tenjin-cli 0.1.0-alpha.12 → 0.1.0-alpha.14

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 (155) hide show
  1. package/README.md +36 -2
  2. package/dist/{buy-3DTBFZ4B.js → buy-2JBYPHAI.js} +23 -21
  3. package/dist/{chunk-Y7ERTA7D.js → chunk-3P3ES4XU.js} +4 -6
  4. package/dist/chunk-3P3ES4XU.js.map +1 -0
  5. package/dist/{chunk-WWIKAJFO.js → chunk-3ZW7HPY5.js} +12 -10
  6. package/dist/{chunk-WWIKAJFO.js.map → chunk-3ZW7HPY5.js.map} +1 -1
  7. package/dist/chunk-4UHNXY6B.js +786 -0
  8. package/dist/chunk-4UHNXY6B.js.map +1 -0
  9. package/dist/{chunk-6UY2UQMY.js → chunk-4Y53PDH6.js} +4 -4
  10. package/dist/{chunk-TUXKOIOU.js → chunk-54AJIO3E.js} +12 -13
  11. package/dist/chunk-54AJIO3E.js.map +1 -0
  12. package/dist/chunk-736DW4V3.js +65 -0
  13. package/dist/chunk-736DW4V3.js.map +1 -0
  14. package/dist/{chunk-CNUXRXI2.js → chunk-7GJQ5RGA.js} +9 -9
  15. package/dist/{chunk-4NTZETIL.js → chunk-7NADDA2V.js} +10 -7
  16. package/dist/{chunk-4NTZETIL.js.map → chunk-7NADDA2V.js.map} +1 -1
  17. package/dist/{chunk-UFPJBS4C.js → chunk-ACBEHJAH.js} +10 -8
  18. package/dist/{chunk-UFPJBS4C.js.map → chunk-ACBEHJAH.js.map} +1 -1
  19. package/dist/{chunk-IB63U6BM.js → chunk-B676GPS2.js} +34 -11
  20. package/dist/chunk-B676GPS2.js.map +1 -0
  21. package/dist/{chunk-MBKFZBB2.js → chunk-DAZAXFSF.js} +24 -24
  22. package/dist/{chunk-E6YOODH7.js → chunk-DTCXO7HS.js} +284 -406
  23. package/dist/chunk-DTCXO7HS.js.map +1 -0
  24. package/dist/{chunk-HWHYPCCH.js → chunk-ETKZWJ4B.js} +2 -2
  25. package/dist/{chunk-HWHYPCCH.js.map → chunk-ETKZWJ4B.js.map} +1 -1
  26. package/dist/{chunk-X2WZPGCF.js → chunk-FDUD3W5V.js} +5 -5
  27. package/dist/{chunk-6RMEX74N.js → chunk-GEHL43VE.js} +63 -26
  28. package/dist/chunk-GEHL43VE.js.map +1 -0
  29. package/dist/chunk-IU2HVT3Y.js +313 -0
  30. package/dist/chunk-IU2HVT3Y.js.map +1 -0
  31. package/dist/{chunk-4TCU3YRD.js → chunk-IUQZ4Z7M.js} +40 -8
  32. package/dist/chunk-IUQZ4Z7M.js.map +1 -0
  33. package/dist/{chunk-CBNXUQGM.js → chunk-IXZJ3JOO.js} +10 -8
  34. package/dist/{chunk-CBNXUQGM.js.map → chunk-IXZJ3JOO.js.map} +1 -1
  35. package/dist/{chunk-NUF2PKJO.js → chunk-J6FUAIRR.js} +4 -6
  36. package/dist/{chunk-NUF2PKJO.js.map → chunk-J6FUAIRR.js.map} +1 -1
  37. package/dist/{chunk-OZHJ3FLR.js → chunk-L6G35FU5.js} +5 -5
  38. package/dist/{chunk-ALUNME53.js → chunk-LSWP7MU2.js} +52 -68
  39. package/dist/chunk-LSWP7MU2.js.map +1 -0
  40. package/dist/chunk-MJSXP4LW.js +191 -0
  41. package/dist/chunk-MJSXP4LW.js.map +1 -0
  42. package/dist/{chunk-RSBN67PA.js → chunk-NAAMHWSI.js} +7 -6
  43. package/dist/chunk-NAAMHWSI.js.map +1 -0
  44. package/dist/{chunk-7MJVNALU.js → chunk-O75FOHXS.js} +35 -15
  45. package/dist/chunk-O75FOHXS.js.map +1 -0
  46. package/dist/{chunk-6BGYHARE.js → chunk-OWVVI4VQ.js} +15 -15
  47. package/dist/{chunk-PZRAAAY2.js → chunk-PAOVPSP6.js} +10 -3
  48. package/dist/chunk-PAOVPSP6.js.map +1 -0
  49. package/dist/{chunk-ROAK2DOX.js → chunk-PCX2JQ2J.js} +8 -8
  50. package/dist/{chunk-JTYIX6OD.js → chunk-PKW3H26Z.js} +7 -5
  51. package/dist/{chunk-JTYIX6OD.js.map → chunk-PKW3H26Z.js.map} +1 -1
  52. package/dist/{chunk-V5UHKC46.js → chunk-PQZVDCCA.js} +7 -7
  53. package/dist/{chunk-P74I3WH4.js → chunk-QWBUKIP2.js} +9 -5
  54. package/dist/chunk-QWBUKIP2.js.map +1 -0
  55. package/dist/{chunk-FKSAUOJU.js → chunk-UO22YNY4.js} +1 -69
  56. package/dist/chunk-UO22YNY4.js.map +1 -0
  57. package/dist/chunk-VEAERJVJ.js +43 -0
  58. package/dist/chunk-VEAERJVJ.js.map +1 -0
  59. package/dist/{chunk-ILDVGY7K.js → chunk-VRPLZERE.js} +25 -12
  60. package/dist/chunk-VRPLZERE.js.map +1 -0
  61. package/dist/{chunk-L3I2MVKR.js → chunk-W4VW5XYB.js} +6 -6
  62. package/dist/{chunk-TDDN5GXR.js → chunk-WU5CZPLD.js} +5 -5
  63. package/dist/chunk-WYLMJQVH.js +240 -0
  64. package/dist/chunk-WYLMJQVH.js.map +1 -0
  65. package/dist/{chunk-PZSUWDF2.js → chunk-XGZ5EVMB.js} +2 -2
  66. package/dist/{chunk-CLOEU7RA.js → chunk-XVPQGCH4.js} +14 -13
  67. package/dist/chunk-XVPQGCH4.js.map +1 -0
  68. package/dist/chunk-ZOBNS7CX.js +73 -0
  69. package/dist/chunk-ZOBNS7CX.js.map +1 -0
  70. package/dist/{cli-3WZGLZDP.js → cli-U2BEUA55.js} +53 -150
  71. package/dist/cli-U2BEUA55.js.map +1 -0
  72. package/dist/{config-WDGMZKHU.js → config-CNUIX23Q.js} +14 -8
  73. package/dist/doctor-QJJXRWTO.js +31 -0
  74. package/dist/edit-HJ44P44P.js +40 -0
  75. package/dist/{fund-JAPOFTUG.js → fund-Y5IAHZ5D.js} +19 -17
  76. package/dist/index.js +1 -1
  77. package/dist/inspect-NFQ6SQQQ.js +37 -0
  78. package/dist/{install-WXTOHDWC.js → install-DXX7PVUP.js} +128 -408
  79. package/dist/install-DXX7PVUP.js.map +1 -0
  80. package/dist/outcome-ANV4QIED.js +24 -0
  81. package/dist/publish-PCBTCXCZ.js +42 -0
  82. package/dist/{read-UAZGZ4UL.js → read-W7QVRBVD.js} +24 -22
  83. package/dist/{read-UAZGZ4UL.js.map → read-W7QVRBVD.js.map} +1 -1
  84. package/dist/{run-AJNCOT5R.js → run-CJWPGMIQ.js} +35 -33
  85. package/dist/{run-AJNCOT5R.js.map → run-CJWPGMIQ.js.map} +1 -1
  86. package/dist/search-JGAVKTYJ.js +25 -0
  87. package/dist/{send-F34ZDXDZ.js → send-C5EOKXOU.js} +13 -11
  88. package/dist/{send-F34ZDXDZ.js.map → send-C5EOKXOU.js.map} +1 -1
  89. package/dist/{session-4N4ZT3AH.js → session-OBCUUIFX.js} +16 -15
  90. package/dist/{session-4N4ZT3AH.js.map → session-OBCUUIFX.js.map} +1 -1
  91. package/dist/{skill-heal-XBEK272G.js → skill-heal-D6EPLPS6.js} +5 -6
  92. package/dist/skill-heal-D6EPLPS6.js.map +1 -0
  93. package/dist/{uninstall-BTKPHPDL.js → uninstall-OWJNJ5LI.js} +13 -8
  94. package/dist/uninstall-OWJNJ5LI.js.map +1 -0
  95. package/dist/update-24Y2CQTT.js +318 -0
  96. package/dist/update-24Y2CQTT.js.map +1 -0
  97. package/dist/{wallet-WJ6UP5OU.js → wallet-OFXDIIGP.js} +11 -10
  98. package/dist/{wallet-UL4P2JRO.js → wallet-SLRIYJ2U.js} +7 -7
  99. package/docs/agent-permissions.md +111 -16
  100. package/docs/command-reference.md +68 -11
  101. package/package.json +1 -1
  102. package/skills/tenjin-publish/SKILL.md +181 -192
  103. package/skills/tenjin-publish/references/maintain.md +39 -0
  104. package/skills/tenjin-search/SKILL.md +86 -279
  105. package/skills/tenjin-search/references/permissions.md +106 -0
  106. package/dist/chunk-2I4QTOLB.js +0 -11
  107. package/dist/chunk-2I4QTOLB.js.map +0 -1
  108. package/dist/chunk-4TCU3YRD.js.map +0 -1
  109. package/dist/chunk-6RMEX74N.js.map +0 -1
  110. package/dist/chunk-7MJVNALU.js.map +0 -1
  111. package/dist/chunk-ALUNME53.js.map +0 -1
  112. package/dist/chunk-CLOEU7RA.js.map +0 -1
  113. package/dist/chunk-E6YOODH7.js.map +0 -1
  114. package/dist/chunk-FKSAUOJU.js.map +0 -1
  115. package/dist/chunk-IB63U6BM.js.map +0 -1
  116. package/dist/chunk-ILDVGY7K.js.map +0 -1
  117. package/dist/chunk-P74I3WH4.js.map +0 -1
  118. package/dist/chunk-PZRAAAY2.js.map +0 -1
  119. package/dist/chunk-RSBN67PA.js.map +0 -1
  120. package/dist/chunk-SFGXAZ3M.js +0 -316
  121. package/dist/chunk-SFGXAZ3M.js.map +0 -1
  122. package/dist/chunk-TUXKOIOU.js.map +0 -1
  123. package/dist/chunk-Y7ERTA7D.js.map +0 -1
  124. package/dist/cli-3WZGLZDP.js.map +0 -1
  125. package/dist/doctor-EKVCP7JP.js +0 -27
  126. package/dist/edit-4UZQVFCK.js +0 -38
  127. package/dist/inspect-IEV75A42.js +0 -35
  128. package/dist/install-WXTOHDWC.js.map +0 -1
  129. package/dist/outcome-FYOFDOUK.js +0 -22
  130. package/dist/publish-6QNARH7E.js +0 -40
  131. package/dist/search-EEKTW6VK.js +0 -23
  132. package/dist/skill-heal-XBEK272G.js.map +0 -1
  133. package/dist/uninstall-BTKPHPDL.js.map +0 -1
  134. /package/dist/{buy-3DTBFZ4B.js.map → buy-2JBYPHAI.js.map} +0 -0
  135. /package/dist/{chunk-6UY2UQMY.js.map → chunk-4Y53PDH6.js.map} +0 -0
  136. /package/dist/{chunk-CNUXRXI2.js.map → chunk-7GJQ5RGA.js.map} +0 -0
  137. /package/dist/{chunk-MBKFZBB2.js.map → chunk-DAZAXFSF.js.map} +0 -0
  138. /package/dist/{chunk-X2WZPGCF.js.map → chunk-FDUD3W5V.js.map} +0 -0
  139. /package/dist/{chunk-OZHJ3FLR.js.map → chunk-L6G35FU5.js.map} +0 -0
  140. /package/dist/{chunk-6BGYHARE.js.map → chunk-OWVVI4VQ.js.map} +0 -0
  141. /package/dist/{chunk-ROAK2DOX.js.map → chunk-PCX2JQ2J.js.map} +0 -0
  142. /package/dist/{chunk-V5UHKC46.js.map → chunk-PQZVDCCA.js.map} +0 -0
  143. /package/dist/{chunk-L3I2MVKR.js.map → chunk-W4VW5XYB.js.map} +0 -0
  144. /package/dist/{chunk-TDDN5GXR.js.map → chunk-WU5CZPLD.js.map} +0 -0
  145. /package/dist/{chunk-PZSUWDF2.js.map → chunk-XGZ5EVMB.js.map} +0 -0
  146. /package/dist/{config-WDGMZKHU.js.map → config-CNUIX23Q.js.map} +0 -0
  147. /package/dist/{doctor-EKVCP7JP.js.map → doctor-QJJXRWTO.js.map} +0 -0
  148. /package/dist/{edit-4UZQVFCK.js.map → edit-HJ44P44P.js.map} +0 -0
  149. /package/dist/{fund-JAPOFTUG.js.map → fund-Y5IAHZ5D.js.map} +0 -0
  150. /package/dist/{inspect-IEV75A42.js.map → inspect-NFQ6SQQQ.js.map} +0 -0
  151. /package/dist/{outcome-FYOFDOUK.js.map → outcome-ANV4QIED.js.map} +0 -0
  152. /package/dist/{publish-6QNARH7E.js.map → publish-PCBTCXCZ.js.map} +0 -0
  153. /package/dist/{search-EEKTW6VK.js.map → search-JGAVKTYJ.js.map} +0 -0
  154. /package/dist/{wallet-UL4P2JRO.js.map → wallet-OFXDIIGP.js.map} +0 -0
  155. /package/dist/{wallet-WJ6UP5OU.js.map → wallet-SLRIYJ2U.js.map} +0 -0
