tenjin-cli 0.1.0-alpha.2 → 0.1.0-alpha.20
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/NOTICE.md +54 -7
- package/README.md +161 -257
- package/dist/{_esm-FEASBWRP.js → _esm-CE7KNONL.js} +9 -10
- package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
- package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
- package/dist/chunk-2E6GVIRP.js +888 -0
- package/dist/chunk-2E6GVIRP.js.map +1 -0
- package/dist/chunk-2G2WLVHB.js +102 -0
- package/dist/chunk-2G2WLVHB.js.map +1 -0
- package/dist/chunk-2QYORQBF.js +55 -0
- package/dist/chunk-2QYORQBF.js.map +1 -0
- package/dist/chunk-3BS55ANY.js +245 -0
- package/dist/chunk-3BS55ANY.js.map +1 -0
- package/dist/chunk-3KKKB2AQ.js +40 -0
- package/dist/chunk-3KKKB2AQ.js.map +1 -0
- package/dist/chunk-4AS52HUG.js +165 -0
- package/dist/chunk-4AS52HUG.js.map +1 -0
- package/dist/chunk-4M5FBWT5.js +368 -0
- package/dist/chunk-4M5FBWT5.js.map +1 -0
- package/dist/chunk-5FYKPQNX.js +1784 -0
- package/dist/chunk-5FYKPQNX.js.map +1 -0
- package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
- package/dist/chunk-5KD5HRAJ.js +241 -0
- package/dist/chunk-5KD5HRAJ.js.map +1 -0
- package/dist/chunk-72UHZRG6.js +231 -0
- package/dist/chunk-72UHZRG6.js.map +1 -0
- package/dist/chunk-7ACHDNJA.js +155 -0
- package/dist/chunk-7ACHDNJA.js.map +1 -0
- package/dist/chunk-7QKHZQKW.js +1680 -0
- package/dist/chunk-7QKHZQKW.js.map +1 -0
- package/dist/chunk-A36LQPHV.js +29 -0
- package/dist/chunk-A36LQPHV.js.map +1 -0
- package/dist/{chunk-UGX7YPX2.js → chunk-AWQPGIR6.js} +7 -9
- package/dist/{chunk-UGX7YPX2.js.map → chunk-AWQPGIR6.js.map} +1 -1
- package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
- package/dist/{chunk-XJIW7USF.js → chunk-BTX2QE2Y.js} +115 -11
- package/dist/chunk-BTX2QE2Y.js.map +1 -0
- package/dist/{chunk-OYMYCW7J.js → chunk-CCDOV45D.js} +588 -97
- package/dist/chunk-CCDOV45D.js.map +1 -0
- package/dist/chunk-CXUYCDPX.js +127 -0
- package/dist/chunk-CXUYCDPX.js.map +1 -0
- package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
- package/dist/chunk-HH3PDYIG.js +194 -0
- package/dist/chunk-HH3PDYIG.js.map +1 -0
- package/dist/{chunk-CYOF7ROH.js → chunk-HPWO4O6S.js} +3 -3
- package/dist/chunk-JLEF5WHM.js +132 -0
- package/dist/chunk-JLEF5WHM.js.map +1 -0
- package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
- package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
- package/dist/chunk-LHHMV4GU.js +27 -0
- package/dist/chunk-LHHMV4GU.js.map +1 -0
- package/dist/chunk-LI44XLMB.js +242 -0
- package/dist/chunk-LI44XLMB.js.map +1 -0
- package/dist/chunk-LN2HISWU.js +172 -0
- package/dist/chunk-LN2HISWU.js.map +1 -0
- package/dist/{chunk-YBMMV4Y4.js → chunk-MEFB5KHA.js} +13 -5
- package/dist/chunk-MEFB5KHA.js.map +1 -0
- package/dist/{chunk-NCE5NSN6.js → chunk-N35E6CM2.js} +140 -10
- package/dist/chunk-N35E6CM2.js.map +1 -0
- package/dist/chunk-NSG5TVZQ.js +447 -0
- package/dist/chunk-NSG5TVZQ.js.map +1 -0
- package/dist/chunk-O2JYBOUO.js +47 -0
- package/dist/chunk-O2JYBOUO.js.map +1 -0
- package/dist/{chunk-N62ROTMC.js → chunk-P42QX3QF.js} +14 -10
- package/dist/chunk-P42QX3QF.js.map +1 -0
- package/dist/chunk-PO4HAXAW.js +10528 -0
- package/dist/chunk-PO4HAXAW.js.map +1 -0
- package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
- package/dist/{chunk-S3IGX57D.js → chunk-RGVOODF4.js} +7703 -7475
- package/dist/chunk-RGVOODF4.js.map +1 -0
- package/dist/chunk-RPR2C2JO.js +112 -0
- package/dist/chunk-RPR2C2JO.js.map +1 -0
- package/dist/chunk-S2NRVRPF.js +171 -0
- package/dist/chunk-S2NRVRPF.js.map +1 -0
- package/dist/chunk-TGLKKLQG.js +11 -0
- package/dist/chunk-TGLKKLQG.js.map +1 -0
- package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/chunk-TU7XH3JJ.js +97 -0
- package/dist/chunk-TU7XH3JJ.js.map +1 -0
- package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
- package/dist/{chunk-Z6MFJV5Z.js → chunk-YEBNE5NW.js} +851 -500
- package/dist/chunk-YEBNE5NW.js.map +1 -0
- package/dist/chunk-YREKMJPP.js +131 -0
- package/dist/chunk-YREKMJPP.js.map +1 -0
- package/dist/{cli-4NNBEQYH.js → cli-XJQYUOHI.js} +355 -217
- package/dist/cli-XJQYUOHI.js.map +1 -0
- package/dist/config-KMJLFPSI.js +39 -0
- package/dist/dist-3LOO6M4U.js +2842 -0
- package/dist/dist-3LOO6M4U.js.map +1 -0
- package/dist/doctor-KMN55D7U.js +444 -0
- package/dist/doctor-KMN55D7U.js.map +1 -0
- package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
- package/dist/fund-LT6ZPGEQ.js +298 -0
- package/dist/fund-LT6ZPGEQ.js.map +1 -0
- package/dist/hook-command-U5XPEHAJ.js +1052 -0
- package/dist/hook-command-U5XPEHAJ.js.map +1 -0
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/install-MMNXJ5LM.js +61 -0
- package/dist/install-identity-B7FVIWML.js +27 -0
- package/dist/install-wallet-XMVUBCHS.js +107 -0
- package/dist/install-wallet-XMVUBCHS.js.map +1 -0
- package/dist/mcp-TUPRIPSI.js +10000 -0
- package/dist/mcp-TUPRIPSI.js.map +1 -0
- package/dist/paths-LRMWNTJP.js +51 -0
- package/dist/pay-XAWW3NV3.js +44 -0
- package/dist/redact-6W23GGJC.js +15 -0
- package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-ZZZT2CAX.js} +3 -3
- package/dist/secp256k1-ZZZT2CAX.js.map +1 -0
- package/dist/send-HESQYRKM.js +225 -0
- package/dist/send-HESQYRKM.js.map +1 -0
- package/dist/status-ANZPRZJJ.js +71 -0
- package/dist/status-ANZPRZJJ.js.map +1 -0
- package/dist/status-line-J3TUWVRQ.js +87 -0
- package/dist/status-line-J3TUWVRQ.js.map +1 -0
- package/dist/status-line-wiring-HSV7DXO5.js +29 -0
- package/dist/status-line-wiring-HSV7DXO5.js.map +1 -0
- package/dist/tenjin-daemon.mjs +20547 -0
- package/dist/tenjin-shim.mjs +251 -0
- package/dist/tenjin-vitest-reporter.mjs +49 -0
- package/dist/uninstall-GUU34YKP.js +165 -0
- package/dist/uninstall-GUU34YKP.js.map +1 -0
- package/dist/update-KO2NZRJ5.js +433 -0
- package/dist/update-KO2NZRJ5.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
- package/dist/viemAdapter-By13KInL-X2VY6CY3.js.map +1 -0
- package/dist/wallet-3URC5QPK.js +33 -0
- package/dist/wallet-3URC5QPK.js.map +1 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +139 -0
- package/docs/safety-model.md +70 -0
- package/package.json +14 -9
- package/LICENSE +0 -21
- package/dist/buy-U35DQ6XM.js +0 -1598
- package/dist/buy-U35DQ6XM.js.map +0 -1
- package/dist/candidate-RLYCQMF5.js +0 -127
- package/dist/candidate-RLYCQMF5.js.map +0 -1
- package/dist/chunk-27ONARHV.js +0 -171
- package/dist/chunk-27ONARHV.js.map +0 -1
- package/dist/chunk-3OV7E5G5.js +0 -18
- package/dist/chunk-3OV7E5G5.js.map +0 -1
- package/dist/chunk-7KUW4MJD.js +0 -59
- package/dist/chunk-7KUW4MJD.js.map +0 -1
- package/dist/chunk-7PHSZKQS.js +0 -333
- package/dist/chunk-7PHSZKQS.js.map +0 -1
- package/dist/chunk-IYLHQMT5.js +0 -211
- package/dist/chunk-IYLHQMT5.js.map +0 -1
- package/dist/chunk-JPHG2JW3.js +0 -96
- package/dist/chunk-JPHG2JW3.js.map +0 -1
- package/dist/chunk-MUBUQVC3.js +0 -67
- package/dist/chunk-MUBUQVC3.js.map +0 -1
- package/dist/chunk-N62ROTMC.js.map +0 -1
- package/dist/chunk-NCE5NSN6.js.map +0 -1
- package/dist/chunk-OYMYCW7J.js.map +0 -1
- package/dist/chunk-QNP7H47L.js +0 -152
- package/dist/chunk-QNP7H47L.js.map +0 -1
- package/dist/chunk-RY4XKNV3.js +0 -140
- package/dist/chunk-RY4XKNV3.js.map +0 -1
- package/dist/chunk-S3IGX57D.js.map +0 -1
- package/dist/chunk-TFGSOPWR.js +0 -261
- package/dist/chunk-TFGSOPWR.js.map +0 -1
- package/dist/chunk-TLCMMYLY.js +0 -126
- package/dist/chunk-TLCMMYLY.js.map +0 -1
- package/dist/chunk-UO22YNY4.js +0 -69
- package/dist/chunk-UO22YNY4.js.map +0 -1
- package/dist/chunk-UPIEAMGH.js +0 -160
- package/dist/chunk-UPIEAMGH.js.map +0 -1
- package/dist/chunk-XJIW7USF.js.map +0 -1
- package/dist/chunk-YBMMV4Y4.js.map +0 -1
- package/dist/chunk-YIYQ2ZNT.js +0 -286
- package/dist/chunk-YIYQ2ZNT.js.map +0 -1
- package/dist/chunk-YN5SHIXQ.js +0 -126
- package/dist/chunk-YN5SHIXQ.js.map +0 -1
- package/dist/chunk-Z52RA3NC.js +0 -137
- package/dist/chunk-Z52RA3NC.js.map +0 -1
- package/dist/chunk-Z6MFJV5Z.js.map +0 -1
- package/dist/cli-4NNBEQYH.js.map +0 -1
- package/dist/config-2VSXWWHK.js +0 -21
- package/dist/doctor-JJPNIBYH.js +0 -20
- package/dist/inspect-JGYJWFDP.js +0 -96
- package/dist/inspect-JGYJWFDP.js.map +0 -1
- package/dist/install-ZQRMSRGW.js +0 -378
- package/dist/install-ZQRMSRGW.js.map +0 -1
- package/dist/lookup-WYVTOMVY.js +0 -113
- package/dist/lookup-WYVTOMVY.js.map +0 -1
- package/dist/outcome-HKKT6QIA.js +0 -66
- package/dist/outcome-HKKT6QIA.js.map +0 -1
- package/dist/publish-D76B3MBK.js +0 -1480
- package/dist/publish-D76B3MBK.js.map +0 -1
- package/dist/usdc-JIAJW4SV.js +0 -22
- package/dist/wallet-6QKS6UHW.js +0 -179
- package/dist/wallet-6QKS6UHW.js.map +0 -1
- package/dist/wallet-PA54CRBL.js +0 -30
- package/skills/tenjin/SKILL.md +0 -199
- package/skills/tenjin-publish/SKILL.md +0 -96
- package/skills/tenjin-search/SKILL.md +0 -122
- /package/dist/{_esm-FEASBWRP.js.map → _esm-CE7KNONL.js.map} +0 -0
- /package/dist/{ccip-NQXCEK2U.js.map → ccip-7RMRLAGV.js.map} +0 -0
- /package/dist/{ccip-XR5NE5QK.js.map → ccip-NLCSCHKI.js.map} +0 -0
- /package/dist/{chunk-ZMHYXMO6.js.map → chunk-5IEP5EGE.js.map} +0 -0
- /package/dist/{chunk-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
- /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
- /package/dist/{chunk-CYOF7ROH.js.map → chunk-HPWO4O6S.js.map} +0 -0
- /package/dist/{chunk-QVX5MWJZ.js.map → chunk-JRGFKVAZ.js.map} +0 -0
- /package/dist/{chunk-HIVZG55D.js.map → chunk-KG3D7FIF.js.map} +0 -0
- /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POUWHWID.js.map} +0 -0
- /package/dist/{chunk-RRN3YTK7.js.map → chunk-TTNESUPQ.js.map} +0 -0
- /package/dist/{chunk-HSDCI7OV.js.map → chunk-XZKD7DIF.js.map} +0 -0
- /package/dist/{config-2VSXWWHK.js.map → config-KMJLFPSI.js.map} +0 -0
- /package/dist/{doctor-JJPNIBYH.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → install-MMNXJ5LM.js.map} +0 -0
- /package/dist/{secp256k1-N3ZHU7LB.js.map → install-identity-B7FVIWML.js.map} +0 -0
- /package/dist/{usdc-JIAJW4SV.js.map → paths-LRMWNTJP.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → pay-XAWW3NV3.js.map} +0 -0
- /package/dist/{wallet-PA54CRBL.js.map → redact-6W23GGJC.js.map} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
setTenjinIdentity
|
|
4
|
+
} from "./chunk-3BS55ANY.js";
|
|
5
|
+
import {
|
|
6
|
+
hasCode
|
|
7
|
+
} from "./chunk-2I4QTOLB.js";
|
|
8
|
+
import {
|
|
9
|
+
isTeamModeConfig
|
|
10
|
+
} from "./chunk-5KD5HRAJ.js";
|
|
11
|
+
import {
|
|
12
|
+
knownDeploymentOrigins,
|
|
13
|
+
loadRawConfig,
|
|
14
|
+
resolveSettings
|
|
15
|
+
} from "./chunk-CCDOV45D.js";
|
|
16
|
+
import {
|
|
17
|
+
writeFileAtomicExclusive
|
|
18
|
+
} from "./chunk-JLEF5WHM.js";
|
|
19
|
+
import {
|
|
20
|
+
installIdPath
|
|
21
|
+
} from "./chunk-TU7XH3JJ.js";
|
|
22
|
+
|
|
23
|
+
// src/lib/install-identity.ts
|
|
24
|
+
import { randomUUID } from "node:crypto";
|
|
25
|
+
import { readFile } from "node:fs/promises";
|
|
26
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
27
|
+
function parseInstallId(raw) {
|
|
28
|
+
const id = raw.trim();
|
|
29
|
+
return UUID_RE.test(id) ? id : void 0;
|
|
30
|
+
}
|
|
31
|
+
async function readOrCreateInstallId(dir) {
|
|
32
|
+
const path = installIdPath(dir);
|
|
33
|
+
try {
|
|
34
|
+
return parseInstallId(await readFile(path, "utf8"));
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (!hasCode(err, "ENOENT")) return void 0;
|
|
37
|
+
}
|
|
38
|
+
const id = randomUUID();
|
|
39
|
+
try {
|
|
40
|
+
await writeFileAtomicExclusive(path, `${id}
|
|
41
|
+
`, { mode: 384, dirMode: 448 });
|
|
42
|
+
return id;
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (!hasCode(err, "EEXIST")) return void 0;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
return parseInstallId(await readFile(path, "utf8"));
|
|
48
|
+
} catch {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function tryOrigin(url) {
|
|
53
|
+
try {
|
|
54
|
+
return new URL(url).origin;
|
|
55
|
+
} catch {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function tenjinOrigins(s) {
|
|
60
|
+
const origins = new Set(knownDeploymentOrigins());
|
|
61
|
+
const baseOrigin = tryOrigin(s.baseUrl);
|
|
62
|
+
if (baseOrigin !== void 0 && !s.teamMode) origins.add(baseOrigin);
|
|
63
|
+
return [...origins];
|
|
64
|
+
}
|
|
65
|
+
function identityFor(dir, origins) {
|
|
66
|
+
let install;
|
|
67
|
+
return {
|
|
68
|
+
origins,
|
|
69
|
+
installId: () => install ??= readOrCreateInstallId(dir)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
var baseUrlFlag;
|
|
73
|
+
function noteBaseUrlFlag(flag) {
|
|
74
|
+
baseUrlFlag = flag;
|
|
75
|
+
}
|
|
76
|
+
function enableCliIdentity(dir, env = process.env) {
|
|
77
|
+
let origins;
|
|
78
|
+
setTenjinIdentity(
|
|
79
|
+
identityFor(dir, () => {
|
|
80
|
+
origins ??= (async () => {
|
|
81
|
+
const config = await loadRawConfig(dir);
|
|
82
|
+
const s = resolveSettings({ config, flags: { baseUrl: baseUrlFlag }, env });
|
|
83
|
+
return tenjinOrigins({
|
|
84
|
+
baseUrl: s.baseUrl.value,
|
|
85
|
+
teamMode: isTeamModeConfig(config)
|
|
86
|
+
});
|
|
87
|
+
})();
|
|
88
|
+
return origins;
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function enableDaemonIdentity(dir, config) {
|
|
93
|
+
setTenjinIdentity(
|
|
94
|
+
identityFor(dir, async () => {
|
|
95
|
+
const c = config();
|
|
96
|
+
return tenjinOrigins({
|
|
97
|
+
baseUrl: c.baseUrl,
|
|
98
|
+
teamMode: isTeamModeConfig(c)
|
|
99
|
+
});
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export {
|
|
105
|
+
readOrCreateInstallId,
|
|
106
|
+
tenjinOrigins,
|
|
107
|
+
identityFor,
|
|
108
|
+
noteBaseUrlFlag,
|
|
109
|
+
enableCliIdentity,
|
|
110
|
+
enableDaemonIdentity
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=chunk-RPR2C2JO.js.map
|
|
@@ -0,0 +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":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,gBAAg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IACE,YAAY,KAAK,MAAM;AACrB,mBAAa,YAAY;AACvB,cAAM,SAAS,MAAM,cAAc,GAAG;AACtC,cAAM,IAAI,gBAAgB,EAAE,QAAQ,OAAO,EAAE,SAAS,YAAY,GAAG,IAAI,CAAC;AAC1E,eAAO,cAAc;AAAA,UACnB,SAAS,EAAE,QAAQ;AAAA,UACnB,UAAU,iBAAiB,MAAM;AAAA,QACnC,CAAC;AAAA,MACH,GAAG;AACH,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;AAOO,SAAS,qBACd,KACA,QACM;AACN;AAAA,IACE,YAAY,KAAK,YAAY;AAC3B,YAAM,IAAI,OAAO;AACjB,aAAO,cAAc;AAAA,QACnB,SAAS,EAAE;AAAA,QACX,UAAU,iBAAiB,CAAC;AAAA,MAC9B,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
MCP_SERVER_NAME,
|
|
4
|
+
REQUEST_TOOL
|
|
5
|
+
} from "./chunk-TGLKKLQG.js";
|
|
6
|
+
|
|
7
|
+
// src/router/agent-tools.ts
|
|
8
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
9
|
+
import { dirname, join, resolve } from "node:path";
|
|
10
|
+
var MCP_INHERITING_BUILTINS = /* @__PURE__ */ new Set([
|
|
11
|
+
"general-purpose",
|
|
12
|
+
"Explore",
|
|
13
|
+
"Plan"
|
|
14
|
+
]);
|
|
15
|
+
var MAX_AGENT_FILE_BYTES = 256 * 1024;
|
|
16
|
+
var TYPE_RE = /^[A-Za-z0-9_.:-]{1,200}$/;
|
|
17
|
+
async function requestToolAccess(agentType, lookup) {
|
|
18
|
+
if (agentType === void 0 || !TYPE_RE.test(agentType)) return "unknown";
|
|
19
|
+
try {
|
|
20
|
+
const text = await findDefinition(agentType, lookup);
|
|
21
|
+
if (text !== null) return accessOf(text);
|
|
22
|
+
return MCP_INHERITING_BUILTINS.has(agentType) ? "allowed" : "unknown";
|
|
23
|
+
} catch {
|
|
24
|
+
return "unknown";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function accessOf(definition) {
|
|
28
|
+
const frontmatter = frontmatterOf(definition);
|
|
29
|
+
if (frontmatter === null) return "unknown";
|
|
30
|
+
const disallowed = listField(frontmatter, "disallowedTools");
|
|
31
|
+
if (disallowed !== void 0 && disallowed.some(namesRequestTool)) return "excluded";
|
|
32
|
+
const tools = listField(frontmatter, "tools");
|
|
33
|
+
if (tools === void 0) return "allowed";
|
|
34
|
+
return tools.some(namesRequestTool) ? "allowed" : "excluded";
|
|
35
|
+
}
|
|
36
|
+
function namesRequestTool(tool) {
|
|
37
|
+
if (tool === REQUEST_TOOL || tool === `mcp__${MCP_SERVER_NAME}`) return true;
|
|
38
|
+
return tool.endsWith("*") && REQUEST_TOOL.startsWith(tool.slice(0, -1));
|
|
39
|
+
}
|
|
40
|
+
async function agentsWithoutRequestTool(lookup) {
|
|
41
|
+
const found = [];
|
|
42
|
+
const seen = /* @__PURE__ */ new Set();
|
|
43
|
+
for (const directory of agentDirs(lookup)) {
|
|
44
|
+
for (const { name, text } of await definitionsIn(directory)) {
|
|
45
|
+
const type = nameOf(text) ?? name;
|
|
46
|
+
if (seen.has(type)) continue;
|
|
47
|
+
seen.add(type);
|
|
48
|
+
if (accessOf(text) === "excluded") found.push(type);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return found.sort();
|
|
52
|
+
}
|
|
53
|
+
async function findDefinition(agentType, lookup) {
|
|
54
|
+
for (const directory of agentDirs(lookup)) {
|
|
55
|
+
const text = await definitionIn(directory, agentType);
|
|
56
|
+
if (text !== null) return text;
|
|
57
|
+
}
|
|
58
|
+
const colon = agentType.indexOf(":");
|
|
59
|
+
if (colon > 0) {
|
|
60
|
+
const plugin = agentType.slice(0, colon);
|
|
61
|
+
const agent = agentType.slice(colon + 1);
|
|
62
|
+
for (const root of await pluginRoots(plugin, lookup.homeDir)) {
|
|
63
|
+
const text = await definitionIn(join(root, "agents"), agent);
|
|
64
|
+
if (text !== null) return text;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function agentDirs(lookup) {
|
|
70
|
+
const dirs = [];
|
|
71
|
+
if (lookup.cwd !== void 0 && lookup.cwd.length > 0) {
|
|
72
|
+
let current = resolve(lookup.cwd);
|
|
73
|
+
for (; ; ) {
|
|
74
|
+
dirs.push(join(current, ".claude", "agents"));
|
|
75
|
+
const parent = dirname(current);
|
|
76
|
+
if (parent === current) break;
|
|
77
|
+
current = parent;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const user = join(resolve(lookup.homeDir), ".claude", "agents");
|
|
81
|
+
return [...dirs.filter((d) => d !== user), user];
|
|
82
|
+
}
|
|
83
|
+
async function definitionIn(directory, agentType) {
|
|
84
|
+
const direct = await readBounded(join(directory, `${agentType}.md`));
|
|
85
|
+
if (direct !== null && (nameOf(direct) ?? agentType) === agentType) return direct;
|
|
86
|
+
for (const { text } of await definitionsIn(directory)) {
|
|
87
|
+
if (nameOf(text) === agentType) return text;
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
async function definitionsIn(directory) {
|
|
92
|
+
let names;
|
|
93
|
+
try {
|
|
94
|
+
names = (await readdir(directory)).filter((n) => n.endsWith(".md")).slice(0, 200);
|
|
95
|
+
} catch {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
const out = [];
|
|
99
|
+
for (const file of names) {
|
|
100
|
+
const text = await readBounded(join(directory, file));
|
|
101
|
+
if (text !== null) out.push({ name: file.slice(0, -3), text });
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
async function pluginRoots(plugin, homeDir) {
|
|
106
|
+
const raw = await readBounded(join(homeDir, ".claude", "plugins", "installed_plugins.json"));
|
|
107
|
+
if (raw === null) return [];
|
|
108
|
+
const parsed = JSON.parse(raw);
|
|
109
|
+
const roots = [];
|
|
110
|
+
for (const [key, entries] of Object.entries(parsed.plugins ?? {})) {
|
|
111
|
+
if (key.split("@")[0] !== plugin || !Array.isArray(entries)) continue;
|
|
112
|
+
for (const entry of entries) {
|
|
113
|
+
const path = entry.installPath;
|
|
114
|
+
if (typeof path === "string" && path.length > 0) roots.push(path);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return roots;
|
|
118
|
+
}
|
|
119
|
+
async function readBounded(path) {
|
|
120
|
+
try {
|
|
121
|
+
const text = await readFile(path, "utf8");
|
|
122
|
+
return text.length > MAX_AGENT_FILE_BYTES ? null : text;
|
|
123
|
+
} catch {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function frontmatterOf(text) {
|
|
128
|
+
const lines = text.replace(/^\uFEFF/, "").split(/\r?\n/);
|
|
129
|
+
const open = lines.findIndex((l) => l.trim().length > 0);
|
|
130
|
+
if (open === -1 || lines[open]?.trim() !== "---") return null;
|
|
131
|
+
const end = lines.findIndex((l, i) => i > open && l.trim() === "---");
|
|
132
|
+
return end === -1 ? null : lines.slice(open + 1, end);
|
|
133
|
+
}
|
|
134
|
+
function nameOf(text) {
|
|
135
|
+
const frontmatter = frontmatterOf(text);
|
|
136
|
+
if (frontmatter === null) return null;
|
|
137
|
+
const line = frontmatter.find((l) => /^name\s*:/.test(l));
|
|
138
|
+
const value = line === void 0 ? "" : unquote(line.slice(line.indexOf(":") + 1).trim());
|
|
139
|
+
return value.length > 0 ? value : null;
|
|
140
|
+
}
|
|
141
|
+
function listField(frontmatter, key) {
|
|
142
|
+
const index = frontmatter.findIndex((l) => new RegExp(`^${key}\\s*:`).test(l));
|
|
143
|
+
if (index === -1) return void 0;
|
|
144
|
+
const line = frontmatter[index];
|
|
145
|
+
const inline = line.slice(line.indexOf(":") + 1).trim();
|
|
146
|
+
if (inline.length > 0) {
|
|
147
|
+
const body = inline.startsWith("[") && inline.endsWith("]") ? inline.slice(1, -1) : inline;
|
|
148
|
+
return body.split(",").map((part) => unquote(part.trim())).filter((part) => part.length > 0);
|
|
149
|
+
}
|
|
150
|
+
const items = [];
|
|
151
|
+
for (const next of frontmatter.slice(index + 1)) {
|
|
152
|
+
const item = /^\s+-\s*(.*)$/.exec(next);
|
|
153
|
+
if (item === null) {
|
|
154
|
+
if (next.trim().length === 0) continue;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
const value = unquote(item[1].trim());
|
|
158
|
+
if (value.length > 0) items.push(value);
|
|
159
|
+
}
|
|
160
|
+
return items;
|
|
161
|
+
}
|
|
162
|
+
function unquote(value) {
|
|
163
|
+
const quoted = /^(['"])(.*)\1$/.exec(value);
|
|
164
|
+
return quoted === null ? value : quoted[2];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
requestToolAccess,
|
|
169
|
+
agentsWithoutRequestTool
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=chunk-S2NRVRPF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/router/agent-tools.ts"],"sourcesContent":["import { readdir, readFile } from 'node:fs/promises';\nimport { dirname, join, resolve } from 'node:path';\nimport { MCP_SERVER_NAME, REQUEST_TOOL } from './names';\n\n/**\n * CAN THIS SUBAGENT CALL `request` AT ALL? An offer to an agent whose definition\n * leaves the tool out is a line it cannot act on, and a router call spent to\n * write it. Claude Code defines a custom agent in a Markdown file whose\n * frontmatter may carry `tools:` (an allowlist) and `disallowedTools:`; this\n * reads that, and nothing else, and never writes to it.\n *\n * ONLY `allowed` IS ACTED ON. A subagent is redirected or offered a lookup\n * only when this KNOWS it can make the call: a definition whose tools cover\n * the request tool (or that has no `tools:` and so inherits everything), or a\n * built-in in {@link MCP_INHERITING_BUILTINS}. Every other built-in, and any\n * type with no definition this can find or read, is `unknown`, and `unknown`\n * gets no router call: `claude-code-guide` ships with Bash, Read, WebFetch and\n * WebSearch and no MCP tools, and denying its WebFetch would strand it exactly\n * as #377 reported.\n *\n * WHERE A DEFINITION LIVES, in the harness's own precedence: the project's\n * `.claude/agents` (from `cwd` up to the filesystem root, nearest first), then\n * `~/.claude/agents`, then an installed plugin's `agents/` for a `plugin:agent`\n * type. A file is found by its name first and by its frontmatter `name:`\n * second, because the type is the `name:` and the file name only usually\n * matches it.\n */\n\nexport type RequestToolAccess = 'allowed' | 'excluded' | 'unknown';\n\n/**\n * The built-in agent types that have no definition file and still inherit MCP\n * tools, so can call `mcp__x402__request`. From Claude Code's own Agent tool\n * listing (2.1.28x): `general-purpose` has every tool, and `Explore` and `Plan`\n * exclude only editing and agent tools, never MCP. Built-ins with a fixed tool\n * list, such as `claude-code-guide` (Bash, Read, WebFetch, WebSearch) and\n * `statusline-setup` (Read, Edit), are deliberately absent.\n */\nexport const MCP_INHERITING_BUILTINS: ReadonlySet<string> = new Set([\n 'general-purpose',\n 'Explore',\n 'Plan',\n]);\n\nexport interface AgentLookup {\n cwd?: string;\n homeDir: string;\n}\n\nconst MAX_AGENT_FILE_BYTES = 256 * 1024;\nconst TYPE_RE = /^[A-Za-z0-9_.:-]{1,200}$/;\n\nexport async function requestToolAccess(\n agentType: string | undefined,\n lookup: AgentLookup,\n): Promise<RequestToolAccess> {\n if (agentType === undefined || !TYPE_RE.test(agentType)) return 'unknown';\n try {\n const text = await findDefinition(agentType, lookup);\n if (text !== null) return accessOf(text);\n return MCP_INHERITING_BUILTINS.has(agentType) ? 'allowed' : 'unknown';\n } catch {\n return 'unknown';\n }\n}\n\n/** What one definition's frontmatter says about the request tool. */\nexport function accessOf(definition: string): RequestToolAccess {\n const frontmatter = frontmatterOf(definition);\n if (frontmatter === null) return 'unknown';\n const disallowed = listField(frontmatter, 'disallowedTools');\n if (disallowed !== undefined && disallowed.some(namesRequestTool)) return 'excluded';\n const tools = listField(frontmatter, 'tools');\n if (tools === undefined) return 'allowed';\n return tools.some(namesRequestTool) ? 'allowed' : 'excluded';\n}\n\n/**\n * Does one `tools:` or `disallowedTools:` entry cover the request tool? The\n * tool itself, the bare server, or any `*`-suffixed pattern the tool's name\n * starts with: `*`, `mcp__*`, `mcp__x402__*` and every prefix between.\n */\nfunction namesRequestTool(tool: string): boolean {\n if (tool === REQUEST_TOOL || tool === `mcp__${MCP_SERVER_NAME}`) return true;\n return tool.endsWith('*') && REQUEST_TOOL.startsWith(tool.slice(0, -1));\n}\n\n/**\n * Every custom agent this project and this user define whose tools leave the\n * request tool out, for `doctor` to name. Plugin agents are not listed: their\n * files are not the user's to edit.\n */\nexport async function agentsWithoutRequestTool(lookup: AgentLookup): Promise<string[]> {\n const found: string[] = [];\n const seen = new Set<string>();\n for (const directory of agentDirs(lookup)) {\n for (const { name, text } of await definitionsIn(directory)) {\n const type = nameOf(text) ?? name;\n if (seen.has(type)) continue;\n seen.add(type);\n if (accessOf(text) === 'excluded') found.push(type);\n }\n }\n return found.sort();\n}\n\nasync function findDefinition(agentType: string, lookup: AgentLookup): Promise<string | null> {\n for (const directory of agentDirs(lookup)) {\n const text = await definitionIn(directory, agentType);\n if (text !== null) return text;\n }\n const colon = agentType.indexOf(':');\n if (colon > 0) {\n const plugin = agentType.slice(0, colon);\n const agent = agentType.slice(colon + 1);\n for (const root of await pluginRoots(plugin, lookup.homeDir)) {\n const text = await definitionIn(join(root, 'agents'), agent);\n if (text !== null) return text;\n }\n }\n return null;\n}\n\nfunction agentDirs(lookup: AgentLookup): string[] {\n const dirs: string[] = [];\n if (lookup.cwd !== undefined && lookup.cwd.length > 0) {\n let current = resolve(lookup.cwd);\n for (;;) {\n dirs.push(join(current, '.claude', 'agents'));\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n }\n const user = join(resolve(lookup.homeDir), '.claude', 'agents');\n // The user's directory is also an ancestor of most projects; it counts once,\n // in its own place in the order.\n return [...dirs.filter((d) => d !== user), user];\n}\n\nasync function definitionIn(directory: string, agentType: string): Promise<string | null> {\n const direct = await readBounded(join(directory, `${agentType}.md`));\n if (direct !== null && (nameOf(direct) ?? agentType) === agentType) return direct;\n for (const { text } of await definitionsIn(directory)) {\n if (nameOf(text) === agentType) return text;\n }\n return null;\n}\n\nasync function definitionsIn(directory: string): Promise<{ name: string; text: string }[]> {\n let names: string[];\n try {\n names = (await readdir(directory)).filter((n) => n.endsWith('.md')).slice(0, 200);\n } catch {\n return [];\n }\n const out: { name: string; text: string }[] = [];\n for (const file of names) {\n const text = await readBounded(join(directory, file));\n if (text !== null) out.push({ name: file.slice(0, -3), text });\n }\n return out;\n}\n\n/** Install paths `installed_plugins.json` records for `<plugin>@<marketplace>`. */\nasync function pluginRoots(plugin: string, homeDir: string): Promise<string[]> {\n const raw = await readBounded(join(homeDir, '.claude', 'plugins', 'installed_plugins.json'));\n if (raw === null) return [];\n const parsed = JSON.parse(raw) as { plugins?: Record<string, unknown> };\n const roots: string[] = [];\n for (const [key, entries] of Object.entries(parsed.plugins ?? {})) {\n if (key.split('@')[0] !== plugin || !Array.isArray(entries)) continue;\n for (const entry of entries) {\n const path = (entry as { installPath?: unknown }).installPath;\n if (typeof path === 'string' && path.length > 0) roots.push(path);\n }\n }\n return roots;\n}\n\nasync function readBounded(path: string): Promise<string | null> {\n try {\n const text = await readFile(path, 'utf8');\n return text.length > MAX_AGENT_FILE_BYTES ? null : text;\n } catch {\n return null;\n }\n}\n\nfunction frontmatterOf(text: string): string[] | null {\n const lines = text.replace(/^\\uFEFF/, '').split(/\\r?\\n/);\n const open = lines.findIndex((l) => l.trim().length > 0);\n if (open === -1 || lines[open]?.trim() !== '---') return null;\n const end = lines.findIndex((l, i) => i > open && l.trim() === '---');\n return end === -1 ? null : lines.slice(open + 1, end);\n}\n\nfunction nameOf(text: string): string | null {\n const frontmatter = frontmatterOf(text);\n if (frontmatter === null) return null;\n const line = frontmatter.find((l) => /^name\\s*:/.test(l));\n const value = line === undefined ? '' : unquote(line.slice(line.indexOf(':') + 1).trim());\n return value.length > 0 ? value : null;\n}\n\n/**\n * A top-level list field in the three spellings agent files use: `a, b, c`,\n * `[a, b]`, or a block of `- a` lines. `undefined` when the key is absent.\n */\nfunction listField(frontmatter: string[], key: string): string[] | undefined {\n const index = frontmatter.findIndex((l) => new RegExp(`^${key}\\\\s*:`).test(l));\n if (index === -1) return undefined;\n const line = frontmatter[index]!;\n const inline = line.slice(line.indexOf(':') + 1).trim();\n if (inline.length > 0) {\n const body = inline.startsWith('[') && inline.endsWith(']') ? inline.slice(1, -1) : inline;\n return body\n .split(',')\n .map((part) => unquote(part.trim()))\n .filter((part) => part.length > 0);\n }\n const items: string[] = [];\n for (const next of frontmatter.slice(index + 1)) {\n const item = /^\\s+-\\s*(.*)$/.exec(next);\n if (item === null) {\n if (next.trim().length === 0) continue;\n break;\n }\n const value = unquote(item[1]!.trim());\n if (value.length > 0) items.push(value);\n }\n return items;\n}\n\nfunction unquote(value: string): string {\n const quoted = /^(['\"])(.*)\\1$/.exec(value);\n return quoted === null ? value : quoted[2]!;\n}\n"],"mappings":";;;;;;;AAAA,SAAS,SAAS,gBAAgB;AAClC,SAAS,SAAS,MAAM,eAAe;AAqChC,IAAM,0BAA+C,oBAAI,IAAI;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOD,IAAM,uBAAuB,MAAM;AACnC,IAAM,UAAU;AAEhB,eAAsB,kBACpB,WACA,QAC4B;AAC5B,MAAI,cAAc,UAAa,CAAC,QAAQ,KAAK,SAAS,EAAG,QAAO;AAChE,MAAI;AACF,UAAM,OAAO,MAAM,eAAe,WAAW,MAAM;AACnD,QAAI,SAAS,KAAM,QAAO,SAAS,IAAI;AACvC,WAAO,wBAAwB,IAAI,SAAS,IAAI,YAAY;AAAA,EAC9D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,SAAS,YAAuC;AAC9D,QAAM,cAAc,cAAc,UAAU;AAC5C,MAAI,gBAAgB,KAAM,QAAO;AACjC,QAAM,aA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,IAAI,CAAC,EAAE,KAAK,CAAC;AACxF,SAAO,MAAM,SAAS,IAAI,QAAQ;AACpC;AAMA,SAAS,UAAU,aAAuB,KAAmC;AAC3E,QAAM,QAAQ,YAAY,UAAU,CAAC,MAAM,IAAI,OAAO,IAAI,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7E,MAAI,UAAU,GAAI,QAAO;AACzB,QAAM,OAAO,YAAY,KAAK;AAC9B,QAAM,SAAS,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAI,CAAC,EAAE,KAAK;AACtD,MAAI,OAAO,SAAS,GAAG;AACrB,UAAM,OAAO,OAAO,WAAW,GAAG,KAAK,OAAO,SAAS,GAAG,IAAI,OAAO,MAAM,GAAG,EAAE,IAAI;AACpF,WAAO,KACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,QAAQ,KAAK,KAAK,CAAC,CAAC,EAClC,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC;AAAA,EACrC;AACA,QAAM,QAAkB,CAAC;AACzB,aAAW,QAAQ,YAAY,MAAM,QAAQ,CAAC,GAAG;AAC/C,UAAM,OAAO,gBAAgB,KAAK,IAAI;AACtC,QAAI,SAAS,MAAM;AACjB,UAAI,KAAK,KAAK,EAAE,WAAW,EAAG;AAC9B;AAAA,IACF;AACA,UAAM,QAAQ,QAAQ,KAAK,CAAC,EAAG,KAAK,CAAC;AACrC,QAAI,MAAM,SAAS,EAAG,OAAM,KAAK,KAAK;AAAA,EACxC;AACA,SAAO;AACT;AAEA,SAAS,QAAQ,OAAuB;AACtC,QAAM,SAAS,iBAAiB,KAAK,KAAK;AAC1C,SAAO,WAAW,OAAO,QAAQ,OAAO,CAAC;AAC3C;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/router/names.ts
|
|
4
|
+
var MCP_SERVER_NAME = "x402";
|
|
5
|
+
var REQUEST_TOOL = `mcp__${MCP_SERVER_NAME}__request`;
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
MCP_SERVER_NAME,
|
|
9
|
+
REQUEST_TOOL
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-TGLKKLQG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/router/names.ts"],"sourcesContent":["/**\n * THE NAMES THE HARNESS KNOWS THE ROUTER BY, spelled once. `install` registers\n * the MCP server under {@link MCP_SERVER_NAME}, and Claude Code exposes its tool\n * as {@link REQUEST_TOOL}; the permission rule, the server's own name and every\n * hint line the hooks inject all read these, so a rename moves them together.\n *\n * A module of its own because the hooks need the tool name and must not load\n * `install` to get it: their chunk graph is the product's floor.\n */\nexport const MCP_SERVER_NAME = 'x402';\nexport const REQUEST_TOOL = `mcp__${MCP_SERVER_NAME}__request`;\n"],"mappings":";;;AASO,IAAM,kBAAkB;AACxB,IAAM,eAAe,QAAQ,eAAe;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
keccak_256
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KG3D7FIF.js";
|
|
5
5
|
|
|
6
6
|
// node_modules/.pnpm/abitype@1.2.3_typescript@6.0.3_zod@3.25.76/node_modules/abitype/dist/esm/version.js
|
|
7
7
|
var version = "1.2.3";
|
|
@@ -5630,7 +5630,7 @@ async function call(client, args) {
|
|
|
5630
5630
|
if (isAbortError(err))
|
|
5631
5631
|
throw err;
|
|
5632
5632
|
const data2 = getRevertErrorData(err);
|
|
5633
|
-
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-
|
|
5633
|
+
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-7RMRLAGV.js");
|
|
5634
5634
|
if (client.ccipRead !== false && data2?.slice(0, 10) === offchainLookupSignature2 && to)
|
|
5635
5635
|
return {
|
|
5636
5636
|
data: await offchainLookup2(client, { data: data2, requestOptions, to })
|
|
@@ -6196,4 +6196,4 @@ export {
|
|
|
6196
6196
|
ccipRequest,
|
|
6197
6197
|
call
|
|
6198
6198
|
};
|
|
6199
|
-
//# sourceMappingURL=chunk-
|
|
6199
|
+
//# sourceMappingURL=chunk-TTNESUPQ.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/lib/paths.ts
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { join, resolve } from "node:path";
|
|
6
|
+
function dataDir(env = process.env) {
|
|
7
|
+
const override = env.TENJIN_DATA_DIR;
|
|
8
|
+
if (override !== void 0 && override.length > 0) return resolve(override);
|
|
9
|
+
return defaultDataDir();
|
|
10
|
+
}
|
|
11
|
+
function defaultDataDir(home = homedir()) {
|
|
12
|
+
return join(home, ".tenjin");
|
|
13
|
+
}
|
|
14
|
+
function configPath(dir = dataDir()) {
|
|
15
|
+
return join(dir, "config.json");
|
|
16
|
+
}
|
|
17
|
+
function walletPath(dir = dataDir()) {
|
|
18
|
+
return join(dir, "wallet.json");
|
|
19
|
+
}
|
|
20
|
+
function installIdPath(dir = dataDir()) {
|
|
21
|
+
return join(dir, "install-id");
|
|
22
|
+
}
|
|
23
|
+
function sessionPath(dir = dataDir()) {
|
|
24
|
+
return join(dir, "session.json");
|
|
25
|
+
}
|
|
26
|
+
function spendLedgerPath(dir = dataDir()) {
|
|
27
|
+
return join(dir, "spend.json");
|
|
28
|
+
}
|
|
29
|
+
function updateCheckPath(dir = dataDir()) {
|
|
30
|
+
return join(dir, "update-check.json");
|
|
31
|
+
}
|
|
32
|
+
function hooksDir(dir = dataDir()) {
|
|
33
|
+
return join(dir, "hooks");
|
|
34
|
+
}
|
|
35
|
+
function hookHealthPath(dir = dataDir()) {
|
|
36
|
+
return join(dir, "hook-health.json");
|
|
37
|
+
}
|
|
38
|
+
function passphraseBlobPath(dir = dataDir()) {
|
|
39
|
+
return join(dir, "passphrase.dpapi");
|
|
40
|
+
}
|
|
41
|
+
function passphraseBlobPathFor(account, dir = dataDir()) {
|
|
42
|
+
return join(dir, `passphrase.${account}.dpapi`);
|
|
43
|
+
}
|
|
44
|
+
function archivedWalletPath(account, dir = dataDir()) {
|
|
45
|
+
return join(dir, `wallet.${account}.json.bak`);
|
|
46
|
+
}
|
|
47
|
+
function loopDbPath(dir = dataDir()) {
|
|
48
|
+
return join(dir, "loop.db");
|
|
49
|
+
}
|
|
50
|
+
function daemonTokenPath(dir = dataDir()) {
|
|
51
|
+
return join(dir, "daemon.token");
|
|
52
|
+
}
|
|
53
|
+
function daemonPidPath(dir = dataDir()) {
|
|
54
|
+
return join(dir, "daemon.pid");
|
|
55
|
+
}
|
|
56
|
+
function daemonLogPath(dir = dataDir()) {
|
|
57
|
+
return join(dir, "daemon.log");
|
|
58
|
+
}
|
|
59
|
+
function daemonSpawnPath(dir = dataDir()) {
|
|
60
|
+
return join(dir, "daemon.spawn");
|
|
61
|
+
}
|
|
62
|
+
function daemonBundlePath(dir = dataDir()) {
|
|
63
|
+
return join(hooksDir(dir), "tenjin-daemon.mjs");
|
|
64
|
+
}
|
|
65
|
+
function shimBundlePath(dir = dataDir()) {
|
|
66
|
+
return join(hooksDir(dir), "tenjin-shim.mjs");
|
|
67
|
+
}
|
|
68
|
+
var VITEST_REPORTER_FILE = "tenjin-vitest-reporter.mjs";
|
|
69
|
+
function vitestReporterPath(dir = dataDir()) {
|
|
70
|
+
return join(hooksDir(dir), VITEST_REPORTER_FILE);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
dataDir,
|
|
75
|
+
defaultDataDir,
|
|
76
|
+
configPath,
|
|
77
|
+
walletPath,
|
|
78
|
+
installIdPath,
|
|
79
|
+
sessionPath,
|
|
80
|
+
spendLedgerPath,
|
|
81
|
+
updateCheckPath,
|
|
82
|
+
hooksDir,
|
|
83
|
+
hookHealthPath,
|
|
84
|
+
passphraseBlobPath,
|
|
85
|
+
passphraseBlobPathFor,
|
|
86
|
+
archivedWalletPath,
|
|
87
|
+
loopDbPath,
|
|
88
|
+
daemonTokenPath,
|
|
89
|
+
daemonPidPath,
|
|
90
|
+
daemonLogPath,
|
|
91
|
+
daemonSpawnPath,
|
|
92
|
+
daemonBundlePath,
|
|
93
|
+
shimBundlePath,
|
|
94
|
+
VITEST_REPORTER_FILE,
|
|
95
|
+
vitestReporterPath
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=chunk-TU7XH3JJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/paths.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport { join, resolve } from 'node:path';\n\n/**\n * Where the CLI keeps its config and wallet. Defaults to ~/.tenjin, overridable\n * via TENJIN_DATA_DIR (CI, ephemeral agents, and every test — which point it at\n * a temp dir so the real home is never touched).\n */\nexport function dataDir(env: NodeJS.ProcessEnv = process.env): string {\n const override = env.TENJIN_DATA_DIR;\n // Absolute, always: the daemon compares this string against its own\n // `data_dir` and is spawned with it as `cwd`, so a relative override must\n // mean the same directory from every process.\n if (override !== undefined && override.length > 0) return resolve(override);\n return defaultDataDir();\n}\n\n/**\n * The data dir a run with no override resolves. Split out of {@link dataDir} so\n * a caller holding a home directory can ask whether some other profile IS the\n * default one, without a second copy of the `.tenjin` literal.\n */\nexport function defaultDataDir(home: string = homedir()): string {\n return join(home, '.tenjin');\n}\n\nexport function configPath(dir: string = dataDir()): string {\n return join(dir, 'config.json');\n}\n\nexport function walletPath(dir: string = dataDir()): string {\n return join(dir, 'wallet.json');\n}\n\n/**\n * The anonymous install id sent to Tenjin as `X-Tenjin-Install` (lib/install-identity).\n * Under the data dir so it survives upgrades and reinstalls of the CLI itself.\n */\nexport function installIdPath(dir: string = dataDir()): string {\n return join(dir, 'install-id');\n}\n\n/**\n * Where the delegated P-256 session key + its wallet-signed SIWX delegation are\n * cached (B3, D35). A short-lived (≤24h) hot key: lower stakes than wallet.json,\n * but still written 0600 and address-bound so a wallet change invalidates it.\n */\nexport function sessionPath(dir: string = dataDir()): string {\n return join(dir, 'session.json');\n}\n\n/**\n * Where the client-side rolling spend ledger lives (lib/wallet/spend.ts).\n *\n * Its own file, NOT session.json: the two schemas are incompatible and both\n * readers treat a parse failure as \"absent\", so a shared path meant each writer\n * silently destroyed the other's file — a session key wiped the spend window, and\n * the next spend wiped the session key.\n */\nexport function spendLedgerPath(dir: string = dataDir()): string {\n return join(dir, 'spend.json');\n}\n\n/**\n * Where the once-a-day \"a newer tenjin-cli exists\" check caches the registry\n * answer. A pure cache: nothing here is authoritative, so an unreadable file is\n * simply re-fetched.\n */\nexport function updateCheckPath(dir: string = dataDir()): string {\n return join(dir, 'update-check.json');\n}\n\n/**\n * Where `install` writes the standalone harness hook scripts. Under the data dir\n * rather than the harness's own config directory: the scripts are ours, a harness\n * only ever holds the path to them, and one location serves every harness.\n */\nexport function hooksDir(dir: string = dataDir()): string {\n return join(dir, 'hooks');\n}\n\n/**\n * How the marketplace has been answering the dispatch hook lately, so a run of\n * failures stops the arm instead of paying the fetch budget per subagent through\n * an outage. Hook-written, unlocked, and cheap to lose, since a missing file\n * reads as \"healthy\". Its own file because two hooks writing one unlocked file\n * would erase each other.\n */\nexport function hookHealthPath(dir: string = dataDir()): string {\n return join(dir, 'hook-health.json');\n}\n\n/**\n * Where the LEGACY (pre-per-wallet) Windows DPAPI passphrase blob lives. The\n * file holds a DPAPI CurrentUser ciphertext, not the passphrase in plaintext.\n * New writes go to the per-wallet path below; this one is only read as a\n * migration fallback and removed after a verified per-wallet copy exists.\n */\nexport function passphraseBlobPath(dir: string = dataDir()): string {\n return join(dir, 'passphrase.dpapi');\n}\n\n/**\n * The per-wallet Windows DPAPI passphrase blob: one file per wallet address\n * (lowercase), so creating a new wallet never clobbers an old wallet's blob.\n * Only ever written on win32; other platforms use their own OS store.\n */\nexport function passphraseBlobPathFor(account: string, dir: string = dataDir()): string {\n return join(dir, `passphrase.${account}.dpapi`);\n}\n\n/**\n * Where `wallet create --replace` parks the outgoing wallet's keystore, keyed by\n * its lowercase address so successive replaces can never collide. Together with\n * the wallet's per-address passphrase entry in the OS store, this file keeps the\n * replaced wallet's funds recoverable; it is never read by the active-wallet\n * path.\n */\nexport function archivedWalletPath(account: string, dir: string = dataDir()): string {\n return join(dir, `wallet.${account}.json.bak`);\n}\n\n/**\n * The loop daemon's own state, all under the data dir (tenjin-notes\n * loop-redesign/02-redesign.md §4, §10).\n */\nexport function loopDbPath(dir: string = dataDir()): string {\n return join(dir, 'loop.db');\n}\n\n/** 32 random bytes, hex, 0600. Minted by `tenjin daemon start`, rotated only by\n * reinstall, NEVER deleted by the daemon: every transport reads it, and an idle\n * exit that removed it would strand them all. */\nexport function daemonTokenPath(dir: string = dataDir()): string {\n return join(dir, 'daemon.token');\n}\n\n/** `{ pid, port, started_at, data_dir }`, advisory: written after the bind,\n * removed at exit only by the process whose pid it names. Liveness is\n * `GET /health`, never this file alone. */\nexport function daemonPidPath(dir: string = dataDir()): string {\n return join(dir, 'daemon.pid');\n}\n\n/** Where a detached daemon's stdout and stderr go, and where the shim writes its\n * one `daemon-down` line when it cannot reach one. */\nexport function daemonLogPath(dir: string = dataDir()): string {\n return join(dir, 'daemon.log');\n}\n\n/** An empty file whose mtime is the last spawn attempt; the shim's backoff. */\nexport function daemonSpawnPath(dir: string = dataDir()): string {\n return join(dir, 'daemon.spawn');\n}\n\n/** The single-file daemon bundle `tenjin daemon start` copies from `dist`. */\nexport function daemonBundlePath(dir: string = dataDir()): string {\n return join(hooksDir(dir), 'tenjin-daemon.mjs');\n}\n\n/** The ensure-and-forward shim the two `command` hook entries run. */\nexport function shimBundlePath(dir: string = dataDir()): string {\n return join(hooksDir(dir), 'tenjin-shim.mjs');\n}\n\n/** Tenjin's own vitest reporter, copied beside the bundles. NOT A HOOK ENTRY\n * and never spawned: a repo's own `vitest.config.ts` imports it by this\n * absolute path, which is why `doctor` can hint at it verbatim. */\nexport const VITEST_REPORTER_FILE = 'tenjin-vitest-reporter.mjs';\n\nexport function vitestReporterPath(dir: string = dataDir()): string {\n return join(hooksDir(dir), VITEST_REPORTER_FILE);\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AAOvB,SAAS,QAAQ,MAAyB,QAAQ,KAAa;AACpE,QAAM,WAAW,IAAI;AAIrB,MAAI,aAAa,UAAa,SAAS,SAAS,EAAG,QAAO,QAAQ,QAAQ;AAC1E,SAAO,eAAe;AACxB;AAOO,SAAS,eAAe,OAAe,QAAQ,GAAW;AAC/D,SAAO,KAAK,MAAM,SAAS;AAC7B;AAEO,SAAS,WAAW,MAAc,QAAQ,GAAW;AAC1D,SAAO,KAAK,KAAK,aAAa;AAChC;AAEO,SAAS,WAAW,MAAc,QAAQ,GAAW;AAC1D,SAAO,KAAK,KAAK,aAAa;AAChC;AAMO,SAAS,cAAc,MAAc,QAAQ,GAAW;AAC7D,SAAO,KAAK,KAAK,YAAY;AAC/B;AAOO,SAAS,YAAY,MAAc,QAAQ,GAAW;AAC3D,SAAO,KAAK,KAAK,cAAc;AACjC;AAUO,SAAS,gBAAgB,MAAc,QAAQ,GAAW;AAC/D,SAAO,KAAK,KAAK,YAAY;AAC/B;AAOO,SAAS,gBAAgB,MAAc,QAAQ,GAAW;AAC/D,SAAO,KAAK,KAAK,mBAAmB;AACtC;AAOO,SAAS,SAAS,MAAc,QAAQ,GAAW;AACxD,SAAO,KAAK,KAAK,OAAO;AAC1B;AASO,SAAS,eAAe,MAAc,QAAQ,GAAW;AAC9D,SAAO,KAAK,KAAK,kBAAkB;AACrC;AAQO,SAAS,mBAAmB,MAAc,QAAQ,GAAW;AAClE,SAAO,KAAK,KAAK,kBAAkB;AACrC;AAOO,SAAS,sBAAsB,SAAiB,MAAc,QAAQ,GAAW;AACtF,SAAO,KAAK,KAAK,cAAc,OAAO,QAAQ;AAChD;AASO,SAAS,mBAAmB,SAAiB,MAAc,QAAQ,GAAW;AACnF,SAAO,KAAK,KAAK,UAAU,OAAO,WAAW;AAC/C;AAMO,SAAS,WAAW,MAAc,QAAQ,GAAW;AAC1D,SAAO,KAAK,KAAK,SAAS;AAC5B;AAKO,SAAS,gBAAgB,MAAc,QAAQ,GAAW;AAC/D,SAAO,KAAK,KAAK,cAAc;AACjC;AAKO,SAAS,cAAc,MAAc,QAAQ,GAAW;AAC7D,SAAO,KAAK,KAAK,YAAY;AAC/B;AAIO,SAAS,cAAc,MAAc,QAAQ,GAAW;AAC7D,SAAO,KAAK,KAAK,YAAY;AAC/B;AAGO,SAAS,gBAAgB,MAAc,QAAQ,GAAW;AAC/D,SAAO,KAAK,KAAK,cAAc;AACjC;AAGO,SAAS,iBAAiB,MAAc,QAAQ,GAAW;AAChE,SAAO,KAAK,SAAS,GAAG,GAAG,mBAAmB;AAChD;AAGO,SAAS,eAAe,MAAc,QAAQ,GAAW;AAC9D,SAAO,KAAK,SAAS,GAAG,GAAG,iBAAiB;AAC9C;AAKO,IAAM,uBAAuB;AAE7B,SAAS,mBAAmB,MAAc,QAAQ,GAAW;AAClE,SAAO,KAAK,SAAS,GAAG,GAAG,oBAAoB;AACjD;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
keccak_256
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KG3D7FIF.js";
|
|
5
5
|
import {
|
|
6
6
|
bytesToHex
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BPMWXTFX.js";
|
|
8
8
|
import {
|
|
9
9
|
__commonJS,
|
|
10
10
|
__require,
|
|
@@ -7803,4 +7803,4 @@ export {
|
|
|
7803
7803
|
p2 as p,
|
|
7804
7804
|
m2 as m
|
|
7805
7805
|
};
|
|
7806
|
-
//# sourceMappingURL=chunk-
|
|
7806
|
+
//# sourceMappingURL=chunk-XZKD7DIF.js.map
|