@agentproto/corpus-cli 0.11.4 → 0.11.6

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.
@@ -0,0 +1,93 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentproto.sh/docs/aip-63/RECIPE.schema.json",
4
+ "title": "recipe/v1",
5
+ "description": "JSON Schema for the YAML frontmatter of an AIP-63 site recipe manifest (RECIPE.md). The property set is closed: an unknown top-level key is a load error, never a silent ignore (P2). The tool prefix rule (P3) and the workflow prefix rule (P4) are normative prose, not expressible here because each composes with the recipe id.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema", "id", "version", "title", "api", "sites", "tools", "publisher"],
9
+ "properties": {
10
+ "schema": { "const": "recipe/v1", "description": "Required, exact (P2)." },
11
+ "id": {
12
+ "type": "string",
13
+ "pattern": "^[a-z][a-z0-9-]{1,30}$",
14
+ "description": "Recipe id. Also the directory name (P1) and the base of the tool prefix (P3)."
15
+ },
16
+ "version": {
17
+ "type": "string",
18
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$",
19
+ "description": "Semver. One recipe, one version."
20
+ },
21
+ "title": { "type": "string", "minLength": 1, "description": "Display name." },
22
+ "api": {
23
+ "const": 1,
24
+ "description": "The recipe API version this recipe targets. A host MUST refuse an api it does not know."
25
+ },
26
+ "sites": {
27
+ "type": "array",
28
+ "minItems": 1,
29
+ "uniqueItems": true,
30
+ "items": { "$ref": "#/$defs/domain" },
31
+ "description": "Non-empty registrable domains, lowercase. The recipe's origin guard covers each domain and its subdomains exactly as C2 does for grants (P8)."
32
+ },
33
+ "accounts": {
34
+ "type": "array",
35
+ "uniqueItems": true,
36
+ "items": { "$ref": "#/$defs/domain" },
37
+ "description": "Optional subset of sites. The recipe needs an Account (C17) on these sites (P5, P11). A subset relation is not expressible in JSON Schema; the loader checks it."
38
+ },
39
+ "tools": {
40
+ "type": "array",
41
+ "minItems": 1,
42
+ "uniqueItems": true,
43
+ "items": { "$ref": "#/$defs/toolName" },
44
+ "description": "Exact set of tool names the entry returns (P6). Every name starts with the recipe's tool prefix (P3, prose)."
45
+ },
46
+ "workflows": {
47
+ "type": "array",
48
+ "uniqueItems": true,
49
+ "items": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
50
+ "description": "Exact set of workflow ids the entry returns (P6). Every id starts with `<id>-` (P4, prose)."
51
+ },
52
+ "writes": {
53
+ "type": "object",
54
+ "propertyNames": { "$ref": "#/$defs/toolName" },
55
+ "additionalProperties": { "type": "string", "enum": ["approve", "confirm"] },
56
+ "description": "Tool name to write gate level (P5, P9, P10). Every tool not listed is a read."
57
+ },
58
+ "probes": {
59
+ "type": "array",
60
+ "uniqueItems": true,
61
+ "items": { "type": "string", "pattern": "^[a-z][a-z0-9_-]*$" },
62
+ "description": "Exact set of probe ids the entry exports (P6, P15)."
63
+ },
64
+ "entry": {
65
+ "type": "string",
66
+ "minLength": 1,
67
+ "description": "Entry module path. Default dist/index.js (P1)."
68
+ },
69
+ "guide": {
70
+ "type": "string",
71
+ "minLength": 1,
72
+ "description": "Guide path. Default guide/GUIDE.md (P1)."
73
+ },
74
+ "publisher": {
75
+ "type": "string",
76
+ "minLength": 1,
77
+ "description": "Who publishes the recipe. Shown in discovery and in the guide's provenance."
78
+ }
79
+ },
80
+ "$defs": {
81
+ "domain": {
82
+ "type": "string",
83
+ "maxLength": 253,
84
+ "pattern": "^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+([a-z]{2,63}|xn--[a-z0-9-]{1,59})$",
85
+ "description": "An explicit lowercase registrable domain or host (at least two labels, ASCII or punycode). No wildcard, no leading dot, no bare TLD. A schema cannot see the Public Suffix List, so a host MUST additionally reject public suffixes at runtime (C2)."
86
+ },
87
+ "toolName": {
88
+ "type": "string",
89
+ "pattern": "^[a-z][a-z0-9_]*$",
90
+ "description": "Generic AIP-14 tool name shape. The recipe id prefix rule is prose (P3)."
91
+ }
92
+ }
93
+ }
@@ -54,6 +54,7 @@
54
54
  "minLength": 1,
