@claudexor/core 5.0.2 → 6.0.0
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 +97 -6
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +19 -0
- package/dist/adapter.js.map +1 -1
- package/dist/answer-assembly.d.ts +3 -0
- package/dist/answer-assembly.d.ts.map +1 -1
- package/dist/answer-assembly.js +5 -0
- package/dist/answer-assembly.js.map +1 -1
- package/dist/auth-capability-verifier.d.ts.map +1 -1
- package/dist/auth-capability-verifier.js +2 -0
- package/dist/auth-capability-verifier.js.map +1 -1
- package/dist/browser-mcp.d.ts +20 -1
- package/dist/browser-mcp.d.ts.map +1 -1
- package/dist/browser-mcp.js +56 -0
- package/dist/browser-mcp.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +7 -1
- package/dist/doctor.js.map +1 -1
- package/dist/env-scope.d.ts +8 -6
- package/dist/env-scope.d.ts.map +1 -1
- package/dist/env-scope.js +31 -6
- package/dist/env-scope.js.map +1 -1
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -0
- package/dist/errors.js.map +1 -1
- package/dist/hidden-program-paths.d.ts +13 -0
- package/dist/hidden-program-paths.d.ts.map +1 -0
- package/dist/hidden-program-paths.js +56 -0
- package/dist/hidden-program-paths.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +10 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +27 -4
- package/dist/model.js.map +1 -1
- package/dist/native/claudexor-process-identity +0 -0
- package/dist/native-program.d.ts +14 -0
- package/dist/native-program.d.ts.map +1 -0
- package/dist/native-program.js +56 -0
- package/dist/native-program.js.map +1 -0
- package/dist/proc.d.ts +18 -0
- package/dist/proc.d.ts.map +1 -1
- package/dist/proc.js +19 -0
- package/dist/proc.js.map +1 -1
- package/dist/process-identity.d.ts +5 -5
- package/dist/process-scope-census.d.ts +8 -33
- package/dist/process-scope-census.d.ts.map +1 -1
- package/dist/process-scope-census.js +32 -75
- package/dist/process-scope-census.js.map +1 -1
- package/dist/process-table.d.ts +38 -0
- package/dist/process-table.d.ts.map +1 -1
- package/dist/process-table.js +80 -0
- package/dist/process-table.js.map +1 -1
- package/dist/program-observation.d.ts +23 -0
- package/dist/program-observation.d.ts.map +1 -0
- package/dist/program-observation.js +105 -0
- package/dist/program-observation.js.map +1 -0
- package/dist/program-registry.d.ts +188 -0
- package/dist/program-registry.d.ts.map +1 -0
- package/dist/program-registry.js +32 -0
- package/dist/program-registry.js.map +1 -0
- package/dist/program-version.d.ts +4 -0
- package/dist/program-version.d.ts.map +1 -0
- package/dist/program-version.js +52 -0
- package/dist/program-version.js.map +1 -0
- package/dist/runloop.d.ts +4 -1
- package/dist/runloop.d.ts.map +1 -1
- package/dist/runloop.js +11 -0
- package/dist/runloop.js.map +1 -1
- package/dist/runtime-env.d.ts +5 -34
- package/dist/runtime-env.d.ts.map +1 -1
- package/dist/runtime-env.js +25 -85
- package/dist/runtime-env.js.map +1 -1
- package/dist/selected-program.d.ts +42 -0
- package/dist/selected-program.d.ts.map +1 -0
- package/dist/selected-program.js +128 -0
- package/dist/selected-program.js.map +1 -0
- package/dist/turn-limit.d.ts +12 -0
- package/dist/turn-limit.d.ts.map +1 -0
- package/dist/turn-limit.js +20 -0
- package/dist/turn-limit.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { composeSpawnEnv } from "./env-scope.js";
|
|
2
|
+
import { harnessBinaryIdentityOnPath } from "./runtime-env.js";
|
|
3
|
+
import { resolveSelectedProgramAsync, selectProgramEntry, } from "./selected-program.js";
|
|
4
|
+
const remembered = new Map();
|
|
5
|
+
let sequence = 0;
|
|
6
|
+
function remember(entry, selection) {
|
|
7
|
+
// A failed ask is still an observation, but never erases this identity's answer.
|
|
8
|
+
if (selection.version !== null || entry.selection.version === null)
|
|
9
|
+
entry.selection = selection;
|
|
10
|
+
entry.known = true;
|
|
11
|
+
}
|
|
12
|
+
function entryFor(program, options) {
|
|
13
|
+
const selected = selectProgramEntry(program, options);
|
|
14
|
+
const identity = JSON.stringify([
|
|
15
|
+
selected.observed.path,
|
|
16
|
+
selected.observed.realPath,
|
|
17
|
+
selected.observed.path
|
|
18
|
+
? harnessBinaryIdentityOnPath(selected.observed.path, selected.env.PATH ?? "", options.platform)
|
|
19
|
+
: null,
|
|
20
|
+
]);
|
|
21
|
+
const key = `${program.id}\0${selected.observed.path ?? "missing"}`;
|
|
22
|
+
let entry = remembered.get(key);
|
|
23
|
+
if (!entry || entry.identity !== identity) {
|
|
24
|
+
entry = { identity, sequence: ++sequence, known: false, selection: selected.observed };
|
|
25
|
+
remembered.set(key, entry);
|
|
26
|
+
}
|
|
27
|
+
return { key, entry, selected };
|
|
28
|
+
}
|
|
29
|
+
function observation(selection, identity, source = "remembered") {
|
|
30
|
+
return {
|
|
31
|
+
selection,
|
|
32
|
+
program: selection.path ? { path: selection.path, version: selection.version } : null,
|
|
33
|
+
key: JSON.stringify([identity, selection.version]),
|
|
34
|
+
versionSource: selection.version === null ? "unknown" : source,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function invalidateProgramObservations(harness) {
|
|
38
|
+
for (const key of remembered.keys())
|
|
39
|
+
if (!harness || key.startsWith(`${harness}\0`))
|
|
40
|
+
remembered.delete(key);
|
|
41
|
+
}
|
|
42
|
+
/** Reserve publication before an inventory child or native startup. A later
|
|
43
|
+
* observation or file replacement fences its answer; no clock/TTL is involved. */
|
|
44
|
+
export function programObservationPublisher(program, options = {}) {
|
|
45
|
+
const { entry, key } = entryFor(program, options);
|
|
46
|
+
const revision = (entry.sequence = ++sequence);
|
|
47
|
+
return (selected) => {
|
|
48
|
+
if (remembered.get(key) !== entry ||
|
|
49
|
+
entry.sequence !== revision ||
|
|
50
|
+
entryFor(program, options).entry !== entry ||
|
|
51
|
+
selected.path !== entry.selection.path ||
|
|
52
|
+
selected.realPath !== entry.selection.realPath)
|
|
53
|
+
return false;
|
|
54
|
+
remember(entry, selected);
|
|
55
|
+
entry.pending = undefined;
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Passive reads inspect file identity only. The first read of an entry and
|
|
60
|
+
* explicit fresh reads share one version process. An unanswered ask is remembered
|
|
61
|
+
* by file identity too; consumers may reuse evidence under that same null answer. */
|
|
62
|
+
export async function observeHarnessProgram(program, patch, bin, options = {}) {
|
|
63
|
+
if (!program)
|
|
64
|
+
return { selection: null, program: null, key: "no-program", versionSource: "unknown" };
|
|
65
|
+
const environment = options.environment ?? composeSpawnEnv("mirror_native", patch);
|
|
66
|
+
const resolution = {
|
|
67
|
+
sourceEnv: { ...environment, ...(bin ? { [program.overrideEnv]: bin } : {}) },
|
|
68
|
+
environment,
|
|
69
|
+
cwd: options.cwd,
|
|
70
|
+
};
|
|
71
|
+
const { entry, key, selected } = entryFor(program, resolution);
|
|
72
|
+
const read = () => observation({
|
|
73
|
+
...selected.observed,
|
|
74
|
+
version: entry.selection.version,
|
|
75
|
+
versionOutput: entry.selection.versionOutput,
|
|
76
|
+
}, entry.identity);
|
|
77
|
+
if (options.probe === false)
|
|
78
|
+
return read();
|
|
79
|
+
if (entry.pending)
|
|
80
|
+
return entry.pending;
|
|
81
|
+
if (entry.known && !options.fresh)
|
|
82
|
+
return read();
|
|
83
|
+
const revision = (entry.sequence = ++sequence);
|
|
84
|
+
const pending = resolveSelectedProgramAsync(program, resolution)
|
|
85
|
+
.then((answer) => {
|
|
86
|
+
if (remembered.get(key) === entry &&
|
|
87
|
+
entry.sequence === revision &&
|
|
88
|
+
entryFor(program, resolution).entry === entry) {
|
|
89
|
+
remember(entry, answer);
|
|
90
|
+
return observation(entry.selection, entry.identity, answer.version === null ? "remembered" : "version_probe");
|
|
91
|
+
}
|
|
92
|
+
return observation(answer, entry.identity, "version_probe");
|
|
93
|
+
})
|
|
94
|
+
.finally(() => {
|
|
95
|
+
if (entry.pending === pending)
|
|
96
|
+
entry.pending = undefined;
|
|
97
|
+
});
|
|
98
|
+
entry.pending = pending;
|
|
99
|
+
return pending;
|
|
100
|
+
}
|
|
101
|
+
export function assertSameProgram(before, after) {
|
|
102
|
+
if (before.key !== after.key)
|
|
103
|
+
throw Object.assign(new Error("The selected program changed during this observation; read it again."), { code: "program_changed_during_observation" });
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=program-observation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program-observation.js","sourceRoot":"","sources":["../src/program-observation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,GAEnB,MAAM,uBAAuB,CAAC;AAe/B,MAAM,UAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;AACjD,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,SAAS,QAAQ,CAAC,KAAiB,EAAE,SAAiC;IACpE,iFAAiF;IACjF,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,OAAO,KAAK,IAAI;QAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IAChG,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;AACrB,CAAC;AACD,SAAS,QAAQ,CAAC,OAAuB,EAAE,OAAiC;IAC1E,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAC9B,QAAQ,CAAC,QAAQ,CAAC,IAAI;QACtB,QAAQ,CAAC,QAAQ,CAAC,QAAQ;QAC1B,QAAQ,C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,KAAK,KAAK,EAC7C,CAAC;YACD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACxB,OAAO,WAAW,CAChB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,QAAQ,EACd,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CACzD,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACZ,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO;YAAE,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC;IAC3D,CAAC,CAAC,CAAC;IACL,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAA0B,EAAE,KAAyB;IACrF,IAAI,MAAM,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;QAC1B,MAAM,MAAM,CAAC,MAAM,CACjB,IAAI,KAAK,CAAC,sEAAsE,CAAC,EACjF,EAAE,IAAI,EAAE,oCAAoC,EAAE,CAC/C,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { HarnessProgram } from "@claudexor/schema";
|
|
2
|
+
/** Called by each adapter's declaration, never by a second vendor table. */
|
|
3
|
+
export declare function defineHarnessProgram(value: HarnessProgram): HarnessProgram;
|
|
4
|
+
export declare function registeredHarnessPrograms(): HarnessProgram[];
|
|
5
|
+
export declare function programPlatform(program: HarnessProgram, platform: NodeJS.Platform): {
|
|
6
|
+
launcherDirs: string[];
|
|
7
|
+
install?: {
|
|
8
|
+
kind: "exec";
|
|
9
|
+
command: string;
|
|
10
|
+
args: string[];
|
|
11
|
+
env?: Record<string, string> | undefined;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "script";
|
|
14
|
+
url: string;
|
|
15
|
+
interpreter: string;
|
|
16
|
+
interpreterArgs: string[];
|
|
17
|
+
args: string[];
|
|
18
|
+
env?: Record<string, string> | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
update?: {
|
|
21
|
+
kind: "exec";
|
|
22
|
+
command: string;
|
|
23
|
+
args: string[];
|
|
24
|
+
env?: Record<string, string> | undefined;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "script";
|
|
27
|
+
url: string;
|
|
28
|
+
interpreter: string;
|
|
29
|
+
interpreterArgs: string[];
|
|
30
|
+
args: string[];
|
|
31
|
+
env?: Record<string, string> | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
exactVersion?: {
|
|
34
|
+
kind: "exec";
|
|
35
|
+
command: string;
|
|
36
|
+
args: string[];
|
|
37
|
+
env?: Record<string, string> | undefined;
|
|
38
|
+
} | {
|
|
39
|
+
kind: "script";
|
|
40
|
+
url: string;
|
|
41
|
+
interpreter: string;
|
|
42
|
+
interpreterArgs: string[];
|
|
43
|
+
args: string[];
|
|
44
|
+
env?: Record<string, string> | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
newest?: {
|
|
47
|
+
url: string;
|
|
48
|
+
pick: {
|
|
49
|
+
kind: "text";
|
|
50
|
+
} | {
|
|
51
|
+
kind: "json";
|
|
52
|
+
field: string;
|
|
53
|
+
stripPrefix?: string | undefined;
|
|
54
|
+
} | {
|
|
55
|
+
kind: "pattern";
|
|
56
|
+
pattern: string;
|
|
57
|
+
};
|
|
58
|
+
} | undefined;
|
|
59
|
+
architectures?: Record<string, string> | undefined;
|
|
60
|
+
reasons?: {
|
|
61
|
+
install?: string | undefined;
|
|
62
|
+
update?: string | undefined;
|
|
63
|
+
exactVersion?: string | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
} | {
|
|
66
|
+
launcherDirs: string[];
|
|
67
|
+
install?: {
|
|
68
|
+
kind: "exec";
|
|
69
|
+
command: string;
|
|
70
|
+
args: string[];
|
|
71
|
+
env?: Record<string, string> | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
kind: "script";
|
|
74
|
+
url: string;
|
|
75
|
+
interpreter: string;
|
|
76
|
+
interpreterArgs: string[];
|
|
77
|
+
args: string[];
|
|
78
|
+
env?: Record<string, string> | undefined;
|
|
79
|
+
} | undefined;
|
|
80
|
+
update?: {
|
|
81
|
+
kind: "exec";
|
|
82
|
+
command: string;
|
|
83
|
+
args: string[];
|
|
84
|
+
env?: Record<string, string> | undefined;
|
|
85
|
+
} | {
|
|
86
|
+
kind: "script";
|
|
87
|
+
url: string;
|
|
88
|
+
interpreter: string;
|
|
89
|
+
interpreterArgs: string[];
|
|
90
|
+
args: string[];
|
|
91
|
+
env?: Record<string, string> | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
exactVersion?: {
|
|
94
|
+
kind: "exec";
|
|
95
|
+
command: string;
|
|
96
|
+
args: string[];
|
|
97
|
+
env?: Record<string, string> | undefined;
|
|
98
|
+
} | {
|
|
99
|
+
kind: "script";
|
|
100
|
+
url: string;
|
|
101
|
+
interpreter: string;
|
|
102
|
+
interpreterArgs: string[];
|
|
103
|
+
args: string[];
|
|
104
|
+
env?: Record<string, string> | undefined;
|
|
105
|
+
} | undefined;
|
|
106
|
+
newest?: {
|
|
107
|
+
url: string;
|
|
108
|
+
pick: {
|
|
109
|
+
kind: "text";
|
|
110
|
+
} | {
|
|
111
|
+
kind: "json";
|
|
112
|
+
field: string;
|
|
113
|
+
stripPrefix?: string | undefined;
|
|
114
|
+
} | {
|
|
115
|
+
kind: "pattern";
|
|
116
|
+
pattern: string;
|
|
117
|
+
};
|
|
118
|
+
} | undefined;
|
|
119
|
+
architectures?: Record<string, string> | undefined;
|
|
120
|
+
reasons?: {
|
|
121
|
+
install?: string | undefined;
|
|
122
|
+
update?: string | undefined;
|
|
123
|
+
exactVersion?: string | undefined;
|
|
124
|
+
} | undefined;
|
|
125
|
+
} | {
|
|
126
|
+
launcherDirs: string[];
|
|
127
|
+
install?: {
|
|
128
|
+
kind: "exec";
|
|
129
|
+
command: string;
|
|
130
|
+
args: string[];
|
|
131
|
+
env?: Record<string, string> | undefined;
|
|
132
|
+
} | {
|
|
133
|
+
kind: "script";
|
|
134
|
+
url: string;
|
|
135
|
+
interpreter: string;
|
|
136
|
+
interpreterArgs: string[];
|
|
137
|
+
args: string[];
|
|
138
|
+
env?: Record<string, string> | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
update?: {
|
|
141
|
+
kind: "exec";
|
|
142
|
+
command: string;
|
|
143
|
+
args: string[];
|
|
144
|
+
env?: Record<string, string> | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
kind: "script";
|
|
147
|
+
url: string;
|
|
148
|
+
interpreter: string;
|
|
149
|
+
interpreterArgs: string[];
|
|
150
|
+
args: string[];
|
|
151
|
+
env?: Record<string, string> | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
exactVersion?: {
|
|
154
|
+
kind: "exec";
|
|
155
|
+
command: string;
|
|
156
|
+
args: string[];
|
|
157
|
+
env?: Record<string, string> | undefined;
|
|
158
|
+
} | {
|
|
159
|
+
kind: "script";
|
|
160
|
+
url: string;
|
|
161
|
+
interpreter: string;
|
|
162
|
+
interpreterArgs: string[];
|
|
163
|
+
args: string[];
|
|
164
|
+
env?: Record<string, string> | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
newest?: {
|
|
167
|
+
url: string;
|
|
168
|
+
pick: {
|
|
169
|
+
kind: "text";
|
|
170
|
+
} | {
|
|
171
|
+
kind: "json";
|
|
172
|
+
field: string;
|
|
173
|
+
stripPrefix?: string | undefined;
|
|
174
|
+
} | {
|
|
175
|
+
kind: "pattern";
|
|
176
|
+
pattern: string;
|
|
177
|
+
};
|
|
178
|
+
} | undefined;
|
|
179
|
+
architectures?: Record<string, string> | undefined;
|
|
180
|
+
reasons?: {
|
|
181
|
+
install?: string | undefined;
|
|
182
|
+
update?: string | undefined;
|
|
183
|
+
exactVersion?: string | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
} | undefined;
|
|
186
|
+
export declare function programPath(template: string, env: NodeJS.ProcessEnv): string;
|
|
187
|
+
export declare function programLauncherDirs(env: NodeJS.ProcessEnv, platform: NodeJS.Platform): string[];
|
|
188
|
+
//# sourceMappingURL=program-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program-registry.d.ts","sourceRoot":"","sources":["../src/program-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAI1E;AAED,wBAAgB,yBAAyB,IAAI,cAAc,EAAE,CAE5D;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEjF;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAU5E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAM/F"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HarnessProgram } from "@claudexor/schema";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const programs = new Map();
|
|
5
|
+
/** Called by each adapter's declaration, never by a second vendor table. */
|
|
6
|
+
export function defineHarnessProgram(value) {
|
|
7
|
+
const program = HarnessProgram.parse(value);
|
|
8
|
+
programs.set(program.id, program);
|
|
9
|
+
return program;
|
|
10
|
+
}
|
|
11
|
+
export function registeredHarnessPrograms() {
|
|
12
|
+
return [...programs.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
13
|
+
}
|
|
14
|
+
export function programPlatform(program, platform) {
|
|
15
|
+
return program.platforms[platform];
|
|
16
|
+
}
|
|
17
|
+
export function programPath(template, env) {
|
|
18
|
+
const home = env.HOME || env.USERPROFILE || homedir();
|
|
19
|
+
const missing = [...template.matchAll(/\{env:([A-Z_][A-Z_0-9]*)\}/g)].some((match) => !env[match[1]]);
|
|
20
|
+
if (missing)
|
|
21
|
+
return "";
|
|
22
|
+
return template
|
|
23
|
+
.replace(/\{env:([A-Z_][A-Z_0-9]*)\}/g, (_match, key) => env[key])
|
|
24
|
+
.replaceAll("{home}", home)
|
|
25
|
+
.replaceAll("{localAppData}", env.LOCALAPPDATA || join(home, "AppData", "Local"));
|
|
26
|
+
}
|
|
27
|
+
export function programLauncherDirs(env, platform) {
|
|
28
|
+
return registeredHarnessPrograms().flatMap((program) => (programPlatform(program, platform)?.launcherDirs ?? [])
|
|
29
|
+
.map((path) => programPath(path, env))
|
|
30
|
+
.filter(Boolean));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=program-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program-registry.js","sourceRoot":"","sources":["../src/program-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEnD,4EAA4E;AAC5E,MAAM,UAAU,oBAAoB,CAAC,KAAqB;IACxD,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,K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CAAC,CAAC,OAAO,EAAE,EAAE,CACrD,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,YAAY,IAAI,EAAE,CAAC;SACrD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SACrC,MAAM,CAAC,OAAO,CAAC,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HarnessProgram } from "@claudexor/schema";
|
|
2
|
+
/** Is the observed published pointer newer? Never order an unknown version scheme. */
|
|
3
|
+
export declare function programUpdateAvailable(scheme: HarnessProgram["versionScheme"], selected: string | null, newest: string | null): "yes" | "no" | "cannot_tell";
|
|
4
|
+
//# sourceMappingURL=program-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program-version.d.ts","sourceRoot":"","sources":["../src/program-version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,sFAAsF;AACtF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,CAAC,eAAe,CAAC,EACvC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,KAAK,GAAG,IAAI,GAAG,aAAa,CA4C9B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Is the observed published pointer newer? Never order an unknown version scheme. */
|
|
2
|
+
export function programUpdateAvailable(scheme, selected, newest) {
|
|
3
|
+
if (!selected || !newest)
|
|
4
|
+
return "cannot_tell";
|
|
5
|
+
if (selected === newest)
|
|
6
|
+
return "no";
|
|
7
|
+
if (scheme === "date-hash") {
|
|
8
|
+
const parse = (s) => {
|
|
9
|
+
const m = /^(\d{4})\.(\d{2})\.(\d{2})-([a-zA-Z0-9]+)$/.exec(s);
|
|
10
|
+
if (!m)
|
|
11
|
+
return null;
|
|
12
|
+
const date = `${m[1]}-${m[2]}-${m[3]}`;
|
|
13
|
+
const ms = Date.parse(date);
|
|
14
|
+
return Number.isFinite(ms) && new Date(ms).toISOString().slice(0, 10) === date ? date : null;
|
|
15
|
+
};
|
|
16
|
+
const a = parse(selected), b = parse(newest);
|
|
17
|
+
// Hashes identify builds but do not order builds on the same day.
|
|
18
|
+
return !a || !b || a === b ? "cannot_tell" : b > a ? "yes" : "no";
|
|
19
|
+
}
|
|
20
|
+
if (scheme !== "semver")
|
|
21
|
+
return "cannot_tell";
|
|
22
|
+
const parse = (s) => {
|
|
23
|
+
const m = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(s);
|
|
24
|
+
if (!m || m[4]?.split(".").some((v) => /^0\d+$/.test(v)))
|
|
25
|
+
return null;
|
|
26
|
+
return { numbers: m.slice(1, 4).map(BigInt), pre: m[4]?.split(".") ?? [] };
|
|
27
|
+
};
|
|
28
|
+
const a = parse(selected), b = parse(newest);
|
|
29
|
+
if (!a || !b)
|
|
30
|
+
return "cannot_tell";
|
|
31
|
+
for (let i = 0; i < 3; i++) {
|
|
32
|
+
if (a.numbers[i] !== b.numbers[i])
|
|
33
|
+
return b.numbers[i] > a.numbers[i] ? "yes" : "no";
|
|
34
|
+
}
|
|
35
|
+
if (!a.pre.length || !b.pre.length)
|
|
36
|
+
return a.pre.length && !b.pre.length ? "yes" : "no";
|
|
37
|
+
for (let i = 0; i < Math.max(a.pre.length, b.pre.length); i++) {
|
|
38
|
+
const x = a.pre[i], y = b.pre[i];
|
|
39
|
+
if (x === y)
|
|
40
|
+
continue;
|
|
41
|
+
if (x === undefined)
|
|
42
|
+
return "yes";
|
|
43
|
+
if (y === undefined)
|
|
44
|
+
return "no";
|
|
45
|
+
const nx = /^\d+$/.test(x), ny = /^\d+$/.test(y);
|
|
46
|
+
if (nx !== ny)
|
|
47
|
+
return nx ? "yes" : "no";
|
|
48
|
+
return (nx ? BigInt(y) > BigInt(x) : y > x) ? "yes" : "no";
|
|
49
|
+
}
|
|
50
|
+
return "no";
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=program-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program-version.js","sourceRoot":"","sources":["../src/program-version.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,UAAU,sBAAsB,CACpC,MAAuC,EACvC,QAAuB,EACvB,MAAqB;IAErB,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM;QAAE,OAAO,aAAa,CAAC;IAC/C,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACrC,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE;YAC1B,MAAM,CAAC,GAAG,4CAA4C,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/D,IAAI,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;YACpB,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/F,CAAC,CAAC;QACF,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EACvB,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QACpB,kEAAkE;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1,9 +1,12 @@
|
|
|
1
|
-
import type { HarnessEvent, HarnessRunSpec } from "@claudexor/schema";
|
|
1
|
+
import type { HarnessEvent, HarnessRunSpec, HarnessProgram } from "@claudexor/schema";
|
|
2
2
|
import { spawnProcess, type ChildStdin } from "./proc.js";
|
|
3
3
|
import type { WindowsConsolePolicy } from "./runtime-env.js";
|
|
4
4
|
import type { ProcessTreeTerminationOutcome, ReapProcessTreeOptions } from "./process-tree.js";
|
|
5
5
|
export declare function abortSignalFromSpec(spec: HarnessRunSpec): AbortSignal | undefined;
|
|
6
6
|
export interface CliRunLoopOptions {
|
|
7
|
+
program?: HarnessProgram;
|
|
8
|
+
/** Adapter-owned field from the vendor startup frame, never error prose. */
|
|
9
|
+
programVersion?: (frame: unknown) => unknown;
|
|
7
10
|
bin: string;
|
|
8
11
|
args: string[];
|
|
9
12
|
/** Native process I/O seam; event parsing and lifecycle remain production-owned. */
|
package/dist/runloop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runloop.d.ts","sourceRoot":"","sources":["../src/runloop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runloop.d.ts","sourceRoot":"","sources":["../src/runloop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAoC/F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,GAAG,SAAS,CAOjF;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,C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zC;;;;;WAKG;QACH,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;KAC3D,CAAC;IACF;;iCAE6B;IAC7B,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAC;CACjF;AAED,wBAAuB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,cAAc,CAAC,YAAY,CAAC,CAc1F"}
|
package/dist/runloop.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { prepareNativeProgram } from "./native-program.js";
|
|
1
2
|
import { spawnProcess } from "./proc.js";
|
|
2
3
|
/**
|
|
3
4
|
* Shared CLI adapter run loop.
|
|
@@ -41,6 +42,15 @@ export function abortSignalFromSpec(spec) {
|
|
|
41
42
|
: undefined;
|
|
42
43
|
}
|
|
43
44
|
export async function* runCliHarness(opts) {
|
|
45
|
+
if (!opts.program) {
|
|
46
|
+
yield* runCliHarnessObserved(opts);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const program = await prepareNativeProgram(opts.program, opts.bin, opts.spec, opts.env, !!opts.programVersion);
|
|
50
|
+
for await (const event of runCliHarnessObserved({ ...opts, bin: program.bin }, program))
|
|
51
|
+
yield program.event(event);
|
|
52
|
+
}
|
|
53
|
+
async function* runCliHarnessObserved(opts, program) {
|
|
44
54
|
if (opts.input !== undefined && opts.session !== undefined) {
|
|
45
55
|
throw new Error("runCliHarness input and session are mutually exclusive stdin owners");
|
|
46
56
|
}
|
|
@@ -150,6 +160,7 @@ export async function* runCliHarness(opts) {
|
|
|
150
160
|
droppedUnparsedLines += 1;
|
|
151
161
|
continue;
|
|
152
162
|
}
|
|
163
|
+
program?.observeVersion(opts.programVersion?.(obj));
|
|
153
164
|
if (opts.session && session.io && opts.session.matches(obj)) {
|
|
154
165
|
for await (const out of opts.session.handle(obj, session.io)) {
|
|
155
166
|
if (out.type === "error")
|
package/dist/runloop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runloop.js","sourceRoot":"","sources":["../src/runloop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runloop.js","sourceRoot":"","sources":["../src/runloop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAyB,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,YAAY,EAAmB,MAAM,WAAW,CAAC;AAI1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,UAAU,mBAAmB,CAAC,IAAoB;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC5D,MAAM,SAAS,GAAG,MAA8B,CAAC;IACjD,OAAO,OAAO,SAAS,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,SAAS,CAAC,gBAAgB,KAAK,UAAU;QAC/F,CAAC,CAAE,MAAsB;QACzB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AA8DD,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,aAAa,CAAC,IAAuB;IAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,KAAK,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,oBAAoB,CACxC,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,GAAG,EACR,CAAC,CAAC,IAAI,CAAC,cAAc,CACtB,CAAC;IACF,IAAI,KAAK,EAAE,MAAM,KAAK,I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,CAAC;IACD,+EAA+E;IAC/E,qEAAqE;IACrE,IAAI,CAAC,OAAO,IAAI,UAAU;QAAE,OAAO,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC;IAChE,IAAI,WAAW;QAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAChD,8EAA8E;IAC9E,8EAA8E;IAC9E,8EAA8E;IAC9E,0BAA0B;IAC1B,IAAI,oBAAoB;QAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC;IACnE,+EAA+E;IAC/E,gFAAgF;IAChF,8EAA8E;IAC9E,8EAA8E;IAC9E,MAAM,YAAY,GAAG,UAAU,EAAE,CAAC;IAClC,IAAI,YAAY;QAAE,OAAO,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;IACxD,MAAM;QACJ,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,EAAE,EAAE,EAAE,EAAE;QACR,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxD,CAAC;AACJ,CAAC"}
|
package/dist/runtime-env.d.ts
CHANGED
|
@@ -27,11 +27,9 @@ import type { HarnessLaunchRefusal, SkippedLaunchCandidate } from "./launch-refu
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function managedRunnerNodeDir(execPath?: string, platform?: NodeJS.Platform): string | null;
|
|
29
29
|
/**
|
|
30
|
-
* The managed toolchain root under `home`: the
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `lib/node_modules` payloads). ONE spelling shared by every harness PATH
|
|
34
|
-
* producer.
|
|
30
|
+
* The managed toolchain root under `home`: the Node distribution Claudexor installs.
|
|
31
|
+
* Older releases also placed npm harnesses here; those are converted by Update.
|
|
32
|
+
* ONE spelling shared by every harness PATH producer.
|
|
35
33
|
* Deliberately HOME-anchored, not config-dir-anchored — a
|
|
36
34
|
* `CLAUDEXOR_CONFIG_DIR` override relocates the runtime root, never the
|
|
37
35
|
* installed toolchain.
|
|
@@ -43,32 +41,6 @@ export declare function managedNodeRoot(home: string): string;
|
|
|
43
41
|
* Windows (where the launcher shims land in the prefix root itself).
|
|
44
42
|
*/
|
|
45
43
|
export declare function npmGlobalPackagesDir(prefix: string, platform: NodeJS.Platform): string;
|
|
46
|
-
/**
|
|
47
|
-
* The npm entrypoint bundled INSIDE a Node distribution, next to the runtime
|
|
48
|
-
* that will execute it: `<root>/lib/node_modules/npm/bin/npm-cli.js` beside
|
|
49
|
-
* `<root>/bin/node` on POSIX, `<dir>/node_modules/npm/bin/npm-cli.js` beside
|
|
50
|
-
* `<dir>/node.exe` on Windows (the official zip layout). The local installer
|
|
51
|
-
* runs exactly this file on exactly that Node and never an ambient PATH npm.
|
|
52
|
-
*/
|
|
53
|
-
export declare function embeddedNpmCli(execPath: string, platform: NodeJS.Platform): string;
|
|
54
|
-
/** Compatibility PATH entries for previously installed managed Codex images.
|
|
55
|
-
* Standard npm installs now resolve their own declared bin through npm-launch;
|
|
56
|
-
* keep this existing image location as a fallback for earlier managed installs. */
|
|
57
|
-
declare const WINDOWS_TARGET_TRIPLES: {
|
|
58
|
-
readonly x64: "x86_64-pc-windows-msvc";
|
|
59
|
-
readonly arm64: "aarch64-pc-windows-msvc";
|
|
60
|
-
};
|
|
61
|
-
export type WindowsNativeArch = keyof typeof WINDOWS_TARGET_TRIPLES;
|
|
62
|
-
export declare function isWindowsNativeArch(arch: string): arch is WindowsNativeArch;
|
|
63
|
-
/** Segments from an npm global packages dir to the package-native image dir,
|
|
64
|
-
* or null when no verified Windows image layout exists for that pin/arch. */
|
|
65
|
-
export declare function windowsNativeImageSegments(npmPackage: string, arch: string): readonly string[] | null;
|
|
66
|
-
/** The absolute package-native image dir inside an npm prefix on Windows. */
|
|
67
|
-
export declare function windowsNativeImageDir(prefix: string, npmPackage: string, arch: string): string | null;
|
|
68
|
-
/** Every verified package-native image dir under the managed toolchain root —
|
|
69
|
-
* the win32 entries the harness PATH carries so a bare `codex` resolves to the
|
|
70
|
-
* vendor's `codex.exe` on every local surface (doctor, login, run, quota). */
|
|
71
|
-
export declare function managedWindowsNativeImageDirs(home: string, arch: string): string[];
|
|
72
44
|
/**
|
|
73
45
|
* Single producer for the PATH every local harness discovery/run surface should
|
|
74
46
|
* use. Surfaces may still inherit other env vars, but binary resolution must not
|
|
@@ -76,7 +48,7 @@ export declare function managedWindowsNativeImageDirs(home: string, arch: string
|
|
|
76
48
|
* Existing inherited entries are never dropped (only de-duplicated); the only
|
|
77
49
|
* additions are the trusted `preferred` prefixes.
|
|
78
50
|
*/
|
|
79
|
-
export declare function normalizedHarnessPath(source?: NodeJS.ProcessEnv, execPath?: string, platform?: NodeJS.Platform,
|
|
51
|
+
export declare function normalizedHarnessPath(source?: NodeJS.ProcessEnv, execPath?: string, platform?: NodeJS.Platform, _arch?: string): string;
|
|
80
52
|
export declare function harnessRuntimeEnv(source?: NodeJS.ProcessEnv, execPath?: string, platform?: NodeJS.Platform): NodeJS.ProcessEnv;
|
|
81
53
|
/**
|
|
82
54
|
* Resolve which binary a harness child will ACTUALLY execute, using the same
|
|
@@ -104,7 +76,7 @@ export interface HarnessCommandResolution {
|
|
|
104
76
|
/** Exact final PATH; never normalize a scoped HOME or replace a caller's patch.
|
|
105
77
|
* PATH entries resolve where the daemon runs, as its probes do; an explicitly
|
|
106
78
|
* relative name resolves from `cwd`, where the child runs. */
|
|
107
|
-
export declare function resolveHarnessCommandOnPath(bin: string, pathValue: string, platform?: NodeJS.Platform, source?: NodeJS.ProcessEnv, cwd?: string): HarnessCommandResolution;
|
|
79
|
+
export declare function resolveHarnessCommandOnPath(bin: string, pathValue: string, platform?: NodeJS.Platform, source?: NodeJS.ProcessEnv, cwd?: string, maskedPaths?: readonly string[]): HarnessCommandResolution;
|
|
108
80
|
/** Prepare the OS invocation run from `cwd` without changing the environment's authority. */
|
|
109
81
|
export declare function prepareHarnessCommand(bin: string, args: readonly string[], env: NodeJS.ProcessEnv, platform?: NodeJS.Platform, cwd?: string): ReturnType<typeof interpretedCommand> & {
|
|
110
82
|
resolution: HarnessCommandResolution;
|
|
@@ -195,5 +167,4 @@ export declare function brokenInstallAdvisory(bin: string, source?: NodeJS.Proce
|
|
|
195
167
|
* only (doctor surfaces it); never gates a run.
|
|
196
168
|
*/
|
|
197
169
|
export declare function atRiskNodeAdvisory(execPath?: string, platform?: NodeJS.Platform): string | null;
|
|
198
|
-
export {};
|
|
199
170
|
//# sourceMappingURL=runtime-env.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-env.d.ts","sourceRoot":"","sources":["../src/runtime-env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-env.d.ts","sourceRoot":"","sources":["../src/runtime-env.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAM1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,GAAE,MAAyB,EACnC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,MAAM,GAAG,IAAI,CAef;AAYD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,CAEtF;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,GAAE,MAA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