@@ -0,0 +1,25 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ runSearch
4
+ } from "./chunk-XVPQGCH4.js";
5
+ import "./chunk-4Y53PDH6.js";
6
+ import "./chunk-7NADDA2V.js";
7
+ import "./chunk-FDUD3W5V.js";
8
+ import "./chunk-54AJIO3E.js";
9
+ import "./chunk-XGZ5EVMB.js";
10
+ import "./chunk-B676GPS2.js";
11
+ import "./chunk-ZOBNS7CX.js";
12
+ import "./chunk-PKW3H26Z.js";
13
+ import "./chunk-736DW4V3.js";
14
+ import "./chunk-UO22YNY4.js";
15
+ import "./chunk-VEAERJVJ.js";
16
+ import "./chunk-LSWP7MU2.js";
17
+ import "./chunk-ETKZWJ4B.js";
18
+ import "./chunk-ZQIQ55KK.js";
19
+ import "./chunk-QWBUKIP2.js";
20
+ import "./chunk-PAOVPSP6.js";
21
+ import "./chunk-ZXTAQYNA.js";
22
+ export {
23
+ runSearch
24
+ };
25
+ //# sourceMappingURL=search-JGAVKTYJ.js.map
@@ -14,24 +14,26 @@ import {
14
14
  import {
15
15
  describeWallet,
16
16
  resolveWalletProvider
17
- } from "./chunk-CNUXRXI2.js";
18
- import "./chunk-Y7ERTA7D.js";
19
- import "./chunk-IB63U6BM.js";
17
+ } from "./chunk-7GJQ5RGA.js";
18
+ import "./chunk-3P3ES4XU.js";
19
+ import "./chunk-B676GPS2.js";
20
+ import "./chunk-ZOBNS7CX.js";
20
21
  import {
21
22
  resolveContextSettings
22
- } from "./chunk-JTYIX6OD.js";
23
- import "./chunk-FKSAUOJU.js";
23
+ } from "./chunk-PKW3H26Z.js";
24
24
  import {
25
- SEND_MAX_UNSET,
26
25
  parseUsdToAtomic,
27
26
  toMoney
28
- } from "./chunk-ALUNME53.js";
27
+ } from "./chunk-736DW4V3.js";
28
+ import "./chunk-UO22YNY4.js";
29
+ import {
30
+ SEND_MAX_UNSET
31
+ } from "./chunk-LSWP7MU2.js";
29
32
  import "./chunk-ZQIQ55KK.js";
30
- import "./chunk-P74I3WH4.js";
31
- import "./chunk-2I4QTOLB.js";
33
+ import "./chunk-QWBUKIP2.js";
32
34
  import {
33
35
  CliError
34
- } from "./chunk-PZRAAAY2.js";
36
+ } from "./chunk-PAOVPSP6.js";
35
37
  import "./chunk-7FK2UN2T.js";
36
38
  import "./chunk-M2O56UK7.js";
37
39
  import "./chunk-UHTVXQ2O.js";