55
55
  "description": "The agent or browser session that was recorded."
56
56
  },
57
+ "callerSessionId": { "type": "string", "minLength": 1, "description": "Caller session (AIP-63 L15) that drove the recorded targets, established by an AIP-59 sub-session token (R16)." },
57
58
  "provider": {
58
59
  "type": "string",
59
60
  "minLength": 1,
@@ -229,6 +230,7 @@
229
230
  "description": "Page URL when the action started, with fragment and any userinfo removed."
230
231
  },
231
232
  "tabId": { "type": "string", "minLength": 1 },
233
+ "callerSessionId": { "type": "string", "minLength": 1, "description": "Caller session (AIP-63 L15) that made this call." },
232
234
  "target": {
233
235
  "type": "object",
234
236
  "additionalProperties": false,
@@ -85,7 +85,7 @@
85
85
  "minLength": 1
86
86
  },
87
87
  "default": [],
88
- "description": "Free-form labels. Scope anchors are carried here in their formatted form (e.g. 'global', 'project:acme', 'agent:assistant', 'pr:acme/app#42'). Two anchors tie an item to an AIP-34 tree and an AIP-9 operator: 'node:<id>' (the AIP-34 node id, e.g. 'node:@acme/agentik') scopes visibility, and 'operator:<id>' (e.g. 'operator:pm-simone') marks ownership and never widens visibility. An item carries at most one of each; the node projection and write rules are in AIP-72 section 10."
88
+ "description": "Free-form labels. Scope anchors are carried here in their formatted form (e.g. 'global', 'project:acme', 'agent:assistant', 'pr:acme/app#42'). Two anchors tie an item to an AIP-34 tree and an AIP-9 operator: 'node:<id>' (the AIP-34 node id, e.g. 'node:@acme/agentik') scopes visibility, and 'operator:<id>' (e.g. 'operator:pm-demo') marks ownership and never widens visibility. An item carries at most one of each; the node projection and write rules are in AIP-72 section 10."
89
89
  },
