tenjin-cli 0.1.0-alpha.16 → 0.1.0-alpha.17

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 (110) hide show
  1. package/README.md +2 -0
  2. package/dist/chunk-2G2WLVHB.js +102 -0
  3. package/dist/chunk-2G2WLVHB.js.map +1 -0
  4. package/dist/chunk-2I4QTOLB.js +11 -0
  5. package/dist/chunk-2I4QTOLB.js.map +1 -0
  6. package/dist/{chunk-HVRC33OL.js → chunk-2JGT3KDW.js} +4 -6
  7. package/dist/{chunk-HVRC33OL.js.map → chunk-2JGT3KDW.js.map} +1 -1
  8. package/dist/chunk-35M3VITA.js +102 -0
  9. package/dist/chunk-35M3VITA.js.map +1 -0
  10. package/dist/{chunk-5X4SZ5BF.js → chunk-5QHHRMRA.js} +4 -4
  11. package/dist/{chunk-BFFM2WFK.js → chunk-5UDD5VSY.js} +2 -2
  12. package/dist/{chunk-BFFM2WFK.js.map → chunk-5UDD5VSY.js.map} +1 -1
  13. package/dist/{chunk-OIM4HLN6.js → chunk-7QKHZQKW.js} +295 -20
  14. package/dist/chunk-7QKHZQKW.js.map +1 -0
  15. package/dist/{chunk-BBVUVBUO.js → chunk-AR7U7BRG.js} +44 -7
  16. package/dist/{chunk-BBVUVBUO.js.map → chunk-AR7U7BRG.js.map} +1 -1
  17. package/dist/{chunk-DMZZLPZN.js → chunk-AUKDYPPX.js} +14 -89
  18. package/dist/chunk-AUKDYPPX.js.map +1 -0
  19. package/dist/{chunk-PZEN5PHN.js → chunk-J5INH7WB.js} +17 -3
  20. package/dist/chunk-J5INH7WB.js.map +1 -0
  21. package/dist/{chunk-7WEQQJLG.js → chunk-JLEF5WHM.js} +66 -2
  22. package/dist/chunk-JLEF5WHM.js.map +1 -0
  23. package/dist/{chunk-GULLJQXA.js → chunk-KK4YGYTV.js} +127 -17
  24. package/dist/chunk-KK4YGYTV.js.map +1 -0
  25. package/dist/{chunk-YEETV6IW.js → chunk-KUBEYXSO.js} +10 -12
  26. package/dist/{chunk-YEETV6IW.js.map → chunk-KUBEYXSO.js.map} +1 -1
  27. package/dist/{chunk-2U5ZVEV3.js → chunk-LJ4DMVFI.js} +5 -5
  28. package/dist/{chunk-3AJS6LLN.js → chunk-MRGADYDD.js} +7 -7
  29. package/dist/{chunk-25TJPVBF.js → chunk-O4ZNKFRU.js} +28 -15
  30. package/dist/chunk-O4ZNKFRU.js.map +1 -0
  31. package/dist/{chunk-OJLYNM4Z.js → chunk-PDA2BVFY.js} +77 -19
  32. package/dist/chunk-PDA2BVFY.js.map +1 -0
  33. package/dist/{chunk-L3PVMIYQ.js → chunk-QDD2RN7G.js} +29 -119
  34. package/dist/chunk-QDD2RN7G.js.map +1 -0
  35. package/dist/chunk-S2NRVRPF.js +171 -0
  36. package/dist/chunk-S2NRVRPF.js.map +1 -0
  37. package/dist/chunk-TGLKKLQG.js +11 -0
  38. package/dist/chunk-TGLKKLQG.js.map +1 -0
  39. package/dist/chunk-TP4D47BY.js +127 -0
  40. package/dist/chunk-TP4D47BY.js.map +1 -0
  41. package/dist/{chunk-WH7OWT6G.js → chunk-U2DZISAH.js} +2 -8
  42. package/dist/chunk-U2DZISAH.js.map +1 -0
  43. package/dist/{chunk-USS336NF.js → chunk-WGQVJM56.js} +5 -5
  44. package/dist/chunk-WGQVJM56.js.map +1 -0
  45. package/dist/{chunk-YJHHCWM3.js → chunk-WLMJE3GJ.js} +3 -3
  46. package/dist/{chunk-U5DXNFJC.js → chunk-WS4JA6TC.js} +3 -3
  47. package/dist/{chunk-SKAHDQH7.js → chunk-XZOEUYMX.js} +6 -7
  48. package/dist/{chunk-SKAHDQH7.js.map → chunk-XZOEUYMX.js.map} +1 -1
  49. package/dist/{cli-M3XCSOU6.js → cli-VHYYYYXM.js} +43 -29
  50. package/dist/{cli-M3XCSOU6.js.map → cli-VHYYYYXM.js.map} +1 -1
  51. package/dist/{config-MXOX7XDR.js → config-5ADBAAXU.js} +11 -10
  52. package/dist/{doctor-LU4YIZWM.js → doctor-Q35VQW3S.js} +108 -21
  53. package/dist/doctor-Q35VQW3S.js.map +1 -0
  54. package/dist/{fund-A54P2QFK.js → fund-GDDPL2BB.js} +11 -10
  55. package/dist/{fund-A54P2QFK.js.map → fund-GDDPL2BB.js.map} +1 -1
  56. package/dist/hook-command-PBERPRE3.js +763 -0
  57. package/dist/hook-command-PBERPRE3.js.map +1 -0
  58. package/dist/index.js +2 -2
  59. package/dist/{install-XUM2XSHW.js → install-OKDKGUXM.js} +21 -14
  60. package/dist/{install-wallet-QIOFORTX.js → install-wallet-SI4LZ73K.js} +10 -9
  61. package/dist/{install-wallet-QIOFORTX.js.map → install-wallet-SI4LZ73K.js.map} +1 -1
  62. package/dist/{mcp-HJC2PLRV.js → mcp-XX3WRQEZ.js} +63 -31
  63. package/dist/{mcp-HJC2PLRV.js.map → mcp-XX3WRQEZ.js.map} +1 -1
  64. package/dist/{pay-SBXZEPEP.js → pay-3SYKHKWJ.js} +15 -13
  65. package/dist/{redact-46ZHF2NH.js → redact-6W23GGJC.js} +4 -6
  66. package/dist/{send-ASD2ZXJD.js → send-LQRKTEJT.js} +10 -9
  67. package/dist/{send-ASD2ZXJD.js.map → send-LQRKTEJT.js.map} +1 -1
  68. package/dist/{skill-placement-NFVHY6A3.js → skill-placement-JMDPSKE6.js} +12 -13
  69. package/dist/{skill-placement-NFVHY6A3.js.map → skill-placement-JMDPSKE6.js.map} +1 -1
  70. package/dist/{status-T2SDB57A.js → status-FFC6FO72.js} +8 -7
  71. package/dist/{status-T2SDB57A.js.map → status-FFC6FO72.js.map} +1 -1
  72. package/dist/{status-line-CGPUSDMC.js → status-line-SAXSU6CR.js} +19 -3
  73. package/dist/status-line-SAXSU6CR.js.map +1 -0
  74. package/dist/{status-line-wiring-BYPHTYZE.js → status-line-wiring-L2WYIYBM.js} +5 -6
  75. package/dist/tenjin-daemon.mjs +384 -23
  76. package/dist/{uninstall-FKYZHAM3.js → uninstall-OACH27UV.js} +18 -15
  77. package/dist/{uninstall-FKYZHAM3.js.map → uninstall-OACH27UV.js.map} +1 -1
  78. package/dist/{update-ANJ2AOTN.js → update-4W6EKLGZ.js} +6 -7
  79. package/dist/{update-ANJ2AOTN.js.map → update-4W6EKLGZ.js.map} +1 -1
  80. package/dist/{wallet-PWAHVKWW.js → wallet-BMEXRR3P.js} +10 -9
  81. package/docs/agent-permissions.md +16 -8
  82. package/docs/safety-model.md +1 -1
  83. package/package.json +1 -1
  84. package/dist/chunk-25TJPVBF.js.map +0 -1
  85. package/dist/chunk-7WEQQJLG.js.map +0 -1
  86. package/dist/chunk-DMZZLPZN.js.map +0 -1
  87. package/dist/chunk-GULLJQXA.js.map +0 -1
  88. package/dist/chunk-L3PVMIYQ.js.map +0 -1
  89. package/dist/chunk-OCBHUHWB.js +0 -69
  90. package/dist/chunk-OCBHUHWB.js.map +0 -1
  91. package/dist/chunk-OIM4HLN6.js.map +0 -1
  92. package/dist/chunk-OJLYNM4Z.js.map +0 -1
  93. package/dist/chunk-PZEN5PHN.js.map +0 -1
  94. package/dist/chunk-USS336NF.js.map +0 -1
  95. package/dist/chunk-WH7OWT6G.js.map +0 -1
  96. package/dist/doctor-LU4YIZWM.js.map +0 -1
  97. package/dist/hook-command-U6KWPEDQ.js +0 -377
  98. package/dist/hook-command-U6KWPEDQ.js.map +0 -1
  99. package/dist/status-line-CGPUSDMC.js.map +0 -1
  100. /package/dist/{chunk-5X4SZ5BF.js.map → chunk-5QHHRMRA.js.map} +0 -0
  101. /package/dist/{chunk-2U5ZVEV3.js.map → chunk-LJ4DMVFI.js.map} +0 -0
  102. /package/dist/{chunk-3AJS6LLN.js.map → chunk-MRGADYDD.js.map} +0 -0
  103. /package/dist/{chunk-YJHHCWM3.js.map → chunk-WLMJE3GJ.js.map} +0 -0
  104. /package/dist/{chunk-U5DXNFJC.js.map → chunk-WS4JA6TC.js.map} +0 -0
  105. /package/dist/{config-MXOX7XDR.js.map → config-5ADBAAXU.js.map} +0 -0
  106. /package/dist/{install-XUM2XSHW.js.map → install-OKDKGUXM.js.map} +0 -0
  107. /package/dist/{pay-SBXZEPEP.js.map → pay-3SYKHKWJ.js.map} +0 -0
  108. /package/dist/{redact-46ZHF2NH.js.map → redact-6W23GGJC.js.map} +0 -0
  109. /package/dist/{status-line-wiring-BYPHTYZE.js.map → status-line-wiring-L2WYIYBM.js.map} +0 -0
  110. /package/dist/{wallet-PWAHVKWW.js.map → wallet-BMEXRR3P.js.map} +0 -0
