@avow-finance/spec 0.0.0-stage → 0.1.0

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 (179) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +119 -2
  3. package/dist/agent-connect.d.ts +82 -0
  4. package/dist/agent-connect.d.ts.map +1 -0
  5. package/dist/agent-connect.js +91 -0
  6. package/dist/agent-connect.js.map +1 -0
  7. package/dist/agent-session.d.ts +791 -0
  8. package/dist/agent-session.d.ts.map +1 -0
  9. package/dist/agent-session.js +176 -0
  10. package/dist/agent-session.js.map +1 -0
  11. package/dist/ap2.d.ts +79 -0
  12. package/dist/ap2.d.ts.map +1 -0
  13. package/dist/ap2.js +151 -0
  14. package/dist/ap2.js.map +1 -0
  15. package/dist/api-request.d.ts +144 -0
  16. package/dist/api-request.d.ts.map +1 -0
  17. package/dist/api-request.js +246 -0
  18. package/dist/api-request.js.map +1 -0
  19. package/dist/api.d.ts +288 -0
  20. package/dist/api.d.ts.map +1 -0
  21. package/dist/api.js +332 -0
  22. package/dist/api.js.map +1 -0
  23. package/dist/canonical.d.ts +22 -0
  24. package/dist/canonical.d.ts.map +1 -0
  25. package/dist/canonical.js +66 -0
  26. package/dist/canonical.js.map +1 -0
  27. package/dist/commitment-card.d.ts +78 -0
  28. package/dist/commitment-card.d.ts.map +1 -0
  29. package/dist/commitment-card.js +224 -0
  30. package/dist/commitment-card.js.map +1 -0
  31. package/dist/commitment.d.ts +185 -0
  32. package/dist/commitment.d.ts.map +1 -0
  33. package/dist/commitment.js +148 -0
  34. package/dist/commitment.js.map +1 -0
  35. package/dist/compute-offers.d.ts +128 -0
  36. package/dist/compute-offers.d.ts.map +1 -0
  37. package/dist/compute-offers.js +111 -0
  38. package/dist/compute-offers.js.map +1 -0
  39. package/dist/contest.d.ts +88 -0
  40. package/dist/contest.d.ts.map +1 -0
  41. package/dist/contest.js +131 -0
  42. package/dist/contest.js.map +1 -0
  43. package/dist/demo.d.ts +69 -0
  44. package/dist/demo.d.ts.map +1 -0
  45. package/dist/demo.js +152 -0
  46. package/dist/demo.js.map +1 -0
  47. package/dist/dependencies.d.ts +308 -0
  48. package/dist/dependencies.d.ts.map +1 -0
  49. package/dist/dependencies.js +133 -0
  50. package/dist/dependencies.js.map +1 -0
  51. package/dist/eip712.d.ts +1569 -0
  52. package/dist/eip712.d.ts.map +1 -0
  53. package/dist/eip712.js +550 -0
  54. package/dist/eip712.js.map +1 -0
  55. package/dist/elided-terms.d.ts +37 -0
  56. package/dist/elided-terms.d.ts.map +1 -0
  57. package/dist/elided-terms.js +48 -0
  58. package/dist/elided-terms.js.map +1 -0
  59. package/dist/erc8183.d.ts +78 -0
  60. package/dist/erc8183.d.ts.map +1 -0
  61. package/dist/erc8183.js +88 -0
  62. package/dist/erc8183.js.map +1 -0
  63. package/dist/facts.d.ts +70 -0
  64. package/dist/facts.d.ts.map +1 -0
  65. package/dist/facts.js +33 -0
  66. package/dist/facts.js.map +1 -0
  67. package/dist/gpu-reservation.d.ts +79 -0
  68. package/dist/gpu-reservation.d.ts.map +1 -0
  69. package/dist/gpu-reservation.js +135 -0
  70. package/dist/gpu-reservation.js.map +1 -0
  71. package/dist/index.d.ts +49 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +49 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/job-session.d.ts +981 -0
  76. package/dist/job-session.d.ts.map +1 -0
  77. package/dist/job-session.js +170 -0
  78. package/dist/job-session.js.map +1 -0
  79. package/dist/job-verification.d.ts +244 -0
  80. package/dist/job-verification.d.ts.map +1 -0
  81. package/dist/job-verification.js +89 -0
  82. package/dist/job-verification.js.map +1 -0
  83. package/dist/job-wording.d.ts +48 -0
  84. package/dist/job-wording.d.ts.map +1 -0
  85. package/dist/job-wording.js +134 -0
  86. package/dist/job-wording.js.map +1 -0
  87. package/dist/job.d.ts +117 -0
  88. package/dist/job.d.ts.map +1 -0
  89. package/dist/job.js +166 -0
  90. package/dist/job.js.map +1 -0
  91. package/dist/json-fields.d.ts +13 -0
  92. package/dist/json-fields.d.ts.map +1 -0
  93. package/dist/json-fields.js +30 -0
  94. package/dist/json-fields.js.map +1 -0
  95. package/dist/keychain.d.ts +51 -0
  96. package/dist/keychain.d.ts.map +1 -0
  97. package/dist/keychain.js +133 -0
  98. package/dist/keychain.js.map +1 -0
  99. package/dist/mailbox.d.ts +1650 -0
  100. package/dist/mailbox.d.ts.map +1 -0
  101. package/dist/mailbox.js +87 -0
  102. package/dist/mailbox.js.map +1 -0
  103. package/dist/mandate.d.ts +53 -0
  104. package/dist/mandate.d.ts.map +1 -0
  105. package/dist/mandate.js +97 -0
  106. package/dist/mandate.js.map +1 -0
  107. package/dist/networks.d.ts +18 -0
  108. package/dist/networks.d.ts.map +1 -0
  109. package/dist/networks.js +24 -0
  110. package/dist/networks.js.map +1 -0
  111. package/dist/profiles.d.ts +31 -0
  112. package/dist/profiles.d.ts.map +1 -0
  113. package/dist/profiles.js +33 -0
  114. package/dist/profiles.js.map +1 -0
  115. package/dist/rail.d.ts +48 -0
  116. package/dist/rail.d.ts.map +1 -0
  117. package/dist/rail.js +28 -0
  118. package/dist/rail.js.map +1 -0
  119. package/dist/reasons.d.ts +173 -0
  120. package/dist/reasons.d.ts.map +1 -0
  121. package/dist/reasons.js +174 -0
  122. package/dist/reasons.js.map +1 -0
  123. package/dist/reference-link.d.ts +23 -0
  124. package/dist/reference-link.d.ts.map +1 -0
  125. package/dist/reference-link.js +56 -0
  126. package/dist/reference-link.js.map +1 -0
  127. package/dist/references.d.ts +125 -0
  128. package/dist/references.d.ts.map +1 -0
  129. package/dist/references.js +108 -0
  130. package/dist/references.js.map +1 -0
  131. package/dist/replay.d.ts +30 -0
  132. package/dist/replay.d.ts.map +1 -0
  133. package/dist/replay.js +27 -0
  134. package/dist/replay.js.map +1 -0
  135. package/dist/sandbox-registration.d.ts +200 -0
  136. package/dist/sandbox-registration.d.ts.map +1 -0
  137. package/dist/sandbox-registration.js +172 -0
  138. package/dist/sandbox-registration.js.map +1 -0
  139. package/dist/sandbox.d.ts +3478 -0
  140. package/dist/sandbox.d.ts.map +1 -0
  141. package/dist/sandbox.js +316 -0
  142. package/dist/sandbox.js.map +1 -0
  143. package/dist/session-fields.d.ts +203 -0
  144. package/dist/session-fields.d.ts.map +1 -0
  145. package/dist/session-fields.js +43 -0
  146. package/dist/session-fields.js.map +1 -0
  147. package/dist/supplier-adapter.d.ts +65 -0
  148. package/dist/supplier-adapter.d.ts.map +1 -0
  149. package/dist/supplier-adapter.js +91 -0
  150. package/dist/supplier-adapter.js.map +1 -0
  151. package/dist/terms-v1.d.ts +74 -0
  152. package/dist/terms-v1.d.ts.map +1 -0
  153. package/dist/terms-v1.js +156 -0
  154. package/dist/terms-v1.js.map +1 -0
  155. package/dist/terms.d.ts +341 -0
  156. package/dist/terms.d.ts.map +1 -0
  157. package/dist/terms.js +715 -0
  158. package/dist/terms.js.map +1 -0
  159. package/dist/test-customer.d.ts +1525 -0
  160. package/dist/test-customer.d.ts.map +1 -0
  161. package/dist/test-customer.js +260 -0
  162. package/dist/test-customer.js.map +1 -0
  163. package/dist/types.d.ts +272 -0
  164. package/dist/types.d.ts.map +1 -0
  165. package/dist/types.js +32 -0
  166. package/dist/types.js.map +1 -0
  167. package/dist/version.d.ts +51 -0
  168. package/dist/version.d.ts.map +1 -0
  169. package/dist/version.js +66 -0
  170. package/dist/version.js.map +1 -0
  171. package/dist/wire.d.ts +2698 -0
  172. package/dist/wire.d.ts.map +1 -0
  173. package/dist/wire.js +678 -0
  174. package/dist/wire.js.map +1 -0
  175. package/package.json +37 -3
  176. package/vectors/api-request-v1.json +53 -0
  177. package/vectors/contest-statement-v1.json +42 -0
  178. package/vectors/terms-v2.json +398 -0
  179. package/vectors/terms-v3.json +2103 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-customer.d.ts","sourceRoot":"","sources":["../src/test-customer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO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AAe;;;;;;kBAG1B,CAAA;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,eAAe,GAAG,QAAQ,GACjC,UAAU,GAAG,IAAI,CASnB;AAYD,oCAAoC;AACpC,eAAO,MAAM,wBAAwB,SATrB,OAAO,gCASqE,CAAA;AAC5F,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,SAXd,OAAO,yBAWgD,CAAA;AACvE,kCAAkC;AAClC,eAAO,MAAM,aAAa,SAbV,OAAO,qBAaoC,CAAA;AAC3D,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,SAfd,OAAO,yBAegD,CAAA;AACvE,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAjBZ,OAAO,uBAiB0C,CAAA;AACjE,wDAAwD;AACxD,eAAO,MAAM,gBAAgB,SAnBb,OAAO,wBAmB6C,CAAA;AACpE,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,SArBhB,OAAO,2BAqBsD,CAAA"}