90
90
  "polarity": {
91
91
  "enum": [
@@ -0,0 +1,545 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentproto.sh/schemas/aip-74/BILLING.schema.json",
4
+ "$comment": "DRAFT. Not frozen: it is frozen only after a product has read its own BILLING.md through a parser built from it (AIP-74 status Draft). It checks the SHAPE of the frontmatter. The cross-reference rules of AIP-74 rule 21 (unknown asset, partition, feature, conversion or rail reference, an offer currency that is neither the anchor currency nor an fx key, a grant key without {account}) need the whole document and belong to the parser, not to this schema.",
5
+ "title": "billing/v1 frontmatter (AIP-74, DRAFT)",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema",
10
+ "name",
11
+ "title",
12
+ "version",
13
+ "assets",
14
+ "primaryAsset",
15
+ "anchor",
16
+ "accounts",
17
+ "payer",
18
+ "rails"
19
+ ],
20
+ "properties": {
21
+ "schema": { "const": "billing/v1" },
22
+ "name": { "$ref": "#/$defs/id" },
23
+ "title": { "type": "string", "minLength": 1 },
24
+ "version": {
25
+ "type": "string",
26
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$",
27
+ "description": "Semver. Bump on any change of amount, expiry, right, anchor or fx (rule 23)."
28
+ },
29
+ "assets": {
30
+ "type": "array",
31
+ "minItems": 1,
32
+ "description": "AIP-49 asset declarations, inline, or { ref } for a shared asset (fiat). The default partition of a fiat asset is implicit.",
33
+ "items": {
34
+ "oneOf": [
35
+ {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": ["ref"],
39
+ "properties": { "ref": { "$ref": "#/$defs/assetRef" } }
40
+ },
41
+ { "$ref": "https://agentproto.sh/schemas/aip-49/ASSET.schema.json" }
42
+ ]
43
+ }
44
+ },
45
+ "primaryAsset": {
46
+ "$ref": "#/$defs/assetRef",
47
+ "description": "The asset spends draw from. Its value is defined by `anchor` only (rule 26)."
48
+ },
49
+ "anchor": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["currency", "creditsPerUnit"],
53
+ "description": "The ONE adjustable value of a credit: creditsPerUnit credits of primaryAsset per major unit of `currency` (rule 26).",
54
+ "properties": {
55
+ "currency": { "$ref": "#/$defs/currency" },
56
+ "creditsPerUnit": { "type": "number", "exclusiveMinimum": 0 }
57
+ }
58
+ },
59
+ "fx": {
60
+ "type": "object",
61
+ "description": "Fixed configuration, never a live exchange rate: anchor units per one unit of the local currency (EUR: 1.18 means 1 EUR = 1.18 USD when the anchor is USD). Entry rate of a fiat F = anchor.creditsPerUnit x fx[F] (rule 26).",
62
+ "propertyNames": { "$ref": "#/$defs/currency" },
63
+ "additionalProperties": { "type": "number", "exclusiveMinimum": 0 }
64
+ },
65
+ "spendOrder": {
66
+ "type": "array",
67
+ "uniqueItems": true,
68
+ "items": { "$ref": "#/$defs/partitionId" },
69
+ "description": "Optional tie-break after the AIP-49 normative order."
70
+ },
71
+ "taxBasis": {
72
+ "enum": ["net", "gross"],
73
+ "description": "Required by the parser when any conversion starts from fiat (rule 13)."
74
+ },
75
+ "features": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "required": ["id", "type"],
81
+ "properties": {
82
+ "id": { "$ref": "#/$defs/featureId" },
83
+ "type": { "enum": ["boolean", "credits"] }
84
+ }
85
+ }
86
+ },
87
+ "accounts": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": ["kinds", "hierarchy"],
91
+ "properties": {
92
+ "kinds": {
93
+ "type": "array",
94
+ "minItems": 1,
95
+ "items": { "$ref": "#/$defs/id" },
96
+ "description": "Host vocabulary."
97
+ },
98
+ "hierarchy": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["maxDepth", "funding"],
102
+ "properties": {
103
+ "maxDepth": { "type": "integer", "minimum": 0, "maximum": 3 },
104
+ "funding": {
105
+ "type": "array",
106
+ "uniqueItems": true,
107
+ "items": { "enum": ["pool", "allocated_budget"] }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "payer": {
114
+ "type": "object",
115
+ "additionalProperties": false,
116
+ "required": ["strategy", "owner"],
117
+ "properties": {
118
+ "strategy": {
119
+ "oneOf": [
120
+ { "enum": ["self", "hierarchy/v1"] },
121
+ { "$ref": "#/$defs/vendorStrategy" }
122
+ ]
123
+ },
124
+ "owner": {
125
+ "type": "array",
126
+ "minItems": 1,
127
+ "uniqueItems": true,
128
+ "items": { "type": "string", "minLength": 1 },
129
+ "description": "Context keys that identify the payer. Server-side keys only (rule 20)."
130
+ },
131
+ "affordability": { "enum": ["balance", "spendable"], "default": "balance" }
132
+ }
133
+ },
134
+ "transfers": {
135
+ "type": "object",
136
+ "additionalProperties": false,
137
+ "required": ["allow"],
138
+ "description": "Parent to child allocation (AIP-49 transfer).",
139
+ "properties": {
140
+ "allow": {
141
+ "type": "array",
142
+ "minItems": 1,
143
+ "uniqueItems": true,
144
+ "items": { "enum": ["allocate", "reclaim"] }
145
+ },
146
+ "from": {
147
+ "type": "array",
148
+ "items": { "$ref": "#/$defs/partitionId" },
149
+ "description": "What a parent may allocate."
150
+ },
151
+ "expiry": {
152
+ "const": "inherit",
153
+ "description": "The child lot keeps the origin lot's expiry."
154
+ }
155
+ }
156
+ },
157
+ "conversions": {
158
+ "type": "array",
159
+ "items": { "$ref": "#/$defs/conversion" }
160
+ },
161
+ "offers": {
162
+ "type": "array",
163
+ "items": { "$ref": "#/$defs/offer" }
164
+ },
165
+ "grants": {
166
+ "type": "array",
167
+ "items": { "$ref": "#/$defs/grant" }
168
+ },
169
+ "rails": {
170
+ "type": "array",
171
+ "items": {
172
+ "type": "object",
173
+ "additionalProperties": false,
174
+ "required": ["id"],
175
+ "properties": {
176
+ "id": {
177
+ "$ref": "#/$defs/railId",
178
+ "description": "Unique in the file (rule 21)."
179
+ },
180
+ "provider": {
181
+ "$ref": "#/$defs/railId",
182
+ "description": "SettlementProvider kind; default is the id. Two accounts of one provider are two entries with two ids."
183
+ },
184
+ "productTag": { "type": "string", "minLength": 1, "description": "The provider account or product tag (for example consumer-app, team-workspace); filters events when one account serves several products." },
185
+ "env": {
186
+ "type": "object",
187
+ "additionalProperties": false,
188
+ "description": "Variable NAMES, never values. Defaults are <RAIL>_SECRET_KEY, <RAIL>_WEBHOOK_SECRET, <RAIL>_MODE.",
189
+ "properties": {
190
+ "secretKey": { "$ref": "#/$defs/envName" },
191
+ "webhookSecret": { "$ref": "#/$defs/envName" },
192
+ "mode": { "$ref": "#/$defs/envName" }
193
+ }
194
+ }
195
+ }
196
+ }
197
+ },
198
+ "metadata": {
199
+ "type": "object",
200
+ "description": "Vendor extensions, namespaced under <vendor>. Never overrides a field above."
201
+ }
202
+ },
203
+ "$defs": {
204
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
205
+ "featureId": {
206
+ "type": "string",
207
+ "pattern": "^[a-z][a-z0-9_-]*$",
208
+ "description": "Underscores allowed: provider feature ids such as Autumn's paid_plan are kept as they are."
209
+ },
210
+ "railId": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
211
+ "envName": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
212
+ "currency": {
213
+ "type": "string",
214
+ "pattern": "^[A-Za-z]{3}$",
215
+ "description": "ISO 4217, either case; the parser normalises to upper case (rule 22)."
216
+ },
217
+ "assetRef": {
218
+ "type": "string",
219
+ "pattern": "^(aip://49/)?[A-Z][A-Z0-9_]*$"
220
+ },
221
+ "fiatRef": {
222
+ "type": "string",
223
+ "pattern": "^(aip://49/)?[A-Z]{3}$"
224
+ },
225
+ "partitionId": {
226
+ "type": "string",
227
+ "pattern": "^[A-Z][A-Z0-9_]*:[A-Za-z0-9_-]+$"
228
+ },
229
+ "duration": {
230
+ "type": "string",
231
+ "pattern": "^P(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?$",
232
+ "description": "ISO 8601 duration."
233
+ },
234
+ "vendorStrategy": {
235
+ "type": "string",
236
+ "pattern": "^x-[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$",
237
+ "description": "x-<vendor>:<name>, resolved from a registry fixed at build time. A host that does not know it refuses the manifest."
238
+ },
239
+ "expiry": {
240
+ "oneOf": [
241
+ {
242
+ "type": "object",
243
+ "additionalProperties": false,
244
+ "required": ["after"],
245
+ "properties": { "after": { "$ref": "#/$defs/duration" } }
246
+ },
247
+ {
248
+ "type": "object",
249
+ "additionalProperties": false,
250
+ "required": ["atPeriodEnd"],
251
+ "properties": { "atPeriodEnd": { "const": true } }
252
+ }
253
+ ]
254
+ },
255
+ "conversion": {
256
+ "type": "object",
257
+ "additionalProperties": false,
258
+ "required": ["id", "from", "to", "mint"],
259
+ "properties": {
260
+ "id": { "$ref": "#/$defs/id" },
261
+ "from": { "$ref": "#/$defs/assetRef" },
262
+ "to": { "$ref": "#/$defs/assetRef" },
263
+ "rate": {
264
+ "oneOf": [
265
+ {
266
+ "type": "object",
267
+ "additionalProperties": false,
268
+ "required": ["kind", "ratio"],
269
+ "properties": {
270
+ "kind": { "const": "fixed" },
271
+ "ratio": { "type": "number", "exclusiveMinimum": 0 }
272
+ }
273
+ },
274
+ {
275
+ "type": "object",
276
+ "additionalProperties": false,
277
+ "required": ["kind", "source"],
278
+ "properties": {
279
+ "kind": { "const": "oracle" },
280
+ "source": { "type": "string", "minLength": 1 }
281
+ }
282
+ }
283
+ ],
284
+ "description": "Destination major units per source major unit (rule 9). FORBIDDEN when `from` is fiat: that rate is computed from anchor and fx (rule 26)."
285
+ },
286
+ "rail": { "$ref": "#/$defs/railId" },
287
+ "mint": {
288
+ "type": "object",
289
+ "additionalProperties": false,
290
+ "required": ["partition"],
291
+ "properties": {
292
+ "partition": { "$ref": "#/$defs/partitionId" },
293
+ "expires": { "$ref": "#/$defs/expiry" }
294
+ }
295
+ },
296
+ "bonus": {
297
+ "type": "object",
298
+ "additionalProperties": false,
299
+ "required": ["strategy", "partition", "tiers"],
300
+ "description": "Fiat entries only (rule 21). Minted as its own lot, never drawn by a conversion, never reclaimed into money (rule 12).",
301
+ "properties": {
302
+ "strategy": { "enum": ["tiered-lots/v1"] },
303
+ "partition": { "$ref": "#/$defs/partitionId" },
304
+ "tiers": {
305
+ "type": "array",
306
+ "minItems": 1,
307
+ "items": {
308
+ "type": "array",
309
+ "minItems": 2,
310
+ "maxItems": 2,
311
+ "prefixItems": [
312
+ { "type": "integer", "minimum": 0 },
313
+ { "type": "number", "minimum": 0, "maximum": 100 }
314
+ ],
315
+ "description": "[fromMinor, percent]: the highest tier whose fromMinor is at most the paid amount applies."
316
+ }
317
+ }
318
+ }
319
+ },
320
+ "capMinor": {
321
+ "type": "object",
322
+ "additionalProperties": false,
323
+ "required": ["amount", "windowSec"],
324
+ "description": "In minor units of `from`, per principal.",
325
+ "properties": {
326
+ "amount": { "type": "integer", "minimum": 0 },
327
+ "windowSec": { "type": "integer", "minimum": 1 }
328
+ }
329
+ },
330
+ "enabled": { "type": "boolean", "default": true }
331
+ },
332
+ "if": {
333
+ "properties": { "from": { "$ref": "#/$defs/fiatRef" } },
334
+ "required": ["from"]
335
+ },
336
+ "then": {
337
+ "required": ["rail"],
338
+ "not": { "required": ["rate"] }
339
+ },
340
+ "else": {
341
+ "required": ["rate"],
342
+ "not": { "anyOf": [{ "required": ["rail"] }, { "required": ["bonus"] }] }
343
+ }
344
+ },
345
+ "include": {
346
+ "oneOf": [
347
+ {
348
+ "type": "object",
349
+ "additionalProperties": false,
350
+ "required": ["feature"],
351
+ "properties": { "feature": { "$ref": "#/$defs/featureId" } }
352
+ },
353
+ {
354
+ "type": "object",
355
+ "additionalProperties": false,
356
+ "required": ["feature", "amountMinor", "partition"],
357
+ "properties": {
358
+ "feature": { "$ref": "#/$defs/featureId" },
359
+ "partition": {
360
+ "$ref": "#/$defs/partitionId",
361
+ "description": "The partition the included credits are minted into."
362
+ },
363
+ "amountMinor": {
364
+ "type": "integer",
365
+ "minimum": 0,
366
+ "description": "Minor units of primaryAsset. NOT derived from the conversion: an include is a period allocation, not a purchase (AIP-74 offer types)."
367
+ },
368
+ "rollover": { "enum": ["none", "unbounded"], "default": "none" }
369
+ }
370
+ }
371
+ ]
372
+ },
373
+ "price": {
374
+ "description": "AIP-55 price, extended by AIP-55 annex amendment (subscription, pack and buyer-chosen prepaid-pool, x-<vendor> models).",
375
+ "oneOf": [
376
+ {
377
+ "type": "object",
378
+ "additionalProperties": false,
379
+ "required": ["model", "amountMinor", "currency"],
380
+ "properties": {
381
+ "model": { "enum": ["one-time", "prepaid-pool"] },
382
+ "amountMinor": { "type": "integer", "minimum": 1 },
383
+ "currency": { "$ref": "#/$defs/currency" }
384
+ }
385
+ },
386
+ {
387
+ "type": "object",
388
+ "additionalProperties": false,
389
+ "required": ["model", "amountMinor", "currency"],
390
+ "properties": {
391
+ "model": { "const": "prepaid-pool" },
392
+ "amountMinor": { "const": "buyer" },
393
+ "minMinor": { "type": "integer", "minimum": 1, "description": "Absent: no minimum." },
394
+ "maxMinor": { "type": "integer", "minimum": 1, "description": "Absent: no maximum." },
395
+ "currency": { "$ref": "#/$defs/currency" }
396
+ }
397
+ },
398
+ {
399
+ "type": "object",
400
+ "additionalProperties": false,
401
+ "required": ["model", "amountMinor", "currency", "interval"],
402
+ "properties": {
403
+ "model": { "const": "subscription" },
404
+ "amountMinor": { "type": "integer", "minimum": 1 },
405
+ "currency": { "$ref": "#/$defs/currency" },
406
+ "interval": { "enum": ["week", "month", "year"] },
407
+ "intervalCount": { "type": "integer", "minimum": 1, "default": 1 }
408
+ }
409
+ },
410
+ {
411
+ "type": "object",
412
+ "required": ["model"],
413
+ "properties": {
414
+ "model": { "$ref": "#/$defs/vendorStrategy" }
415
+ }
416
+ }
417
+ ]
418
+ },
419
+ "offer": {
420
+ "type": "object",
421
+ "additionalProperties": false,
422
+ "required": ["id", "price"],
423
+ "properties": {
424
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9_-]*$" },
425
+ "price": { "$ref": "#/$defs/price" },
426
+ "convert": {
427
+ "$ref": "#/$defs/id",
428
+ "description": "prepaid-pool only: the conversion the payment runs."
429
+ },
430
+ "includes": {
431
+ "type": "array",
432
+ "items": { "$ref": "#/$defs/include" },
433
+ "description": "one-time (given once) and subscription (given per paid period). Forbidden on prepaid-pool (rule 21)."
434
+ },
435
+ "subscription": {
436
+ "type": "object",
437
+ "additionalProperties": false,
438
+ "required": ["anchor", "onUpgrade"],
439
+ "description": "subscription only. `grace` absent means no grace: the period closes at the failed renewal.",
440
+ "properties": {
441
+ "anchor": {
442
+ "enum": ["payment", "calendar"],
443
+ "description": "When the period's includes are given: at the payment date, or at the calendar period boundary."
444
+ },
445
+ "grace": { "$ref": "#/$defs/duration" },
446
+ "onUpgrade": { "enum": ["none", "prorate"] }
447
+ }
448
+ },
449
+ "rail": {
450
+ "type": "object",
451
+ "minProperties": 1,
452
+ "propertyNames": { "$ref": "#/$defs/railId" },
453
+ "additionalProperties": {
454
+ "type": "object",
455
+ "additionalProperties": false,
456
+ "required": ["lookupKey"],
457
+ "properties": { "lookupKey": { "type": "string", "minLength": 1 } }
458
+ },
459
+ "description": "Existing provider ids to keep (for example a Stripe lookup_key)."
460
+ }
461
+ },
462
+ "allOf": [
463
+ {
464
+ "if": {
465
+ "properties": {
466
+ "price": { "properties": { "model": { "const": "prepaid-pool" } }, "required": ["model"] }
467
+ },
468
+ "required": ["price"]
469
+ },
470
+ "then": { "required": ["convert"], "not": { "required": ["includes"] } },
471
+ "else": { "not": { "required": ["convert"] } }
472
+ },
473
+ {
474
+ "if": {
475
+ "properties": {
476
+ "price": { "properties": { "model": { "const": "subscription" } }, "required": ["model"] }
477
+ },
478
+ "required": ["price"]
479
+ },
480
+ "then": { "required": ["subscription", "includes"] },
481
+ "else": { "not": { "required": ["subscription"] } }
482
+ }
483
+ ]
484
+ },
485
+ "grant": {
486
+ "type": "object",
487
+ "additionalProperties": false,
488
+ "required": ["id", "trigger", "amount", "partition", "key"],
489
+ "properties": {
490
+ "id": { "$ref": "#/$defs/id" },
491
+ "trigger": {
492
+ "oneOf": [
493
+ { "$ref": "https://agentproto.sh/schemas/aip-41/ROUTINE.schema.json#/$defs/scheduleCron" },
494
+ { "$ref": "https://agentproto.sh/schemas/aip-41/ROUTINE.schema.json#/$defs/scheduleCalendar" },
495
+ { "$ref": "https://agentproto.sh/schemas/aip-41/ROUTINE.schema.json#/$defs/scheduleEvent" },
496
+ { "$ref": "https://agentproto.sh/schemas/aip-41/ROUTINE.schema.json#/$defs/scheduleManual" }
497
+ ],
498
+ "description": "An AIP-41 schedule block: cron, calendar, event or manual. Evaluated in UTC unless the block names a timezone."
499
+ },
500
+ "eligible": {
501
+ "type": "object",
502
+ "additionalProperties": false,
503
+ "properties": {
504
+ "plans": {
505
+ "type": "array",
506
+ "minItems": 1,
507
+ "items": { "type": "string", "minLength": 1 },
508
+ "description": "Offer ids, or the literal none for an account with no paid offer."
509
+ }
510
+ }
511
+ },
512
+ "amount": {
513
+ "oneOf": [
514
+ {
515
+ "type": "object",
516
+ "additionalProperties": false,
517
+ "required": ["fixedMinor"],
518
+ "properties": { "fixedMinor": { "type": "integer", "minimum": 1 } }
519
+ },
520
+ {
521
+ "type": "object",
522
+ "additionalProperties": false,
523
+ "required": ["fromContext"],
524
+ "properties": { "fromContext": { "const": true } }
525
+ },
526
+ {
527
+ "type": "object",
528
+ "additionalProperties": false,
529
+ "required": ["strategy"],
530
+ "properties": { "strategy": { "$ref": "#/$defs/vendorStrategy" } }
531
+ }
532
+ ]
533
+ },
534
+ "partition": { "$ref": "#/$defs/partitionId" },
535
+ "mode": { "enum": ["add", "top-up"], "default": "add" },
536
+ "expires": { "$ref": "#/$defs/expiry" },
537
+ "key": {
538
+ "type": "string",
539
+ "pattern": "\\{account\\}",
540
+ "description": "Suffix template of the deterministic key grant:<id>:<suffix>. MUST contain {account}; {period} for cron and calendar triggers (rule 15)."
541
+ }
542
+ }
543
+ }
544
+ }
545
+ }