@oneie/sdk 0.17.4 → 0.17.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.
Files changed (118) hide show
  1. package/README.md +4 -0
  2. package/dist/.build-fingerprint +1 -0
  3. package/dist/age.d.ts +96 -0
  4. package/dist/age.d.ts.map +1 -0
  5. package/dist/age.js +487 -0
  6. package/dist/age.js.map +1 -0
  7. package/dist/billing.d.ts +244 -14
  8. package/dist/billing.d.ts.map +1 -1
  9. package/dist/billing.js +374 -55
  10. package/dist/billing.js.map +1 -1
  11. package/dist/blocks.d.ts +8 -4
  12. package/dist/blocks.d.ts.map +1 -1
  13. package/dist/blocks.js +17 -5
  14. package/dist/blocks.js.map +1 -1
  15. package/dist/client.d.ts.map +1 -1
  16. package/dist/client.js +8 -1
  17. package/dist/client.js.map +1 -1
  18. package/dist/edge/solve.d.ts +38 -0
  19. package/dist/edge/solve.d.ts.map +1 -0
  20. package/dist/edge/solve.js +334 -0
  21. package/dist/edge/solve.js.map +1 -0
  22. package/dist/edge/types.d.ts +216 -0
  23. package/dist/edge/types.d.ts.map +1 -0
  24. package/dist/edge/types.js +21 -0
  25. package/dist/edge/types.js.map +1 -0
  26. package/dist/edge/validate.d.ts +19 -0
  27. package/dist/edge/validate.d.ts.map +1 -0
  28. package/dist/edge/validate.js +89 -0
  29. package/dist/edge/validate.js.map +1 -0
  30. package/dist/edge.d.ts +9 -0
  31. package/dist/edge.d.ts.map +1 -0
  32. package/dist/edge.js +8 -0
  33. package/dist/edge.js.map +1 -0
  34. package/dist/fn-allowlist.d.ts +1 -1
  35. package/dist/fn-allowlist.d.ts.map +1 -1
  36. package/dist/fn-allowlist.js +14 -0
  37. package/dist/fn-allowlist.js.map +1 -1
  38. package/dist/gateway.d.ts +18 -1
  39. package/dist/gateway.d.ts.map +1 -1
  40. package/dist/gateway.js +77 -3
  41. package/dist/gateway.js.map +1 -1
  42. package/dist/generated/fn-map.d.ts +2 -2
  43. package/dist/generated/fn-map.d.ts.map +1 -1
  44. package/dist/generated/fn-map.js +114 -13
  45. package/dist/generated/fn-map.js.map +1 -1
  46. package/dist/generated/schemas/index.d.ts +2 -2
  47. package/dist/generated/schemas.d.ts +65 -23
  48. package/dist/generated/schemas.d.ts.map +1 -1
  49. package/dist/generated/schemas.js +32 -1
  50. package/dist/generated/schemas.js.map +1 -1
  51. package/dist/index.d.ts +1 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/market.d.ts.map +1 -1
  56. package/dist/market.js +6 -0
  57. package/dist/market.js.map +1 -1
  58. package/dist/message-key.d.ts +20 -0
  59. package/dist/message-key.d.ts.map +1 -0
  60. package/dist/message-key.js +46 -0
  61. package/dist/message-key.js.map +1 -0
  62. package/dist/message-lock.d.ts +56 -0
  63. package/dist/message-lock.d.ts.map +1 -0
  64. package/dist/message-lock.js +157 -0
  65. package/dist/message-lock.js.map +1 -0
  66. package/dist/meta.d.ts +13 -0
  67. package/dist/meta.d.ts.map +1 -1
  68. package/dist/meta.js +11 -0
  69. package/dist/meta.js.map +1 -1
  70. package/dist/prices/vendors.d.ts +7 -0
  71. package/dist/prices/vendors.d.ts.map +1 -0
  72. package/dist/prices/vendors.js +229 -0
  73. package/dist/prices/vendors.js.map +1 -0
  74. package/dist/prices.d.ts +41 -0
  75. package/dist/prices.d.ts.map +1 -0
  76. package/dist/prices.js +79 -0
  77. package/dist/prices.js.map +1 -0
  78. package/dist/receiver-layers.d.ts +27 -1
  79. package/dist/receiver-layers.d.ts.map +1 -1
  80. package/dist/receiver-layers.js +85 -5
  81. package/dist/receiver-layers.js.map +1 -1
  82. package/dist/receivers.d.ts +1773 -103
  83. package/dist/receivers.d.ts.map +1 -1
  84. package/dist/receivers.js +1910 -179
  85. package/dist/receivers.js.map +1 -1
  86. package/dist/secrets-give.d.ts +120 -0
  87. package/dist/secrets-give.d.ts.map +1 -0
  88. package/dist/secrets-give.js +160 -0
  89. package/dist/secrets-give.js.map +1 -0
  90. package/dist/secrets-grant.d.ts +52 -0
  91. package/dist/secrets-grant.d.ts.map +1 -0
  92. package/dist/secrets-grant.js +55 -0
  93. package/dist/secrets-grant.js.map +1 -0
  94. package/dist/secrets-key.d.ts +20 -0
  95. package/dist/secrets-key.d.ts.map +1 -0
  96. package/dist/secrets-key.js +47 -0
  97. package/dist/secrets-key.js.map +1 -0
  98. package/dist/secrets-list.d.ts +169 -0
  99. package/dist/secrets-list.d.ts.map +1 -0
  100. package/dist/secrets-list.js +13 -0
  101. package/dist/secrets-list.js.map +1 -0
  102. package/dist/secrets-one-vault.d.ts +53 -0
  103. package/dist/secrets-one-vault.d.ts.map +1 -0
  104. package/dist/secrets-one-vault.js +78 -0
  105. package/dist/secrets-one-vault.js.map +1 -0
  106. package/dist/secrets.d.ts +204 -0
  107. package/dist/secrets.d.ts.map +1 -0
  108. package/dist/secrets.js +389 -0
  109. package/dist/secrets.js.map +1 -0
  110. package/dist/templates.js +6 -6
  111. package/dist/templates.js.map +1 -1
  112. package/dist/work-contract-grammar.json +77 -5
  113. package/dist/work-contract.d.ts +24 -0
  114. package/dist/work-contract.d.ts.map +1 -1
  115. package/dist/work-contract.js +55 -0
  116. package/dist/work-contract.js.map +1 -1
  117. package/package.json +42 -3
  118. package/src/generated/funs.json +1 -0
