@claudexor/core 1.0.1 → 2.1.2
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/dist/adapter.d.ts +14 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/answer-assembly.d.ts +22 -0
- package/dist/answer-assembly.d.ts.map +1 -0
- package/dist/answer-assembly.js +55 -0
- package/dist/answer-assembly.js.map +1 -0
- package/dist/attachment-integrity.d.ts +4 -0
- package/dist/attachment-integrity.d.ts.map +1 -0
- package/dist/attachment-integrity.js +12 -0
- package/dist/attachment-integrity.js.map +1 -0
- package/dist/auth-capability-verifier.d.ts +42 -0
- package/dist/auth-capability-verifier.d.ts.map +1 -0
- package/dist/auth-capability-verifier.js +417 -0
- package/dist/auth-capability-verifier.js.map +1 -0
- package/dist/auth-readiness.d.ts +24 -0
- package/dist/auth-readiness.d.ts.map +1 -0
- package/dist/auth-readiness.js +34 -0
- package/dist/auth-readiness.js.map +1 -0
- package/dist/browser-mcp-launcher.d.ts +3 -0
- package/dist/browser-mcp-launcher.d.ts.map +1 -0
- package/dist/browser-mcp-launcher.js +18 -0
- package/dist/browser-mcp-launcher.js.map +1 -0
- package/dist/browser-mcp.d.ts +10 -16
- package/dist/browser-mcp.d.ts.map +1 -1
- package/dist/browser-mcp.js +20 -23
- package/dist/browser-mcp.js.map +1 -1
- package/dist/capabilities.d.ts +0 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +0 -3
- package/dist/capabilities.js.map +1 -1
- package/dist/conformance.d.ts +43 -0
- package/dist/conformance.d.ts.map +1 -1
- package/dist/conformance.js +67 -1
- package/dist/conformance.js.map +1 -1
- package/dist/diff.d.ts +9 -0
- package/dist/diff.d.ts.map +1 -1
- package/dist/diff.js +18 -3
- package/dist/diff.js.map +1 -1
- package/dist/doctor.d.ts +13 -2
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +88 -9
- package/dist/doctor.js.map +1 -1
- package/dist/effort.d.ts.map +1 -1
- package/dist/effort.js +2 -1
- package/dist/effort.js.map +1 -1
- package/dist/env-scope.d.ts.map +1 -1
- package/dist/env-scope.js +15 -0
- package/dist/env-scope.js.map +1 -1
- package/dist/executable-inspection.d.ts +52 -0
- package/dist/executable-inspection.d.ts.map +1 -0
- package/dist/executable-inspection.js +83 -0
- package/dist/executable-inspection.js.map +1 -0
- package/dist/inactivity.d.ts.map +1 -1
- package/dist/inactivity.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +10 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +14 -0
- package/dist/instructions.js.map +1 -0
- package/dist/isolation-locator.d.ts +21 -0
- package/dist/isolation-locator.d.ts.map +1 -0
- package/dist/isolation-locator.js +55 -0
- package/dist/isolation-locator.js.map +1 -0
- package/dist/native/claudexor-process-identity +0 -0
- package/dist/proc.d.ts +32 -0
- package/dist/proc.d.ts.map +1 -1
- package/dist/proc.js +50 -0
- package/dist/proc.js.map +1 -1
- package/dist/process-group.d.ts +67 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +107 -0
- package/dist/process-group.js.map +1 -0
- package/dist/process-identity.d.ts +65 -0
- package/dist/process-identity.d.ts.map +1 -0
- package/dist/process-identity.js +209 -0
- package/dist/process-identity.js.map +1 -0
- package/dist/process-registry.d.ts +17 -5
- package/dist/process-registry.d.ts.map +1 -1
- package/dist/process-registry.js +8 -3
- package/dist/process-registry.js.map +1 -1
- package/dist/runloop.d.ts.map +1 -1
- package/dist/runloop.js +1 -0
- package/dist/runloop.js.map +1 -1
- package/dist/runtime-env.d.ts +8 -0
- package/dist/runtime-env.d.ts.map +1 -1
- package/dist/runtime-env.js +48 -4
- package/dist/runtime-env.js.map +1 -1
- package/package.json +9 -3
package/dist/doctor.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { redactSecrets } from "@claudexor/util";
|
|
2
3
|
/**
|
|
3
4
|
* Short-lived doctor cache. Real-harness `doctor()` is expensive (version probe,
|
|
4
5
|
* native-auth check, and — for the api-key route — a paid isolated smoke), and
|
|
@@ -10,15 +11,58 @@ import { createHash } from "node:crypto";
|
|
|
10
11
|
const DOCTOR_TTL_MS = Number(process.env.CLAUDEXOR_DOCTOR_TTL_MS ?? 90_000);
|
|
11
12
|
/**
|
|
12
13
|
* Non-OK results age out much faster: an out-of-band `codex login` /
|
|
13
|
-
* `claude
|
|
14
|
+
* `claude auth login --claudeai` (which Claudexor cannot observe to invalidate) should become
|
|
14
15
|
* routable within seconds, not a full TTL. OK results keep the long TTL since
|
|
15
16
|
* readiness rarely degrades spontaneously and re-probing it is what costs money.
|
|
16
17
|
*/
|
|
17
18
|
const DOCTOR_NON_OK_TTL_MS = Number(process.env.CLAUDEXOR_DOCTOR_NON_OK_TTL_MS ?? 15_000);
|
|
18
19
|
const doctorCache = new Map();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
let globalCacheGeneration = 0;
|
|
21
|
+
const adapterCacheGenerations = new Map();
|
|
22
|
+
const cwdCacheGenerations = new Map();
|
|
23
|
+
const adapterCwdCacheGenerations = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* Invalidate derived doctor evidence after auth/secrets/settings mutations.
|
|
26
|
+
* No scope preserves the historical whole-cache behavior. A scope removes
|
|
27
|
+
* only entries whose structured dimensions match, so a Claude login cannot
|
|
28
|
+
* evict an unrelated Codex API-key smoke (or vice versa).
|
|
29
|
+
*/
|
|
30
|
+
export function invalidateDoctorCache(scope) {
|
|
31
|
+
if (!scope || (scope.adapterId === undefined && scope.cwd === undefined)) {
|
|
32
|
+
doctorCache.clear();
|
|
33
|
+
globalCacheGeneration += 1;
|
|
34
|
+
adapterCacheGenerations.clear();
|
|
35
|
+
cwdCacheGenerations.clear();
|
|
36
|
+
adapterCwdCacheGenerations.clear();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (scope.adapterId !== undefined && scope.cwd !== undefined) {
|
|
40
|
+
incrementGeneration(adapterCwdCacheGenerations, `${scope.adapterId}\0${scope.cwd}`);
|
|
41
|
+
}
|
|
42
|
+
else if (scope.adapterId !== undefined) {
|
|
43
|
+
incrementGeneration(adapterCacheGenerations, scope.adapterId);
|
|
44
|
+
}
|
|
45
|
+
else if (scope.cwd !== undefined) {
|
|
46
|
+
incrementGeneration(cwdCacheGenerations, scope.cwd);
|
|
47
|
+
}
|
|
48
|
+
for (const [key, entry] of doctorCache) {
|
|
49
|
+
if (scope.adapterId !== undefined && entry.adapterId !== scope.adapterId)
|
|
50
|
+
continue;
|
|
51
|
+
if (scope.cwd !== undefined && entry.cwd !== scope.cwd)
|
|
52
|
+
continue;
|
|
53
|
+
doctorCache.delete(key);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function incrementGeneration(generations, key) {
|
|
57
|
+
generations.set(key, (generations.get(key) ?? 0) + 1);
|
|
58
|
+
}
|
|
59
|
+
function cacheGeneration(adapterId, cwd) {
|
|
60
|
+
return [
|
|
61
|
+
globalCacheGeneration,
|
|
62
|
+
adapterCacheGenerations.get(adapterId) ?? 0,
|
|
63
|
+
cwdCacheGenerations.get(cwd) ?? 0,
|
|
64
|
+
adapterCwdCacheGenerations.get(`${adapterId}\0${cwd}`) ?? 0,
|
|
65
|
+
].join(":");
|
|
22
66
|
}
|
|
23
67
|
function doctorCacheKey(adapterId, spec) {
|
|
24
68
|
// The key covers EVERY spec field that can change a probe's outcome: cwd,
|
|
@@ -33,7 +77,7 @@ function doctorCacheKey(adapterId, spec) {
|
|
|
33
77
|
.digest("hex")
|
|
34
78
|
.slice(0, 16)
|
|
35
79
|
: "";
|
|
36
|
-
return `${adapterId}::${spec.cwd ?? ""}::${spec.authPreference ?? ""}::${envDigest}`;
|
|
80
|
+
return `${adapterId}::${spec.cwd ?? ""}::${spec.authPreference ?? ""}::${spec.authSource ?? ""}::${envDigest}`;
|
|
37
81
|
}
|
|
38
82
|
/** Run conformance probes across all registered adapters; never throws. */
|
|
39
83
|
export async function runDoctor(adapters, spec) {
|
|
@@ -42,7 +86,18 @@ export async function runDoctor(adapters, spec) {
|
|
|
42
86
|
for (const adapter of adapters.values()) {
|
|
43
87
|
// Fakes are cheap + deterministic and are reconfigured per test — never cache
|
|
44
88
|
// them (avoids cross-test contamination); only real adapters benefit.
|
|
45
|
-
|
|
89
|
+
// A caller asking for fresh evidence must neither read nor seed shared
|
|
90
|
+
// cache state. This keeps an explicit post-login probe isolated from the
|
|
91
|
+
// normal routing cache and avoids clearing useful reports for other specs.
|
|
92
|
+
const cacheable = DOCTOR_TTL_MS > 0 &&
|
|
93
|
+
!adapter.id.startsWith("fake") &&
|
|
94
|
+
spec.fresh !== true &&
|
|
95
|
+
spec.abortSignal === undefined;
|
|
96
|
+
const cwd = spec.cwd ?? "";
|
|
97
|
+
// Capture the invalidation generation before the asynchronous probe. If
|
|
98
|
+
// auth/settings change while it is in flight, its result may still be
|
|
99
|
+
// returned to the original caller but must never repopulate shared cache.
|
|
100
|
+
const generation = cacheGeneration(adapter.id, cwd);
|
|
46
101
|
const key = doctorCacheKey(adapter.id, spec);
|
|
47
102
|
if (cacheable) {
|
|
48
103
|
const hit = doctorCache.get(key);
|
|
@@ -57,17 +112,41 @@ export async function runDoctor(adapters, spec) {
|
|
|
57
112
|
report = await adapter.doctor(spec);
|
|
58
113
|
}
|
|
59
114
|
catch (err) {
|
|
115
|
+
// Adapter errors are projected into successful doctor/readiness DTOs, so
|
|
116
|
+
// they bypass the control-api problem redactor. Sanitize at this producer
|
|
117
|
+
// boundary before the message can enter reasons, cache state, or exact
|
|
118
|
+
// auth-source evidence.
|
|
119
|
+
const detail = redactSecrets(err instanceof Error ? err.message : String(err));
|
|
60
120
|
report = {
|
|
61
121
|
harness_id: adapter.id,
|
|
62
122
|
status: "unavailable",
|
|
63
123
|
checks: [],
|
|
64
124
|
enabled_intents: [],
|
|
65
125
|
disabled_intents: [],
|
|
66
|
-
reasons: [
|
|
126
|
+
reasons: [detail],
|
|
127
|
+
// An exact source probe that failed is UNKNOWN, not evidence that the
|
|
128
|
+
// source is absent. Preserve the requested identity so callers never
|
|
129
|
+
// have to collapse "probe failed" into null/unsupported.
|
|
130
|
+
auth_sources: spec.authSource === undefined
|
|
131
|
+
? []
|
|
132
|
+
: [
|
|
133
|
+
{
|
|
134
|
+
source: spec.authSource,
|
|
135
|
+
availability: "unknown",
|
|
136
|
+
verification: "not_run",
|
|
137
|
+
detail,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
67
140
|
};
|
|
68
141
|
}
|
|
69
|
-
if (cacheable)
|
|
70
|
-
doctorCache.set(key, {
|
|
142
|
+
if (cacheable && generation === cacheGeneration(adapter.id, cwd)) {
|
|
143
|
+
doctorCache.set(key, {
|
|
144
|
+
adapterId: adapter.id,
|
|
145
|
+
cwd,
|
|
146
|
+
report,
|
|
147
|
+
at: now,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
71
150
|
reports.push(report);
|
|
72
151
|
}
|
|
73
152
|
return reports;
|
package/dist/doctor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,MAAM,CAAC,CAAC;AAC5E;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,MAA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aACR,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/effort.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effort.d.ts","sourceRoot":"","sources":["../src/effort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBpD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACxC,SAAS,EAAE,SAAS,UAAU,EAAE,GAC/B,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"effort.d.ts","sourceRoot":"","sources":["../src/effort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBpD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACxC,SAAS,EAAE,SAAS,UAAU,EAAE,GAC/B,UAAU,GAAG,IAAI,CAoBnB"}
|
package/dist/effort.js
CHANGED
|
@@ -39,7 +39,8 @@ export function normalizeEffort(requested, supported) {
|
|
|
39
39
|
for (const level of supported) {
|
|
40
40
|
const distance = Math.abs(rank(level) - want);
|
|
41
41
|
// Strictly-closer wins; on a tie keep the LOWER-ranked (cheaper) candidate.
|
|
42
|
-
if (distance < bestDistance ||
|
|
42
|
+
if (distance < bestDistance ||
|
|
43
|
+
(distance === bestDistance && best !== null && rank(level) < rank(best))) {
|
|
43
44
|
best = level;
|
|
44
45
|
bestDistance = distance;
|
|
45
46
|
}
|
package/dist/effort.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effort.js","sourceRoot":"","sources":["../src/effort.ts"],"names":[],"mappings":"AACA,OAAO,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,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC/D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IAEpD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7B,IAAI,IAAI,GAAsB,IAAI,CAAC;IACnC,IAAI,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAC5C,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9C,4EAA4E;QAC5E,IACE,QAAQ,GAAG,YAAY;YACvB,CAAC,QAAQ,KAAK,YAAY,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EACxE,CAAC;YACD,IAAI,GAAG,KAAK,CAAC;YACb,YAAY,GAAG,QAAQ,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/env-scope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-scope.d.ts","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"env-scope.d.ts","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EA4DhD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAOnF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAoChD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,eAAe,GAAG,OAAO,EACtC,MAAM,GAAE,MAAM,CAAC,UAAwB,GACtC,MAAM,CAAC,UAAU,CASnB"}
|
package/dist/env-scope.js
CHANGED
|
@@ -22,6 +22,7 @@ export const PROVIDER_SECRET_ENV = [
|
|
|
22
22
|
"OPENAI_PROJECT_ID",
|
|
23
23
|
"OPENAI_BASE_URL",
|
|
24
24
|
"CODEX_API_KEY",
|
|
25
|
+
"CODEX_ACCESS_TOKEN",
|
|
25
26
|
"CLAUDEXOR_CODEX_API_KEY",
|
|
26
27
|
// Anthropic / Claude
|
|
27
28
|
"ANTHROPIC_API_KEY",
|
|
@@ -31,8 +32,13 @@ export const PROVIDER_SECRET_ENV = [
|
|
|
31
32
|
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
32
33
|
"CLAUDE_CODE_USE_BEDROCK",
|
|
33
34
|
"CLAUDE_CODE_USE_VERTEX",
|
|
35
|
+
"CLAUDE_CODE_USE_FOUNDRY",
|
|
34
36
|
"ANTHROPIC_BEDROCK_BASE_URL",
|
|
35
37
|
"ANTHROPIC_VERTEX_PROJECT_ID",
|
|
38
|
+
"ANTHROPIC_FOUNDRY_API_KEY",
|
|
39
|
+
"ANTHROPIC_FOUNDRY_AUTH_TOKEN",
|
|
40
|
+
"ANTHROPIC_FOUNDRY_RESOURCE",
|
|
41
|
+
"ANTHROPIC_FOUNDRY_BASE_URL",
|
|
36
42
|
"CLAUDEXOR_ANTHROPIC_API_KEY",
|
|
37
43
|
// Cloud provider creds reachable by Bedrock/Vertex routing
|
|
38
44
|
"AWS_ACCESS_KEY_ID",
|
|
@@ -40,6 +46,15 @@ export const PROVIDER_SECRET_ENV = [
|
|
|
40
46
|
"AWS_SESSION_TOKEN",
|
|
41
47
|
"AWS_PROFILE",
|
|
42
48
|
"GOOGLE_APPLICATION_CREDENTIALS",
|
|
49
|
+
// Azure credentials and route selectors reachable by Foundry auth.
|
|
50
|
+
"AZURE_CLIENT_ID",
|
|
51
|
+
"AZURE_CLIENT_SECRET",
|
|
52
|
+
"AZURE_TENANT_ID",
|
|
53
|
+
"AZURE_SUBSCRIPTION_ID",
|
|
54
|
+
"AZURE_FEDERATED_TOKEN_FILE",
|
|
55
|
+
"AZURE_AUTHORITY_HOST",
|
|
56
|
+
"AZURE_TOKEN_CREDENTIALS",
|
|
57
|
+
"AZURE_CONFIG_DIR",
|
|
43
58
|
// Google / Gemini, xAI, OpenRouter, Cursor, OpenCode
|
|
44
59
|
"GEMINI_API_KEY",
|
|
45
60
|
"GOOGLE_API_KEY",
|
package/dist/env-scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-scope.js","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,yBAAyB;IACzB,qBAAqB;IACrB,mBAAmB;IACnB,sBAAsB;IACtB,oBAAoB;IACpB,gBAAgB;IAChB,yBAAyB;IACzB,yBAAyB;IACzB,wBAAwB;IACxB,4BAA4B;IAC5B,6BAA6B;IAC7B,6BAA6B;IAC7B,2DAA2D;IAC3D,mBAAmB;IACnB,uBAAuB;IACvB,mBAAmB;IACnB,aAAa;IACb,gCAAgC;IAChC,qDAAqD;IACrD,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACpB,qBAAqB;IACrB,gBAAgB;IAChB,0BAA0B;IA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AAG,GAAsB,EAAE,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
1
|
+
{"version":3,"file":"env-scope.js","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;IACrB,mBAAmB;IACnB,sBAAsB;IACtB,oBAAoB;IACpB,gBAAgB;IAChB,yBAAyB;IACzB,yBAAyB;IACzB,wBAAwB;IACxB,yBAAyB;IACzB,4BAA4B;IAC5B,6BAA6B;IAC7B,2BAA2B;IAC3B,8BAA8B;IAC9B,4BAA4B;IAC5B,4BAA4B;IAC5B,6BAA6B;IAC7B,2DAA2D;IAC3D,mBAAmB;IACnB,uBAAuB;IACvB,mBAAmB;IACnB,aAAa;IACb,gCAAgC;IAChC,mEAAmE;IACnE,iBAAiB;IACjB,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,4BAA4B;IAC5B,sBAAsB;IACtB,yBAAyB;IACzB,kBAAkB;IAClB,qDAAqD;IACrD,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACpB,qBAAqB;IACrB,gBAAgB;IAChB,0BAA0B;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,oCAAoC;IACpC,sBAAsB;IACtB,2BAA2B;IAC3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ACtC,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable facts about the exact bytes at an executable path — the SINGLE
|
|
3
|
+
* producer of executable facts shared by the harness PATH resolver and the
|
|
4
|
+
* setup-login evidence gate, so the two surfaces can never disagree about the
|
|
5
|
+
* same file (the parity break that made setup-login reject a binary Doctor and
|
|
6
|
+
* runs accepted).
|
|
7
|
+
*
|
|
8
|
+
* `nlink` is captured as a FACT, never an inline rejection here: link-count
|
|
9
|
+
* policy is scoped to the file's owner/type by the CALLER. Daemon-owned MUTABLE
|
|
10
|
+
* files (journal, token, locks) legitimately require `nlink === 1` at their own
|
|
11
|
+
* call-sites — a second hard link there means the private file is not
|
|
12
|
+
* exclusively owned. An external, read-only vendor binary is a different case:
|
|
13
|
+
* the official installer hard-links the platform binary into its launcher
|
|
14
|
+
* (`@anthropic-ai/claude-code` → `nlink === 2`), so for a binary Claudexor never
|
|
15
|
+
* writes, `dev`/`inode`/`sha256` already prove which exact bytes will run and
|
|
16
|
+
* the link count is irrelevant.
|
|
17
|
+
*/
|
|
18
|
+
export interface ExecutableInspection {
|
|
19
|
+
/** realpath-resolved canonical path (all symlinks followed). */
|
|
20
|
+
realpath: string;
|
|
21
|
+
isRegularFile: boolean;
|
|
22
|
+
/** Any exec bit set (POSIX mode & 0o111). Advisory on win32. */
|
|
23
|
+
isExecutable: boolean;
|
|
24
|
+
size: number;
|
|
25
|
+
/** mode & 0o7777. */
|
|
26
|
+
mode: number;
|
|
27
|
+
device: string;
|
|
28
|
+
inode: string;
|
|
29
|
+
nlink: number;
|
|
30
|
+
/** The opened inode still matches the named canonical file and it is not a
|
|
31
|
+
* symlink — no swap raced between open and stat. */
|
|
32
|
+
identityStable: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Safely open the realpath-resolved canonical file (O_NOFOLLOW so a swapped
|
|
36
|
+
* symlink can't redirect us; O_NONBLOCK so a FIFO on PATH cannot block the
|
|
37
|
+
* open), capture its facts, and hand the SAME fd to `fn` so a content read is
|
|
38
|
+
* byte-faithful to the exact inode we identity-checked (no TOCTOU between the
|
|
39
|
+
* check and the read).
|
|
40
|
+
*/
|
|
41
|
+
export declare function withExecutableInspection<T>(path: string, fn: (info: ExecutableInspection, fd: number) => T): T;
|
|
42
|
+
/** Facts only (fd closed before returning). */
|
|
43
|
+
export declare function inspectExecutable(path: string): ExecutableInspection;
|
|
44
|
+
/** True when the inspection describes a real, bounded regular file. */
|
|
45
|
+
export declare function isBoundedRegularExecutable(info: ExecutableInspection): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Cheap "the process can spawn this" verdict for the harness PATH resolver: a
|
|
48
|
+
* bounded regular file the current user may execute. No content hash. Returns
|
|
49
|
+
* false on any inspection error (dangling symlink, permission, mid-walk race).
|
|
50
|
+
*/
|
|
51
|
+
export declare function isLaunchableExecutable(path: string): boolean;
|
|
52
|
+
//# sourceMappingURL=executable-inspection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable-inspection.d.ts","sourceRoot":"","sources":["../src/executable-inspection.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,gEAAgE;IAChE,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;yDACqD;IACrD,cAAc,EAAE,OAAO,CAAC;CACzB;AASD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,oBAAoB,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC,GAChD,CAAC,CAuBH;AAED,+CAA+C;AAC/C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAEpE;AAED,uEAAuE;AACvE,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAI9E;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAuB5D"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { accessSync, closeSync, constants, fstatSync, lstatSync, openSync, realpathSync, statSync, } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
// O_NOFOLLOW/O_NONBLOCK are POSIX-only; on win32 they are undefined and must
|
|
4
|
+
// degrade to a no-op (0) or the OR would produce NaN and every open would fail
|
|
5
|
+
// — which would make the resolver find no binaries on Windows.
|
|
6
|
+
const O_NOFOLLOW = constants.O_NOFOLLOW ?? 0;
|
|
7
|
+
const O_NONBLOCK = constants.O_NONBLOCK ?? 0;
|
|
8
|
+
const MAX_EXECUTABLE_BYTES = 1024 * 1024 * 1024; // 1 GiB
|
|
9
|
+
/**
|
|
10
|
+
* Safely open the realpath-resolved canonical file (O_NOFOLLOW so a swapped
|
|
11
|
+
* symlink can't redirect us; O_NONBLOCK so a FIFO on PATH cannot block the
|
|
12
|
+
* open), capture its facts, and hand the SAME fd to `fn` so a content read is
|
|
13
|
+
* byte-faithful to the exact inode we identity-checked (no TOCTOU between the
|
|
14
|
+
* check and the read).
|
|
15
|
+
*/
|
|
16
|
+
export function withExecutableInspection(path, fn) {
|
|
17
|
+
const canonical = realpathSync(resolve(path));
|
|
18
|
+
const fd = openSync(canonical, constants.O_RDONLY | O_NOFOLLOW | O_NONBLOCK);
|
|
19
|
+
try {
|
|
20
|
+
const stat = fstatSync(fd, { bigint: true });
|
|
21
|
+
const named = lstatSync(canonical, { bigint: true });
|
|
22
|
+
const identityStable = !named.isSymbolicLink() && named.isFile() && named.dev === stat.dev && named.ino === stat.ino;
|
|
23
|
+
const info = {
|
|
24
|
+
realpath: canonical,
|
|
25
|
+
isRegularFile: stat.isFile(),
|
|
26
|
+
isExecutable: (stat.mode & 73n) !== 0n,
|
|
27
|
+
size: Number(stat.size),
|
|
28
|
+
mode: Number(stat.mode & 4095n),
|
|
29
|
+
device: String(stat.dev),
|
|
30
|
+
inode: String(stat.ino),
|
|
31
|
+
nlink: Number(stat.nlink),
|
|
32
|
+
identityStable,
|
|
33
|
+
};
|
|
34
|
+
return fn(info, fd);
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
closeSync(fd);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Facts only (fd closed before returning). */
|
|
41
|
+
export function inspectExecutable(path) {
|
|
42
|
+
return withExecutableInspection(path, (info) => info);
|
|
43
|
+
}
|
|
44
|
+
/** True when the inspection describes a real, bounded regular file. */
|
|
45
|
+
export function isBoundedRegularExecutable(info) {
|
|
46
|
+
return (info.isRegularFile && info.identityStable && info.size >= 0 && info.size <= MAX_EXECUTABLE_BYTES);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Cheap "the process can spawn this" verdict for the harness PATH resolver: a
|
|
50
|
+
* bounded regular file the current user may execute. No content hash. Returns
|
|
51
|
+
* false on any inspection error (dangling symlink, permission, mid-walk race).
|
|
52
|
+
*/
|
|
53
|
+
export function isLaunchableExecutable(path) {
|
|
54
|
+
try {
|
|
55
|
+
const info = inspectExecutable(path);
|
|
56
|
+
if (!info.isRegularFile || !info.identityStable)
|
|
57
|
+
return false;
|
|
58
|
+
if (process.platform !== "win32")
|
|
59
|
+
accessSync(info.realpath, constants.X_OK);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
// An exec-only binary (mode 0o111, not readable) cannot be O_RDONLY-opened
|
|
64
|
+
// by inspectExecutable, but the old resolver accepted it — execution does
|
|
65
|
+
// not require read. Fall back to the classic spawn-faithful probe (a
|
|
66
|
+
// regular file the process may execute) so resolution behavior is unchanged.
|
|
67
|
+
if (err?.code === "EACCES") {
|
|
68
|
+
try {
|
|
69
|
+
const real = realpathSync(resolve(path));
|
|
70
|
+
if (!statSync(real).isFile())
|
|
71
|
+
return false;
|
|
72
|
+
if (process.platform !== "win32")
|
|
73
|
+
accessSync(real, constants.X_OK);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=executable-inspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable-inspection.js","sourceRoot":"","sources":["../src/executable-inspection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC,6EAA6E;AAC7E,+EAA+E;AAC/E,+DAA+D;AAC/D,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC;AAC7C,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC;AAC7C,MAAM,oBAAoB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAEzD;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAY,EACZ,EAAiD;IAEjD,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,I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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inactivity.d.ts","sourceRoot":"","sources":["../src/inactivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM;gBAAjB,SAAS,EAAE,MAAM;CAQvC;AAED,wBAAuB,sBAAsB,CAAC,CAAC,EAC7C,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;CAC7B,GACA,aAAa,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"inactivity.d.ts","sourceRoot":"","sources":["../src/inactivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM;gBAAjB,SAAS,EAAE,MAAM;CAQvC;AAED,wBAAuB,sBAAsB,CAAC,CAAC,EAC7C,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;CAC7B,GACA,aAAa,CAAC,CAAC,CAAC,CAiDlB"}
|
package/dist/inactivity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inactivity.js","sourceRoot":"","sources":["../src/inactivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACjC;IAArB,YAAqB,SAAiB;QACpC,KAAK,CACH,kCAAkC,S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CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./errors.js";
|
|
2
2
|
export * from "./adapter.js";
|
|
3
|
+
export * from "./attachment-integrity.js";
|
|
3
4
|
export * from "./effort.js";
|
|
4
5
|
export * from "./model.js";
|
|
5
6
|
export * from "./proc.js";
|
|
@@ -10,7 +11,15 @@ export * from "./diff.js";
|
|
|
10
11
|
export * from "./conformance.js";
|
|
11
12
|
export * from "./capabilities.js";
|
|
12
13
|
export * from "./doctor.js";
|
|
14
|
+
export * from "./answer-assembly.js";
|
|
15
|
+
export * from "./auth-readiness.js";
|
|
16
|
+
export * from "./auth-capability-verifier.js";
|
|
13
17
|
export * from "./env-scope.js";
|
|
14
18
|
export * from "./runtime-env.js";
|
|
19
|
+
export * from "./executable-inspection.js";
|
|
20
|
+
export * from "./instructions.js";
|
|
15
21
|
export * from "./browser-mcp.js";
|
|
22
|
+
export * from "./process-identity.js";
|
|
23
|
+
export * from "./process-group.js";
|
|
24
|
+
export * from "./isolation-locator.js";
|
|
16
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./errors.js";
|
|
2
2
|
export * from "./adapter.js";
|
|
3
|
+
export * from "./attachment-integrity.js";
|
|
3
4
|
export * from "./effort.js";
|
|
4
5
|
export * from "./model.js";
|
|
5
6
|
export * from "./proc.js";
|
|
@@ -10,7 +11,15 @@ export * from "./diff.js";
|
|
|
10
11
|
export * from "./conformance.js";
|
|
11
12
|
export * from "./capabilities.js";
|
|
12
13
|
export * from "./doctor.js";
|
|
14
|
+
export * from "./answer-assembly.js";
|
|
15
|
+
export * from "./auth-readiness.js";
|
|
16
|
+
export * from "./auth-capability-verifier.js";
|
|
13
17
|
export * from "./env-scope.js";
|
|
14
18
|
export * from "./runtime-env.js";
|
|
19
|
+
export * from "./executable-inspection.js";
|
|
20
|
+
export * from "./instructions.js";
|
|
15
21
|
export * from "./browser-mcp.js";
|
|
22
|
+
export * from "./process-identity.js";
|
|
23
|
+
export * from "./process-group.js";
|
|
24
|
+
export * from "./isolation-locator.js";
|
|
16
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HarnessRunSpec } from "@claudexor/schema";
|
|
2
|
+
/**
|
|
3
|
+
* Layer caller-supplied per-run instructions onto the prompt for harnesses with
|
|
4
|
+
* NO native system-prompt flag (cursor, opencode, raw-api). Claude and Codex use
|
|
5
|
+
* their native additive channels (`--append-system-prompt`, `developer_instructions`)
|
|
6
|
+
* instead and never call this. The block is explicitly delimited so the model
|
|
7
|
+
* reads it as system framing, not as part of the user's request.
|
|
8
|
+
*/
|
|
9
|
+
export declare function promptWithInstructions(spec: Pick<HarnessRunSpec, "prompt" | "instructions">): string;
|
|
10
|
+
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,cAAc,CAAC,GACpD,MAAM,CAIR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer caller-supplied per-run instructions onto the prompt for harnesses with
|
|
3
|
+
* NO native system-prompt flag (cursor, opencode, raw-api). Claude and Codex use
|
|
4
|
+
* their native additive channels (`--append-system-prompt`, `developer_instructions`)
|
|
5
|
+
* instead and never call this. The block is explicitly delimited so the model
|
|
6
|
+
* reads it as system framing, not as part of the user's request.
|
|
7
|
+
*/
|
|
8
|
+
export function promptWithInstructions(spec) {
|
|
9
|
+
const instructions = spec.instructions?.trim();
|
|
10
|
+
if (!instructions)
|
|
11
|
+
return spec.prompt;
|
|
12
|
+
return `[SYSTEM INSTRUCTIONS]\n${instructions}\n[END SYSTEM INSTRUCTIONS]\n\n${spec.prompt}`;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAqD;IAErD,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC;IAC/C,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC,MAAM,CAAC;IACtC,OAAO,0BAA0B,YAAY,kCAAkC,IAAI,CAAC,MAAM,EAAE,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared locator discipline (release wave round-11): absolute, canonicalized
|
|
3
|
+
* through the DEEPEST EXISTING ancestor (a nonexistent leaf under a symlinked
|
|
4
|
+
* parent cannot alias a forbidden store), and CONFINED to the Claudexor-owned
|
|
5
|
+
* tree — a locator inside a repository or an arbitrary user dir would put
|
|
6
|
+
* credential state where git or other tools can capture it.
|
|
7
|
+
*
|
|
8
|
+
* The confinement root FOLLOWS the v2 root (release wave round-18 #4): under
|
|
9
|
+
* an explicit CLAUDEXOR_CONFIG_DIR override that override IS the complete
|
|
10
|
+
* relocatable root — a hermetic/disposable run must accept profiles inside
|
|
11
|
+
* it and reject the host's real ~/.claudexor (host credential state must not
|
|
12
|
+
* leak into an isolated environment). Without the override, the owned tree
|
|
13
|
+
* is ~/.claudexor as before.
|
|
14
|
+
*/
|
|
15
|
+
/** Canonicalize a path through its DEEPEST EXISTING ancestor (symlinks
|
|
16
|
+
* resolved), re-appending the not-yet-existing remainder — so two spellings
|
|
17
|
+
* of one location (e.g. /var vs /private/var on macOS) always compare equal
|
|
18
|
+
* even before the leaf exists. */
|
|
19
|
+
export declare function normalizeThroughExistingAncestor(path: string): string;
|
|
20
|
+
export declare function canonicalIsolationLocator(locator: string, label: string): string;
|
|
21
|
+
//# sourceMappingURL=isolation-locator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isolation-locator.d.ts","sourceRoot":"","sources":["../src/isolation-locator.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH;;;kCAGkC;AAClC,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAerE;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAahF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
3
|
+
import { claudexorOwnedRoot } from "@claudexor/util";
|
|
4
|
+
/**
|
|
5
|
+
* Shared locator discipline (release wave round-11): absolute, canonicalized
|
|
6
|
+
* through the DEEPEST EXISTING ancestor (a nonexistent leaf under a symlinked
|
|
7
|
+
* parent cannot alias a forbidden store), and CONFINED to the Claudexor-owned
|
|
8
|
+
* tree — a locator inside a repository or an arbitrary user dir would put
|
|
9
|
+
* credential state where git or other tools can capture it.
|
|
10
|
+
*
|
|
11
|
+
* The confinement root FOLLOWS the v2 root (release wave round-18 #4): under
|
|
12
|
+
* an explicit CLAUDEXOR_CONFIG_DIR override that override IS the complete
|
|
13
|
+
* relocatable root — a hermetic/disposable run must accept profiles inside
|
|
14
|
+
* it and reject the host's real ~/.claudexor (host credential state must not
|
|
15
|
+
* leak into an isolated environment). Without the override, the owned tree
|
|
16
|
+
* is ~/.claudexor as before.
|
|
17
|
+
*/
|
|
18
|
+
/** Canonicalize a path through its DEEPEST EXISTING ancestor (symlinks
|
|
19
|
+
* resolved), re-appending the not-yet-existing remainder — so two spellings
|
|
20
|
+
* of one location (e.g. /var vs /private/var on macOS) always compare equal
|
|
21
|
+
* even before the leaf exists. */
|
|
22
|
+
export function normalizeThroughExistingAncestor(path) {
|
|
23
|
+
let existing = resolve(path);
|
|
24
|
+
const tail = [];
|
|
25
|
+
for (;;) {
|
|
26
|
+
try {
|
|
27
|
+
existing = realpathSync(existing);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
const parent = dirname(existing);
|
|
32
|
+
if (parent === existing)
|
|
33
|
+
break;
|
|
34
|
+
tail.unshift(basename(existing));
|
|
35
|
+
existing = parent;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return tail.length > 0 ? join(existing, ...tail) : existing;
|
|
39
|
+
}
|
|
40
|
+
export function canonicalIsolationLocator(locator, label) {
|
|
41
|
+
if (!isAbsolute(locator))
|
|
42
|
+
throw new Error(`${label} must be absolute: ${locator}`);
|
|
43
|
+
const dir = normalizeThroughExistingAncestor(locator);
|
|
44
|
+
// Normalize the confinement root the SAME way as the locator (round-19,
|
|
45
|
+
// fable checkpoint): a not-yet-created CLAUDEXOR_CONFIG_DIR under a
|
|
46
|
+
// symlinked parent (/var → /private/var on macOS) would otherwise compare
|
|
47
|
+
// unequal to a locator that was resolved through that symlink, and
|
|
48
|
+
// false-reject a valid in-root profile.
|
|
49
|
+
const owned = normalizeThroughExistingAncestor(claudexorOwnedRoot());
|
|
50
|
+
if (dir !== owned && !dir.startsWith(owned + sep)) {
|
|
51
|
+
throw new Error(`${label} must live under ${owned} (got ${dir})`);
|
|
52
|
+
}
|
|
53
|
+
return dir;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=isolation-locator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isolation-locator.js","sourceRoot":"","sources":["../src/isolation-locator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAA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