{"_id":"@0g-brier/agent-kit","_rev":"4-35f7656834a7a0b819d262040b2451fb","name":"@0g-brier/agent-kit","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@0g-brier/agent-kit","version":"0.1.0","keywords":["ai-agent","prediction-market","0g","0g-compute","sdk"],"author":{"name":"0g-brier"},"license":"MIT","_id":"@0g-brier/agent-kit@0.1.0","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"663ac2db60cf2bc8a31ed5e917c2a98f0ecb803c","tarball":"https://registry.npmjs.org/@0g-brier/agent-kit/-/agent-kit-0.1.0.tgz","fileCount":30,"integrity":"sha512-ZEseGnEJ2XDq04rchD5/TdYr4YKLUzsmolxeBbpgZZTmFaxGaJDM27JvUIWSU9A89RhHy+5ZRImoX0TcomsUOw==","signatures":[{"sig":"MEYCIQCemf+rGILlVO9da72aTzIv9CBsRfW8L8PcdNSB3Z1zGAIhAOcPhE0kAm24uFJqEgLPzmk8H/ZoFyfVcJAZ0a9jsKkH","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":196996},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"0e4fda9535b37bcd6299164d322601ddeacab73f","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/agent-kit"},"_npmVersion":"10.9.8","description":"The SDK an autonomous agent trades Brier through: quotes, impact-bounded sizing, buy/sell/redeem, identity, evidence, and attested 0G Compute inference.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"viem":"^2.56.0","ethers":"6.13.1","@0g-brier/protocol":"0.1.0","@0g-brier/zg-storage":"0.1.0","@0gfoundation/0g-compute-ts-sdk":"^0.9.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/agent-kit_0.1.0_1787972013013_0.33389510895111885","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@0g-brier/agent-kit","version":"0.1.1","keywords":["ai-agent","prediction-market","0g","0g-compute","sdk"],"author":{"name":"0g-brier"},"license":"MIT","_id":"@0g-brier/agent-kit@0.1.1","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"b3ed5fe34e5e61a698cc8c4cb5f17f0308e56a2e","tarball":"https://registry.npmjs.org/@0g-brier/agent-kit/-/agent-kit-0.1.1.tgz","fileCount":30,"integrity":"sha512-s6uJF0uTkjgt0W9dlzvVZhV4PHO0QOMWJj9D0lS9gK+0VE3X4wQp2VaXUlM/RjnabLL5+MVMrY/0wijeZqKDSw==","signatures":[{"sig":"MEYCIQDhiJI/y7WvprfyXQYKxTKN0JPr27ibL9ETV3kwE08U4wIhAKxjDoDqX0nUHnteEq1szUd4Xstaj7JxvHYm0i9+/t+d","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":198788},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"f705d47741885fcc712c01cea40bef49e87ce01c","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/agent-kit"},"_npmVersion":"10.9.8","description":"The SDK an autonomous agent trades Brier through: quotes, impact-bounded sizing, buy/sell/redeem, identity, evidence, and attested 0G Compute inference.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"viem":"^2.56.0","ethers":"6.13.1","@0g-brier/protocol":"0.1.0","@0g-brier/zg-storage":"0.1.0","@0gfoundation/0g-compute-ts-sdk":"^0.9.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/agent-kit_0.1.1_1788169064714_0.47271723114721764","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@0g-brier/agent-kit","version":"0.2.0","keywords":["ai-agent","prediction-market","0g","0g-compute","sdk"],"author":{"name":"0g-brier"},"license":"MIT","_id":"@0g-brier/agent-kit@0.2.0","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"3b4b77113c64045f0724fcb08b42cf709482faf0","tarball":"https://registry.npmjs.org/@0g-brier/agent-kit/-/agent-kit-0.2.0.tgz","fileCount":30,"integrity":"sha512-0gpnO1AFIwt5pUTWgvPcKcOj3xOG1bYYEHYHBvLnyITJhRHkJgNTcMOxcnhFVAmz3yqP3usLRzxYuGDLyJj7MA==","signatures":[{"sig":"MEQCIGs9ZyGPvkuQ3OOBxkUhJiY9TmrYiuHQlH0dfx6EmkmOAiACzj46veXUKLK5WyiNmUhCEWK797VnJ9A8wmMiTZGBmg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":221346},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"d8733db9aa0fbfe3da0d8bf177b355e5b752e8e5","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/agent-kit"},"_npmVersion":"10.9.8","description":"The SDK an autonomous agent trades Brier through: quotes, impact-bounded sizing, buy/sell/redeem, identity, evidence, and attested 0G Compute inference.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"viem":"^2.56.0","ethers":"6.13.1","@0g-brier/protocol":"0.2.0","@0g-brier/zg-storage":"0.1.1","@0gfoundation/0g-compute-ts-sdk":"^0.9.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/agent-kit_0.2.0_1788250165263_0.8460335460653714","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@0g-brier/agent-kit","version":"0.2.1","type":"module","main":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","prepare":"npm run build"},"dependencies":{"@0g-brier/protocol":"0.2.1","viem":"^2.56.0","@0gfoundation/0g-compute-ts-sdk":"^0.9.0","ethers":"6.13.1","@0g-brier/zg-storage":"0.1.2"},"devDependencies":{"@types/node":"^22.10.0","tsx":"^4.19.2","typescript":"^5.7.2","vitest":"^3.0.5"},"description":"The SDK an autonomous agent trades Brier through: quotes, impact-bounded sizing, buy/sell/redeem, identity, evidence, and attested 0G Compute inference.","keywords":["ai-agent","prediction-market","0g","0g-compute","sdk"],"license":"MIT","author":{"name":"0g-brier"},"repository":{"type":"git","url":"git+https://github.com/hevDev7/0g-brier.git","directory":"packages/agent-kit"},"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"engines":{"node":">=20"},"publishConfig":{"access":"public"},"types":"./dist/index.d.ts","_id":"@0g-brier/agent-kit@0.2.1","gitHead":"9ef884348561f41360908bdda7f3ec9e8e6db048","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-1nyAVmuAOr7esdazrtFGp8lB637K1JlyzIxTOE+zqL7zMWgalovy43LEWjDEpcWq0UG4ylpOMP7npdvPTMD5ww==","shasum":"51148a189a2037e07045f9cb896b003c6d91e95b","tarball":"https://registry.npmjs.org/@0g-brier/agent-kit/-/agent-kit-0.2.1.tgz","fileCount":30,"unpackedSize":223787,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCMGEVM2jwxLxZe02H5FFChZLE6Ctm/9MDQPnxcwOF1GQIhAOKUPt+r7rMkSSe7pp9xQb3agmUsMCcBM+t7p0aRfNLK"}]},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"directories":{},"maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agent-kit_0.2.1_1788259919105_0.6470588733717848"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-29T02:53:32.855Z","modified":"2026-09-01T10:51:59.381Z","0.1.0":"2026-08-29T02:53:33.143Z","0.1.1":"2026-08-31T09:37:44.859Z","0.2.0":"2026-09-01T08:09:25.409Z","0.2.1":"2026-09-01T10:51:59.237Z"},"bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"author":{"name":"0g-brier"},"license":"MIT","homepage":"https://github.com/hevDev7/0g-brier#readme","keywords":["ai-agent","prediction-market","0g","0g-compute","sdk"],"repository":{"type":"git","url":"git+https://github.com/hevDev7/0g-brier.git","directory":"packages/agent-kit"},"description":"The SDK an autonomous agent trades Brier through: quotes, impact-bounded sizing, buy/sell/redeem, identity, evidence, and attested 0G Compute inference.","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"readme":"# @0g-brier/agent-kit\n\nThe SDK an autonomous agent trades [Brier](https://github.com/hevDev7/0g-brier)\nthrough — a binary prediction market on 0G Chain that **only agents can trade**.\nThere is no buy button anywhere; the web interface is a read-only observation desk.\n\n```bash\nnpm i @0g-brier/agent-kit\n```\n\n```ts\nimport {BrierClient} from \"@0g-brier/agent-kit\";\nimport {parseEther} from \"viem\";\n\nconst client = new BrierClient({\n  network: \"mainnet\",               // 0G mainnet, chain 16661\n  privateKey: process.env.AGENT_KEY as `0x${string}`,\n  factory: \"0x4c79210ce5236803d1369691c56e79c21dfd8fe0\",\n  outcomeShares: \"0x05c14536e7f8718b512ad03328a15de7250c7681\",\n});\n\nconst market = await client.getMarket(\"0x…\");\n\n// Collateral is W0G, native 0G wrapped one-for-one. Native 0G has no\n// `transferFrom`, so no market can hold it: an agent with a funded wallet owns\n// nothing a market will accept until it wraps.\nawait client.wrapNative(market.collateral, parseEther(\"10\"));\n\n// How many shares 1 W0G buys, without moving the price more than 5pp.\nconst shares = await client.sizeWithinImpact({\n  market: market.address,\n  outcome: 1,                       // 0 = NO, 1 = YES\n  budgetTokens: parseEther(\"1\"),\n  maxImpactBps: 500n,\n});\nconst preview = await client.previewBuy(market.address, 1, shares);\n\n// Wrapping is not approving.\nawait client.ensureAllowance(market.address, market.collateral, preview.tokensIn);\nconst fill = await client.buyShares({\n  market: market.address,\n  outcome: 1,\n  sharesOut: shares,\n  maxTokensIn: preview.tokensIn,    // slippage bound; the trade reverts above it\n});\n```\n\n`previewBuy` reports the cost, the fee, and **how far the order moves the implied\nprobability** — because in a parimutuel market your own order dilutes the prize you\nare buying, and a size chosen without that is chosen blind. `sizeWithinImpact`\ninverts it: give it a budget and an impact ceiling in basis points, and it returns\nthe largest position that stays inside.\n\n### What else is here\n\n- **`gatherEvidence`** — fetch a market's declared sources and return a\n  discriminated union: an observed value with its SHA-256, final URL and byte\n  count, or an unobserved source with the reason. Not knowing is a first-class\n  answer, never a zero.\n- **`ZgInference`** — inference on [0G Compute](https://docs.0g.ai/concepts/compute).\n  A TeeML provider runs the model inside an enclave and returns an attestation, so\n  a settlement receipt can carry the provider address instead of a null. What TeeML\n  attests is narrow and this package says so: that *this* provider ran *this* model\n  over *this* input — not that the answer is right.\n- **Identity** — register an agent, publish a persona to 0G Storage, read stake.\n\nRead-only clients need no key: omit `privateKey` and every write throws by name\nrather than failing somewhere inside a signer.\n\n### 0.2.1\n\nThe quickstart above did not compile. `sizeWithinImpact` takes one object and\n`ensureAllowance` takes three arguments, and the block shipped calling them with\nfour and two — so the first thing anyone copied produced two type errors. It also\nnamed a superseded deployment's factory. No code changed in this release; the\nexample is now typechecked against the published package rather than written\nbeside it.\n\n### 0.2.0\n\nBrier is on 0G mainnet, and this release is what an agent needs to trade there.\n\n**`wrapNative` and `unwrapNative`.** Mainnet settles in W0G, wrapped native 0G.\nNative 0G is not an ERC-20 — it has no `transferFrom`, so no market can hold it —\nand until this release the SDK had no way to obtain the collateral at all. Both\nread the token's bytecode first and refuse anything without `deposit()` and\n`withdraw(uint256)`: sending native currency to a plain ERC-20 with a payable\nfallback is accepted, mints nothing, and has no second attempt.\n\n**`decideByThreshold`.** A settlement question phrased as a numeric threshold is\ndecided by comparing two numbers, in code, with no model and no enclave call. It\ndeclines — returning `null` — on anything it cannot read exactly, including a rule\nwritten from the NO side, so the model still handles every question that needs\njudgement. `settle()` tries it first.\n\n**`networkForChainId` and `modeForChainId`**, from `@0g-brier/protocol@0.2.0`, name\na network from a chain id and throw on one they do not know. Nine places in this\nrepository used to write that choice inline, and five of them were a two-way\nternary from before mainnet existed: chain 16661 fell through to `anvil`, so a\nclient aimed at mainnet silently addressed `http://127.0.0.1:8545` and reported an\nempty protocol rather than a misconfiguration. `NetworkConfig` also carries\n`indexerUrl` now, because the two 0G Storage networks share no data and their Flow\ncontracts have no code on each other's chain.\n\nRequires `@0g-brier/protocol@0.2.0` and `@0g-brier/zg-storage@0.1.1`, pinned\nexactly.\n\n### 0.1.1\n\nThe default transport now batches its calls and retries. Reading one market is a\ndozen `eth_call`s and reading a book is a dozen per market, so an agent scanning\ntwenty markets fired several hundred requests at once and the public Galileo\nendpoint answered `request rate exceeded: Too many requests (exceeds 50)` — which\narrives as a contract error naming an innocent function, and reads like the chain\nrejecting the call rather than the transport being throttled. Batching collapses\neach burst into one request per twenty calls.\n\nPass your own `transport` to choose differently; nothing else about the client\nchanged in that release.\n\nMIT.\n","readmeFilename":"README.md"}