package/README.md CHANGED
@@ -71,6 +71,8 @@ tenjin uninstall # removes the Claude Code setup; your wallet stays
71
71
 
72
72
  Use `tenjin install --project` to set it up for one project instead of your whole machine.
73
73
 
74
+ To keep it installed and stop it, `tenjin config set router.enabled false` stops the router on this machine, and `tenjin config set --project router.enabled false` stops it in this repository.
75
+
74
76
  ## More
75
77
 
76
78
  - [How a lookup runs, what it sends, and what install writes](./docs/agent-permissions.md)
@@ -0,0 +1,102 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ CliError
4
+ } from "./chunk-JLEF5WHM.js";
5
+
6
+ // src/lib/destination.ts
7
+ import { lookup } from "node:dns/promises";
8
+ import { BlockList, isIP } from "node:net";
9
+ var blockedV4 = new BlockList();
10
+ for (const [base, prefix] of [
11
+ ["0.0.0.0", 8],
12
+ ["10.0.0.0", 8],
13
+ ["100.64.0.0", 10],
14
+ ["127.0.0.0", 8],
15
+ ["169.254.0.0", 16],
16
+ ["172.16.0.0", 12],
17
+ ["192.0.0.0", 24],
18
+ ["192.0.2.0", 24],
19
+ ["192.168.0.0", 16],
20
+ ["198.18.0.0", 15],
21
+ ["198.51.100.0", 24],
22
+ ["203.0.113.0", 24],
23
+ ["224.0.0.0", 4],
24
+ ["240.0.0.0", 4]
25
+ ]) {
26
+ blockedV4.addSubnet(base, prefix, "ipv4");
27
+ }
28
+ var blockedV6 = new BlockList();
29
+ for (const [base, prefix] of [
30
+ ["::", 128],
31
+ ["::1", 128],
32
+ ["64:ff9b::", 96],
33
+ ["100::", 64],
34
+ ["2001:db8::", 32],
35
+ ["fc00::", 7],
36
+ ["fe80::", 10],
37
+ ["ff00::", 8]
38
+ ]) {
39
+ blockedV6.addSubnet(base, prefix, "ipv6");
40
+ }
41
+ function isPublicAddress(value) {
42
+ const kind = isIP(value);
43
+ if (kind === 4) return !blockedV4.check(value, "ipv4");
44
+ return kind === 6 && /^[23]/i.test(value) && !blockedV6.check(value, "ipv6");
45
+ }
46
+ var LOCAL_SUFFIX = /(?:^|\.)(?:localhost|local|internal|home|lan)$/i;
47
+ function refuse(message, details) {
48
+ throw new CliError("USAGE", message, {
49
+ fix: "Paid requests go to public HTTPS endpoints only; nothing was signed.",
50
+ ...details !== void 0 ? { details } : {}
51
+ });
52
+ }
53
+ function assertPublicHttpsUrl(raw) {
54
+ let url;
55
+ try {
56
+ url = new URL(raw);
57
+ } catch {
58
+ return refuse(`Invalid URL: ${JSON.stringify(raw.slice(0, 200))}`);
59
+ }
60
+ if (url.protocol !== "https:" || url.username !== "" || url.password !== "" || url.hash !== "" || url.port !== "" && url.port !== "443" || raw.length > 16384) {
61
+ refuse("Only public HTTPS endpoints without credentials, fragments or custom ports are paid.");
62
+ }
63
+ const host = url.hostname.replace(/^\[|\]$/g, "");
64
+ if (!host.includes(".") && isIP(host) === 0) refuse("The endpoint host is not a public name.");
65
+ if (LOCAL_SUFFIX.test(host)) refuse("Private or local destinations are not paid.");
66
+ if (isIP(host) !== 0 && !isPublicAddress(host)) {
67
+ refuse("Private or reserved IP destinations are not paid.");
68
+ }
69
+ return url;
70
+ }
71
+ async function assertPublicDestination(raw, options = {}) {
72
+ const url = assertPublicHttpsUrl(raw);
73
+ const host = url.hostname.replace(/^\[|\]$/g, "");
74
+ if (isIP(host) !== 0) return url;
75
+ const resolve = options.resolveHostname ?? ((name) => lookup(name, { all: true }));
76
+ const signal = AbortSignal.timeout(options.timeoutMs ?? 5e3);
77
+ let addresses;
78
+ try {
79
+ addresses = await Promise.race([
80
+ resolve(host),
81
+ new Promise((_, reject) => {
82
+ signal.addEventListener("abort", () => reject(new Error("DNS lookup timed out.")), {
83
+ once: true
84
+ });
85
+ })
86
+ ]);
87
+ } catch (err) {
88
+ return refuse(`The endpoint host ${host} could not be resolved.`, {
89
+ cause: err instanceof Error ? err.message : String(err)
90
+ });
91
+ }
92
+ if (addresses.length === 0 || addresses.some((entry) => !isPublicAddress(entry.address))) {
93
+ refuse(`The endpoint host ${host} resolves to a private or unsupported network address.`);
94
+ }
95
+ return url;
96
+ }
97
+
98
+ export {
99
+ isPublicAddress,
100
+ assertPublicDestination
101
+ };
102
+ //# sourceMappingURL=chunk-2G2WLVHB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/destination.ts"],"sourcesContent":["import { lookup } from 'node:dns/promises';\nimport { BlockList, isIP } from 'node:net';\nimport { CliError } from './errors';\n\n/**\n * Where this CLI is willing to send a paid request. Ported from the draft\n * auto-mode experiment (PR #369 `execution.ts`) into a shared path, so the\n * router's provider call and `tenjin pay` answer the question the same way.\n *\n * TWO CHECKS, BOTH NEEDED. The lexical one refuses a URL shape that cannot be a\n * public endpoint (a scheme, credentials, a fragment, a literal private\n * address). The DNS one refuses a public-looking NAME that resolves onto the\n * local network, which is the shape a hostile registry listing or a hostile\n * routing decision would take.\n *\n * WHAT IT IS NOT. A resolved address is checked, NOT PINNED. `fetch` resolves\n * the name again on its own, so a host that answers publicly here and privately\n * a moment later is not closed by this, and neither is a remote scraper\n * following its own redirects on its own server. Closing the first needs a\n * transport that connects to the address it validated (`node:https` with a\n * `lookup` override, as the draft experiment's `safeHttpsTransport` did), which\n * the plan for this release deliberately left unported. What this does remove\n * is the easy local target: `http://`, credentials, a custom port, a literal\n * private address, a `.localhost`/`.internal` name, and a public name whose\n * only answers are private. Documented in docs/safety-model.md as a bound.\n */\n\nconst blockedV4 = new BlockList();\nfor (const [base, prefix] of [\n ['0.0.0.0', 8],\n ['10.0.0.0', 8],\n ['100.64.0.0', 10],\n ['127.0.0.0', 8],\n ['169.254.0.0', 16],\n ['172.16.0.0', 12],\n ['192.0.0.0', 24],\n ['192.0.2.0', 24],\n ['192.168.0.0', 16],\n ['198.18.0.0', 15],\n ['198.51.100.0', 24],\n ['203.0.113.0', 24],\n ['224.0.0.0', 4],\n ['240.0.0.0', 4],\n] as const) {\n blockedV4.addSubnet(base, prefix, 'ipv4');\n}\n\nconst blockedV6 = new BlockList();\nfor (const [base, prefix] of [\n ['::', 128],\n ['::1', 128],\n ['64:ff9b::', 96],\n ['100::', 64],\n ['2001:db8::', 32],\n ['fc00::', 7],\n ['fe80::', 10],\n ['ff00::', 8],\n] as const) {\n blockedV6.addSubnet(base, prefix, 'ipv6');\n}\n\n/** Is this literal address one a paid request may be sent to? IPv6 additionally\n * has to sit in the globally routable 2000::/3 range. */\nexport function isPublicAddress(value: string): boolean {\n const kind = isIP(value);\n if (kind === 4) return !blockedV4.check(value, 'ipv4');\n return kind === 6 && /^[23]/i.test(value) && !blockedV6.check(value, 'ipv6');\n}\n\nconst LOCAL_SUFFIX = /(?:^|\\.)(?:localhost|local|internal|home|lan)$/i;\n\nfunction refuse(message: string, details?: Record<string, unknown>): never {\n throw new CliError('USAGE', message, {\n fix: 'Paid requests go to public HTTPS endpoints only; nothing was signed.',\n ...(details !== undefined ? { details } : {}),\n });\n}\n\n/** The lexical half: the URL shape alone, no network. Returns the parsed URL. */\nexport function assertPublicHttpsUrl(raw: string): URL {\n let url: URL;\n try {\n url = new URL(raw);\n } catch {\n return refuse(`Invalid URL: ${JSON.stringify(raw.slice(0, 200))}`);\n }\n if (\n url.protocol !== 'https:' ||\n url.username !== '' ||\n url.password !== '' ||\n url.hash !== '' ||\n (url.port !== '' && url.port !== '443') ||\n raw.length > 16_384\n ) {\n refuse('Only public HTTPS endpoints without credentials, fragments or custom ports are paid.');\n }\n const host = url.hostname.replace(/^\\[|\\]$/g, '');\n if (!host.includes('.') && isIP(host) === 0) refuse('The endpoint host is not a public name.');\n if (LOCAL_SUFFIX.test(host)) refuse('Private or local destinations are not paid.');\n if (isIP(host) !== 0 && !isPublicAddress(host)) {\n refuse('Private or reserved IP destinations are not paid.');\n }\n return url;\n}\n\nexport interface DestinationOptions {\n /** Resolver seam; production leaves it unset and uses `dns.lookup`. */\n resolveHostname?: (hostname: string) => Promise<{ address: string; family: number }[]>;\n /** One deadline for the whole resolution, not per address. */\n timeoutMs?: number;\n}\n\n/**\n * The full preflight: the lexical check, then DNS. A literal address answered\n * the DNS question already and skips the lookup.\n */\nexport async function assertPublicDestination(\n raw: string,\n options: DestinationOptions = {},\n): Promise<URL> {\n const url = assertPublicHttpsUrl(raw);\n const host = url.hostname.replace(/^\\[|\\]$/g, '');\n if (isIP(host) !== 0) return url;\n const resolve = options.resolveHostname ?? ((name: string) => lookup(name, { all: true }));\n const signal = AbortSignal.timeout(options.timeoutMs ?? 5_000);\n let addresses: { address: string; family: number }[];\n try {\n addresses = await Promise.race([\n resolve(host),\n new Promise<never>((_, reject) => {\n signal.addEventListener('abort', () => reject(new Error('DNS lookup timed out.')), {\n once: true,\n });\n }),\n ]);\n } catch (err) {\n return refuse(`The endpoint host ${host} could not be resolved.`, {\n cause: err instanceof Error ? err.message : String(err),\n });\n }\n if (addresses.length === 0 || addresses.some((entry) => !isPublicAddress(entry.address))) {\n refuse(`The endpoint host ${host} resolves to a private or unsupported network address.`);\n }\n return url;\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,WAAW,YAAY;AA0BhC,IAAM,YAAY,IAAI,UAAU;AAChC,WAAW,CAAC,MAAM,MAAM,KAAK;AAAA,EAC3B,CAAC,WAAW,CAAC;AAAA,EACb,CAAC,YAAY,CAAC;AAAA,EACd,CAAC,cAAc,EAAE;AAAA,EACjB,CAAC,aAAa,CAAC;AAAA,EACf,CAAC,eAAe,EAAE;AAAA,EAClB,CAAC,cAAc,EAAE;AAAA,EACjB,CAAC,aAAa,EAAE;AAAA,EAChB,CAAC,aAAa,EAAE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AI,wDAAwD;AAAA,EAC1F;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+
3
+ // src/lib/errno.ts
4
+ function hasCode(err, code) {
5
+ return typeof err === "object" && err !== null && "code" in err && err.code === code;
6
+ }
7
+
8
+ export {
9
+ hasCode
10
+ };
11
+ //# sourceMappingURL=chunk-2I4QTOLB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/errno.ts"],"sourcesContent":["/**\n * True when `err` is a Node system error carrying the given `code` (ENOENT,\n * EEXIST, …). One definition so the fs-error checks scattered across the wallet\n * store, config loader, and session cache stay identical.\n */\nexport function hasCode(err: unknown, code: string): boolean {\n return (\n typeof err === 'object' &&\n err !== null &&\n 'code' in err &&\n (err as { code?: unknown }).code === code\n );\n}\n"],"mappings":";;;AAKO,SAAS,QAAQ,KAAc,MAAuB;AAC3D,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACT,IAA2B,SAAS;AAEzC;","names":[]}
@@ -1,13 +1,11 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  inspectHooksFile
4
- } from "./chunk-SKAHDQH7.js";
5
- import {
6
- CliError
7
- } from "./chunk-OCBHUHWB.js";
4
+ } from "./chunk-XZOEUYMX.js";
8
5
  import {
6
+ CliError,
9
7
  writeFileAtomic
10
- } from "./chunk-7WEQQJLG.js";
8
+ } from "./chunk-JLEF5WHM.js";
11
9
 
