@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.
package/dist/api.d.ts CHANGED
@@ -47,6 +47,7 @@
47
47
  * at all.
48
48
  */
49
49
  import { z } from "zod";
50
+ import type { Fulfillment, PublicCard } from "./card.js";
50
51
  /**
51
52
  * An order together with the word for where it stands.
52
53
  *
@@ -493,7 +494,7 @@ export declare const PurchaseRequestSchema: z.ZodObject<{
493
494
  export declare const AgentOrderStatusSchema: z.ZodObject<{
494
495
  order_id: z.ZodString;
495
496
  status_url: z.ZodURL;
496
- status: z.ZodEnum<{
497
+ status: z.ZodUnion<readonly [z.ZodEnum<{
497
498
  delivered: "delivered";
498
499
  in_progress: "in_progress";
499
500
  rejected: "rejected";
@@ -504,20 +505,24 @@ export declare const AgentOrderStatusSchema: z.ZodObject<{
504
505
  refund_due: "refund_due";
505
506
  refunded: "refunded";
506
507
  delivered_unpaid: "delivered_unpaid";
507
- }>;
508
+ }>, z.ZodString]>;
508
509
  price: z.ZodNullable<z.ZodObject<{
509
510
  amount: z.ZodString;
510
511
  currency: z.ZodString;
511
512
  at: z.ZodISODateTime;
512
513
  as_of: z.ZodISODateTime;
513
- }, z.core.$strict>>;
514
+ }, z.core.$loose>>;
514
515
  delivered: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
515
516
  test: z.ZodBoolean;
516
517
  refusal: z.ZodOptional<z.ZodObject<{
517
518
  code: z.ZodString;
518
519
  message: z.ZodString;
519
- }, z.core.$strict>>;
520
- }, z.core.$strict>;
520
+ }, z.core.$loose>>;
521
+ seller: z.ZodObject<{
522
+ name: z.ZodNullable<z.ZodString>;
523
+ site: z.ZodNullable<z.ZodString>;
524
+ }, z.core.$loose>;
525
+ }, z.core.$loose>;
521
526
  /**
522
527
  * The catalog as an agent reads it.
523
528
  *
@@ -526,106 +531,28 @@ export declare const AgentOrderStatusSchema: z.ZodObject<{
526
531
  * Until then it makes no claim about completeness, and that is stated in the
527
532
  * document itself: an agent must not read the absence of a field about paging
528
533
  * as a promise that there is nothing more.
534
+ *
535
+ * It is read card by card (ADR-0006 §5). The storefront has no version, so a
536
+ * card of a mode or a shape added later reaches agents that still hold this
537
+ * contract, and one card they cannot read must leave every other card for
538
+ * sale. So the page holds its items as whatever they are, and `cardsOf` reads
539
+ * each one on its own against the card an agent reads.
529
540
  */
