tenjin-cli 0.1.0-alpha.28 → 0.1.0-alpha.29

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 (127) hide show
  1. package/README.md +13 -10
  2. package/dist/{chunk-ZG6ZZLO7.js → chunk-25GGN553.js} +9 -11
  3. package/dist/{chunk-ZG6ZZLO7.js.map → chunk-25GGN553.js.map} +1 -1
  4. package/dist/{chunk-B2L53TMK.js → chunk-2SNUOHAT.js} +28 -23
  5. package/dist/chunk-2SNUOHAT.js.map +1 -0
  6. package/dist/{chunk-UEOWNDQG.js → chunk-3FY5HG7R.js} +82 -13
  7. package/dist/chunk-3FY5HG7R.js.map +1 -0
  8. package/dist/{chunk-DJYAPACT.js → chunk-4FYMDRD3.js} +32 -24
  9. package/dist/chunk-4FYMDRD3.js.map +1 -0
  10. package/dist/{chunk-ZP7AHN7Z.js → chunk-AMEUXNJT.js} +3 -5
  11. package/dist/{chunk-ZP7AHN7Z.js.map → chunk-AMEUXNJT.js.map} +1 -1
  12. package/dist/chunk-EWLU46J6.js +100 -0
  13. package/dist/chunk-EWLU46J6.js.map +1 -0
  14. package/dist/{chunk-RLPLYUME.js → chunk-LRCJ2IZ5.js} +3 -3
  15. package/dist/{chunk-RLPLYUME.js.map → chunk-LRCJ2IZ5.js.map} +1 -1
  16. package/dist/{chunk-YFJJYHVG.js → chunk-LX5OT4TQ.js} +3 -3
  17. package/dist/{chunk-YFJJYHVG.js.map → chunk-LX5OT4TQ.js.map} +1 -1
  18. package/dist/{chunk-ZO3X5NPG.js → chunk-MG3G644T.js} +4 -4
  19. package/dist/{chunk-6KA4HFX5.js → chunk-MOG7PB3A.js} +3 -3
  20. package/dist/{chunk-DYSDQE7S.js → chunk-MRUPDSUM.js} +14 -93
  21. package/dist/chunk-MRUPDSUM.js.map +1 -0
  22. package/dist/{chunk-KAMRYUK2.js → chunk-OOSRB3OF.js} +2 -2
  23. package/dist/{chunk-PZ5N6BAL.js → chunk-ORWL5BSN.js} +5 -4
  24. package/dist/chunk-ORWL5BSN.js.map +1 -0
  25. package/dist/chunk-P4LVLFO4.js +29 -0
  26. package/dist/chunk-P4LVLFO4.js.map +1 -0
  27. package/dist/{chunk-ZP5PV3JB.js → chunk-QTGUDCIR.js} +5 -5
  28. package/dist/{chunk-FQ6DHINU.js → chunk-R4AO7GC2.js} +437 -78
  29. package/dist/chunk-R4AO7GC2.js.map +1 -0
  30. package/dist/{chunk-UOW5JXYY.js → chunk-RJEPZMYY.js} +10 -4
  31. package/dist/chunk-RJEPZMYY.js.map +1 -0
  32. package/dist/{chunk-VSUHGRVB.js → chunk-SBL4THYT.js} +712 -93
  33. package/dist/chunk-SBL4THYT.js.map +1 -0
  34. package/dist/{chunk-BRHREK7E.js → chunk-SFEQGENI.js} +2 -2
  35. package/dist/{chunk-K6AXXYCG.js → chunk-SJLTEINJ.js} +10 -2
  36. package/dist/{chunk-K6AXXYCG.js.map → chunk-SJLTEINJ.js.map} +1 -1
  37. package/dist/{chunk-XVTD7UWR.js → chunk-TROZ6HL4.js} +2 -2
  38. package/dist/{chunk-3QJREVMX.js → chunk-USOLCBKC.js} +5 -5
  39. package/dist/{chunk-W6JX4LYF.js → chunk-VKQXVCZR.js} +46 -5
  40. package/dist/chunk-VKQXVCZR.js.map +1 -0
  41. package/dist/{chunk-QTND6XWJ.js → chunk-VVAHFCX2.js} +51 -3
  42. package/dist/chunk-VVAHFCX2.js.map +1 -0
  43. package/dist/{chunk-7H3RN4WJ.js → chunk-WM7TJEBP.js} +5 -5
  44. package/dist/{chunk-MNTQMZJB.js → chunk-XDYKZRLN.js} +22 -13
  45. package/dist/chunk-XDYKZRLN.js.map +1 -0
  46. package/dist/{chunk-A5H3E5QA.js → chunk-XJQ6CH7X.js} +3 -2
  47. package/dist/{chunk-7R37M6WV.js → chunk-ZQNGTLOC.js} +5 -5
  48. package/dist/{cli-234DNHN6.js → cli-JPTDHGRX.js} +38 -33
  49. package/dist/{cli-234DNHN6.js.map → cli-JPTDHGRX.js.map} +1 -1
  50. package/dist/{config-IY2OJCAK.js → config-YYKDH2TH.js} +11 -11
  51. package/dist/{doctor-2UZZF44A.js → doctor-SSTXGCHX.js} +60 -56
  52. package/dist/doctor-SSTXGCHX.js.map +1 -0
  53. package/dist/{fund-RZ2QFULK.js → fund-QWVWRVDK.js} +14 -16
  54. package/dist/{fund-RZ2QFULK.js.map → fund-QWVWRVDK.js.map} +1 -1
  55. package/dist/hook-command-VWJXRT7H.js +31 -0
  56. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  57. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  58. package/dist/hosts/claude/tenjin/.mcp.json +2 -1
  59. package/dist/hosts/claude/tenjin/hooks/hooks.json +18 -3
  60. package/dist/index.js +6 -6
  61. package/dist/{install-O5FJ5EP3.js → install-2GXXD4DK.js} +19 -16
  62. package/dist/{install-identity-QM44IQ6Z.js → install-identity-FK3YF227.js} +7 -8
  63. package/dist/{install-wallet-Z52EDLPB.js → install-wallet-TC22U52X.js} +17 -12
  64. package/dist/{install-wallet-Z52EDLPB.js.map → install-wallet-TC22U52X.js.map} +1 -1
  65. package/dist/{mcp-33HAADDF.js → mcp-42H2F4NY.js} +2091 -348
  66. package/dist/mcp-42H2F4NY.js.map +1 -0
  67. package/dist/{package-RT24HTTP.js → package-6DJA3Y2O.js} +2 -2
  68. package/dist/{paths-MUXHUOCM.js → paths-POPTXJO6.js} +6 -2
  69. package/dist/{pay-IR2V76FX.js → pay-LSDJBIAZ.js} +18 -15
  70. package/dist/payments-SPECLBRQ.js +105 -0
  71. package/dist/payments-SPECLBRQ.js.map +1 -0
  72. package/dist/{send-PI4NUA7I.js → send-MHAOLPK3.js} +12 -14
  73. package/dist/{send-PI4NUA7I.js.map → send-MHAOLPK3.js.map} +1 -1
  74. package/dist/status-O2RWLPS5.js +114 -0
  75. package/dist/status-O2RWLPS5.js.map +1 -0
  76. package/dist/{status-line-2G5JPQAE.js → status-line-45TVCRM3.js} +7 -8
  77. package/dist/{status-line-2G5JPQAE.js.map → status-line-45TVCRM3.js.map} +1 -1
  78. package/dist/{uninstall-THKUH5ZT.js → uninstall-VOK2Z5M4.js} +27 -17
  79. package/dist/uninstall-VOK2Z5M4.js.map +1 -0
  80. package/dist/update-FGP3HNLD.js +33 -0
  81. package/dist/{wallet-53EFH4M5.js → wallet-DA7OFNEW.js} +17 -12
  82. package/docs/agent-permissions.md +11 -8
  83. package/docs/safety-model.md +3 -1
  84. package/package.json +2 -2
  85. package/dist/chunk-AO54FM4H.js +0 -563
  86. package/dist/chunk-AO54FM4H.js.map +0 -1
  87. package/dist/chunk-B2L53TMK.js.map +0 -1
  88. package/dist/chunk-DJYAPACT.js.map +0 -1
  89. package/dist/chunk-DYSDQE7S.js.map +0 -1
  90. package/dist/chunk-FQ6DHINU.js.map +0 -1
  91. package/dist/chunk-FZTSGQVK.js +0 -52
  92. package/dist/chunk-FZTSGQVK.js.map +0 -1
  93. package/dist/chunk-MNTQMZJB.js.map +0 -1
  94. package/dist/chunk-PZ5N6BAL.js.map +0 -1
  95. package/dist/chunk-QTND6XWJ.js.map +0 -1
  96. package/dist/chunk-UEOWNDQG.js.map +0 -1
  97. package/dist/chunk-UOW5JXYY.js.map +0 -1
  98. package/dist/chunk-VSUHGRVB.js.map +0 -1
  99. package/dist/chunk-W6JX4LYF.js.map +0 -1
  100. package/dist/doctor-2UZZF44A.js.map +0 -1
  101. package/dist/hook-command-PZHKS7ES.js +0 -31
  102. package/dist/mcp-33HAADDF.js.map +0 -1
  103. package/dist/payments-GFV4HU5R.js +0 -47
  104. package/dist/payments-GFV4HU5R.js.map +0 -1
  105. package/dist/status-ZUHTJK46.js +0 -71
  106. package/dist/status-ZUHTJK46.js.map +0 -1
  107. package/dist/uninstall-THKUH5ZT.js.map +0 -1
  108. package/dist/update-NPZDP24E.js +0 -18
  109. /package/dist/{chunk-ZO3X5NPG.js.map → chunk-MG3G644T.js.map} +0 -0
  110. /package/dist/{chunk-6KA4HFX5.js.map → chunk-MOG7PB3A.js.map} +0 -0
  111. /package/dist/{chunk-KAMRYUK2.js.map → chunk-OOSRB3OF.js.map} +0 -0
  112. /package/dist/{chunk-ZP5PV3JB.js.map → chunk-QTGUDCIR.js.map} +0 -0
  113. /package/dist/{chunk-BRHREK7E.js.map → chunk-SFEQGENI.js.map} +0 -0
  114. /package/dist/{chunk-XVTD7UWR.js.map → chunk-TROZ6HL4.js.map} +0 -0
  115. /package/dist/{chunk-3QJREVMX.js.map → chunk-USOLCBKC.js.map} +0 -0
  116. /package/dist/{chunk-7H3RN4WJ.js.map → chunk-WM7TJEBP.js.map} +0 -0
  117. /package/dist/{chunk-A5H3E5QA.js.map → chunk-XJQ6CH7X.js.map} +0 -0
  118. /package/dist/{chunk-7R37M6WV.js.map → chunk-ZQNGTLOC.js.map} +0 -0
  119. /package/dist/{config-IY2OJCAK.js.map → config-YYKDH2TH.js.map} +0 -0
  120. /package/dist/{hook-command-PZHKS7ES.js.map → hook-command-VWJXRT7H.js.map} +0 -0
  121. /package/dist/{install-O5FJ5EP3.js.map → install-2GXXD4DK.js.map} +0 -0
  122. /package/dist/{install-identity-QM44IQ6Z.js.map → install-identity-FK3YF227.js.map} +0 -0
  123. /package/dist/{package-RT24HTTP.js.map → package-6DJA3Y2O.js.map} +0 -0
  124. /package/dist/{paths-MUXHUOCM.js.map → paths-POPTXJO6.js.map} +0 -0
  125. /package/dist/{pay-IR2V76FX.js.map → pay-LSDJBIAZ.js.map} +0 -0
  126. /package/dist/{update-NPZDP24E.js.map → update-FGP3HNLD.js.map} +0 -0
  127. /package/dist/{wallet-53EFH4M5.js.map → wallet-DA7OFNEW.js.map} +0 -0
