feat: add 0xWork marketplace integration for agent revenue#254
Open
tyxben wants to merge 2 commits intoConway-Research:mainfrom
Open
feat: add 0xWork marketplace integration for agent revenue#254tyxben wants to merge 2 commits intoConway-Research:mainfrom
tyxben wants to merge 2 commits intoConway-Research:mainfrom
Conversation
Add 0xWork as a revenue source so agents can earn USDC by completing marketplace tasks. This is the first income path for automatons — until now agents could only spend, not earn. Changes: - src/conway/oxwork.ts: HTTP client for 0xWork API (auth, browse, claim, submit, status) - 4 new agent tools: oxwork_browse, oxwork_claim, oxwork_submit, oxwork_status - scan_oxwork_tasks heartbeat task: auto-discovers paid tasks every 30min at zero inference cost - New "service_revenue" transaction type for proper income tracking - Solana wallet guards: 0xWork uses EIP-191 auth, Solana agents get a clear error instead of a cryptic failure - 17 unit tests with mocked fetch covering all API functions No new dependencies — uses native fetch() and existing viem wallet.
7cf61be to
18e8878
Compare
- Add oxwork_browse/oxwork_status to EXTERNAL_SOURCE_TOOLS for prompt injection sanitization on untrusted task descriptions - Fix premature revenue recording: oxwork_submit now records as tool_use instead of service_revenue (bounty isn't paid until poster approves) - Add ownership pre-check in oxwork_submit to verify the agent owns the task claim before attempting submission - Add 15s AbortSignal timeout to all fetch calls to prevent blocking the heartbeat on a hung API - Add failure backoff to scan_oxwork_tasks (skips one interval after error, matching social inbox backoff pattern) - Reduce auth log from info to debug, redact wallet address - URL-encode all path parameters for defense in depth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #192 — adds 0xWork as the first revenue source for automatons.
Until now, agents could only spend (inference, x402 payments, credit topups). This PR gives them a direct path to earn USDC: browse tasks → claim → do work → submit → get paid via on-chain escrow.
What's new
src/conway/oxwork.ts— HTTP client for the 0xWork API (auth via EIP-191 wallet signature, task browsing, claiming, submitting work)src/agent/tools.ts:oxwork_browse— discover open paid tasks (filter by category/bounty)oxwork_claim— claim a task to begin working on itoxwork_submit— submit completed work for poster reviewoxwork_status— check status of your claimed/submitted tasksscan_oxwork_tasksheartbeat task — auto-discovers paid tasks every 30 minutes at zero inference cost (pure HTTP)service_revenuetransaction type — proper income tracking in the financial ledger (also counted incolony_financial_report)src/__tests__/oxwork.test.ts— 17 unit tests with mocked fetch covering all API functionsImprovements over v1
main(includes Solana integration, pretty-logs, etc.)service_revenuetransaction type so revenue is tracked separately from transfersoxwork_submitnow records the bounty amount asservice_revenuein the transaction tablecolony_financial_reportnow countsservice_revenuein revenue totalsNotes
/auth/nonce)fetch()and existing viem walletTest plan
tsc --noEmitpasses (zero type errors)oxwork_browseagainst live API, verify task listing