530
541
  export declare const CatalogPageSchema: z.ZodObject<{
531
- items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
532
- id: z.ZodString;
533
- title: z.ZodString;
534
- description: z.ZodString;
535
- price: z.ZodObject<{
536
- amount: z.ZodString;
537
- currency: z.ZodString;
538
- }, z.core.$strict>;
539
- as_of: z.ZodISODateTime;
540
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
541
- type: z.ZodEnum<{
542
- string: "string";
543
- number: "number";
544
- boolean: "boolean";
545
- integer: "integer";
546
- }>;
547
- required: z.ZodOptional<z.ZodBoolean>;
548
- title: z.ZodOptional<z.ZodString>;
549
- }, z.core.$strict>>>;
550
- result: z.ZodRecord<z.ZodString, z.ZodObject<{
551
- type: z.ZodEnum<{
552
- string: "string";
553
- number: "number";
554
- boolean: "boolean";
555
- integer: "integer";
556
- }>;
557
- required: z.ZodOptional<z.ZodBoolean>;
558
- title: z.ZodOptional<z.ZodString>;
559
- }, z.core.$strict>>;
560
- price_checked_at_purchase: z.ZodBoolean;
561
- fulfillment: z.ZodLiteral<"sync">;
562
- }, z.core.$strict>, z.ZodObject<{
563
- id: z.ZodString;
564
- title: z.ZodString;
565
- description: z.ZodString;
566
- price: z.ZodObject<{
567
- amount: z.ZodString;
568
- currency: z.ZodString;
569
- }, z.core.$strict>;
570
- as_of: z.ZodISODateTime;
571
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
572
- type: z.ZodEnum<{
573
- string: "string";
574
- number: "number";
575
- boolean: "boolean";
576
- integer: "integer";
577
- }>;
578
- required: z.ZodOptional<z.ZodBoolean>;
579
- title: z.ZodOptional<z.ZodString>;
580
- }, z.core.$strict>>>;
581
- result: z.ZodRecord<z.ZodString, z.ZodObject<{
582
- type: z.ZodEnum<{
583
- string: "string";
584
- number: "number";
585
- boolean: "boolean";
586
- integer: "integer";
587
- }>;
588
- required: z.ZodOptional<z.ZodBoolean>;
589
- title: z.ZodOptional<z.ZodString>;
590
- }, z.core.$strict>>;
591
- price_checked_at_purchase: z.ZodBoolean;
592
- fulfillment: z.ZodLiteral<"async">;
593
- fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
594
- }, z.core.$strict>, z.ZodObject<{
595
- id: z.ZodString;
596
- title: z.ZodString;
597
- description: z.ZodString;
598
- price: z.ZodObject<{
599
- amount: z.ZodString;
600
- currency: z.ZodString;
601
- }, z.core.$strict>;
602
- as_of: z.ZodISODateTime;
603
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
604
- type: z.ZodEnum<{
605
- string: "string";
606
- number: "number";
607
- boolean: "boolean";
608
- integer: "integer";
609
- }>;
610
- required: z.ZodOptional<z.ZodBoolean>;
611
- title: z.ZodOptional<z.ZodString>;
612
- }, z.core.$strict>>>;
613
- result: z.ZodRecord<z.ZodString, z.ZodObject<{
614
- type: z.ZodEnum<{
615
- string: "string";
616
- number: "number";
617
- boolean: "boolean";
618
- integer: "integer";
619
- }>;
620
- required: z.ZodOptional<z.ZodBoolean>;
621
- title: z.ZodOptional<z.ZodString>;
622
- }, z.core.$strict>>;
623
- price_checked_at_purchase: z.ZodBoolean;
624
- fulfillment: z.ZodLiteral<"confirm">;
625
- confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
626
- fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
627
- }, z.core.$strict>], "fulfillment">>;
628
- }, z.core.$strict>;
542
+ items: z.ZodArray<z.ZodUnknown>;
543
+ }, z.core.$loose>;
544
+ /**
545
+ * The cards of a catalog page a reader of this contract can buy from, each read
546
+ * on its own.
547
+ *
548
+ * Two kinds of item are passed over, and the rest of the page stands. One that
549
+ * does not read as a card at all, and one that does but is sold in a mode this
550
+ * contract does not name: its reader cannot know when such goods arrive or when
551
+ * the money moves, so it must not buy on it.
552
+ */
553
+ export declare const cardsOf: (page: CatalogPage) => (PublicCard & {
554
+ readonly fulfillment: Fulfillment;
555
+ })[];
629
556
  /**
630
557
  * The methods this surface uses.
631
558
  *
@@ -783,7 +710,7 @@ export type ErrorEnvelope = z.infer<typeof ErrorEnvelopeSchema>;
783
710
  * has to act on it belongs to the route that sends it and to the sentence the
784
711
  * refusal carries.
785
712
  */
