@moonbeam-foundation/sdk 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +378 -0
  3. package/bin/moonbeam.mjs +56 -0
  4. package/dist/acp/coverage.d.ts +36 -0
  5. package/dist/acp/coverage.d.ts.map +1 -0
  6. package/dist/acp/coverage.js +51 -0
  7. package/dist/acp/coverage.js.map +1 -0
  8. package/dist/acp/events.d.ts +201 -0
  9. package/dist/acp/events.d.ts.map +1 -0
  10. package/dist/acp/events.js +201 -0
  11. package/dist/acp/events.js.map +1 -0
  12. package/dist/acp/hex.d.ts +29 -0
  13. package/dist/acp/hex.d.ts.map +1 -0
  14. package/dist/acp/hex.js +51 -0
  15. package/dist/acp/hex.js.map +1 -0
  16. package/dist/acp/lifecycle-types.d.ts +11 -0
  17. package/dist/acp/lifecycle-types.d.ts.map +1 -0
  18. package/dist/acp/lifecycle-types.js +8 -0
  19. package/dist/acp/lifecycle-types.js.map +1 -0
  20. package/dist/acp/lifecycle.d.ts +78 -0
  21. package/dist/acp/lifecycle.d.ts.map +1 -0
  22. package/dist/acp/lifecycle.js +224 -0
  23. package/dist/acp/lifecycle.js.map +1 -0
  24. package/dist/acp/outcome.d.ts +45 -0
  25. package/dist/acp/outcome.d.ts.map +1 -0
  26. package/dist/acp/outcome.js +104 -0
  27. package/dist/acp/outcome.js.map +1 -0
  28. package/dist/acp/pipeline.d.ts +30 -0
  29. package/dist/acp/pipeline.d.ts.map +1 -0
  30. package/dist/acp/pipeline.js +25 -0
  31. package/dist/acp/pipeline.js.map +1 -0
  32. package/dist/acp/recourse.d.ts +74 -0
  33. package/dist/acp/recourse.d.ts.map +1 -0
  34. package/dist/acp/recourse.js +234 -0
  35. package/dist/acp/recourse.js.map +1 -0
  36. package/dist/acp/registry.d.ts +62 -0
  37. package/dist/acp/registry.d.ts.map +1 -0
  38. package/dist/acp/registry.js +86 -0
  39. package/dist/acp/registry.js.map +1 -0
  40. package/dist/acp/transitions.d.ts +82 -0
  41. package/dist/acp/transitions.d.ts.map +1 -0
  42. package/dist/acp/transitions.js +106 -0
  43. package/dist/acp/transitions.js.map +1 -0
  44. package/dist/actors/index.d.ts +84 -0
  45. package/dist/actors/index.d.ts.map +1 -0
  46. package/dist/actors/index.js +133 -0
  47. package/dist/actors/index.js.map +1 -0
  48. package/dist/actors/track-record.d.ts +79 -0
  49. package/dist/actors/track-record.d.ts.map +1 -0
  50. package/dist/actors/track-record.js +105 -0
  51. package/dist/actors/track-record.js.map +1 -0
  52. package/dist/adapters/acp.d.ts +48 -0
  53. package/dist/adapters/acp.d.ts.map +1 -0
  54. package/dist/adapters/acp.js +74 -0
  55. package/dist/adapters/acp.js.map +1 -0
  56. package/dist/adapters/port.d.ts +53 -0
  57. package/dist/adapters/port.d.ts.map +1 -0
  58. package/dist/adapters/port.js +2 -0
  59. package/dist/adapters/port.js.map +1 -0
  60. package/dist/adapters/stamp.d.ts +57 -0
  61. package/dist/adapters/stamp.d.ts.map +1 -0
  62. package/dist/adapters/stamp.js +114 -0
  63. package/dist/adapters/stamp.js.map +1 -0
  64. package/dist/client/index.d.ts +123 -0
  65. package/dist/client/index.d.ts.map +1 -0
  66. package/dist/client/index.js +78 -0
  67. package/dist/client/index.js.map +1 -0
  68. package/dist/connect/attestation.d.ts +64 -0
  69. package/dist/connect/attestation.d.ts.map +1 -0
  70. package/dist/connect/attestation.js +62 -0
  71. package/dist/connect/attestation.js.map +1 -0
  72. package/dist/connect/http.d.ts +36 -0
  73. package/dist/connect/http.d.ts.map +1 -0
  74. package/dist/connect/http.js +51 -0
  75. package/dist/connect/http.js.map +1 -0
  76. package/dist/connect/logs.d.ts +53 -0
  77. package/dist/connect/logs.d.ts.map +1 -0
  78. package/dist/connect/logs.js +42 -0
  79. package/dist/connect/logs.js.map +1 -0
  80. package/dist/connect/result.d.ts +49 -0
  81. package/dist/connect/result.d.ts.map +1 -0
  82. package/dist/connect/result.js +41 -0
  83. package/dist/connect/result.js.map +1 -0
  84. package/dist/core/actors.d.ts +13 -0
  85. package/dist/core/actors.d.ts.map +1 -0
  86. package/dist/core/actors.js +57 -0
  87. package/dist/core/actors.js.map +1 -0
  88. package/dist/core/clock.d.ts +55 -0
  89. package/dist/core/clock.d.ts.map +1 -0
  90. package/dist/core/clock.js +36 -0
  91. package/dist/core/clock.js.map +1 -0
  92. package/dist/core/money.d.ts +32 -0
  93. package/dist/core/money.d.ts.map +1 -0
  94. package/dist/core/money.js +57 -0
  95. package/dist/core/money.js.map +1 -0
  96. package/dist/core/pool.d.ts +71 -0
  97. package/dist/core/pool.d.ts.map +1 -0
  98. package/dist/core/pool.js +98 -0
  99. package/dist/core/pool.js.map +1 -0
  100. package/dist/core/settle.d.ts +50 -0
  101. package/dist/core/settle.d.ts.map +1 -0
  102. package/dist/core/settle.js +175 -0
  103. package/dist/core/settle.js.map +1 -0
  104. package/dist/core/types.d.ts +109 -0
  105. package/dist/core/types.d.ts.map +1 -0
  106. package/dist/core/types.js +6 -0
  107. package/dist/core/types.js.map +1 -0
  108. package/dist/erc8004/index.d.ts +94 -0
  109. package/dist/erc8004/index.d.ts.map +1 -0
  110. package/dist/erc8004/index.js +118 -0
  111. package/dist/erc8004/index.js.map +1 -0
  112. package/dist/erc8004/registry.generated.d.ts +17 -0
  113. package/dist/erc8004/registry.generated.d.ts.map +1 -0
  114. package/dist/erc8004/registry.generated.js +20 -0
  115. package/dist/erc8004/registry.generated.js.map +1 -0
  116. package/dist/erc8183/index.d.ts +114 -0
  117. package/dist/erc8183/index.d.ts.map +1 -0
  118. package/dist/erc8183/index.js +109 -0
  119. package/dist/erc8183/index.js.map +1 -0
  120. package/dist/index.d.ts +81 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/index.js +73 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/judge/index.d.ts +64 -0
  125. package/dist/judge/index.d.ts.map +1 -0
  126. package/dist/judge/index.js +64 -0
  127. package/dist/judge/index.js.map +1 -0
  128. package/dist/launcher/index.d.ts +109 -0
  129. package/dist/launcher/index.d.ts.map +1 -0
  130. package/dist/launcher/index.js +144 -0
  131. package/dist/launcher/index.js.map +1 -0
  132. package/dist/negotiate/index.d.ts +166 -0
  133. package/dist/negotiate/index.d.ts.map +1 -0
  134. package/dist/negotiate/index.js +150 -0
  135. package/dist/negotiate/index.js.map +1 -0
  136. package/dist/onboard/index.d.ts +533 -0
  137. package/dist/onboard/index.d.ts.map +1 -0
  138. package/dist/onboard/index.js +509 -0
  139. package/dist/onboard/index.js.map +1 -0
  140. package/dist/onboarding/index.d.ts +177 -0
  141. package/dist/onboarding/index.d.ts.map +1 -0
  142. package/dist/onboarding/index.js +390 -0
  143. package/dist/onboarding/index.js.map +1 -0
  144. package/dist/pools/index.d.ts +191 -0
  145. package/dist/pools/index.d.ts.map +1 -0
  146. package/dist/pools/index.js +244 -0
  147. package/dist/pools/index.js.map +1 -0
  148. package/docs/demo.gif +0 -0
  149. package/docs/demo.tape +14 -0
  150. package/examples/01-settle-a-covered-job.mjs +18 -0
  151. package/examples/02-negotiate-a-hire.mjs +21 -0
  152. package/examples/03-end-to-end-offline.mjs +27 -0
  153. package/examples/10-grade-evidence.mjs +12 -0
  154. package/examples/11-grade-facts.mjs +10 -0
  155. package/examples/12-grade-answers.mjs +8 -0
  156. package/examples/13-grade-verdict.mjs +10 -0
  157. package/examples/14-grade-record.mjs +11 -0
  158. package/examples/15-grade-end-the-job.mjs +11 -0
  159. package/examples/16-grade-verify.mjs +9 -0
  160. package/examples/17-grade-live.mjs +14 -0
  161. package/examples/20-onboard-client.mjs +8 -0
  162. package/examples/21-onboard-provider.mjs +9 -0
  163. package/examples/22-onboard-evaluator.mjs +7 -0
  164. package/examples/23-onboard-backer.mjs +8 -0
  165. package/examples/30-read-a-real-job.mjs +19 -0
  166. package/examples/31-read-the-ending.mjs +15 -0
  167. package/examples/32-read-live-from-base.mjs +33 -0
  168. package/examples/33-read-many-jobs.mjs +12 -0
  169. package/examples/40-the-article.mjs +78 -0
  170. package/examples/README.md +93 -0
  171. package/examples/data/answers.mjs +8 -0
  172. package/examples/data/base-grade.recorded.json +72 -0
  173. package/examples/data/pilot-grade.recorded.json +78 -0
  174. package/examples/data/pilot-hire.json +35 -0
  175. package/examples/data/terms.mjs +11 -0
  176. package/examples/data/virtuals-job-74926.json +74 -0
  177. package/examples/data/virtuals-job-rejected.json +74 -0
  178. package/package.json +124 -0
  179. package/skills/moonbeam-acp-decoding/SKILL.md +80 -0
  180. package/skills/moonbeam-actor-backer/SKILL.md +81 -0
  181. package/skills/moonbeam-actor-challenger/SKILL.md +62 -0
  182. package/skills/moonbeam-actor-client/SKILL.md +67 -0
  183. package/skills/moonbeam-actor-doubter/SKILL.md +55 -0
  184. package/skills/moonbeam-actor-evaluator/SKILL.md +67 -0
  185. package/skills/moonbeam-actor-provider/SKILL.md +63 -0
  186. package/skills/moonbeam-assurance/SKILL.md +58 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Negotiation — how two agents that have never met arrive at terms.
