tenjin-cli 0.1.0-alpha.24 → 0.1.0-alpha.26

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 (133) hide show
  1. package/README.md +19 -42
  2. package/dist/{chunk-GPLSNGKX.js → chunk-4HAV6IFE.js} +6 -6
  3. package/dist/{chunk-UXSF7IFD.js → chunk-5HS54CLI.js} +3 -3
  4. package/dist/{chunk-RCJ64OXH.js → chunk-5INS5ZZF.js} +36 -7
  5. package/dist/chunk-5INS5ZZF.js.map +1 -0
  6. package/dist/{chunk-XZUGRTSV.js → chunk-5NUF4BHR.js} +5 -3
  7. package/dist/{chunk-XZUGRTSV.js.map → chunk-5NUF4BHR.js.map} +1 -1
  8. package/dist/{chunk-YZTIYDWU.js → chunk-65EJJVT3.js} +2 -2
  9. package/dist/{chunk-ZMFDMALH.js → chunk-6JIYGYRB.js} +3 -53
  10. package/dist/chunk-6JIYGYRB.js.map +1 -0
  11. package/dist/chunk-7EKYXMUO.js +7536 -0
  12. package/dist/chunk-7EKYXMUO.js.map +1 -0
  13. package/dist/chunk-AKWGE6JQ.js +49 -0
  14. package/dist/chunk-AKWGE6JQ.js.map +1 -0
  15. package/dist/{chunk-KC24CYGV.js → chunk-ALJRB7NG.js} +14 -9
  16. package/dist/chunk-ALJRB7NG.js.map +1 -0
  17. package/dist/{chunk-S2NRVRPF.js → chunk-BOAI23CX.js} +53 -2
  18. package/dist/chunk-BOAI23CX.js.map +1 -0
  19. package/dist/{chunk-SQSKVKX6.js → chunk-DI7WHXOZ.js} +20 -16
  20. package/dist/chunk-DI7WHXOZ.js.map +1 -0
  21. package/dist/{chunk-UBOFYC6J.js → chunk-EJXIK6WY.js} +1817 -137
  22. package/dist/chunk-EJXIK6WY.js.map +1 -0
  23. package/dist/{chunk-RGVOODF4.js → chunk-EL56RW2J.js} +164 -7463
  24. package/dist/chunk-EL56RW2J.js.map +1 -0
  25. package/dist/{chunk-ZNZGBUV6.js → chunk-GHR4BTNJ.js} +9 -7
  26. package/dist/chunk-GHR4BTNJ.js.map +1 -0
  27. package/dist/chunk-H4BOQLWW.js +99 -0
  28. package/dist/chunk-H4BOQLWW.js.map +1 -0
  29. package/dist/{chunk-TMLCEPCD.js → chunk-HII5HOQV.js} +3 -5
  30. package/dist/chunk-HII5HOQV.js.map +1 -0
  31. package/dist/chunk-LFZJM56J.js +159 -0
  32. package/dist/chunk-LFZJM56J.js.map +1 -0
  33. package/dist/chunk-OBPZ36HG.js +145 -0
  34. package/dist/chunk-OBPZ36HG.js.map +1 -0
  35. package/dist/{chunk-NSDZESRS.js → chunk-OZ3LWLCI.js} +3 -3
  36. package/dist/chunk-PM2MOXJ3.js +66 -0
  37. package/dist/chunk-PM2MOXJ3.js.map +1 -0
  38. package/dist/chunk-PZ5N6BAL.js +268 -0
  39. package/dist/chunk-PZ5N6BAL.js.map +1 -0
  40. package/dist/{chunk-O2WN732M.js → chunk-UDWGT4FX.js} +2 -2
  41. package/dist/{chunk-W2ARIOAZ.js → chunk-VNT3CQFV.js} +23 -25
  42. package/dist/chunk-VNT3CQFV.js.map +1 -0
  43. package/dist/{chunk-XRW4N23F.js → chunk-W36HL4TB.js} +6 -6
  44. package/dist/{chunk-IIE65SJC.js → chunk-WT7DHJNJ.js} +4 -4
  45. package/dist/{chunk-P22ZWXFX.js → chunk-XICKN3CH.js} +49 -4
  46. package/dist/chunk-XICKN3CH.js.map +1 -0
  47. package/dist/chunk-XMIVHQ35.js +55 -0
  48. package/dist/chunk-XMIVHQ35.js.map +1 -0
  49. package/dist/chunk-YHKXNYTB.js +105 -0
  50. package/dist/chunk-YHKXNYTB.js.map +1 -0
  51. package/dist/{chunk-H5UR3GFJ.js → chunk-YHWBDCGS.js} +272 -54
  52. package/dist/chunk-YHWBDCGS.js.map +1 -0
  53. package/dist/{hook-command-GMIDXVFK.js → chunk-YLCWI6ZR.js} +231 -40
  54. package/dist/chunk-YLCWI6ZR.js.map +1 -0
  55. package/dist/{chunk-FFL5M5BC.js → chunk-YTM7OURD.js} +2 -2
  56. package/dist/{chunk-EP5P2STS.js → chunk-Z7R2QDX2.js} +67 -10
  57. package/dist/chunk-Z7R2QDX2.js.map +1 -0
  58. package/dist/chunk-ZLD6MJVJ.js +30 -0
  59. package/dist/chunk-ZLD6MJVJ.js.map +1 -0
  60. package/dist/{cli-GGNOQQEB.js → cli-2U5JB7OQ.js} +38 -36
  61. package/dist/{cli-GGNOQQEB.js.map → cli-2U5JB7OQ.js.map} +1 -1
  62. package/dist/{config-XUUFICXK.js → config-44EGO636.js} +14 -9
  63. package/dist/{doctor-3LGF6CWI.js → doctor-BD42BBEG.js} +231 -97
  64. package/dist/doctor-BD42BBEG.js.map +1 -0
  65. package/dist/env-proxy-KEGEMWKX.js +15 -0
  66. package/dist/{fund-3URFMBMN.js → fund-WQOOUESE.js} +26 -17
  67. package/dist/fund-WQOOUESE.js.map +1 -0
  68. package/dist/hook-command-23LC5NRN.js +32 -0
  69. package/dist/index.js +5 -3
  70. package/dist/index.js.map +1 -1
  71. package/dist/{install-FRTG4KHF.js → install-REPLHNU7.js} +25 -16
  72. package/dist/{install-identity-WNXSYP6N.js → install-identity-4RDWTLJ2.js} +6 -7
  73. package/dist/{install-wallet-MXLJJP3N.js → install-wallet-USHWL7AX.js} +10 -9
  74. package/dist/{install-wallet-MXLJJP3N.js.map → install-wallet-USHWL7AX.js.map} +1 -1
  75. package/dist/{mcp-O2WJ3QBW.js → mcp-T5SYCLP7.js} +778 -83
  76. package/dist/mcp-T5SYCLP7.js.map +1 -0
  77. package/dist/{pay-43WUYTW5.js → pay-276DSSYG.js} +16 -14
  78. package/dist/{payments-7UTMMTIO.js → payments-TZYLJXK3.js} +7 -7
  79. package/dist/{send-ALHG2RXT.js → send-YHDKZPED.js} +10 -11
  80. package/dist/{send-ALHG2RXT.js.map → send-YHDKZPED.js.map} +1 -1
  81. package/dist/{status-CFPNHB6R.js → status-X2INT6VD.js} +8 -9
  82. package/dist/{status-CFPNHB6R.js.map → status-X2INT6VD.js.map} +1 -1
  83. package/dist/{status-line-FJ6N7MKJ.js → status-line-QKDJYZGV.js} +4 -5
  84. package/dist/{status-line-FJ6N7MKJ.js.map → status-line-QKDJYZGV.js.map} +1 -1
  85. package/dist/{status-line-wiring-GXFNXHPE.js → status-line-wiring-LW4HFRHB.js} +6 -4
  86. package/dist/status-line-wiring-LW4HFRHB.js.map +1 -0
  87. package/dist/{uninstall-5P2GFYBY.js → uninstall-NVTGU7JD.js} +43 -33
  88. package/dist/uninstall-NVTGU7JD.js.map +1 -0
  89. package/dist/{update-QJ5YHJ7I.js → update-QXVH2DE7.js} +25 -7
  90. package/dist/update-QXVH2DE7.js.map +1 -0
  91. package/dist/{wallet-6OJPGNEV.js → wallet-CKKB23D5.js} +10 -9
  92. package/dist/wallet-CKKB23D5.js.map +1 -0
  93. package/docs/agent-permissions.md +18 -5
  94. package/docs/troubleshooting.md +13 -0
  95. package/package.json +8 -6
  96. package/dist/chunk-EP5P2STS.js.map +0 -1
  97. package/dist/chunk-H5UR3GFJ.js.map +0 -1
  98. package/dist/chunk-KC24CYGV.js.map +0 -1
  99. package/dist/chunk-O2JYBOUO.js +0 -47
  100. package/dist/chunk-O2JYBOUO.js.map +0 -1
  101. package/dist/chunk-P22ZWXFX.js.map +0 -1
  102. package/dist/chunk-RCJ64OXH.js.map +0 -1
  103. package/dist/chunk-RGVOODF4.js.map +0 -1
  104. package/dist/chunk-S2NRVRPF.js.map +0 -1
  105. package/dist/chunk-SQSKVKX6.js.map +0 -1
  106. package/dist/chunk-TMLCEPCD.js.map +0 -1
  107. package/dist/chunk-UBOFYC6J.js.map +0 -1
  108. package/dist/chunk-W2ARIOAZ.js.map +0 -1
  109. package/dist/chunk-YXLG7Q6Q.js +0 -140
  110. package/dist/chunk-YXLG7Q6Q.js.map +0 -1
  111. package/dist/chunk-ZMFDMALH.js.map +0 -1
  112. package/dist/chunk-ZNZGBUV6.js.map +0 -1
  113. package/dist/doctor-3LGF6CWI.js.map +0 -1
  114. package/dist/fund-3URFMBMN.js.map +0 -1
  115. package/dist/hook-command-GMIDXVFK.js.map +0 -1
  116. package/dist/mcp-O2WJ3QBW.js.map +0 -1
  117. package/dist/uninstall-5P2GFYBY.js.map +0 -1
  118. package/dist/update-QJ5YHJ7I.js.map +0 -1
  119. /package/dist/{chunk-GPLSNGKX.js.map → chunk-4HAV6IFE.js.map} +0 -0
  120. /package/dist/{chunk-UXSF7IFD.js.map → chunk-5HS54CLI.js.map} +0 -0
  121. /package/dist/{chunk-YZTIYDWU.js.map → chunk-65EJJVT3.js.map} +0 -0
  122. /package/dist/{chunk-NSDZESRS.js.map → chunk-OZ3LWLCI.js.map} +0 -0
  123. /package/dist/{chunk-O2WN732M.js.map → chunk-UDWGT4FX.js.map} +0 -0
  124. /package/dist/{chunk-XRW4N23F.js.map → chunk-W36HL4TB.js.map} +0 -0
  125. /package/dist/{chunk-IIE65SJC.js.map → chunk-WT7DHJNJ.js.map} +0 -0
  126. /package/dist/{chunk-FFL5M5BC.js.map → chunk-YTM7OURD.js.map} +0 -0
  127. /package/dist/{config-XUUFICXK.js.map → config-44EGO636.js.map} +0 -0
  128. /package/dist/{install-FRTG4KHF.js.map → env-proxy-KEGEMWKX.js.map} +0 -0
  129. /package/dist/{install-identity-WNXSYP6N.js.map → hook-command-23LC5NRN.js.map} +0 -0
  130. /package/dist/{pay-43WUYTW5.js.map → install-REPLHNU7.js.map} +0 -0
  131. /package/dist/{status-line-wiring-GXFNXHPE.js.map → install-identity-4RDWTLJ2.js.map} +0 -0
  132. /package/dist/{wallet-6OJPGNEV.js.map → pay-276DSSYG.js.map} +0 -0
  133. /package/dist/{payments-7UTMMTIO.js.map → payments-TZYLJXK3.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/decision.ts"],"sourcesContent":["import { z } from 'zod';\nimport { fetchFailureToCliError, httpRequest } from '../lib/http';\nimport type { FetchJsonFailure, HttpRequestOptions, HttpResult } from '../lib/http';\nimport type { CommandContext } from '../context';\nimport type { Packet } from './context';\n\n/**\n * `POST /api/x402-router`: ONE DECISION PER LOOKUP. On the free path it costs\n * nothing. Inside `tenjin mcp`, while the server answers its paid path, the\n * same body goes to that path through the stock x402 client\n * ({@link DecisionRoute}, `routing-payer.ts`); a call that path cannot take\n * falls back to the free path. The rest of this note describes the free path,\n * which is unchanged.\n *\n * The routing decision costs nothing and nobody signs for it. The hook asks for\n * it from the user's own words, the backend answers with what it would do and\n * what the provider charges, and the only payment on the wire is the one\n * `runPay` makes to that provider. That deletes the router fee and everything\n * built to carry it: the 402 probe, the requirements cache, the stale-quote\n * retry, the settlement accounting and one Base settlement of about 1.5 s from\n * every paid lookup.\n *\n * The bounded packet travels with the hook request and the backend keeps it\n * against the decision id until that id expires. What this client keeps is\n * each offer's spec, by its id (`specs.ts`).\n */\n\nexport const ROUTER_PATH = '/api/x402-router';\n\n/**\n * The request the server builds and this client sends verbatim. Query assembly,\n * body encoding and header choice are the server's; what stays here is every\n * check that decides whether to send it at all.\n */\nconst RequestSchema = z.object({\n url: z.string().min(1).max(16_384),\n method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']),\n headers: z.record(z.string(), z.string()),\n body: z\n .string()\n .max(256 * 1024)\n .optional(),\n});\n\nconst ContractSchema = z.object({\n /** Flat, for display and for the result check; never re-encoded into a call:\n * the server built `request` from them and this client sends that verbatim. */\n arguments: z.record(z.string(), z.unknown()).optional(),\n resultSchema: z.record(z.string(), z.unknown()).optional(),\n request: RequestSchema,\n});\nexport type DecisionContract = z.infer<typeof ContractSchema>;\n\n/**\n * What stopped an outcome this client cannot execute, in terms the host can act\n * on: a stable reason code, the stage that stopped, the fields or scope choices\n * the user can supply, and one concrete next action.\n */\nconst DiagnosticsSchema = z.object({\n reasonCode: z.string().min(1).max(64),\n stage: z.string().min(1).max(32),\n missing: z.array(z.string().max(200)).max(60),\n nextAction: z.string().max(500),\n});\nexport type DecisionDiagnostics = z.infer<typeof DiagnosticsSchema>;\n\n/**\n * ONE VARIANT PER ANSWER, DISCRIMINATED ON THE ACTION. Optional fields made\n * every shape legal: an `execute` with no contract parsed and came back to the\n * host as a routine `needs_input`, a non-execute with no diagnostics parsed\n * with nothing to act on, and a hook answer carrying a contract parsed as\n * though the hook had quoted a price. Each of those is drift the shared\n * fixtures exist to catch, so each is now a parse failure that names itself.\n *\n * The two calls ask different questions and get different answers, so they get\n * different parsers. The HOOK asks whether a paid lookup is worth offering: an\n * id, or a reason it is not. The TOOL asks for the decision: the capability,\n * its price and the contract together, so a caller cannot approve one offer and\n * receive another.\n */\nconst IdSchema = z\n .string()\n .regex(/^[A-Za-z0-9_-]{8,64}$/)\n .describe(\n 'The turn id, an OPAQUE HANDLE: it is the one piece of server text this ' +\n 'client puts in a model-facing line, so the alphabet is pinned here ' +\n 'rather than escaped later.',\n );\n\n/** Every non-execute answer carries these, beside the action they explain. */\nconst RefusedSchema = z.strictObject({\n reason: z.string().max(2_000).optional(),\n diagnostics: DiagnosticsSchema,\n});\n\n/**\n * WHAT THE SERVICE IS, AND WHAT IT DOES. The hook answer used to be an id and\n * nothing else, so the line the host injected could only say \"a paid lookup is\n * available\", which a model follows 8 to 20 times in 40 where a line naming the\n * task and the service is followed 40 in 40. The gate knows which capability\n * serves the category it chose, so it now says so; the CONTRACT is still not\n * here, because the task the host will run does not exist yet.\n */\nconst CapabilityFields = {\n capabilityId: z.string().min(1).max(200),\n category: z.string().min(1).max(64),\n /** The service's own name, not the x402 reseller in front of it. */\n provider: z.string().min(1).max(120),\n capabilityDescription: z.string().min(1).max(500),\n /** What the provider charges, atomic USDC. The `request` tool refuses a live\n * 402 above it; `gateSpend` still caps the amount actually signed. */\n providerPriceAtomic: z.string().regex(/^\\d+$/),\n};\n\n/**\n * STRUCTURE, NEVER WORDING. A hint lands in the model's context verbatim, so\n * its shape is checked the way the id's alphabet is: one line, no control\n * characters, and it has to be the call it claims to be, naming the id this\n * same answer carries. A hint that fails any of these is a protocol error and\n * the turn falls back to the generic line; nothing here rewrites a word of a\n * hint that passes. Both offering arms, `execute` and `discovered`, hold it.\n */\nfunction checkHint(decision: { id: string; hint: string }, ctx: z.RefinementCtx): void {\n if (/[\\p{Cc}\\p{Cf}]/u.test(decision.hint)) {\n ctx.addIssue({ code: 'custom', path: ['hint'], message: 'a hint is one plain line' });\n }\n if (!decision.hint.includes('request({')) {\n ctx.addIssue({ code: 'custom', path: ['hint'], message: 'a hint names the call to make' });\n }\n if (!decision.hint.includes(decision.id)) {\n ctx.addIssue({\n code: 'custom',\n path: ['hint'],\n message: \"a hint carries this answer's own id\",\n });\n }\n}\n\n/**\n * A PAY-PER-CALL SERVICE NOBODY CURATED. When no capability in the catalog fits\n * but a listed x402 service could do the step, the server names that one\n * service: who sells it, where, for how much, and the input it takes. The\n * candidate is the seller's own listing, so every field is data for the host\n * to judge, never an instruction; the host builds the `input` and the tool\n * call pays through the same `runPay` path and caps as a curated lookup.\n */\nconst DiscoveredCandidateSchema = z.strictObject({\n source: z.string().min(1).max(64),\n provider: z.string().min(1).max(120),\n url: z.string().min(1).max(2_048),\n method: z.enum(['GET', 'POST']),\n description: z.string().max(500),\n providerPriceAtomic: z.string().regex(/^\\d+$/),\n network: z.string().min(1).max(64),\n payTo: z.string().min(1).max(200),\n input: z.strictObject({\n location: z.enum(['body', 'query']),\n schema: z.record(z.string(), z.unknown()),\n }),\n});\n\n/**\n * A REQUEST SPEC: the offered service's real contract, sent beside the line only\n * because this build asks for it (`accepts: [\"spec\"]`). The hook stores it by\n * the offer's id; `request({id})` shows it and `request({id, input})` fills its\n * request and pays the provider directly, with no second decision. Every field\n * is the server's, and so is checked like the rest of the answer: the payee and\n * price still meet the live 402 and the spend policy in `runPay`.\n */\nexport const ToolSpecSchema = z.strictObject({\n capabilityId: z.string().min(1).max(200),\n provider: z.string().min(1).max(120),\n description: z.string().min(1).max(500),\n priceAtomic: z.string().regex(/^\\d+$/),\n priceVaries: z.boolean(),\n maxAmountAtomic: z.string().regex(/^\\d+$/),\n payTo: z.string().min(1).max(200),\n network: z.string().min(1).max(64),\n asset: z.string().min(1).max(200),\n request: z.strictObject({\n method: z.enum(['GET', 'POST']),\n url: z.string().min(1).max(2_048),\n fields: z.record(z.string(), z.enum(['path', 'query', 'body'])),\n location: z.enum(['query', 'body']),\n }),\n input: z.record(z.string(), z.unknown()),\n pinned: z.record(z.string(), z.unknown()),\n example: z.record(z.string(), z.unknown()).optional(),\n returns: z.string().min(1).max(200).optional(),\n returnsExample: z.unknown().optional(),\n resultSchema: z.record(z.string(), z.unknown()).optional(),\n /** The fields the result promises (type, properties, items, required). The\n * agent is handed only these; the whole body is saved to a file. */\n outputSchema: z.record(z.string(), z.unknown()).optional(),\n});\nexport type ToolSpec = z.infer<typeof ToolSpecSchema>;\n\nexport const OfferSpecSchema = ToolSpecSchema.extend({ id: IdSchema });\nexport type OfferSpec = z.infer<typeof OfferSpecSchema>;\n\n/** One spec per service the line names: the offer and any alternative. */\nconst SpecsSchema = z.array(OfferSpecSchema).min(1).max(4).optional();\n\n/** The same answer on both calls: the hook's offer, and the tool's fallback\n * when a query with no id found no curated capability. */\nconst DiscoveredSchema = z\n .strictObject({\n action: z.literal('discovered'),\n id: IdSchema,\n candidate: DiscoveredCandidateSchema,\n /** THE LINE, FINISHED, as on `execute`: it carries the seller's\n * description and the input it takes. */\n hint: z.string().min(1).max(2_000),\n specs: SpecsSchema,\n })\n .superRefine(checkHint);\n\nconst HookDecisionSchema = z.discriminatedUnion('action', [\n z\n .strictObject({\n action: z.literal('execute'),\n id: IdSchema,\n ...CapabilityFields,\n /** The x402 URL a lookup would pay, for the line the server writes. */\n endpoint: z.string().min(1).max(2_048),\n /** What to pass in `query`, in the service's own terms. */\n usage: z.string().min(1).max(300),\n /**\n * THE LINE, FINISHED. The server writes it with the real id in it and, on a\n * native call, the exact search or URL that was denied. The client injects\n * it and composes nothing, which is why there is no hint builder here any\n * more: two sides writing the same sentence is how they drift. The same\n * bound as a discovered line's.\n */\n hint: z.string().min(1).max(2_000),\n specs: SpecsSchema,\n })\n .superRefine(checkHint),\n DiscoveredSchema,\n RefusedSchema.extend({ action: z.literal('native') }),\n RefusedSchema.extend({ action: z.literal('needs_input') }),\n]);\n\nconst ToolDecisionSchema = z.discriminatedUnion('action', [\n z.strictObject({\n action: z.literal('execute'),\n ...CapabilityFields,\n contract: ContractSchema,\n }),\n /**\n * A query with no id, answered with the spec of the service the server\n * picked under a fresh `id`: kept like a hook's, and never run in the same\n * call. `hint` is the line, with the skeleton of the next call:\n * `request({id, input: {...}})` with the required fields. `input` is what a\n * router from before the binder's removal still sends on a bound pick: it\n * is accepted so that answer parses, and never read, so it never runs.\n */\n z\n .strictObject({\n action: z.literal('spec'),\n id: IdSchema,\n spec: ToolSpecSchema,\n hint: z.string().min(1).max(2_000),\n input: z.record(z.string(), z.unknown()).optional(),\n })\n .superRefine(checkHint),\n DiscoveredSchema,\n RefusedSchema.extend({ action: z.literal('native') }),\n RefusedSchema.extend({ action: z.literal('needs_input') }),\n]);\n\nfunction envelope<T extends z.ZodTypeAny>(decision: T) {\n return z.strictObject({\n schemaVersion: z.literal(1),\n routerVersion: z.string().min(1).max(64),\n decision,\n /** A plain sentence about the CALL, such as an id that had expired. Never a\n * failure: the decision beside it ran anyway. */\n note: z.string().max(500).optional(),\n jev: z.object({ calls: z.number(), latencyMs: z.number() }).optional(),\n });\n}\n\nconst HookResponseSchema = envelope(HookDecisionSchema);\nconst ToolResponseSchema = envelope(ToolDecisionSchema);\n\nexport type HookResponse = z.infer<typeof HookResponseSchema>;\nexport type ToolResponse = z.infer<typeof ToolResponseSchema>;\nexport type HookDecision = HookResponse['decision'];\nexport type ToolDecision = ToolResponse['decision'];\n\n/** Which call this is, and therefore which answer is legal for it. */\nexport type CallKind = 'hook' | 'tool';\n\n/**\n * What this client can act on beyond the curated answers, sent on both calls.\n * `discovered` is Tenjin's reviewed list of third-party services, on for every\n * build that parses it; the server answers that arm only to a request that\n * lists it, so an older build never sees one. `spec` asks for each offered\n * service's request spec beside its line, and for the picked service's spec in\n * place of a decision on a query with no id, which only a build that parses\n * them can take: the decision schemas are strict. `bazaar` widens discovery\n * to the open Bazaar and is sent only while `experimental.bazaar` is on.\n */\nexport const CLIENT_ACCEPTS: readonly string[] = ['discovered', 'spec'];\nexport const BAZAAR_ACCEPT = 'bazaar';\n\n/** The `accepts` this build sends, with the open Bazaar or without it. */\nexport function acceptsFor(bazaar: boolean): string[] {\n return bazaar ? [...CLIENT_ACCEPTS, BAZAAR_ACCEPT] : [...CLIENT_ACCEPTS];\n}\n\n/**\n * The exact body the hook call sends, spelled once and pinned to the shared\n * fixtures. The route reads it with a strict object, so an extra field is a\n * 400, and a 400 is a turn with no hint.\n *\n * ONE BODY FOR BOTH HOOKS. Which hook is asking is not a field: the route reads\n * it from `packet.pendingCall`, which the native hook sets and the prompt hook\n * does not. A `source` beside the packet was the `/prepare` route's shape, and\n * that route is gone. `sessionId` is the harness's own session id, which the\n * server uses only so one session is not offered the same discovered service\n * twice.\n */\nexport function buildHookBody(\n packet: Packet,\n extras: { sessionId?: string; accepts?: readonly string[] } = {},\n): Record<string, unknown> {\n return {\n schemaVersion: 1,\n ...(extras.sessionId !== undefined ? { sessionId: extras.sessionId } : {}),\n ...(extras.accepts !== undefined ? { accepts: [...extras.accepts] } : {}),\n packet,\n };\n}\n\n/** The exact body the tool call sends. `id` is the offer the query is for,\n * sent only for an offer with no spec kept; `gateHint` is evidence, never\n * authority. */\nexport function buildToolBody(request: {\n query?: string;\n id?: string;\n gateHint?: GateHint;\n accepts?: readonly string[];\n}): Record<string, unknown> {\n return {\n schemaVersion: 1,\n ...(request.query !== undefined ? { query: request.query } : {}),\n ...(request.id !== undefined ? { id: request.id } : {}),\n ...(request.gateHint !== undefined ? { gateHint: request.gateHint } : {}),\n ...(request.accepts !== undefined ? { accepts: [...request.accepts] } : {}),\n };\n}\n\n/** The parsers, exposed so the shared wire fixtures are checked against the\n * same schemas production parses with rather than against a copy of them. */\nexport function parseForTests(kind: CallKind, value: unknown): { success: boolean } {\n const schema = kind === 'hook' ? HookResponseSchema : ToolResponseSchema;\n return { success: schema.safeParse(value).success };\n}\n\n/**\n * The gate's own reading of this turn, travelling as EVIDENCE for the lookup it\n * was produced for. The backend may refine or reject it, and it authorizes no\n * money: the local spend policy does that. Optional on both call forms.\n */\nexport interface GateHint {\n category: string;\n turnId: string;\n lookupId: string;\n}\n\nexport interface DecisionDeps {\n ctx: CommandContext;\n baseUrl: string;\n /** `experimental.bazaar`: add {@link BAZAAR_ACCEPT}, so a service from the\n * open Bazaar may come back. Off by default: curated and the Tenjin list. */\n acceptsBazaar?: boolean;\n fetchImpl?: typeof fetch;\n /** Overrides the per-call deadline; the hook passes its own, smaller one. */\n timeoutMs?: number;\n /** The paid path, when `tenjin mcp` takes it: the body goes to `path` and is\n * sent by `send`, which pays the routing fee with the stock x402 client.\n * Absent is the free path. */\n route?: DecisionRoute;\n}\n\n/** How a routing call reaches the paid path. `send` throws\n * {@link RouteSkipped} when it has no paid answer for the call, which then\n * takes the free path. */\nexport interface DecisionRoute {\n path: string;\n send: (url: string, options: HttpRequestOptions) => Promise<HttpResult>;\n}\n\n/** The paid path gave this call no answer: the wallet locked, low or over\n * its spend limits, the channel busy, or the payment failed. */\nexport class RouteSkipped extends Error {\n /** `unreached`: the paid call could not reach the router\n * ({@link isUnreachable}), so the free path, on the same host, is not\n * tried and the call reads as that transport failure. */\n constructor(\n readonly why: string,\n readonly unreached?: FetchJsonFailure,\n ) {\n super(`routing fee not paid: ${why}`);\n }\n}\n\n/** Another session's call was in flight on the wallet's routing channel. */\nexport const CHANNEL_BUSY = 'channel_busy';\n/** The server answered no paid path. */\nexport const PAID_PATH_ABSENT = 'paid_path_absent';\n/** The paid call got no answer, a refused payment or a server error. */\nexport const PAYMENT_FAILED = 'payment_failed';\n/** The payment went out and the call's budget ran out before its answer:\n * no fault. `tenjin mcp` lets the request finish, so it is recorded. */\nexport const DEADLINE_AFTER_PAYMENT_SENT = 'deadline_after_payment_sent';\n\nexport type DecisionOutcome<T> =\n /** `freePath`: the paid path skipped the call for this reason and it went\n * to the free path instead, unpaid. */\n | { status: 'decided'; decision: T; freePath?: string }\n /** On the free path nothing was paid and nothing could be, so a failure here\n * costs the turn a routing answer and nothing else. */\n | {\n status: 'failed';\n reason: string;\n errorCode?: string;\n freePath?: string;\n /** The router could not be reached at all ({@link isUnreachable}). */\n unreachable?: true;\n /** No answer came back at all: a transport failure or a timeout. */\n noAnswer?: true;\n }\n /** The paid path gave no answer ({@link RouteSkipped}) and no time was left\n * for the free path: the native tool runs. */\n | { status: 'skipped'; why: string };\n\n/**\n * ONE FREE CALL, IN TWO FORMS. The hook sends `{ packet }`: the backend runs\n * the gate, and on `execute` stores that packet under an id and answers with\n * each offered service's spec. The tool sends `{ query }`, which the backend\n * answers with the spec of the service its gate picks, or `{ query, id }` for\n * the free docs offer, which has no spec and is bound from the query. Every\n * provider call is built here, from a spec, or for the docs lookup by the\n * backend from the query.\n */\nexport async function requestDecision(\n kind: 'hook',\n request: { packet: Packet; sessionId?: string },\n deps: DecisionDeps,\n): Promise<DecisionOutcome<HookResponse>>;\nexport async function requestDecision(\n kind: 'tool',\n request: { query: string; id?: string; gateHint?: GateHint },\n deps: DecisionDeps,\n): Promise<DecisionOutcome<ToolResponse>>;\nexport async function requestDecision(\n kind: CallKind,\n request: {\n query?: string;\n packet?: Packet;\n sessionId?: string;\n id?: string;\n gateHint?: GateHint;\n },\n deps: DecisionDeps,\n): Promise<DecisionOutcome<HookResponse | ToolResponse>> {\n const url = new URL(deps.route?.path ?? ROUTER_PATH, deps.baseUrl).toString();\n const options: HttpRequestOptions = {\n method: 'POST',\n timeoutMs: deps.timeoutMs ?? deps.ctx.flags.timeout,\n blockRedirects: true,\n jsonBody:\n kind === 'hook'\n ? buildHookBody(request.packet as Packet, {\n ...(request.sessionId !== undefined ? { sessionId: request.sessionId } : {}),\n accepts: acceptsFor(deps.acceptsBazaar === true),\n })\n : buildToolBody({\n ...(request.query !== undefined ? { query: request.query } : {}),\n ...(request.id !== undefined ? { id: request.id } : {}),\n ...(request.gateHint !== undefined ? { gateHint: request.gateHint } : {}),\n accepts: acceptsFor(deps.acceptsBazaar === true),\n }),\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n };\n const started = Date.now();\n const schema = kind === 'hook' ? HookResponseSchema : ToolResponseSchema;\n let response: HttpResult;\n try {\n response = await (deps.route?.send ?? httpRequest)(url, options);\n } catch (err) {\n if (!(err instanceof RouteSkipped)) throw err;\n if (err.unreached !== undefined) return readDecision(err.unreached, schema);\n const left = options.timeoutMs - (Date.now() - started);\n if (left <= 0) return { status: 'skipped', why: err.why };\n // A CALL THE PAID PATH COULD NOT TAKE STILL ROUTES, on the free path,\n // unpaid, inside what is left of its budget, and says why.\n response = await httpRequest(new URL(ROUTER_PATH, deps.baseUrl).toString(), {\n ...options,\n timeoutMs: left,\n });\n const free = readDecision(response, schema);\n // A failure here ran on what a paid attempt left of the budget, so it says\n // nothing about the router being down: it never starts the backoff.\n if (free.status === 'failed') {\n return {\n status: 'failed',\n reason: free.reason,\n ...(free.errorCode !== undefined ? { errorCode: free.errorCode } : {}),\n // Still no answer, which must not end another call's backoff.\n ...(free.noAnswer === true ? { noAnswer: true as const } : {}),\n freePath: err.why,\n };\n }\n return free.status === 'skipped' ? free : { ...free, freePath: err.why };\n }\n return readDecision(response, schema);\n}\n\n/** How a call run from a request spec ended, for the server's offer-to-call\n * count. No text: the id, the outcome, the provider's status and the time. */\nexport interface SpecOutcome {\n id: string;\n status: 'fulfilled' | 'unverified' | 'failed' | 'needs_approval';\n httpStatus?: number;\n ms?: number;\n}\n\n/** The outcome report's own deadline: it is telemetry and never holds a result. */\nexport const OUTCOME_TIMEOUT_MS = 3_000;\n\n/**\n * TELL THE SERVER A SPEC WAS USED. The client called and paid the provider\n * itself, so this is the only word the server gets that its offer was taken.\n * Never throws and never waits on anything the caller needs: a lost report\n * costs one count.\n */\nexport async function reportSpecOutcome(\n outcome: SpecOutcome,\n deps: Pick<DecisionDeps, 'ctx' | 'baseUrl' | 'fetchImpl'>,\n): Promise<void> {\n try {\n await httpRequest(new URL(ROUTER_PATH, deps.baseUrl).toString(), {\n method: 'POST',\n timeoutMs: OUTCOME_TIMEOUT_MS,\n blockRedirects: true,\n jsonBody: buildOutcomeBody(outcome),\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n });\n } catch {\n // Telemetry only.\n }\n}\n\n/** The exact body of an outcome report, pinned to the shared fixtures. */\nexport function buildOutcomeBody(outcome: SpecOutcome): Record<string, unknown> {\n return {\n schemaVersion: 1,\n id: outcome.id,\n status: outcome.status,\n ...(outcome.httpStatus !== undefined ? { httpStatus: outcome.httpStatus } : {}),\n ...(outcome.ms !== undefined ? { ms: Math.max(0, Math.round(outcome.ms)) } : {}),\n };\n}\n\nfunction readDecision<T extends z.ZodTypeAny>(\n response: HttpResult,\n schema: T,\n): DecisionOutcome<z.infer<T>> {\n // A transport failure says its own reason; nothing was paid either way,\n // because there is nothing to pay for on this route.\n if (!response.ok) {\n return {\n status: 'failed',\n reason: fetchFailureToCliError(response).message,\n ...(isUnreachable(response) ? { unreachable: true as const } : {}),\n ...(response.status === undefined ? { noAnswer: true as const } : {}),\n };\n }\n if (response.status < 200 || response.status >= 300) {\n const named = errorOf(response.json);\n return {\n status: 'failed',\n // The backend's own code and message, never a bare status line: a typed\n // refusal the host could act on was arriving as \"answered 400\".\n reason:\n named === null\n ? `The router endpoint answered ${response.status}.`\n : `The router endpoint answered ${response.status} (${named.code}): ${named.message}`,\n ...(named !== null ? { errorCode: named.code } : {}),\n };\n }\n const parsed = schema.safeParse(response.json);\n if (!parsed.success) {\n return { status: 'failed', reason: 'The router returned a decision this build cannot read.' };\n }\n return { status: 'decided', decision: parsed.data as z.infer<T> };\n}\n\n/** `{ error: { code, message } }`, the envelope every Tenjin route answers a\n * refusal with. Anything else reads as no code rather than as a guess. */\nfunction errorOf(body: unknown): { code: string; message: string } | null {\n if (body === null || typeof body !== 'object') return null;\n const error = (body as { error?: unknown }).error;\n if (error === null || typeof error !== 'object') return null;\n const { code, message } = error as { code?: unknown; message?: unknown };\n if (typeof code !== 'string' || code.length === 0 || code.length > 64) return null;\n const text = typeof message === 'string' ? message.slice(0, 500) : '';\n return { code, message: text };\n}\n\n/** A dropped socket, which a fresh connection usually gets past. */\nconst RESET_CODES = new Set(['ECONNRESET', 'UND_ERR_SOCKET']);\n\n/**\n * A ROUTER THAT CANNOT BE REACHED: the transport named the layer that refused\n * the connection (DNS, TLS, a refused connection, a proxy refusing the tunnel)\n * and no status came back. Never the call's own timeout: that is the gate's\n * few seconds, and a slow decision or a cold start must not take the router\n * away from every session. Never a status, even with a body that failed to\n * read, and never a reset socket, which the free path retries on a fresh one.\n */\nexport function isUnreachable(failure: FetchJsonFailure): boolean {\n return (\n failure.kind === 'network' &&\n failure.status === undefined &&\n failure.transport !== undefined &&\n !RESET_CODES.has(failure.transport.code ?? '')\n );\n}\n"],"mappings":";;;;;;;;;;AA2BO,IAAM,cAAc;AAO3B,IAAM,gBAAgB,iBAAE,OAAO;AAAA,EAC7B,KAAK,iBAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,KAAM;AAAA,EACjC,QAAQ,iBAAE,KAAK,CAAC,OAAO,QAAQ,OAAO,SAAS,UAAU,QAAQ,SAAS,CAAC;AAAA,EAC3E,SAAS,iBAAE,OAAO,iBAAE,OAAO,GAAG,iBAAE,OAAO,CAAC;AAAA,EACxC,MAAM,iBACH,OAAO,EACP,IAAI,MAAM,IAAI,EACd,SAAS;AACd,CAAC;AAED,IAAM,iBAAiB,iBAAE,OAAO;AAAA;AAAA;AAAA,EAG9B,WAAW,iBAAE,OAAO,iBAAE,OAAO,GAAG,iBAAE,QAAQ,CAAC,EAAE,SAAS;AAAA,EACtD,cAAc,iBAAE,OAAO,iBAAE,OAAO,GAAG,iBAAE,QAAQ,CAAC,EAAE,SAAS;AAAA,EACzD,SAAS;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AAE,QAAQ,WAAW,UAAU,OAAO,KAAmB;AAClE;AAIA,SAAS,QAAQ,MAAyD;AACxE,MAAI,SAAS,QAAQ,OAAO,SAAS,SAAU,QAAO;AACtD,QAAM,QAAS,KAA6B;AAC5C,MAAI,UAAU,QAAQ,OAAO,UAAU,SAAU,QAAO;AACxD,QAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,MAAI,OAAO,SAAS,YAAY,KAAK,WAAW,KAAK,KAAK,SAAS,GAAI,QAAO;AAC9E,QAAM,OAAO,OAAO,YAAY,WAAW,QAAQ,MAAM,GAAG,GAAG,IAAI;AACnE,SAAO,EAAE,MAAM,SAAS,KAAK;AAC/B;AAGA,IAAM,cAAc,oBAAI,IAAI,CAAC,cAAc,gBAAgB,CAAC;AAUrD,SAAS,cAAc,SAAoC;AAChE,SACE,QAAQ,SAAS,aACjB,QAAQ,WAAW,UACnB,QAAQ,cAAc,UACtB,CAAC,YAAY,IAAI,QAAQ,UAAU,QAAQ,EAAE;AAEjD;","names":[]}
@@ -0,0 +1,30 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+
3
+ // src/lib/env-proxy.ts
4
+ import * as http from "node:http";
5
+ var PROXY_VARIABLES = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"];
6
+ var nodeSetGlobalProxy = http.setGlobalProxyFromEnv;
7
+ function proxyVariable(env) {
8
+ return PROXY_VARIABLES.find((name) => (env[name] ?? "") !== "");
9
+ }
10
+ function envProxySupported(setGlobal = nodeSetGlobalProxy) {
11
+ return typeof setGlobal === "function";
12
+ }
13
+ function useEnvProxy(env, setGlobal = nodeSetGlobalProxy ?? null) {
14
+ if (proxyVariable(env) === void 0) return "none";
15
+ if (typeof setGlobal !== "function") return "unsupported";
16
+ try {
17
+ setGlobal(env);
18
+ return "set";
19
+ } catch {
20
+ return "invalid";
21
+ }
22
+ }
23
+
24
+ export {
25
+ PROXY_VARIABLES,
26
+ proxyVariable,
27
+ envProxySupported,
28
+ useEnvProxy
29
+ };
30
+ //# sourceMappingURL=chunk-ZLD6MJVJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/env-proxy.ts"],"sourcesContent":["import * as http from 'node:http';\n\n/** Named, never quoted: a proxy URL can carry its own credentials. */\nexport const PROXY_VARIABLES = ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy'] as const;\n\ntype SetGlobalProxy = (env: NodeJS.ProcessEnv) => () => void;\n\n/** Node 24.14 added it; `engines` still admits 24.0, where it is absent. */\nconst nodeSetGlobalProxy = (http as { setGlobalProxyFromEnv?: SetGlobalProxy })\n .setGlobalProxyFromEnv;\n\n/** The first proxy variable this environment sets, or undefined. */\nexport function proxyVariable(env: NodeJS.ProcessEnv): string | undefined {\n return PROXY_VARIABLES.find((name) => (env[name] ?? '') !== '');\n}\n\n/** Can this Node route `fetch` through the proxy the environment names? */\nexport function envProxySupported(setGlobal: unknown = nodeSetGlobalProxy): boolean {\n return typeof setGlobal === 'function';\n}\n\nexport type EnvProxyResult = 'none' | 'set' | 'unsupported' | 'invalid';\n\n/**\n * Send `fetch` and `https.request` through the proxy the environment names.\n * Node's `fetch` ignores HTTPS_PROXY, HTTP_PROXY and NO_PROXY unless\n * NODE_USE_ENV_PROXY=1, so on a network where the proxy is the only way out the\n * harness reaches the internet and Tenjin does not. Called once by the bin\n * entry, so the CLI, the hooks and `tenjin mcp` all get it. Never throws: a\n * proxy URL Node cannot parse leaves the transport as it was.\n */\nexport function useEnvProxy(\n env: NodeJS.ProcessEnv,\n setGlobal: SetGlobalProxy | null = nodeSetGlobalProxy ?? null,\n): EnvProxyResult {\n if (proxyVariable(env) === undefined) return 'none';\n if (typeof setGlobal !== 'function') return 'unsupported';\n try {\n setGlobal(env);\n return 'set';\n } catch {\n return 'invalid';\n }\n}\n"],"mappings":";;;AAAA,YAAY,UAAU;AAGf,IAAM,kBAAkB,CAAC,eAAe,eAAe,cAAc,YAAY;AAKxF,IAAM,qBACH;AAGI,SAAS,cAAc,KAA4C;AACxE,SAAO,gBAAgB,KAAK,CAAC,UAAU,IAAI,IAAI,KAAK,QAAQ,EAAE;AAChE;AAGO,SAAS,kBAAkB,YAAqB,oBAA6B;AAClF,SAAO,OAAO,cAAc;AAC9B;AAYO,SAAS,YACd,KACA,YAAmC,sBAAsB,MACzC;AAChB,MAAI,cAAc,GAAG,MAAM,OAAW,QAAO;AAC7C,MAAI,OAAO,cAAc,WAAY,QAAO;AAC5C,MAAI;AACF,cAAU,GAAG;AACb,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -2,28 +2,27 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
2
2
  import {
3
3
  maybeUpdate,
4
4
  readUpdateSignal
5
- } from "./chunk-XRW4N23F.js";
5
+ } from "./chunk-W36HL4TB.js";
6
6
  import {
7
7
  defaultIo,
8
8
  emitFailure,
9
9
  emitSuccess
10
- } from "./chunk-O2WN732M.js";
10
+ } from "./chunk-UDWGT4FX.js";
11
11
  import {
12
12
  noteBaseUrlFlag
13
- } from "./chunk-IIE65SJC.js";
14
- import "./chunk-RCJ64OXH.js";
13
+ } from "./chunk-WT7DHJNJ.js";
14
+ import "./chunk-5INS5ZZF.js";
15
15
  import {
16
16
  PERMISSIONS_DOC_URL
17
17
  } from "./chunk-A36LQPHV.js";
18
+ import {
19
+ package_default
20
+ } from "./chunk-GHR4BTNJ.js";
18
21
  import "./chunk-2I4QTOLB.js";
19
- import "./chunk-TMLCEPCD.js";
20
- import "./chunk-O2JYBOUO.js";
22
+ import "./chunk-HII5HOQV.js";
21
23
  import {
22
24
  external_exports
23
- } from "./chunk-P22ZWXFX.js";
24
- import {
25
- package_default
26
- } from "./chunk-ZNZGBUV6.js";
25
+ } from "./chunk-XICKN3CH.js";
27
26
  import {
28
27
  CliError
29
28
  } from "./chunk-JLEF5WHM.js";