@@ -220,4 +222,4 @@ This moves funds out of the agent wallet and cannot be undone. [y/N] `;
220
222
  export {
221
223
  runSend
222
224
  };
223
- //# sourceMappingURL=send-F34ZDXDZ.js.map
225
+ //# sourceMappingURL=send-C5EOKXOU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/send.ts"],"sourcesContent":["import { formatEther, getAddress, isAddress, type Address } from 'viem';\nimport { SEND_MAX_UNSET } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { parseUsdToAtomic, toMoney } from '../lib/money';\nimport { promptYesNo } from '../lib/prompt';\nimport { resolveContextSettings } from '../lib/settings';\nimport {\n broadcastUsdcSend,\n FeeCapExceededError,\n getUsdcBalance,\n prepareUsdcSend,\n SendPendingError,\n SendRevertedError,\n USDC_ADDRESS,\n} from '../lib/usdc';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin send <amount> <token> <to>`: the escape hatch that moves funds OUT of\n * the agent wallet, complementary to delegation (which redirects future revenue\n * off the hot key; this is for a balance already on it). Invariants a reader\n * cannot derive from the code order alone:\n * - the confirm (buy's posture: interactive y/N, `--yes` bypasses the prompt\n * only, headless without it refuses) runs BEFORE the signer is resolved, so\n * no refusal branch ever touches key material;\n * - `sendMaxAmount` is a spend-policy gate, NOT satisfiable by --yes, and it\n * has NO default: unset refuses until `config set sendMaxAmount` is run\n * (require-set-before-first-send; \"none\" is an explicit uncapped opt-in);\n * - the verb is deliberately absent from the MCP toolset (spec 10's narrow\n * toolset) and the skill adapters — human-invoked only, both pinned by tests.\n */\n\nexport interface SendArgs {\n /** Decimal USD at the edge (O1 convention); converted to atomic exactly once. */\n amount: string;\n token: string;\n /** Recipient address, 0x-prefixed; checksummed or all-lowercase. */\n to: string;\n /** Skip the interactive confirm. REQUIRED to send when not at a TTY. */\n yes?: boolean;\n}\n\nexport interface SendDeps {\n /** Test seam: bypass the local wallet provider. */\n provider?: WalletProvider;\n /** Interactive-confirm seam; defaults to a TTY y/n prompt (same shape as buy). */\n confirm?: (prompt: string) => Promise<boolean>;\n}\n\nconst ZERO_ADDRESS: Address = '0x0000000000000000000000000000000000000000';\nconst DEAD_ADDRESS: Address = '0x000000000000000000000000000000000000dEaD';\n\nexport async function runSend(\n args: SendArgs,\n ctx: CommandContext,\n deps: SendDeps = {},\n): Promise<CommandResult> {\n requireUsdc(args.token);\n const amountAtomic = BigInt(parseUsdToAtomic(args.amount));\n if (amountAtomic === 0n) {\n throw new CliError('USAGE', 'The send amount must be greater than zero.', {\n fix: 'Pass a positive decimal USDC amount, e.g. `tenjin send 5 usdc <to>`.',\n });\n }\n const to = parseRecipient(args.to);\n\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // Address + posture only; surfaces WALLET_MISSING. No key material yet.\n const desc = await describeWallet(provider);\n if (to.toLowerCase() === desc.address.toLowerCase()) {\n throw new CliError('USAGE', 'The recipient is this wallet itself.', {\n fix: 'Pass the destination wallet address, not the sending one.',\n });\n }\n\n const { rpcUrl, sendMaxAmountAtomic } = await resolveContextSettings(ctx);\n enforceSendCap(amountAtomic, sendMaxAmountAtomic);\n\n let balance: bigint;\n try {\n balance = await getUsdcBalance(desc.address, rpcUrl);\n } catch (err) {\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (amountAtomic > balance) {\n throw new CliError('REFUSED', 'The amount exceeds the wallet USDC balance.', {\n fix: 'Check `tenjin wallet balance` and send at most that amount.',\n details: {\n requested: toMoney(amountAtomic.toString()),\n balance: toMoney(balance.toString()),\n },\n });\n }\n\n // Read-only chain prep before the confirm, so the prompt can show the fee and\n // a wallet without gas refuses before asking anyone to approve anything.\n let prepared;\n try {\n prepared = await prepareUsdcSend({ from: desc.address, to, amountAtomic, rpcUrl });\n } catch (err) {\n if (err instanceof FeeCapExceededError) {\n throw new CliError('REFUSED', 'The RPC gas/fee estimate is abnormal for Base; refusing.', {\n fix: 'Check `tenjin config get rpcUrl` points at a trusted Base RPC; if the RPC is fine, Base fees are spiking — wait and retry.',\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'Could not prepare the transfer on Base.', {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (prepared.ethBalanceWei < prepared.feeWei) {\n throw new CliError('REFUSED', 'The wallet has no ETH on Base to pay the network fee.', {\n fix: `Send a little ETH on Base to ${desc.address} (about ${formatEther(prepared.feeWei)} ETH needed), then retry.`,\n details: {\n ethBalanceWei: prepared.ethBalanceWei.toString(),\n feeWei: prepared.feeWei.toString(),\n },\n });\n }\n\n const approved = await confirmSend(ctx, deps, args.yes === true, {\n amountAtomic,\n to,\n from: desc.address,\n feeWei: prepared.feeWei,\n });\n if (!approved) {\n throw new CliError('REFUSED', 'Send not confirmed.', {\n fix: 'Verify the recipient and amount, then re-run with --yes to approve this transfer.',\n details: { to, amount: toMoney(amountAtomic.toString()) },\n });\n }\n\n // The only door to the key; a missing passphrase entry refuses here with the\n // provider's coded error. The signer must be the wallet the human just saw:\n // the local provider guarantees it, a hosted one is only trusted after this.\n const signer = await provider.getSigner();\n if (signer.address.toLowerCase() !== desc.address.toLowerCase()) {\n throw new CliError(\n 'PROVIDER_ERROR',\n `The signer address ${signer.address} does not match the confirmed wallet ${desc.address}.`,\n { fix: 'The wallet changed between preview and signing; re-run `tenjin send`.' },\n );\n }\n\n let txHash: string;\n try {\n txHash = await broadcastUsdcSend({ signer, prepared, rpcUrl });\n } catch (err) {\n if (err instanceof SendRevertedError) {\n throw new CliError('SEND_FAILED', 'The transfer was mined but reverted; no USDC moved.', {\n fix: 'Check the transaction on a Base explorer, then retry if the cause is transient.',\n details: { txHash: err.txHash },\n cause: err,\n });\n }\n if (err instanceof SendPendingError) {\n throw new CliError('SEND_FAILED', 'The transfer was broadcast but not confirmed in time.', {\n fix: 'Check the transaction on a Base explorer before retrying: it may still mine, and an immediate retry could double-send.',\n details: { txHash: err.txHash, pending: true },\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'The transfer could not be sent on Base.', {\n fix: 'Check the network and RPC, then retry.',\n cause: err,\n });\n }\n\n const amount = toMoney(amountAtomic.toString());\n return {\n data: { txHash, from: signer.address, to, token: 'USDC', network: 'base', amount },\n humanLines: [`Sent ${amount.usd} USDC on Base to ${to}`, `Tx: ${txHash}`],\n };\n}\n\n/**\n * The hard per-send cap (`config set sendMaxAmount`): a policy gate, not a\n * confirm — no branch here is satisfiable by --yes. There is no default cap:\n * an unset key refuses (require-set-before-first-send), exactly as strict as\n * the set-cap refusals below.\n */\nfunction enforceSendCap(\n amountAtomic: bigint,\n capAtomic: bigint | null | typeof SEND_MAX_UNSET,\n): void {\n if (capAtomic === SEND_MAX_UNSET) {\n throw new CliError(\n 'POLICY_REFUSED',\n 'No sendMaxAmount is configured; a per-send cap must be set before the first send.',\n {\n fix: 'Run `tenjin config set sendMaxAmount <usd>` (or `0` to disable send, or `none` to opt in to uncapped), then retry. --yes does not bypass this.',\n },\n );\n }\n if (capAtomic === null) return;\n if (capAtomic === 0n) {\n throw new CliError('POLICY_REFUSED', 'Sending is disabled by sendMaxAmount = 0.', {\n fix: 'Run `tenjin config set sendMaxAmount <usd|none>` to allow sends.',\n });\n }\n if (amountAtomic > capAtomic) {\n throw new CliError('POLICY_REFUSED', 'The amount exceeds the sendMaxAmount cap.', {\n fix: 'Send a smaller amount, or raise the cap with `tenjin config set sendMaxAmount <usd>`.',\n details: { requested: toMoney(amountAtomic.toString()), cap: toMoney(capAtomic.toString()) },\n });\n }\n}\n\n/** USDC on Base only; anything else is a usage error, not a guess. */\nfunction requireUsdc(token: string): void {\n if (token.trim().toLowerCase() === 'usdc') return;\n throw new CliError('USAGE', `Unsupported token: ${JSON.stringify(token)}`, {\n fix: 'Only USDC on Base is supported: `tenjin send <amount> usdc <to>`.',\n });\n}\n\n/**\n * Validate and resolve the recipient. Strict `isAddress` refuses malformed input\n * and a bad EIP-55 checksum on MIXED-CASE input (all-lowercase input carries no\n * checksum to verify — that limit is inherent to the format); `getAddress` then\n * yields the checksummed form the preview shows and the transfer targets. Known\n * fund-destroying destinations (the USDC contract, the zero address, the burn\n * address) refuse outright.\n */\nfunction parseRecipient(raw: string): Address {\n const trimmed = raw.trim();\n if (!isAddress(trimmed)) {\n throw new CliError('USAGE', `Invalid recipient address: ${JSON.stringify(raw)}`, {\n fix: 'Pass a 0x-prefixed 20-byte address, checksummed or all-lowercase (lowercase skips the checksum typo check).',\n });\n }\n const to = getAddress(trimmed);\n if (to === USDC_ADDRESS || to === ZERO_ADDRESS || to === DEAD_ADDRESS) {\n throw new CliError('USAGE', 'The recipient is a known fund-destroying address.', {\n fix: 'Tokens sent to the token contract, the zero address, or the burn address are unrecoverable. Pass the destination wallet address.',\n });\n }\n return to;\n}\n\ninterface ConfirmDetails {\n amountAtomic: bigint;\n to: Address;\n from: Address;\n feeWei: bigint;\n}\n\n/** Buy's confirm posture; the preview names the resolved recipient, amount, and fee. */\nasync function confirmSend(\n ctx: CommandContext,\n deps: SendDeps,\n yes: boolean,\n d: ConfirmDetails,\n): Promise<boolean> {\n if (yes) return true;\n const prompt =\n `Send ${toMoney(d.amountAtomic.toString()).usd} USDC on Base\\n` +\n ` from ${d.from}\\n` +\n ` to ${d.to}\\n` +\n ` network fee up to ~${formatEther(d.feeWei)} ETH\\n` +\n `This moves funds out of the agent wallet and cannot be undone. [y/N] `;\n if (deps.confirm !== undefined) return deps.confirm(prompt);\n // Both streams must be real TTYs; piped stdin/stdout without --yes refuses.\n if (!ctx.io.isTTY || !process.stdin.isTTY) return false;\n return promptYesNo(prompt);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAM,eAAwB;AAC9B,IAAM,eAAwB;AAE9B,eAAsB,QACpB,MACA,KACA,OAAiB,CAAC,GACM;AAC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ACH;AAUA,SAAS,eAAe,KAAsB;AAC5C,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,CAAC,UAAU,OAAO,GAAG;AACvB,UAAM,IAAI,SAAS,SAAS,8BAA8B,KAAK,UAAU,GAAG,CAAC,IAAI;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,KAAK,WAAW,OAAO;AAC7B,MAAI,OAAO,gBAAgB,OAAO,gBAAgB,OAAO,cAAc;AACrE,UAAM,IAAI,SAAS,SAAS,qDAAqD;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAUA,eAAe,YACb,KACA,MACA,KACA,GACkB;AAClB,MAAI,IAAK,QAAO;AAChB,QAAM,SACJ,QAAQ,QAAQ,EAAE,aAAa,SAAS,CAAC,EAAE,GAAG;AAAA,SACpC,EAAE,IAAI;AAAA,SACN,EAAE,EAAE;AAAA,uBACU,YAAY,EAAE,MAAM,CAAC;AAAA;AAE/C,MAAI,KAAK,YAAY,OAAW,QAAO,KAAK,QAAQ,MAAM;AAE1D,MAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,MAAM,MAAO,QAAO;AAClD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
1
+ {"version":3,"sources":["../src/commands/send.ts"],"sourcesContent":["import { formatEther, getAddress, isAddress, type Address } from 'viem';\nimport { SEND_MAX_UNSET } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { parseUsdToAtomic, toMoney } from '../lib/money';\nimport { promptYesNo } from '../lib/prompt';\nimport { resolveContextSettings } from '../lib/settings';\nimport {\n broadcastUsdcSend,\n FeeCapExceededError,\n getUsdcBalance,\n prepareUsdcSend,\n SendPendingError,\n SendRevertedError,\n USDC_ADDRESS,\n} from '../lib/usdc';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin send <amount> <token> <to>`: the escape hatch that moves funds OUT of\n * the agent wallet, complementary to delegation (which redirects future revenue\n * off the hot key; this is for a balance already on it). Invariants a reader\n * cannot derive from the code order alone:\n * - the confirm (buy's posture: interactive y/N, `--yes` bypasses the prompt\n * only, headless without it refuses) runs BEFORE the signer is resolved, so\n * no refusal branch ever touches key material;\n * - `sendMaxAmount` is a spend-policy gate, NOT satisfiable by --yes, and it\n * has NO default: unset refuses until `config set sendMaxAmount` is run\n * (require-set-before-first-send; \"none\" is an explicit uncapped opt-in);\n * - the verb is deliberately absent from the MCP toolset (spec 10's narrow\n * toolset) and the skill adapters — human-invoked only, both pinned by tests.\n */\n\nexport interface SendArgs {\n /** Decimal USD at the edge (O1 convention); converted to atomic exactly once. */\n amount: string;\n token: string;\n /** Recipient address, 0x-prefixed; checksummed or all-lowercase. */\n to: string;\n /** Skip the interactive confirm. REQUIRED to send when not at a TTY. */\n yes?: boolean;\n}\n\nexport interface SendDeps {\n /** Test seam: bypass the local wallet provider. */\n provider?: WalletProvider;\n /** Interactive-confirm seam; defaults to a TTY y/n prompt (same shape as buy). */\n confirm?: (prompt: string) => Promise<boolean>;\n}\n\nconst ZERO_ADDRESS: Address = '0x0000000000000000000000000000000000000000';\nconst DEAD_ADDRESS: Address = '0x000000000000000000000000000000000000dEaD';\n\nexport async function runSend(\n args: SendArgs,\n ctx: CommandContext,\n deps: SendDeps = {},\n): Promise<CommandResult> {\n requireUsdc(args.token);\n const amountAtomic = BigInt(parseUsdToAtomic(args.amount));\n if (amountAtomic === 0n) {\n throw new CliError('USAGE', 'The send amount must be greater than zero.', {\n fix: 'Pass a positive decimal USDC amount, e.g. `tenjin send 5 usdc <to>`.',\n });\n }\n const to = parseRecipient(args.to);\n\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // Address + posture only; surfaces WALLET_MISSING. No key material yet.\n const desc = await describeWallet(provider);\n if (to.toLowerCase() === desc.address.toLowerCase()) {\n throw new CliError('USAGE', 'The recipient is this wallet itself.', {\n fix: 'Pass the destination wallet address, not the sending one.',\n });\n }\n\n const { rpcUrl, sendMaxAmountAtomic } = await resolveContextSettings(ctx);\n enforceSendCap(amountAtomic, sendMaxAmountAtomic);\n\n let balance: bigint;\n try {\n balance = await getUsdcBalance(desc.address, rpcUrl);\n } catch (err) {\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (amountAtomic > balance) {\n throw new CliError('REFUSED', 'The amount exceeds the wallet USDC balance.', {\n fix: 'Check `tenjin wallet balance` and send at most that amount.',\n details: {\n requested: toMoney(amountAtomic.toString()),\n balance: toMoney(balance.toString()),\n },\n });\n }\n\n // Read-only chain prep before the confirm, so the prompt can show the fee and\n // a wallet without gas refuses before asking anyone to approve anything.\n let prepared;\n try {\n prepared = await prepareUsdcSend({ from: desc.address, to, amountAtomic, rpcUrl });\n } catch (err) {\n if (err instanceof FeeCapExceededError) {\n throw new CliError('REFUSED', 'The RPC gas/fee estimate is abnormal for Base; refusing.', {\n fix: 'Check `tenjin config get rpcUrl` points at a trusted Base RPC; if the RPC is fine, Base fees are spiking — wait and retry.',\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'Could not prepare the transfer on Base.', {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (prepared.ethBalanceWei < prepared.feeWei) {\n throw new CliError('REFUSED', 'The wallet has no ETH on Base to pay the network fee.', {\n fix: `Send a little ETH on Base to ${desc.address} (about ${formatEther(prepared.feeWei)} ETH needed), then retry.`,\n details: {\n ethBalanceWei: prepared.ethBalanceWei.toString(),\n feeWei: prepared.feeWei.toString(),\n },\n });\n }\n\n const approved = await confirmSend(ctx, deps, args.yes === true, {\n amountAtomic,\n to,\n from: desc.address,\n feeWei: prepared.feeWei,\n });\n if (!approved) {\n throw new CliError('REFUSED', 'Send not confirmed.', {\n fix: 'Verify the recipient and amount, then re-run with --yes to approve this transfer.',\n details: { to, amount: toMoney(amountAtomic.toString()) },\n });\n }\n\n // The only door to the key; a missing passphrase entry refuses here with the\n // provider's coded error. The signer must be the wallet the human just saw:\n // the local provider guarantees it, a hosted one is only trusted after this.\n const signer = await provider.getSigner();\n if (signer.address.toLowerCase() !== desc.address.toLowerCase()) {\n throw new CliError(\n 'PROVIDER_ERROR',\n `The signer address ${signer.address} does not match the confirmed wallet ${desc.address}.`,\n { fix: 'The wallet changed between preview and signing; re-run `tenjin send`.' },\n );\n }\n\n let txHash: string;\n try {\n txHash = await broadcastUsdcSend({ signer, prepared, rpcUrl });\n } catch (err) {\n if (err instanceof SendRevertedError) {\n throw new CliError('SEND_FAILED', 'The transfer was mined but reverted; no USDC moved.', {\n fix: 'Check the transaction on a Base explorer, then retry if the cause is transient.',\n details: { txHash: err.txHash },\n cause: err,\n });\n }\n if (err instanceof SendPendingError) {\n throw new CliError('SEND_FAILED', 'The transfer was broadcast but not confirmed in time.', {\n fix: 'Check the transaction on a Base explorer before retrying: it may still mine, and an immediate retry could double-send.',\n details: { txHash: err.txHash, pending: true },\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'The transfer could not be sent on Base.', {\n fix: 'Check the network and RPC, then retry.',\n cause: err,\n });\n }\n\n const amount = toMoney(amountAtomic.toString());\n return {\n data: { txHash, from: signer.address, to, token: 'USDC', network: 'base', amount },\n humanLines: [`Sent ${amount.usd} USDC on Base to ${to}`, `Tx: ${txHash}`],\n };\n}\n\n/**\n * The hard per-send cap (`config set sendMaxAmount`): a policy gate, not a\n * confirm — no branch here is satisfiable by --yes. There is no default cap:\n * an unset key refuses (require-set-before-first-send), exactly as strict as\n * the set-cap refusals below.\n */\nfunction enforceSendCap(\n amountAtomic: bigint,\n capAtomic: bigint | null | typeof SEND_MAX_UNSET,\n): void {\n if (capAtomic === SEND_MAX_UNSET) {\n throw new CliError(\n 'POLICY_REFUSED',\n 'No sendMaxAmount is configured; a per-send cap must be set before the first send.',\n {\n fix: 'Run `tenjin config set sendMaxAmount <usd>` (or `0` to disable send, or `none` to opt in to uncapped), then retry. --yes does not bypass this.',\n },\n );\n }\n if (capAtomic === null) return;\n if (capAtomic === 0n) {\n throw new CliError('POLICY_REFUSED', 'Sending is disabled by sendMaxAmount = 0.', {\n fix: 'Run `tenjin config set sendMaxAmount <usd|none>` to allow sends.',\n });\n }\n if (amountAtomic > capAtomic) {\n throw new CliError('POLICY_REFUSED', 'The amount exceeds the sendMaxAmount cap.', {\n fix: 'Send a smaller amount, or raise the cap with `tenjin config set sendMaxAmount <usd>`.',\n details: { requested: toMoney(amountAtomic.toString()), cap: toMoney(capAtomic.toString()) },\n });\n }\n}\n\n/** USDC on Base only; anything else is a usage error, not a guess. */\nfunction requireUsdc(token: string): void {\n if (token.trim().toLowerCase() === 'usdc') return;\n throw new CliError('USAGE', `Unsupported token: ${JSON.stringify(token)}`, {\n fix: 'Only USDC on Base is supported: `tenjin send <amount> usdc <to>`.',\n });\n}\n\n/**\n * Validate and resolve the recipient. Strict `isAddress` refuses malformed input\n * and a bad EIP-55 checksum on MIXED-CASE input (all-lowercase input carries no\n * checksum to verify — that limit is inherent to the format); `getAddress` then\n * yields the checksummed form the preview shows and the transfer targets. Known\n * fund-destroying destinations (the USDC contract, the zero address, the burn\n * address) refuse outright.\n */\nfunction parseRecipient(raw: string): Address {\n const trimmed = raw.trim();\n if (!isAddress(trimmed)) {\n throw new CliError('USAGE', `Invalid recipient address: ${JSON.stringify(raw)}`, {\n fix: 'Pass a 0x-prefixed 20-byte address, checksummed or all-lowercase (lowercase skips the checksum typo check).',\n });\n }\n const to = getAddress(trimmed);\n if (to === USDC_ADDRESS || to === ZERO_ADDRESS || to === DEAD_ADDRESS) {\n throw new CliError('USAGE', 'The recipient is a known fund-destroying address.', {\n fix: 'Tokens sent to the token contract, the zero address, or the burn address are unrecoverable. Pass the destination wallet address.',\n });\n }\n return to;\n}\n\ninterface ConfirmDetails {\n amountAtomic: bigint;\n to: Address;\n from: Address;\n feeWei: bigint;\n}\n\n/** Buy's confirm posture; the preview names the resolved recipient, amount, and fee. */\nasync function confirmSend(\n ctx: CommandContext,\n deps: SendDeps,\n yes: boolean,\n d: ConfirmDetails,\n): Promise<boolean> {\n if (yes) return true;\n const prompt =\n `Send ${toMoney(d.amountAtomic.toString()).usd} USDC on Base\\n` +\n ` from ${d.from}\\n` +\n ` to ${d.to}\\n` +\n ` network fee up to ~${formatEther(d.feeWei)} ETH\\n` +\n `This moves funds out of the agent wallet and cannot be undone. [y/N] `;\n if (deps.confirm !== undefined) return deps.confirm(prompt);\n // Both streams must be real TTYs; piped stdin/stdout without --yes refuses.\n if (!ctx.io.isTTY || !process.stdin.isTTY) return false;\n return promptYesNo(prompt);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAM,eAAwB;AAC9B,IAAM,eAAwB;AAE9B,eAAsB,QACpB,MACA,KACA,OAAiB,CAAC,GACM;AACxB,cAAY,KAAK,KAAK;AACtB,QAAM,eAAe,OAAO,iBAAiB,KAAK,MAAM,CAAC;AACzD,MAAI,iBAAiB,IAAI;AACvB,UAAM,IAAI,SAAS,SAAS,8CAA8C;AAAA,MACxE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,KAAK,eAAe,KAAK,EAAE;AAEjC,QAAM,WAAW;AAAA,IACf;AAAA,IACA,KAAK,aAAa,SAAY,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;AAAA,EAC/D;AAEA,QAAM,OAAO,MAAM,eAAe,QAAQ;AAC1C,MAAI,GAAG,YAAY,MAAM,KAAK,QAAQ,YAAY,GAAG;AACnD,UAAM,IAAI,SAAS,SAAS,wCAAwC;AAAA,MAClE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,EAAE,QAAQ,oBAAoB,IAAI,MAAM,uBAAuB,GAAG;AACxE,iBAAe,cAAc,mBAAmB;AAEh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MAAM,CAAC;AAAA;AAE/C,MAAI,KAAK,YAAY,OAAW,QAAO,KAAK,QAAQ,MAAM;AAE1D,MAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,MAAM,MAAO,QAAO;AAClD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
@@ -2,36 +2,37 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
2
2
  import {
3
3
  SESSION_CHAIN_ID,
4
4
  establishSession
5
- } from "./chunk-TDDN5GXR.js";
6
- import "./chunk-6BGYHARE.js";
5
+ } from "./chunk-WU5CZPLD.js";
6
+ import "./chunk-OWVVI4VQ.js";
7
+ import "./chunk-KZAAWQNP.js";
7
8
  import "./chunk-S5RYMCV6.js";
8
9
  import "./chunk-POJRB2AE.js";
9
10
  import "./chunk-YLYINX2H.js";
10
11
  import {
11
12
  describeWallet,
12
13
  resolveWalletProvider
13
- } from "./chunk-CNUXRXI2.js";
14
+ } from "./chunk-7GJQ5RGA.js";
14
15
  import {
15
16
  isSessionUsable,
16
17
  loadSessionFile
17
- } from "./chunk-NUF2PKJO.js";
18
+ } from "./chunk-J6FUAIRR.js";
18
19
  import {
19
20
  originOf
20
- } from "./chunk-PZSUWDF2.js";
21
- import "./chunk-Y7ERTA7D.js";
22
- import "./chunk-KZAAWQNP.js";
23
- import "./chunk-IB63U6BM.js";
21
+ } from "./chunk-XGZ5EVMB.js";
22
+ import "./chunk-3P3ES4XU.js";
23
+ import "./chunk-B676GPS2.js";
24
+ import "./chunk-ZOBNS7CX.js";
24
25
  import {
25
26
  resolveContextSettings
26
- } from "./chunk-JTYIX6OD.js";
27
- import "./chunk-FKSAUOJU.js";
28
- import "./chunk-ALUNME53.js";
27
+ } from "./chunk-PKW3H26Z.js";
28
+ import "./chunk-736DW4V3.js";
29
+ import "./chunk-UO22YNY4.js";
30
+ import "./chunk-LSWP7MU2.js";
29
31
  import "./chunk-ZQIQ55KK.js";