3
+ *
4
+ * The rest of this SDK starts at `settle()`, which takes `JobTerms` as given.
5
+ * This module is the step before: it is the pure state machine that turns an
6
+ * open intent into terms both sides are bound by, and it exists because the
7
+ * alternative on the floor today is that a buyer simply *names* a worker and
8
+ * funds the job directly. Naming works. It does not discover a price, it does
9
+ * not let an unknown counterparty compete, and it gives neither side a record
10
+ * of what was agreed before the work started.
11
+ *
12
+ * The design rule, and the reason this is not just a message bus: **a bid is an
13
+ * offer to be bound, so it must be checkable before it is accepted.** Every bid
14
+ * that enters this machine is validated against the invariants `settle()` will
15
+ * later assume — the deposit outweighs the job, cover is residual behind that
16
+ * deposit, the pool can actually pay what it promises. A bid that fails is
17
+ * refused by name, at the moment it is made, rather than accepted and then
18
+ * discovered to be unsettleable when money is already locked.
19
+ *
20
+ * That is the whole difference between negotiation and haggling: at the end of
21
+ * this machine you hold terms that the settlement core can already price, and
22
+ * an acceptance digest that neither side can quietly edit afterwards.
23
+ *
24
+ * Pure by construction: no clock, no chain, no I/O. The caller supplies the
25
+ * epoch. Nothing here signs anything or sends anything, so the invariants are
26
+ * properties you can test rather than claims you have to trust.
27
+ */
28
+ import { min, sum, clampToZero } from '../core/money.js';
29
+ /** Open an intent for bidding. */
30
+ export function open(intent) {
31
+ return { intent, phase: 'open', bids: [], refused: [] };
32
+ }
33
+ /**
34
+ * Check a bid against the invariants settlement will later assume.
35
+ *
36
+ * Exported on its own so a bidder can check its own bid before making it, and
37
+ * get the same answer the floor will give.
38
+ */
39
+ export function checkBid(intent, bid, cover, now) {
40
+ if (bid.intentId !== intent.id) {
41
+ return { code: 'WRONG_INTENT', reason: 'This bid names a different intent.' };
42
+ }
43
+ if (now > intent.closesAt) {
44
+ return { code: 'INTENT_CLOSED', reason: 'The intent closed before this bid arrived.' };
45
+ }
46
+ const missing = intent.capabilities.filter((c) => !bid.capabilities.includes(c));
47
+ if (missing.length > 0) {
48
+ return {
49
+ code: 'CAPABILITY_MISSING',
50
+ reason: `The intent asks for ${missing.join(', ')}, which this agent has not published.`,
51
+ };
52
+ }
53
+ if (bid.pay > intent.maxPay) {
54
+ return { code: 'ABOVE_MAX_PAY', reason: 'The bid asks more than the buyer will pay.' };
55
+ }
56
+ /* The deterrence rule, enforced at the moment the offer is made rather than
57
+ discovered at settlement: a worker who cheats must lose more than the job
58
+ pays it, or the arithmetic argues for cheating. */
59
+ if (bid.deposit <= bid.pay) {
60
+ return {
61
+ code: 'DEPOSIT_BELOW_JOB',
62
+ reason: 'The bond must outweigh the job, so that cheating always costs more than it pays.',
63
+ };
64
+ }
65
+ /* Bonds first, pool second: the pool covers only what the bond cannot, and it
66
+ must actually be able to cover that residual. A quote that cannot pay what
67
+ it promises is refused here rather than failing when a buyer needs it. */
68
+ const residual = clampToZero(intent.damage - bid.deposit);
69
+ if (cover.poolCapital < residual) {
70
+ return {
71
+ code: 'COVER_CANNOT_PAY',
72
+ reason: 'Committed cover is smaller than the residual it would have to pay behind this bond.',
73
+ };
74
+ }
75
+ return null;
76
+ }
77
+ /** Record a bid, or record why it was refused. Never throws. */
78
+ export function bid(n, b, cover, now) {
79
+ if (n.phase !== 'open')
80
+ return n;
81
+ const refusal = checkBid(n.intent, b, cover, now);
82
+ if (refusal)
83
+ return { ...n, refused: [...n.refused, { ...refusal, bid: b }] };
84
+ return { ...n, bids: [...n.bids, b] };
85
+ }
86
+ /** Close an intent whose window has passed, with no winner. */
87
+ export function expire(n, now) {
88
+ if (n.phase !== 'open' || now <= n.intent.closesAt)
89
+ return n;
90
+ return { ...n, phase: 'expired' };
91
+ }
92
+ /**
93
+ * The cheapest bid that also cleared every check.
94
+ *
95
+ * Cheapest, not "best": ranking on anything softer than price would need a
96
+ * reputation model this layer does not have, and inventing one here would hide
97
+ * a judgement call inside a function that looks like arithmetic. A caller with
98
+ * its own ranking can read `bids` and choose.
99
+ */
100
+ export function bestBid(n) {
101
+ if (n.bids.length === 0)
102
+ return null;
103
+ return n.bids.reduce((a, b) => (b.pay < a.pay ? b : a));
104
+ }
105
+ /**
106
+ * Accept a bid and produce the terms settlement will price.
107
+ *
108
+ * This is the join between the two halves of the SDK: everything before it is
109
+ * discovery and agreement, everything after it is `settle()`. The terms that
110
+ * come out are complete, so no field is filled in later by anybody.
111
+ */
112
+ export function accept(n, winner, cover) {
113
+ if (n.phase !== 'open') {
114
+ return { code: 'INTENT_CLOSED', reason: 'This negotiation is no longer open.' };
115
+ }
116
+ if (!n.bids.some((b) => b.agent === winner.agent && b.pay === winner.pay)) {
117
+ return { code: 'WRONG_INTENT', reason: 'That bid is not among the ones that cleared.' };
118
+ }
119
+ const terms = {
120
+ pay: winner.pay,
121
+ premium: cover.premium,
122
+ deposit: winner.deposit,
123
+ evaluatorBond: cover.evaluatorBond,
124
+ poolCapital: cover.poolCapital,
125
+ damage: n.intent.damage,
126
+ };
127
+ return { negotiation: { ...n, phase: 'agreed', accepted: winner }, terms };
128
+ }
129
+ /**
130
+ * What the buyer locks when the job opens: the work, plus cover.
131
+ *
132
+ * Stated as its parts rather than a total. A single summed figure mixes the
133
+ * purchase with the fee and drifts whenever the illustration does; the parts
134
+ * are what a reader can actually act on.
135
+ */
136
+ export function lockedByBuyer(terms) {
137
+ return { pay: terms.pay, premium: terms.premium, total: sum([terms.pay, terms.premium]) };
138
+ }
139
+ /**
140
+ * How much of `damage` the bond covers, and how much the pool would.
141
+ *
142
+ * The same split `settle()` applies, exposed before anyone commits, so a buyer
143
+ * can see where its cover actually comes from while it still has a choice.
144
+ */
145
+ export function coverSplit(terms) {
146
+ const fromDeposit = min(terms.damage, terms.deposit);
147
+ const fromPool = min(clampToZero(terms.damage - terms.deposit), terms.poolCapital);
148
+ return { fromDeposit, fromPool };
149
+ }
150
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/negotiate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAsGzD,kCAAkC;AAClC,MAAM,UAAU,IAAI,CAAC,MAAc;IACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,GAAQ,EAAE,KAAiB,EAAE,GAAW;IAC/E,IAAI,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,oCAAoC,EAAE,CAAC;IAChF,CAAC;IACD,IAAI,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC1B,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,4CAA4C,EA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+ export type Address = Hex;
4
+ /** The ERC-8183 job contract most observed Base jobs live in (Virtuals ACP). */
5
+ export declare const BASE_JOB_CONTRACT: "0x238E541BfefD82238730D00a2208E5497F1832E0";
6
+ /** USDC on Base, 6 decimals. */
7
+ export declare const BASE_USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
8
+ /** The assurance hook on Base: deposit, premium and verdict attached to a job. */
9
+ export declare const BASE_ASSURANCE_HOOK: "0xc0578657Eda85e0a246771aa1839ce79b54eE80d";
10
+ /** One ERC-4626 cover pool per seller comes from here. */
11
+ export declare const BASE_POOL_FACTORY: "0x91f078D10E3f0D05fEBcEA35f114063c696aef54";
12
+ /** The ERC-8004 identity registry, one address on every chain it is deployed to. */
13
+ export declare const ERC8004_IDENTITY_REGISTRY: "0x8004a169fb4a3325136eb29fa0ceb6d2e539a432";
14
+ export declare const BASE_CHAIN_ID: 8453;
15
+ export interface BaseAgentCandidate {
16
+ chainId: 8453;
17
+ /** the seller of record: receives the price, locks the deposit */
18
+ address: Address;
19
+ /** ERC-8004 identity registry id; null when the agent is only a card */
20
+ agentId: bigint | null;
21
+ /** /.well-known/agent.json or the MCP server URL */
22
+ cardUrl: string | null;
23
+ /** what a buyer actually calls */
24
+ endpoint: string | null;
25
+ protocol: 'mcp' | 'a2a' | 'x402' | 'n8n' | 'erc8183' | 'unknown';
26
+ /** from the card's services[] or tools/list */
27
+ skills: string[];
28
+ wire: 'ready' | 'x402' | 'silent' | 'unreachable' | 'unprobed';
29
+ source: {
30
+ feed: 'flows' | 'registry' | 'jobs';
31
+ seenAt: number;
32
+ };
33
+ }
34
+ export interface Attestation {
35
+ /** the Registered event seen on the identity registry */
36
+ identity: {
37
+ ok: boolean;
38
+ tx?: Hex;
39
+ block?: number;
40
+ };
41
+ /** the wire probe answered in the agent's own protocol */
42
+ reachability: {
43
+ ok: boolean;
44
+ protocol?: string;
45
+ probedAt?: number;
46
+ wall?: {
47
+ amount: string;
48
+ payTo: Address;
49
+ } | null;
50
+ };
51
+ /** tools/list or the card's skills */
52
+ capability: {
53
+ ok: boolean;
54
+ tools?: string[];
55
+ skills?: string[];
56
+ };
57
+ /** derived, never self-reported */
58
+ state: 'ATTESTED' | 'MANIFEST_ONLY' | 'CLAIMED';
59
+ }
60
+ export interface HireTerms {
61
+ chainId: 8453;
62
+ jobContract: typeof BASE_JOB_CONTRACT;
63
+ token: typeof BASE_USDC;
64
+ buyer: Address;
65
+ seller: Address;
66
+ /** in token units (USDC has 6 decimals) */
67
+ price: bigint;
68
+ /** unix seconds; past it anyone may trigger the refund */
69
+ deadline: number;
70
+ /** 1.2 × price, the seller's own; checked at funding */
71
+ deposit: bigint;
72
+ /** from the record; null = unknown (thin) */
73
+ premium: {
74
+ low: number;
75
+ high: number;
76
+ rate: number;
77
+ label: string;
78
+ } | null;
79
+ task: string;
80
+ skills: string[];
81
+ }
82
+ export type UnsignedCall = {
83
+ chainId: number;
84
+ to: Address;
85
+ data: Hex;
86
+ value: '0x0';
87
+ step: string;
88
+ signer: 'buyer' | 'seller' | 'anyone';
89
+ effect: string;
90
+ };
91
+ export interface Delivery {
92
+ /** bytes32 on the hook; the ERC-8183 id for the market */
93
+ jobId: Hex;
94
+ /** sha256 of the canonical deliverable, or the reply digest for a tool call */
95
+ evidenceDigest: Hex;
96
+ /** keccak(domain ‖ nonce ‖ payTo ‖ uint64 chainId): binds off-chain work to the job */
97
+ correlator: Hex;
98
+ submittedAt: number;
99
+ tx?: Hex;
100
+ }
101
+ export declare const JEV_OPTIONS: readonly ["delivered_as_specified", "delivered_with_defects", "not_delivered", "cannot_determine"];
102
+ export type JevOption = (typeof JEV_OPTIONS)[number];
103
+ export interface JevGuard {
104
+ /** confidence below the bar is a lean; the ending falls back to the trail decoder */
105
+ bar: 0.8;
106
+ /** the calibrated model; a deterministic mode exists for schema checks */
107
+ mode: 'calibrated';
108
+ /** printed, hashed, part of the decision digest */
109
+ question: string;
110
+ /** closed vocabulary; nothing in it maps to dishonesty */
111
+ options: typeof JEV_OPTIONS;
112
+ quota: {
113
+ free: 3;
114
+ per: 'account' | 'api-key' | 'address';
115
+ burstPerMinute: 5;
116
+ block: {
117
+ calls: 3;
118
+ grid: 15;
119
+ usdcAtPeg: number;
120
+ };
121
+ };
122
+ /** every decision is written to the decision log before use */
123
+ anchor: {
124
+ chain: 36927 | 8453;
125
+ log: Address;
126
+ };
127
+ }
128
+ export interface JevDecision {
129
+ value: JevOption;
130
+ probabilities: Partial<Record<JevOption, number>>;
131
+ confidence: number;
132
+ /** REF → ending; NoGrade means the trail decides */
133
+ ending: 'Settled' | 'Rejected' | 'NoGrade';
134
+ decision: {
135
+ id: string;
136
+ digest: Hex;
137
+ subject_id: Hex;
138
+ anchor: {
139
+ chain: number;
140
+ tx: Hex | null;
141
+ status: 'pending' | 'ok' | 'failed';
142
+ };
143
+ };
144
+ quota: {
145
+ who: string;
146
+ left: number;
147
+ buy?: string;
148
+ };
149
+ }
150
+ export type Ending = 'completed' | 'expired' | 'rejected' | 'cheat';
151
+ export interface Settlement {
152
+ jobId: Hex;
153
+ ending: Ending;
154
+ txs: Hex[];
155
+ /** V5 receipt proof of the settling transaction */
156
+ proof?: {
157
+ url: string;
158
+ superRoot: Hex;
159
+ finalized: boolean;
160
+ };
161
+ }
162
+ export interface SellerRecord {
163
+ seller: Address;
164
+ settled: number;
165
+ cheated: number;
166
+ expired: number;
167
+ open: number;
168
+ /** 95% interval on cheated / (settled + cheated) */
169
+ wilson: [number, number] | null;
170
+ /** n ≥ 5 and width ≤ 0.35 */
171
+ calibrated: boolean;
172
+ premium: {
173
+ low: number;
174
+ high: number;
175
+ rate: number;
176
+ } | null;
177
+ pool: {
178
+ vault: Address | null;
179
+ totalAssets: bigint | null;
180
+ };
181
+ }
182
+ export interface Hireable {
183
+ candidate: BaseAgentCandidate;
184
+ attestation: Attestation;
185
+ record: SellerRecord;
186
+ /** attested identity ∧ wire ready ∧ (record exists ∨ priced as unknown) ∧ premium quotable */
187
+ hireable: boolean;
188
+ /** every failed condition, named */
189
+ why: string[];
190
+ }
191
+ /** deposit ≥ 1.2 × price: a seller must not profit by defaulting */
192
+ export declare const DEPOSIT_FACTOR = 1.2;
193
+ /** confidence below this is a lean, not a verdict */
194
+ export declare const JEV_BAR: 0.8;
195
+ /** free judge calls per user (account, API key or address), ever */
196
+ export declare const QUOTA_FREE: 3;
197
+ /** judge calls per minute per caller */
198
+ export declare const QUOTA_BURST_PER_MINUTE: 5;
199
+ /** a bought block: three calls for fifteen GRID at the oracle peg, paid in USDC */
200
+ export declare const QUOTA_BLOCK: Readonly<{
201
+ readonly calls: 3;
202
+ readonly grid: 15;
203
+ }>;
204
+ /** at most this many blocks in one purchase */
205
+ export declare const QUOTA_MAX_BLOCKS = 20;
206
+ /** the seller's record is calibrated at n ≥ 5 and a Wilson width ≤ 0.35 */
207
+ export declare const RECORD_MIN_N = 5;
208
+ export declare const RECORD_MAX_WIDTH = 0.35;
209
+ /** the hook's grading window after submission, in seconds (what the layer's calls carry) */
210
+ export declare const DEFAULT_GRADE_WINDOW = 604800;
211
+ export declare const DEFAULT_QUESTION = "Was the work delivered as specified?";
212
+ /** The guard as this surface applies it. `anchor` names the decision log the layer writes to today. */
213
+ export declare const DEFAULT_GUARD: JevGuard;
214
+ export declare function isAddress(v: unknown): v is Address;
215
+ export declare function isHex32(v: unknown): v is Hex;
216
+ export declare function isJevOption(v: unknown): v is JevOption;
217
+ export declare function isCandidate(v: unknown): v is BaseAgentCandidate;
218
+ export declare function isDecision(v: unknown): v is JevDecision;
219
+ /** The smallest deposit the rule accepts: ceil(1.2 × price), in token units. */
220
+ export declare function depositFor(price: bigint): bigint;
221
+ /** deposit ≥ 1.2 × price, or the refusal by name. A bid where the seller profits by defaulting is refused at funding. */
222
+ export declare function checkDeposit(price: bigint, deposit: bigint): {
223
+ ok: true;
224
+ } | {
225
+ ok: false;
226
+ code: 'DEPOSIT_BELOW_RULE';
227
+ reason: string;
228
+ required: bigint;
229
+ };
230
+ /** The 95% Wilson interval on k successes in n trials. null when n = 0 (an empty record is unknown, not zero). */
231
+ export declare function wilson(k: number, n: number, z?: number): [number, number] | null;
232
+ /** calibrated = n ≥ 5 and the interval narrower than 0.35 */
233
+ export declare function isCalibrated(settled: number, cheated: number): boolean;
234
+ /** The record a thin seller gets: no interval, not calibrated, premium unknown. Thin is priced as unknown, never refused. */
235
+ export declare function emptyRecord(seller: Address): SellerRecord;
236
+ export interface QuotaStanding {
237
+ free: {
238
+ calls: number;
239
+ used: number;
240
+ left: number;
241
+ };
242
+ credits: {
243
+ left: number;
244
+ blocks: number;
245
+ };
246
+ burst: {
247
+ perMinute: number;
248
+ usedThisMinute: number;
249
+ };
250
+ price: {
251
+ gridPerBlock: number;
252
+ gridUsdc: number;
253
+ usdcPerBlock: number;
254
+ };
255
+ }
256
+ /** Can this caller make one more judge call now, and if not, why and what it costs. */
257
+ export declare function admit(q: QuotaStanding): {
258
+ ok: true;
259
+ lane: 'free' | 'credits';
260
+ leftAfter: number;
261
+ } | {
262
+ ok: false;
263
+ code: 'BURST' | 'QUOTA';
264
+ reason: string;
265
+ buy?: {
266
+ blocks: number;
267
+ usdc: number;
268
+ };
269
+ };
270
+ /** How many blocks cover `calls` more judge calls. */
271
+ export declare function blocksFor(calls: number): number;
272
+ /** blocks × 15 GRID × the oracle peg, in USDC (rounded to the cent-of-a-cent USDC carries: 6 decimals). */
273
+ export declare function priceOfBlocks(blocks: number, gridUsdc: number): number;
274
+ /** Derive the attestation state. Never self-reported: identity is a chain event, reachability a probe, capability a read card. */
275
+ export declare function attestationState(a: {
276
+ identity: {
277
+ ok: boolean;
278
+ };
279
+ reachability: {
280
+ ok: boolean;
281
+ };
282
+ capability: {
283
+ ok: boolean;
284
+ };
285
+ }): Attestation['state'];
286
+ /** A grade to the ending it names, once it clears the bar. Nothing in the vocabulary maps to a cheat: a grade never touches a pool. */
287
+ export declare function decisionEnding(value: JevOption, probabilities: Partial<Record<JevOption, number>>, confidence: number, bar?: number): JevDecision['ending'];
288
+ /**
289
+ * The ending: the trail first, the judge only when the trail cannot decide, and only above the bar.
290
+ * trail says delivered_as_specified → completed
291
+ * trail says delivered_with_defects → rejected
292
+ * trail says not_delivered → expired (nothing arrived; the refund path)
293
+ * trail cannot say, grade clears the bar → completed | rejected as the grade names
294
+ * otherwise → expired: the deadline decides, nobody is paid, the pool pays nothing
295
+ * `cheat` is never produced here. Only an adjudication can name it, and it draws on cover only after the deposit.
296
+ */
297
+ export declare function endingOf(trail: readonly TrailEvent[], decision?: JevDecision, bar?: number): Ending;
298
+ /** What each ending does to the money, in this surface's words. */
299
+ export declare const ENDING_MONEY: Readonly<Record<Ending, string>>;
300
+ /** The hireable predicate with every failed condition named. */
301
+ export declare function hireable(c: BaseAgentCandidate, a: Attestation, r: SellerRecord): Hireable;
302
+ export declare function bytesToHex(b: Uint8Array): Hex;
303
+ export declare function hexToBytes(h: string): Uint8Array;
304
+ export declare function utf8(s: string): Uint8Array;
305
+ /** keccak-256 over bytes: the Ethereum hash, in fifty lines, so nothing here needs a chain library. */
306
+ export declare function keccak256(input: Uint8Array): Uint8Array;
307
+ export declare function keccakHex(input: Uint8Array): Hex;
308
+ /** The first four bytes of keccak(signature): the function selector. */
309
+ export declare function selector(signature: string): Hex;
310
+ /** The hook and token functions this module encodes, by signature. Selectors are re-derived from these in tests and pinned against live calldata. */
311
+ export declare const SIGNATURES: Readonly<{
312
+ readonly approve: "approve(address,uint256)";
313
+ readonly fundJob: "fundJob(bytes32,address,address,uint256,uint256,uint256,uint64,uint64,address)";
314
+ readonly submit: "submit(bytes32,bytes32)";
315
+ readonly complete: "complete(bytes32)";
316
+ readonly reject: "reject(bytes32,bytes32)";
317
+ readonly expire: "expire(bytes32)";
318
+ }>;
319
+ /** The bytes32 job id for a set of terms: keccak over the canonical terms, so the same terms always name the same job and anyone can recompute it. */
320
+ export declare function jobIdOf(t: Pick<HireTerms, 'chainId' | 'buyer' | 'seller' | 'token' | 'price' | 'deadline' | 'task'>): Hex;
321
+ /** correlator = keccak(domain ‖ nonce ‖ payTo ‖ uint64 chainId): binds off-chain work to the job it is paid under. */
322
+ export declare function correlatorOf(a: {
323
+ domain: string;
324
+ nonce: Hex;
325
+ payTo: Address;
326
+ chainId: number;
327
+ }): Hex;
328
+ /**
329
+ * The calls the buyer signs to fund an insured job on Base, in order: an exact-amount USDC approve to
330
+ * the hook, then fundJob. The seller must already have approved the hook for exactly its deposit for
331
+ * this job (never a standing allowance: the live contract pulls the deposit from whichever seller the
332
+ * funder names). Refuses terms whose deposit is below the rule.
333
+ */
334
+ export declare function fundCalls(terms: HireTerms, opts?: {
335
+ jobId?: Hex;
336
+ evaluator?: Address;
337
+ gradeWindow?: number;
338
+ }): UnsignedCall[];
339
+ /** The seller's call: submit(jobId, evidenceDigest) seals the digest on the hook. It does not release payment. */
340
+ export declare function submitCalls(d: Delivery): UnsignedCall[];
341
+ /**
342
+ * The call that settles a job under one of the four endings.
343
+ * completed → complete(jobId), the buyer or a registered evaluator
344
+ * rejected → reject(jobId, verdictDigest), the buyer or a registered evaluator; the digest is required
345
+ * expired → expire(jobId), anyone, once the deadline has passed
346
+ * cheat → refused here: an adjudicated cheat is posted through the judge adapter by a registered evaluator, and no adapter is deployed on Base
347
+ */
348
+ export declare function settleCalls(jobId: Hex, ending: Ending, verdictDigest?: Hex): UnsignedCall[];
349
+ /** The one thing this module needs from the outside: a fetch and the base of the scrubbing proxy. */
350
+ export interface OnboardTransport {
351
+ fetch: (url: string, init?: {
352
+ method?: string;
353
+ headers?: Record<string, string>;
354
+ body?: string;
355
+ signal?: AbortSignal;
356
+ }) => Promise<{
357
+ readonly ok: boolean;
358
+ readonly status: number;
359
+ json(): Promise<unknown>;
360
+ }>;
361
+ /** the scrubbing proxy, e.g. "/api/onboard"; paths below mirror the layer's own */
362
+ base: string;
363
+ /** forwarded as X-API-Key; without it the judge counts the free calls per address */
364
+ apiKey?: string;
365
+ }
366
+ export declare class OnboardError extends Error {
367
+ readonly status: number;
368
+ readonly body?: unknown | undefined;
369
+ constructor(status: number, message: string, body?: unknown | undefined);
370
+ }
371
+ type RegistryRow = {
372
+ agentId: number | string;
373
+ chainId: number;
374
+ owner: string;
375
+ endpoint?: string | null;
376
+ endpointKind?: string | null;
377
+ cardHost?: string | null;
378
+ skills?: string[];
379
+ skillCount?: number;
380
+ wire?: string | {
381
+ status?: string;
382
+ protocol?: string | null;
383
+ } | null;
384
+ wireProtocol?: string | null;
385
+ wireReadyAt?: number | null;
386
+ registrationTx?: string | null;
387
+ trust?: number;
388
+ };
389
+ type FlowRow = {
390
+ id: string;
391
+ title?: string;
392
+ task?: string;
393
+ required_skills?: string[];
394
+ budget_usdc?: number;
395
+ created_at?: string;
396
+ candidate?: {
397
+ chain?: number;
398
+ id?: string | null;
399
+ name?: string;
400
+ owner?: string;
401
+ endpoint?: string | null;
402
+ endpoint_kind?: string | null;
403
+ kind?: string;
404
+ wire?: {
405
+ protocol?: string | null;
406
+ status?: string;
407
+ } | null;
408
+ card_url?: string | null;
409
+ };
410
+ };
411
+ /** A registry row as the layer returns it, folded into a candidate. Exported so the fold is testable without a transport. */
412
+ export declare function candidateFromRegistry(r: RegistryRow, seenAt: number): BaseAgentCandidate | null;
413
+ /** A ready-to-run flow's candidate, folded the same way. Flows without a chain-8453 owner address fold to null. */
414
+ export declare function candidateFromFlow(f: FlowRow, seenAt: number): BaseAgentCandidate | null;
415
+ /** Discover: the registry's Base agents best-trust-first, plus the scanner's ready-to-run flows, deduplicated by address and id. */
416
+ export declare function discover(t: OnboardTransport, f?: {
417
+ skill?: string;
418
+ wire?: 'ready' | 'x402';
419
+ limit?: number;
420
+ }): Promise<BaseAgentCandidate[]>;
421
+ type WireProbe = {
422
+ status?: string;
423
+ protocol?: string | null;
424
+ probedAt?: number;
425
+ readyAt?: number;
426
+ };
427
+ type RegistryRecord = Omit<RegistryRow, 'wire'> & {
428
+ sources?: string[];
429
+ wire?: WireProbe | string | null;
430
+ skills?: string[];
431
+ x402?: {
432
+ amount?: string;
433
+ payTo?: string;
434
+ } | null;
435
+ };
436
+ /** Attest: identity from the registry record read from chain, reachability from the wire probe, capability from the card. */
437
+ export declare function attest(t: OnboardTransport, c: BaseAgentCandidate): Promise<Attestation>;
438
+ /** The fold behind `attest`, exported for tests: a record (or none) to the three fields and the derived state. */
439
+ export declare function attestationFromRecord(c: BaseAgentCandidate, rec: RegistryRecord | null): Attestation;
440
+ type QuoteReply = {
441
+ ok?: boolean;
442
+ premium?: {
443
+ insurable?: boolean;
444
+ low?: number;
445
+ high?: number;
446
+ rate?: number;
447
+ label?: string;
448
+ } | null;
449
+ terms?: {
450
+ depositRequired?: string;
451
+ };
452
+ refusals?: unknown[];
453
+ };
454
+ /** Quote: the premium interval from the seller's record (never a point), and the deposit the rule requires. */
455
+ export declare function quote(t: OnboardTransport, c: BaseAgentCandidate, ask: {
456
+ task: string;
457
+ price: bigint;
458
+ deadline: number;
459
+ buyer?: Address;
460
+ skills?: string[];
461
+ }): Promise<HireTerms>;
462
+ /** The fold behind `quote`, exported for tests. The deposit is the larger of the rule and what the layer requires. */
463
+ export declare function termsFromQuote(c: BaseAgentCandidate, ask: {
464
+ task: string;
465
+ price: bigint;
466
+ deadline: number;
467
+ buyer?: Address;
468
+ skills?: string[];
469
+ }, q: QuoteReply): HireTerms;
470
+ type RefReply = {
471
+ ok?: boolean;
472
+ answer?: {
473
+ value?: string;
474
+ probabilities?: Record<string, number>;
475
+ confidence?: number;
476
+ };
477
+ value?: string;
478
+ probabilities?: Record<string, number>;
479
+ confidence?: number;
480
+ decision?: {
481
+ id?: string;
482
+ digest?: string;
483
+ subject_id?: string;
484
+ subject?: string;
485
+ anchor?: {
486
+ chain?: number;
487
+ tx?: string | null;
488
+ status?: string;
489
+ };
490
+ };
491
+ trial?: {
492
+ calls?: number;
493
+ used?: number;
494
+ left?: number;
495
+ };
496
+ quota?: {
497
+ who?: string;
498
+ left?: number;
499
+ buy?: string;
500
+ };
501
+ who?: string;
502
+ };
503
+ /** Judge: one closed question over the sealed evidence, answered with a distribution and a confidence, recorded and anchored before it is used. Throws OnboardError(402|429) when the quota refuses. */
504
+ export declare function judge(t: OnboardTransport, jobId: Hex, evidence: {
505
+ state: unknown;
506
+ }, guard?: Partial<JevGuard>): Promise<JevDecision>;
507
+ /** The fold behind `judge`, exported for tests: the layer's reply to a JevDecision, ending decided against the bar. */
508
+ export declare function decisionFromRef(r: RefReply, bar?: number): JevDecision;
509
+ type PoolRow = {
510
+ sellerId?: string;
511
+ seller?: string;
512
+ vault?: string | null;
513
+ totalAssets?: string | null;
514
+ settled?: number;
515
+ cheated?: number;
516
+ expired?: number;
517
+ open?: number;
518
+ jobs?: number;
519
+ insurable?: boolean;
520
+ premium?: {
521
+ low?: number;
522
+ high?: number;
523
+ rate?: number;
524
+ } | null;
525
+ };
526
+ /** Record: the seller's settled / cheated counts and the Wilson interval on the cheat rate, from the pools feed. A seller with no row gets the thin record. */
527
+ export declare function record(t: OnboardTransport, seller: Address): Promise<SellerRecord>;
528
+ /** The fold behind `record`, exported for tests. */
529
+ export declare function recordFromPool(seller: Address, row: PoolRow | null): SellerRecord;
530
+ /** discover → attest → record → hireable, for one candidate. */
531
+ export declare function assess(t: OnboardTransport, c: BaseAgentCandidate): Promise<Hireable>;
532
+ export {};
533
+ //# sourceMappingURL=index.d.ts.map