@@ -3496,7 +3495,7 @@ function registerCore(reg) {
3496
3495
  const { runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2 } = reg;
3497
3496
  leaf2(SETUP, "install", "set up Tenjin for Claude Code and create a wallet").description(
3498
3497
  "Set up Claude Code to use Tenjin: seven hook entries, the `x402` MCP server and its permission rule, spend limits for each lookup, and a wallet if this machine has none."
3499
- ).option("--project", "write into this project's .claude/settings.json instead of your home one").option("--no-wallet", "create no wallet").option("--refresh", "re-register the hook entries this machine already has; add nothing").option(
3498
+ ).option("--project", "write into this project's .claude/settings.json instead of your home one").option("--no-wallet", "create no wallet").option("--refresh", "re-register the hook entries this machine already has; add nothing").option("--yes", "accept the default spend limits instead of asking").option(
3500
3499
  "--status-line <mode>",
3501
3500
  "the live footer: `own` registers it when you have no status line of your own, `compose` appends it to the one you do have, `skip` leaves the setting alone"
3502
3501
  ).addHelpText(
@@ -3513,12 +3512,13 @@ Learn more:
3513
3512
  ).action(async function() {
3514
3513
  await runCommand("install", this, async (ctx) => {
3515
3514
  const o = this.opts();
3516
- const { runRouterInstall } = await import("./install-FRTG4KHF.js");
3517
- const { statusLineMode } = await import("./status-line-wiring-GXFNXHPE.js");
3515
+ const { runRouterInstall } = await import("./install-REPLHNU7.js");
3516
+ const { statusLineMode } = await import("./status-line-wiring-LW4HFRHB.js");
3518
3517
  return runRouterInstall(
3519
3518
  {
3520
3519
  ...o.project === true ? { project: true } : {},
3521
3520
  ...o.refresh === true ? { refresh: true } : {},
3521
+ ...o.yes === true ? { yes: true } : {},
3522
3522
  ...o.statusLine !== void 0 ? { statusLine: statusLineMode(String(o.statusLine)) } : {},
3523
3523
  ...o.wallet === false ? { noWallet: true } : {}
3524
3524
  },
@@ -3531,7 +3531,7 @@ Learn more:
3531
3531
  ).option("--project", "remove from this project's .claude/settings.json").action(async function() {
3532
3532
  await runCommand("uninstall", this, async (ctx) => {
3533
3533
  const o = this.opts();
3534
- const { runRouterUninstall } = await import("./uninstall-5P2GFYBY.js");
3534
+ const { runRouterUninstall } = await import("./uninstall-NVTGU7JD.js");
3535
3535
  return runRouterUninstall({ ...o.project === true ? { project: true } : {} }, ctx);
3536
3536
  });
3537
3537
  });
@@ -3547,7 +3547,7 @@ Examples:
3547
3547
  `
3548
3548
  ).action(async function() {
3549
3549
  await runCommand("doctor", this, async (ctx) => {
3550
- const { runRouterDoctor } = await import("./doctor-3LGF6CWI.js");
3550
+ const { runRouterDoctor } = await import("./doctor-BD42BBEG.js");
3551
3551
  return runRouterDoctor(ctx, this.opts().project === true ? { project: true } : {});
3552
3552
  });
3553
3553
  });
@@ -3555,7 +3555,7 @@ Examples:
3555
3555
  "Update tenjin-cli to the newest version npm publishes on the latest tag. It then runs `install --refresh` on the new binary, so every profile on this machine gets the skills and hook scripts of the build that just landed."
3556
3556
  ).option("--check", "report whether a newer version exists without installing it").action(async function() {
3557
3557
  await runCommand("update", this, async (ctx) => {
3558
- const { runUpdate } = await import("./update-QJ5YHJ7I.js");
3558
+ const { runUpdate } = await import("./update-QXVH2DE7.js");
3559
3559
  return runUpdate({ check: this.opts().check === true }, ctx);
3560
3560
  });
3561
3561
  });
@@ -3574,7 +3574,7 @@ Examples:
3574
3574
  );
3575
3575
  config.action(async function() {
3576
3576
  await runCommand("config", this, async (ctx) => {
3577
- const { runConfigList } = await import("./config-XUUFICXK.js");
3577
+ const { runConfigList } = await import("./config-44EGO636.js");
3578
3578
  return runConfigList(ctx);
3579
3579
  });
3580
3580
  });
@@ -3582,7 +3582,7 @@ Examples:
3582
3582
  "Print one effective config value by key. The effective value is what the command would use, defaults and environment overrides included."
3583
3583
  ).action(async function(key) {
3584
3584
  await runCommand("config.get", this, async (ctx) => {
3585
- const { runConfigGet } = await import("./config-XUUFICXK.js");
3585
+ const { runConfigGet } = await import("./config-44EGO636.js");
3586
3586
  return runConfigGet({ key }, ctx);
3587
3587
  });
3588
3588
  });
@@ -3594,7 +3594,7 @@ Examples:
3594
3594
  ).option("--local", "with --project, write .tenjin/config.local.json instead, which is yours").action(async function(key, value) {
3595
3595
  const o = this.opts();
3596
3596
  await runCommand("config.set", this, async (ctx) => {
3597
- const { runConfigSet } = await import("./config-XUUFICXK.js");
3597
+ const { runConfigSet } = await import("./config-44EGO636.js");
3598
3598
  return runConfigSet(
3599
3599
  { key, value, project: o.project === true, local: o.local === true },
3600
3600
  ctx
@@ -3616,38 +3616,40 @@ Examples:
3616
3616
  ).action(async function() {
3617
3617
  await runCommand("wallet.create", this, async (ctx) => {
3618
3618
  const o = this.opts();
3619
- const { runWalletCreate } = await import("./wallet-6OJPGNEV.js");
3619
+ const { runWalletCreate } = await import("./wallet-CKKB23D5.js");
3620
3620
  return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
3621
3621
  });
3622
3622
  });
3623
- addGlobalFlags2(wallet.command("show")).summary("show the wallet address and key source").description(
3624
- "Print the active wallet address and where its key comes from. The private key is never printed, by any flag."
3625
- ).action(async function() {
3623
+ addGlobalFlags2(wallet.command("show")).alias("address").summary("show the wallet address and key source").description(
3624
+ "Print the active wallet address and where its key comes from. The private key is never printed, by any flag. At a terminal it also draws the address as a QR code for a phone wallet to scan."
3625
+ ).option("--no-qr", "print the address without the QR code").action(async function() {
3626
3626
  await runCommand("wallet.show", this, async (ctx) => {
3627
- const { runWalletShow } = await import("./wallet-6OJPGNEV.js");
3628
- return runWalletShow(ctx);
3627
+ const o = this.opts();
3628
+ const { runWalletShow } = await import("./wallet-CKKB23D5.js");
3629
+ return runWalletShow(ctx, o.qr === false ? { qr: false } : {});
3629
3630
  });
3630
3631
  });
3631
3632
  addGlobalFlags2(wallet.command("balance")).summary("show the wallet USDC balance on Base").description(
3632
3633
  "Read the wallet USDC balance on Base. It is a chain read: no key is unlocked and nothing is spent."
3633
3634
  ).action(async function() {
3634
3635
  await runCommand("wallet.balance", this, async (ctx) => {
3635
- const { runWalletBalance } = await import("./wallet-6OJPGNEV.js");
3636
+ const { runWalletBalance } = await import("./wallet-CKKB23D5.js");
3636
3637
  return runWalletBalance(ctx);
3637
3638
  });
3638
3639
  });
3639
3640
  addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("card-fund this wallet through Coinbase Onramp").description(
3640
3641
  "Mint a Coinbase Onramp checkout link bound to THIS wallet, open it in the browser, and wait for the USDC to land on Base. Minting moves no money: a human completes the payment on pay.coinbase.com."
3641
- ).option("--no-open", "print the checkout link without opening a browser").option(
3642
+ ).option("--no-open", "print the checkout link without opening a browser").option("--no-qr", "skip the QR code of the address for sending USDC from a phone").option(
3642
3643
  "--no-wait",
3643
3644
  "return once the link is issued instead of polling the balance (already the default when not at a TTY)"
3644
3645
  ).action(async function(amountUsd) {
3645
3646
  await runCommand("wallet.fund", this, async (ctx) => {
3646
3647
  const o = this.opts();
3647
- const { runFund } = await import("./fund-3URFMBMN.js");
3648
+ const { runFund } = await import("./fund-WQOOUESE.js");
3648
3649
  return runFund(ctx, {
3649
3650
  ...amountUsd !== void 0 ? { amountUsd } : {},
3650
3651
  ...o.open === false ? { open: false } : {},
3652
+ ...o.qr === false ? { qr: false } : {},
3651
3653
  ...o.wait === false ? { wait: false } : {}
3652
3654
  });
3653
3655
  });
@@ -3663,7 +3665,7 @@ Examples:
3663
3665
  ).action(async function(amount, token, to) {
3664
3666
  await runCommand("wallet.send", this, async (ctx) => {
3665
3667
  const o = this.opts();
3666
- const { runSend } = await import("./send-ALHG2RXT.js");
3668
+ const { runSend } = await import("./send-YHDKZPED.js");
3667
3669
  return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
3668
3670
  });
3669
3671
  });
@@ -3683,7 +3685,7 @@ Examples:
3683
3685
  ).action(async function(url) {
3684
3686
  await runCommand("pay", this, async (ctx) => {
3685
3687
  const o = this.opts();
3686
- const { runPay } = await import("./pay-43WUYTW5.js");
3688
+ const { runPay } = await import("./pay-276DSSYG.js");
3687
3689
  return runPay(
3688
3690
  {
3689
3691
  url,
@@ -3719,7 +3721,7 @@ function registerRouter(reg) {
3719
3721
  ]) {
3720
3722
  addGlobalFlags2(hook.command(name)).summary(summary).action(async function() {
3721
3723
  const ctx = buildContext2(this);
3722
- const { runHookCommand } = await import("./hook-command-GMIDXVFK.js");
3724
+ const { runHookCommand } = await import("./hook-command-23LC5NRN.js");
3723
3725
  await runHookCommand(name, io, {
3724
3726
  dataDir: ctx.dataDir,
3725
3727
  ...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {}
@@ -3732,21 +3734,21 @@ function registerRouter(reg) {
3732
3734
  "Run the local stdio MCP server that carries the `request` tool: one free routing decision per lookup, then the provider call, built here from the offer's spec and your assistant's input where it has one, under your local spend policy. It speaks on stdin and stdout and runs until the client disconnects, so it prints no envelope of its own."
3733
3735
  ).action(async function() {
3734
3736
  const ctx = buildContext2(this);
3735
- const { runRouterMcpServer } = await import("./mcp-O2WJ3QBW.js");
3737
+ const { runRouterMcpServer } = await import("./mcp-T5SYCLP7.js");
3736
3738
  await runRouterMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
3737
3739
  });
3738
3740
  leaf2(INTEGRATION, "status-line", "the live footer, for Claude Code's status line").description(
3739
3741
  "Print one line naming what this session is looking up right now: the provider actually being called, its bounded parameters, and what it cost. It reads Claude Code's status event on stdin for the session identity, reads that session's own progress records, writes nothing, and prints `x402 \xB7 ready` when this session has no activity. `tenjin install` registers it; you never run it by hand."
3740
3742
  ).action(async function() {
3741
3743
  const ctx = buildContext2(this);
3742
- const { runStatusLine } = await import("./status-line-FJ6N7MKJ.js");
3744
+ const { runStatusLine } = await import("./status-line-QKDJYZGV.js");
3743
3745
  await runStatusLine(io, { dataDir: ctx.dataDir });
3744
3746
  });
3745
3747
  leaf2(SETUP, "status", "what this machine has spent, and what is still open").description(
3746
3748
  "Report the rolling 24h spend window from spend.json: what has settled, what is reserved by a request still in flight, and the per-call and per-day caps in force."
3747
3749
  ).action(async function() {
3748
3750
  await runCommand("status", this, async (ctx) => {
3749
- const { runRouterStatus } = await import("./status-CFPNHB6R.js");
3751
+ const { runRouterStatus } = await import("./status-X2INT6VD.js");
3750
3752
  return runRouterStatus(ctx);
3751
3753
  });
3752
3754
  });
@@ -3757,7 +3759,7 @@ function registerRouter(reg) {
3757
3759
  "For each paid lookup whose seller never confirmed settlement and whose authorization has expired, ask USDC on Base (through the configured rpcUrl) whether it was used: used means it was charged, unused means it never can be. Nothing is signed or sent but that one read."
3758
3760
  ).action(async function() {
3759
3761
  await runCommand("payments.reconcile", this, async (ctx) => {
3760
- const { runPaymentsReconcile } = await import("./payments-7UTMMTIO.js");
3762
+ const { runPaymentsReconcile } = await import("./payments-TZYLJXK3.js");
3761
3763
  return runPaymentsReconcile(ctx);
3762
3764
  });
3763
3765
  });
@@ -3907,4 +3909,4 @@ export {
3907
3909
  buildProgram,
3908
3910
  main
3909
3911
  };
3910
- //# sourceMappingURL=cli-GGNOQQEB.js.map
3912
+ //# sourceMappingURL=cli-2U5JB7OQ.js.map