30
- import "./chunk-P74I3WH4.js";
31
- import "./chunk-2I4QTOLB.js";
32
+ import "./chunk-QWBUKIP2.js";
32
33
  import {
33
34
  CliError
34
- } from "./chunk-PZRAAAY2.js";
35
+ } from "./chunk-PAOVPSP6.js";
35
36
  import "./chunk-M2O56UK7.js";
36
37
  import "./chunk-UHTVXQ2O.js";
37
38
  import "./chunk-W6R3HAAG.js";
@@ -85,4 +86,4 @@ function receipt(file, minted) {
85
86
  export {
86
87
  runSessionStart
87
88
  };
88
- //# sourceMappingURL=session-4N4ZT3AH.js.map
89
+ //# sourceMappingURL=session-OBCUUIFX.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/session.ts"],"sourcesContent":["import { CliError } from '../lib/errors';\nimport { resolveContextSettings } from '../lib/settings';\nimport { establishSession, SESSION_CHAIN_ID } from '../lib/session-key';\nimport { isSessionUsable, loadSessionFile, type SessionScope } from '../lib/session-present';\nimport { originOf } from '../lib/url';\nimport type { SessionFile } from '../lib/session-present';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin session start --scope read`: open the wallet ONCE and mint a ≤24h\n * P-256 session key that `tenjin read` can then present, unattended, to recover a\n * piece this wallet already owns but has not cached on this machine.\n *\n * This is the attended half of a deliberate split: `read` cannot open a keystore,\n * so the one wallet signature a recovery needs comes from a verb the operator\n * invokes on purpose. It spends nothing and cannot, but it does open the\n * keystore, which is why it sits in the OPT-IN tier beside `buy`.\n *\n * What it leaves on disk is a wallet-derived credential. Treat it as one: it is\n * bound to the origin it was minted against and every presenter re-checks that,\n * and the receipt below carries no key material. `lib/permissions.ts` states the\n * exposure an operator is accepting.\n *\n * v1 accepts NO other scope. `--scope read+write` is refused rather than\n * forwarded: a prefix allowlist rule pins the verb and not the flags, so the only\n * way `Bash(tenjin session start:*)` can be a non-escalatable grant is for every\n * command line it matches to mint the narrow scope. The write path keeps minting\n * its own `read+write` session lazily, from `publish`/`edit`, where a human is\n * already consenting to a write.\n */\n\n/** The only scope v1 mints; see the docblock for why that is load-bearing. */\nconst V1_SCOPE: SessionScope = 'read';\n\nexport interface SessionStartArgs {\n /** Raw `--scope`; validated at the edge, USAGE on anything but `read`. */\n scope?: string;\n}\n\nexport interface SessionStartDeps {\n provider?: WalletProvider;\n env?: NodeJS.ProcessEnv;\n /** Clock seam (ms since epoch) for the reuse decision. */\n now?: () => number;\n}\n\nexport async function runSessionStart(\n args: SessionStartArgs,\n ctx: CommandContext,\n deps: SessionStartDeps = {},\n): Promise<CommandResult> {\n const now = deps.now ?? Date.now;\n if (args.scope !== undefined && args.scope !== V1_SCOPE) {\n throw new CliError('USAGE', `Unsupported session scope: ${JSON.stringify(args.scope)}`, {\n fix: 'This version mints read-scoped sessions only; run `tenjin session start --scope read` (or omit the flag). A write-capable session is minted by `tenjin publish` / `tenjin edit` on the run that needs it.',\n });\n }\n\n const settings = await resolveContextSettings(ctx);\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // describe() reports the address WITHOUT unlocking the key, which is what makes\n // the reuse path below cost no wallet interaction (no passphrase prompt).\n const wallet = await describeWallet(provider);\n\n // Idempotent: a live session wide enough AND minted for this origin is reused,\n // so a second run opens no wallet, and a cached `read+write` (publish's) is\n // never downgraded. A session for another deployment is not reusable.\n const origin = originOf(settings.baseUrl);\n const cached = await loadSessionFile(ctx.dataDir);\n if (cached !== null && isSessionUsable(cached, wallet.address, now(), V1_SCOPE, origin)) {\n return receipt(cached, false);\n }\n\n const signer = await provider.getSigner();\n const file = await establishSession({\n signer,\n baseUrl: settings.baseUrl,\n chainId: SESSION_CHAIN_ID,\n dataDir: ctx.dataDir,\n scope: V1_SCOPE,\n });\n return receipt(file, true);\n}\n\n/**\n * The receipt. Address, origin, scope and expiry ONLY — never the delegation and\n * never the private JWK: this output lands in an agent's transcript, and a\n * session key printed there outlives the 0600 file it was written to.\n */\nfunction receipt(file: SessionFile, minted: boolean): CommandResult {\n const { address, origin, scope, exp } = file;\n const what = `${address} (scope ${scope}) for ${origin}`;\n return {\n data: { status: minted ? 'created' : 'reused', address, origin, scope, exp },\n humanLines: [\n minted\n ? `Session key minted for ${what}, expires ${exp}.`\n : `Session key already active for ${what}, expires ${exp}. No wallet signature needed.`,\n '`tenjin read` can now recover pieces this wallet already owns from that origin. It still cannot pay.',\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAM,WAAyB;AAc/B,eAAsB,gBACpB,MACA,KACA,OAAyB,CAAC,GACF;AACxB,QAAM,MAAM,KAAK,OAAO,KAAK;AAC7B,MAAI,KAAK,UAAU,UAAa,KAAK,UAAU,UAAU;AACvD,UAAM,IAAI,SAAS,SAAS,8BAA8B,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI;AAAA,MACtF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,MAAM,uBAAuB,GAAG;AACjD,QAAM,WAAW;AAAA,IACf;AAAA,IACA,KAAK,aAAa,SAAY,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;AAAA,EAC/D;AAGA,QAAM,SAAS,MAAM,eAAe,QAAQ;AAK5C,QAAM,SAAS,SAAS,SAAS,OAAO;AACxC,QAAM,SAAS,MAAM,gBAAgB,IAAI,OAAO;AAChD,MAAI,WAAW,QAAQ,gBAAgB,QAAQ,OAAO,SAAS,IAAI,GAAG,UAAU,MAAM,GAAG;AACvF,WAAO,QAAQ,QAAQ,KAAK;AAAA,EAC9B;AAEA,QAAM,SAAS,MAAM,SAAS,UAAU;AACxC,QAAM,OAAO,MAAM,iBAAiB;AAAA,IAClC;AAAA,IACA,SAAS,SAAS;AAAA,IAClB,SAAS;AAAA,IACT,SAAS,IAAI;AAAA,IACb,OAAO;AAAA,EACT,CAAC;AACD,SAAO,QAAQ,MAAM,IAAI;AAC3B;AAOA,SAAS,QAAQ,MAAmB,QAAgC;AAClE,QAAM,EAAE,SAAS,QAAQ,OAAO,IAAI,IAAI;AACxC,QAAM,OAAO,GAAG,OAAO,WAAW,KAAK,SAAS,MAAM;AACtD,SAAO;AAAA,IACL,MAAM,EAAE,QAAQ,SAAS,YAAY,UAAU,SAAS,QAAQ,OAAO,IAAI;AAAA,IAC3E,YAAY;AAAA,MACV,SACI,0BAA0B,IAAI,aAAa,GAAG,MAC9C,kCAAkC,IAAI,aAAa,GAAG;AAAA,MAC1D;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/commands/session.ts"],"sourcesContent":["import { CliError } from '../lib/errors';\nimport { resolveContextSettings } from '../lib/settings';\nimport { establishSession, SESSION_CHAIN_ID } from '../lib/session-key';\nimport { isSessionUsable, loadSessionFile, type SessionScope } from '../lib/session-present';\nimport { originOf } from '../lib/url';\nimport type { SessionFile } from '../lib/session-present';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin session start --scope read`: open the wallet ONCE and mint a ≤24h\n * P-256 session key that `tenjin read` can then present, unattended, to recover a\n * piece this wallet already owns but has not cached on this machine.\n *\n * This is the attended half of a deliberate split: `read` cannot open a keystore,\n * so the one wallet signature a recovery needs comes from a verb the operator\n * invokes on purpose. It spends nothing and cannot, but it does open the\n * keystore, which is why it sits in the OPT-IN tier beside `buy`.\n *\n * What it leaves on disk is a wallet-derived credential. Treat it as one: it is\n * bound to the origin it was minted against and every presenter re-checks that,\n * and the receipt below carries no key material. `lib/permissions.ts` states the\n * exposure an operator is accepting.\n *\n * v1 accepts NO other scope. `--scope read+write` is refused rather than\n * forwarded: a prefix allowlist rule pins the verb and not the flags, so the only\n * way `Bash(tenjin session start:*)` can be a non-escalatable grant is for every\n * command line it matches to mint the narrow scope. The write path keeps minting\n * its own `read+write` session lazily, from `publish`/`edit`, where a human is\n * already consenting to a write.\n */\n\n/** The only scope v1 mints; see the docblock for why that is load-bearing. */\nconst V1_SCOPE: SessionScope = 'read';\n\nexport interface SessionStartArgs {\n /** Raw `--scope`; validated at the edge, USAGE on anything but `read`. */\n scope?: string;\n}\n\nexport interface SessionStartDeps {\n provider?: WalletProvider;\n env?: NodeJS.ProcessEnv;\n /** Clock seam (ms since epoch) for the reuse decision. */\n now?: () => number;\n}\n\nexport async function runSessionStart(\n args: SessionStartArgs,\n ctx: CommandContext,\n deps: SessionStartDeps = {},\n): Promise<CommandResult> {\n const now = deps.now ?? Date.now;\n if (args.scope !== undefined && args.scope !== V1_SCOPE) {\n throw new CliError('USAGE', `Unsupported session scope: ${JSON.stringify(args.scope)}`, {\n fix: 'This version mints read-scoped sessions only; run `tenjin session start --scope read` (or omit the flag). A write-capable session is minted by `tenjin publish` / `tenjin edit` on the run that needs it.',\n });\n }\n\n const settings = await resolveContextSettings(ctx);\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // describe() reports the address WITHOUT unlocking the key, which is what makes\n // the reuse path below cost no wallet interaction (no passphrase prompt).\n const wallet = await describeWallet(provider);\n\n // Idempotent: a live session wide enough AND minted for this origin is reused,\n // so a second run opens no wallet, and a cached `read+write` (publish's) is\n // never downgraded. A session for another deployment is not reusable.\n const origin = originOf(settings.baseUrl);\n const cached = await loadSessionFile(ctx.dataDir);\n if (cached !== null && isSessionUsable(cached, wallet.address, now(), V1_SCOPE, origin)) {\n return receipt(cached, false);\n }\n\n const signer = await provider.getSigner();\n const file = await establishSession({\n signer,\n baseUrl: settings.baseUrl,\n chainId: SESSION_CHAIN_ID,\n dataDir: ctx.dataDir,\n scope: V1_SCOPE,\n });\n return receipt(file, true);\n}\n\n/**\n * The receipt. Address, origin, scope and expiry ONLY — never the delegation and\n * never the private JWK: this output lands in an agent's transcript, and a\n * session key printed there outlives the 0600 file it was written to.\n */\nfunction receipt(file: SessionFile, minted: boolean): CommandResult {\n const { address, origin, scope, exp } = file;\n const what = `${address} (scope ${scope}) for ${origin}`;\n return {\n data: { status: minted ? 'created' : 'reused', address, origin, scope, exp },\n humanLines: [\n minted\n ? `Session key minted for ${what}, expires ${exp}.`\n : `Session key already active for ${what}, expires ${exp}. No wallet signature needed.`,\n '`tenjin read` can now recover pieces this wallet already owns from that origin. It still cannot pay.',\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAM,WAAyB;AAc/B,eAAsB,gBACpB,MACA,KACA,OAAyB,CAAC,GACF;AACxB,QAAM,MAAM,KAAK,OAAO,KAAK;AAC7B,MAAI,KAAK,UAAU,UAAa,KAAK,UAAU,UAAU;AACvD,UAAM,IAAI,SAAS,SAAS,8BAA8B,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI;AAAA,MACtF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,MAAM,uBAAuB,GAAG;AACjD,QAAM,WAAW;AAAA,IACf;AAAA,IACA,KAAK,aAAa,SAAY,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;AAAA,EAC/D;AAGA,QAAM,SAAS,MAAM,eAAe,QAAQ;AAK5C,QAAM,SAAS,SAAS,SAAS,OAAO;AACxC,QAAM,SAAS,MAAM,gBAAgB,IAAI,OAAO;AAChD,MAAI,WAAW,QAAQ,gBAAgB,QAAQ,OAAO,SAAS,IAAI,GAAG,UAAU,MAAM,GAAG;AACvF,WAAO,QAAQ,QAAQ,KAAK;AAAA,EAC9B;AAEA,QAAM,SAAS,MAAM,SAAS,UAAU;AACxC,QAAM,OAAO,MAAM,iBAAiB;AAAA,IAClC;AAAA,IACA,SAAS,SAAS;AAAA,IAClB,SAAS;AAAA,IACT,SAAS,IAAI;AAAA,IACb,OAAO;AAAA,EACT,CAAC;AACD,SAAO,QAAQ,MAAM,IAAI;AAC3B;AAOA,SAAS,QAAQ,MAAmB,QAAgC;AAClE,QAAM,EAAE,SAAS,QAAQ,OAAO,IAAI,IAAI;AACxC,QAAM,OAAO,GAAG,OAAO,WAAW,KAAK,SAAS,MAAM;AACtD,SAAO;AAAA,IACL,MAAM,EAAE,QAAQ,SAAS,YAAY,UAAU,SAAS,QAAQ,OAAO,IAAI;AAAA,IAC3E,YAAY;AAAA,MACV,SACI,0BAA0B,IAAI,aAAa,GAAG,MAC9C,kCAAkC,IAAI,aAAa,GAAG;AAAA,MAC1D;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,19 +1,18 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  installSkill
4
- } from "./chunk-RSBN67PA.js";
4
+ } from "./chunk-NAAMHWSI.js";
5
5
  import {
6
6
  emitWriteNotice
7
- } from "./chunk-IB63U6BM.js";
7
+ } from "./chunk-B676GPS2.js";
8
8
  import {
9
9
  CLI_SKILL_NAMES,
10
10
  readSkillFile,
11
11
  resolveSkillsSource,
12
12
  skillFrontmatterName,
13
13
  skillsDirsFor
14
- } from "./chunk-P74I3WH4.js";
15
- import "./chunk-2I4QTOLB.js";
16
- import "./chunk-PZRAAAY2.js";
14
+ } from "./chunk-QWBUKIP2.js";
15
+ import "./chunk-PAOVPSP6.js";
17
16
  import "./chunk-ZXTAQYNA.js";
