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

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 (112) hide show
  1. package/README.md +152 -38
  2. package/dist/{_esm-CE7KNONL.js → _esm-OVVGTKHH.js} +4 -4
  3. package/dist/{chunk-5QHHRMRA.js → chunk-2SQEFBAM.js} +4 -3
  4. package/dist/chunk-3KKKB2AQ.js +40 -0
  5. package/dist/chunk-3KKKB2AQ.js.map +1 -0
  6. package/dist/{chunk-LJ4DMVFI.js → chunk-3VYGDRRL.js} +5 -5
  7. package/dist/{chunk-PDA2BVFY.js → chunk-5DOHKQ24.js} +4 -15
  8. package/dist/chunk-5DOHKQ24.js.map +1 -0
  9. package/dist/{chunk-N35E6CM2.js → chunk-6DCELMQA.js} +6 -6
  10. package/dist/{chunk-WXC57XGG.js → chunk-A36LQPHV.js} +1 -1
  11. package/dist/chunk-A36LQPHV.js.map +1 -0
  12. package/dist/{chunk-56MOAIP5.js → chunk-A6CY6BUW.js} +11 -8
  13. package/dist/chunk-A6CY6BUW.js.map +1 -0
  14. package/dist/{chunk-TP4D47BY.js → chunk-AISBL7EY.js} +3 -3
  15. package/dist/{chunk-KK4YGYTV.js → chunk-AMG4SONW.js} +138 -58
  16. package/dist/chunk-AMG4SONW.js.map +1 -0
  17. package/dist/{chunk-AUKDYPPX.js → chunk-BG2EXNAA.js} +7 -6
  18. package/dist/chunk-BG2EXNAA.js.map +1 -0
  19. package/dist/{chunk-O4ZNKFRU.js → chunk-FHBGTOFA.js} +121 -40
  20. package/dist/chunk-FHBGTOFA.js.map +1 -0
  21. package/dist/{chunk-HPWO4O6S.js → chunk-FPUPBQHX.js} +2 -2
  22. package/dist/{chunk-3AUDA53C.js → chunk-KTAW4KGH.js} +6 -5
  23. package/dist/{chunk-J5INH7WB.js → chunk-LSWVVSFX.js} +106 -5
  24. package/dist/chunk-LSWVVSFX.js.map +1 -0
  25. package/dist/chunk-O2JYBOUO.js +47 -0
  26. package/dist/chunk-O2JYBOUO.js.map +1 -0
  27. package/dist/{chunk-5UDD5VSY.js → chunk-PZQRSZJV.js} +2 -2
  28. package/dist/{chunk-5UDD5VSY.js.map → chunk-PZQRSZJV.js.map} +1 -1
  29. package/dist/{chunk-QDD2RN7G.js → chunk-SCAOYGKX.js} +356 -90
  30. package/dist/chunk-SCAOYGKX.js.map +1 -0
  31. package/dist/{chunk-35M3VITA.js → chunk-TDGN476R.js} +60 -7
  32. package/dist/chunk-TDGN476R.js.map +1 -0
  33. package/dist/{chunk-AR7U7BRG.js → chunk-UNV4K45L.js} +12 -18
  34. package/dist/{chunk-AR7U7BRG.js.map → chunk-UNV4K45L.js.map} +1 -1
  35. package/dist/{chunk-MRGADYDD.js → chunk-VFVFVQM6.js} +4 -4
  36. package/dist/{chunk-2JGT3KDW.js → chunk-WUU3BH6G.js} +2 -2
  37. package/dist/{chunk-KUBEYXSO.js → chunk-XDADPAWW.js} +22 -22
  38. package/dist/{chunk-WGQVJM56.js → chunk-XNP6VUAJ.js} +3 -3
  39. package/dist/{chunk-AWQPGIR6.js → chunk-Y66XUXVI.js} +5 -5
  40. package/dist/{chunk-XZOEUYMX.js → chunk-ZDKEU2GF.js} +2 -2
  41. package/dist/{chunk-WLMJE3GJ.js → chunk-ZTFIQC4C.js} +2 -2
  42. package/dist/{cli-VHYYYYXM.js → cli-456F77ZY.js} +33 -28
  43. package/dist/{cli-VHYYYYXM.js.map → cli-456F77ZY.js.map} +1 -1
  44. package/dist/{config-5ADBAAXU.js → config-BLUWOH6S.js} +9 -12
  45. package/dist/{doctor-Q35VQW3S.js → doctor-PS45CR3T.js} +37 -29
  46. package/dist/{doctor-Q35VQW3S.js.map → doctor-PS45CR3T.js.map} +1 -1
  47. package/dist/{fund-GDDPL2BB.js → fund-4SW2ZBWC.js} +18 -17
  48. package/dist/{fund-GDDPL2BB.js.map → fund-4SW2ZBWC.js.map} +1 -1
  49. package/dist/{hook-command-PBERPRE3.js → hook-command-YTV7X333.js} +318 -37
  50. package/dist/hook-command-YTV7X333.js.map +1 -0
  51. package/dist/index.js +2 -2
  52. package/dist/{install-OKDKGUXM.js → install-U4BIDCHH.js} +14 -13
  53. package/dist/{install-wallet-SI4LZ73K.js → install-wallet-EYHELQMG.js} +15 -14
  54. package/dist/{install-wallet-SI4LZ73K.js.map → install-wallet-EYHELQMG.js.map} +1 -1
  55. package/dist/{mcp-XX3WRQEZ.js → mcp-AC4PIXH5.js} +43 -28
  56. package/dist/{mcp-XX3WRQEZ.js.map → mcp-AC4PIXH5.js.map} +1 -1
  57. package/dist/{pay-3SYKHKWJ.js → pay-VJOP6TFT.js} +24 -19
  58. package/dist/{send-LQRKTEJT.js → send-YH75Z6LB.js} +15 -14
  59. package/dist/{send-LQRKTEJT.js.map → send-YH75Z6LB.js.map} +1 -1
  60. package/dist/{status-FFC6FO72.js → status-5CHCDLUE.js} +24 -17
  61. package/dist/status-5CHCDLUE.js.map +1 -0
  62. package/dist/{status-line-SAXSU6CR.js → status-line-CZAZUOAY.js} +6 -6
  63. package/dist/{status-line-wiring-L2WYIYBM.js → status-line-wiring-2ABDVXSJ.js} +4 -4
  64. package/dist/tenjin-daemon.mjs +3 -14
  65. package/dist/{uninstall-OACH27UV.js → uninstall-BYVGAQMO.js} +36 -18
  66. package/dist/uninstall-BYVGAQMO.js.map +1 -0
  67. package/dist/{update-4W6EKLGZ.js → update-7QJDSHST.js} +5 -5
  68. package/dist/{viemAdapter-By13KInL-X2VY6CY3.js → viemAdapter-By13KInL-N2GIVMZ7.js} +2 -2
  69. package/dist/{wallet-BMEXRR3P.js → wallet-YZOXIXBC.js} +15 -14
  70. package/docs/agent-permissions.md +30 -14
  71. package/docs/safety-model.md +7 -1
  72. package/package.json +1 -1
  73. package/dist/chunk-35M3VITA.js.map +0 -1
  74. package/dist/chunk-56MOAIP5.js.map +0 -1
  75. package/dist/chunk-AUKDYPPX.js.map +0 -1
  76. package/dist/chunk-J5INH7WB.js.map +0 -1
  77. package/dist/chunk-KK4YGYTV.js.map +0 -1
  78. package/dist/chunk-O4ZNKFRU.js.map +0 -1
  79. package/dist/chunk-PDA2BVFY.js.map +0 -1
  80. package/dist/chunk-QDD2RN7G.js.map +0 -1
  81. package/dist/chunk-U2DZISAH.js +0 -111
  82. package/dist/chunk-U2DZISAH.js.map +0 -1
  83. package/dist/chunk-WS4JA6TC.js +0 -137
  84. package/dist/chunk-WS4JA6TC.js.map +0 -1
  85. package/dist/chunk-WXC57XGG.js.map +0 -1
  86. package/dist/hook-command-PBERPRE3.js.map +0 -1
  87. package/dist/skill-placement-JMDPSKE6.js +0 -299
  88. package/dist/skill-placement-JMDPSKE6.js.map +0 -1
  89. package/dist/status-FFC6FO72.js.map +0 -1
  90. package/dist/uninstall-OACH27UV.js.map +0 -1
  91. /package/dist/{_esm-CE7KNONL.js.map → _esm-OVVGTKHH.js.map} +0 -0
  92. /package/dist/{chunk-5QHHRMRA.js.map → chunk-2SQEFBAM.js.map} +0 -0
  93. /package/dist/{chunk-LJ4DMVFI.js.map → chunk-3VYGDRRL.js.map} +0 -0
  94. /package/dist/{chunk-N35E6CM2.js.map → chunk-6DCELMQA.js.map} +0 -0
  95. /package/dist/{chunk-TP4D47BY.js.map → chunk-AISBL7EY.js.map} +0 -0
  96. /package/dist/{chunk-HPWO4O6S.js.map → chunk-FPUPBQHX.js.map} +0 -0
  97. /package/dist/{chunk-3AUDA53C.js.map → chunk-KTAW4KGH.js.map} +0 -0
  98. /package/dist/{chunk-MRGADYDD.js.map → chunk-VFVFVQM6.js.map} +0 -0
  99. /package/dist/{chunk-2JGT3KDW.js.map → chunk-WUU3BH6G.js.map} +0 -0
  100. /package/dist/{chunk-KUBEYXSO.js.map → chunk-XDADPAWW.js.map} +0 -0
  101. /package/dist/{chunk-WGQVJM56.js.map → chunk-XNP6VUAJ.js.map} +0 -0
  102. /package/dist/{chunk-AWQPGIR6.js.map → chunk-Y66XUXVI.js.map} +0 -0
  103. /package/dist/{chunk-XZOEUYMX.js.map → chunk-ZDKEU2GF.js.map} +0 -0
  104. /package/dist/{chunk-WLMJE3GJ.js.map → chunk-ZTFIQC4C.js.map} +0 -0
  105. /package/dist/{config-5ADBAAXU.js.map → config-BLUWOH6S.js.map} +0 -0
  106. /package/dist/{install-OKDKGUXM.js.map → install-U4BIDCHH.js.map} +0 -0
  107. /package/dist/{pay-3SYKHKWJ.js.map → pay-VJOP6TFT.js.map} +0 -0
  108. /package/dist/{status-line-SAXSU6CR.js.map → status-line-CZAZUOAY.js.map} +0 -0
  109. /package/dist/{status-line-wiring-L2WYIYBM.js.map → status-line-wiring-2ABDVXSJ.js.map} +0 -0
  110. /package/dist/{update-4W6EKLGZ.js.map → update-7QJDSHST.js.map} +0 -0
  111. /package/dist/{viemAdapter-By13KInL-X2VY6CY3.js.map → viemAdapter-By13KInL-N2GIVMZ7.js.map} +0 -0
  112. /package/dist/{wallet-BMEXRR3P.js.map → wallet-YZOXIXBC.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/permissions.ts"],"sourcesContent":["/**\n * The recommended HARNESS permission allowlist: the exact rule lines an operator\n * pastes into Claude Code (or an equivalent harness) so auto mode stops denying\n * the free Tenjin verbs, and so the one paying verb is cleared deliberately\n * rather than by accident.\n *\n * This is a HARNESS-side allowlist (which shell commands the agent may run at\n * all). It is NOT the CLI's spend policy and shares nothing with it: the shipped\n * `allowlistCreators` config key gates WHO you may pay, this file gates WHICH\n * COMMANDS the harness will run without a prompt. The two are deliberately kept\n * apart in name and in code — clearing `Bash(tenjin buy:*)` here never raises a\n * spend cap. That is a claim about this file, NOT a claim that the spend policy\n * stops an allowlisted `buy`: `--yes` is an ordinary flag on an allowlisted verb\n * and `confirmSpend` returns true on it before any TTY check\n * (src/commands/buy.ts), so under CONFIG_DEFAULTS nothing denies. See\n * OPT_IN_ALLOWLIST's note for the walk-through.\n *\n * These are static, shipped constants on purpose: there is NO config key for\n * them. An operator-editable \"which commands may run\" list stored next to the\n * spend policy would be a second, weaker copy of a control the harness already\n * owns, and a CLI that could widen its own permission grant is exactly the shape\n * this file exists to avoid.\n *\n * Scope: `tenjin mcp` exposes the same command cores over MCP, where the harness\n * gates TOOLS, not Bash lines. These rules say nothing about that surface, which\n * is why `tenjin mcp` is itself never recommended here: clearing it would route\n * around every rule below. MCP_CAVEAT names the tools to leave gated for an\n * operator who runs the server anyway.\n *\n * LIMIT OF A PREFIX RULE, read this before adding an entry: the rule constrains\n * the VERB and nothing else. `addGlobalFlags` (src/cli.ts) puts `--json`,\n * `--timeout`, and `--base-url` on every leaf command, so every rule below also\n * clears `--base-url <url>` in trailing position. `--base-url` is validated as a\n * URL and nothing more, and it wins settings precedence, so it re-points the\n * trust boundary itself: the `search` question goes to that host, `doctor` probes\n * it, and `assertOnBaseOrigin` only checks that a resource URL shares an origin\n * with the CONFIGURED base, so an attacker-controlled pair satisfies the pin. No\n * prefix syntax expresses \"this verb but not that flag\", so the mitigation is\n * disclosure rather than a narrower rule: FLAG_CAVEAT rides the `--json` payload\n * and docs/agent-permissions.md, every human surface points at that page, and the\n * skills tell the agent never to pass `--base-url` on an allowlisted verb. Pinning\n * the paying path to a constant origin instead is the real fix and is an\n * x402/payments-semantics change, tracked separately.\n */\n\nimport type { PublishMode } from './config';\n\n/** One pasteable allowlist rule plus why it is safe (or what it costs). */\nexport interface AllowlistEntry {\n /** The exact line to add to the harness permission allowlist. */\n rule: string;\n /** The verb it clears. */\n command: string;\n /** Why it is safe to pre-clear, or what the operator is opting into. */\n note: string;\n}\n\n/** A verb deliberately kept OUT of the recommended allowlist, and why. */\nexport interface ExcludedVerb {\n command: string;\n reason: string;\n}\n\n/**\n * FREE verbs: they CANNOT SPEND. That is the whole definition of this tier, and\n * it is deliberately narrower than the older \"no wallet, no signing, no\n * payment\" — which stopped being true the moment `read` gained the ability to\n * recover an owned piece. `read` signs, with a P-256 delegation, and mints one\n * with a wallet signature when none is live; what it cannot do is produce the\n * secp256k1/EIP-712 signature a payment authorization needs (wrong curve), which\n * is test-pinned by its import graph never reaching the payment module. Money\n * stays out of reach; a signature, and the keystore access behind minting one,\n * no longer do, so the tier says what it means. `doctor` decrypts locally to\n * check the wallet still opens.\n *\n * What the tier does NOT claim, because it is not true: that the read scope\n * limits what a leaked delegation is worth. Scope is enforced only on the request\n * shape that carries both a session signature and the delegation header; the same\n * delegation replayed as a plain `SIGN-IN-WITH-X` takes a different server path\n * where no scope logic runs. So a session file is a wallet-derived credential\n * with the authority of the wallet behind it, and the mitigations that actually\n * hold are the ones in this repo: it is 0600, short-lived (≤24h, server-clamped),\n * bound to the origin it was minted for, and never presented off that origin.\n * Treat \"read is allowlisted\" as \"read may transmit that credential to the\n * configured origin\", and see FLAG_CAVEAT for why the configured origin is not\n * automatically the one you configured.\n *\n * Not all of them are read-only, and the difference is disclosed rather than\n * papered over — `search` POSTs the (generalized, anonymous) question off-machine\n * and records it locally, `outcome` POSTs a report that moves the marketplace's\n * reuse signal (both unauthenticated remote writes), and `read` writes locally,\n * saving a delivered piece to the library, and `doctor` decrypts the keystore\n * locally to check it opens. Pre-clearing them is defensible because they cost\n * nothing and none of it leaves the machine; calling them read-only to justify it\n * would not be.\n *\n * Rules are PREFIX rules: `Bash(tenjin search:*)` clears commands that start with\n * `tenjin search` and nothing else. The narrow `wallet show` / `wallet balance` /\n * The `config get` form is deliberate: a `Bash(tenjin wallet:*)`\n * or `Bash(tenjin config:*)` rule would silently swallow `wallet create` and\n * `config set`, and `config set` can raise the spend caps.\n *\n * Two known gaps, both fail-closed (denied, never wrongly allowed):\n * - Bare `tenjin config` (runConfigList) is as read-only as `config get`, but no\n * prefix rule reaches it without also covering `config set`, so it stays out.\n * Use `tenjin config get <key>`, which is a different supported command rather\n * than a reworded one.\n * - Group-level flag forms like `tenjin wallet --json show` are not covered.\n * Put global flags AFTER the leaf verb (`tenjin wallet show --json`); the\n * CLI parses either, and only the trailing form matches these rules.\n */\nexport const ALWAYS_SAFE_ALLOWLIST: readonly AllowlistEntry[] = [\n {\n rule: 'Bash(tenjin search:*)',\n command: 'tenjin search',\n note:\n 'Free anonymous marketplace search. No wallet, no signing, no payment. ' +\n 'Not read-only: it POSTs the generalized question off-machine and records ' +\n 'the search locally.',\n },\n {\n rule: 'Bash(tenjin wallet fund:*)',\n command: 'tenjin wallet fund',\n note:\n 'Owner call (2026-08-12): free on both surfaces, because the command just opens the ' +\n 'fund modal. Minting moves no money: the destination is server-pinned to the wallet ' +\n 'that signed, the CLI refuses any checkout host but pay.coinbase.com, and payment ' +\n 'happens behind Coinbase\\u2019s own human gate. The usual --base-url caveat does not ' +\n 'apply: fund is pinned to the production origin and takes no override from flag, ' +\n 'env, or config.',\n },\n {\n rule: 'Bash(tenjin inspect:*)',\n command: 'tenjin inspect',\n note: 'Free pre-purchase card and preview. Never signs, never pays, never saves.',\n },\n {\n rule: 'Bash(tenjin read:*)',\n command: 'tenjin read',\n note:\n 'Free-only delivery: free pieces, local-library re-reads, and pieces this ' +\n 'wallet already owns. Cannot spend: the payment module is absent from its ' +\n 'import graph, and the key it signs with is a P-256 delegation, the wrong ' +\n 'curve to authorize a payment. OPENS THE KEYSTORE (one wallet signature) ' +\n 'when an owned piece is not on this machine and no session key is live, ' +\n 'minting the same ≤24h read-scoped delegation `publish` and `edit` mint; ' +\n 'every later owned read reuses it and asks for nothing. TRANSMITS A ' +\n 'CREDENTIAL: that wallet-derived delegation goes to the server on a cold ' +\n '402. It is minted and presented only for the origin of the piece being ' +\n 'read, and never for a second origin while one for another is cached, ' +\n 'which is what bounds a stray `--base-url`; no scope on it limits what a ' +\n 'holder could do with it. Not read-only: a freshly delivered piece is ' +\n 'saved to the library.',\n },\n {\n rule: 'Bash(tenjin outcome:*)',\n command: 'tenjin outcome',\n note:\n 'Free honest outcome report on a past search. No wallet, no payment. ' +\n 'Not read-only: it POSTs a report that moves the marketplace reuse signal.',\n },\n {\n rule: 'Bash(tenjin doctor:*)',\n command: 'tenjin doctor',\n note:\n 'Local environment and API reachability diagnostics. Decrypts the wallet ' +\n 'locally to check it still opens; signs nothing and sends nothing.',\n },\n {\n rule: 'Bash(tenjin wallet show:*)',\n command: 'tenjin wallet show',\n note: 'Prints the wallet address and key source. Never prints the key.',\n },\n {\n rule: 'Bash(tenjin wallet balance:*)',\n command: 'tenjin wallet balance',\n note: 'Read-only USDC balance query on Base.',\n },\n {\n rule: 'Bash(tenjin config get:*)',\n command: 'tenjin config get',\n note:\n 'Reads one effective config value. `config set` is excluded on purpose. ' +\n 'Note `config get rpcUrl` returns your RPC URL, which commonly embeds a ' +\n 'provider API key: no wallet secret, but a credential-adjacent read.',\n },\n];\n\n/**\n * The verbs offered as EXPLICIT opt-in lines rather than shipped in the safe set:\n * the one that spends, and the one that opens the keystore.\n *\n * Read the buy note carefully before pasting the line: on the DEFAULT config this\n * rule authorizes unattended spending up to the wallet balance. Walking\n * `--yes` clears confirmation only. Zero daily budget refuses positive payments,\n * finite budgets cap cumulative exposure, and `none` explicitly removes that cap.\n */\nexport const OPT_IN_ALLOWLIST: readonly AllowlistEntry[] = [\n {\n rule: 'Bash(tenjin buy:*)',\n command: 'tenjin buy',\n note:\n 'SPENDS USDC on Base, unrefundably. This authorizes UNATTENDED purchases: ' +\n '`--yes` is an ordinary flag on the same allowlisted verb and it clears the ' +\n 'confirm gate only. Manual purchases do not obey maxAutoSpend or sessionBudget; those limits apply only to automatic router spending. ' +\n 'This permission never raises a spend cap, but those automatic caps do not bound this verb. Use --max-price for an explicit per-purchase ceiling and require consent for the quoted purchase.',\n },\n {\n rule: 'Bash(tenjin pay:*)',\n command: 'tenjin pay',\n note:\n 'SPENDS USDC on Base, unrefundably. Only for explicit user-requested payments with consent for the live quote; never an autonomous router-refusal workaround. Automatic router limits do not apply. Registry lookup failures or listed-term mismatches require --ignore-warnings ' +\n 'for that invocation, and --yes confirms payment only. Both still obey an explicit --max-price, ' +\n 'balance and destination checks. maxAutoSpend and sessionBudget apply only to automatic router spending. Every paid call can spend again.',\n },\n];\n\n/**\n * The one rule that is neither always-safe nor a standing opt-in: it exists only\n * while `publish.mode` is `auto` or `full-auto`.\n *\n * The mode IS the consent. An operator who set auto has already said a clean\n * publish should proceed without asking; leaving the harness prompt in front of\n * it asks the same question a second time, in a place the mode cannot answer,\n * and the agent that hits it does the only safe thing and stops. That was the\n * observed failure: a session ran `tenjin config get publish.mode` mid-publish to\n * discover it had permission it had already been given (#161).\n *\n * NOT part of {@link recommendedRules}, and not a tier an operator picks from.\n * There is no line to paste and no flag that adds it: `install` writes it when\n * the mode it just settled is auto or full-auto, takes it back when the mode is\n * review, and `uninstall` reclaims it like every other rule this CLI wrote.\n */\nexport const PUBLISH_MODE_ALLOWLIST: readonly AllowlistEntry[] = [\n {\n rule: 'Bash(tenjin publish:*)',\n command: 'tenjin publish',\n note:\n 'PUBLISHES PUBLICLY under your identity, and is cleared only while publish.mode is ' +\n 'auto or full-auto: the mode is the consent, and the harness prompt would ask for it ' +\n 'twice. Three things it clears that the free tier never did. It OPENS THE KEYSTORE: ' +\n 'publish always resolves a signer, and with no usable session it mints one at ' +\n 'read+write scope, which is strictly broader than the read-only key `tenjin read` ' +\n 'mints to recover an owned piece. It publishes the contents ' +\n 'of ANY REGULAR LOCAL FILE the agent can read, gated only by the heuristic scan. And it is a ' +\n 'PREFIX rule, so it pins the verb and not the flags: `--base-url` rides it (see the ' +\n 'flag caveat), and `--yes` is an ordinary flag on the same verb that clears exactly ' +\n 'the WARN findings auto stopped on, so a re-run collapses auto into full-auto with ' +\n 'nobody asked. The local scan is warn-only now and every finding routes through the ' +\n 'same consent flow this mode already governs; what still refuses a publish outright is ' +\n 'the SERVER’s ingest gate (vendor tokens, private keys, seed phrases, DB passwords, ' +\n 'bearer headers), which no mode and no flag clears. The skills hold the rest of that ' +\n 'line. Set publish.mode back to review and the rule is retracted.',\n },\n {\n rule: 'Bash(tenjin edit:*)',\n command: 'tenjin edit',\n note:\n 'Updates posts your wallet ALREADY OWNS: reprices, refreshes an as-of date, repairs an ' +\n 'answer card, and flips status both ways, so it CAN PROMOTE A DRAFT TO PUBLISHED under ' +\n 'this same gate (promotion re-runs the block-tier secret scan over the stored body). ' +\n 'Owner-scoped on both legs (GET and PUT /api/posts/<id> are signed and owner-only), ' +\n 'spends nothing, moves no keys, and mints no new posts: a narrower blast radius than ' +\n 'the publish rule beside it, though promotion means existing drafts can go public. It ' +\n 'rides the same mode for the same reason: edit runs the identical publish.mode consent ' +\n 'gate in the CLI (lib/consent.ts needsConfirmation), so a mode that publishes ' +\n 'unattended and then cannot fix its own post\\u2019s price is the asymmetry the mode ' +\n 'exists to remove. It opens the keystore on the same terms as the publish rule beside ' +\n 'it, and takes the same prefix-rule caveats. Removed by the same return to review.',\n },\n];\n\n/** The mode-gated rules in effect for `mode`; empty on review. */\nexport function modeGatedAllowlist(mode: PublishMode): AllowlistEntry[] {\n return mode === 'review' ? [] : PUBLISH_MODE_ALLOWLIST.map((e) => ({ ...e }));\n}\n\n/**\n * Verbs that must NEVER appear in the recommended allowlist, with the reason each\n * one is a human decision. `tenjin wallet send` is the wallet escape hatch\n * (tenjin-agent #40) and heads this list: it moves USDC to an arbitrary address,\n * outside the spend policy that bounds `buy`. Naming it here is load-bearing even\n * in versions where the verb does not exist yet — the exclusion ships before the\n * verb does.\n *\n * `tenjin publish` stays on this list under its own terms: nothing RECOMMENDS it,\n * and no line here or on the doc page adds it. {@link PUBLISH_MODE_ALLOWLIST} is\n * not a recommendation — it is what one specific operator choice already means.\n */\nexport const NEVER_ALLOWLISTED: readonly ExcludedVerb[] = [\n {\n command: 'tenjin wallet send',\n reason:\n 'Moves USDC out of the wallet to an arbitrary address (the escape hatch, #40). ' +\n 'Irreversible and not bounded by the buy spend policy. Always a human decision.',\n },\n {\n command: 'tenjin publish',\n reason:\n 'Puts your content on a public marketplace under your identity. Never pre-cleared by the ' +\n 'free tier or an opt-in line: the only thing that clears it is `publish.mode` auto or ' +\n 'full-auto, which is the same human decision said once instead of twice (see ' +\n 'PUBLISH_MODE_ALLOWLIST). Back on review, `install` takes the rule away again.',\n },\n {\n command: 'tenjin edit',\n reason:\n 'Write-capable despite the no-flag form reading as a pure show: it edits live posts ' +\n 'and answer cards under your identity, and moves prices. A prefix rule pins the verb, ' +\n 'not the flags, so no rule can clear the read half without clearing the write half. ' +\n 'Never pre-cleared as a recommendation: like `tenjin publish`, the only thing that ' +\n 'clears it is `publish.mode` auto or full-auto, whose consent gate it already shares ' +\n '(see PUBLISH_MODE_ALLOWLIST). Back on review, `install` takes the rule away again.',\n },\n {\n command: 'tenjin delete',\n reason:\n 'Destroys a published piece. It is the one write verb `publish.mode` deliberately does NOT ' +\n 'carry: the mode is consent to publish, and reading it as consent to destroy would let one ' +\n 'decision authorize a different, irreversible one. So no mode ever clears this rule, and ' +\n 'the CLI confirms on every run regardless — a prefix rule here would only remove the ' +\n 'harness prompt in front of a command that asks its own question anyway. Reach for ' +\n '`tenjin edit --status draft` when the piece should come down reversibly.',\n },\n {\n command: 'tenjin wallet create',\n reason: 'Creates the payment credential; a stray run is a wallet you did not mean to have.',\n },\n {\n command: 'tenjin config set',\n reason:\n 'Can raise maxAutoSpend / sessionBudget, i.e. widen the agent’s own spend policy — ' +\n 'and, through shelfBypassSecret + baseUrl, put the machine in team mode, where a publish ' +\n 'skips the scan’s warn tier (except secret-assignment, and hex32-value, the warn form a ' +\n 'block-tier check demotes to) and prices at 0. It also writes ' +\n 'publish.ackServerWarnings on, the most direct consent-loosening write on this verb: ' +\n 'it lets one --yes cover the marketplace’s own scan findings, which no payload had ' +\n 'rendered when that yes was given.',\n },\n {\n command: 'tenjin install',\n reason: 'Writes into harness config and skills directories.',\n },\n {\n command: 'tenjin mcp',\n reason:\n 'Long-running server that re-exposes every command core over stdio; ' +\n 'clearing it would indirectly clear everything above.',\n },\n {\n command: 'tenjin update',\n reason:\n 'Replaces the tenjin binary the agent then runs, with whatever npm serves ' +\n 'next. Which build an agent executes is an operator decision, not something ' +\n 'a rule pre-clears. `--check` only reports, but a prefix rule pins the verb, ' +\n 'not the flags.',\n },\n];\n\n/**\n * The flag-surface caveat. A prefix rule pins the verb, never the flags, and the\n * flag that matters is `--base-url`: it is accepted on every leaf, validated only\n * as a URL, and it wins settings precedence, so it moves the destination of every\n * allowlisted verb. Printed with the rules everywhere they are printed, because\n * an operator who only reads the verb list would never learn it.\n */\nexport const FLAG_CAVEAT: readonly string[] = [\n 'Caveat: a prefix rule pins the VERB, not the flags. Every line above also clears',\n '`--base-url <url>` on that verb, which re-points where the question, the probe, the',\n 'session key `read` mints and presents, and (for buy) the signature and payment go.',\n 'Signed and credential-bearing traffic is NOT confined to the paying verb: `read` is in',\n 'the safe tier and both mints a wallet-derived delegation and transmits it, which is why',\n 'that delegation is bound to the origin it was minted for and refused elsewhere.',\n 'Allowlist these verbs only if you are content for the agent to choose the destination',\n 'host, and set the base URL in config instead of letting it be an argument. The skills',\n 'tell agents never to pass --base-url on an allowlisted verb, but that is a convention,',\n 'not an enforced boundary.',\n 'This covers the two rules your publish.mode carries as well, and bites hardest there:',\n '`tenjin publish --base-url <host>` is cleared by default on auto, and it signs against',\n 'the host it is given.',\n];\n\n/**\n * The MCP caveat. `tenjin mcp` is never recommended as a Bash rule, but an\n * operator who registers the server anyway is on a different permission surface\n * (tools, not command strings) where three excluded verbs come back.\n */\nexport const MCP_CAVEAT: readonly string[] = [\n 'Note the asymmetry: publish.mode writes the Bash rules for `publish` and `edit`, and',\n 'deliberately does not touch the MCP tool grants below. The mode is a CLI-side consent',\n 'gate, and nothing reads it on the MCP surface, so clearing those tools would hand out',\n 'the same authority with none of the same gate. Aligning the two is tracked separately.',\n 'Running the local MCP server (`tenjin mcp`) instead? That is a different permission',\n 'surface: the harness gates TOOLS there, and these Bash rules do not apply. Leave',\n '`mcp__tenjin__tenjin_publish`, `mcp__tenjin__tenjin_edit`,',\n '`mcp__tenjin__tenjin_delete`, and `mcp__tenjin__tenjin_wallet` gated. `tenjin_buy` is',\n 'the same opt-in decision as the buy line above. `tenjin_delete` is the one whose own',\n 'core still confirms even if you clear it: it never reads publish.mode.',\n];\n\n/** The machine shape emitted by `tenjin doctor --json` and `tenjin install --json`. */\nexport interface RecommendedPermissions {\n alwaysSafe: AllowlistEntry[];\n optIn: AllowlistEntry[];\n neverAllowlisted: ExcludedVerb[];\n /**\n * Rules the CURRENT publish.mode carries, empty on review. Separate from the\n * three tiers above because it is not a recommendation to weigh: it is what\n * this machine's mode already means, so a consumer that renders it beside the\n * others would be offering a choice that has been made.\n */\n modeGated: AllowlistEntry[];\n /**\n * Whether any harness on THIS machine can carry the rules above. They are\n * `Bash(...)` lines, Claude Code's grammar; a reader that took this payload\n * for a description of a Codex-only machine concluded `publish.mode=auto`\n * was in force while Codex was rejecting `tenjin publish` before the CLI ran\n * (tenjin-agent#342). The document still ships for a harness you have not\n * installed yet, so check this before treating any rule below as granted.\n */\n effective: boolean;\n /** Caveats that qualify the rules above; never omit them when rendering. */\n caveats: { flags: string[]; mcp: string[] };\n}\n\n/**\n * `mode` defaults to the shipped `review`, i.e. no mode-gated rules.\n * `effective` defaults to FALSE, so a caller that has not established such a\n * harness cannot have the payload claim one by omission.\n */\nexport function recommendedPermissions(\n mode: PublishMode = 'review',\n effective = false,\n): RecommendedPermissions {\n return {\n alwaysSafe: ALWAYS_SAFE_ALLOWLIST.map((e) => ({ ...e })),\n optIn: OPT_IN_ALLOWLIST.map((e) => ({ ...e })),\n neverAllowlisted: NEVER_ALLOWLISTED.map((e) => ({ ...e })),\n modeGated: modeGatedAllowlist(mode),\n effective,\n caveats: { flags: [...FLAG_CAVEAT], mcp: [...MCP_CAVEAT] },\n };\n}\n\n/** Every rule this module recommends adding (safe + opt-in). */\nexport function recommendedRules(): string[] {\n return [...ALWAYS_SAFE_ALLOWLIST, ...OPT_IN_ALLOWLIST].map((e) => e.rule);\n}\n\n/**\n * The permission caveats' one home. `doctor` used to print the whole thing —\n * nine rules, both opt-in notes, every exclusion, the flag caveat and the MCP\n * caveat, ~60 lines ahead of the check list it was actually run for. No doctor\n * command in the wider ecosystem carries security prose, and an operator reading\n * a wall of it in a terminal cannot paste from it, search it, or link a colleague\n * to a section. The page can do all three, so it is where the caveats live and\n * where every human surface points; `--json` still carries them as data\n * (`recommendedPermissions`), which is what an agent reads.\n */\nexport const PERMISSIONS_DOC_URL =\n 'https://github.com/BackTrackCo/tenjin-agent/blob/main/docs/agent-permissions.md';\n\n/**\n * The rules the current mode is missing, or null when it needs none. This one\n * DOES name them: they are not a tier to weigh and paste, they\n * are lines that should already be in the operator's settings file, and an\n * operator whose agent is being prompted for work the mode said not to ask about\n * needs to see exactly which rules are missing.\n *\n * CONSULTS THE MACHINE. Rendering from the mode alone told operators to add\n * rules their settings file already had, and named a remedy that in one case\n * would not have written anything — a nag that is wrong twice over on a line\n * whose whole job is to prevent an agent stalling on a prompt (#161).\n */\nexport function modeGatedPointer(\n mode: PublishMode,\n /** The mode-gated rules this machine is actually MISSING. Empty renders nothing. */\n missing: readonly string[],\n /**\n * The command that would fix it. `tenjin install` for the ordinary case; a\n * mode coming from TENJIN_PUBLISH_MODE needs `config set` instead, because\n * install resolves the mode from the global file and would write nothing.\n */\n remedy = 'tenjin install',\n): string | null {\n if (modeGatedAllowlist(mode).length === 0 || missing.length === 0) return null;\n return `publish.mode=${mode} also needs ${missing.join(' and ')} in your harness allowlist, or it will prompt anyway; \\`${remedy}\\` writes them.`;\n}\n"],"mappings":";;;AAyOO,IAAM,yBAAoD;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MACE;AAAA,EAeJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MACE;AAAA,EAWJ;AACF;AAGO,SAAS,mBAAmB,MAAqC;AACtE,SAAO,SAAS,WAAW,CAAC,IAAI,uBAAuB,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;AAC9E;AAwLO,IAAM,sBACX;AAcK,SAAS,iBACd,MAEA,SAMA,SAAS,kBACM;AACf,MAAI,mBAAmB,IAAI,EAAE,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;AAC1E,SAAO,gBAAgB,IAAI,eAAe,QAAQ,KAAK,OAAO,CAAC,2DAA2D,MAAM;AAClI;","names":[]}
@@ -1,4 +1,7 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ USDC_ADDRESS
4
+ } from "./chunk-3KKKB2AQ.js";
2
5
  import {
3
6
  createPublicClient,
4
7
  defineBlock,
@@ -7,11 +10,11 @@ import {
7
10
  defineTransactionReceipt,
8
11
  formatTransaction,
9
12
  http
10
- } from "./chunk-AWQPGIR6.js";
13
+ } from "./chunk-Y66XUXVI.js";
11
14
  import {
12
15
  serializeTransaction,
13
16
  toRlp
14
- } from "./chunk-N35E6CM2.js";
17
+ } from "./chunk-6DCELMQA.js";
15
18
  import {
16
19
  decodeFunctionData,
17
20
  encodeFunctionData,
@@ -199,11 +202,11 @@ var basePreconf = /* @__PURE__ */ defineChain({
199
202
  });
200
203
 
201
204
  // src/lib/usdc.ts
202
- var USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
205
+ var USDC_ADDRESS2 = USDC_ADDRESS;
203
206
  async function getUsdcBalance(address, rpcUrl) {
204
207
  const client = createPublicClient({ chain: base, transport: http(rpcUrl) });
205
208
  return client.readContract({
206
- address: USDC_ADDRESS,
209
+ address: USDC_ADDRESS2,
207
210
  abi: erc20Abi,
208
211
  functionName: "balanceOf",
209
212
  args: [address]
@@ -248,7 +251,7 @@ async function prepareUsdcSend({
248
251
  });
249
252
  const [nonce, gas, fees, ethBalanceWei] = await Promise.all([
250
253
  client.getTransactionCount({ address: from, blockTag: "pending" }),
251
- client.estimateGas({ account: from, to: USDC_ADDRESS, data }),
254
+ client.estimateGas({ account: from, to: USDC_ADDRESS2, data }),
252
255
  client.estimateFeesPerGas(),
253
256
  client.getBalance({ address: from })
254
257
  ]);
@@ -283,7 +286,7 @@ async function broadcastUsdcSend({
283
286
  const serializedTransaction = await signer.signTransaction({
284
287
  type: "eip1559",
285
288
  chainId: base.id,
286
- to: USDC_ADDRESS,
289
+ to: USDC_ADDRESS2,
287
290
  // Explicitly zero: an ERC-20 transfer carries no native value (test-pinned).
288
291
  value: 0n,
289
292
  data: prepared.data,
@@ -307,7 +310,7 @@ function assertUnderCap(field, value, cap) {
307
310
  }
308
311
 
309
312
  export {
310
- USDC_ADDRESS,
313
+ USDC_ADDRESS2 as USDC_ADDRESS,
311
314
  getUsdcBalance,
312
315
  FeeCapExceededError,
313
316
  SendRevertedError,
@@ -315,4 +318,4 @@ export {
315
318
  prepareUsdcSend,
316
319
  broadcastUsdcSend
317
320
  };
318
- //# sourceMappingURL=chunk-56MOAIP5.js.map
321
+ //# sourceMappingURL=chunk-A6CY6BUW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/op-stack/contracts.ts","../node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/op-stack/formatters.ts","../node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/op-stack/serializers.ts","../node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/op-stack/chainConfig.ts","../node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/chains/definitions/base.ts","../src/lib/usdc.ts"],"sourcesContent":["import type { Chain } from '../types/chain.js'\n\n/**\n * Predeploy contracts for OP Stack.\n * @see https://github.com/ethereum-optimism/optimism/blob/develop/specs/predeploys.md\n */\nexport const contracts = {\n gasPriceOracle: { address: '0x420000000000000000000000000000000000000F' },\n l1Block: { address: '0x4200000000000000000000000000000000000015' },\n l2CrossDomainMessenger: {\n address: '0x4200000000000000000000000000000000000007',\n },\n l2Erc721Bridge: { address: '0x4200000000000000000000000000000000000014' },\n l2StandardBridge: { address: '0x4200000000000000000000000000000000000010' },\n l2ToL1MessagePasser: {\n address: '0x4200000000000000000000000000000000000016',\n },\n} as const satisfies Chain['contracts']\n","import type { ChainFormatters } from '../types/chain.js'\nimport type { RpcTransaction } from '../types/rpc.js'\nimport { hexToBigInt, hexToNumber } from '../utils/encoding/fromHex.js'\nimport { defineBlock } from '../utils/formatters/block.js'\nimport {\n defineTransaction,\n formatTransaction,\n} from '../utils/formatters/transaction.js'\nimport { defineTransactionReceipt } from '../utils/formatters/transactionReceipt.js'\nimport type { OpStackBlock, OpStackRpcBlock } from './types/block.js'\nimport type {\n OpStackRpcTransaction,\n OpStackRpcTransactionReceipt,\n OpStackTransaction,\n OpStackTransactionReceipt,\n} from './types/transaction.js'\n\nexport const formatters = {\n block: /*#__PURE__*/ defineBlock({\n format(args: OpStackRpcBlock): OpStackBlock {\n const transactions = args.transactions?.map((transaction) => {\n if (typeof transaction === 'string') return transaction\n const formatted = formatTransaction(\n transaction as RpcTransaction,\n ) as OpStackTransaction\n if (formatted.typeHex === '0x7e') {\n formatted.isSystemTx = transaction.isSystemTx\n formatted.mint = transaction.mint\n ? hexToBigInt(transaction.mint)\n : undefined\n formatted.sourceHash = transaction.sourceHash\n formatted.type = 'deposit'\n }\n return formatted\n })\n return {\n transactions,\n stateRoot: args.stateRoot,\n } as OpStackBlock\n },\n }),\n transaction: /*#__PURE__*/ defineTransaction({\n format(args: OpStackRpcTransaction): OpStackTransaction {\n const transaction = {} as OpStackTransaction\n if (args.type === '0x7e') {\n transaction.isSystemTx = args.isSystemTx\n transaction.mint = args.mint ? hexToBigInt(args.mint) : undefined\n transaction.sourceHash = args.sourceHash\n transaction.type = 'deposit'\n }\n return transaction\n },\n }),\n transactionReceipt: /*#__PURE__*/ defineTransactionReceipt({\n format(args: OpStackRpcTransactionReceipt): OpStackTransactionReceipt {\n return {\n ...(args.depositNonce\n ? { depositNonce: hexToBigInt(args.depositNonce) }\n : {}),\n ...(args.depositReceiptVersion\n ? { depositReceiptVersion: hexToNumber(args.depositReceiptVersion) }\n : {}),\n l1GasPrice: args.l1GasPrice ? hexToBigInt(args.l1GasPrice) : null,\n l1GasUsed: args.l1GasUsed ? hexToBigInt(args.l1GasUsed) : null,\n l1Fee: args.l1Fee ? hexToBigInt(args.l1Fee) : null,\n l1FeeScalar: args.l1FeeScalar ? Number(args.l1FeeScalar) : null,\n } as OpStackTransactionReceipt\n },\n }),\n} as const satisfies ChainFormatters\n","import { InvalidAddressError } from '../errors/address.js'\nimport type { ErrorType } from '../errors/utils.js'\nimport type { ChainSerializers } from '../types/chain.js'\nimport type { Hex, Signature } from '../types/misc.js'\nimport type { TransactionSerializable } from '../types/transaction.js'\nimport type { RequiredBy } from '../types/utils.js'\nimport { isAddress } from '../utils/address/isAddress.js'\nimport { concatHex } from '../utils/data/concat.js'\nimport { toHex } from '../utils/encoding/toHex.js'\nimport { toRlp } from '../utils/encoding/toRlp.js'\nimport {\n type SerializeTransactionErrorType as SerializeTransactionErrorType_,\n serializeTransaction as serializeTransaction_,\n} from '../utils/transaction/serializeTransaction.js'\nimport type {\n OpStackTransactionSerializable,\n TransactionSerializableDeposit,\n TransactionSerializedDeposit,\n} from './types/transaction.js'\n\nexport type SerializeTransactionReturnType = ReturnType<\n typeof serializeTransaction\n>\n\nexport type SerializeTransactionErrorType =\n | SerializeTransactionErrorType_\n | ErrorType\n\nexport function serializeTransaction(\n transaction: OpStackTransactionSerializable,\n signature?: Signature,\n) {\n if (isDeposit(transaction)) return serializeTransactionDeposit(transaction)\n return serializeTransaction_(\n transaction as TransactionSerializable,\n signature,\n )\n}\n\nexport const serializers = {\n transaction: serializeTransaction,\n} as const satisfies ChainSerializers\n\n//////////////////////////////////////////////////////////////////////////////\n// Serializers\n\nexport type SerializeTransactionDepositReturnType = TransactionSerializedDeposit\n\nfunction serializeTransactionDeposit(\n transaction: TransactionSerializableDeposit,\n): SerializeTransactionDepositReturnType {\n assertTransactionDeposit(transaction)\n\n const { sourceHash, data, from, gas, isSystemTx, mint, to, value } =\n transaction\n\n const serializedTransaction: Hex[] = [\n sourceHash,\n from,\n to ?? '0x',\n mint ? toHex(mint) : '0x',\n value ? toHex(value) : '0x',\n gas ? toHex(gas) : '0x',\n isSystemTx ? '0x1' : '0x',\n data ?? '0x',\n ]\n\n return concatHex([\n '0x7e',\n toRlp(serializedTransaction),\n ]) as SerializeTransactionDepositReturnType\n}\n\nfunction isDeposit(\n transaction: OpStackTransactionSerializable,\n): transaction is RequiredBy<TransactionSerializableDeposit, 'type'> {\n if (transaction.type === 'deposit') return true\n if (typeof transaction.sourceHash !== 'undefined') return true\n return false\n}\n\nexport function assertTransactionDeposit(\n transaction: TransactionSerializableDeposit,\n) {\n const { from, to } = transaction\n if (from && !isAddress(from)) throw new InvalidAddressError({ address: from })\n if (to && !isAddress(to)) throw new InvalidAddressError({ address: to })\n}\n","import { contracts } from './contracts.js'\nimport { formatters } from './formatters.js'\nimport { serializers } from './serializers.js'\n\nexport const chainConfig = {\n blockTime: 2_000,\n contracts,\n formatters,\n serializers,\n} as const\n","import { chainConfig } from '../../op-stack/chainConfig.js'\nimport { defineChain } from '../../utils/chain/defineChain.js'\n\nconst sourceId = 1 // mainnet\n\nexport const base = /*#__PURE__*/ defineChain({\n ...chainConfig,\n id: 8453,\n name: 'Base',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n rpcUrls: {\n default: {\n http: ['https://mainnet.base.org'],\n },\n },\n blockExplorers: {\n default: {\n name: 'Basescan',\n url: 'https://basescan.org',\n apiUrl: 'https://api.basescan.org/api',\n },\n },\n contracts: {\n ...chainConfig.contracts,\n disputeGameFactory: {\n [sourceId]: {\n address: '0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e',\n },\n },\n l2OutputOracle: {\n [sourceId]: {\n address: '0x56315b90c40730925ec5485cf004d835058518A0',\n },\n },\n multicall3: {\n address: '0xca11bde05977b3631167028862be2a173976ca11',\n blockCreated: 5022,\n },\n portal: {\n [sourceId]: {\n address: '0x49048044D57e1C92A77f79988d21Fa8fAF74E97e',\n blockCreated: 17482143,\n },\n },\n l1StandardBridge: {\n [sourceId]: {\n address: '0x3154Cf16ccdb4C6d922629664174b904d80F2C35',\n blockCreated: 17482143,\n },\n },\n },\n sourceId,\n})\n\nexport const basePreconf = /*#__PURE__*/ defineChain({\n ...base,\n experimental_preconfirmationTime: 200,\n rpcUrls: {\n default: {\n http: ['https://mainnet-preconf.base.org'],\n },\n },\n})\n","import {\n createPublicClient,\n decodeFunctionData,\n encodeFunctionData,\n erc20Abi,\n http,\n type Address,\n type Hex,\n} from 'viem';\nimport { base } from 'viem/chains';\nimport { USDC_ADDRESS as USDC } from './usdc-balance';\nimport type { TenjinSigner } from './wallet/provider';\n\n/** Lives in `usdc-balance.ts`, which the viem-free hooks can load. */\nexport const USDC_ADDRESS: Address = USDC;\nexport const USDC_DECIMALS = 6;\n\nexport async function getUsdcBalance(address: Address, rpcUrl: string): Promise<bigint> {\n const client = createPublicClient({ chain: base, transport: http(rpcUrl) });\n return client.readContract({\n address: USDC_ADDRESS,\n abi: erc20Abi,\n functionName: 'balanceOf',\n args: [address],\n });\n}\n\n// The chain boundary for `tenjin wallet send`, two-phase around the human confirm:\n// prepareUsdcSend (read-only: encode, nonce, gas, fees, ETH-for-gas balance)\n// runs BEFORE the confirm so the prompt can show the fee, broadcastUsdcSend\n// (sign via the TenjinSigner seam, broadcast, wait for the receipt) runs after.\n// Command tests mock this whole module, so no test can ever reach a real chain.\n\n/**\n * Ceilings on the RPC-supplied gas and fee fields. The RPC endpoint is\n * config-controlled and its estimates go straight into the signed transaction; a\n * hostile or broken endpoint returning huge values would burn the wallet's ETH\n * as fees. An ERC-20 transfer is ~65k gas and Base fees run well under a gwei,\n * so estimates past these bounds mean something is wrong: refuse, never clamp\n * (a clamped maxFeePerGas below the real base fee would just strand the tx).\n * A genuine extreme fee spike on Base trips the same refusal; that is intended\n * — waiting it out beats signing an irreversible transfer at panic prices.\n */\nexport const SEND_GAS_CAP = 150_000n;\nexport const SEND_MAX_FEE_PER_GAS_CAP = 10_000_000_000n; // 10 gwei\nexport const SEND_MAX_PRIORITY_FEE_CAP = 2_000_000_000n; // 2 gwei\n\n/** An RPC gas/fee estimate exceeded the send ceilings; nothing was signed. */\nexport class FeeCapExceededError extends Error {\n constructor(field: string, value: bigint, cap: bigint) {\n super(`${field} estimate ${value} exceeds the send ceiling ${cap}`);\n this.name = 'FeeCapExceededError';\n }\n}\n\n/** The transfer was mined but reverted; the fee was spent, the USDC did not move. */\nexport class SendRevertedError extends Error {\n constructor(readonly txHash: Hex) {\n super(`Transaction ${txHash} reverted`);\n this.name = 'SendRevertedError';\n }\n}\n\n/** Broadcast succeeded but no receipt arrived in time; the tx may still mine. */\nexport class SendPendingError extends Error {\n constructor(readonly txHash: Hex) {\n super(`Transaction ${txHash} was broadcast but not confirmed in time`);\n this.name = 'SendPendingError';\n }\n}\n\nexport interface PrepareUsdcSendArgs {\n from: Address;\n to: Address;\n amountAtomic: bigint;\n rpcUrl: string;\n}\n\n/**\n * Everything signed later, fixed at prepare time, plus the gas-cost preview.\n * The nonce is pinned here, BEFORE the human confirm, so anything else spending\n * from this key during that window makes the later broadcast fail nonce-stale\n * (an RPC_ERROR from the node; nothing double-spends — re-run to re-prepare).\n * `to` and `amountAtomic` are the previewed intent; broadcastUsdcSend re-decodes\n * `data` against them before signing.\n */\nexport interface PreparedUsdcSend {\n to: Address;\n amountAtomic: bigint;\n data: Hex;\n nonce: number;\n gas: bigint;\n maxFeePerGas: bigint;\n maxPriorityFeePerGas: bigint;\n /** Worst-case fee (gas * maxFeePerGas), for the confirm prompt and gas check. */\n feeWei: bigint;\n /** The sender's native ETH balance, for the has-gas pre-check. */\n ethBalanceWei: bigint;\n}\n\nexport async function prepareUsdcSend({\n from,\n to,\n amountAtomic,\n rpcUrl,\n}: PrepareUsdcSendArgs): Promise<PreparedUsdcSend> {\n const client = createPublicClient({ chain: base, transport: http(rpcUrl) });\n const data = encodeFunctionData({\n abi: erc20Abi,\n functionName: 'transfer',\n args: [to, amountAtomic],\n });\n const [nonce, gas, fees, ethBalanceWei] = await Promise.all([\n client.getTransactionCount({ address: from, blockTag: 'pending' }),\n client.estimateGas({ account: from, to: USDC_ADDRESS, data }),\n client.estimateFeesPerGas(),\n client.getBalance({ address: from }),\n ]);\n assertUnderCap('gas', gas, SEND_GAS_CAP);\n assertUnderCap('maxFeePerGas', fees.maxFeePerGas, SEND_MAX_FEE_PER_GAS_CAP);\n assertUnderCap('maxPriorityFeePerGas', fees.maxPriorityFeePerGas, SEND_MAX_PRIORITY_FEE_CAP);\n return {\n to,\n amountAtomic,\n data,\n nonce,\n gas,\n maxFeePerGas: fees.maxFeePerGas,\n maxPriorityFeePerGas: fees.maxPriorityFeePerGas,\n feeWei: gas * fees.maxFeePerGas,\n ethBalanceWei,\n };\n}\n\nexport interface BroadcastUsdcSendArgs {\n signer: TenjinSigner;\n prepared: PreparedUsdcSend;\n rpcUrl: string;\n /** Receipt wait bound in ms; Base blocks are ~2s, so the default is generous. */\n receiptTimeoutMs?: number;\n}\n\n/**\n * Sign the prepared transfer through the TenjinSigner seam (never a raw key),\n * broadcast it, and wait for the receipt so \"sent\" means mined. Throws\n * SendRevertedError (mined but failed) or SendPendingError (no receipt in time);\n * both carry the hash so the caller can report it either way.\n */\nexport async function broadcastUsdcSend({\n signer,\n prepared,\n rpcUrl,\n receiptTimeoutMs = 120_000,\n}: BroadcastUsdcSendArgs): Promise<Hex> {\n const client = createPublicClient({ chain: base, transport: http(rpcUrl) });\n // Pre-sign cross-check, the calldata twin of send.ts's signer/preview match:\n // the bytes about to be signed must still decode to the previewed recipient\n // and amount. Unreachable unless prepare-time state was corrupted; refusing\n // here means nothing is signed against a preview it does not match.\n const decoded = decodeFunctionData({ abi: erc20Abi, data: prepared.data });\n if (\n decoded.functionName !== 'transfer' ||\n decoded.args[0].toLowerCase() !== prepared.to.toLowerCase() ||\n decoded.args[1] !== prepared.amountAtomic\n ) {\n throw new Error(\n 'Prepared calldata does not decode to the previewed recipient and amount; nothing was signed.',\n );\n }\n const serializedTransaction = await signer.signTransaction({\n type: 'eip1559',\n chainId: base.id,\n to: USDC_ADDRESS,\n // Explicitly zero: an ERC-20 transfer carries no native value (test-pinned).\n value: 0n,\n data: prepared.data,\n nonce: prepared.nonce,\n gas: prepared.gas,\n maxFeePerGas: prepared.maxFeePerGas,\n maxPriorityFeePerGas: prepared.maxPriorityFeePerGas,\n });\n const txHash = await client.sendRawTransaction({ serializedTransaction });\n let receipt;\n try {\n receipt = await client.waitForTransactionReceipt({ hash: txHash, timeout: receiptTimeoutMs });\n } catch {\n throw new SendPendingError(txHash);\n }\n if (receipt.status !== 'success') throw new SendRevertedError(txHash);\n return txHash;\n}\n\nfunction assertUnderCap(field: string, value: bigint, cap: bigint): void {\n if (value > cap) throw new FeeCapExceededError(field, value, cap);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAM,YAAY;EACvB,gBAAgB,EAAE,SAAS,6CAA4C;EACvE,SAAS,EAAE,SAAS,6CAA4C;EAChE,wBAAwB;IACtB,SAAS;;EAEX,gBAAgB,EAAE,SAAS,6CAA4C;EACvE,kBAAkB,EAAE,SAAS,6CAA4C;EACzE,qBAAqB;IACnB,SAAS;;;;;ACEN,IAAM,aAAa;EACxB,OAAqB,4BAAY;IAC/B,OAAO,MAAqB;AAC1B,YAAM,eAAe,KAAK,cAAc,IAAI,CAAC,gBAAe;AAC1D,YAAI,OAAO,gBAAgB;AAAU,iBAAO;AAC5C,cAAM,YAAY,kBAChB,WAA6B;AAE/B,YAAI,UAAU,YAAY,QAAQ;AAChC,oBAAU,aAAa,YAAY;AACnC,oBAAU,OAAO,YAAY,OACzB,YAAY,YAAY,IAAI,IAC5B;AACJ,oBAAU,aAAa,YAAY;AACnC,oBAAU,OAAO;QACnB;AACA,eAAO;MACT,CAAC;AACD,aAAO;QACL;QACA,WAAW,KAAK;;IAEpB;GACD;EACD,aAA2B,kCAAkB;IAC3C,OAAO,MAA2B;AAChC,YAAM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RESS","USDC_ADDRESS"]}
@@ -5,12 +5,12 @@ import {
5
5
  mainWorktreeOf,
6
6
  ownedCandidates,
7
7
  projectRoot
8
- } from "./chunk-PDA2BVFY.js";
8
+ } from "./chunk-5DOHKQ24.js";
9
9
  import {
10
10
  CONFIG_DEFAULTS,
11
11
  loadRawConfig,
12
12
  parseRouterLayer
13
- } from "./chunk-AR7U7BRG.js";
13
+ } from "./chunk-UNV4K45L.js";
14
14
  import {
15
15
  CliError
16
16
  } from "./chunk-JLEF5WHM.js";
@@ -124,4 +124,4 @@ export {
124
124
  readProjectRouterFile,
125
125
  projectRouterPath
126
126
  };
127
- //# sourceMappingURL=chunk-TP4D47BY.js.map
127
+ //# sourceMappingURL=chunk-AISBL7EY.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  modeGatedPointer
4
- } from "./chunk-WXC57XGG.js";
4
+ } from "./chunk-A36LQPHV.js";
5
5
  import {
6
6
  confirmChoice
7
7
  } from "./chunk-2QYORQBF.js";
@@ -9,25 +9,22 @@ import {
9
9
  LockTimeoutError,
10
10
  withFileLock
11
11
  } from "./chunk-MEFB5KHA.js";
12
+ import {
13
+ hasCode
14
+ } from "./chunk-2I4QTOLB.js";
12
15
  import {
13
16
  projectRouterPath,
14
17
  readProjectRouterFile,
15
18
  routerSettings
16
- } from "./chunk-TP4D47BY.js";
17
- import {
18
- detectHarnesses,
19
- harnessInPlay,
20
- harnessTargetDir,
21
- onPath
22
- } from "./chunk-WS4JA6TC.js";
19
+ } from "./chunk-AISBL7EY.js";
23
20
  import {
24
21
  isTeamShelfOrigin,
25
22
  loadProjectConfig
26
- } from "./chunk-PDA2BVFY.js";
23
+ } from "./chunk-5DOHKQ24.js";
27
24
  import {
28
25
  parseUsdToAtomic,
29
26
  toMoney
30
- } from "./chunk-U2DZISAH.js";
27
+ } from "./chunk-O2JYBOUO.js";
31
28
  import {
32
29
  CONFIG_KEYS,
33
30
  HOOKS_CONFIG_KEYS,
@@ -35,6 +32,7 @@ import {
35
32
  PRODUCTION_ORIGIN,
36
33
  PUBLISH_CONFIG_KEYS,
37
34
  PublishModeSchema,
35
+ RETIRED_PAYMENT_GUIDANCE,
38
36
  ROUTER_CONFIG_KEYS,
39
37
  ROUTER_CONTEXTS,
40
38
  RawConfigSchema,
@@ -47,8 +45,9 @@ import {
47
45
  parseLoopValue,
48
46
  parsePublicFallbackFlag,
49
47
  parseUpdateModeFlag,
50
- resolveSettings
51
- } from "./chunk-AR7U7BRG.js";
48
+ resolveSettings,
49
+ retiredPaymentKeys
50
+ } from "./chunk-UNV4K45L.js";
52
51
  import {
53
52
  ADAPTERS,
54
53
  MODE_GATED_RULES,
@@ -56,7 +55,7 @@ import {
56
55
  registeredHooks,
57
56
  retractModeGatedRules,
58
57
  wireFreeVerbAllowlist
59
- } from "./chunk-XZOEUYMX.js";
58
+ } from "./chunk-ZDKEU2GF.js";
60
59
  import {
61
60
  CliError,
62
61
  writeFileAtomic
@@ -68,9 +67,109 @@ import {
68
67
  // src/commands/config.ts
69
68
  import { mkdir } from "node:fs/promises";
70
69
  import { homedir } from "node:os";
71
- import { dirname } from "node:path";
70
+ import { dirname as dirname2 } from "node:path";
72
71
  import { styleText } from "node:util";
73
72
 
73
+ // src/lib/skill-wiring.ts
74
+ import { existsSync, statSync } from "node:fs";
75
+ import { constants, open } from "node:fs/promises";
76
+ import { delimiter, join as join2 } from "node:path";
77
+
78
+ // src/lib/skills-source.ts
79
+ import { dirname, join } from "node:path";
80
+ var SKILL_NAMES = ["tenjin-search", "tenjin-publish", "tenjin"];
81
+ var RETIRED_SKILL_NAMES = ["tenjin-pay"];
82
+ var PACKAGED_SKILL_NAMES = [...SKILL_NAMES];
83
+ var SENTINEL = join("tenjin", "SKILL.md");
84
+
85
+ // src/lib/skill-wiring.ts
86
+ function skillsDirsFor(home) {
87
+ return [join2(home, ".claude", "skills"), join2(home, ".agents", "skills")];
88
+ }
89
+ function harnessTargetDir(home, harness) {
90
+ if (harness === "claude") return join2(home, ".claude", "skills");
91
+ return join2(home, ".agents", "skills");
92
+ }
93
+ function harnessFlagFor(home, dir) {
94
+ if (dir === join2(home, ".claude", "skills")) return "claude";
95
+ return "codex";
96
+ }
97
+ function harnessDetectedBy(home, harness, which) {
98
+ const reasons = [];
99
+ if (existsSync(join2(home, `.${harness}`))) reasons.push("home-dir");
100
+ if (which(harness)) reasons.push("binary");
101
+ return reasons;
102
+ }
103
+ function detectHarnesses(home, which) {
104
+ return {
105
+ claude: harnessDetectedBy(home, "claude", which).length > 0,
106
+ codex: harnessDetectedBy(home, "codex", which).length > 0
107
+ };
108
+ }
109
+ function harnessReads(home, dir, present) {
110
+ if (harnessFlagFor(home, dir) === "claude") return present.claude;
111
+ return present.codex;
112
+ }
113
+ function harnessRequested(home, dir, requested) {
114
+ return requested.some((h) => harnessTargetDir(home, h) === dir);
115
+ }
116
+ function harnessInPlay(home, dir, present, requested) {
117
+ if (requested.length > 0) return harnessRequested(home, dir, requested);
118
+ return harnessReads(home, dir, present);
119
+ }
120
+ function onPath(bin, env) {
121
+ const raw = env.PATH ?? "";
122
+ const exts = process.platform === "win32" ? ["", ...(env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter((e) => e.length > 0)] : [""];
123
+ for (const part of raw.split(delimiter)) {
124
+ if (part.length === 0) continue;
125
+ for (const ext of exts) {
126
+ if (isFile(join2(part, bin + ext))) return true;
127
+ }
128
+ }
129
+ return false;
130
+ }
131
+ function isFile(p) {
132
+ try {
133
+ return statSync(p).isFile();
134
+ } catch {
135
+ return false;
136
+ }
137
+ }
138
+ async function readSkillFile(path) {
139
+ let handle;
140
+ try {
141
+ handle = await open(path, constants.O_RDONLY | (constants.O_NONBLOCK ?? 0));
142
+ } catch (err) {
143
+ if (hasCode(err, "ENOENT")) return { kind: "absent" };
144
+ return { kind: "unreadable", err };
145
+ }
146
+ try {
147
+ if (!(await handle.stat()).isFile()) return { kind: "not-regular" };
148
+ return { kind: "ok", bytes: await handle.readFile() };
149
+ } catch (err) {
150
+ return { kind: "unreadable", err };
151
+ } finally {
152
+ await handle.close().catch(() => void 0);
153
+ }
154
+ }
155
+ function skillFrontmatterName(skillMd) {
156
+ const frontmatter = extractFrontmatter(skillMd);
157
+ if (frontmatter === null) return null;
158
+ for (const line of frontmatter) {
159
+ const m = /^name:\s*(.+?)\s*$/.exec(line);
160
+ if (m !== null) return (m[1] ?? "").replace(/^["']|["']$/g, "");
161
+ }
162
+ return null;
163
+ }
164
+ function extractFrontmatter(text) {
165
+ const lines = text.replace(/^\uFEFF/, "").split(/\r?\n/);
166
+ const open2 = lines.findIndex((l) => l.trim().length > 0);
167
+ if (open2 === -1 || lines[open2]?.trim() !== "---") return null;
168
+ const end = lines.findIndex((l, i) => i > open2 && l.trim() === "---");
169
+ if (end === -1) return null;
170
+ return lines.slice(open2 + 1, end);
171
+ }
172
+
74
173
  // src/lib/harness-presence.ts
75
174
  async function installedHarnessInPlay(adapter, home, dataDir, options = {}) {
76
175
  const env = options.env ?? process.env;
@@ -87,7 +186,6 @@ async function installedHarnessInPlay(adapter, home, dataDir, options = {}) {
87
186
  }
88
187
 
89
188
  // src/commands/config.ts
90
- var CONFIRM_ABOVE = "above:";
91
189
  var KEY_WIDTH = Math.max(
92
190
  ...[
93
191
  ...CONFIG_KEYS,
@@ -100,9 +198,8 @@ var KEY_WIDTH = Math.max(
100
198
  ].map((key) => key.length)
101
199
  );
102
200
  var KEY_DESCRIPTIONS = {
103
- maxAutoSpend: "auto-approve a read up to this amount",
104
- sessionBudget: "cap on total auto-spend per session",
105
- confirm: "when to ask before paying",
201
+ maxAutoSpend: "automatic router limit per call",
202
+ sessionBudget: "automatic router daily limit: 0 blocks automatic spend, none removes the ceiling",
106
203
  sendMaxAmount: "hard cap per tenjin wallet send; unset = send refuses until set, 0 disables send, none = uncapped; never bypassed by --yes",
107
204
  allowlistCreators: "only auto-pay these creators (empty = any)",
108
205
  baseUrl: "Tenjin API base URL: what publish/read/search go to (the team shelf, in team mode)",
@@ -110,8 +207,7 @@ var KEY_DESCRIPTIONS = {
110
207
  shelfBypassSecret: "the team shelf's Vercel protection-bypass secret; setting it is what turns team mode on (printed as set/unset)",
111
208
  rpcUrl: "Base RPC endpoint for balance reads",
112
209
  evalCohort: "opt in to the search evaluation cohort",
113
- bazaarPay: "let `tenjin pay` spend at registry-listed non-Tenjin endpoints",
114
- bazaarRegistries: "x402 discovery registries for `discover` and the pay lane",
210
+ bazaarRegistries: "x402 registries used to verify direct-payment listings",
115
211
  "publish.mode": "review=always ask, auto=ask on findings, full-auto=only hard blocks stop it",
116
212
  "publish.defaultPrice": "price used when none is given",
117
213
  "publish.ackServerWarnings": "whether a yes covers the MARKETPLACE scan's warn findings: mode=only the ones an earlier render already showed you (full-auto still acks), on=any of them, off=never",
@@ -275,16 +371,6 @@ async function runConfigSet({
275
371
  const configKey = assertKey(key);
276
372
  const stored = parseValue(configKey, value);
277
373
  await persist(ctx.dataDir, (existing) => ({ ...existing, [configKey]: stored }));
278
- if (configKey === "bazaarPay") {
279
- try {
280
- const { syncBazaarSkill } = await import("./skill-placement-JMDPSKE6.js");
281
- await syncBazaarSkill(
282
- stored === true,
283
- deps.placeSkill ?? { io: ctx.io, dataDir: ctx.dataDir }
284
- );
285
- } catch {
286
- }
287
- }
288
374
  const entry = renderSetting(configKey, stored, "file");
289
375
  const warning = await halfWiredTeamShelf(configKey, ctx.dataDir);
290
376
  return {
@@ -528,7 +614,7 @@ function parseRouterContext(value) {
528
614
  });
529
615
  }
530
616
  async function persistProjectRouter(path, field, value) {
531
- await mkdir(dirname(path), { recursive: true, mode: 493 });
617
+ await mkdir(dirname2(path), { recursive: true, mode: 493 });
532
618
  const lockPath = `${path}.lock`;
533
619
  try {
534
620
  await withFileLock(lockPath, () => mergeProjectRouter(path, field, value));
@@ -574,9 +660,6 @@ async function persistPublishMode(dir, mode) {
574
660
  publish: { ...existing.publish, mode }
575
661
  }));
576
662
  }
577
- async function persistBazaarPay(dir, enabled) {
578
- await persist(dir, (existing) => ({ ...existing, bazaarPay: enabled }));
579
- }
580
663
  async function persistRouterProject(dir, projectDir, present = true) {
581
664
  await persist(dir, (existing) => {
582
665
  const known = new Set(existing.install?.routerProjects ?? []);
@@ -587,13 +670,16 @@ async function persistRouterProject(dir, projectDir, present = true) {
587
670
  }
588
671
  var ROUTER_DEFAULTS = {
589
672
  maxAutoSpend: "250000",
590
- sessionBudget: "5000000",
591
- confirm: "above:250000"
673
+ sessionBudget: "5000000"
592
674
  };
593
- async function persistRouterDefaults(dir) {
594
- const result = { set: [], kept: [] };
675
+ async function persistRouterDefaults(dir, refresh = false) {
676
+ const result = { set: [], kept: [], removed: [] };
677
+ if (refresh && retiredPaymentKeys(await loadRawConfig(dir)).length === 0) return result;
595
678
  await persist(dir, (existing) => {
596
- const next = { ...existing, bazaarPay: true };
679
+ const next = { ...existing };
680
+ result.removed = retiredPaymentKeys(existing);
681
+ for (const key of result.removed) delete next[key];
682
+ if (refresh) return next;
597
683
  for (const [key, value] of Object.entries(ROUTER_DEFAULTS)) {
598
684
  if (existing[key] === void 0) {
599
685
  next[key] = value;
@@ -627,6 +713,9 @@ async function resolveFromContext(ctx) {
627
713
  });
628
714
  }
629
715
  function assertKey(key) {
716
+ if (key === "bazaarPay" || key === "confirm") {
717
+ throw new CliError("USAGE", `Retired config key: ${key}`, { fix: RETIRED_PAYMENT_GUIDANCE });
718
+ }
630
719
  if (CONFIG_KEYS.includes(key)) return key;
631
720
  throw new CliError("USAGE", `Unknown config key: ${JSON.stringify(key)}`, {
632
721
  fix: `Valid keys: ${[...CONFIG_KEYS, ...PUBLISH_CONFIG_KEYS, ...HOOKS_CONFIG_KEYS, ...ROUTER_CONFIG_KEYS].join(", ")}.`
@@ -659,25 +748,22 @@ function renderValue(key, stored) {
659
748
  return { value: typeof stored === "string" && stored.length > 0 ? "set" : "unset" };
660
749
  }
661
750
  if (Array.isArray(stored) || typeof stored === "boolean") return { value: stored };
751
+ if (key === "sessionBudget" && stored === "none") return { value: null };
662
752
  if (key === "maxAutoSpend" || key === "sessionBudget") return { value: toMoney(stored) };
663
753
  if (key === "sendMaxAmount") {
664
754
  return { value: stored === "none" || stored === SEND_MAX_UNSET ? stored : toMoney(stored) };
665
755
  }
666
- if (key === "confirm" && stored.startsWith(CONFIRM_ABOVE)) {
667
- return { value: stored, threshold: toMoney(stored.slice(CONFIRM_ABOVE.length)) };
668
- }
669
756
  return { value: stored };
670
757
  }
671
758
  function parseValue(key, value) {
672
759
  switch (key) {
673
- case "maxAutoSpend":
674
760
  case "sessionBudget":
761
+ return value === "none" ? "none" : parseUsdToAtomic(value);
762
+ case "maxAutoSpend":
675
763
  return parseUsdToAtomic(value);
676
764
  // throws USAGE on a bad amount
677
765
  case "sendMaxAmount":
678
766
  return value === "none" ? "none" : parseUsdToAtomic(value);
679
- case "confirm":
680
- return parseConfirm(value);
681
767
  case "allowlistCreators":
682
768
  return parseAllowlist(value);
683
769
  case "baseUrl":
@@ -687,7 +773,6 @@ function parseValue(key, value) {
687
773
  case "shelfBypassSecret":
688
774
  return value.trim();
689
775
  case "evalCohort":
690
- case "bazaarPay":
691
776
  return parseBoolean(value);
692
777
  case "bazaarRegistries":
693
778
  return parseRegistryList(value);
@@ -703,15 +788,6 @@ function parseBoolean(value) {
703
788
  fix: 'Use "on" or "off" (or "true"/"false").'
704
789
  });
705
790
  }
706
- function parseConfirm(value) {
707
- if (value === "always") return "always";
708
- if (value.startsWith(CONFIRM_ABOVE)) {
709
- return `${CONFIRM_ABOVE}${parseUsdToAtomic(value.slice(CONFIRM_ABOVE.length))}`;
710
- }
711
- throw new CliError("USAGE", `Invalid confirm value: ${JSON.stringify(value)}`, {
712
- fix: 'Use "always" or "above:<usd>", e.g. above:0.25.'
713
- });
714
- }
715
791
  function parseAllowlist(value) {
716
792
  const entries = value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
717
793
  for (const entry of entries) {
@@ -787,22 +863,26 @@ function displayValue(entry) {
787
863
  const { value } = entry;
788
864
  if (Array.isArray(value)) return value.length > 0 ? value.join(", ") : "(empty)";
789
865
  if (typeof value === "boolean") return value ? "true" : "false";
866
+ if (value === null) return "none (no daily limit)";
790
867
  if (typeof value === "object") return `${value.usd} USD`;
791
- if (entry.threshold !== void 0) return `above ${entry.threshold.usd} USD`;
792
868
  return value;
793
869
  }
794
870
 
795
871
  export {
872
+ RETIRED_SKILL_NAMES,
873
+ skillsDirsFor,
874
+ onPath,
875
+ readSkillFile,
876
+ skillFrontmatterName,
796
877
  runConfigList,
797
878
  runConfigGet,
798
879
  runConfigSet,
799
880
  persistHookArm,
800
881
  persistPublishMode,
801
- persistBazaarPay,
802
882
  persistRouterProject,
803
883
  ROUTER_DEFAULTS,
804
884
  persistRouterDefaults,
805
885
  persistInstallHarness,
806
886
  persistGrantDeclined
807
887
  };
808
- //# sourceMappingURL=chunk-KK4YGYTV.js.map
888
+ //# sourceMappingURL=chunk-AMG4SONW.js.map