@@ -0,0 +1,20 @@
1
+ /** HKDF info — the message key. Locked. */
2
+ export declare const MESSAGE_KEY_INFO = "message-x25519-v1";
3
+ export interface MessageKey {
4
+ /** `age1…` — give it to anyone; it is how they seal a note for you. */
5
+ recipient: string;
6
+ /** 32 public bytes behind the recipient. */
7
+ publicKey: Uint8Array;
8
+ /** 32 secret bytes. Zero them when done. */
9
+ secret: Uint8Array;
10
+ }
11
+ /** Derive the message key from the master. The caller zeroes `secret`. */
12
+ export declare function deriveMessageKey(master: Uint8Array): MessageKey;
13
+ /**
14
+ * The message key for a 24-word phrase. The error never repeats the input — it may BE
15
+ * the phrase. The caller zeroes `secret`.
16
+ */
17
+ export declare function messageKeyFromPhrase(mnemonic: string): MessageKey;
18
+ /** The `AGE-SECRET-KEY-1…` form, for export to the age CLI or another tool. */
19
+ export declare function messageIdentityText(k: MessageKey): string;
20
+ //# sourceMappingURL=message-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-key.d.ts","sourceRoot":"","sources":["../src/message-key.ts"],"names":[],"mappings":"AAeA,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,sBAAsB,CAAA;AAEnD,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,SAAS,EAAE,UAAU,CAAA;IACrB,4CAA4C;IAC5C,MAAM,EAAE,UAAU,CAAA;CACnB;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAK/D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAUjE;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAEzD"}
@@ -0,0 +1,46 @@
1
+ // message-key.ts — the SDK's copy of one.ie/web/src/lib/key/message-key.ts (see age.ts for why).
2
+ // Import via the `@oneie/sdk/message-key` subpath (never the bare barrel).
3
+ //
4
+ // HKDF-SHA256(master 32 bytes, salt empty, info 'message-x25519-v1') → X25519 → age1…
5
+ // The master IS the 24 words' 32-byte entropy, so a key.json's `mnemonic` reaches the same
6
+ // lock the browser shows. The label is LOCKED: changing it changes everyone's lock and
7
+ // makes every note already sealed unreadable (text/key-derivation-spec.md § The message key).
8
+ import { x25519 } from '@noble/curves/ed25519.js';
9
+ import { hkdf } from '@noble/hashes/hkdf.js';
10
+ import { sha256 } from '@noble/hashes/sha2.js';
11
+ import { mnemonicToEntropy, validateMnemonic } from '@scure/bip39';
12
+ import { wordlist } from '@scure/bip39/wordlists/english.js';
13
+ import { encodeIdentity, encodeRecipient } from './age.js';
14
+ /** HKDF info — the message key. Locked. */
15
+ export const MESSAGE_KEY_INFO = 'message-x25519-v1';
16
+ /** Derive the message key from the master. The caller zeroes `secret`. */
17
+ export function deriveMessageKey(master) {
18
+ if (master.length !== 32)
19
+ throw new Error('the master is 32 bytes');
20
+ const secret = hkdf(sha256, master, new Uint8Array(0), new TextEncoder().encode(MESSAGE_KEY_INFO), 32);
21
+ const publicKey = x25519.getPublicKey(secret);
22
+ return { recipient: encodeRecipient(publicKey), publicKey, secret };
23
+ }
24
+ /**
25
+ * The message key for a 24-word phrase. The error never repeats the input — it may BE
26
+ * the phrase. The caller zeroes `secret`.
27
+ */
28
+ export function messageKeyFromPhrase(mnemonic) {
29
+ const words = mnemonic.trim().toLowerCase().split(/\s+/).join(' ');
30
+ if (!validateMnemonic(words, wordlist))
31
+ throw new Error('that is not a valid 24-word BIP-39 recovery phrase');
32
+ const master = mnemonicToEntropy(words, wordlist);
33
+ if (master.length !== 32)
34
+ throw new Error('that is not a 24-word BIP-39 recovery phrase');
35
+ try {
36
+ return deriveMessageKey(master);
37
+ }
38
+ finally {
39
+ master.fill(0);
40
+ }
41
+ }
42
+ /** The `AGE-SECRET-KEY-1…` form, for export to the age CLI or another tool. */
43
+ export function messageIdentityText(k) {
44
+ return encodeIdentity(k.secret);
45
+ }
46
+ //# sourceMappingURL=message-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-key.js","sourceRoot":"","sources":["../src/message-key.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,2EAA2E;AAC3E,EAAE;AACF,sFAAsF;AACtF,2FAA2F;AAC3F,uFAAuF;AACvF,8FAA8F;AAE9F,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAA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CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB,CAAC,CAAa;IAC/C,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AACjC,CAAC"}
@@ -0,0 +1,56 @@
1
+ /** The first line of every signed lock. Versioned: a change is a new message, never an edit. */
2
+ export declare const LOCK_MESSAGE_VERSION = "ONE message lock v1";
3
+ export declare const LOCK_RE: RegExp;
4
+ export declare const SLUG_RE: RegExp;
5
+ export declare const AGENT_RE: RegExp;
6
+ /** The exact text a holder signs. The slug is lower-case; the lock is the full `age1…`. */
7
+ export declare function lockMessage(slug: string, lock: string): string;
8
+ /** The exact text an AGENT signs: the name is `<workspace>/<agent-id>`. */
9
+ export declare function agentLockMessage(slug: string, agent: string, lock: string): string;
10
+ /** `sam` -> {slug}; `sam/scout` -> {slug, agent}; anything else -> null. The slug is lower-cased, the agent id is not. */
11
+ export declare function parseLockName(name: string): {
12
+ slug: string;
13
+ agent?: string;
14
+ } | null;
15
+ /**
16
+ * Sign `message` as a Sui personal message with a 32-byte ed25519 secret (the key's Sui
17
+ * account-0 secret). Returns the signer's address and the wire signature. The secret is
18
+ * read, never kept or returned; the caller zeroes it.
19
+ */
20
+ export declare function signSuiPersonalMessage(secret: Uint8Array, message: string): {
21
+ address: string;
22
+ signature: string;
23
+ };
24
+ /**
25
+ * The Sui address that signed `message`, or null. The signature names its own key, so
26
+ * "who signed" and "was it the address I expected" stay two questions (the caller compares).
27
+ * Only ed25519 (flag 0x00) is checked here; any other scheme, a wrong length or junk is null.
28
+ */
29
+ export declare function verifySuiPersonalMessage(message: string, signature: string): string | null;
30
+ /** What `wallet:lock-get` / GET /api/lock/<slug> answers for a published lock. */
31
+ export interface PublishedLock {
32
+ lock: string;
33
+ suiAddress: string;
34
+ signature: string;
35
+ message: string;
36
+ publishedAt?: string;
37
+ }
38
+ export type LockRecordVerdict = {
39
+ ok: true;
40
+ lock: string;
41
+ suiAddress: string;
42
+ } | {
43
+ ok: false;
44
+ reason: 'malformed' | 'not_for_slug' | 'invalid';
45
+ detail: string;
46
+ };
47
+ /**
48
+ * Re-verify a published lock for `slug`, offline — the CLI twin of one.ie's
49
+ * `verifyPublishedLock`. The text is REBUILT here from the slug and the lock; the record's
50
+ * own `message` must equal it, and the signature is checked against the rebuilt text, never
51
+ * against whatever the server sent. The signer must be the address the record names.
52
+ * What it cannot check alone is that this address belongs to the name: ONE's server vouches
53
+ * for that from the account's registered wallet.
54
+ */
55
+ export declare function verifyLockRecord(slug: string, rec: Partial<PublishedLock> | null | undefined, agent?: string): LockRecordVerdict;
56
+ //# sourceMappingURL=message-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-lock.d.ts","sourceRoot":"","sources":["../src/message-lock.ts"],"names":[],"mappings":"AA6BA,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,wBAAwB,CAAA;AACzD,eAAO,MAAM,OAAO,QAAuB,CAAA;AAC3C,eAAO,MAAM,OAAO,QAA8B,CAAA;AAClD,eAAO,MAAM,QAAQ,QAAuC,CAAA;AAE5D,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElF;AAED,0HAA0H;AAC1H,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOnF;AAiCD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CASlH;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiB1F;AAED,kFAAkF;AAClF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnF;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAoBhI"}
@@ -0,0 +1,157 @@
1
+ // message-lock.ts — publish a lock under a name: the text to sign, and the Sui signature over it.
2
+ // Import via the `@oneie/sdk/message-lock` subpath (never the bare barrel).
3
+ //
4
+ // one.ie's `wallet:lock-publish` stores a holder's `age1…` lock only when a Sui
5
+ // PERSONAL-MESSAGE signature over `lockMessage(slug, lock)` comes from the Sui address the
6
+ // account registered (one.ie/web lib/wallet-lock.ts). The browser signs with @mysten/sui
7
+ // (lib/key/sign-message.ts); a terminal or an agent has no @mysten/sui, so this file makes
8
+ // the same signature with noble. It is the CLI's half of that door, nothing more.
9
+ //
10
+ // WHAT A SUI PERSONAL-MESSAGE SIGNATURE IS (the part that is easy to get wrong):
11
+ // digest = blake2b-256( [3,0,0] ‖ ULEB128(len) ‖ messageBytes )
12
+ // intent {scope: PersonalMessage=3, version: 0, app: Sui=0}, then the message
13
+ // as a BCS vector<u8> (a length prefix, then the bytes)
14
+ // signature = ed25519(digest)
15
+ // wire = base64( 0x00 ‖ signature(64) ‖ publicKey(32) ) flag 0x00 = ed25519
16
+ // Ed25519 is deterministic, so a pinned vector made with @mysten/sui's own
17
+ // `Ed25519Keypair.signPersonalMessage` is byte-comparable: tests/message-lock.test.ts.
18
+ //
19
+ // AN AGENT'S LOCK is named `<workspace>/<agent-id>` (`agentLockMessage`): the same three
20
+ // lines with a name that has a `/`, which no person's name can, so the two texts are never
21
+ // equal. `parseLockName` splits what a human types (`sam` or `sam/scout`).
22
+ //
23
+ // The slug and lock patterns and the text templates mirror one.ie/web lib/key/lock-lookup.ts;
24
+ // the test reads that file as source and fails if either copy changes alone.
25
+ import { ed25519 } from '@noble/curves/ed25519.js';
26
+ import { blake2b } from '@noble/hashes/blake2.js';
27
+ import { suiAddressFromPubkey } from './wallet.js';
28
+ /** The first line of every signed lock. Versioned: a change is a new message, never an edit. */
29
+ export const LOCK_MESSAGE_VERSION = 'ONE message lock v1';
30
+ export const LOCK_RE = /^age1[a-z0-9]{58}$/;
31
+ export const SLUG_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
32
+ export const AGENT_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
33
+ /** The exact text a holder signs. The slug is lower-case; the lock is the full `age1…`. */
34
+ export function lockMessage(slug, lock) {
35
+ return `${LOCK_MESSAGE_VERSION}\n${slug}\n${lock}`;
36
+ }
37
+ /** The exact text an AGENT signs: the name is `<workspace>/<agent-id>`. */
38
+ export function agentLockMessage(slug, agent, lock) {
39
+ return `${LOCK_MESSAGE_VERSION}\n${slug}/${agent}\n${lock}`;
40
+ }
41
+ /** `sam` -> {slug}; `sam/scout` -> {slug, agent}; anything else -> null. The slug is lower-cased, the agent id is not. */
42
+ export function parseLockName(name) {
43
+ const [head, ...rest] = name.trim().split('/');
44
+ const slug = head.toLowerCase();
45
+ if (!SLUG_RE.test(slug))
46
+ return null;
47
+ if (rest.length === 0)
48
+ return { slug };
49
+ if (rest.length > 1 || !AGENT_RE.test(rest[0]))
50
+ return null;
51
+ return { slug, agent: rest[0] };
52
+ }
53
+ const INTENT_PERSONAL_MESSAGE = [3, 0, 0];
54
+ /** BCS length prefix for a vector<u8>: unsigned LEB128. */
55
+ function uleb128(n) {
56
+ const out = [];
57
+ let v = n;
58
+ do {
59
+ let byte = v & 0x7f;
60
+ v >>>= 7;
61
+ if (v !== 0)
62
+ byte |= 0x80;
63
+ out.push(byte);
64
+ } while (v !== 0);
65
+ return out;
66
+ }
67
+ function digestOf(message) {
68
+ const bytes = new TextEncoder().encode(message);
69
+ const prefix = uleb128(bytes.length);
70
+ const body = new Uint8Array(INTENT_PERSONAL_MESSAGE.length + prefix.length + bytes.length);
71
+ body.set(INTENT_PERSONAL_MESSAGE, 0);
72
+ body.set(prefix, INTENT_PERSONAL_MESSAGE.length);
73
+ body.set(bytes, INTENT_PERSONAL_MESSAGE.length + prefix.length);
74
+ return blake2b(body, { dkLen: 32 });
75
+ }
76
+ const b64 = (bytes) => {
77
+ let s = '';
78
+ for (let i = 0; i < bytes.length; i++)
79
+ s += String.fromCharCode(bytes[i]);
80
+ return btoa(s);
81
+ };
82
+ /**
83
+ * Sign `message` as a Sui personal message with a 32-byte ed25519 secret (the key's Sui
84
+ * account-0 secret). Returns the signer's address and the wire signature. The secret is
85
+ * read, never kept or returned; the caller zeroes it.
86
+ */
87
+ export function signSuiPersonalMessage(secret, message) {
88
+ if (secret.length !== 32)
89
+ throw new Error('a Sui ed25519 secret is 32 bytes');
90
+ const publicKey = ed25519.getPublicKey(secret);
91
+ const sig = ed25519.sign(digestOf(message), secret);
92
+ const wire = new Uint8Array(1 + 64 + 32);
93
+ wire[0] = 0x00;
94
+ wire.set(sig, 1);
95
+ wire.set(publicKey, 65);
96
+ return { address: suiAddressFromPubkey(publicKey), signature: b64(wire) };
97
+ }
98
+ /**
99
+ * The Sui address that signed `message`, or null. The signature names its own key, so
100
+ * "who signed" and "was it the address I expected" stay two questions (the caller compares).
101
+ * Only ed25519 (flag 0x00) is checked here; any other scheme, a wrong length or junk is null.
102
+ */
103
+ export function verifySuiPersonalMessage(message, signature) {
104
+ let raw;
105
+ try {
106
+ const bin = atob(signature.trim());
107
+ raw = Uint8Array.from(bin, (c) => c.charCodeAt(0));
108
+ }
109
+ catch {
110
+ return null;
111
+ }
112
+ if (raw.length !== 97 || raw[0] !== 0x00)
113
+ return null;
114
+ const sig = raw.subarray(1, 65);
115
+ const publicKey = raw.subarray(65, 97);
116
+ try {
117
+ if (!ed25519.verify(sig, digestOf(message), publicKey))
118
+ return null;
119
+ }
120
+ catch {
121
+ return null;
122
+ }
123
+ return suiAddressFromPubkey(publicKey);
124
+ }
125
+ /**
126
+ * Re-verify a published lock for `slug`, offline — the CLI twin of one.ie's
127
+ * `verifyPublishedLock`. The text is REBUILT here from the slug and the lock; the record's
128
+ * own `message` must equal it, and the signature is checked against the rebuilt text, never
129
+ * against whatever the server sent. The signer must be the address the record names.
130
+ * What it cannot check alone is that this address belongs to the name: ONE's server vouches
131
+ * for that from the account's registered wallet.
132
+ */
133
+ export function verifyLockRecord(slug, rec, agent) {
134
+ if (!SLUG_RE.test(slug))
135
+ return { ok: false, reason: 'malformed', detail: 'that is not a name' };
136
+ if (agent !== undefined && !AGENT_RE.test(agent))
137
+ return { ok: false, reason: 'malformed', detail: 'that is not an agent name' };
138
+ if (typeof rec?.lock !== 'string' || !LOCK_RE.test(rec.lock)) {
139
+ return { ok: false, reason: 'malformed', detail: 'the published lock is not a lock' };
140
+ }
141
+ if (typeof rec.suiAddress !== 'string' || typeof rec.signature !== 'string') {
142
+ return { ok: false, reason: 'malformed', detail: 'the published lock has no signer or no signature' };
143
+ }
144
+ const name = agent === undefined ? slug : `${slug}/${agent}`;
145
+ const expected = agent === undefined ? lockMessage(slug, rec.lock) : agentLockMessage(slug, agent, rec.lock);
146
+ if (rec.message !== expected) {
147
+ return { ok: false, reason: 'not_for_slug', detail: `the signed text does not say this lock belongs to ${name}` };
148
+ }
149
+ const signer = verifySuiPersonalMessage(expected, rec.signature);
150
+ if (!signer)
151
+ return { ok: false, reason: 'invalid', detail: 'the signature does not hold for that text' };
152
+ if (signer.toLowerCase() !== rec.suiAddress.toLowerCase()) {
153
+ return { ok: false, reason: 'invalid', detail: 'the signature was made by a different key than the address named' };
154
+ }
155
+ return { ok: true, lock: rec.lock, suiAddress: signer.toLowerCase() };
156
+ }
157
+ //# sourceMappingURL=message-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-lock.js","sourceRoot":"","sources":["../src/message-lock.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,4EAA4E;AAC5E,EAAE;AACF,gFAAgF;AAChF,2FAA2F;AAC3F,yFAAyF;AACzF,2FAA2F;AAC3F,kFAAkF;AAClF,EAAE;AACF,iFAAiF;AACjF,qEAAqE;AACrE,8FAA8F;AAC9F,wEAAwE;AACxE,gCAAgC;AAChC,wFAAwF;AACxF,2EAA2E;AAC3E,uFAAuF;AACvF,EAAE;AACF,yFAAyF;AACzF,2FAA2F;AAC3F,2EAA2E;AAC3E,EAAE;AACF,8FAA8F;AAC9F,6EAA6E;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAA;AACzD,MAAM,CAAC,MAAM,OAAO,GAAG,oBAAoB,CAAA;AAC3C,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAA;AAClD,MAAM,CAAC,MAAM,QAAQ,GAAG,oCAAoC,CAAA;AAE5D,2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,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;IAC5G,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,qDAAqD,IAAI,EAAE,EAAE,CAAA;IACnH,CAAC;IACD,MAAM,MAAM,GAAG,wBAAwB,CAAC,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IAChE,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,2CAA2C,EAAE,CAAA;IACzG,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,kEAAkE,EAAE,CAAA;IACrH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,CAAA;AACvE,CAAC"}
package/dist/meta.d.ts CHANGED
@@ -20,7 +20,19 @@ export interface CatalogEntry {
20
20
  version?: string;
21
21
  deprecated?: string;
22
22
  canonical?: string;
23
+ /** Declared tags plus the `surface:chat` / `surface:mcp` read-back of `surfaces`. */
24
+ tags: string[];
23
25
  }