786
- export declare const ERROR_CODES: readonly ["body_too_large", "body_undecodable", "call_refused", "charset_unsupported", "encoding_unsupported", "gateway_failed", "key_made_for_a_cabinet", "key_opened_this_call", "malformed_body", "malformed_query", "merchant_departed", "no_such_item", "no_such_key", "no_such_order", "no_such_route", "not_a_cabinet_key", "not_authorised", "not_invited", "not_selling", "not_this_purchase", "order_closed_before_it_was_priced", "order_not_priced_yet", "params_do_not_fit", "payment_already_spent", "payment_not_taken", "payment_not_verified", "wallet_change_not_announced", "wallet_change_nobody_to_tell", "wallet_change_raced", "wallet_change_unconfirmed"];
713
+ export declare const ERROR_CODES: readonly ["body_too_large", "body_undecodable", "call_refused", "charset_unsupported", "encoding_unsupported", "gateway_failed", "key_made_for_a_dashboard", "key_opened_this_call", "malformed_body", "malformed_query", "merchant_departed", "no_such_item", "no_such_key", "no_such_order", "no_such_route", "not_a_dashboard_key", "not_authorised", "not_invited", "not_selling", "not_this_purchase", "order_closed_before_it_was_priced", "order_not_priced_yet", "params_do_not_fit", "payment_already_spent", "payment_not_taken", "payment_not_verified", "wallet_change_not_announced", "wallet_change_nobody_to_tell", "wallet_change_raced", "wallet_change_unconfirmed"];
787
714
  /** One of the codes this gateway is known to refuse a call with. */
788
715
  export type ErrorCode = (typeof ERROR_CODES)[number];