12
10
  // src/router/status-line-wiring.ts
13
11
  import { readFile, stat } from "node:fs/promises";
@@ -171,4 +169,4 @@ export {
171
169
  removeStatusLine,
172
170
  inspectStatusLine
173
171
  };
174
- //# sourceMappingURL=chunk-HVRC33OL.js.map
172
+ //# sourceMappingURL=chunk-2JGT3KDW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/router/status-line-wiring.ts"],"sourcesContent":["import { readFile, stat } from 'node:fs/promises';\nimport { writeFileAtomic } from '../lib/atomic-json';\nimport { CliError } from '../lib/errors';\nimport { inspectHooksFile } from '../lib/harness-hooks';\n\n/**\n * The `statusLine` key in Claude Code's settings file: the one setting the live\n * footer needs, and the one piece of harness configuration a person is most\n * likely to have already set for themselves.\n *\n * SO IT IS NEVER REPLACED. An existing status line that is not ours is left\n * exactly as it is, and `install` prints the composition line instead;\n * `--status-line compose` writes that line only because it was asked for by\n * name. Writing over it and saying so in the output destroys a configuration\n * this CLI did not create.\n *\n * OWNERSHIP IS ONE MARKER, the command naming `tenjin status-line`, used by\n * `install`, `install --refresh`, `uninstall` and `doctor` alike, so the four\n * can never disagree about which status line is Tenjin's.\n */\n\n/** The command `install` registers, in the shape the hook entries use: a plain\n * command line on PATH, with no path into this build's dist directory. */\nexport const STATUS_LINE_COMMAND = 'tenjin status-line';\n/** Claude Code re-runs the command on this interval, in seconds. */\nexport const STATUS_LINE_REFRESH_SECONDS = 1;\n/** The marker that makes a status line ours, composed or not. */\nconst OUR_MARKER = STATUS_LINE_COMMAND;\n\n/** What the user asked for, when they asked. Absent means the default path. */\nexport type StatusLineMode = 'own' | 'compose' | 'skip';\n\nconst MODES: readonly StatusLineMode[] = ['own', 'compose', 'skip'];\n\n/** `--status-line <mode>`, refused rather than guessed at. */\nexport function statusLineMode(value: string): StatusLineMode {\n const mode = MODES.find((known) => known === value);\n if (mode === undefined) {\n throw new CliError('USAGE', `--status-line takes ${MODES.join(', ')}, not \"${value}\".`, {\n fix: 'Run `tenjin install --status-line own`.',\n });\n }\n return mode;\n}\n\n/**\n * What is in the file: ours alone, ours appended to someone else's, someone\n * else's alone, or nothing.\n */\nexport type StatusLineState = 'ours' | 'composed' | 'foreign' | 'absent';\n\nexport interface StatusLineResult {\n path: string;\n state: StatusLineState;\n /** True when this run changed the file. */\n wrote: boolean;\n /** The command now registered, when one of ours is. */\n command?: string;\n /** The exact command to set by hand, printed when a foreign line is kept. */\n compose?: string;\n /** Why nothing was written, for a file this run would not touch. */\n warning?: string;\n}\n\nexport function classifyStatusLine(value: unknown): StatusLineState {\n if (value === null || value === undefined) return 'absent';\n const command =\n typeof value === 'string'\n ? value\n : typeof value === 'object' && !Array.isArray(value)\n ? (value as { command?: unknown }).command\n : undefined;\n // A status line whose command this build cannot read is still the user's.\n if (typeof command !== 'string' || command.trim().length === 0) return 'foreign';\n if (command.trim() === OUR_MARKER) return 'ours';\n return command.includes(OUR_MARKER) ? 'composed' : 'foreign';\n}\n\nfunction ours(): Record<string, unknown> {\n return {\n type: 'command',\n command: STATUS_LINE_COMMAND,\n refreshInterval: STATUS_LINE_REFRESH_SECONDS,\n };\n}\n\nconst shQuote = (value: string): string => `'${value.replaceAll(\"'\", String.raw`'\\''`)}'`;\nconst shUnquote = (value: string): string => value.replaceAll(String.raw`'\\''`, \"'\");\n\n/** The inner script, with the user's own command as the one hole in it. */\nfunction composedScript(existing: string): string {\n return [\n 'event=$(cat)',\n `yours=$(printf %s \"$event\" | ${existing})`,\n `tenjin=$(printf %s \"$event\" | ${STATUS_LINE_COMMAND})`,\n 'printf %s \"$yours${tenjin:+ · $tenjin}\"',\n ].join('; ');\n}\n\n/**\n * The command a composition was built from, or null when this is not a\n * composition this build wrote. It is the exact inverse of\n * {@link composeCommand}: a hand-edited line matches nothing and is kept whole,\n * because guessing at someone's shell is how an uninstall breaks a prompt.\n */\nexport function decomposeCommand(command: string): string | null {\n const trimmed = command.trim();\n if (!trimmed.startsWith(\"sh -c '\") || !trimmed.endsWith(\"'\")) return null;\n const script = shUnquote(trimmed.slice(\"sh -c '\".length, -1));\n const prefix = 'event=$(cat); yours=$(printf %s \"$event\" | ';\n if (!script.startsWith(prefix)) return null;\n const rest = script.slice(prefix.length);\n const suffix = `); tenjin=$(printf %s \"$event\" | ${STATUS_LINE_COMMAND}); printf %s \"$yours\\${tenjin:+ · $tenjin}\"`;\n if (!rest.endsWith(suffix)) return null;\n const existing = rest.slice(0, -suffix.length);\n return existing.length > 0 && composedScript(existing) === script ? existing : null;\n}\n\n/**\n * The user's status line with ours appended after a separator, on one line.\n *\n * The harness writes its event on stdin ONCE, so a composition cannot simply\n * run two commands in sequence: the event is captured first and replayed into\n * each. Ours contributes nothing when this session has no activity, and the\n * separator goes with it, so a quiet session looks exactly as it did before.\n */\nexport function composeCommand(existing: string): string {\n return `sh -c ${shQuote(composedScript(existing))}`;\n}\n\n/** The command a status-line setting runs, in either shape it can take. */\nfunction commandOf(value: unknown): string | undefined {\n const command =\n typeof value === 'string'\n ? value\n : typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as { command?: unknown }).command\n : undefined;\n return typeof command === 'string' && command.trim().length > 0 ? command.trim() : undefined;\n}\n\n/** What a foreign status line's owner is told to set, verbatim. */\nfunction composeFor(value: unknown): string | undefined {\n const command = commandOf(value);\n return command === undefined ? undefined : composeCommand(command);\n}\n\nexport interface EnsureStatusLineOpts {\n mode?: StatusLineMode;\n /**\n * `install --refresh` and the refresh `tenjin update` spawns: converge a\n * status line of ours that is already registered, and ADD NOTHING. A machine\n * whose owner removed ours, or never had it, keeps that answer across every\n * upgrade without a second place to record it.\n */\n refreshOnly?: boolean;\n}\n\nexport async function ensureStatusLine(\n settingsPath: string,\n opts: EnsureStatusLineOpts = {},\n): Promise<StatusLineResult> {\n const found = await inspectHooksFile(settingsPath);\n if ('refusal' in found) {\n return { path: settingsPath, state: 'absent', wrote: false, warning: found.refusal.reason };\n }\n const { path, settings } = found;\n const current = settings.statusLine;\n const state = classifyStatusLine(current);\n if (opts.mode === 'skip') {\n return { path, state, wrote: false, ...(state === 'foreign' ? kept(current) : {}) };\n }\n if (opts.mode === 'compose') {\n const composed = composeFor(current);\n if (composed === undefined) return writeStatusLine(found, ours(), 'ours');\n // THEIR OBJECT, with the command swapped. Rebuilding it from ours would\n // drop whatever else they had set on it, such as their own padding.\n const base =\n typeof current === 'object' && current !== null && !Array.isArray(current)\n ? (current as Record<string, unknown>)\n : ours();\n return state === 'composed'\n ? { path, state, wrote: false, command: composed }\n : writeStatusLine(found, { ...base, command: composed }, 'composed');\n }\n if (state === 'foreign') {\n // NOT REPLACED, AND NOT WRITTEN AROUND. The user keeps what they set, and\n // gets the one command that adds ours to it.\n return { path, state, wrote: false, ...kept(current) };\n }\n if (state === 'composed') return { path, state, wrote: false };\n if (state === 'absent' && opts.refreshOnly === true) {\n return { path, state, wrote: false };\n }\n return writeStatusLine(found, ours(), 'ours');\n}\n\n/** `uninstall`: take out a status line of OURS, and only if it is ours alone. */\nexport async function removeStatusLine(settingsPath: string): Promise<StatusLineResult> {\n const found = await inspectHooksFile(settingsPath);\n if ('refusal' in found) {\n return { path: settingsPath, state: 'absent', wrote: false, warning: found.refusal.reason };\n }\n const { path, settings } = found;\n const current = settings.statusLine;\n const state = classifyStatusLine(current);\n if (state === 'ours') return writeStatusLine(found, undefined, 'absent');\n // A COMPOSED LINE IS MOSTLY THE USER'S TEXT, so it is not deleted: the half\n // this build wrote is unwound and their own command is put back exactly as it\n // was. A composition that was hand-edited since inverts to nothing and is\n // left whole, because guessing at someone's shell is the worse failure.\n if (state === 'composed') {\n const command = commandOf(current);\n const original = command === undefined ? null : decomposeCommand(command);\n if (original === null) return { path, state, wrote: false };\n const kept = { ...(current as Record<string, unknown>), command: original };\n return writeStatusLine(found, kept, 'foreign');\n }\n return { path, state, wrote: false };\n}\n\n/** What `doctor` reports, without writing anything. */\nexport async function inspectStatusLine(\n settingsPath: string,\n): Promise<{ path: string; state: StatusLineState; warning?: string }> {\n const found = await inspectHooksFile(settingsPath);\n if ('refusal' in found) {\n return { path: settingsPath, state: 'absent', warning: found.refusal.reason };\n }\n return { path: found.path, state: classifyStatusLine(found.settings.statusLine) };\n}\n\nfunction kept(current: unknown): { compose?: string } {\n const compose = composeFor(current);\n return compose === undefined ? {} : { compose };\n}\n\ntype Inspection = { path: string; raw: string | null; settings: Record<string, unknown> };\n\n/**\n * One key, written through the same read-compare-write the hooks writer uses:\n * every other key is copied through in its original order, the bytes are\n * re-read before the rename so a concurrent edit is refused rather than lost,\n * and the file keeps its mode.\n */\nasync function writeStatusLine(\n found: Inspection,\n value: Record<string, unknown> | undefined,\n state: StatusLineState,\n): Promise<StatusLineResult> {\n const { path, raw, settings } = found;\n const next: Record<string, unknown> = { ...settings };\n if (value === undefined) delete next.statusLine;\n else next.statusLine = value;\n const body = `${JSON.stringify(next, null, 2)}\\n`;\n const result: StatusLineResult = {\n path,\n state,\n wrote: false,\n ...(typeof value?.command === 'string' ? { command: value.command } : {}),\n };\n if (body === raw) return result;\n const mode = await stat(path)\n .then((s) => ({ mode: s.mode & 0o777 }))\n .catch(() => ({}));\n if (raw !== null && (await readFile(path, 'utf8').catch(() => null)) !== raw) {\n return {\n ...result,\n state: classifyStatusLine(settings.statusLine),\n warning: 'changed-since-read',\n };\n }\n try {\n await writeFileAtomic(path, body, mode);\n } catch (err) {\n return {\n ...result,\n state: classifyStatusLine(settings.statusLine),\n warning: err instanceof Error ? err.message : String(err),\n };\n }\n return { ...result, wrote: true };\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,UAAU,YAAY;AAuBxB,IAAM,sBAAsB;AAE5B,IAAM,8BAA8B;AAE3C,IAAM,aAAa;AAKnB,IAAM,QAAmC,CAAC,OAAO,WAAW,MAAM;AAG3D,SAAS,eAAe,OAA+B;AAC5D,QAAM,OAAO,MAAM,KAAK,CAAC,UAAU,UAAU,KAAK;AAClD,MAAI,SAAS,QAAW;AACtB,UAAM,IAAI,SAAS,SAAS,uBAAuB,MAAM,KAAK,IAAI,CAAC,UAAU,KAAK,MAAM;AAAA,MACtF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAqBO,SAAS,mBAAmB,OAAiC;AAClE,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,QAAM,UACJ,OAAO,UAAU,WACb,QACA,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAC9C,MAAgC,UACjC;AAER,MAA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;AACpD,MAAI,UAAU,OAAW,QAAO,KAAK;AAAA,MAChC,MAAK,aAAa;AACvB,QAAM,OAAO,GAAG,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;AAAA;AAC7C,QAAM,SAA2B;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,GAAI,OAAO,OAAO,YAAY,WAAW,EAAE,SAAS,MAAM,QAAQ,IAAI,CAAC;AAAA,EACzE;AACA,MAAI,SAAS,IAAK,QAAO;AACzB,QAAM,OAAO,MAAM,KAAK,IAAI,EACzB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,IAAM,EAAE,EACtC,MAAM,OAAO,CAAC,EAAE;AACnB,MAAI,QAAQ,QAAS,MAAM,SAAS,MAAM,MAAM,EAAE,MAAM,MAAM,IAAI,MAAO,KAAK;AAC5E,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO,mBAAmB,SAAS,UAAU;AAAA,MAC7C,SAAS;AAAA,IACX;AAAA,EACF;AACA,MAAI;AACF,UAAM,gBAAgB,MAAM,MAAM,IAAI;AAAA,EACxC,SAAS,KAAK;AACZ,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO,mBAAmB,SAAS,UAAU;AAAA,MAC7C,SAAS,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,IAC1D;AAAA,EACF;AACA,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK;AAClC;","names":["kept"]}
1
+ {"version":3,"sources":["../src/router/status-line-wiring.ts"],"sourcesContent":["import { readFile, stat } from 'node:fs/promises';\nimport { writeFileAtomic } from '../lib/atomic-json';\nimport { CliError } from '../lib/errors';\nimport { inspectHooksFile } from '../lib/harness-hooks';\n\n/**\n * The `statusLine` key in Claude Code's settings file: the one setting the live\n * footer needs, and the one piece of harness configuration a person is most\n * likely to have already set for themselves.\n *\n * SO IT IS NEVER REPLACED. An existing status line that is not ours is left\n * exactly as it is, and `install` prints the composition line instead;\n * `--status-line compose` writes that line only because it was asked for by\n * name. Writing over it and saying so in the output destroys a configuration\n * this CLI did not create.\n *\n * OWNERSHIP IS ONE MARKER, the command naming `tenjin status-line`, used by\n * `install`, `install --refresh`, `uninstall` and `doctor` alike, so the four\n * can never disagree about which status line is Tenjin's.\n */\n\n/** The command `install` registers, in the shape the hook entries use: a plain\n * command line on PATH, with no path into this build's dist directory. */\nexport const STATUS_LINE_COMMAND = 'tenjin status-line';\n/** Claude Code re-runs the command on this interval, in seconds. */\nexport const STATUS_LINE_REFRESH_SECONDS = 1;\n/** The marker that makes a status line ours, composed or not. */\nconst OUR_MARKER = STATUS_LINE_COMMAND;\n\n/** What the user asked for, when they asked. Absent means the default path. */\nexport type StatusLineMode = 'own' | 'compose' | 'skip';\n\nconst MODES: readonly StatusLineMode[] = ['own', 'compose', 'skip'];\n\n/** `--status-line <mode>`, refused rather than guessed at. */\nexport function statusLineMode(value: string): StatusLineMode {\n const mode = MODES.find((known) => known === value);\n if (mode === undefined) {\n throw new CliError('USAGE', `--status-line takes ${MODES.join(', ')}, not \"${value}\".`, {\n fix: 'Run `tenjin install --status-line own`.',\n });\n }\n return mode;\n}\n\n/**\n * What is in the file: ours alone, ours appended to someone else's, someone\n * else's alone, or nothing.\n */\nexport type StatusLineState = 'ours' | 'composed' | 'foreign' | 'absent';\n\nexport interface StatusLineResult {\n path: string;\n state: StatusLineState;\n /** True when this run changed the file. */\n wrote: boolean;\n /** The command now registered, when one of ours is. */\n command?: string;\n /** The exact command to set by hand, printed when a foreign line is kept. */\n compose?: string;\n /** Why nothing was written, for a file this run would not touch. */\n warning?: string;\n}\n\nexport function classifyStatusLine(value: unknown): StatusLineState {\n if (value === null || value === undefined) return 'absent';\n const command =\n typeof value === 'string'\n ? value\n : typeof value === 'object' && !Array.isArray(value)\n ? (value as { command?: unknown }).command\n : undefined;\n // A status line whose command this build cannot read is still the user's.\n if (typeof command !== 'string' || command.trim().length === 0) return 'foreign';\n if (command.trim() === OUR_MARKER) return 'ours';\n return command.includes(OUR_MARKER) ? 'composed' : 'foreign';\n}\n\nfunction ours(): Record<string, unknown> {\n return {\n type: 'command',\n command: STATUS_LINE_COMMAND,\n refreshInterval: STATUS_LINE_REFRESH_SECONDS,\n };\n}\n\nconst shQuote = (value: string): string => `'${value.replaceAll(\"'\", String.raw`'\\''`)}'`;\nconst shUnquote = (value: string): string => value.replaceAll(String.raw`'\\''`, \"'\");\n\n/** The inner script, with the user's own command as the one hole in it. */\nfunction composedScript(existing: string): string {\n return [\n 'event=$(cat)',\n `yours=$(printf %s \"$event\" | ${existing})`,\n `tenjin=$(printf %s \"$event\" | ${STATUS_LINE_COMMAND})`,\n 'printf %s \"$yours${tenjin:+ · $tenjin}\"',\n ].join('; ');\n}\n\n/**\n * The command a composition was built from, or null when this is not a\n * composition this build wrote. It is the exact inverse of\n * {@link composeCommand}: a hand-edited line matches nothing and is kept whole,\n * because guessing at someone's shell is how an uninstall breaks a prompt.\n */\nexport function decomposeCommand(command: string): string | null {\n const trimmed = command.trim();\n if (!trimmed.startsWith(\"sh -c '\") || !trimmed.endsWith(\"'\")) return null;\n const script = shUnquote(trimmed.slice(\"sh -c '\".length, -1));\n const prefix = 'event=$(cat); yours=$(printf %s \"$event\" | ';\n if (!script.startsWith(prefix)) return null;\n const rest = script.slice(prefix.length);\n const suffix = `); tenjin=$(printf %s \"$event\" | ${STATUS_LINE_COMMAND}); printf %s \"$yours\\${tenjin:+ · $tenjin}\"`;\n if (!rest.endsWith(suffix)) return null;\n const existing = rest.slice(0, -suffix.length);\n return existing.length > 0 && composedScript(existing) === script ? existing : null;\n}\n\n/**\n * The user's status line with ours appended after a separator, on one line.\n *\n * The harness writes its event on stdin ONCE, so a composition cannot simply\n * run two commands in sequence: the event is captured first and replayed into\n * each. Ours contributes nothing when this session has no activity, and the\n * separator goes with it, so a quiet session looks exactly as it did before.\n */\nexport function composeCommand(existing: string): string {\n return `sh -c ${shQuote(composedScript(existing))}`;\n}\n\n/** The command a status-line setting runs, in either shape it can take. */\nfunction commandOf(value: unknown): string | undefined {\n const command =\n typeof value === 'string'\n ? value\n : typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as { command?: unknown }).command\n : undefined;\n return typeof command === 'string' && command.trim().length > 0 ? command.trim() : undefined;\n}\n\n/** What a foreign status line's owner is told to set, verbatim. */\nfunction composeFor(value: unknown): string | undefined {\n const command = commandOf(value);\n return command === undefined ? undefined : composeCommand(command);\n}\n\nexport interface EnsureStatusLineOpts {\n mode?: StatusLineMode;\n /**\n * `install --refresh` and the refresh `tenjin update` spawns: converge a\n * status line of ours that is already registered, and ADD NOTHING. A machine\n * whose owner removed ours, or never had it, keeps that answer across every\n * upgrade without a second place to record it.\n */\n refreshOnly?: boolean;\n}\n\nexport async function ensureStatusLine(\n settingsPath: string,\n opts: EnsureStatusLineOpts = {},\n): Promise<StatusLineResult> {\n const found = await inspectHooksFile(settingsPath);\n if ('refusal' in found) {\n return { path: settingsPath, state: 'absent', wrote: false, warning: found.refusal.reason };\n }\n const { path, settings } = found;\n const current = settings.statusLine;\n const state = classifyStatusLine(current);\n if (opts.mode === 'skip') {\n return { path, state, wrote: false, ...(state === 'foreign' ? kept(current) : {}) };\n }\n if (opts.mode === 'compose') {\n const composed = composeFor(current);\n if (composed === undefined) return writeStatusLine(found, ours(), 'ours');\n // THEIR OBJECT, with the command swapped. Rebuilding it from ours would\n // drop whatever else they had set on it, such as their own padding.\n const base =\n typeof current === 'object' && current !== null && !Array.isArray(current)\n ? (current as Record<string, unknown>)\n : ours();\n return state === 'composed'\n ? { path, state, wrote: false, command: composed }\n : writeStatusLine(found, { ...base, command: composed }, 'composed');\n }\n if (state === 'foreign') {\n // NOT REPLACED, AND NOT WRITTEN AROUND. The user keeps what they set, and\n // gets the one command that adds ours to it.\n return { path, state, wrote: false, ...kept(current) };\n }\n if (state === 'composed') return { path, state, wrote: false };\n if (state === 'absent' && opts.refreshOnly === true) {\n return { path, state, wrote: false };\n }\n return writeStatusLine(found, ours(), 'ours');\n}\n\n/** `uninstall`: take out a status line of OURS, and only if it is ours alone. */\nexport async function removeStatusLine(settingsPath: string): Promise<StatusLineResult> {\n const found = await inspectHooksFile(settingsPath);\n if ('refusal' in found) {\n return { path: settingsPath, state: 'absent', wrote: false, warning: found.refusal.reason };\n }\n const { path, settings } = found;\n const current = settings.statusLine;\n const state = classifyStatusLine(current);\n if (state === 'ours') return writeStatusLine(found, undefined, 'absent');\n // A COMPOSED LINE IS MOSTLY THE USER'S TEXT, so it is not deleted: the half\n // this build wrote is unwound and their own command is put back exactly as it\n // was. A composition that was hand-edited since inverts to nothing and is\n // left whole, because guessing at someone's shell is the worse failure.\n if (state === 'composed') {\n const command = commandOf(current);\n const original = command === undefined ? null : decomposeCommand(command);\n if (original === null) return { path, state, wrote: false };\n const kept = { ...(current as Record<string, unknown>), command: original };\n return writeStatusLine(found, kept, 'foreign');\n }\n return { path, state, wrote: false };\n}\n\n/** What `doctor` reports, without writing anything. */\nexport async function inspectStatusLine(\n settingsPath: string,\n): Promise<{ path: string; state: StatusLineState; warning?: string }> {\n const found = await inspectHooksFile(settingsPath);\n if ('refusal' in found) {\n return { path: settingsPath, state: 'absent', warning: found.refusal.reason };\n }\n return { path: found.path, state: classifyStatusLine(found.settings.statusLine) };\n}\n\nfunction kept(current: unknown): { compose?: string } {\n const compose = composeFor(current);\n return compose === undefined ? {} : { compose };\n}\n\ntype Inspection = { path: string; raw: string | null; settings: Record<string, unknown> };\n\n/**\n * One key, written through the same read-compare-write the hooks writer uses:\n * every other key is copied through in its original order, the bytes are\n * re-read before the rename so a concurrent edit is refused rather than lost,\n * and the file keeps its mode.\n */\nasync function writeStatusLine(\n found: Inspection,\n value: Record<string, unknown> | undefined,\n state: StatusLineState,\n): Promise<StatusLineResult> {\n const { path, raw, settings } = found;\n const next: Record<string, unknown> = { ...settings };\n if (value === undefined) delete next.statusLine;\n else next.statusLine = value;\n const body = `${JSON.stringify(next, null, 2)}\\n`;\n const result: StatusLineResult = {\n path,\n state,\n wrote: false,\n ...(typeof value?.command === 'string' ? { command: value.command } : {}),\n };\n if (body === raw) return result;\n const mode = await stat(path)\n .then((s) => ({ mode: s.mode & 0o777 }))\n .catch(() => ({}));\n if (raw !== null && (await readFile(path, 'utf8').catch(() => null)) !== raw) {\n return {\n ...result,\n state: classifyStatusLine(settings.statusLine),\n warning: 'changed-since-read',\n };\n }\n try {\n await writeFileAtomic(path, body, mode);\n } catch (err) {\n return {\n ...result,\n state: classifyStatusLine(settings.statusLine),\n warning: err instanceof Error ? err.message : String(err),\n };\n }\n return { ...result, wrote: true };\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,UAAU,YAAY;AAuBxB,IAAM,sBAAsB;AAE5B,IAAM,8BAA8B;AAE3C,IAAM,aAAa;AAKnB,IAAM,QAAmC,CAAC,OAAO,WAAW,MAAM;AAG3D,SAAS,eAAe,OAA+B;AAC5D,QAAM,OAAO,MAAM,KAAK,CAAC,UAAU,UAAU,KAAK;AAClD,MAAI,SAAS,QAAW;AACtB,UAAM,IAAI,SAAS,SAAS,uBAAuB,MAAM,KAAK,IAAI,CAAC,UAAU,KAAK,MAAM;AAAA,MACtF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAqBO,SAAS,mBAAmB,OAAiC;AAClE,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,QAAM,UACJ,OAAO,UAAU,WACb,QACA,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAC9C,MAAgC,UACjC;AAER,MAAI,OAAO,YAAY,YAAY,QAAQ,KAAK,EAAE,WAAW,EAAG,QAAO;AACvE,MAAI,QAAQ,KAAK,MAAM,WAAY,QAAO;AAC1C,SAAO,QAAQ,SAAS,UAAU,IAAI,aAAa;AACrD;AAEA,SAAS,OAAgC;AACvC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,iBAAiB;AAAA,EACnB;AACF;AAEA,IAAM,UAAU,CAAC,UAA0B,IAAI,MAAM,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IAAK,QAAO;AACzB,QAAM,OAAO,MAAM,KAAK,IAAI,EACzB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,IAAM,EAAE,EACtC,MAAM,OAAO,CAAC,EAAE;AACnB,MAAI,QAAQ,QAAS,MAAM,SAAS,MAAM,MAAM,EAAE,MAAM,MAAM,IAAI,MAAO,KAAK;AAC5E,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO,mBAAmB,SAAS,UAAU;AAAA,MAC7C,SAAS;AAAA,IACX;AAAA,EACF;AACA,MAAI;AACF,UAAM,gBAAgB,MAAM,MAAM,IAAI;AAAA,EACxC,SAAS,KAAK;AACZ,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO,mBAAmB,SAAS,UAAU;AAAA,MAC7C,SAAS,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,IAC1D;AAAA,EACF;AACA,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK;AAClC;","names":["kept"]}
@@ -0,0 +1,102 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ hasCode
4
+ } from "./chunk-2I4QTOLB.js";
5
+ import {
6
+ external_exports
7
+ } from "./chunk-AR7U7BRG.js";
8
+ import {
9
+ spendLedgerPath
10
+ } from "./chunk-2BKS2FVE.js";
11
+
12
+ // src/lib/spend-ledger.ts
13
+ import { readFile } from "node:fs/promises";
14
+ var DEFAULT_WINDOW_MS = 864e5;
15
+ var RESERVATION_TTL_MS = 6e5;
16
+ var ReservationSchema = external_exports.object({
17
+ id: external_exports.string(),
18
+ amountAtomic: external_exports.string().regex(/^\d+$/),
19
+ atMs: external_exports.number(),
20
+ /** Optional so a ledger written by an older build still parses. */
21
+ requestKey: external_exports.string().optional()
22
+ });
23
+ var LedgerSchema = external_exports.object({
24
+ schemaVersion: external_exports.literal(2),
25
+ windowStartMs: external_exports.number(),
26
+ /**
27
+ * EXPOSURE: every authorization this window transmitted. A signed EIP-3009
28
+ * authorization is a bearer instrument, so this is what the budget counts,
29
+ * whatever any counterparty later says it took.
30
+ */
31
+ committedAtomic: external_exports.string().regex(/^\d+$/),
32
+ /**
33
+ * SETTLED: what counterparties reported actually taking, which the router's
34
+ * waived outcomes made a different number from the line above (2026-09-23
35
+ * lookup contract). Optional so a ledger an older build wrote still parses;
36
+ * absent means "everything committed was settled", which is what that build
37
+ * assumed. Reporting only, never a budget input: under-counting exposure
38
+ * because a server said "no charge" is exactly the hole this avoids.
39
+ */
40
+ settledAtomic: external_exports.string().regex(/^\d+$/).optional(),
41
+ reservations: external_exports.array(ReservationSchema)
42
+ });
43
+ function emptyLedger(nowMs) {
44
+ return {
45
+ schemaVersion: 2,
46
+ windowStartMs: nowMs,
47
+ committedAtomic: "0",
48
+ settledAtomic: "0",
49
+ reservations: []
50
+ };
51
+ }
52
+ function spentOf(ledger) {
53
+ return ledger.reservations.reduce(
54
+ (sum, r) => sum + BigInt(r.amountAtomic),
55
+ BigInt(ledger.committedAtomic)
56
+ );
57
+ }
58
+ async function readLedger(path) {
59
+ let raw;
60
+ try {
61
+ raw = await readFile(path, "utf8");
62
+ } catch (err) {
63
+ if (hasCode(err, "ENOENT")) return { ledger: null };
64
+ return { ledger: null, corrupt: err instanceof Error ? err.message : String(err) };
65
+ }
66
+ let json;
67
+ try {
68
+ json = JSON.parse(raw);
69
+ } catch {
70
+ return { ledger: null, corrupt: "not valid JSON" };
71
+ }
72
+ const parsed = LedgerSchema.safeParse(json);
73
+ if (parsed.success) return { ledger: parsed.data };
74
+ const issue = parsed.error.issues[0];
75
+ const field = issue?.path.join(".");
76
+ const message = issue?.message ?? "schema mismatch";
77
+ return {
78
+ ledger: null,
79
+ corrupt: field !== void 0 && field.length > 0 ? `${field}: ${message}` : message
80
+ };
81
+ }
82
+ async function readSpendSummary(dir, opts = {}) {
83
+ const { ledger } = await readLedger(spendLedgerPath(dir));
84
+ if (ledger === null) return null;
85
+ const nowMs = (opts.now ?? Date.now)();
86
+ const windowMs = opts.windowMs ?? DEFAULT_WINDOW_MS;
87
+ if (nowMs - ledger.windowStartMs >= windowMs) return emptyLedger(nowMs);
88
+ return {
89
+ ...ledger,
90
+ reservations: ledger.reservations.filter((r) => nowMs - r.atMs < RESERVATION_TTL_MS)
91
+ };
92
+ }
93
+
94
+ export {
95
+ DEFAULT_WINDOW_MS,
96
+ RESERVATION_TTL_MS,
97
+ emptyLedger,
98
+ spentOf,
99
+ readLedger,
100
+ readSpendSummary
101
+ };
102
+ //# sourceMappingURL=chunk-35M3VITA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/spend-ledger.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { z } from 'zod';\nimport { hasCode } from './errno';\nimport { spendLedgerPath } from './paths';\n\n/**\n * The spend ledger's READ side: its shape, the two expiries, and a read-only\n * summary. It lives outside `lib/wallet` so the router hooks can measure an\n * offer against the same session total an authorization would, without the\n * wallet entering their chunk graph (`src/router/dist-chunks.test.ts`). The\n * write side, with its lock and reservations, stays in `lib/wallet/spend.ts`.\n */\n\nexport const DEFAULT_WINDOW_MS = 86_400_000; // 24h rolling day\nexport const RESERVATION_TTL_MS = 600_000; // 10 min: a dangling reservation self-expires\n\nconst ReservationSchema = z.object({\n id: z.string(),\n amountAtomic: z.string().regex(/^\\d+$/),\n atMs: z.number(),\n /** Optional so a ledger written by an older build still parses. */\n requestKey: z.string().optional(),\n});\nexport type Reservation = z.infer<typeof ReservationSchema>;\n\nconst LedgerSchema = z.object({\n schemaVersion: z.literal(2),\n windowStartMs: z.number(),\n /**\n * EXPOSURE: every authorization this window transmitted. A signed EIP-3009\n * authorization is a bearer instrument, so this is what the budget counts,\n * whatever any counterparty later says it took.\n */\n committedAtomic: z.string().regex(/^\\d+$/),\n /**\n * SETTLED: what counterparties reported actually taking, which the router's\n * waived outcomes made a different number from the line above (2026-09-23\n * lookup contract). Optional so a ledger an older build wrote still parses;\n * absent means \"everything committed was settled\", which is what that build\n * assumed. Reporting only, never a budget input: under-counting exposure\n * because a server said \"no charge\" is exactly the hole this avoids.\n */\n settledAtomic: z.string().regex(/^\\d+$/).optional(),\n reservations: z.array(ReservationSchema),\n});\nexport type Ledger = z.infer<typeof LedgerSchema>;\n\nexport function emptyLedger(nowMs: number): Ledger {\n return {\n schemaVersion: 2,\n windowStartMs: nowMs,\n committedAtomic: '0',\n settledAtomic: '0',\n reservations: [],\n };\n}\n\n/** Everything this window has spent or is holding: the budget's input. */\nexport function spentOf(ledger: {\n committedAtomic: string;\n reservations: { amountAtomic: string }[];\n}): bigint {\n return ledger.reservations.reduce(\n (sum, r) => sum + BigInt(r.amountAtomic),\n BigInt(ledger.committedAtomic),\n );\n}\n\n/**\n * ABSENT and CORRUPT both reset the window, but they are not the same fact: the\n * first is a first run, the second is spend that existed and is now gone. Only\n * the second is worth telling anyone about, so the two stay distinguishable here\n * rather than collapsing into one null.\n */\ninterface LedgerRead {\n ledger: Ledger | null;\n /** Set only when the file EXISTS and could not be turned back into a ledger. */\n corrupt?: string;\n}\n\nexport async function readLedger(path: string): Promise<LedgerRead> {\n let raw: string;\n try {\n raw = await readFile(path, 'utf8');\n } catch (err) {\n // A missing file is the ordinary first run. Any other read failure means a\n // file is there and unusable, which is the corrupt case by another name.\n if (hasCode(err, 'ENOENT')) return { ledger: null };\n return { ledger: null, corrupt: err instanceof Error ? err.message : String(err) };\n }\n let json: unknown;\n try {\n json = JSON.parse(raw);\n } catch {\n return { ledger: null, corrupt: 'not valid JSON' };\n }\n const parsed = LedgerSchema.safeParse(json);\n if (parsed.success) return { ledger: parsed.data };\n const issue = parsed.error.issues[0];\n const field = issue?.path.join('.');\n const message = issue?.message ?? 'schema mismatch';\n // Field-qualified: \"expected number, received undefined\" names nothing on its\n // own. zod never echoes the received VALUE, so no spend figure rides along.\n return {\n ledger: null,\n corrupt: field !== undefined && field.length > 0 ? `${field}: ${message}` : message,\n };\n}\n\nexport interface SpendSummary {\n windowStartMs: number;\n committedAtomic: string;\n reservations: { amountAtomic: string; atMs: number; requestKey?: string }[];\n}\n\n/**\n * The ledger AS AN AUTHORIZATION WOULD SEE IT, for `tenjin status`. Read-only,\n * and it applies the same two expiries the authorizer applies before it\n * evaluates a spend: a rolling window that has run out reads as a fresh one,\n * and reservations past their TTL are gone. Summing the raw file instead\n * reported spend as current, and crashed reservations as open, until the next\n * payment happened to rewrite it.\n *\n * `null` for absent or unreadable, which is the same thing to a report.\n */\nexport async function readSpendSummary(\n dir: string,\n opts: { now?: () => number; windowMs?: number } = {},\n): Promise<SpendSummary | null> {\n const { ledger } = await readLedger(spendLedgerPath(dir));\n if (ledger === null) return null;\n const nowMs = (opts.now ?? Date.now)();\n const windowMs = opts.windowMs ?? DEFAULT_WINDOW_MS;\n if (nowMs - ledger.windowStartMs >= windowMs) return emptyLedger(nowMs);\n return {\n ...ledger,\n reservations: ledger.reservations.filter((r) => nowMs - r.atMs < RESERVATION_TTL_MS),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAalB,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB;AAElC,IAAM,oBAAoB,iBAAE,OAAO;AAAA,EACjC,IAAI,iBAAE,OAAO;AAAA,EACb,cAAc,iBAAE,OAAO,EAAE,MAAM,OAAO;AAAA,EACtC,MAAM,iBAAE,OAAO;AAAA;AAAA,EAEf,YAAY,iBAAE,OAAO,EAAE,SAAS;AAClC,CAAC;AAGD,IAAM,eAAe,iBAAE,OAAO;AAAA,EAC5B,eAAe,iBAAE,QAAQ,CAAC;AAAA,EAC1B,eAAe,iBAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxB,iBAAiB,iBAAE,OAAO,EAAE,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASzC,eAAe,iBAAE,OAAO,EAAE,MAAM,OAAO,EAAE,SAAS;AAAA,EAClD,cAAc,iBAAE,MAAM,iBAAiB;AACzC,CA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KAAK,YAAY;AAClC,MAAI,QAAQ,OAAO,iBAAiB,SAAU,QAAO,YAAY,KAAK;AACtE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,cAAc,OAAO,aAAa,OAAO,CAAC,MAAM,QAAQ,EAAE,OAAO,kBAAkB;AAAA,EACrF;AACF;","names":[]}
@@ -1,13 +1,13 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  PRODUCTION_ORIGIN
4
- } from "./chunk-BBVUVBUO.js";
4
+ } from "./chunk-AR7U7BRG.js";
5
5
  import {
6
6
  package_default
7
- } from "./chunk-BFFM2WFK.js";
7
+ } from "./chunk-5UDD5VSY.js";
8
8
  import {
9
9
  CliError
10
- } from "./chunk-OCBHUHWB.js";
10
+ } from "./chunk-JLEF5WHM.js";
11
11
 