18
17
 
19
18
  // src/lib/skill-heal.ts
@@ -82,4 +81,4 @@ function noticeFor(updated) {
82
81
  export {
83
82
  healWiredSkills
84
83
  };
85
- //# sourceMappingURL=skill-heal-XBEK272G.js.map
84
+ //# sourceMappingURL=skill-heal-D6EPLPS6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/skill-heal.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { emitWriteNotice } from './output';\nimport type { Io } from './output';\nimport { installSkill } from './skill-writer';\nimport {\n CLI_SKILL_NAMES,\n readSkillFile,\n skillFrontmatterName,\n skillsDirsFor,\n} from './skill-wiring';\nimport { resolveSkillsSource } from './skills-source';\n\nexport interface HealDeps {\n io: Io;\n /** Environment for the CI and opt-out checks. Defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** Home whose skills directories are healed. Tests inject a temp dir. */\n homeDir?: string;\n /**\n * The packaged skills source. Defaults to this build's own, and only that\n * default is checked for being a working tree: passing one is a deliberate act.\n */\n skillsSourceDir?: string;\n}\n\n/** The opt-out, in the shape the CLI's other `TENJIN_NO_*` switches take. */\nconst OPT_OUT = 'TENJIN_NO_SKILL_HEAL';\n\n/**\n * Refresh the CLI adapter skills ALREADY in a harness skills directory, so\n * updating the CLI updates the copies `install` wrote instead of leaving an agent\n * on an older version's instructions. Subordinate to the command that ran, like\n * the update nudge: after the envelope, never on stdout, never a failure.\n *\n * It is an UNATTENDED writer into the operator's home, so it is strictly more\n * conservative than `install`, which a human ran on purpose. What it declines to\n * touch is listed on {@link healable}, and it heals only the two CLI adapters:\n * the hosted `tenjin` skill mirrors tenjin.blog/skills.md, so the copy on disk\n * may be a NEWER fetch than this package ships, and rewriting it would undo that\n * and make install's \"re-fetch it from tenjin.blog/skills.md\" false. Same domain\n * `doctor`'s staleness check compares.\n *\n * Unlocked, on purpose. Concurrent healers write byte-identical content to the\n * same paths through per-file atomic renames, so there is nothing to serialize;\n * a lock here could only make things worse, because one left behind by a killed\n * process would silently disable healing on this machine forever.\n */\nexport async function healWiredSkills(deps: HealDeps): Promise<void> {\n try {\n const env = deps.env ?? process.env;\n // The same two doors the update nudge uses: a build log cannot act on this,\n // and an operator who wants their skills left alone says so once.\n if (env.CI !== undefined && env.CI.length > 0) return;\n if (env[OPT_OUT] === '1') return;\n\n const home = deps.homeDir ?? homedir();\n // An empty or relative HOME (sudo/docker env_reset, systemd units) would make\n // every target below relative, healing paths under the working directory.\n if (!isAbsolute(home)) return;\n\n const source = deps.skillsSourceDir ?? packagedSource();\n if (source === null) return;\n const targets = healable(home);\n if (targets.length === 0) return;\n await heal(targets, source, deps.io);\n } catch {\n // Whatever it was, it is the next command's to retry; this one is finished.\n }\n}\n\n/**\n * This build's packaged skills, or null when they are a working tree's. The\n * published package ships `dist/` and `skills/` with no `src/` beside them, so a\n * `src/` sibling means a checkout, whose skills may be half-edited and are not\n * what anyone agreed to install.\n */\nfunction packagedSource(): string | null {\n const dir = resolveSkillsSource(fileURLToPath(new URL('.', import.meta.url)));\n return existsSync(join(dirname(dir), 'src')) ? null : dir;\n}\n\ninterface Target {\n dir: string;\n name: string;\n /** The SKILL.md itself: what the gates judged, and what the notice names. */\n path: string;\n}\n\n/**\n * The (directory, skill) pairs this may rewrite, which is a deliberately narrow\n * set. A skill that is not there is never created, because presence is the\n * operator's consent to a directory.\n *\n * Nothing here is reached THROUGH a symlink. `install` follows one on purpose,\n * since the operator pointed it somewhere; unattended, following one means a\n * write landing wherever it points and a notice naming a path that is not where\n * it landed. That argument does not get weaker one directory up, so every\n * component this CLI creates is checked with `lstat`, not `stat`: the skills\n * directory, the skill directory, and SKILL.md. Above them is the harness's own\n * home, which every tool including the harness reaches through, so a link there\n * is the operator's name for the place rather than a redirect around us.\n *\n * Gating SKILL.md gates the whole write. It is not the only file a skill ships\n * any more (tenjin-search carries `references/`), but it is the only one whose\n * frontmatter can prove the directory is OURS, and `installSkill` writes the\n * whole packaged tree once that gate passes — so a reference file deleted or\n * edited under a healthy SKILL.md is restored on the same pass. The other gate,\n * that the file is ours at all, needs its content and so lives at the write.\n */\nfunction healable(home: string): Target[] {\n const found: Target[] = [];\n for (const dir of skillsDirsFor(home)) {\n if (!isRealDirectory(dir)) continue;\n for (const name of CLI_SKILL_NAMES) {\n if (!isRealDirectory(join(dir, name))) continue;\n const path = join(dir, name, 'SKILL.md');\n if (lstatSync(path, { throwIfNoEntry: false })?.isFile() !== true) continue;\n found.push({ dir, name, path });\n }\n }\n return found;\n}\n\n/** A directory, and not a symlink to one. */\nfunction isRealDirectory(path: string): boolean {\n return lstatSync(path, { throwIfNoEntry: false })?.isDirectory() === true;\n}\n\nasync function heal(targets: readonly Target[], source: string, io: Io): Promise<void> {\n const updated: string[] = [];\n for (const { dir, name, path } of targets) {\n try {\n if (!(await isOurs(path, name))) continue;\n const { status } = await installSkill(join(source, name), join(dir, name), false, name, {\n followSymlinks: false,\n });\n if (status === 'up-to-date') continue;\n updated.push(path);\n } catch {\n // A denied write, a case collision, a file swapped under us: that skill keeps\n // what it has and the others are still healed, and NOTHING is said about it.\n // A cause the next command cannot clear either (a directory at 0500) would\n // otherwise print the same line forever, on every command, with no state to\n // suppress it and no way to dismiss it. `tenjin doctor` is where a skill that\n // is wired but not from this build gets reported, which is exactly this.\n }\n }\n if (updated.length > 0) emitWriteNotice(io, noticeFor(updated));\n}\n\n/** Does this file claim to BE the skill we would write over it? Somebody else's\n * skill is not ours to replace just for sitting at one of our paths. */\nasync function isOurs(path: string, name: string): Promise<boolean> {\n const read = await readSkillFile(path);\n return read.kind === 'ok' && skillFrontmatterName(read.bytes.toString('utf8')) === name;\n}\n\n/**\n * Files, not directories: this line is the only notice that content in the\n * operator's home changed unasked, so it has to say which content. It claims\n * nothing about edits being lost, because it cannot know. Every routine upgrade\n * rewrites these same files, and telling someone their edits are gone when they\n * made none is worse than saying nothing.\n */\nfunction noticeFor(updated: readonly string[]): string {\n return `Updated ${updated.join(' and ')} to match this CLI.`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY,YAAY;AAC1C,SAAS,qBAAqB;AA0B9B,IAAM,UAAU;AAqBhB,eAAsB,gBAAgB,MAA+B;AACnE,MAAI;AACF,UAAM,MAAM,KAAK,OAAO,QAAQ;AAGhC,QAAI,IAAI,OAAO,UAAa,IAAI,GAAG,SAAS,EAAG;AAC/C,QAAI,IAAI,OAAO,MAAM,IAAK;AAE1B,UAAM,OAAO,KAAK,WAAW,QAAQ;AAGrC,QAAI,CAAC,WAAW,IAAI,EAAG;AAEvB,UAAM,SAAS,KAAK,mBAAmB,eAAe;AACt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;AAAA,IAOR;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,EAAG,iBAAgB,IAAI,UAAU,OAAO,CAAC;AAChE;AAIA,eAAe,OAAO,MAAc,MAAgC;AAClE,QAAM,OAAO,MAAM,cAAc,IAAI;AACrC,SAAO,KAAK,SAAS,QAAQ,qBAAqB,KAAK,MAAM,SAAS,MAAM,CAAC,MAAM;AACrF;AASA,SAAS,UAAU,SAAoC;AACrD,SAAO,WAAW,QAAQ,KAAK,OAAO,CAAC;AACzC;","names":[]}
@@ -1,19 +1,23 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  KEPT_ITEMS,
4
+ REMOVED_FROM_DATA_DIR,
4
5
  removeFromSettings,
5
6
  removeHookScripts,
6
7
  removeMarkerLines,
7
8
  removeSkills
8
- } from "./chunk-E6YOODH7.js";
9
- import "./chunk-RSBN67PA.js";
9
+ } from "./chunk-WYLMJQVH.js";
10
+ import "./chunk-NAAMHWSI.js";
10
11
  import {
11
12
  sanitizeForTerminal
12
- } from "./chunk-IB63U6BM.js";
13
+ } from "./chunk-B676GPS2.js";
14
+ import "./chunk-DTCXO7HS.js";
15
+ import "./chunk-IU2HVT3Y.js";
16
+ import "./chunk-VEAERJVJ.js";
17
+ import "./chunk-ETKZWJ4B.js";
13
18
  import "./chunk-ZQIQ55KK.js";
