@mcsherrylabs/evolver-mcp 0.13.0 → 0.15.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 (118) hide show
  1. package/deploy/docker-compose.http.yml +45 -0
  2. package/deploy/docker-compose.yml +4 -1
  3. package/dist/application-signer.d.ts +1 -1
  4. package/dist/application-signer.d.ts.map +1 -1
  5. package/dist/attachments.d.ts +1 -1
  6. package/dist/attachments.d.ts.map +1 -1
  7. package/dist/attachments.js +2 -2
  8. package/dist/attachments.js.map +1 -1
  9. package/dist/bootstrap.d.ts +36 -4
  10. package/dist/bootstrap.d.ts.map +1 -1
  11. package/dist/bootstrap.js +35 -11
  12. package/dist/bootstrap.js.map +1 -1
  13. package/dist/content-file-tools.js +1 -1
  14. package/dist/content-file-tools.js.map +1 -1
  15. package/dist/content-files.d.ts +1 -1
  16. package/dist/content-files.d.ts.map +1 -1
  17. package/dist/content-files.js +1 -1
  18. package/dist/content-files.js.map +1 -1
  19. package/dist/content-ranges.d.ts +1 -1
  20. package/dist/content-ranges.d.ts.map +1 -1
  21. package/dist/group-crypto-tools.js +1 -1
  22. package/dist/group-crypto-tools.js.map +1 -1
  23. package/dist/group-crypto.d.ts +2 -2
  24. package/dist/group-crypto.d.ts.map +1 -1
  25. package/dist/group-crypto.js +1 -1
  26. package/dist/group-crypto.js.map +1 -1
  27. package/dist/http-transport.d.ts +87 -0
  28. package/dist/http-transport.d.ts.map +1 -0
  29. package/dist/http-transport.js +359 -0
  30. package/dist/http-transport.js.map +1 -0
  31. package/dist/inbox.d.ts +1 -1
  32. package/dist/inbox.d.ts.map +1 -1
  33. package/dist/inbox.js +1 -1
  34. package/dist/inbox.js.map +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +254 -115
  37. package/dist/index.js.map +1 -1
  38. package/dist/install-http.d.ts +27 -0
  39. package/dist/install-http.d.ts.map +1 -0
  40. package/dist/install-http.js +192 -0
  41. package/dist/install-http.js.map +1 -0
  42. package/dist/install.d.ts +18 -0
  43. package/dist/install.d.ts.map +1 -1
  44. package/dist/install.js +128 -22
  45. package/dist/install.js.map +1 -1
  46. package/dist/login.d.ts +1 -1
  47. package/dist/login.d.ts.map +1 -1
  48. package/dist/mcp.d.ts +2 -2
  49. package/dist/mcp.d.ts.map +1 -1
  50. package/dist/p2p.d.ts +1 -1
  51. package/dist/p2p.d.ts.map +1 -1
  52. package/dist/p2p.js +1 -1
  53. package/dist/p2p.js.map +1 -1
  54. package/dist/processor.d.ts +1 -1
  55. package/dist/processor.d.ts.map +1 -1
  56. package/dist/processor.js +1 -1
  57. package/dist/processor.js.map +1 -1
  58. package/dist/signed-http.d.ts +1 -1
  59. package/dist/signed-http.d.ts.map +1 -1
  60. package/dist/tools.d.ts +5 -3
  61. package/dist/tools.d.ts.map +1 -1
  62. package/dist/tools.js +34 -34
  63. package/dist/tools.js.map +1 -1
  64. package/dist/transaction-interchange-tools.js +1 -1
  65. package/dist/transaction-interchange-tools.js.map +1 -1
  66. package/dist/transaction-interchange.d.ts +5 -2
  67. package/dist/transaction-interchange.d.ts.map +1 -1
  68. package/dist/transaction-interchange.js +10 -10
  69. package/dist/transaction-interchange.js.map +1 -1
  70. package/package.json +10 -16
  71. package/dist/amount.d.ts +0 -23
  72. package/dist/amount.d.ts.map +0 -1
  73. package/dist/amount.js +0 -53
  74. package/dist/amount.js.map +0 -1
  75. package/dist/channel.d.ts +0 -77
  76. package/dist/channel.d.ts.map +0 -1
  77. package/dist/channel.js +0 -287
  78. package/dist/channel.js.map +0 -1
  79. package/dist/claim.d.ts +0 -48
  80. package/dist/claim.d.ts.map +0 -1
  81. package/dist/claim.js +0 -81
  82. package/dist/claim.js.map +0 -1
  83. package/dist/content.d.ts +0 -94
  84. package/dist/content.d.ts.map +0 -1
  85. package/dist/content.js +0 -215
  86. package/dist/content.js.map +0 -1
  87. package/dist/group-ownership.d.ts +0 -78
  88. package/dist/group-ownership.d.ts.map +0 -1
  89. package/dist/group-ownership.js +0 -324
  90. package/dist/group-ownership.js.map +0 -1
  91. package/dist/group.d.ts +0 -60
  92. package/dist/group.d.ts.map +0 -1
  93. package/dist/group.js +0 -204
  94. package/dist/group.js.map +0 -1
  95. package/dist/identity.d.ts +0 -87
  96. package/dist/identity.d.ts.map +0 -1
  97. package/dist/identity.js +0 -236
  98. package/dist/identity.js.map +0 -1
  99. package/dist/node-transport.d.ts +0 -14
  100. package/dist/node-transport.d.ts.map +0 -1
  101. package/dist/node-transport.js +0 -54
  102. package/dist/node-transport.js.map +0 -1
  103. package/dist/read.d.ts +0 -252
  104. package/dist/read.d.ts.map +0 -1
  105. package/dist/read.js +0 -320
  106. package/dist/read.js.map +0 -1
  107. package/dist/result.d.ts +0 -110
  108. package/dist/result.d.ts.map +0 -1
  109. package/dist/result.js +0 -97
  110. package/dist/result.js.map +0 -1
  111. package/dist/signer.d.ts +0 -37
  112. package/dist/signer.d.ts.map +0 -1
  113. package/dist/signer.js +0 -76
  114. package/dist/signer.js.map +0 -1
  115. package/dist/write.d.ts +0 -214
  116. package/dist/write.d.ts.map +0 -1
  117. package/dist/write.js +0 -399
  118. package/dist/write.js.map +0 -1