@@ -1 +0,0 @@
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 a Tenjin list service does the\n * task the gate picked, or no task fits and a listed x402 service could do the\n * step, the server names that one service: who sells it, where, for how much,\n * and the input it takes. A Tenjin list service arrives here under its catalog\n * id, because this build sends `catalog`. The candidate is the seller's own\n * listing, so every field is data for the host to judge, never an instruction;\n * the host builds the `input` and the tool call pays through the same `runPay`\n * 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 /** The input field that takes a pending search's query or fetch's URL. */\n holds: z\n .strictObject({\n WebSearch: z.string().min(1).max(64).optional(),\n WebFetch: z.string().min(1).max(64).optional(),\n })\n .optional(),\n /** What a paid result is. `media` means its files (bytes, links or inline\n * base64) are saved locally; absent on a Bazaar spec. */\n output: z.enum(['json', 'text', 'media']).optional(),\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, any other service it\n * lists, and each option of a choice set. */\nconst SpecsSchema = z.array(OfferSpecSchema).min(1).max(8).optional();\n\n/** Words this client shows the model itself, in its own line: one plain line. */\nconst PlainLine = (max: number) =>\n z\n .string()\n .min(1)\n .max(max)\n .refine((text) => !/[\\p{Cc}\\p{Cf}]/u.test(text), 'one plain line');\n\n/**\n * SERVICES THE USER PICKS BETWEEN, OR RUNS ALL OF. Sent only beside a\n * discovered offer, to a build that lists `catalog` in `accepts`. Each option\n * is a real offer: its own id, its own spec in `specs`, and its own one\n * payment, so `request({id, choice})` runs exactly the spec\n * `request({id: option.id})` would. `all` runs every option side by side, one\n * payment each. The set is the server's data: changing it is a deploy there,\n * not a release here. `input` names the open fields the options share, the\n * only ones an `all` call may carry.\n */\nexport const ChoicesSchema = z.strictObject({\n group: PlainLine(64),\n default: PlainLine(64),\n input: z.array(PlainLine(64)).min(1).max(16),\n options: z\n .array(\n z.strictObject({\n key: PlainLine(64),\n label: PlainLine(120),\n strength: PlainLine(300),\n id: IdSchema,\n }),\n )\n .min(2)\n .max(4),\n all: z.strictObject({ totalAtomic: z.string().regex(/^\\d+$/) }),\n});\nexport type Choices = z.infer<typeof ChoicesSchema>;\n\n/** The word that runs every option, so no option may take it as its key. */\nexport const ALL_CHOICES = 'all';\n\n/**\n * A CHOICE NAMES ONLY WHAT THIS ANSWER CARRIES: each key and id once, `all`\n * free for the whole set, a spec for every option, and the default option is\n * the offer this answer's id already names. A set that breaks any of these is\n * a protocol error, and the turn falls back like any unreadable answer.\n */\nfunction checkChoices(\n decision: { id: string; specs?: { id: string }[] | undefined; choices?: Choices | undefined },\n ctx: z.RefinementCtx,\n): void {\n const { choices } = decision;\n if (choices === undefined) return;\n const issue = (message: string) => ctx.addIssue({ code: 'custom', path: ['choices'], message });\n const keys = choices.options.map((option) => option.key);\n const ids = choices.options.map((option) => option.id);\n if (new Set(keys).size !== keys.length) issue('each choice key is named once');\n if (new Set(ids).size !== ids.length) issue('each choice id is named once');\n if (keys.includes(ALL_CHOICES)) issue(`\"${ALL_CHOICES}\" runs every choice, so it is no key`);\n const specIds = new Set((decision.specs ?? []).map((spec) => spec.id));\n if (ids.some((id) => !specIds.has(id))) issue('every choice carries its spec');\n const fallback = choices.options.find((option) => option.key === choices.default);\n if (fallback === undefined) issue('the default is one of the choices');\n else if (fallback.id !== decision.id) issue(\"the default choice is this answer's own offer\");\n}\n\n/** The same answer on both calls: the hook's offer, and the tool's answer\n * when a query with no id found a service nobody curated. */\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 choices: ChoicesSchema.optional(),\n })\n .superRefine(checkHint)\n .superRefine(checkChoices);\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 * `catalog` takes Tenjin's reviewed list of third-party services as\n * `discovered` offers under their catalog ids, with each spec's `holds` and\n * `output`, and `choices`, a set of options the user picks between or runs\n * all of, beside a discovered offer from a compare group. A build that sends\n * `discovered` in its place gets the same services under their\n * `discovered:tenjin:` ids. `spec` asks for each offered service's request\n * spec beside its line, and for the picked service's spec in place of a\n * decision on a query with no id, which only a build that parses them can\n * take: the decision schemas are strict. `bazaar` widens discovery to the\n * open Bazaar and is sent only while `experimental.bazaar` is on.\n */\nexport const CLIENT_ACCEPTS: readonly string[] = ['catalog', '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/** Why a call from a spec stopped before anything was signed: the input did\n * not fit, the live terms were not the spec's, the provider answered\n * something else, it could not be reached, or the wallet could not pay. */\nexport type UnpaidReason = 'input' | 'terms' | 'provider' | 'unreachable' | 'wallet';\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 /** `unpaid`: stopped before anything was signed, which the server never\n * counts as the offer taken. */\n status: 'fulfilled' | 'unverified' | 'failed' | 'needs_approval' | 'unpaid';\n /** On `unpaid` only, where the server requires it. */\n reason?: UnpaidReason;\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 * or that a call for it stopped before payment and why. Never throws and never\n * waits on anything the caller needs: a lost report 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.reason !== undefined ? { reason: outcome.reason } : {}),\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;AACX,CAAC;AAQD,IAAM,oBAAoB,iBAAE,OAAO;AAAA,EACjC,YAAY,iBAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EACpC,OAAO,iBAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EAC/B,SAAS,iBAAE,MAAM,iBAAE,OAAO,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE;AAAA,EAC5C,YAAY,iBAAE,OAAO,EAAE,IAAI,GAAG;AAChC,CAAC;AAiBD,IAAM,WAAW,iBACd,OAAO,EACP,MAAM,uBAAu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;AAAA;AAAA;AAAA,MAGR,QACE,UAAU,OACN,gCAAgC,SAAS,MAAM,MAC/C,gCAAgC,SAAS,MAAM,KAAK,MAAM,IAAI,MAAM,MAAM,OAAO;AAAA,MACvF,GAAI,UAAU,OAAO,EAAE,WAAW,MAAM,KAAK,IAAI,CAAC;AAAA,IACpD;AAAA,EACF;AACA,QAAM,SAAS,OAAO,UAAU,SAAS,IAAI;AAC7C,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO,EAAE,QAAQ,UAAU,QAAQ,yDAAyD;AAAA,EAC9F;AACA,SAAO,EAAE,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":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/router/doctor.ts"],"sourcesContent":["import { readFile, readdir } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { FileClientChannelStorage } from '@x402/evm/batch-settlement/client/file-storage';\nimport pkg from '../../package.json';\nimport { loadRawConfig } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { toMoney } from '../lib/money';\nimport { evaluateSpendPolicy, type SpendPolicy } from '../lib/policy';\nimport { resolveContextSettings, type ResolvedSettings } from '../lib/settings';\nimport { spentOf } from '../lib/spend-ledger';\nimport { readUsdcBalance } from '../lib/usdc-balance';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport { readSpendSummary } from '../lib/wallet/spend';\nimport { walletFileExists } from '../lib/wallet/store';\nimport type { CommandContext, CommandResult } from '../context';\nimport { agentsWithoutRequestTool } from './agent-tools';\nimport { readAliveStamp } from './alive';\nimport {\n CLAUDE_CODE_FLOOR,\n claudeConfigDir,\n findClaudeBinary,\n readClaudeCode,\n runClaude,\n type ClaudeBinary,\n type ClaudeCodeState,\n} from './claude-cli';\nimport {\n CHANNEL_DEPOSIT_ATOMIC,\n feeRefusal,\n MIN_DEPOSIT_ATOMIC,\n payerDir,\n ROUTING_FEE_ATOMIC,\n unpaid,\n usd,\n} from './fee';\nimport { loadStep, pluginProof, settingsInstallPaths } from './install';\nimport { inspectLegacyInstall, type LegacyInstall } from './legacy-install';\nimport { routerSettings, type RouterSettings } from './settings';\nimport { PLUGIN_ID, PLUGIN_SERVER, REQUEST_TOOL } from './names';\nimport { folderState, readPluginListing, type PluginScope } from './plugin-registration';\nimport { probeRouter, type RouterCheck } from './reachability';\nimport { readMcpServers, type InstalledAt, type ListMcpProcesses } from './mcp-processes';\nimport { clearRouterMemo, readRouterMemo, type RouterMemo } from './router-memo';\nimport {\n ACCEPT_COMMAND,\n OWN_LIMITS_COMMANDS,\n shownLimits,\n spendQuestion,\n type RouterLimits,\n} from './spend-question';\n\n/**\n * `tenjin doctor` for the router product: the things that decide whether a\n * lookup can happen at all, read and never written.\n *\n * THE PLUGIN IS ASKED ABOUT THROUGH CLAUDE CODE ITSELF: `claude --version`\n * against the floor, `claude plugin list --json` for the plugin and its\n * version, and `claude mcp get` for its `router` server. With no binary, the\n * plugin folder and the `alive` stamp stand in. A settings install of an\n * earlier release is reported with its migration state; doctor never migrates.\n *\n * EVERY FIX IS A STEP THE AGENT TAKES IN THE SESSION: a command it runs, or a\n * slash command the person types there. None sends anyone out of Claude Code.\n *\n * THE SHELF'S DOCTOR IS NOT THIS ONE. It stays with the product it belongs to\n * (`src/commands/doctor.ts`, unregistered), and this one reports the router's\n * own wiring.\n */\n\nexport type { RouterCheck };\n\nexport interface RouterDoctorDeps {\n homeDir?: string;\n cwd?: string;\n /** Check the project install, as `install --project` registered it. */\n project?: boolean;\n env?: NodeJS.ProcessEnv;\n /** Finds the `claude` binary; tests inject one. */\n findClaude?: (env: NodeJS.ProcessEnv) => ClaudeBinary | null;\n fetchImpl?: typeof fetch;\n /** Node's own version, for the floor check. */\n nodeVersion?: string;\n /** This user's running `tenjin mcp` processes; tests inject them. */\n listMcpProcesses?: ListMcpProcesses;\n /** When this build was installed; tests inject it. */\n installedAt?: InstalledAt;\n now?: () => number;\n}\n\nconst NODE_FLOOR = 22;\n\nexport async function runRouterDoctor(\n ctx: CommandContext,\n deps: RouterDoctorDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n const cwd = deps.cwd ?? process.cwd();\n const project = deps.project === true;\n // From the directory doctor runs in, which is the one a session there would use.\n const router = await routerSettings(\n { cwd, dataDir: ctx.dataDir },\n deps.homeDir !== undefined ? { homeDir: deps.homeDir } : {},\n ).catch((err: unknown) => (err instanceof Error ? err : new Error(String(err))));\n const settings = await resolveContextSettings(ctx);\n const claude = await readClaudeCode(env, cwd, deps.findClaude ?? findClaudeBinary);\n const scope: PluginScope = project ? 'local' : 'user';\n const paths = settingsInstallPaths(project, env, home, cwd);\n const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);\n\n const checks: RouterCheck[] = [nodeCheck(deps.nodeVersion ?? process.version)];\n checks.push(claudeCodeCheck(claude));\n const plugin = await pluginCheck(claude, { scope, env, home, cwd, dataDir: ctx.dataDir, legacy });\n checks.push(plugin.check);\n if (plugin.registered && claude.binary !== null) {\n checks.push(await serverCheck(claude.binary, env, cwd));\n }\n if (legacy.present || legacy.unreadable !== undefined) {\n checks.push(await migrationCheck(legacy, claude, ctx.dataDir, env, cwd));\n }\n checks.push(routingCheck(router));\n checks.push((await readMcpServers(deps, { settingsInstallPending: legacy.present })).check);\n const rawConfig = await loadRawConfig(ctx.dataDir);\n const unanswered =\n rawConfig.maxAutoSpend === undefined ? { limits: shownLimits(rawConfig) } : null;\n checks.push(\n spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic, unanswered),\n );\n checks.push(experimentalCheck(settings.experimentalBazaar));\n checks.push(await routingFeeCheck(ctx, settings, deps.fetchImpl, unanswered));\n checks.push(...(await walletCheck(ctx)));\n const now = deps.now?.() ?? Date.now();\n const probe = await probeRouter(settings.baseUrl, {\n timeoutMs: ctx.flags.timeout,\n env,\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n });\n // A probe the router answered ends the routing legs' backoff at once.\n if (probe.status === 'ok') {\n await clearRouterMemo(ctx.dataDir, 'unreachable', settings.baseUrl);\n checks.push(probe);\n } else {\n checks.push(\n withBackoff(\n probe,\n await readRouterMemo(ctx.dataDir, 'unreachable', settings.baseUrl, now),\n now,\n ),\n );\n }\n const agents = await subagentsCheck(cwd, home);\n if (agents !== null) checks.push(agents);\n\n const failure = checks.find((c) => c.status === 'fail' && c.required);\n const data = {\n checks,\n dataDir: ctx.dataDir,\n baseUrl: settings.baseUrl,\n settingsPath: paths.settingsPath,\n };\n if (failure !== undefined) {\n // REFUSED, the exit-3 class: a machine this command found unready is\n // understood and refused, not a runtime failure of the command itself.\n throw new CliError('REFUSED', failure.detail, {\n ...(failure.fix !== undefined ? { fix: failure.fix } : {}),\n details: data,\n });\n }\n return { data, humanLines: doctorLines(checks) };\n}\n\n/** The human report: one line a check, and under each row to look at, its\n * fix, as `--json` carries it. */\nexport function doctorLines(checks: RouterCheck[]): string[] {\n const bad = checks.filter((c) => c.status !== 'ok').length;\n return [\n ...checks.flatMap((c) => [\n `${c.status === 'ok' ? 'ok ' : c.status === 'warn' ? 'warn' : 'fail'} ${c.name}: ${c.detail}`,\n ...(c.status !== 'ok' && c.fix !== undefined ? [` fix: ${c.fix}`] : []),\n ]),\n bad === 0\n ? `${checks.length} checks, all pass.`\n : `${checks.length} checks, ${bad} to look at.`,\n ];\n}\n\n/**\n * The routing legs' backoff, named on a router line whose probe failed too.\n * It ends by itself after its minute, or when a probe here reaches the router.\n */\nfunction withBackoff(check: RouterCheck, memo: RouterMemo | null, now: number): RouterCheck {\n if (memo === null) return check;\n const left = Math.max(1, Math.ceil((memo.until - now) / 1000));\n return {\n ...check,\n status: check.status === 'ok' ? 'warn' : check.status,\n detail: `${check.detail}; routing calls skip the router for ${left}s more, after one did not reach it`,\n };\n}\n\n/**\n * INFORMATIONAL, NEVER A FAILURE. A custom agent whose `tools:` leave the\n * request tool out is a choice its author may have meant, so this names those\n * agents and the one line that would change it, and counts as passing. It is\n * absent when there is nothing to name. The files are only read.\n */\nasync function subagentsCheck(cwd: string, homeDir: string): Promise<RouterCheck | null> {\n const excluded = await agentsWithoutRequestTool({ cwd, homeDir }, REQUEST_TOOL);\n if (excluded.length === 0) return null;\n return {\n name: 'subagents',\n status: 'ok',\n required: false,\n detail: `${excluded.join(', ')} ${excluded.length === 1 ? 'is' : 'are'} offered no paid lookups: add ${REQUEST_TOOL} to tools: to allow paid lookups there`,\n };\n}\n\nfunction nodeCheck(version: string): RouterCheck {\n const major = Number(/^v(\\d+)/.exec(version)?.[1] ?? '0');\n return major >= NODE_FLOOR\n ? { name: 'node', status: 'ok', required: true, detail: version }\n : {\n name: 'node',\n status: 'fail',\n required: true,\n detail: `${version} is below the Node ${NODE_FLOOR} floor.`,\n fix: `Install Node ${NODE_FLOOR} or newer, then re-run \\`tenjin doctor\\`.`,\n };\n}\n\n/** Claude Code's version against the plugin's floor. */\nfunction claudeCodeCheck(claude: ClaudeCodeState): RouterCheck {\n const name = 'claude code';\n if (claude.binary === null) {\n return {\n name,\n status: 'warn',\n required: false,\n detail:\n 'no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so the plugin was checked from its folder only',\n fix: 'Run `tenjin doctor` from a Claude Code session, where CLAUDE_CODE_EXECPATH names the binary.',\n };\n }\n if (claude.version === null) {\n return {\n name,\n status: 'warn',\n required: false,\n detail: `${claude.binary.path} did not report a version`,\n };\n }\n if (!claude.meetsFloor) {\n return {\n name,\n status: 'fail',\n required: true,\n detail: `Claude Code ${claude.version} is older than ${CLAUDE_CODE_FLOOR}, which the Tenjin plugin needs`,\n ...(claude.fix !== undefined ? { fix: claude.fix } : {}),\n };\n }\n return {\n name,\n status: 'ok',\n required: true,\n detail: `${claude.version}${claude.binary.source === 'execpath' ? ' (from CLAUDE_CODE_EXECPATH)' : ''}`,\n };\n}\n\ninterface PluginContext {\n scope: PluginScope;\n env: NodeJS.ProcessEnv;\n home: string;\n cwd: string;\n dataDir: string;\n legacy: LegacyInstall;\n}\n\n/**\n * The plugin: listed and enabled at this CLI's version, or, with no binary to\n * ask, its folder and the `alive` stamp. A machine that still routes through a\n * settings install of an earlier release warns rather than fails.\n */\nasync function pluginCheck(\n claude: ClaudeCodeState,\n c: PluginContext,\n): Promise<{ check: RouterCheck; registered: boolean }> {\n const name = 'plugin';\n const missing = (detail: string): { check: RouterCheck; registered: boolean } => ({\n registered: false,\n check: c.legacy.present\n ? {\n name,\n status: 'warn',\n required: false,\n detail: `${detail}; the settings install of an earlier release still routes here`,\n fix: claude.meetsFloor\n ? `Run \\`tenjin install${c.scope === 'local' ? ' --project' : ''}\\` to move this machine to the plugin.`\n : `Run \\`claude update\\`, then \\`tenjin install${c.scope === 'local' ? ' --project' : ''}\\` to move this machine to the plugin.`,\n }\n : {\n name,\n status: 'fail',\n required: true,\n detail,\n fix: `Run \\`tenjin install${c.scope === 'local' ? ' --project' : ''}\\`.`,\n },\n });\n if (claude.binary !== null) {\n const listing = await readPluginListing(claude.binary, c.env, c.cwd);\n if (!listing.read) {\n return {\n registered: false,\n check: {\n name,\n status: 'warn',\n required: false,\n detail: \"Claude Code's plugin list could not be read, so the plugin was not checked\",\n fix: 'Run `tenjin doctor` again in a moment.',\n },\n };\n }\n if (listing.id === null) return missing(`${PLUGIN_ID} is not installed in Claude Code`);\n if (!listing.enabled) {\n return {\n registered: false,\n check: {\n name,\n status: 'fail',\n required: true,\n detail: `${listing.id} is installed but disabled, so no lookup is routed`,\n fix: `Run \\`claude plugin enable ${listing.id}\\`, then ${loadStep(c.legacy.present)}.`,\n },\n };\n }\n if (listing.version !== pkg.version) {\n return {\n registered: true,\n check: {\n name,\n status: 'warn',\n required: false,\n detail: `${listing.id} is enabled at ${listing.version ?? 'an unknown version'}, and this CLI is ${pkg.version}`,\n fix: 'Run `tenjin install --refresh` to register this version.',\n },\n };\n }\n return {\n registered: true,\n check: { name, status: 'ok', required: true, detail: `${listing.id} ${pkg.version} enabled` },\n };\n }\n const folder = await folderState(c.scope, c.env, c.home, c.cwd);\n if (folder.state === 'foreign') {\n return {\n registered: false,\n check: {\n name,\n status: 'fail',\n required: true,\n detail: `${folder.path} is there and is not a folder this CLI wrote, so the plugin cannot be written`,\n fix: `Move ${folder.path} aside, then run \\`tenjin install\\` again.`,\n },\n };\n }\n if (folder.state === 'ours') {\n const stamp = await readAliveStamp(c.dataDir);\n return {\n registered: true,\n check:\n stamp === null\n ? {\n name,\n status: 'warn',\n required: false,\n detail: `the plugin folder is at ${folder.path} and has not loaded in a session yet`,\n fix: `To load it, ${loadStep(c.legacy.present)}.`,\n }\n : {\n name,\n status: 'ok',\n required: true,\n detail: `the plugin folder at ${folder.path} loaded, last at ${stamp.at}`,\n },\n };\n }\n if (await listedInClaudeFiles(c.env, c.home)) {\n return {\n registered: true,\n check: {\n name,\n status: 'warn',\n required: false,\n detail: `${PLUGIN_ID} is registered, and there is no claude binary here to check it`,\n fix: 'Run `tenjin doctor` from a Claude Code session to check it.',\n },\n };\n }\n return missing(`${PLUGIN_ID} is not registered`);\n}\n\n/** Claude Code's own record, read when no binary can be asked. */\nasync function listedInClaudeFiles(env: NodeJS.ProcessEnv, home: string): Promise<boolean> {\n try {\n const raw = await readFile(\n join(claudeConfigDir(env, home), 'plugins', 'installed_plugins.json'),\n 'utf8',\n );\n const plugins = (JSON.parse(raw) as { plugins?: unknown }).plugins;\n return plugins !== null && typeof plugins === 'object' && PLUGIN_ID in plugins;\n } catch {\n return false;\n }\n}\n\n/**\n * The plugin's `router` server, through `claude mcp get`, which starts it the\n * way a session would and reports whether it answered. It starts `tenjin mcp`\n * from the PATH Claude Code sees, so a `tenjin` that is not on that PATH shows\n * up here as a server that fails to connect.\n */\nasync function serverCheck(\n binary: ClaudeBinary,\n env: NodeJS.ProcessEnv,\n cwd: string,\n): Promise<RouterCheck> {\n const name = 'router server';\n const run = await runClaude(binary, ['mcp', 'get', PLUGIN_SERVER], {\n env,\n cwd,\n timeoutMs: 45_000,\n });\n const status = /Status:\\s*(.+)/.exec(run.stdout)?.[1]?.trim();\n if (\n run.code === 0 &&\n status !== undefined &&\n /connected/i.test(status) &&\n !/fail/i.test(status)\n ) {\n return { name, status: 'ok', required: true, detail: `${PLUGIN_SERVER} connected` };\n }\n return {\n name,\n status: 'fail',\n required: true,\n detail: `${PLUGIN_SERVER} did not connect${status !== undefined ? `: ${status.slice(0, 200)}` : ''}`,\n fix: 'Run `tenjin --version` in this session: the plugin starts `tenjin mcp` from PATH, so it must print a version.',\n };\n}\n\n/**\n * A settings install of an earlier release: what is left, and whether the\n * next `tenjin install` or `tenjin update` removes it. Never a failure, and\n * never written here.\n */\nasync function migrationCheck(\n legacy: LegacyInstall,\n claude: ClaudeCodeState,\n dataDir: string,\n env: NodeJS.ProcessEnv,\n cwd: string,\n): Promise<RouterCheck> {\n const name = 'settings install';\n if (legacy.unreadable !== undefined) {\n return { name, status: 'warn', required: false, detail: legacy.unreadable };\n }\n const parts = [\n ...(legacy.events.length > 0 ? [`hook entries (${legacy.events.join(', ')})`] : []),\n ...(legacy.allowRule || legacy.denyRule ? ['permission rules'] : []),\n ...(legacy.statusLine === 'ours' || legacy.statusLine === 'composed' ? ['a status line'] : []),\n ...(legacy.mcp === 'ok' ? ['the x402 MCP server'] : []),\n ];\n const found = `${parts.join(', ')} from an earlier release in ${legacy.settingsPath}`;\n const lookalikes =\n legacy.lookalikes.length > 0\n ? `; not Tenjin's and left alone: ${legacy.lookalikes.join(', ')}`\n : '';\n const proof = await pluginProof(claude, dataDir, env, cwd);\n return proof.proven\n ? {\n name,\n status: 'warn',\n required: false,\n detail: `${found}, ready to remove: the plugin has loaded here${lookalikes}`,\n fix: 'Run `tenjin install --refresh` to remove it.',\n }\n : {\n name,\n status: 'warn',\n required: false,\n detail: `${found}, kept until the plugin loads: ${proof.reason}${lookalikes}`,\n fix: claude.meetsFloor\n ? `To load the plugin, ${loadStep(true)}; the next \\`tenjin install\\` or \\`tenjin update\\` then removes the old entries.`\n : 'Run `claude update`, then `tenjin install`: until then the old entries keep routing.',\n };\n}\n\n/**\n * WIRED BUT SWITCHED OFF is a choice, not a fault, so it warns and names the\n * file that made it.\n */\nfunction routingCheck(router: RouterSettings | Error): RouterCheck {\n const name = 'routing';\n if (router instanceof Error) {\n return {\n name,\n status: 'warn',\n required: false,\n detail: `the router is off here: ${router.message}`,\n fix: 'Fix or delete that file.',\n };\n }\n if (!router.enabled.value) {\n const file = router.enabled.path ?? 'the config';\n return {\n name,\n status: 'warn',\n required: false,\n detail: `router.enabled is false in ${file}, so nothing is routed from this directory`,\n fix:\n router.enabled.source === 'file'\n ? 'Run `tenjin config set router.enabled true` to route again.'\n : `Remove router.enabled from ${file} to route here again.`,\n };\n }\n return { name, status: 'ok', required: false, detail: 'on' };\n}\n\n/**\n * THE ROUTING FEE, AS THE NEXT PAID CALL WOULD MEET IT: the reasons the session\n * notice gives (`unpaid`), worked out here from the wallet, the spend limits,\n * the ledger and the channel the SDK keeps. Never a failure: a call the fee\n * cannot pay takes the free path. A payment that failed in a session leaves\n * nothing to read here; these are the causes this can check.\n */\nasync function routingFeeCheck(\n ctx: CommandContext,\n settings: ResolvedSettings,\n fetchImpl: typeof fetch | undefined,\n unanswered: { limits: RouterLimits } | null,\n): Promise<RouterCheck> {\n let host: string;\n try {\n host = new URL(settings.baseUrl).host;\n } catch {\n // The router check below names the bad base URL and its fix.\n return {\n name: 'routing fee',\n status: 'warn',\n required: false,\n detail: 'not checked, because the base URL is not a URL',\n };\n }\n const why = await routingFeeBlock({\n dataDir: ctx.dataDir,\n policy: settings.policy,\n rpcUrl: settings.rpcUrl,\n host,\n timeoutMs: ctx.flags.timeout,\n provider: (await walletFileExists(ctx.dataDir)) ? resolveWalletProvider(ctx) : null,\n ...(fetchImpl !== undefined ? { fetchImpl } : {}),\n }).catch(() => null);\n return routingFeeRow(why, host, unanswered);\n}\n\n/** The routing-fee row for what {@link routingFeeBlock} found. */\nexport function routingFeeRow(\n why: string | null,\n host: string,\n unanswered: { limits: RouterLimits } | null,\n): RouterCheck {\n const u = why === null ? null : unpaid(why);\n if (why === null || u === null) {\n return {\n name: 'routing fee',\n status: 'ok',\n required: false,\n detail: `$${usd(ROUTING_FEE_ATOMIC)} a call, paid from channel deposits of up to $${usd(CHANNEL_DEPOSIT_ATOMIC)} that count against the spend limits`,\n };\n }\n if (why === 'limit_below_deposit' && unanswered !== null) {\n // The zero is the open spend question, not a limit anyone chose: the fix\n // is the question itself, with the fee terms it approves.\n return {\n name: 'routing fee',\n status: 'warn',\n required: false,\n detail: 'the spend limits are not answered yet, so routing calls take the free path',\n fix: `Answer the spend question: ${spendQuestion(unanswered.limits)} For a yes, run \\`${ACCEPT_COMMAND}\\`; for other amounts, ${OWN_LIMITS_COMMANDS}.`,\n };\n }\n const fixes: Record<string, string> = {\n no_wallet: 'Run `tenjin wallet create`, then `tenjin wallet fund 0.25`.',\n limit_below_deposit: `Raise it with \\`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\\`.`,\n budget_reached:\n 'Room comes back as the rolling day passes, or raise it with `tenjin config set sessionBudget <usd>`.',\n not_allowlisted: `Add ${host} to allowlistCreators, or clear the allowlist.`,\n };\n return {\n name: 'routing fee',\n status: 'warn',\n required: false,\n detail: `${u.reason}, so routing calls take the free path`,\n fix: fixes[why] ?? u.fix,\n };\n}\n\n/** What {@link routingFeeBlock} reads; `provider` is null with no wallet. */\nexport interface RoutingFeeInput {\n dataDir: string;\n policy: SpendPolicy;\n rpcUrl: string;\n /** The router's host, the creator a deposit pays. */\n host: string;\n timeoutMs: number;\n provider: WalletProvider | null;\n fetchImpl?: typeof fetch;\n}\n\n/** Why the next deposit would be refused, or null when the fee can be paid. */\nexport async function routingFeeBlock(input: RoutingFeeInput): Promise<string | null> {\n const { provider, policy } = input;\n // The fee's per-payment checks first, before the wallet, as the payer runs\n // them on every call: a channel with credit pays nothing they refuse, and\n // unanswered limits are the question to name, not the passphrase.\n const refused = feeRefusal(policy, input.host);\n if (refused !== null) return refused;\n if (provider === null) return 'no_wallet';\n const verified = await provider.verify?.().catch(() => null);\n if (verified !== undefined && verified !== null && verified.status !== 'verified') {\n return 'wallet_locked';\n }\n const ledger = await readSpendSummary(input.dataDir);\n const spent = ledger === null ? 0n : spentOf(ledger);\n const { address } = await describeWallet(provider);\n if ((await channelCredit(input.dataDir, address)) >= ROUTING_FEE_ATOMIC) return null;\n const deposit =\n policy.maxAutoSpendAtomic < CHANNEL_DEPOSIT_ATOMIC\n ? policy.maxAutoSpendAtomic\n : CHANNEL_DEPOSIT_ATOMIC;\n if (deposit < MIN_DEPOSIT_ATOMIC) return 'limit_below_deposit';\n const evaluation = evaluateSpendPolicy(policy, {\n mode: 'automatic',\n amountAtomic: deposit,\n creator: input.host,\n sessionSpentAtomic: spent,\n });\n if (evaluation.reason === 'not_allowlisted') return 'not_allowlisted';\n if (evaluation.reason === 'session_budget_exceeded') return 'budget_reached';\n const balance = await readUsdcBalance(address, input.rpcUrl, {\n timeoutMs: input.timeoutMs,\n ...(input.fetchImpl !== undefined ? { fetchImpl: input.fetchImpl } : {}),\n });\n return balance !== null && balance < deposit ? 'wallet_low' : null;\n}\n\n/** What the wallet's routing channel still holds for fees, from the SDK's own files. */\nasync function channelCredit(dataDir: string, address: string): Promise<bigint> {\n const dir = payerDir(dataDir, address);\n const storage = new FileClientChannelStorage({ directory: dir });\n let best = 0n;\n for (const name of await readdir(join(dir, 'client')).catch(() => [] as string[])) {\n const id = /^(0x[0-9a-f]{64})\\.json$/.exec(name)?.[1];\n const channel = id === undefined ? undefined : await storage.get(id).catch(() => undefined);\n if (channel === undefined) continue;\n const credit = BigInt(channel.balance ?? '0') - BigInt(channel.chargedCumulativeAmount ?? '0');\n if (credit > best) best = credit;\n }\n return best;\n}\n\n/** INFORMATIONAL: which experiment is on, in one line. Either state passes. */\nfunction experimentalCheck(bazaar: boolean): RouterCheck {\n return {\n name: 'experimental',\n status: 'ok',\n required: false,\n detail: bazaar\n ? 'list: on; bazaar: on (experimental): the router may also suggest unreviewed sellers from the open x402 Bazaar'\n : 'list: on; bazaar: off (experimental): `tenjin config set experimental.bazaar on` to add the open x402 Bazaar',\n };\n}\n\n/**\n * `unanswered` is set when the config file names no `maxAutoSpend`: the state\n * an install that could not ask leaves, the same as a cancel at its selector.\n * The code default's zero holds, and that is a question still open, not a\n * broken machine, so it warns with the question and its one-step yes, and the\n * checks after it (the router probe above all) still print. A 0 the user\n * wrote is their answer and stays a failure.\n */\nfunction spendCheck(\n maxAutoSpendAtomic: bigint,\n sessionBudgetAtomic: bigint | null,\n unanswered: { limits: RouterLimits } | null,\n): RouterCheck {\n if (sessionBudgetAtomic === 0n) {\n return {\n name: 'spend',\n status: 'fail',\n required: true,\n detail: 'The daily limit is 0, so positive payments are refused even with --yes.',\n fix: 'Choose a daily limit with `tenjin config set sessionBudget <usd|none>`.',\n };\n }\n if (maxAutoSpendAtomic === 0n && unanswered !== null) {\n return {\n name: 'spend',\n status: 'warn',\n required: false,\n detail: `the spend limits are not answered yet, so automatic payments are off and every lookup needs approval. Ask the user: ${spendQuestion(unanswered.limits)}`,\n fix: `Answer the spend question: for a yes, run \\`${ACCEPT_COMMAND}\\`; for other amounts, ${OWN_LIMITS_COMMANDS}.`,\n };\n }\n if (maxAutoSpendAtomic === 0n) {\n return {\n name: 'spend',\n status: 'fail',\n required: true,\n detail: 'maxAutoSpend is 0, so every lookup needs approval and none can pay',\n fix: 'Set a per-call limit with `tenjin config set maxAutoSpend <usd>`.',\n };\n }\n const budget =\n sessionBudgetAtomic === null\n ? 'no daily ceiling'\n : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;\n return {\n name: 'spend',\n status: sessionBudgetAtomic === null ? 'warn' : 'ok',\n required: false,\n detail: `automatic approval up to ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,\n ...(sessionBudgetAtomic === null\n ? { fix: 'Set one with `tenjin config set sessionBudget 1.00`.' }\n : {}),\n };\n}\n\nasync function walletCheck(ctx: CommandContext): Promise<RouterCheck[]> {\n if (!(await walletFileExists(ctx.dataDir))) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: 'no wallet on this machine, so nothing can pay',\n fix: 'Run `tenjin wallet create`, then `tenjin wallet fund`.',\n },\n ];\n }\n try {\n const described = await describeWallet(resolveWalletProvider(ctx));\n return [{ name: 'wallet', status: 'ok', required: true, detail: described.address }];\n } catch (err) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: err instanceof CliError ? err.message : String(err),\n ...(err instanceof CliError && err.fix !== undefined ? { fix: err.fix } : {}),\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,eAAe;AAClC,SAAS,eAAe;AACxB,SAAS,YAAY;AAwFrB,IAAM,aAAa;AAEnB,eAAsB,gBACpB,KACA,OAAyB,CAAC,GACF;AACxB,QAAM,MAAM,KAAK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AAA,IACV,QAAQ,4BAA4B,QAAQ,mBAAmB,SAAS,CAAC,EAAE,GAAG,gBAAgB,MAAM;AAAA,IACpG,GAAI,wBAAwB,OACxB,EAAE,KAAK,uDAAuD,IAC9D,CAAC;AAAA,EACP;AACF;AAEA,eAAe,YAAY,KAA6C;AACtE,MAAI,CAAE,MAAM,iBAAiB,IAAI,OAAO,GAAI;AAC1C,WAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACA,MAAI;AACF,UAAM,YAAY,MAAM,eAAe,sBAAsB,GAAG,CAAC;AACjE,WAAO,CAAC,EAAE,MAAM,UAAU,QAAQ,MAAM,UAAU,MAAM,QAAQ,UAAU,QAAQ,CAAC;AAAA,EACrF,SAAS,KAAK;AACZ,WAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,QAAQ,eAAe,WAAW,IAAI,UAAU,OAAO,GAAG;AAAA,QAC1D,GAAI,eAAe,YAAY,IAAI,QAAQ,SAAY,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC;AAAA,MAC7E;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,31 +0,0 @@
1
- import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import {
3
- STDIN_TIMEOUT_MS,
4
- runHookCommand,
5
- runHookKind
6
- } from "./chunk-DJYAPACT.js";
7
- import "./chunk-A5H3E5QA.js";
8
- import "./chunk-6KA4HFX5.js";
9
- import "./chunk-YFJJYHVG.js";
10
- import "./chunk-W6JX4LYF.js";
11
- import "./chunk-DYSDQE7S.js";
12
- import "./chunk-B2L53TMK.js";
13
- import "./chunk-7QKHZQKW.js";
14
- import "./chunk-KAMRYUK2.js";
15
- import "./chunk-ZO3X5NPG.js";
16
- import "./chunk-6W5GYG3W.js";
17
- import "./chunk-S4SAZ7OD.js";
18
- import "./chunk-UOW5JXYY.js";
19
- import "./chunk-2I4QTOLB.js";
20
- import "./chunk-ZP7AHN7Z.js";
21
- import "./chunk-FZTSGQVK.js";
22
- import "./chunk-QTND6XWJ.js";
23
- import "./chunk-K6AXXYCG.js";
24
- import "./chunk-RLPLYUME.js";
25
- import "./chunk-ZXTAQYNA.js";
26
- export {
27
- STDIN_TIMEOUT_MS,
28
- runHookCommand,
29
- runHookKind
30
- };
31
- //# sourceMappingURL=hook-command-PZHKS7ES.js.map