14
- import "./chunk-P74I3WH4.js";
15
- import "./chunk-2I4QTOLB.js";
16
- import "./chunk-PZRAAAY2.js";
19
+ import "./chunk-QWBUKIP2.js";
20
+ import "./chunk-PAOVPSP6.js";
17
21
  import "./chunk-ZXTAQYNA.js";
18
22
 
19
23
  // src/commands/uninstall.ts
@@ -54,8 +58,9 @@ function humanLines(report) {
54
58
  removed.push(`legacy pointer line in ${sanitizeForTerminal(path)}`);
55
59
  }
56
60
  const lines = removed.length === 0 ? ["Nothing to remove; tenjin was not installed here."] : ["Removed:", ...removed.map((r) => ` - ${r}`)];
57
- lines.push("Kept (uninstall never touches these):");
61
+ lines.push("Kept:");
58
62
  for (const item of report.kept) lines.push(` - ${item}`);
63
+ lines.push(`Removed from ~/.tenjin: ${REMOVED_FROM_DATA_DIR}`);
59
64
  if (settings.warning !== void 0) {
60
65
  lines.push(`! ${sanitizeForTerminal(settings.warning)}`);
61
66
  }
@@ -65,4 +70,4 @@ function humanLines(report) {
65
70
  export {
66
71
  runUninstall
67
72
  };
68
- //# sourceMappingURL=uninstall-BTKPHPDL.js.map
73
+ //# sourceMappingURL=uninstall-OWJNJ5LI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/uninstall.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport {\n KEPT_ITEMS,\n REMOVED_FROM_DATA_DIR,\n removeFromSettings,\n removeHookScripts,\n removeMarkerLines,\n removeSkills,\n type UninstallReport,\n} from '../lib/uninstall';\nimport { sanitizeForTerminal } from '../lib/output';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin uninstall`: undo exactly what `tenjin install` wrote, and nothing else.\n *\n * The shape of this command is the promise it makes. It removes the skills, the\n * hook scripts, our hook entries and permission rules in the harness's\n * settings.json, and the legacy pointer line older versions wrote into\n * CLAUDE.md/AGENTS.md. It does NOT remove the wallet, the config, the library,\n * the search ledger, or parked candidates: `install` did not create those, and a\n * wallet holds funds while a candidate is unpublished work. The hook scripts are\n * the one thing under `~/.tenjin` it does remove, because `install` generated\n * them. The receipt names both halves on every run, so the operator learns the\n * boundary from the command rather than from the docs.\n *\n * IDEMPOTENT BY CONSTRUCTION. Every step is \"remove it if it is ours and there\",\n * so a half-installed machine, an already-uninstalled one, and a machine that\n * never ran install all succeed and report what was (not) found. There is no\n * confirmation prompt and no --force: nothing here is unrecoverable, since a\n * `tenjin install` puts all of it back.\n */\n\nexport interface UninstallDeps {\n /** Home whose harness directories are cleaned; tests inject a temp dir. */\n home?: string;\n}\n\nexport async function runUninstall(\n ctx: CommandContext,\n deps: UninstallDeps = {},\n): Promise<CommandResult> {\n const home = deps.home ?? homedir();\n\n // Settings first: it is the only step with a concurrency guard, and the only\n // one that can refuse. Doing it before the scripts are deleted means a refusal\n // leaves a registered hook still pointing at a script that exists, rather than\n // at one that does not.\n const settings = await removeFromSettings(home);\n const scripts = await removeHookScripts(ctx.dataDir);\n const skills = await removeSkills(home);\n const markers = await removeMarkerLines(home);\n\n const report: UninstallReport = {\n settings,\n skills,\n scripts: scripts.scripts,\n ...(scripts.removedDir !== undefined ? { hooksDir: scripts.removedDir } : {}),\n markers,\n kept: [...KEPT_ITEMS],\n };\n\n return { data: report, humanLines: humanLines(report) };\n}\n\nfunction humanLines(report: UninstallReport): string[] {\n const { settings } = report;\n const removed: string[] = [];\n for (const dir of report.skills) removed.push(`skill ${sanitizeForTerminal(dir)}`);\n for (const script of report.scripts) removed.push(`hook script ${sanitizeForTerminal(script)}`);\n if (report.hooksDir !== undefined) {\n removed.push(`empty hooks directory ${sanitizeForTerminal(report.hooksDir)}`);\n }\n for (const event of settings.hooks) {\n removed.push(`${event} hook entry in ${sanitizeForTerminal(settings.path)}`);\n }\n if (settings.rules.length > 0) {\n removed.push(\n `${settings.rules.length} tenjin permission rule(s) in ${sanitizeForTerminal(settings.path)}`,\n );\n }\n for (const path of report.markers) {\n removed.push(`legacy pointer line in ${sanitizeForTerminal(path)}`);\n }\n\n const lines =\n removed.length === 0\n ? ['Nothing to remove; tenjin was not installed here.']\n : ['Removed:', ...removed.map((r) => ` - ${r}`)];\n\n // Named on EVERY run, including the nothing-to-remove one: the boundary is the\n // point of the command, and an operator reaching for it is usually worried\n // about exactly these things. The exception is named right under them, because\n // an unqualified \"nothing under ~/.tenjin is touched\" is contradicted by the\n // hook scripts this same receipt just listed as removed.\n lines.push('Kept:');\n for (const item of report.kept) lines.push(` - ${item}`);\n lines.push(`Removed from ~/.tenjin: ${REMOVED_FROM_DATA_DIR}`);\n\n if (settings.warning !== undefined) {\n lines.push(`! ${sanitizeForTerminal(settings.warning)}`);\n }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