26
+ /** A receiver's tags: declared ones (minus any hand-written `surface:*`) + `surface:*` derived from `surfaces`. */
27
+ export declare function tagsOf(r: {
28
+ tags?: string[];
29
+ surfaces?: {
30
+ chat?: boolean;
31
+ mcp?: boolean | {
32
+ name?: string;
33
+ };
34
+ };
35
+ }): string[];
24
36
  /**
25
37
  * Project the catalog to agent-facing rows, scoped to what the caller may call.
26
38
  * `canCall(auth)` decides per receiver — the service passes a predicate built
@@ -28,6 +40,7 @@ export interface CatalogEntry {
28
40
  */
29
41
  export declare function metaCatalog(opts?: {
30
42
  canCall?: (auth: string | undefined) => boolean;
43
+ tag?: string;
31
44
  }): CatalogEntry[];
32
45
  /** The ordered receiver sequence for a goal — what `meta:catalog?goal=` returns. */
33
46
  export declare function metaRecipe(goal: RecipeName): {
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAExF;;;;;;GAMG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAA;CAAO,GAAG,YAAY,EAAE,CAkB1G;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,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AG,CAAC,EAAE,OAAO,GAAG;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,GAAG,MAAM,EAAE,CAKzH;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,EAAE,CAoBxH;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,CAElG;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAQA;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE3D"}
package/dist/meta.js CHANGED
@@ -1,5 +1,14 @@
1
1
  import { z } from "zod";
2
2
  import { RECEIVERS, RECIPES } from "./receivers.js";
3
+ /** A receiver's tags: declared ones (minus any hand-written `surface:*`) + `surface:*` derived from `surfaces`. */
4
+ export function tagsOf(r) {
5
+ const out = (r.tags ?? []).filter((t) => !t.startsWith("surface:"));
6
+ if (r.surfaces?.chat === true)
7
+ out.push("surface:chat");
8
+ if (r.surfaces?.mcp)
9
+ out.push("surface:mcp");
10
+ return out;
11
+ }
3
12
  /**
4
13
  * Project the catalog to agent-facing rows, scoped to what the caller may call.
5
14
  * `canCall(auth)` decides per receiver — the service passes a predicate built
@@ -9,6 +18,7 @@ export function metaCatalog(opts = {}) {
9
18
  const canCall = opts.canCall ?? (() => true);
10
19
  return Object.values(RECEIVERS)
11
20
  .filter((r) => canCall(r.auth))
21
+ .filter((r) => opts.tag === undefined || tagsOf(r).includes(opts.tag))
12
22
  .map((r) => ({
13
23
  receiver: r.receiver,
14
24
  summary: r.summary,
@@ -22,6 +32,7 @@ export function metaCatalog(opts = {}) {
22
32
  version: r.version,
23
33
  deprecated: r.deprecated,
24
34
  canonical: r.canonical,
35
+ tags: tagsOf(r),
25
36
  }));
26
37
  }
27
38
  /** The ordered receiver sequence for a goal — what `meta:catalog?goal=` returns. */
package/dist/meta.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAsC,MAAM,gBAAgB,CAAC;AA0BxF;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,OAA4D,EAAE;IACxF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;SAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,OAAO,EA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IACzC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;AACzC,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CAAC,QAAsB;IAM/C,MAAM,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9B,OAAO;QACL,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC;QAClC,QAAQ,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;KACrC,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,SAAS,CAAC,IAAwB;IAChD,OAAO,IAAI,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** The day the research behind these rows was checked. */
2
+ export declare const VENDOR_ASOF = "2026-11-08";
3
+ export declare const VENDOR_SOURCES: readonly string[];
4
+ /** [provider, sku, unit, variant, usdPerUnit, sourceIndex, flags (1 = default variant), minPromptTokens, asof ('' = VENDOR_ASOF)] */
5
+ export type VendorRow = readonly [string, string, string, string, number, number, number, number, string];
6
+ export declare const VENDOR_ROWS: readonly VendorRow[];
7
+ //# sourceMappingURL=vendors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendors.d.ts","sourceRoot":"","sources":["../../src/prices/vendors.ts"],"names":[],"mappings":"AAKA,0DAA0D;AAC1D,eAAO,MAAM,WAAW,eAAe,CAAA;AAEvC,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAgD3C,CAAA;AAED,qIAAqI;AACrI,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAEzG,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EA4K3C,CAAA"}