12
12
  // src/lib/client-meta.ts
13
13
  var TENJIN_PRODUCT = `tenjin-cli/${package_default.version}`;
@@ -224,4 +224,4 @@ export {
224
224
  httpRequest,
225
225
  fetchFailureToCliError
226
226
  };
227
- //# sourceMappingURL=chunk-5X4SZ5BF.js.map
227
+ //# sourceMappingURL=chunk-5QHHRMRA.js.map
@@ -3,7 +3,7 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "tenjin-cli",
6
- version: "0.1.0-alpha.16",
6
+ version: "0.1.0-alpha.17",
7
7
  mcpName: "blog.tenjin/tenjin",
8
8
  type: "module",
9
9
  description: "x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base.",
@@ -80,4 +80,4 @@ var package_default = {
80
80
  export {
81
81
  package_default
82
82
  };
83
- //# sourceMappingURL=chunk-BFFM2WFK.js.map
83
+ //# sourceMappingURL=chunk-5UDD5VSY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"tenjin-cli\",\n \"version\": \"0.1.0-alpha.16\",\n \"mcpName\": \"blog.tenjin/tenjin\",\n \"type\": \"module\",\n \"description\": \"x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base.\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/BackTrackCo/tenjin-agent.git\"\n },\n \"homepage\": \"https://tenjin.blog/agents\",\n \"bugs\": \"https://github.com/BackTrackCo/tenjin-agent/issues\",\n \"keywords\": [\n \"x402\",\n \"usdc\",\n \"base\",\n \"ai-agents\",\n \"agent-payments\",\n \"mcp\",\n \"knowledge-marketplace\",\n \"micropayments\",\n \"claude\",\n \"codex\",\n \"cli\"\n ],\n \"bin\": {\n \"tenjin\": \"dist/index.js\"\n },\n \"engines\": {\n \"node\": \">=24\"\n },\n \"files\": [\n \"dist\",\n \"docs\",\n \"NOTICE.md\"\n ],\n \"packageManager\": \"pnpm@11.11.0\",\n \"scripts\": {\n \"build\": \"rm -rf dist && tsup\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint .\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"check\": \"pnpm run build && pnpm run test\",\n \"sync:skill\": \"node scripts/sync-skill.mjs\",\n \"pack-smoke\": \"bash scripts/pack-smoke.sh\",\n \"changeset\": \"changeset\",\n \"prepublishOnly\": \"pnpm run build\",\n \"githooks\": \"git config core.hooksPath .githooks\"\n },\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.31.1\",\n \"@clack/prompts\": \"^1.7.0\",\n \"@eslint/js\": \"^10\",\n \"@modelcontextprotocol/sdk\": \"1.29.0\",\n \"@types/node\": \"^25\",\n \"@x402/core\": \"2.17.0\",\n \"@x402/evm\": \"2.17.0\",\n \"@x402/extensions\": \"2.17.0\",\n \"ajv\": \"^8.20.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^14.0.1\",\n \"eslint\": \"^10\",\n \"eslint-config-prettier\": \"^10\",\n \"ox\": \"0.14.30\",\n \"prettier\": \"^3\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^6\",\n \"typescript-eslint\": \"^8\",\n \"viem\": \"^2.53.1\",\n \"vitest\": \"^4.1.9\",\n \"zod\": \"^4.4.3\"\n }\n}\n"],"mappings":";;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,EACR,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,QAAU;AAAA,EACZ;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,EAClB,SAAW;AAAA,IACT,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,OAAS;AAAA,IACT,cAAc;AAAA,IACd,cAAc;AAAA,IACd,WAAa;AAAA,IACb,gBAAkB;AAAA,IAClB,UAAY;AAAA,EACd;AAAA,EACA,iBAAmB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,6BAA6B;AAAA,IAC7B,eAAe;AAAA,IACf,cAAc;AAAA,IACd,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,KAAO;AAAA,IACP,eAAe;AAAA,IACf,WAAa;AAAA,IACb,QAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,IAAM;AAAA,IACN,UAAY;AAAA,IACZ,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,qBAAqB;AAAA,IACrB,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,KAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"tenjin-cli\",\n \"version\": \"0.1.0-alpha.17\",\n \"mcpName\": \"blog.tenjin/tenjin\",\n \"type\": \"module\",\n \"description\": \"x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base.\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/BackTrackCo/tenjin-agent.git\"\n },\n \"homepage\": \"https://tenjin.blog/agents\",\n \"bugs\": \"https://github.com/BackTrackCo/tenjin-agent/issues\",\n \"keywords\": [\n \"x402\",\n \"usdc\",\n \"base\",\n \"ai-agents\",\n \"agent-payments\",\n \"mcp\",\n \"knowledge-marketplace\",\n \"micropayments\",\n \"claude\",\n \"codex\",\n \"cli\"\n ],\n \"bin\": {\n \"tenjin\": \"dist/index.js\"\n },\n \"engines\": {\n \"node\": \">=24\"\n },\n \"files\": [\n \"dist\",\n \"docs\",\n \"NOTICE.md\"\n ],\n \"packageManager\": \"pnpm@11.11.0\",\n \"scripts\": {\n \"build\": \"rm -rf dist && tsup\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint .\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"check\": \"pnpm run build && pnpm run test\",\n \"sync:skill\": \"node scripts/sync-skill.mjs\",\n \"pack-smoke\": \"bash scripts/pack-smoke.sh\",\n \"changeset\": \"changeset\",\n \"prepublishOnly\": \"pnpm run build\",\n \"githooks\": \"git config core.hooksPath .githooks\"\n },\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.31.1\",\n \"@clack/prompts\": \"^1.7.0\",\n \"@eslint/js\": \"^10\",\n \"@modelcontextprotocol/sdk\": \"1.29.0\",\n \"@types/node\": \"^25\",\n \"@x402/core\": \"2.17.0\",\n \"@x402/evm\": \"2.17.0\",\n \"@x402/extensions\": \"2.17.0\",\n \"ajv\": \"^8.20.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^14.0.1\",\n \"eslint\": \"^10\",\n \"eslint-config-prettier\": \"^10\",\n \"ox\": \"0.14.30\",\n \"prettier\": \"^3\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^6\",\n \"typescript-eslint\": \"^8\",\n \"viem\": \"^2.53.1\",\n \"vitest\": \"^4.1.9\",\n \"zod\": \"^4.4.3\"\n }\n}\n"],"mappings":";;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,EACR,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,QAAU;AAAA,EACZ;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,EAClB,SAAW;AAAA,IACT,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,OAAS;AAAA,IACT,cAAc;AAAA,IACd,cAAc;AAAA,IACd,WAAa;AAAA,IACb,gBAAkB;AAAA,IAClB,UAAY;AAAA,EACd;AAAA,EACA,iBAAmB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,6BAA6B;AAAA,IAC7B,eAAe;AA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