package/dist/result.d.ts DELETED
@@ -1,110 +0,0 @@
1
- export declare const TOOL_RESULT_KINDS: readonly ["ok", "unreachable", "not_found", "partial", "wrong_kind", "misconfigured"];
2
- export type ToolResultKind = (typeof TOOL_RESULT_KINDS)[number];
3
- export type ToolResult<T> = {
4
- readonly kind: "ok";
5
- readonly value: T;
6
- }
7
- /** The chain could not be contacted. NEVER an answer about the world. */
8
- | {
9
- readonly kind: "unreachable";
10
- readonly chain: string;
11
- readonly cause: string;
12
- }
13
- /** The chain answered and has no such thing — definitive, at the height it answered from. */
14
- | {
15
- readonly kind: "not_found";
16
- readonly what: string;
17
- readonly atHeight?: number;
18
- }
19
- /** A scan was interrupted before it finished. Not a bound — a bound would be a lie. */
20
- | {
21
- readonly kind: "partial";
22
- readonly what: string;
23
- readonly cause: string;
24
- }
25
- /**
26
- * The name EXISTS, as the other kind of principal.
27
- *
28
- * ⚠️ WHY THIS IS NOT `not_found`. A name on an evolver chain is either an identity or a group —
29
- * one registry, one name, one kind, uniqueness enforced across both. So an identity lookup of a
30
- * GROUP name used to answer `not_found`, which a model correctly reads as "there is no such
31
- * thing" — and reported that about something the chain holds. Observed live: a tool said
32
- * `not_found` for a name that was a group all along.
33
- *
34
- * The failure is in the KIND, not in the payload: a model branches on `kind`, so enriching
35
- * `not_found` with an extra field would have left the wrong conclusion one field-read away.
36
- * `use` names the tool that WILL answer, because a model's next move should not need a guess.
37
- */
38
- | {
39
- readonly kind: "wrong_kind";
40
- readonly what: string;
41
- readonly found: "identity" | "group";
42
- readonly use: string;
43
- readonly atHeight?: number;
44
- }
45
- /**
46
- * This agent is not set up to answer that, and no amount of retrying will change it.
47
- *
48
- * ⚠️ WHY NOT `unreachable`. Both mean "no answer", and that is exactly the collapse this
49
- * taxonomy exists to prevent. `unreachable` says the chain was TRIED and did not respond — a
50
- * model should wait and retry, and an operator should look at the network. `misconfigured`
51
- * says nothing was tried because this agent does not know where to try. Retrying is futile and
52
- * waiting is worse than futile; a HUMAN has to set something.
53
- *
54
- * `fix` is the sentence that says what. A refusal that does not say how to stop being refused
55
- * makes the model guess.
56
- */
57
- | {
58
- readonly kind: "misconfigured";
59
- readonly what: string;
60
- readonly fix: string;
61
- };
62
- export declare const ok: <T>(value: T) => ToolResult<T>;
63
- export declare const misconfigured: (what: string, fix: string) => ToolResult<never>;
64
- export declare const notFound: (what: string, atHeight?: number) => ToolResult<never>;
65
- export declare const wrongKind: (what: string, found: "identity" | "group", use: string, atHeight?: number) => ToolResult<never>;
66
- export declare const partial: (what: string, cause: string) => ToolResult<never>;
67
- /** Turn anything thrown into `unreachable`, naming the chain that was tried.
68
- *
69
- * This exists because the harness signals an error by the tool throwing, and the client throws
70
- * on any non-OK response while the transport rejects on failure. An escaped throw hands the
71
- * model a bare error string and collapses this taxonomy at exactly the point it protects. */
72
- export declare const unreachableFrom: (e: unknown, chain: string) => ToolResult<never>;
73
- import type { SubmitResult } from "@mcsherrylabs/evolver-client";
74
- export type SubmissionOutcome =
75
- /** ORDERED. ⚠️ Not the same as PAID: an instruction can be abandoned at apply with the charge
76
- * burned and no fine. "Did my payment land" is answered by the balance, not by ordering. */
77
- {
78
- readonly kind: "committed";
79
- readonly txId: string;
80
- }
81
- /** Ordered, charged a fee AND a fine, and the payment did not happen. */
82
- | {
83
- readonly kind: "fined";
84
- readonly reason: string;
85
- readonly message: string;
86
- readonly txId: string;
87
- }
88
- /** The node decided. Final: nothing was ordered and nothing was charged. */
89
- | {
90
- readonly kind: "refused";
91
- readonly reason: string;
92
- readonly message: string;
93
- readonly txId?: string;
94
- }
95
- /** No readable answer. It MAY have committed. Resolve by looking it up — never by re-signing. */
96
- | {
97
- readonly kind: "unknown";
98
- readonly why: string;
99
- readonly txId?: string;
100
- };
101
- /**
102
- * Map what the client reports onto what we tell the model.
103
- *
104
- * ⚠️ The trap this exists to avoid: reporting an unread reply as `refused`, which tells the model
105
- * nothing happened, whose repair is to SIGN AGAIN. The expiry round is folded into the id, so a
106
- * re-signed payment is a different transaction replay protection cannot recognise — both may
107
- * commit. An unknown/`timeout`/unrecognised reason is therefore OPEN, never `refused`.
108
- */
109
- export declare function classifySubmit(r: SubmitResult): SubmissionOutcome;
110
- //# sourceMappingURL=result.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,iBAAiB,uFAOpB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,UAAU,CAAC,CAAC,IACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE;AAC5C,yEAAyE;GACvE;IAAE,QAAQ,C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ool answers in.
2
- //
3
- // Two shapes live here in the reference implementation — `ToolResult<T>` (what a READ answers)
4
- // and `SubmissionOutcome` (what a WRITE answers). Phase 1 is read-only, so only the read half is
5
- // ported: the six kinds the Phase-1 tools actually emit. `not_found_within` is scan-only (it
6
- // serves the deferred `evolver_transaction`) and `classifySubmit` is the write path (Phase 2), so
7
- // neither is ported — and the union, the `ToolResultKind` discriminator set, and `toMcpResult`
8
- //'s branch all agree on exactly these six, leaving no dangling union/branch.
9
- //
10
- // The distinctions are the point. A reader is a model, and it cannot tell "the chain says no such
11
- // thing" from "I could not reach the chain" unless the answer says which — so the kinds are never
12
- // allowed to collapse into one another.
13
- export const TOOL_RESULT_KINDS = [
14
- "ok",
15
- "unreachable",
16
- "not_found",
17
- "partial",
18
- "wrong_kind",
19
- "misconfigured",
20
- ];
21
- export const ok = (value) => ({ kind: "ok", value });
22
- export const misconfigured = (what, fix) => ({ kind: "misconfigured", what, fix });
23
- export const notFound = (what, atHeight) => ({ kind: "not_found", what, atHeight });
24
- export const wrongKind = (what, found, use, atHeight) => ({ kind: "wrong_kind", what, found, use, atHeight });
25
- export const partial = (what, cause) => ({ kind: "partial", what, cause });
26
- /** Turn anything thrown into `unreachable`, naming the chain that was tried.
27
- *
28
- * This exists because the harness signals an error by the tool throwing, and the client throws
29
- * on any non-OK response while the transport rejects on failure. An escaped throw hands the
30
- * model a bare error string and collapses this taxonomy at exactly the point it protects. */
31
- export const unreachableFrom = (e, chain) => ({
32
- kind: "unreachable",
33
- chain,
34
- cause: e instanceof Error ? e.message : String(e),
35
- });
36
- import { FAILURE_REASONS } from "@mcsherrylabs/evolver-client";
37
- /**
38
- * Which failure reasons are a genuine, final answer from the node, and which leave the outcome
39
- * open.
40
- *
41
- * ⚠️ Typed `Record<FailureReason, …>` ON PURPOSE. Adding a reason to the client makes this file
42
- * FAIL TO COMPILE until somebody classifies it — a new reason cannot quietly inherit a default
43
- * that happens to be wrong. The dangerous direction is `refused`: it asserts nothing happened.
44
- */
45
- const REASON_CLASS = {
46
- // ── client-side or otherwise open: the transaction MAY have been ordered ──
47
- internal: "unknown",
48
- confirmation_timeout: "unknown",
49
- duplicate: "unknown",
50
- // ── genuine, final node answers: nothing was ordered and nothing was charged ──
51
- malformed_signed_tx: "refused",
52
- unknown_ledger_id: "refused",
53
- node_not_ready: "refused",
54
- queue_full: "refused",
55
- invalid_signature: "refused",
56
- insufficient_balance: "refused",
57
- invalid_identity_body: "refused",
58
- invalid_group_body: "refused",
59
- invalid_owners_body: "refused",
60
- invalid_list_body: "refused",
61
- rejected: "refused",
62
- ttl_expired: "refused",
63
- ttl_too_far: "refused",
64
- unknown_key: "refused",
65
- unauthorized: "refused",
66
- toll_ceiling_too_low: "refused",
67
- insufficient_da: "refused",
68
- too_many_auths: "refused",
69
- da_unavailable: "refused",
70
- channel_store_full: "refused",
71
- };
72
- /**
73
- * Map what the client reports onto what we tell the model.
74
- *
75
- * ⚠️ The trap this exists to avoid: reporting an unread reply as `refused`, which tells the model
76
- * nothing happened, whose repair is to SIGN AGAIN. The expiry round is folded into the id, so a
77
- * re-signed payment is a different transaction replay protection cannot recognise — both may
78
- * commit. An unknown/`timeout`/unrecognised reason is therefore OPEN, never `refused`.
79
- */
80
- export function classifySubmit(r) {
81
- switch (r.kind) {
82
- case "committed":
83
- return { kind: "committed", txId: r.txIdHex };
84
- case "fined":
85
- return { kind: "fined", reason: r.reason, message: r.message, txId: r.txIdHex };
86
- case "timeout":
87
- return { kind: "unknown", why: "no reply before the deadline — it may have committed", txId: r.txIdHex };
88
- case "failed": {
89
- const known = FAILURE_REASONS.includes(r.reason);
90
- const cls = known ? REASON_CLASS[r.reason] : "unknown";
91
- return cls === "refused"
92
- ? { kind: "refused", reason: r.reason, message: r.message, txId: r.txIdHex }
93
- : { kind: "unknown", why: `${r.reason}: ${r.message}`, txId: r.txIdHex };
94
- }
95
- }
96
- }
97
- //# sourceMappingURL=result.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.js","sourceRoot":"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,CAAC,CAAC,OAAO,EAAE,CAAC;QAClF,KAAK,SAAS;YACZ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,sDAAsD,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QAC3G,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,KAAK,GAAI,eAAqC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YACxE,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACvD,OAAO,GAAG,KAAK,SAAS;gBACtB,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;gBAC5E,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QAC7E,CAAC;IACH,CAAC;AACH,CAAC"}
package/dist/signer.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import type { Signer } from "@mcsherrylabs/evolver-client";
2
- /** The env var naming a path to a base64-encoded key file. Signing is impossible without it. */
3
- export declare const EVOLVER_KEY_PATH = "EVOLVER_KEY_PATH";
4
- /** The env var naming the key type: `"bls"` (default) or `"ed25519"`. */
5
- export declare const EVOLVER_KEY_TYPE = "EVOLVER_KEY_TYPE";
6
- /** The key types this module understands, so a misspelt type is refused here rather than by the
7
- * SDK with an error that echoes nothing useful. */
8
- export declare const SIGNER_TYPE: readonly ["bls", "ed25519"];
9
- export type KeySource = (typeof SIGNER_TYPE)[number];
10
- export type SignerResult = {
11
- readonly ok: true;
12
- readonly signer: Signer;
13
- } | {
14
- readonly ok: false;
15
- readonly error: string;
16
- };
17
- /**
18
- * Resolve the host-held signing key from the environment. Pure of the config file on purpose:
19
- * the config is a committable file and key material has no place in it (D-07).
20
- *
21
- * ⚠️ The error text names the PATH, never the key bytes. A key is the one thing in this process
22
- * whose value must not appear in a log line or a tool result, so a failure reports where the key
23
- * was looked for and what was missing about it — nothing more. The bytes themselves are only ever
24
- * read into memory, base64-decoded, and folded into the `Signer` that closes over them.
25
- */
26
- export declare function loadSigner(source: KeySource, raw: Uint8Array | null): SignerResult;
27
- /**
28
- * Read the key from the environment and construct the `Signer`. The only function that touches
29
- * a filesystem here — `loadSigner` itself stays pure so the resolution rule can be exercised
30
- * without a key file.
31
- *
32
- * Reads `process.env.EVOLVER_KEY_PATH` and `process.env.EVOLVER_KEY_TYPE`; neither is ever read
33
- * from config. Returns `{ ok: false, error }` (naming the PATH, never the key) when the env var
34
- * is unset, the file is missing, or the decoded bytes are empty.
35
- */
36
- export declare function loadSignerFromEnv(env: NodeJS.ProcessEnv): SignerResult;
37
- //# sourceMappingURL=signer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAE3D,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD;oDACoD;AACpD,eAAO,MAAM,WAAW,6BAA8B,CAAC;AACvD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,YAAY,CAgBlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,YAAY,CA0BtE"}
package/dist/signer.js DELETED
@@ -1,76 +0,0 @@
1
- // Key resolution at sign-time (D-07 / SAFE-03): the host-held signing key enters the process
2
- // from the ENVIRONMENT ONLY, never from the committable config file. The key is a bearer of the
3
- // authority that spends, so it must never reach a result, a transcript, or the config file —
4
- // which is why `src/config.ts` rejects `keyLocation`/`keyPath`/`contentUrl` and why this module
5
- // reads nothing off an `EvolverConfig`.
6
- //
7
- // The `Signer` returned closes over the private half, so no caller can read the key back out:
8
- // the only thing a caller can do with it is sign.
9
- import { readFileSync } from "node:fs";
10
- import { blsDefaultSigner, edDefaultSigner } from "@mcsherrylabs/evolver-client";
11
- /** The env var naming a path to a base64-encoded key file. Signing is impossible without it. */
12
- export const EVOLVER_KEY_PATH = "EVOLVER_KEY_PATH";
13
- /** The env var naming the key type: `"bls"` (default) or `"ed25519"`. */
14
- export const EVOLVER_KEY_TYPE = "EVOLVER_KEY_TYPE";
15
- /** The key types this module understands, so a misspelt type is refused here rather than by the
16
- * SDK with an error that echoes nothing useful. */
17
- export const SIGNER_TYPE = ["bls", "ed25519"];
18
- /**
19
- * Resolve the host-held signing key from the environment. Pure of the config file on purpose:
20
- * the config is a committable file and key material has no place in it (D-07).
21
- *
22
- * ⚠️ The error text names the PATH, never the key bytes. A key is the one thing in this process
23
- * whose value must not appear in a log line or a tool result, so a failure reports where the key
24
- * was looked for and what was missing about it — nothing more. The bytes themselves are only ever
25
- * read into memory, base64-decoded, and folded into the `Signer` that closes over them.
26
- */
27
- export function loadSigner(source, raw) {
28
- if (raw === null || raw.length === 0)
29
- return { ok: false, error: "no key bytes were read (empty after decoding)" };
30
- switch (source) {
31
- case "bls":
32
- return { ok: true, signer: blsDefaultSigner(raw, "") };
33
- case "ed25519":
34
- return { ok: true, signer: edDefaultSigner(raw, "") };
35
- default: {
36
- // Exhaustiveness: `source` is typed `KeySource`, so this branch is unreachable — but the
37
- // default keeps an untyped caller from silently falling through to a wrong signer.
38
- const _exhaustive = source;
39
- return { ok: false, error: `unknown key type ${String(_exhaustive)}` };
40
- }
41
- }
42
- }
43
- /**
44
- * Read the key from the environment and construct the `Signer`. The only function that touches
45
- * a filesystem here — `loadSigner` itself stays pure so the resolution rule can be exercised
46
- * without a key file.
47
- *
48
- * Reads `process.env.EVOLVER_KEY_PATH` and `process.env.EVOLVER_KEY_TYPE`; neither is ever read
49
- * from config. Returns `{ ok: false, error }` (naming the PATH, never the key) when the env var
50
- * is unset, the file is missing, or the decoded bytes are empty.
51
- */
52
- export function loadSignerFromEnv(env) {
53
- const path = env[EVOLVER_KEY_PATH];
54
- if (path === undefined || path.length === 0)
55
- return { ok: false, error: `no signing key configured: set ${EVOLVER_KEY_PATH} to a base64-encoded key file` };
56
- const sourceRaw = env[EVOLVER_KEY_TYPE] ?? "bls";
57
- if (!SIGNER_TYPE.includes(sourceRaw))
58
- return {
59
- ok: false,
60
- error: `${EVOLVER_KEY_TYPE} is "${sourceRaw}" but must be one of: ${SIGNER_TYPE.join(", ")}`,
61
- };
62
- let decoded;
63
- try {
64
- const content = readFileSync(path, "utf8").trim();
65
- decoded = Uint8Array.from(Buffer.from(content, "base64"));
66
- }
67
- catch {
68
- return { ok: false, error: `could not read the signing key at ${path}` };
69
- }
70
- // Reject empty decode before the switch: a base64 decoder silently yields zero bytes for empty
71
- // input, and a zero-byte key would construct a signer that signs nothing meaningful.
72
- if (decoded.length === 0)
73
- return { ok: false, error: `the signing key at ${path} decoded to zero bytes` };
74
- return loadSigner(sourceRaw, decoded);
75
- }
76
- //# sourceMappingURL=signer.js.map
@@ -1 +0,0 @@
1
- {"version":3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evolver-client";
3
- export { hexToBytes };
4
- import type { ChainReads } from "./read.js";
5
- import type { SubmissionOutcome, ToolResult } from "./result.js";
6
- /** Rounds of life given to a signed transaction.
7
- *
8
- * ⚠️ SHORT ON PURPOSE. A signed transaction is a bearer artefact: valid until it expires,
9
- * submission unauthenticated, no cancel. Nothing here waits on a human between signing and
10
- * submitting, so a long window buys nothing and leaves a live artefact in a transcript. */
11
- export declare const DEFAULT_TTL_OFFSET = 50;
12
- /** What `signTransfer`/`submitSigned` need from the world, injected so every rule is exercised
13
- * against a fake rather than a live node. */
14
- export interface WriteDeps {
15
- readonly identity: string;
16
- readonly signer: Signer;
17
- readonly ttlOffset?: number;
18
- readonly reads: ChainReads;
19
- submitTx(bytes: Uint8Array): Promise<SubmitResult>;
20
- /** Gateway collection/assembly/submission; never falls back to ordinary submit. */
21
- submitTxWithDa?(bytes: Uint8Array): Promise<SubmitResult>;
22
- }
23
- /** A signed credit transfer, as recorded for inspection. INTENT, not bytes — the base64 bytes
24
- * live in a separate map so a live, submittable artefact never sits on what a model reads. */
25
- export interface SignedTransfer {
26
- readonly txId: string;
27
- readonly expiresAtRound: number;
28
- readonly signedAtRound: number;
29
- readonly summary: {
30
- readonly sender: string;
31
- readonly recipient: string;
32
- readonly amount: string;
33
- };
34
- }
35
- /** A signed opaque channel write (SUBM-07), as recorded. Carries the `verb: "opaque"` tag so a
36
- * reader can tell it from a transfer, and `fields` (the caller-supplied channel + body size) in
37
- * place of the transfer's named fields. Intent, never bytes. */
38
- export interface SignedOpaque {
39
- readonly txId: string;
40
- readonly expiresAtRound: number;
41
- readonly signedAtRound: number;
42
- readonly verb: "opaque";
43
- readonly fields: {
44
- readonly channel: string;
45
- readonly bodyBytes: number;
46
- readonly maxToll: string;
47
- };
48
- readonly summary: {
49
- readonly sender: string;
50
- readonly channel: string;
51
- readonly bodyBytes: number;
52
- readonly maxToll: string;
53
- };
54
- }
55
- /** A signed identity administration operation (SIGN-03..07), as recorded for inspection. Intent,
56
- * never bytes — the base64 bytes live in a separate map. The `verb` discriminator tells a reader
57
- * what happened; `fields`/`summary` name ONLY public, non-key, non-PoP metadata (key `type`/`label`,
58
- * a target, a starting credit) — never `publicKey`, `popSignature`, `bytes` or `base64`. */
59
- export interface SignedIdentity {
60
- readonly txId: string;
61
- readonly expiresAtRound: number;
62
- readonly signedAtRound: number;
63
- readonly verb: "create_identity" | "delete_identity" | "add_key" | "replace_key" | "delete_key";
64
- readonly fields: Record<string, string>;
65
- readonly summary: Record<string, string>;
66
- }
67
- /** A signed groups-ledger operation (SIGN-09..12) or the multi-recipient group credit transfer
68
- * (SIGN-02), as recorded for inspection. Intent, never bytes — the base64 bytes live in a separate
69
- * map. `fields`/`summary` name ONLY public metadata (group name, member node id, decimal
70
- * recipient/amount strings) — never `publicKey`, `popSignature`, `bytes` or `base64`. */
71
- export interface SignedGroup {
72
- readonly txId: string;
73
- readonly expiresAtRound: number;
74
- readonly signedAtRound: number;
75
- readonly verb: "create_group" | "delete_group" | "add_member" | "remove_member" | "group_transfer" | "group_ownership_transfer";
76
- readonly fields: Record<string, string>;
77
- readonly summary: Record<string, string>;
78
- }
79
- /** A PREPARED group ownership transfer awaiting the incoming owner's consent. Nothing is signed and
80
- * no bytes exist, so `submitSigned` cannot find it: an unconsented transfer is unsubmittable by
81
- * construction, not by a flag. Kept apart from `signedThisSession` for that reason. */
82
- export interface PendingOwnershipTransfer {
83
- readonly txId: string;
84
- readonly expiresAtRound: number;
85
- readonly preparedAtRound: number;
86
- readonly verb: "group_ownership_transfer_pending";
87
- readonly fields: {
88
- readonly ledgerId: string;
89
- readonly groupName: string;
90
- readonly outgoingOwner: string;
91
- readonly incomingOwner: string;
92
- readonly maxToll: string;
93
- };
94
- readonly summary: Record<string, string>;
95
- readonly status: string;
96
- }
97
- /** A signed channel-ledger operation (SIGN-13..18: claim, unclaim, write, set-toll, set-write-policy,
98
- * set-DA-policy), as recorded for inspection. Intent, never bytes — the base64 bytes live in a
99
- * separate map. `fields`/`summary` name ONLY public metadata (channel ledger id, write policy, toll
100
- * as a decimal string, DA group/threshold) — never `publicKey`, `popSignature`, `popSig`, `bytes` or
101
- * `base64`. */
102
- export interface SignedChannel {
103
- readonly txId: string;
104
- readonly expiresAtRound: number;
105
- readonly signedAtRound: number;
106
- readonly verb: "channel_claim" | "channel_unclaim" | "channel_write" | "channel_toll" | "channel_write_policy" | "channel_da";
107
- readonly fields: Record<string, string>;
108
- readonly summary: Record<string, string>;
109
- }
110
- /** Everything this session signed: a transfer, an opaque channel write, an identity operation, a
111
- * groups-ledger operation, or a channel-ledger operation. */
112
- export type SignedRecord = SignedTransfer | SignedOpaque | SignedIdentity | SignedGroup | SignedChannel;
113
- /** A channel id a caller may write to — NOT a core ledger, NOT the reserved namespace.
114
- *
115
- * ⚠️ CASE-INSENSITIVE ON PURPOSE, AND NOT BECAUSE THE NODE IS. The node compares ledger ids
116
- * exactly, but refusing every casing costs nothing and removes a whole class of bypass that opens
117
- * the moment anything in the path normalises case. This refusal is the only thing between a
118
- * caller and the node's own interpreters. This single refusal is EXPORTED so `src/channel.ts`
119
- * imports and REUSES it verbatim — never re-implements it (single dispatch-safety rule). */
120
- export declare function writableChannelId(raw: unknown): string | ToolResult<never>;
121
- /** One PROCESS attempt budget per intent, shared by legacy ordinary/DA and approved external
122
- * artifacts. Authorization-set variants have different fingerprints, NOT independent budgets.
123
- * Claim synchronously before network. An uncertain attempt remains consumed until restart;
124
- * export/other sessions mean this is never a global exactly-once guarantee. */
125
- export declare function submissionAttempted(txId: string): boolean;
126
- export declare function claimSubmissionAttempt(txId: string): boolean;
127
- /** A caller-supplied id, safe to name in a refusal. Echoing it verbatim gifts an attacker content
128
- * AND size in the transcript; the id is named only when it LOOKS like one. */
129
- export declare const namedInRefusal: (txId: string) => string;
130
- /** Everything this session signed, by id. */
131
- export declare function recordedById(txId: string): SignedRecord | undefined;
132
- /** Record a signed operation into BOTH session stores — the intent record AND the base64 bearer
133
- * bytes. This is the single record path shared by `signTransfer` and `composeIdentityTx` (via
134
- * `src/identity.ts`); composing and recording in one call is what keeps inspect/submit from ever
135
- * seeing a signed transaction whose record is missing. */
136
- export declare function recordSigned(signed: SignedRecord, bytes: Uint8Array): void;
137
- /** Record an operation whose envelope carries auths assembled from MORE than this session's signer
138
- * (the group ownership transfer). Strict where `recordSigned` is lenient: it never replaces or
139
- * merges an existing id, so a verified multi-auth envelope cannot be shadowed by, or shadow, an
140
- * earlier record. Returns false (recording nothing) when the id is already known. */
141
- export declare function recordAssembledOnce(signed: SignedGroup, bytes: Uint8Array): boolean;
142
- export declare const MAX_PENDING_OWNERSHIP = 16;
143
- /** Remember a prepared transfer. False when the bound is reached or the id is already known. */
144
- export declare function recordPendingOwnership(p: PendingOwnershipTransfer): boolean;
145
- export declare function pendingOwnershipById(txId: string): PendingOwnershipTransfer | undefined;
146
- export declare function dropPendingOwnership(txId: string): void;
147
- /** Forget prepared transfers that can no longer be admitted (expiry <= round). They were never
148
- * signed, so nothing submittable is lost; this keeps the bound from filling with dead entries. */
149
- export declare function pruneExpiredPendingOwnership(round: number): void;
150
- /** The signed bytes for one recorded transaction, base64. Undefined for anything this session
151
- * did not sign. */
152
- export declare function peekBytes(txId: string): string | undefined;
153
- /**
154
- * Sign a credit transfer to a `txId` and record it — no network submit (SIGN-20).
155
- *
156
- * Reads the chain tip to bound the TTL (the read is mandatory: a transaction's life is relative
157
- * to the current round, and a guessed round is refused). If the chain is unreachable, signing
158
- * fails as `unreachable` — but it still does NOT submit.
159
- */
160
- export declare function signTransfer(deps: WriteDeps, params: {
161
- recipient: string;
162
- amount: string;
163
- }): Promise<ToolResult<SignedTransfer>>;
164
- /**
165
- * Sign a write to a channel — the generic escape hatch (SUBM-07). Signs only; a separate
166
- * `evolver_submit` or `evolver_submit_da` call is what reaches a chain.
167
- *
168
- * ⚠️ WHAT THE CALLER IS TRUSTED WITH, AND WHAT IT IS NOT. The caller chooses the bytes and the
169
- * channel. It does NOT choose the interpreter: `writableChannelId` below refuses every CORE ledger
170
- * id and the whole reserved `ce.evolver.` namespace, so the bytes reach a ledger the core never
171
- * parses. That is the whole safety argument — a caller who could name `ce.evolver.ledger.identity`
172
- * with a crafted body would be handing the node a transfer or key registration signed as this
173
- * identity. The sign DIGEST was never the weak point; DISPATCH was.
174
- *
175
- * ⚠️ NOT THE 157 LOGIN. The `signedRequest` SDK path is a challenge-response login proof that sends
176
- * its own HTTP and carries no commit interval; it is a DIFFERENT affordance and is not wired here.
177
- */
178
- export declare function signOpaque(deps: WriteDeps, params: {
179
- channel: string;
180
- bodyHex: string;
181
- }): Promise<ToolResult<SignedOpaque>>;
182
- /** What a signed submit returned. Ordinary `commitIntervalMs` is present ONLY on an observed
183
- * matching commit. DA `daSubmitDurationMs` measures the entire gateway call (including collection
184
- * and assembly), even on an unsuccessful/unknown return; it never claims commit-only latency.
185
- * The published SDK provides no separate collection or commit timing. Local guards have neither. */
186
- export type SubmitReport = SubmissionOutcome & {
187
- readonly commitIntervalMs?: number;
188
- readonly daSubmitDurationMs?: number;
189
- readonly submitted?: Record<string, string | number>;
190
- };
191
- /**
192
- * Submit a transaction this session signed, by its `txId` (SIGN-19). Never signs, never does
193
- * network work before the guards clear:
194
- *
195
- * Rule 1 (SUBM-08) — only what this session signed: otherwise this agent is a submission relay.
196
- * Rule 2 (SAFE-01) — never twice: a repeat is a no-op the chain refuses, and re-signing is the
197
- * loop that pays twice. Here the refusal names "look it up", never re-sign.
198
- *
199
- * The `txId` resolves the signed record and the exact stored bytes. Both routes share these guards
200
- * and mark the id before awaiting the network, including when the result is unknown. DA permits
201
- * only channel-write intent, never a core-ledger operation or owners-ledger administration.
202
- */
203
- export declare function submitSigned(deps: WriteDeps, txId: string, mode?: "ordinary" | "da"): Promise<SubmitReport>;
204
- /**
205
- * Read back what a signed transaction would do (READ-05). Answers from the session RECORD, not
206
- * by decoding — and not from any other transaction. Contacts no chain.
207
- */
208
- export declare function inspectSigned(txId: string): ToolResult<SignedRecord | PendingOwnershipTransfer>;
209
- /** Test seam only: forget this session's signing history (all three stores). */
210
- export declare function __resetSession(): void;
211
- /** The single compose→sign→record helper, re-exported from `src/identity.ts` so every identity verb
212
- * and any future signing verb shares ONE compose implementation (never two). */
213
- export { composeIdentityTx as composeAndSign } from "./identity.js";
214
- //# sourceMappingURL=write.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAaA,OAAO,EAML,UAAU,EAGX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIzE,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;4FAI4F;AAC5F,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;8CAC8C;AAC9C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACnD,mFAAmF;IACnF,cAAc,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC3D;AAED;+FAC+F;AAC/F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAA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