789
716
  /**
@@ -1255,6 +1182,7 @@ export declare const API_ROUTES: Readonly<{
1255
1182
  response: {
1256
1183
  document: z.ZodObject<{
1257
1184
  seller_name: z.ZodNullable<z.ZodString>;
1185
+ seller_site: z.ZodNullable<z.ZodString>;
1258
1186
  }, z.core.$strict>;
1259
1187
  };
1260
1188
  };
@@ -1264,11 +1192,13 @@ export declare const API_ROUTES: Readonly<{
1264
1192
  auth: "merchant_key";
1265
1193
  description: string;
1266
1194
  request: z.ZodObject<{
1267
- seller_name: z.ZodPipe<z.ZodString, z.ZodString>;
1195
+ seller_name: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
1196
+ seller_site: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
1268
1197
  }, z.core.$strict>;
1269
1198
  response: {
1270
1199
  document: z.ZodObject<{
1271
1200
  seller_name: z.ZodNullable<z.ZodString>;
1201
+ seller_site: z.ZodNullable<z.ZodString>;
1272
1202
  }, z.core.$strict>;
1273
1203
  };
1274
1204
  };
@@ -1361,7 +1291,7 @@ export declare const API_ROUTES: Readonly<{
1361
1291
  }, z.core.$strict>;
1362
1292
  };
1363
1293
  };
1364
- issue_cabinet_key: {
1294
+ issue_dashboard_key: {
1365
1295
  method: "POST";
1366
1296
  path: string;
1367
1297
  auth: "merchant_key";
@@ -1372,7 +1302,7 @@ export declare const API_ROUTES: Readonly<{
1372
1302
  }, z.core.$strict>;
1373
1303
  };
1374
1304
  };
1375
- forget_cabinet_key: {
1305
+ forget_dashboard_key: {
1376
1306
  method: "DELETE";
1377
1307
  path: string;
1378
1308
  auth: "merchant_key";
@@ -1725,104 +1655,8 @@ export declare const API_ROUTES: Readonly<{
1725
1655
  description: string;
1726
1656
  response: {
1727
1657
  document: z.ZodObject<{
1728
- items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1729
- id: z.ZodString;
1730
- title: z.ZodString;
1731
- description: z.ZodString;
1732
- price: z.ZodObject<{
1733
- amount: z.ZodString;
1734
- currency: z.ZodString;
1735
- }, z.core.$strict>;
1736
- as_of: z.ZodISODateTime;
1737
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1738
- type: z.ZodEnum<{
1739
- string: "string";
1740
- number: "number";
1741
- boolean: "boolean";
1742
- integer: "integer";
1743
- }>;
1744
- required: z.ZodOptional<z.ZodBoolean>;
1745
- title: z.ZodOptional<z.ZodString>;
1746
- }, z.core.$strict>>>;
1747
- result: z.ZodRecord<z.ZodString, z.ZodObject<{
1748
- type: z.ZodEnum<{
1749
- string: "string";
1750
- number: "number";
1751
- boolean: "boolean";
1752
- integer: "integer";
1753
- }>;
1754
- required: z.ZodOptional<z.ZodBoolean>;
1755
- title: z.ZodOptional<z.ZodString>;
1756
- }, z.core.$strict>>;
1757
- price_checked_at_purchase: z.ZodBoolean;
1758
- fulfillment: z.ZodLiteral<"sync">;
1759
- }, z.core.$strict>, z.ZodObject<{
1760
- id: z.ZodString;
1761
- title: z.ZodString;
1762
- description: z.ZodString;
1763
- price: z.ZodObject<{
1764
- amount: z.ZodString;
1765
- currency: z.ZodString;
1766
- }, z.core.$strict>;
1767
- as_of: z.ZodISODateTime;
1768
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1769
- type: z.ZodEnum<{
1770
- string: "string";
1771
- number: "number";
1772
- boolean: "boolean";
1773
- integer: "integer";
1774
- }>;
1775
- required: z.ZodOptional<z.ZodBoolean>;
1776
- title: z.ZodOptional<z.ZodString>;
1777
- }, z.core.$strict>>>;
1778
- result: z.ZodRecord<z.ZodString, z.ZodObject<{
1779
- type: z.ZodEnum<{
1780
- string: "string";
1781
- number: "number";
1782
- boolean: "boolean";
1783
- integer: "integer";
1784
- }>;
1785
- required: z.ZodOptional<z.ZodBoolean>;
1786
- title: z.ZodOptional<z.ZodString>;
1787
- }, z.core.$strict>>;
1788
- price_checked_at_purchase: z.ZodBoolean;
1789
- fulfillment: z.ZodLiteral<"async">;
1790
- fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1791
- }, z.core.$strict>, z.ZodObject<{
1792
- id: z.ZodString;
1793
- title: z.ZodString;
1794
- description: z.ZodString;
1795
- price: z.ZodObject<{
1796
- amount: z.ZodString;
1797
- currency: z.ZodString;
1798
- }, z.core.$strict>;
1799
- as_of: z.ZodISODateTime;
1800
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1801
- type: z.ZodEnum<{
1802
- string: "string";
1803
- number: "number";
1804
- boolean: "boolean";
1805
- integer: "integer";
1806
- }>;
1807
- required: z.ZodOptional<z.ZodBoolean>;
1808
- title: z.ZodOptional<z.ZodString>;
1809
- }, z.core.$strict>>>;
1810
- result: z.ZodRecord<z.ZodString, z.ZodObject<{
1811
- type: z.ZodEnum<{
1812
- string: "string";
1813
- number: "number";
1814
- boolean: "boolean";
1815
- integer: "integer";
1816
- }>;
1817
- required: z.ZodOptional<z.ZodBoolean>;
1818
- title: z.ZodOptional<z.ZodString>;
1819
- }, z.core.$strict>>;
1820
- price_checked_at_purchase: z.ZodBoolean;
1821
- fulfillment: z.ZodLiteral<"confirm">;
1822
- confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
1823
- fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1824
- }, z.core.$strict>], "fulfillment">>;
1825
- }, z.core.$strict>;
1658
+ items: z.ZodArray<z.ZodUnknown>;
1659
+ }, z.core.$loose>;
1826
1660
  };
1827
1661
  };
1828
1662
  purchase_item: {
@@ -1838,7 +1672,7 @@ export declare const API_ROUTES: Readonly<{
1838
1672
  document: z.ZodObject<{
1839
1673
  order_id: z.ZodString;
1840
1674
  status_url: z.ZodURL;
1841
- status: z.ZodEnum<{
1675
+ status: z.ZodUnion<readonly [z.ZodEnum<{
1842
1676
  delivered: "delivered";
1843
1677
  in_progress: "in_progress";
1844
1678
  rejected: "rejected";
@@ -1849,20 +1683,24 @@ export declare const API_ROUTES: Readonly<{
1849
1683
  refund_due: "refund_due";
1850
1684
  refunded: "refunded";
1851
1685
  delivered_unpaid: "delivered_unpaid";
1852
- }>;
1686
+ }>, z.ZodString]>;
1853
1687
  price: z.ZodNullable<z.ZodObject<{
1854
1688
  amount: z.ZodString;
1855
1689
  currency: z.ZodString;
1856
1690
  at: z.ZodISODateTime;
1857
1691
  as_of: z.ZodISODateTime;
1858
- }, z.core.$strict>>;
1692
+ }, z.core.$loose>>;
1859
1693
  delivered: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1860
1694
  test: z.ZodBoolean;
1861
1695
  refusal: z.ZodOptional<z.ZodObject<{
1862
1696
  code: z.ZodString;
1863
1697
  message: z.ZodString;
1864
- }, z.core.$strict>>;
1865
- }, z.core.$strict>;
1698
+ }, z.core.$loose>>;
1699
+ seller: z.ZodObject<{
1700
+ name: z.ZodNullable<z.ZodString>;
1701
+ site: z.ZodNullable<z.ZodString>;
1702
+ }, z.core.$loose>;
1703
+ }, z.core.$loose>;
1866
1704
  };
1867
1705
  };
1868
1706
  get_order_status: {
@@ -1874,7 +1712,7 @@ export declare const API_ROUTES: Readonly<{
1874
1712
  document: z.ZodObject<{
1875
1713
  order_id: z.ZodString;
1876
1714
  status_url: z.ZodURL;
1877
- status: z.ZodEnum<{
1715
+ status: z.ZodUnion<readonly [z.ZodEnum<{
1878
1716
  delivered: "delivered";
1879
1717
  in_progress: "in_progress";
1880
1718
  rejected: "rejected";
@@ -1885,20 +1723,24 @@ export declare const API_ROUTES: Readonly<{
1885
1723
  refund_due: "refund_due";
1886
1724
  refunded: "refunded";
1887
1725
  delivered_unpaid: "delivered_unpaid";
1888
- }>;
1726
+ }>, z.ZodString]>;
1889
1727
  price: z.ZodNullable<z.ZodObject<{
1890
1728
  amount: z.ZodString;
1891
1729
  currency: z.ZodString;
1892
1730
  at: z.ZodISODateTime;
1893
1731
  as_of: z.ZodISODateTime;
1894
- }, z.core.$strict>>;
1732
+ }, z.core.$loose>>;
1895
1733
  delivered: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1896
1734
  test: z.ZodBoolean;
1897
1735
  refusal: z.ZodOptional<z.ZodObject<{
1898
1736
  code: z.ZodString;
1899
1737
  message: z.ZodString;
1900
- }, z.core.$strict>>;
1901
- }, z.core.$strict>;
1738
+ }, z.core.$loose>>;
1739
+ seller: z.ZodObject<{
1740
+ name: z.ZodNullable<z.ZodString>;
1741
+ site: z.ZodNullable<z.ZodString>;
1742
+ }, z.core.$loose>;
1743
+ }, z.core.$loose>;
1902
1744
  };
1903
1745
  };
1904
1746
  }>;