@@ -0,0 +1,260 @@
1
+ import { z } from 'zod';
2
+ import { canonicalJson } from './canonical.js';
3
+ import { checkedDependencyJson, dependencyIndexJson, isChainedTerms, MAX_DEPENDENCIES, pinnedBlockJson, } from './dependencies.js';
4
+ import { factBodyShape } from './facts.js';
5
+ import { GPU_RESERVATION } from './gpu-reservation.js';
6
+ import { address, bytes32, hexBytes, u64, u256 } from './json-fields.js';
7
+ import { commitmentReferenceJson, } from './references.js';
8
+ import { reasonCodeJson } from './session-fields.js';
9
+ import { supplierProfileJson } from './supplier-adapter.js';
10
+ import { plainTermsOf } from './terms.js';
11
+ import { chainedJobTermsJson, jobTermsJson, paymentReferenceJson, termsAgreementJson, toWire, } from './wire.js';
12
+ /**
13
+ * Avow's test customer, a sandbox business on testnet that offers a developer's business paid
14
+ * jobs. Avow's service holds its keys, on testnet only, and it's labelled as Avow's test customer
15
+ * in everything it returns. Its own agent key funds its reserves from its own account, so its lock
16
+ * still pulls only from the account calling it.
17
+ *
18
+ * Orders arrive by pull, so the developer's machine needs no inbound connection. Its job process
19
+ * asks for an order, quotes it, then polls the order until the customer has verified the quote and
20
+ * reserved, and reports delivery.
21
+ *
22
+ * Every POST is a signed API request, as `api-request` defines one, signed by the developer's
23
+ * supplier signing key, with the customer's origin as the audience and the customer's lock as the
24
+ * domain's lock. An order belongs to the supplier it was offered to, which the customer records
25
+ * with the offer. A request for a new order has to be signed by the signing key Avow registered
26
+ * for the supplier it names. A quote or a delivery report has to be signed by the signing key of
27
+ * the supplier the order was offered to, and `orderSignerProblem` refuses any other signer. An
28
+ * order's id is no secret, since every job event names it and anyone with the screen's link can
29
+ * read those, so the id alone lets nobody act on an order. A refusal has the API's error shape and
30
+ * a reason code. The GETs are unsigned. The origin is the sandbox deployment's `customerUrl`.
31
+ */
32
+ /** How the test customer labels itself, in its profile, its offers and every order it returns. */
33
+ export const TEST_CUSTOMER_LABEL = "Avow's test customer";
34
+ /** An order id: 16 random bytes as 32 lower-case hex characters. */
35
+ const ORDER_ID = /^[0-9a-f]{32}$/;
36
+ /** Whether text is an order id, the only form an order's path carries. */
37
+ export const isOrderId = (text) => ORDER_ID.test(text);
38
+ const pathOf = (orderId, rest = '') => {
39
+ if (!isOrderId(orderId))
40
+ throw new RangeError(`${orderId} isn't an order id`);
41
+ return `/v1/orders/${orderId}${rest}`;
42
+ };
43
+ /** The test customer's routes, each a path on its origin. */
44
+ export const TEST_CUSTOMER_PATHS = {
45
+ /** GET, unsigned. The customer's profile. */
46
+ profile: '/v1/profile',
47
+ /** POST, signed. Asks for a new order and answers with the offer. */
48
+ orders: '/v1/orders',
49
+ /** GET, unsigned and polled. Where the order stands. */
50
+ order: (orderId) => pathOf(orderId),
51
+ /** POST, signed. Sends the quote, answered with 202 while the customer verifies it. */
52
+ quote: (orderId) => pathOf(orderId, '/quote'),
53
+ /** POST, signed, with a `DeliveryReport` as the body. Reports delivery, answered with 202. */
54
+ delivery: (orderId) => pathOf(orderId, '/delivery'),
55
+ };
56
+ /**
57
+ * Who refused for the customer. `customer` is the customer's own check of the quote. `avow` is
58
+ * Avow's API refusing to approve the customer's reserve. `relay`, `lock` and `keychain` refused the
59
+ * customer's reserve on its way to its lock, as they would any agent's, and `unknown` is a reserve
60
+ * that never landed with no reason given. `supplier` is the developer's business never accepting
61
+ * the customer's reserve by its deadline, as with `supplier.not_accepted`.
62
+ */
63
+ export const CUSTOMER_REFUSAL_LAYERS = [
64
+ 'customer',
65
+ 'supplier',
66
+ 'avow',
67
+ 'relay',
68
+ 'lock',
69
+ 'keychain',
70
+ 'unknown',
71
+ ];
72
+ /** The longest message the customer says. */
73
+ export const CUSTOMER_SAID_MAX = 500;
74
+ /** The most messages or facts one order carries. */
75
+ export const ORDER_STATEMENTS_MAX = 32;
76
+ /** The label of the result a delivery hands over, which says plainly that it's a placeholder. */
77
+ export const SIMULATED_RESULT_LABEL = 'Simulated fine-tuning result, a placeholder, since no model was trained';
78
+ /** Where an order stands, in the order it moves. */
79
+ export const ORDER_STATUSES = [
80
+ 'offered',
81
+ 'verifying',
82
+ 'refused',
83
+ 'reserved',
84
+ 'accepted',
85
+ 'cancelled',
86
+ 'delivered',
87
+ 'paid',
88
+ ];
89
+ /**
90
+ * Why a quote or a delivery report for an order can't be taken from this signer, or null when it
91
+ * can. Only the supplier the order was offered to can act on it, through the signing key Avow
92
+ * registered for that supplier, so the order's supplier, the registered profile and the signer are
93
+ * checked together, and a key registered for another supplier never acts on this order.
94
+ */
95
+ export function orderSignerProblem(order, registered, signer) {
96
+ const offeredTo = order.supplierBusinessId === registered.businessId;
97
+ const theirKey = registered.signingKey.toLowerCase() === signer.toLowerCase();
98
+ return offeredTo && theirKey ? null : 'order.supplier_mismatch';
99
+ }
100
+ /**
101
+ * How an order is asked to go, for a developer who wants to see a promise broken. A test customer
102
+ * asked for `cancels_late` cancels the job shortly after its work starts, which its reserve backs.
103
+ */
104
+ export const ORDER_SCENARIOS = ['cancels_late'];
105
+ /** An order id's JSON form. */
106
+ export const orderIdJson = z.string().regex(ORDER_ID);
107
+ /** The customer as JSON, labelled as Avow's test customer and nothing else. */
108
+ export const jobCustomerJson = z.strictObject({
109
+ label: z.literal(TEST_CUSTOMER_LABEL),
110
+ businessId: z.string().min(1).max(100),
111
+ });
112
+ export const testCustomerProfileJson = z.strictObject({
113
+ ...jobCustomerJson.shape,
114
+ account: address,
115
+ lock: address,
116
+ chainId: z.number().int().positive(),
117
+ mandateHash: bytes32,
118
+ limits: z.strictObject({
119
+ reserve: u256,
120
+ price: u256,
121
+ openOrders: z.number().int().positive().max(100),
122
+ }),
123
+ });
124
+ export const orderRequestJson = z.strictObject({
125
+ supplier: supplierProfileJson,
126
+ scenario: z.enum(ORDER_SCENARIOS).optional(),
127
+ });
128
+ /** The booking a quote has to rely on, as JSON. */
129
+ export const jobRequirementJson = z.strictObject({
130
+ template: z.literal(GPU_RESERVATION),
131
+ condition: z.literal('accepted'),
132
+ disclosed: z.literal('subject'),
133
+ });
134
+ const businessIdJson = z.string().min(1).max(100);
135
+ export const jobOfferJson = z.strictObject({
136
+ orderId: orderIdJson,
137
+ commitmentId: bytes32,
138
+ customer: jobCustomerJson,
139
+ supplierBusinessId: businessIdJson,
140
+ terms: jobTermsJson,
141
+ requirement: jobRequirementJson,
142
+ expiry: u64,
143
+ });
144
+ export const quoteRequestJson = z.strictObject({
145
+ terms: z.union([chainedJobTermsJson, jobTermsJson]),
146
+ salt: bytes32,
147
+ agreement: termsAgreementJson,
148
+ supplierSignature: hexBytes,
149
+ disclosed: z.array(z.unknown()).max(MAX_DEPENDENCIES),
150
+ });
151
+ /** A customer's refusal as JSON. */
152
+ export const customerRefusalJson = z.strictObject({
153
+ code: reasonCodeJson,
154
+ layer: z.enum(CUSTOMER_REFUSAL_LAYERS),
155
+ block: pinnedBlockJson.nullable(),
156
+ index: dependencyIndexJson,
157
+ });
158
+ const reserveJson = z.strictObject({
159
+ reference: commitmentReferenceJson,
160
+ amount: u256,
161
+ fundedIn: bytes32,
162
+ });
163
+ const checks = z.array(checkedDependencyJson).max(MAX_DEPENDENCIES);
164
+ /** Statements numbered from 0, each index once and in order, so a reader posts each exactly once. */
165
+ const numbered = (item) => z
166
+ .array(item)
167
+ .max(ORDER_STATEMENTS_MAX)
168
+ .refine((list) => list.every((s, i) => s.index === i), 'indexes 0, 1, 2 and so on, in order');
169
+ export const customerSaidJson = z.strictObject({
170
+ index: z
171
+ .number()
172
+ .int()
173
+ .min(0)
174
+ .max(ORDER_STATEMENTS_MAX - 1),
175
+ text: z.string().min(1).max(CUSTOMER_SAID_MAX),
176
+ });
177
+ export const customerFactJson = z.strictObject({
178
+ index: z
179
+ .number()
180
+ .int()
181
+ .min(0)
182
+ .max(ORDER_STATEMENTS_MAX - 1),
183
+ ...factBodyShape,
184
+ verifiedBy: z.literal('customer'),
185
+ });
186
+ const base = {
187
+ orderId: orderIdJson,
188
+ commitmentId: bytes32,
189
+ customer: jobCustomerJson,
190
+ supplierBusinessId: businessIdJson,
191
+ said: numbered(customerSaidJson),
192
+ facts: numbered(customerFactJson),
193
+ };
194
+ export const deliveryReportJson = z.strictObject({
195
+ result: z.strictObject({ label: z.literal(SIMULATED_RESULT_LABEL), hash: bytes32 }),
196
+ });
197
+ export const orderStateJson = z.discriminatedUnion('status', [
198
+ z.strictObject({ ...base, status: z.literal('offered') }),
199
+ z.strictObject({ ...base, status: z.literal('verifying') }),
200
+ z.strictObject({ ...base, status: z.literal('refused'), refusal: customerRefusalJson, checks }),
201
+ ...['reserved', 'accepted', 'delivered'].map((status) => z.strictObject({ ...base, status: z.literal(status), checks, reserve: reserveJson })),
202
+ z.strictObject({
203
+ ...base,
204
+ status: z.literal('cancelled'),
205
+ checks,
206
+ reserve: reserveJson,
207
+ cancellation: z.strictObject({ cancelledAt: u64 }),
208
+ }),
209
+ z.strictObject({
210
+ ...base,
211
+ status: z.literal('paid'),
212
+ checks,
213
+ reserve: reserveJson,
214
+ payment: paymentReferenceJson,
215
+ }),
216
+ ]);
217
+ export const orderAnswerJson = z.strictObject({
218
+ orderId: orderIdJson,
219
+ status: z.enum(['verifying', 'delivered']),
220
+ });
221
+ /**
222
+ * Why a quote's terms aren't the offer's, or null when they are. A quote may add the bookings the
223
+ * job relies on, which makes its terms version 3 with a setting for who checks them, and may change
224
+ * nothing else. Anything more is `order.terms_changed`.
225
+ */
226
+ export function quoteTermsProblem(offered, quoted) {
227
+ const plain = isChainedTerms(quoted) ? plainTermsOf(quoted) : quoted;
228
+ try {
229
+ return canonicalJson(toWire(plain)) === canonicalJson(toWire(offered))
230
+ ? null
231
+ : 'order.terms_changed';
232
+ }
233
+ catch {
234
+ return 'order.terms_changed';
235
+ }
236
+ }
237
+ /** Reads a JSON body with a schema, refusing anything else as `message.invalid`. */
238
+ function reader(schema) {
239
+ return (json) => {
240
+ const parsed = schema.safeParse(json);
241
+ return parsed.success
242
+ ? { ok: true, value: parsed.data }
243
+ : { ok: false, reason: 'message.invalid' };
244
+ };
245
+ }
246
+ /** Reads the customer's profile. */
247
+ export const parseTestCustomerProfile = reader(testCustomerProfileJson);
248
+ /** Reads the body of a request for a new order, as the customer takes it. */
249
+ export const parseOrderRequest = reader(orderRequestJson);
250
+ /** Reads the customer's offer. */
251
+ export const parseJobOffer = reader(jobOfferJson);
252
+ /** Reads the body of a quote, as the customer takes it. */
253
+ export const parseQuoteRequest = reader(quoteRequestJson);
254
+ /** Reads where an order stands. */
255
+ export const parseOrderState = reader(orderStateJson);
256
+ /** Reads the answer to a quote or a delivery report. */
257
+ export const parseOrderAnswer = reader(orderAnswerJson);
258
+ /** Reads the body of a delivery report, as the customer takes it. */
259
+ export const parseDeliveryReport = reader(deliveryReportJson);
260
+ //# sourceMappingURL=test-customer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-customer.js","sourceRoot":"","sources":["../src/test-customer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;A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MAAM,CAAe,gBAAgB,CAAC,CAAA;AACvE,kCAAkC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAW,YAAY,CAAC,CAAA;AAC3D,2DAA2D;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAe,gBAAgB,CAAC,CAAA;AACvE,mCAAmC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAa,cAAc,CAAC,CAAA;AACjE,wDAAwD;AACxD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAc,eAAe,CAAC,CAAA;AACpE,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAiB,kBAAkB,CAAC,CAAA"}
@@ -0,0 +1,272 @@
1
+ import type { Address, Hex } from 'viem';
2
+ import type { Dependencies, DependencyCheck } from './dependencies.js';
3
+ import type { ChargeKind } from './eip712.js';
4
+ import type { ChainedGpuReservationTerms, GpuReservationTerms } from './gpu-reservation.js';
5
+ import type { ChainedJobTerms, JobTerms } from './job.js';
6
+ import type { ReasonCode } from './reasons.js';
7
+ /**
8
+ * Money in terms and mandates is in micros, millionths of the currency unit, so $500 is
9
+ * 500_000_000n. A USD token on Tempo has 6 decimals, so its base units equal micros. Times are
10
+ * unix seconds and durations are seconds.
11
+ */
12
+ /** ISO 4217. This release runs in US dollars only. */
13
+ export declare const CURRENCIES: readonly ['USD'];
14
+ export type Currency = (typeof CURRENCIES)[number];
15
+ export type Side = 'buyer' | 'supplier';
16
+ /** A business-verification result. Results from a mock provider are always test data. */
17
+ export interface KybAttestation {
18
+ provider: string;
19
+ reference: string;
20
+ verifiedAt: bigint;
21
+ testData: boolean;
22
+ }
23
+ /** A verified company, on either side of a commitment. */
24
+ export interface Business {
25
+ businessId: string;
26
+ legalName: string;
27
+ /** ISO 3166-1 alpha-2 */
28
+ country: string;
29
+ kyb: KybAttestation | null;
30
+ /** The business's Tempo account. Its root key is the administrator's passkey. */
31
+ account: Address;
32
+ lock: Address;
33
+ }
34
+ /** What a business needs before it can receive charges. */
35
+ export interface SupplierProfile {
36
+ businessId: string;
37
+ /**
38
+ * The supplier's account on the rail. The business approves it on its lock, and the account's
39
+ * root key or an admin key consents to a release or withdraws a report.
40
+ */
41
+ account: Address;
42
+ /** Where charges go. A change takes effect only after a delay. */
43
+ payee: Address;
44
+ /** The key that records acceptance, signs start receipts and reports outcomes. */
45
+ signingKey: Address;
46
+ }
47
+ /** The person the business authorized to enroll agents and accept terms. */
48
+ export interface Administrator {
49
+ adminId: string;
50
+ businessId: string;
51
+ /** The attestation that this person can bind the business, or null when none is recorded. */
52
+ authorityReference: string | null;
53
+ }
54
+ export type OutsideIdentityKind = 'visa' | 'mastercard' | 'erc-8004' | 'mppx';
55
+ /** An identity the agent holds outside Avow. This release records these and no check reads them. */
56
+ export interface OutsideIdentity {
57
+ kind: OutsideIdentityKind;
58
+ reference: string;
59
+ }
60
+ /** An AI agent, identified by a Tempo access key the business issued. */
61
+ export interface Agent {
62
+ agentId: string;
63
+ businessId: string;
64
+ key: Address;
65
+ keyLocation: 'sdk' | 'self-hosted-mcp' | 'none';
66
+ operator: string | null;
67
+ outsideIdentities: readonly OutsideIdentity[];
68
+ revokedAt: bigint | null;
69
+ }
70
+ export declare const MANDATE_ACTIONS: readonly ['reserve', 'cancel', 'start', 'pay'];
71
+ export type MandateAction = (typeof MANDATE_ACTIONS)[number];
72
+ /** When the administrator has to approve a reserve in person. Amounts are micros. */
73
+ export type ApprovalRule = {
74
+ kind: 'never';
75
+ } | {
76
+ kind: 'above';
77
+ amount: bigint;
78
+ } | {
79
+ kind: 'always';
80
+ };
81
+ /**
82
+ * A spending limit for one token, in the token's base units. It mirrors the agent key's limit
83
+ * on the rail that the mandate's signature names.
84
+ */
85
+ export interface PaymentLimit {
86
+ token: Address;
87
+ amount: bigint;
88
+ /** 0 for a one-time limit. */
89
+ period: bigint;
90
+ }
91
+ /**
92
+ * What one agent may commit to, signed by the business's administrator. An empty supplier or
93
+ * category list puts no limit on that dimension, and at least one of the two must be non-empty.
94
+ */
95
+ export interface Mandate {
96
+ mandateId: Hex;
97
+ businessId: string;
98
+ agentId: string;
99
+ /** The business's account, whose root key signs the mandate. */
100
+ account: Address;
101
+ /** The agent's key. The mandate's hash is bound into this key's authorization on Tempo. */
102
+ agentKey: Address;
103
+ actions: readonly MandateAction[];
104
+ currency: Currency;
105
+ capPerCommitment: bigint;
106
+ capOpenReserves: bigint;
107
+ /** Business ids of the suppliers the agent may commit to. */
108
+ suppliers: readonly string[];
109
+ categories: readonly string[];
110
+ paymentLimits: readonly PaymentLimit[];
111
+ approvalRule: ApprovalRule;
112
+ expiry: bigint;
113
+ nonce: bigint;
114
+ }
115
+ /**
116
+ * How a disputed charge ends when Avow doesn't rule. Avow's ruling key can rule until day 30 after
117
+ * the charge is paused, the arbiter from day 30 until day 90, and a confirmed charge still unruled
118
+ * at day 90 pays the supplier its share and the rest goes back to the business.
119
+ */
120
+ export interface DisputeTerms {
121
+ /** The fallback arbiter's key, which the lock names for the commitment. */
122
+ arbiter: Address;
123
+ /** The supplier's share of a confirmed charge still unruled at day 90, from 0 to 10,000. */
124
+ day90SupplierShareBps: number;
125
+ }
126
+ /** The version of the terms a plain booking uses. A reader refuses any version it doesn't know. */
127
+ export declare const TERMS_VERSION = 2;
128
+ /**
129
+ * The version of the terms a booking uses when it relies on another business's booking. It's
130
+ * version 2 with one more section, `dependencies`, so a plain booking stays on version 2.
131
+ */
132
+ export declare const CHAINED_TERMS_VERSION = 3;
133
+ /** Every amount in version 2 terms is an integer count of millionths of the terms' currency. */
134
+ export declare const AMOUNT_DECIMALS = 6;
135
+ /**
136
+ * The templates this code knows, by name and version. A template fixes what its subject holds and
137
+ * the rules its terms follow, and its meaning never changes. A new meaning is a new version.
138
+ */
139
+ export declare const TEMPLATE_IDS: readonly ['gpu-reservation/1', 'job/1'];
140
+ export type TemplateId = (typeof TEMPLATE_IDS)[number];
141
+ /**
142
+ * Who each template lets check the bookings its version 3 terms rely on. A job's customer checks
143
+ * its compute itself, so a job takes only `buyer`. Every rule about the setting reads it from here,
144
+ * and the build fails when a template is missing.
145
+ */
146
+ export declare const DEPENDENCY_CHECKS_ALLOWED: {
147
+ readonly 'gpu-reservation/1': readonly ["buyer", "avow"];
148
+ readonly 'job/1': readonly ["buyer"];
149
+ };
150
+ /** The settings a template allows for who checks its version 3 terms' bookings. */
151
+ export type DependencyChecksOf<T extends TemplateId> = (typeof DEPENDENCY_CHECKS_ALLOWED)[T][number];
152
+ /** What the buyer owes for the subject. The lock never reads it, so the terms describe it only. */
153
+ export type Consideration =
154
+ /** An amount for each unit the template names, such as a GPU-hour. */
155
+ {
156
+ kind: 'rate';
157
+ amount: bigint;
158
+ unit: string;
159
+ }
160
+ /** One amount for the whole subject. */
161
+ | {
162
+ kind: 'fixed';
163
+ amount: bigint;
164
+ };
165
+ /**
166
+ * One charge the supplier can report, up to `amount`, from `earliest` until the charge deadline.
167
+ * The kinds are the ones a lock can hold.
168
+ */
169
+ export interface RemedyCharge {
170
+ kind: ChargeKind;
171
+ amount: bigint;
172
+ earliest: bigint;
173
+ }
174
+ /** What the buyer owes when it doesn't go ahead as agreed, with the deadlines around a charge. */
175
+ export interface Remedies {
176
+ /** The last moment the supplier can accept. After it, the backing goes back. */
177
+ acceptBy: bigint;
178
+ /** Until this moment the buyer can cancel without a charge. */
179
+ freeCancelBy: bigint;
180
+ /** In the order of the lock's charge codes, one of each kind at most. */
181
+ charges: readonly RemedyCharge[];
182
+ /** The last moment the supplier can report a charge. */
183
+ chargeDeadline: bigint;
184
+ }
185
+ /** How a reported charge can be contested and who rules when Avow doesn't. */
186
+ export interface Resolution {
187
+ /** How long the buyer has to contest a confirmed charge. */
188
+ contestWindow: bigint;
189
+ /** The fallback arbiter's key, which the lock names for the commitment. */
190
+ arbiter: Address;
191
+ /** The supplier's share of a confirmed charge still unruled at day 90, from 0 to 10,000. */
192
+ day90SupplierShareBps: number;
193
+ }
194
+ /**
195
+ * Money the buyer reserves in its own lock for the supplier, which the lock pays charges from and
196
+ * gives back at the release date. It's the only backing this release enforces.
197
+ */
198
+ export interface ReserveBacking {
199
+ kind: 'reserve';
200
+ /** The side whose promise it backs. The other side benefits, and this release backs the buyer only. */
201
+ side: 'buyer';
202
+ /** Equal to the largest charge. */
203
+ amount: bigint;
204
+ /** When a reserve nobody released or charged goes back to the business. */
205
+ releaseDate: bigint;
206
+ }
207
+ /** What secures a commitment. A change of backing changes the terms hash. */
208
+ export type Backing = ReserveBacking;
209
+ /**
210
+ * The terms of a commitment, version 2. The header (version, template, currency and amount
211
+ * decimals) says how to read the five sections. Only the subject depends on the template.
212
+ * Remedies, resolution and backing hold everything a lock enforces, and consideration is
213
+ * described only. Nothing here names a rail, so the same terms and hash work on any EVM rail.
214
+ */
215
+ export interface TermsOf<Subject, Template extends TemplateId> {
216
+ version: typeof TERMS_VERSION;
217
+ template: Template;
218
+ currency: Currency;
219
+ amountDecimals: typeof AMOUNT_DECIMALS;
220
+ subject: Subject;
221
+ consideration: Consideration;
222
+ remedies: Remedies;
223
+ resolution: Resolution;
224
+ backing: Backing;
225
+ }
226
+ /**
227
+ * Version 2 terms under any template this code knows. Job terms take this shape only as a proposal,
228
+ * since a job relies on a compute booking and so commits only under version 3.
229
+ */
230
+ export type Terms = GpuReservationTerms | JobTerms;
231
+ /**
232
+ * The terms of a commitment that relies on other bookings, version 3. They hold version 2's header
233
+ * and five sections and one more section, `dependencies`, which names each booking this one relies
234
+ * on. The header gains `dependencyCheck`, which says who checks those bookings for the buyer. The
235
+ * lock enforces nothing in either.
236
+ */
237
+ export interface ChainedTermsOf<Subject, Template extends TemplateId> extends Omit<TermsOf<Subject, Template>, 'version'> {
238
+ version: typeof CHAINED_TERMS_VERSION;
239
+ dependencyCheck: DependencyCheck;
240
+ dependencies: Dependencies;
241
+ }
242
+ /** Version 3 terms under any template this code knows. */
243
+ export type ChainedTerms = ChainedGpuReservationTerms | ChainedJobTerms;
244
+ /** An agent's request to reserve money for a supplier under terms. */
245
+ export interface ReserveRequest {
246
+ commitmentId: Hex;
247
+ agentKey: Address;
248
+ /** The supplier's business id, as the mandate names it. */
249
+ supplier: string;
250
+ /** The supplier's payout address on the rail, which receives any charge. */
251
+ payee: Address;
252
+ category: string;
253
+ /**
254
+ * The terms, version 2 or version 3. Version 3 terms name the bookings this one relies on. A
255
+ * caller approves them only once a check has read each of those bookings on its lock, and Avow's
256
+ * API doesn't run that check yet, so it refuses version 3 requests for now.
257
+ */
258
+ terms: Terms | ChainedTerms;
259
+ }
260
+ export type DecisionResult = 'approved' | 'denied' | 'needs_human';
261
+ /** Every check Avow makes, whether it approves or denies. */
262
+ export interface Decision {
263
+ decisionId: string;
264
+ checked: 'reserve';
265
+ result: DecisionResult;
266
+ reason: ReasonCode;
267
+ policyVersion: string;
268
+ at: bigint;
269
+ /** References to the evidence the check used, such as the mandate hash and the terms hash. */
270
+ evidence: readonly string[];
271
+ }
272
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;GAIG;AAEH,sDAAsD;AACtD,eAAO,MAAM,UAAU,YAAI,KAAK,CAAU,CAAA;AAC1C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAElD,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YAAY,GAAG,0BAA0B,GAAG,eAAe,CAAA;AAEvE,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,GAAG,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,KAAK,EAAE,KAAK,GAAG,YAAY,CAAA;CAC5B;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAA;AAElE,6DAA6D;AAC7D,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,SAAS,CAAA;IAClB,MAAM,EAAE,cAAc,CAAA;IACtB,MAAM,EAAE,UAAU,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,8FAA8F;IAC9F,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAC5B"}
package/dist/types.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Money in terms and mandates is in micros, millionths of the currency unit, so $500 is
3
+ * 500_000_000n. A USD token on Tempo has 6 decimals, so its base units equal micros. Times are
4
+ * unix seconds and durations are seconds.
5
+ */
6
+ /** ISO 4217. This release runs in US dollars only. */
7
+ export const CURRENCIES = ['USD'];
8
+ export const MANDATE_ACTIONS = ['reserve', 'cancel', 'start', 'pay'];
9
+ /** The version of the terms a plain booking uses. A reader refuses any version it doesn't know. */
10
+ export const TERMS_VERSION = 2;
11
+ /**
12
+ * The version of the terms a booking uses when it relies on another business's booking. It's
13
+ * version 2 with one more section, `dependencies`, so a plain booking stays on version 2.
14
+ */
15
+ export const CHAINED_TERMS_VERSION = 3;
16
+ /** Every amount in version 2 terms is an integer count of millionths of the terms' currency. */
17
+ export const AMOUNT_DECIMALS = 6;
18
+ /**
19
+ * The templates this code knows, by name and version. A template fixes what its subject holds and
20
+ * the rules its terms follow, and its meaning never changes. A new meaning is a new version.
21
+ */
22
+ export const TEMPLATE_IDS = ['gpu-reservation/1', 'job/1'];
23
+ /**
24
+ * Who each template lets check the bookings its version 3 terms rely on. A job's customer checks
25
+ * its compute itself, so a job takes only `buyer`. Every rule about the setting reads it from here,
26
+ * and the build fails when a template is missing.
27
+ */
28
+ export const DEPENDENCY_CHECKS_ALLOWED = {
29
+ 'gpu-reservation/1': ['buyer', 'avow'],
30
+ 'job/1': ['buyer'],
31
+ };
32
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH,sDAAsD;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,CAAU,CAAA;AAkE1C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAU,CAAA;AAyD7E,mGAAmG;AACnG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAEtC,gGAAgG;AAChG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAU,CAAA;AAGnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,mBAAmB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;IACtC,OAAO,EAAE,CAAC,OAAO,CAAC;CAGnB,CAAA"}
@@ -0,0 +1,51 @@
1
+ /** The EIP-712 domain name of every Avow message. */
2
+ export declare const DOMAIN_NAME = "Avow";
3
+ /**
4
+ * The domain version of every message a lock checks. The lock's code fixes it and a lock can't be
5
+ * upgraded, so it changes only with a new lock.
6
+ */
7
+ export declare const LOCK_MESSAGE_VERSION = "1";
8
+ /**
9
+ * Each message type's EIP-712 domain version. The messages a lock checks share the lock's version.
10
+ * Each message the lock never sees has its own, so it can change without the others and without a
11
+ * new lock. The terms carry their own version inside the terms hash.
12
+ */
13
+ export declare const MESSAGE_VERSIONS: {
14
+ readonly Approval: "1";
15
+ readonly Acceptance: "1";
16
+ readonly Report: "1";
17
+ readonly ReleaseConsent: "1";
18
+ readonly Evidence: "1";
19
+ readonly BusinessAction: "1";
20
+ readonly SupplierAction: "1";
21
+ readonly Mandate: '1';
22
+ readonly TermsAgreement: '1';
23
+ readonly SupplierAuthorization: '1';
24
+ readonly HumanApproval: '1';
25
+ readonly StartReceipt: '1';
26
+ readonly ApiRequest: '1';
27
+ readonly Timestamp: '1';
28
+ };
29
+ type VersionedType = keyof typeof MESSAGE_VERSIONS;
30
+ /** The domain versions this package reads for each message type. */
31
+ export declare const SUPPORTED_MESSAGE_VERSIONS: {
32
+ readonly [T in VersionedType]: readonly string[];
33
+ };
34
+ /**
35
+ * Whether this package reads a message of this type at this domain version. The type comes from
36
+ * whoever sent the message, so only the table's own keys count, never a name every object inherits
37
+ * such as `constructor`.
38
+ */
39
+ export declare function isSupportedMessageVersion(type: string, version: string): boolean;
40
+ /**
41
+ * The version of a stored commitment record. Version 2 added the references a record cites.
42
+ * Version 3 gave a reserve that went back at its release date its own kind of outcome, which
43
+ * versions 1 and 2 recorded as kept, as they did the supplier's consent. A version 1 or 2 record
44
+ * reads as version 3, citing nothing when it's version 1. One that ended as kept stays version 2,
45
+ * so writing it back keeps its meaning. The record's terms carry their own version.
46
+ */
47
+ export declare const COMMITMENT_RECORD_VERSION = "3";
48
+ /** The version of the mandate check in `checkMandate`, recorded on every decision. */
49
+ export declare const POLICY_VERSION = "mandate-check/1";
50
+ export {};
51
+ //# sourceMappingURL=version.d.ts.map