@nuanu-ai/agentify-contracts 0.5.0 → 0.7.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.
@@ -39,13 +39,13 @@ export declare const AmountSchema: z.ZodString;
39
39
  * does not yet say which of the two it carries, so the shape has to admit
40
40
  * both: a national code is three letters (`USD`), and a token ticker is longer
41
41
  * and sometimes carries a digit (`USDC`, `USD1`). Eight admits every ticker
42
- * this contract has had to carry; which currencies are accepted is the
43
- * gateway's to decide.
42
+ * this contract has had to carry.
44
43
  *
45
- * What this does not do is check membership in any list. We hold no currency
46
- * table, and a schema that pretended to would be claiming knowledge the
47
- * package does not have. Which currencies the gateway accepts is a gateway
48
- * question, and it is not answered here.
44
+ * What this does not do is check membership in any list. Which currencies a
45
+ * merchant may set a price in is answered once, by the price rule in
46
+ * `price-rule.ts`, at the moment a price comes in. This shape also reads back
47
+ * every document already written, and a list here would make one written
48
+ * before the list changed unreadable.
49
49
  */
50
50
  export declare const CurrencyCodeSchema: z.ZodString;
51
51
  /** A sum of money: how much, in what. */
@@ -67,6 +67,18 @@ export declare const MoneySchema: z.ZodObject<{
67
67
  */
68
68
  export declare const TimestampSchema: z.ZodISODateTime;
69
69
  export declare const IdentifierSchema: z.ZodString;
70
+ /**
71
+ * A word of a vocabulary that grows without a version (ADR-0006 §5): a mode
72
+ * on the card an agent reads, a status on its order.
73
+ *
74
+ * The storefront has no version, so a word added later reaches agents that
75
+ * still hold this contract, and they read it rather than refuse the document.
76
+ * Open is not anything at all, though: a word is read by a program and shown
77
+ * to a person, so it has the shape every word in those lists already has —
78
+ * lower-case letters, digits and underscores, starting with a letter — and
79
+ * markup, padding or a page of text is not one.
80
+ */
81
+ export declare const OpenWordSchema: z.ZodString;
70
82
  /**
71
83
  * The price a purchase actually went through at.
72
84
  *
@@ -100,4 +112,5 @@ export type CurrencyCode = z.infer<typeof CurrencyCodeSchema>;
100
112
  export type Money = z.infer<typeof MoneySchema>;
101
113
  export type Timestamp = z.infer<typeof TimestampSchema>;
102
114
  export type Identifier = z.infer<typeof IdentifierSchema>;
115
+ export type OpenWord = z.infer<typeof OpenWordSchema>;
103
116
  export type SalePrice = z.infer<typeof SalePriceSchema>;
@@ -41,13 +41,13 @@ export const AmountSchema = z
41
41
  * does not yet say which of the two it carries, so the shape has to admit
42
42
  * both: a national code is three letters (`USD`), and a token ticker is longer
43
43
  * and sometimes carries a digit (`USDC`, `USD1`). Eight admits every ticker
44
- * this contract has had to carry; which currencies are accepted is the
45
- * gateway's to decide.
44
+ * this contract has had to carry.
46
45
  *
47
- * What this does not do is check membership in any list. We hold no currency
48
- * table, and a schema that pretended to would be claiming knowledge the
49
- * package does not have. Which currencies the gateway accepts is a gateway
50
- * question, and it is not answered here.
46
+ * What this does not do is check membership in any list. Which currencies a
47
+ * merchant may set a price in is answered once, by the price rule in
48
+ * `price-rule.ts`, at the moment a price comes in. This shape also reads back
49
+ * every document already written, and a list here would make one written
50
+ * before the list changed unreadable.
51
51
  */
52
52
  export const CurrencyCodeSchema = z
53
53
  .string()
@@ -100,6 +100,20 @@ export const IdentifierSchema = z.string().regex(
100
100
  // then anything printable, then a last character under the same rule as the
101
101
  // first. One character on its own is allowed; nothing at all is not.
102
102
  new RegExp(`^[^\\s${UNPRINTABLE}](?:[^${UNPRINTABLE}]*[^\\s${UNPRINTABLE}])?$`, "u"), "an identifier must not be empty, padded with whitespace, or carry characters that show nothing");
103
+ /**
104
+ * A word of a vocabulary that grows without a version (ADR-0006 §5): a mode
105
+ * on the card an agent reads, a status on its order.
106
+ *
107
+ * The storefront has no version, so a word added later reaches agents that
108
+ * still hold this contract, and they read it rather than refuse the document.
109
+ * Open is not anything at all, though: a word is read by a program and shown
110
+ * to a person, so it has the shape every word in those lists already has —
111
+ * lower-case letters, digits and underscores, starting with a letter — and
112
+ * markup, padding or a page of text is not one.
113
+ */
114
+ export const OpenWordSchema = z
115
+ .string()
116
+ .regex(/^[a-z][a-z0-9_]{0,63}$/, "a word of this vocabulary is lower-case letters, digits and underscores, starts with a letter and is at most sixty-four characters long");
103
117
  /**
104
118
  * The price a purchase actually went through at.
105
119
  *
package/dist/quote.js CHANGED
@@ -82,7 +82,9 @@ export const QuoteRequestSchema = z.strictObject({
82
82
  export const QuoteResponseSchema = z.discriminatedUnion("available", [
83
83
  z.strictObject({
84
84
  available: z.literal(true),
85
- price: MoneySchema,
85
+ price: MoneySchema.meta({
86
+ description: 'Held to the rule a card\'s price meets at publication: above zero, in USD or USDC, with two to six digits after the dot ("5.00", "0.001"); an answer that breaks it is refused and prices nothing.',
87
+ }),
86
88
  as_of: TimestampSchema,
87
89
  }),
88
90
  z.strictObject({
package/dist/results.d.ts CHANGED
@@ -102,9 +102,10 @@ export declare const OrderCallResultSchema: z.ZodEnum<{
102
102
  * merchant in its own words rather than be flattened into the nearest of
103
103
  * three. `refund_already_settled` — the debt was paid back, so there is
104
104
  * nothing left to deliver against. `order_already_closed` — the order reached
105
- * an ending that no call reopens. `not_applicable_in_mode` — the call does not
106
- * exist for this card's mode, as refusing separately does not in the
107
- * synchronous one, where the handler's own answer is the refusal.
105
+ * an ending that no call reopens. `not_applicable_in_mode` — the call or the
106
+ * answer does not exist for this card's mode, as delivering or refusing
107
+ * separately and taking the order on do not in the synchronous one, where the
108
+ * handler's own answer is the delivery or the refusal.
108
109
  * `delivery_does_not_match_card` — the goods are not the ones the card for
109
110
  * this order declares it delivers, so nothing was written down; the message
110
111
  * says whether the order still stands or has already ended, and the fields
@@ -203,7 +204,7 @@ export declare const CARD_REJECTED = "card_rejected";
203
204
  * merchant has no name set for buyers to read, no wallet set for their sales to
204
205
  * be paid into, or no approval from the operator for the live catalog. The
205
206
  * name is set with a call of the merchant's own (`POST /v0/seller-name`) or in
206
- * the cabinet; the wallet in the cabinet's Settings alone, since no key of the
207
+ * the dashboard; the wallet in the dashboard's Settings alone, since no key of the
207
208
  * merchant's code may say where the money goes; and the approval is the
208
209
  * operator's decision, with no call. The name is asked for everywhere, the
209
210
  * wallet wherever a payment settles and the approval on the live deployment
package/dist/results.js CHANGED
@@ -103,9 +103,10 @@ export const OrderCallResultSchema = z.enum(ORDER_CALL_RESULTS);
103
103
  * merchant in its own words rather than be flattened into the nearest of
104
104
  * three. `refund_already_settled` — the debt was paid back, so there is
105
105
  * nothing left to deliver against. `order_already_closed` — the order reached
106
- * an ending that no call reopens. `not_applicable_in_mode` — the call does not
107
- * exist for this card's mode, as refusing separately does not in the
108
- * synchronous one, where the handler's own answer is the refusal.
106
+ * an ending that no call reopens. `not_applicable_in_mode` — the call or the
107
+ * answer does not exist for this card's mode, as delivering or refusing
108
+ * separately and taking the order on do not in the synchronous one, where the
109
+ * handler's own answer is the delivery or the refusal.
109
110
  * `delivery_does_not_match_card` — the goods are not the ones the card for
110
111
  * this order declares it delivers, so nothing was written down; the message
111
112
  * says whether the order still stands or has already ended, and the fields
@@ -211,7 +212,7 @@ export const CallErrorSchema = z.strictObject({
211
212
  code: z.string().regex(/\S/, "an error carries a code").meta({
212
213
  // Same reason as the refusal code: the dictionary travels with the field
213
214
  // or it does not reach the reader the export exists for.
214
- description: 'Why the call did not go through. The set is open, and five are promised to mean one thing each — but not on the same calls, and which call a code can arrive on is part of what is promised about it. Publishing a card is refused with one word and no other: "card_rejected" (the card was not published, and every finding standing between it and the catalog is named in the error\'s problems — the fields at fault, and the merchant\'s own missing name, payout wallet or live operator approval where those are what is missing; it is never retryable, because the same card gets the same answer and what changes the outcome is fixing what the problems name). The calls that close an order — delivering, refusing, taking one on — are refused with the other four, and never with the first: "refund_already_settled" (the debt was paid back, so there is nothing left to deliver against). "order_already_closed" (the order reached an ending that no call reopens). "not_applicable_in_mode" (the call does not exist for this card\'s mode — refusing separately does not, in the synchronous one, where the handler\'s own answer is the refusal). "delivery_does_not_match_card" (the goods are not the ones the card for this order declares it delivers — nothing was written down, the problems name the fields that did not fit, and the message says whether the order still stands or has already ended). The last of those is retryable in a different sense from a lost connection: the call arrived and was understood, so sending the same goods again gives the same refusal, and what clears it is delivering what the card declares. It is not retryable at all where the order has already ended, because there is nothing left to deliver against.',
215
+ description: 'Why the call did not go through. The set is open, and five are promised to mean one thing each — but not on the same calls, and which call a code can arrive on is part of what is promised about it. Publishing a card is refused with one word and no other: "card_rejected" (the card was not published, and every finding standing between it and the catalog is named in the error\'s problems — the fields at fault, and the merchant\'s own missing name, payout wallet or live operator approval where those are what is missing; it is never retryable, because the same card gets the same answer and what changes the outcome is fixing what the problems name). The calls that close an order — delivering, refusing, taking one on — are refused with the other four, and never with the first: "refund_already_settled" (the debt was paid back, so there is nothing left to deliver against). "order_already_closed" (the order reached an ending that no call reopens). "not_applicable_in_mode" (the call or the answer does not exist for this card\'s mode — in the synchronous one the handler\'s own answer is the delivery or the refusal, so delivering or refusing separately does not exist there, and neither does taking an order on while it waits for its goods, which promises them later through a call that mode does not have). "delivery_does_not_match_card" (the goods are not the ones the card for this order declares it delivers — nothing was written down, the problems name the fields that did not fit, and the message says whether the order still stands or has already ended). The last of those is retryable in a different sense from a lost connection: the call arrived and was understood, so sending the same goods again gives the same refusal, and what clears it is delivering what the card declares. It is not retryable at all where the order has already ended, because there is nothing left to deliver against.',
215
216
  }),
216
217
  message: z.string().regex(/\S/, "an error carries an explanation a person can read"),
217
218
  retryable: z.boolean(),
@@ -247,7 +248,7 @@ export const CARD_REJECTED = "card_rejected";
247
248
  * merchant has no name set for buyers to read, no wallet set for their sales to
248
249
  * be paid into, or no approval from the operator for the live catalog. The
249
250
  * name is set with a call of the merchant's own (`POST /v0/seller-name`) or in
250
- * the cabinet; the wallet in the cabinet's Settings alone, since no key of the
251
+ * the dashboard; the wallet in the dashboard's Settings alone, since no key of the
251
252
  * merchant's code may say where the money goes; and the approval is the
252
253
  * operator's decision, with no call. The name is asked for everywhere, the
253
254
  * wallet wherever a payment settles and the approval on the live deployment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuanu-ai/agentify-contracts",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "The Agentify wire contract as code: the schemas for cards, orders, price checks and receipts that the gateway and the merchant SDK both read.",
6
6
  "keywords": [