tenjin-cli 0.1.0-alpha.29 → 0.1.0-alpha.30
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.
- package/README.md +7 -5
- package/dist/{chunk-25GGN553.js → chunk-3O2BQIF6.js} +86 -22
- package/dist/chunk-3O2BQIF6.js.map +1 -0
- package/dist/{chunk-R4AO7GC2.js → chunk-5LJCEMFD.js} +14 -12
- package/dist/{chunk-R4AO7GC2.js.map → chunk-5LJCEMFD.js.map} +1 -1
- package/dist/{chunk-QTGUDCIR.js → chunk-AEG2PXBP.js} +3 -3
- package/dist/{chunk-AMEUXNJT.js → chunk-AWFUPKTM.js} +2 -2
- package/dist/{chunk-XJQ6CH7X.js → chunk-EBVIKMCH.js} +2 -2
- package/dist/{chunk-XDYKZRLN.js → chunk-HE2MS4QO.js} +6 -6
- package/dist/{chunk-RJEPZMYY.js → chunk-IOODYAXL.js} +3 -3
- package/dist/{chunk-SBL4THYT.js → chunk-JMM6YE7J.js} +190 -90
- package/dist/chunk-JMM6YE7J.js.map +1 -0
- package/dist/{chunk-VKQXVCZR.js → chunk-KHE6L6TD.js} +3 -3
- package/dist/chunk-KOGZDMHO.js +21 -0
- package/dist/chunk-KOGZDMHO.js.map +1 -0
- package/dist/{chunk-TROZ6HL4.js → chunk-KYFZTGMC.js} +2 -2
- package/dist/{chunk-LX5OT4TQ.js → chunk-NZIP4PA2.js} +2 -2
- package/dist/chunk-O2FRQ2L2.js +168 -0
- package/dist/chunk-O2FRQ2L2.js.map +1 -0
- package/dist/{chunk-3FY5HG7R.js → chunk-OK2TDZQU.js} +4 -4
- package/dist/{chunk-ZQNGTLOC.js → chunk-OSYTBCUC.js} +7 -5
- package/dist/{chunk-ZQNGTLOC.js.map → chunk-OSYTBCUC.js.map} +1 -1
- package/dist/{chunk-MRUPDSUM.js → chunk-PAYV4XUA.js} +3 -5
- package/dist/chunk-PAYV4XUA.js.map +1 -0
- package/dist/{chunk-USOLCBKC.js → chunk-QUVVWYJW.js} +7 -5
- package/dist/{chunk-USOLCBKC.js.map → chunk-QUVVWYJW.js.map} +1 -1
- package/dist/{chunk-MOG7PB3A.js → chunk-RAULEAZ6.js} +3 -3
- package/dist/{chunk-MG3G644T.js → chunk-SPAVAYSW.js} +3 -3
- package/dist/{chunk-4FYMDRD3.js → chunk-TTBKWWTV.js} +22 -20
- package/dist/chunk-TTBKWWTV.js.map +1 -0
- package/dist/{chunk-OOSRB3OF.js → chunk-U6YQ6FRI.js} +2 -2
- package/dist/{chunk-P4LVLFO4.js → chunk-VFMQTSXG.js} +2 -2
- package/dist/{chunk-LRCJ2IZ5.js → chunk-VUFAK2LW.js} +2 -2
- package/dist/{chunk-LRCJ2IZ5.js.map → chunk-VUFAK2LW.js.map} +1 -1
- package/dist/{chunk-WM7TJEBP.js → chunk-VZGAONSJ.js} +7 -5
- package/dist/{chunk-WM7TJEBP.js.map → chunk-VZGAONSJ.js.map} +1 -1
- package/dist/{chunk-VVAHFCX2.js → chunk-WO5BJNIB.js} +45 -194
- package/dist/chunk-WO5BJNIB.js.map +1 -0
- package/dist/chunk-WVUSXNIE.js +39 -0
- package/dist/chunk-WVUSXNIE.js.map +1 -0
- package/dist/chunk-XKESD27X.js +10 -0
- package/dist/chunk-XKESD27X.js.map +1 -0
- package/dist/{chunk-SFEQGENI.js → chunk-YFQOA5AU.js} +7 -2
- package/dist/{chunk-SFEQGENI.js.map → chunk-YFQOA5AU.js.map} +1 -1
- package/dist/{cli-JPTDHGRX.js → cli-O5SN7ZJ4.js} +38 -30
- package/dist/{cli-JPTDHGRX.js.map → cli-O5SN7ZJ4.js.map} +1 -1
- package/dist/{config-YYKDH2TH.js → config-OJQI27LT.js} +13 -12
- package/dist/{doctor-SSTXGCHX.js → doctor-IQQJHGGM.js} +36 -62
- package/dist/doctor-IQQJHGGM.js.map +1 -0
- package/dist/{fund-QWVWRVDK.js → fund-WEV6DMTD.js} +17 -12
- package/dist/{fund-QWVWRVDK.js.map → fund-WEV6DMTD.js.map} +1 -1
- package/dist/hook-command-D2P3ILRV.js +32 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
- package/dist/index.js +4 -4
- package/dist/{install-2GXXD4DK.js → install-TUCRF32I.js} +23 -14
- package/dist/{install-identity-FK3YF227.js → install-identity-WHPNMNMQ.js} +7 -6
- package/dist/{install-wallet-TC22U52X.js → install-wallet-MA27FTQ5.js} +11 -10
- package/dist/{install-wallet-TC22U52X.js.map → install-wallet-MA27FTQ5.js.map} +1 -1
- package/dist/{mcp-42H2F4NY.js → mcp-QML7ZMPH.js} +33 -40
- package/dist/mcp-QML7ZMPH.js.map +1 -0
- package/dist/{package-6DJA3Y2O.js → package-LGKYOEPV.js} +2 -2
- package/dist/{pay-LSDJBIAZ.js → pay-2C2UBBXJ.js} +14 -13
- package/dist/{payments-SPECLBRQ.js → payments-C44QUFXU.js} +10 -9
- package/dist/{payments-SPECLBRQ.js.map → payments-C44QUFXU.js.map} +1 -1
- package/dist/{send-MHAOLPK3.js → send-KVJX4XIR.js} +9 -8
- package/dist/{send-MHAOLPK3.js.map → send-KVJX4XIR.js.map} +1 -1
- package/dist/{status-O2RWLPS5.js → status-S7C3WMSH.js} +10 -9
- package/dist/{status-O2RWLPS5.js.map → status-S7C3WMSH.js.map} +1 -1
- package/dist/{status-line-45TVCRM3.js → status-line-YR2T5HC4.js} +6 -5
- package/dist/{status-line-45TVCRM3.js.map → status-line-YR2T5HC4.js.map} +1 -1
- package/dist/{uninstall-VOK2Z5M4.js → uninstall-HY6LKIIT.js} +17 -14
- package/dist/{uninstall-VOK2Z5M4.js.map → uninstall-HY6LKIIT.js.map} +1 -1
- package/dist/{update-FGP3HNLD.js → update-OJV22LR3.js} +17 -14
- package/dist/usdc-JK4RRFFQ.js +39 -0
- package/dist/{wallet-DA7OFNEW.js → wallet-PD2IMZDU.js} +11 -10
- package/dist/wallet-PD2IMZDU.js.map +1 -0
- package/docs/agent-permissions.md +16 -4
- package/package.json +1 -1
- package/dist/chunk-25GGN553.js.map +0 -1
- package/dist/chunk-4FYMDRD3.js.map +0 -1
- package/dist/chunk-EWLU46J6.js +0 -100
- package/dist/chunk-EWLU46J6.js.map +0 -1
- package/dist/chunk-MRUPDSUM.js.map +0 -1
- package/dist/chunk-SBL4THYT.js.map +0 -1
- package/dist/chunk-VVAHFCX2.js.map +0 -1
- package/dist/doctor-SSTXGCHX.js.map +0 -1
- package/dist/hook-command-VWJXRT7H.js +0 -31
- package/dist/mcp-42H2F4NY.js.map +0 -1
- /package/dist/{chunk-QTGUDCIR.js.map → chunk-AEG2PXBP.js.map} +0 -0
- /package/dist/{chunk-AMEUXNJT.js.map → chunk-AWFUPKTM.js.map} +0 -0
- /package/dist/{chunk-XJQ6CH7X.js.map → chunk-EBVIKMCH.js.map} +0 -0
- /package/dist/{chunk-XDYKZRLN.js.map → chunk-HE2MS4QO.js.map} +0 -0
- /package/dist/{chunk-RJEPZMYY.js.map → chunk-IOODYAXL.js.map} +0 -0
- /package/dist/{chunk-VKQXVCZR.js.map → chunk-KHE6L6TD.js.map} +0 -0
- /package/dist/{chunk-TROZ6HL4.js.map → chunk-KYFZTGMC.js.map} +0 -0
- /package/dist/{chunk-LX5OT4TQ.js.map → chunk-NZIP4PA2.js.map} +0 -0
- /package/dist/{chunk-3FY5HG7R.js.map → chunk-OK2TDZQU.js.map} +0 -0
- /package/dist/{chunk-MOG7PB3A.js.map → chunk-RAULEAZ6.js.map} +0 -0
- /package/dist/{chunk-MG3G644T.js.map → chunk-SPAVAYSW.js.map} +0 -0
- /package/dist/{chunk-OOSRB3OF.js.map → chunk-U6YQ6FRI.js.map} +0 -0
- /package/dist/{chunk-P4LVLFO4.js.map → chunk-VFMQTSXG.js.map} +0 -0
- /package/dist/{config-YYKDH2TH.js.map → config-OJQI27LT.js.map} +0 -0
- /package/dist/{hook-command-VWJXRT7H.js.map → hook-command-D2P3ILRV.js.map} +0 -0
- /package/dist/{install-2GXXD4DK.js.map → install-TUCRF32I.js.map} +0 -0
- /package/dist/{install-identity-FK3YF227.js.map → install-identity-WHPNMNMQ.js.map} +0 -0
- /package/dist/{package-6DJA3Y2O.js.map → package-LGKYOEPV.js.map} +0 -0
- /package/dist/{pay-LSDJBIAZ.js.map → pay-2C2UBBXJ.js.map} +0 -0
- /package/dist/{update-FGP3HNLD.js.map → update-OJV22LR3.js.map} +0 -0
- /package/dist/{wallet-DA7OFNEW.js.map → usdc-JK4RRFFQ.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-2I4QTOLB.js";
|
|
8
8
|
import {
|
|
9
9
|
formatUsdDisplay
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WO5BJNIB.js";
|
|
11
11
|
|
|
12
12
|
// src/router/fee.ts
|
|
13
13
|
import { createHash } from "node:crypto";
|
|
@@ -16,7 +16,6 @@ import { join } from "node:path";
|
|
|
16
16
|
var ROUTE_PAID_PATH = "/api/x402-router/route";
|
|
17
17
|
var ROUTING_FEE_ATOMIC = 3000n;
|
|
18
18
|
var CHANNEL_DEPOSIT_ATOMIC = 250000n;
|
|
19
|
-
var MIN_DEPOSIT_ATOMIC = 10n * ROUTING_FEE_ATOMIC;
|
|
20
19
|
var SUGGESTED_FUND_USD = "5";
|
|
21
20
|
var ROUTING_DEPOSIT_KEY = "routing-deposit:";
|
|
22
21
|
var REFUSED = {
|
|
@@ -54,7 +53,7 @@ var UNPAID = {
|
|
|
54
53
|
fix: "Run `tenjin doctor`."
|
|
55
54
|
},
|
|
56
55
|
limit_below_deposit: {
|
|
57
|
-
reason: `the per-call spend limit is below the
|
|
56
|
+
reason: `the per-call spend limit is below the $${usd(CHANNEL_DEPOSIT_ATOMIC)} routing deposit`,
|
|
58
57
|
fix: "Run `tenjin doctor`."
|
|
59
58
|
},
|
|
60
59
|
budget_reached: {
|
|
@@ -136,7 +135,6 @@ export {
|
|
|
136
135
|
ROUTE_PAID_PATH,
|
|
137
136
|
ROUTING_FEE_ATOMIC,
|
|
138
137
|
CHANNEL_DEPOSIT_ATOMIC,
|
|
139
|
-
MIN_DEPOSIT_ATOMIC,
|
|
140
138
|
SUGGESTED_FUND_USD,
|
|
141
139
|
ROUTING_DEPOSIT_KEY,
|
|
142
140
|
refusedWhy,
|
|
@@ -150,4 +148,4 @@ export {
|
|
|
150
148
|
usd,
|
|
151
149
|
firstNoticeFor
|
|
152
150
|
};
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
151
|
+
//# sourceMappingURL=chunk-PAYV4XUA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/router/fee.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { mkdir, open, readFile, readdir, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { hasCode } from '../lib/errno';\nimport { formatUsdDisplay } from '../lib/money';\nimport { evaluateSpendPolicy, type PolicyReason, type SpendPolicy } from '../lib/policy';\nimport type { DecisionRoute } from './decision';\n\n/**\n * THE ROUTING FEE, WITHOUT ANYTHING THAT PAYS. Every routing call on the paid\n * path pays $0.003 over x402 `batch-settlement`, and the stock SDK client in\n * `tenjin mcp` does all of it (`routing-payer.ts`). Everything else, `tenjin\n * hook` included, is the free path exactly as before this fee existed.\n *\n * Hook-safe: `tenjin hook` loads this module, and its chunk graph stays free\n * of the wallet and the x402 SDK (`dist-chunks.test.ts`).\n */\n\nexport const ROUTE_PAID_PATH = '/api/x402-router/route';\n\n/** The flat fee per routing call, atomic USDC ($0.003). */\nexport const ROUTING_FEE_ATOMIC = 3_000n;\n/** The largest channel deposit, atomic USDC ($0.25), made inline by the SDK\n * on the first paid call of a channel that cannot cover the next fee. */\nexport const CHANNEL_DEPOSIT_ATOMIC = 250_000n;\n/**\n * The top-up every \"fund the wallet\" hint names, in USD: the checkout's Apple\n * Pay and Google Pay minimum, which covers the routing deposit and a few\n * hundred lookups. `tenjin wallet fund` sends it to the checkout as a preset.\n */\nexport const SUGGESTED_FUND_USD = '5';\n/** The spend ledger key a deposit's exposure is recorded under, before its id. */\nexport const ROUTING_DEPOSIT_KEY = 'routing-deposit:';\n\n/** A spend refusal, as the reason the call was not paid. */\nconst REFUSED: Partial<Record<PolicyReason, string>> = {\n not_allowlisted: 'not_allowlisted',\n session_budget_exceeded: 'budget_reached',\n above_auto_spend: 'limit_below_deposit',\n};\n\n/** The reason a spend refusal leaves a routing call unpaid. */\nexport function refusedWhy(reason: PolicyReason): string {\n return REFUSED[reason] ?? reason;\n}\n\n/**\n * THE DEPOSIT IS THE SPEND. It meets the whole policy once, the day's budget\n * included, when the SDK's `depositStrategy` reserves it. Each fee paid from\n * it then gets only the per-payment checks: the per-call limit, the creator\n * allowlist (the router's host) and an explicit zero daily limit. It is never\n * refused for the day's running total, which the deposit already consumed.\n * Null when those checks allow the fee.\n */\nexport function feeRefusal(policy: SpendPolicy, host: string): string | null {\n const evaluation = evaluateSpendPolicy(\n { ...policy, sessionBudgetAtomic: policy.sessionBudgetAtomic === 0n ? 0n : null },\n { mode: 'automatic', amountAtomic: ROUTING_FEE_ATOMIC, creator: host, sessionSpentAtomic: 0n },\n );\n return evaluation.decision === 'allow' ? null : refusedWhy(evaluation.reason);\n}\n\n/** The paid path for this call, or null for the free path. `tenjin mcp` passes\n * its payer's; absent, every call is free. */\nexport type RouteFor = (baseUrl: string) => Promise<DecisionRoute | null>;\n\n/** The free path's reason code once the server routes only paid calls. */\nexport const FEE_REQUIRED = 'fee_required';\n\n/** Whether a decision is the free path's `fee_required` answer. */\nexport function isFeeRequired(response: unknown): boolean {\n const decision = (response as { decision?: { action?: unknown; diagnostics?: unknown } })\n ?.decision;\n const diagnostics = decision?.diagnostics as { reasonCode?: unknown } | undefined;\n return decision?.action === 'native' && diagnostics?.reasonCode === FEE_REQUIRED;\n}\n\n/**\n * WHY A CALL WAS NOT PAID, for the user: the reason and the fix, keyed by the\n * payer's skip reason (or `fee_required`, when the free path answered it and\n * nothing else explains why). Null for a reason that is no fault and needs no\n * fix: another session's call on the channel, a server with no paid path, or\n * a call queued past its own budget, or a payment still out when the call's\n * budget ran out (it finishes in the background).\n */\nconst UNPAID: Record<string, { reason: string; fix: string }> = {\n wallet_low: {\n reason: `the wallet holds less than the $${usd(CHANNEL_DEPOSIT_ATOMIC)} routing deposit`,\n fix: `Fund it with \\`tenjin wallet fund ${SUGGESTED_FUND_USD}\\`.`,\n },\n wallet_locked: {\n reason: '`tenjin mcp` cannot unlock the wallet without a prompt',\n fix: 'Set TENJIN_WALLET_PASSPHRASE in the environment Claude Code starts from, then restart Claude Code.',\n },\n no_wallet: {\n reason: 'this machine has no wallet',\n fix: 'Run `tenjin doctor`.',\n },\n limit_below_deposit: {\n reason: `the per-call spend limit is below the $${usd(CHANNEL_DEPOSIT_ATOMIC)} routing deposit`,\n fix: 'Run `tenjin doctor`.',\n },\n budget_reached: {\n reason: 'the daily spend limit has no room left for the routing fee or its deposit',\n fix: 'Run `tenjin doctor`.',\n },\n not_allowlisted: {\n reason: 'allowlistCreators does not include the router',\n fix: 'Run `tenjin doctor`.',\n },\n payment_failed: {\n reason: 'the routing payment failed',\n fix: 'Run `tenjin doctor`.',\n },\n [FEE_REQUIRED]: {\n reason: 'the router now charges it, and this session cannot pay it',\n fix: 'Run `tenjin doctor`.',\n },\n};\nconst NO_FAULT = new Set([\n 'channel_busy',\n 'paid_path_absent',\n 'busy',\n 'no_call',\n 'deadline_after_payment_sent',\n]);\n\n/** The reason and fix for an unpaid call, or null when it needs no word. */\nexport function unpaid(why: string): { reason: string; fix: string } | null {\n if (NO_FAULT.has(why)) return null;\n return UNPAID[why] ?? UNPAID['payment_failed']!;\n}\n\n/**\n * The one line said when a routing call's deposit went through: the money is\n * prepaid credit the next calls draw from, not a lookup it bought. It still\n * counts toward the daily limit ({@link feeRefusal}).\n */\nexport function depositSentence(amountAtomic: bigint): string {\n return `Tenjin moved $${usd(amountAtomic)} into prepaid routing credit; each routing call uses $${usd(ROUTING_FEE_ATOMIC)}.`;\n}\n\n/** The one line the user sees, once per session, when a call was not paid. */\nexport function unpaidSentence(why: string): string | null {\n const u = unpaid(why);\n if (u === null) return null;\n return `Tenjin routing could not pay its $${usd(ROUTING_FEE_ATOMIC)} fee (${u.reason}), so calls take the free path until that is fixed. ${u.fix}`;\n}\n\nconst ADDRESS_RE = /^0x[0-9a-f]{40}$/;\n\n/** One wallet's folder: the SDK's file storage for its routing channel\n * (`client/<channelId>.json`). */\nexport function payerDir(dataDir: string, payer: string): string {\n const name = payer.toLowerCase();\n if (!ADDRESS_RE.test(name)) throw new Error(`not a wallet address: ${payer}`);\n return join(dataDir, 'router', 'fee', name);\n}\n\n/** Atomic USDC as dollars with at least two decimals, never a float. */\nexport function usd(atomic: bigint): string {\n return formatUsdDisplay(atomic.toString());\n}\n\n/** How long a session's notice marker is kept. */\nconst NOTICE_KEEP_MS = 7 * 86_400_000;\n\n/**\n * TRUE ONCE PER SESSION: the first caller for a session id creates its marker\n * and gets true; every later one gets false. Each marker holds the time it was\n * made, and those older than a week go on the way past, so the directory does\n * not grow with every session ever run.\n */\nexport async function firstNoticeFor(\n dataDir: string,\n sessionId: string,\n now: number,\n): Promise<boolean> {\n const dir = join(dataDir, 'router', 'notices');\n const name = createHash('sha256').update(sessionId).digest('hex').slice(0, 32);\n const created = await createExclusive(join(dir, name), String(now));\n if (created) {\n for (const entry of await readdir(dir).catch(() => [] as string[])) {\n const path = join(dir, entry);\n const at = Number(await readFile(path, 'utf8').catch(() => 'NaN'));\n if (!Number.isFinite(at) || now - at > NOTICE_KEEP_MS) await rm(path, { force: true });\n }\n }\n return created;\n}\n\nasync function createExclusive(path: string, body: string): Promise<boolean> {\n try {\n await mkdir(join(path, '..'), { recursive: true, mode: 0o700 });\n const handle = await open(path, 'wx', 0o600);\n try {\n await handle.writeFile(body);\n } finally {\n await handle.close();\n }\n return true;\n } catch (err) {\n if (hasCode(err, 'EEXIST')) return false;\n throw err;\n }\n}\n"],"mappings":";;;;;;;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,eAAW,SAAS,MAAM,QAAQ,GAAG,EAAE,MAAM,MAAM,CAAC,CAAa,GAAG;AAClE,YAAM,OAAO,KAAK,KAAK,KAAK;AAC5B,YAAM,KAAK,OAAO,MAAM,SAAS,MAAM,MAAM,EAAE,MAAM,MAAM,KAAK,CAAC;AACjE,UAAI,CAAC,OAAO,SAAS,EAAE,KAAK,MAAM,KAAK,eAAgB,OAAM,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC;AAAA,IACvF;AAAA,EACF;AACA,SAAO;AACT;AAEA,eAAe,gBAAgB,MAAc,MAAgC;AAC3E,MAAI;AACF,UAAM,MAAM,KAAK,MAAM,IAAI,GAAG,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AAC9D,UAAM,SAAS,MAAM,KAAK,MAAM,MAAM,GAAK;AAC3C,QAAI;AACF,YAAM,OAAO,UAAU,IAAI;AAAA,IAC7B,UAAE;AACA,YAAM,OAAO,MAAM;AAAA,IACrB;AACA,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,QAAI,QAAQ,KAAK,QAAQ,EAAG,QAAO;AACnC,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
setTenjinIdentity
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IOODYAXL.js";
|
|
5
5
|
import {
|
|
6
6
|
hasCode
|
|
7
7
|
} from "./chunk-2I4QTOLB.js";
|
|
8
8
|
import {
|
|
9
9
|
isTeamModeConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AWFUPKTM.js";
|
|
11
11
|
import {
|
|
12
12
|
knownDeploymentOrigins,
|
|
13
13
|
loadRawConfig,
|
|
14
|
-
resolveSettings
|
|
14
|
+
resolveSettings
|
|
15
|
+
} from "./chunk-WO5BJNIB.js";
|
|
16
|
+
import {
|
|
15
17
|
writeFileAtomicExclusive
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-O2FRQ2L2.js";
|
|
17
19
|
import {
|
|
18
20
|
installIdPath
|
|
19
21
|
} from "./chunk-SJLTEINJ.js";
|
|
@@ -107,4 +109,4 @@ export {
|
|
|
107
109
|
enableCliIdentity,
|
|
108
110
|
enableDaemonIdentity
|
|
109
111
|
};
|
|
110
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-QUVVWYJW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/install-identity.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { readFile } from 'node:fs/promises';\nimport { writeFileAtomicExclusive } from './atomic-json';\nimport { loadRawConfig, resolveSettings } from './config';\nimport { hasCode } from './errno';\nimport { setTenjinIdentity, type TenjinIdentity } from './http';\nimport { installIdPath } from './paths';\nimport { knownDeploymentOrigins } from './production-origin';\nimport { isTeamModeConfig } from './settings';\n\n/**\n * The install id the transport attaches to Tenjin-bound requests (see\n * `TenjinIdentity` in lib/http), and the rule for which origins are Tenjin's.\n *\n * Nothing here may fail a request: every read that goes wrong is an absent\n * header. There is no opt-out for alpha; the id is random, anonymous, and not a\n * credential.\n */\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction parseInstallId(raw: string): string | undefined {\n const id = raw.trim();\n return UUID_RE.test(id) ? id : undefined;\n}\n\n/**\n * This data dir's install id, minted on first need. Created no-clobber, so two\n * processes racing on a first run agree on the winner's id rather than each\n * keeping its own. A file that exists but does not hold a UUID is left alone and\n * sends nothing: overwriting it would be a new id for the same install.\n */\nexport async function readOrCreateInstallId(dir: string): Promise<string | undefined> {\n const path = installIdPath(dir);\n try {\n return parseInstallId(await readFile(path, 'utf8'));\n } catch (err) {\n if (!hasCode(err, 'ENOENT')) return undefined;\n }\n const id = randomUUID();\n try {\n await writeFileAtomicExclusive(path, `${id}\\n`, { mode: 0o600, dirMode: 0o700 });\n return id;\n } catch (err) {\n if (!hasCode(err, 'EEXIST')) return undefined;\n }\n try {\n return parseInstallId(await readFile(path, 'utf8'));\n } catch {\n return undefined;\n }\n}\n\nfunction tryOrigin(url: string): string | undefined {\n try {\n return new URL(url).origin;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The origins that get the header: Tenjin's own deployments and the base URL\n * this run is pointed at, overrides included (a local dev server is Tenjin too).\n * Not `publicShelfUrl`: its default is already one of Tenjin's deployments, and\n * a custom one may be a host Tenjin does not run.\n *\n * NOT a team shelf. In team mode `baseUrl` is the team's own deployment, which\n * Tenjin does not operate, so on a team machine the base URL is left out unless\n * it is one of Tenjin's own origins anyway. `isTeamModeConfig` reads the file,\n * so a `--base-url` on one run cannot switch that exclusion off.\n */\nexport function tenjinOrigins(s: { baseUrl: string; teamMode: boolean }): string[] {\n const origins = new Set(knownDeploymentOrigins());\n const baseOrigin = tryOrigin(s.baseUrl);\n if (baseOrigin !== undefined && !s.teamMode) origins.add(baseOrigin);\n return [...origins];\n}\n\n/** An identity for one data dir. The install id is read once per process. */\nexport function identityFor(\n dir: string,\n origins: () => Promise<readonly string[]>,\n): TenjinIdentity {\n let install: Promise<string | undefined> | undefined;\n return {\n origins,\n installId: () => (install ??= readOrCreateInstallId(dir)),\n };\n}\n\n/**\n * The run's `--base-url`, recorded by the CLI once it has parsed the global\n * flags. The origins are resolved on the first request, which comes after that.\n */\nlet baseUrlFlag: string | undefined;\n\nexport function noteBaseUrlFlag(flag: string | undefined): void {\n baseUrlFlag = flag;\n}\n\n/**\n * Turn the header on for this CLI process. Called from the entry only, never\n * from `main`, so in-process tests of the command tree never mint an id.\n */\nexport function enableCliIdentity(dir: string, env: NodeJS.ProcessEnv = process.env): void {\n let origins: Promise<readonly string[]> | undefined;\n setTenjinIdentity(\n identityFor(dir, () => {\n origins ??= (async () => {\n const config = await loadRawConfig(dir);\n const s = resolveSettings({ config, flags: { baseUrl: baseUrlFlag }, env });\n return tenjinOrigins({\n baseUrl: s.baseUrl.value,\n teamMode: isTeamModeConfig(config),\n });\n })();\n return origins;\n }),\n );\n}\n\n/**\n * Turn the header on for the loop daemon. No flag or env layer, like the rest\n * of the daemon's config, and re-read per request because the daemon reloads\n * config.json when it changes.\n */\nexport function enableDaemonIdentity(\n dir: string,\n config: () => { baseUrl: string; publicShelfUrl: string; shelfBypassSecret: string },\n): void {\n setTenjinIdentity(\n identityFor(dir, async () => {\n const c = config();\n return tenjinOrigins({\n baseUrl: c.baseUrl,\n teamMode: isTeamModeConfig(c),\n });\n }),\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/lib/install-identity.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { readFile } from 'node:fs/promises';\nimport { writeFileAtomicExclusive } from './atomic-json';\nimport { loadRawConfig, resolveSettings } from './config';\nimport { hasCode } from './errno';\nimport { setTenjinIdentity, type TenjinIdentity } from './http';\nimport { installIdPath } from './paths';\nimport { knownDeploymentOrigins } from './production-origin';\nimport { isTeamModeConfig } from './settings';\n\n/**\n * The install id the transport attaches to Tenjin-bound requests (see\n * `TenjinIdentity` in lib/http), and the rule for which origins are Tenjin's.\n *\n * Nothing here may fail a request: every read that goes wrong is an absent\n * header. There is no opt-out for alpha; the id is random, anonymous, and not a\n * credential.\n */\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction parseInstallId(raw: string): string | undefined {\n const id = raw.trim();\n return UUID_RE.test(id) ? id : undefined;\n}\n\n/**\n * This data dir's install id, minted on first need. Created no-clobber, so two\n * processes racing on a first run agree on the winner's id rather than each\n * keeping its own. A file that exists but does not hold a UUID is left alone and\n * sends nothing: overwriting it would be a new id for the same install.\n */\nexport async function readOrCreateInstallId(dir: string): Promise<string | undefined> {\n const path = installIdPath(dir);\n try {\n return parseInstallId(await readFile(path, 'utf8'));\n } catch (err) {\n if (!hasCode(err, 'ENOENT')) return undefined;\n }\n const id = randomUUID();\n try {\n await writeFileAtomicExclusive(path, `${id}\\n`, { mode: 0o600, dirMode: 0o700 });\n return id;\n } catch (err) {\n if (!hasCode(err, 'EEXIST')) return undefined;\n }\n try {\n return parseInstallId(await readFile(path, 'utf8'));\n } catch {\n return undefined;\n }\n}\n\nfunction tryOrigin(url: string): string | undefined {\n try {\n return new URL(url).origin;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The origins that get the header: Tenjin's own deployments and the base URL\n * this run is pointed at, overrides included (a local dev server is Tenjin too).\n * Not `publicShelfUrl`: its default is already one of Tenjin's deployments, and\n * a custom one may be a host Tenjin does not run.\n *\n * NOT a team shelf. In team mode `baseUrl` is the team's own deployment, which\n * Tenjin does not operate, so on a team machine the base URL is left out unless\n * it is one of Tenjin's own origins anyway. `isTeamModeConfig` reads the file,\n * so a `--base-url` on one run cannot switch that exclusion off.\n */\nexport function tenjinOrigins(s: { baseUrl: string; teamMode: boolean }): string[] {\n const origins = new Set(knownDeploymentOrigins());\n const baseOrigin = tryOrigin(s.baseUrl);\n if (baseOrigin !== undefined && !s.teamMode) origins.add(baseOrigin);\n return [...origins];\n}\n\n/** An identity for one data dir. The install id is read once per process. */\nexport function identityFor(\n dir: string,\n origins: () => Promise<readonly string[]>,\n): TenjinIdentity {\n let install: Promise<string | undefined> | undefined;\n return {\n origins,\n installId: () => (install ??= readOrCreateInstallId(dir)),\n };\n}\n\n/**\n * The run's `--base-url`, recorded by the CLI once it has parsed the global\n * flags. The origins are resolved on the first request, which comes after that.\n */\nlet baseUrlFlag: string | undefined;\n\nexport function noteBaseUrlFlag(flag: string | undefined): void {\n baseUrlFlag = flag;\n}\n\n/**\n * Turn the header on for this CLI process. Called from the entry only, never\n * from `main`, so in-process tests of the command tree never mint an id.\n */\nexport function enableCliIdentity(dir: string, env: NodeJS.ProcessEnv = process.env): void {\n let origins: Promise<readonly string[]> | undefined;\n setTenjinIdentity(\n identityFor(dir, () => {\n origins ??= (async () => {\n const config = await loadRawConfig(dir);\n const s = resolveSettings({ config, flags: { baseUrl: baseUrlFlag }, env });\n return tenjinOrigins({\n baseUrl: s.baseUrl.value,\n teamMode: isTeamModeConfig(config),\n });\n })();\n return origins;\n }),\n );\n}\n\n/**\n * Turn the header on for the loop daemon. No flag or env layer, like the rest\n * of the daemon's config, and re-read per request because the daemon reloads\n * config.json when it changes.\n */\nexport function enableDaemonIdentity(\n dir: string,\n config: () => { baseUrl: string; publicShelfUrl: string; shelfBypassSecret: string },\n): void {\n setTenjinIdentity(\n identityFor(dir, async () => {\n const c = config();\n return tenjinOrigins({\n baseUrl: c.baseUrl,\n teamMode: isTeamModeConfig(c),\n });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AAkBzB,IAAM,UAAU;AAEhB,SAAS,eAAe,KAAiC;AACvD,QAAM,KAAK,IAAI,KAAK;AACpB,SAAO,QAAQ,KAAK,EAAE,IAAI,KAAK;AACjC;AAQA,eAAsB,sBAAsB,KAA0C;AACpF,QAAM,OAAO,cAAc,GAAG;AAC9B,MAAI;AACF,WAAO,eAAe,MAAM,SAAS,MAAM,MAAM,CAAC;AAAA,EACpD,SAAS,KAAK;AACZ,QAAI,CAAC,QAAQ,KAAK,QAAQ,EAAG,QAAO;AAAA,EACtC;AACA,QAAM,KAAK,WAAW;AACtB,MAAI;AACF,UAAM,yBAAyB,MAAM,GAAG,EAAE;AAAA,GAAM,EAAE,MAAM,KAAO,SAAS,IAAM,CAAC;AAC/E,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,QAAI,CAAC,QAAQ,KAAK,QAAQ,EAAG,QAAO;AAAA,EACtC;AACA,MAAI;AACF,WAAO,eAAe,MAAM,SAAS,MAAM,MAAM,CAAC;AAAA,EACpD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAE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|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WVUSXNIE.js";
|
|
7
7
|
import {
|
|
8
8
|
writeFileAtomic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-O2FRQ2L2.js";
|
|
10
10
|
|
|
11
11
|
// src/router/agent-tools.ts
|
|
12
12
|
import { readdir, readFile } from "node:fs/promises";
|
|
@@ -225,4 +225,4 @@ export {
|
|
|
225
225
|
writeRouterMemo,
|
|
226
226
|
clearRouterMemo
|
|
227
227
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
228
|
+
//# sourceMappingURL=chunk-RAULEAZ6.js.map
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
mainWorktreeOf,
|
|
6
6
|
ownedCandidates,
|
|
7
7
|
projectRoot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AWFUPKTM.js";
|
|
9
9
|
import {
|
|
10
10
|
CONFIG_DEFAULTS,
|
|
11
11
|
CliError,
|
|
12
12
|
loadRawConfig,
|
|
13
13
|
parseRouterLayer
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WO5BJNIB.js";
|
|
15
15
|
import {
|
|
16
16
|
configPath
|
|
17
17
|
} from "./chunk-SJLTEINJ.js";
|
|
@@ -122,4 +122,4 @@ export {
|
|
|
122
122
|
readProjectRouterFile,
|
|
123
123
|
projectRouterPath
|
|
124
124
|
};
|
|
125
|
-
//# sourceMappingURL=chunk-
|
|
125
|
+
//# sourceMappingURL=chunk-SPAVAYSW.js.map
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
isPublicAddress
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EBVIKMCH.js";
|
|
5
5
|
import {
|
|
6
6
|
UNREACHABLE_BACKOFF_MS,
|
|
7
7
|
clearRouterMemo,
|
|
8
8
|
readRouterMemo,
|
|
9
9
|
requestToolAccess,
|
|
10
10
|
writeRouterMemo
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RAULEAZ6.js";
|
|
12
12
|
import {
|
|
13
13
|
readSpendSummary,
|
|
14
14
|
spentOf
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NZIP4PA2.js";
|
|
16
16
|
import {
|
|
17
17
|
ChoicesSchema,
|
|
18
18
|
OfferSpecSchema,
|
|
19
19
|
ROUTER_PATH,
|
|
20
20
|
requestDecision
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KHE6L6TD.js";
|
|
22
22
|
import {
|
|
23
23
|
launchedByPlugin,
|
|
24
|
-
requestToolName
|
|
25
|
-
|
|
26
|
-
} from "./chunk-EWLU46J6.js";
|
|
24
|
+
requestToolName
|
|
25
|
+
} from "./chunk-WVUSXNIE.js";
|
|
27
26
|
import {
|
|
28
27
|
FEE_REQUIRED,
|
|
29
28
|
depositSentence,
|
|
30
29
|
firstNoticeFor,
|
|
31
|
-
isFeeRequired
|
|
32
|
-
|
|
30
|
+
isFeeRequired,
|
|
31
|
+
unpaidSentence
|
|
32
|
+
} from "./chunk-PAYV4XUA.js";
|
|
33
33
|
import {
|
|
34
34
|
evaluateSpendPolicy
|
|
35
35
|
} from "./chunk-2SNUOHAT.js";
|
|
@@ -51,10 +51,10 @@ import {
|
|
|
51
51
|
sessionDir,
|
|
52
52
|
wasOffered,
|
|
53
53
|
writeProgress
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-U6YQ6FRI.js";
|
|
55
55
|
import {
|
|
56
56
|
routerSettings
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-SPAVAYSW.js";
|
|
58
58
|
import {
|
|
59
59
|
sessionServedByPlugin
|
|
60
60
|
} from "./chunk-6W5GYG3W.js";
|
|
@@ -63,22 +63,24 @@ import {
|
|
|
63
63
|
} from "./chunk-S4SAZ7OD.js";
|
|
64
64
|
import {
|
|
65
65
|
composeUserAgent
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-IOODYAXL.js";
|
|
67
67
|
import {
|
|
68
68
|
resolveContextSettings
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-AWFUPKTM.js";
|
|
70
70
|
import {
|
|
71
71
|
external_exports,
|
|
72
72
|
isSameDeployment,
|
|
73
73
|
loadRawConfig,
|
|
74
74
|
parseUsdToAtomic,
|
|
75
|
-
rememberingBalanceReader,
|
|
76
75
|
resolveExperimentalBazaar,
|
|
77
76
|
resolveSettings,
|
|
78
|
-
toMoney
|
|
77
|
+
toMoney
|
|
78
|
+
} from "./chunk-WO5BJNIB.js";
|
|
79
|
+
import {
|
|
80
|
+
rememberingBalanceReader,
|
|
79
81
|
writeFileAtomic,
|
|
80
82
|
writeFileAtomicExclusive
|
|
81
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-O2FRQ2L2.js";
|
|
82
84
|
import {
|
|
83
85
|
walletPath
|
|
84
86
|
} from "./chunk-SJLTEINJ.js";
|
|
@@ -1464,7 +1466,7 @@ async function decide({ packet }, deps, config, sessionId, deadline) {
|
|
|
1464
1466
|
const why = outcome.status === "skipped" ? outcome.why : outcome.freePath ?? (outcome.status === "decided" && isFeeRequired(outcome.decision) ? FEE_REQUIRED : void 0);
|
|
1465
1467
|
const memoed = deps.route !== void 0 && route === null;
|
|
1466
1468
|
if (why !== void 0 && !(memoed && why === FEE_REQUIRED)) {
|
|
1467
|
-
await tellOnce(deps, sessionId, why, now
|
|
1469
|
+
await tellOnce(deps, sessionId, why, now);
|
|
1468
1470
|
}
|
|
1469
1471
|
if (outcome.status === "decided" && isFeeRequired(outcome.decision)) {
|
|
1470
1472
|
await clearRouterMemo(deps.dataDir, "paid-path-absent", baseUrl);
|
|
@@ -1491,8 +1493,8 @@ async function decide({ packet }, deps, config, sessionId, deadline) {
|
|
|
1491
1493
|
}
|
|
1492
1494
|
return outcome.decision.decision;
|
|
1493
1495
|
}
|
|
1494
|
-
async function tellOnce(deps, sessionId, why, now
|
|
1495
|
-
const sentence =
|
|
1496
|
+
async function tellOnce(deps, sessionId, why, now) {
|
|
1497
|
+
const sentence = unpaidSentence(why);
|
|
1496
1498
|
if (sentence === null || deps.notice === void 0) return;
|
|
1497
1499
|
if (await firstNoticeFor(deps.dataDir, sessionId, now).catch(() => false)) deps.notice(sentence);
|
|
1498
1500
|
}
|
|
@@ -1600,4 +1602,4 @@ export {
|
|
|
1600
1602
|
runHookCommand,
|
|
1601
1603
|
runHookKind
|
|
1602
1604
|
};
|
|
1603
|
-
//# sourceMappingURL=chunk-
|
|
1605
|
+
//# sourceMappingURL=chunk-TTBKWWTV.js.map
|