@sublang/slc 0.2.0 → 0.4.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/README.md +86 -14
- package/dist/app.d.ts +13 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +65 -15
- package/dist/app.js.map +1 -1
- package/dist/build-history.d.ts +74 -0
- package/dist/build-history.d.ts.map +1 -0
- package/dist/build-history.js +309 -0
- package/dist/build-history.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/cligent-agent.d.ts +19 -0
- package/dist/cligent-agent.d.ts.map +1 -1
- package/dist/cligent-agent.js +125 -30
- package/dist/cligent-agent.js.map +1 -1
- package/dist/compiled-executor.d.ts +7 -1
- package/dist/compiled-executor.d.ts.map +1 -1
- package/dist/compiled-executor.js +11 -3
- package/dist/compiled-executor.js.map +1 -1
- package/dist/config-file.d.ts +9 -0
- package/dist/config-file.d.ts.map +1 -1
- package/dist/config-file.js +29 -5
- package/dist/config-file.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -3
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -0
- package/dist/execution.d.ts +42 -0
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +224 -29
- package/dist/execution.js.map +1 -1
- package/dist/hash.d.ts +22 -0
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +47 -0
- package/dist/hash.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interpreter.d.ts +1 -1
- package/dist/interpreter.d.ts.map +1 -1
- package/dist/interpreter.js +9 -0
- package/dist/interpreter.js.map +1 -1
- package/dist/invocation.d.ts +5 -1
- package/dist/invocation.d.ts.map +1 -1
- package/dist/invocation.js +14 -3
- package/dist/invocation.js.map +1 -1
- package/dist/line-diff.d.ts +7 -0
- package/dist/line-diff.d.ts.map +1 -0
- package/dist/line-diff.js +66 -0
- package/dist/line-diff.js.map +1 -0
- package/dist/phase.d.ts +2 -0
- package/dist/phase.d.ts.map +1 -1
- package/dist/phase.js +19 -3
- package/dist/phase.js.map +1 -1
- package/dist/pin-closure.d.ts +2 -2
- package/dist/pin-closure.d.ts.map +1 -1
- package/dist/pin-closure.js +4 -3
- package/dist/pin-closure.js.map +1 -1
- package/dist/pin-currency.d.ts +6 -2
- package/dist/pin-currency.d.ts.map +1 -1
- package/dist/pin-currency.js +24 -43
- package/dist/pin-currency.js.map +1 -1
- package/dist/pin-generate.d.ts.map +1 -1
- package/dist/pin-generate.js +1 -3
- package/dist/pin-generate.js.map +1 -1
- package/dist/pin-paths.d.ts.map +1 -1
- package/dist/pin-paths.js +2 -13
- package/dist/pin-paths.js.map +1 -1
- package/dist/pins.d.ts.map +1 -1
- package/dist/pins.js +5 -15
- package/dist/pins.js.map +1 -1
- package/dist/playbook-ports.d.ts +17 -0
- package/dist/playbook-ports.d.ts.map +1 -1
- package/dist/playbook-ports.js +21 -6
- package/dist/playbook-ports.js.map +1 -1
- package/dist/progress.d.ts +71 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +96 -0
- package/dist/progress.js.map +1 -0
- package/dist/runner.d.ts +8 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +673 -89
- package/dist/runner.js.map +1 -1
- package/dist/runtime-package.d.ts.map +1 -1
- package/dist/runtime-package.js +3 -11
- package/dist/runtime-package.js.map +1 -1
- package/dist/slc.config.template.yaml +5 -1
- package/dist/verify-coverage.d.ts.map +1 -1
- package/dist/verify-coverage.js +2 -0
- package/dist/verify-coverage.js.map +1 -1
- package/dist/verify-support.d.ts +7 -0
- package/dist/verify-support.d.ts.map +1 -1
- package/dist/verify-support.js +13 -6
- package/dist/verify-support.js.map +1 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +2 -0
- package/dist/verify.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
|
+
/** Complete, versioned build snapshots for incremental compilation. */
|
|
4
|
+
import { constants } from 'node:fs';
|
|
5
|
+
import { lstat, mkdir, open, readdir, rename, unlink, writeFile, } from 'node:fs/promises';
|
|
6
|
+
import { randomUUID } from 'node:crypto';
|
|
7
|
+
import { isAbsolute, join, relative, sep } from 'node:path';
|
|
8
|
+
import { errorCode, isAbsentPathError } from './errors.js';
|
|
9
|
+
import { hashBytes, isHash } from './hash.js';
|
|
10
|
+
export const HISTORY_DIR = '.slc';
|
|
11
|
+
export const BUILD_MANIFEST_SCHEMA = 'sublang.slc.build.v1';
|
|
12
|
+
export const SOURCE_COPY = 'source';
|
|
13
|
+
const OUTPUTS_DIR = 'outputs';
|
|
14
|
+
const MAX_BUILD_NUMBER = 999_999_999_999_999;
|
|
15
|
+
const BUILD_NUMBER = /^[1-9]\d{0,14}$/;
|
|
16
|
+
const PRIVATE_DIRECTORY_MODE = 0o700;
|
|
17
|
+
const PRIVATE_FILE_MODE = 0o600;
|
|
18
|
+
/** Encodes an absolute path relative to the artifact directory. */
|
|
19
|
+
export function encodeLocator(artDir, path) {
|
|
20
|
+
return relative(artDir, path).split(sep).join('/');
|
|
21
|
+
}
|
|
22
|
+
/** Fixed path of a phase's recorded output copy. */
|
|
23
|
+
export function outputCopyPath(history, index) {
|
|
24
|
+
return join(history.dir, OUTPUTS_DIR, String(index));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Loads and verifies the complete active build. Any malformed directory,
|
|
28
|
+
* marker, manifest, source copy, output copy, or hash makes history absent.
|
|
29
|
+
*/
|
|
30
|
+
export async function loadBuildHistory(artDir) {
|
|
31
|
+
try {
|
|
32
|
+
const historyDir = join(artDir, HISTORY_DIR);
|
|
33
|
+
const buildsDir = join(historyDir, 'builds');
|
|
34
|
+
if (!(await isRealDirectory(historyDir)))
|
|
35
|
+
return null;
|
|
36
|
+
if (!(await isRealDirectory(buildsDir)))
|
|
37
|
+
return null;
|
|
38
|
+
const marker = await readPrivateFile(join(historyDir, 'latest'));
|
|
39
|
+
if (marker === null)
|
|
40
|
+
return null;
|
|
41
|
+
const markerText = marker.toString('utf8');
|
|
42
|
+
if (!/^[1-9]\d{0,14}\n?$/.test(markerText))
|
|
43
|
+
return null;
|
|
44
|
+
const build = Number(markerText.endsWith('\n') ? markerText.slice(0, -1) : markerText);
|
|
45
|
+
const dir = join(buildsDir, String(build));
|
|
46
|
+
if (!(await isRealDirectory(dir)))
|
|
47
|
+
return null;
|
|
48
|
+
if (!(await isRealDirectory(join(dir, OUTPUTS_DIR))))
|
|
49
|
+
return null;
|
|
50
|
+
const manifestBytes = await readPrivateFile(join(dir, 'manifest.json'));
|
|
51
|
+
if (manifestBytes === null)
|
|
52
|
+
return null;
|
|
53
|
+
const manifest = parseManifest(JSON.parse(manifestBytes.toString('utf8')));
|
|
54
|
+
if (manifest === null)
|
|
55
|
+
return null;
|
|
56
|
+
const source = await readPrivateFile(join(dir, SOURCE_COPY));
|
|
57
|
+
if (source === null || hashBytes(source) !== manifest.source.hash)
|
|
58
|
+
return null;
|
|
59
|
+
for (let index = 0; index < manifest.steps.length; index++) {
|
|
60
|
+
const copy = await readPrivateFile(join(dir, OUTPUTS_DIR, String(index)));
|
|
61
|
+
if (copy === null || hashBytes(copy) !== manifest.steps[index].output) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { build, dir, manifest };
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Re-verifies the recorded chained input immediately before Update mode uses
|
|
73
|
+
* it. Step zero reads the source copy; later steps read the prior output copy.
|
|
74
|
+
*/
|
|
75
|
+
export async function verifiedInput(history, stepIndex, expected) {
|
|
76
|
+
if (!Number.isSafeInteger(stepIndex) || stepIndex < 0)
|
|
77
|
+
return null;
|
|
78
|
+
const path = stepIndex === 0
|
|
79
|
+
? join(history.dir, SOURCE_COPY)
|
|
80
|
+
: outputCopyPath(history, stepIndex - 1);
|
|
81
|
+
const bytes = await readPrivateFile(path);
|
|
82
|
+
return bytes !== null && hashBytes(bytes) === expected
|
|
83
|
+
? { path, bytes }
|
|
84
|
+
: null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Removes the active marker before the first executor may write. A valid
|
|
88
|
+
* active marker must be removable; malformed advisory state is never followed.
|
|
89
|
+
*/
|
|
90
|
+
export async function invalidateBuildHistory(artDir, active) {
|
|
91
|
+
const historyDir = join(artDir, HISTORY_DIR);
|
|
92
|
+
if (!(await isRealDirectory(historyDir))) {
|
|
93
|
+
if (active)
|
|
94
|
+
throw new Error('active build history directory is unavailable');
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
await unlink(join(historyDir, 'latest'));
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (isAbsentPathError(error))
|
|
102
|
+
return;
|
|
103
|
+
if (active)
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Publishes one complete snapshot and commits its number last. Callers pass
|
|
109
|
+
* already-materialized source/output bytes, so publication never follows a
|
|
110
|
+
* live phase target.
|
|
111
|
+
*/
|
|
112
|
+
export async function recordBuild(opts) {
|
|
113
|
+
if (opts.steps.length === 0)
|
|
114
|
+
throw new Error('cannot record an empty build');
|
|
115
|
+
const historyDir = join(opts.artDir, HISTORY_DIR);
|
|
116
|
+
const buildsDir = join(historyDir, 'builds');
|
|
117
|
+
await ensureRealDirectory(historyDir);
|
|
118
|
+
await ensureRealDirectory(buildsDir);
|
|
119
|
+
let next = 1;
|
|
120
|
+
for (const entry of await readdir(buildsDir)) {
|
|
121
|
+
if (BUILD_NUMBER.test(entry))
|
|
122
|
+
next = Math.max(next, Number(entry) + 1);
|
|
123
|
+
}
|
|
124
|
+
let dir = null;
|
|
125
|
+
while (next <= MAX_BUILD_NUMBER) {
|
|
126
|
+
const candidate = join(buildsDir, String(next));
|
|
127
|
+
try {
|
|
128
|
+
await mkdir(candidate, { mode: PRIVATE_DIRECTORY_MODE });
|
|
129
|
+
dir = candidate;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
if (errorCode(error) !== 'EEXIST')
|
|
134
|
+
throw error;
|
|
135
|
+
next++;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (dir === null)
|
|
139
|
+
throw new Error('build history number space is exhausted');
|
|
140
|
+
await mkdir(join(dir, OUTPUTS_DIR), { mode: PRIVATE_DIRECTORY_MODE });
|
|
141
|
+
await writeFile(join(dir, SOURCE_COPY), opts.sourceBytes, {
|
|
142
|
+
flag: 'wx',
|
|
143
|
+
mode: PRIVATE_FILE_MODE,
|
|
144
|
+
});
|
|
145
|
+
const steps = [];
|
|
146
|
+
for (let index = 0; index < opts.steps.length; index++) {
|
|
147
|
+
const step = opts.steps[index];
|
|
148
|
+
if (hashBytes(step.bytes) !== step.output) {
|
|
149
|
+
throw new Error(`accepted output changed before recording: ${step.target}`);
|
|
150
|
+
}
|
|
151
|
+
const target = encodeLocator(opts.artDir, step.target);
|
|
152
|
+
if (!isConfinedLocator(target)) {
|
|
153
|
+
throw new Error(`phase target is outside the artifact directory: ${step.target}`);
|
|
154
|
+
}
|
|
155
|
+
await writeFile(join(dir, OUTPUTS_DIR, String(index)), step.bytes, {
|
|
156
|
+
flag: 'wx',
|
|
157
|
+
mode: PRIVATE_FILE_MODE,
|
|
158
|
+
});
|
|
159
|
+
steps.push({
|
|
160
|
+
kind: step.kind,
|
|
161
|
+
name: step.name,
|
|
162
|
+
target,
|
|
163
|
+
inputs: [...step.inputs],
|
|
164
|
+
output: step.output,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const sourcePath = encodeLocator(opts.artDir, opts.sourcePath);
|
|
168
|
+
if (!isLocator(sourcePath)) {
|
|
169
|
+
throw new Error(`invalid source locator: ${opts.sourcePath}`);
|
|
170
|
+
}
|
|
171
|
+
const manifest = {
|
|
172
|
+
schema: BUILD_MANIFEST_SCHEMA,
|
|
173
|
+
pipeline: opts.pipeline,
|
|
174
|
+
source: { path: sourcePath, hash: hashBytes(opts.sourceBytes) },
|
|
175
|
+
steps,
|
|
176
|
+
};
|
|
177
|
+
await writeFile(join(dir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`, { flag: 'wx', mode: PRIVATE_FILE_MODE });
|
|
178
|
+
const marker = join(historyDir, `latest.${process.pid}.${randomUUID()}`);
|
|
179
|
+
try {
|
|
180
|
+
await writeFile(marker, `${next}\n`, {
|
|
181
|
+
flag: 'wx',
|
|
182
|
+
mode: PRIVATE_FILE_MODE,
|
|
183
|
+
});
|
|
184
|
+
await rename(marker, join(historyDir, 'latest'));
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
try {
|
|
188
|
+
await unlink(marker);
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
// The temporary marker may not have been created or may already be gone.
|
|
192
|
+
}
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async function ensureRealDirectory(path) {
|
|
197
|
+
try {
|
|
198
|
+
await mkdir(path, { mode: PRIVATE_DIRECTORY_MODE });
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
if (errorCode(error) !== 'EEXIST')
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
if (!(await isRealDirectory(path))) {
|
|
205
|
+
throw new Error(`build history path is not a real directory: ${path}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async function isRealDirectory(path) {
|
|
209
|
+
try {
|
|
210
|
+
return (await lstat(path)).isDirectory();
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
async function readPrivateFile(path) {
|
|
217
|
+
let handle;
|
|
218
|
+
try {
|
|
219
|
+
handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
220
|
+
const info = await handle.stat();
|
|
221
|
+
if (!info.isFile() || info.nlink !== 1)
|
|
222
|
+
return null;
|
|
223
|
+
return await handle.readFile();
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
await handle?.close();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function parseManifest(value) {
|
|
233
|
+
if (!exactRecord(value, ['schema', 'pipeline', 'source', 'steps']))
|
|
234
|
+
return null;
|
|
235
|
+
if (value.schema !== BUILD_MANIFEST_SCHEMA)
|
|
236
|
+
return null;
|
|
237
|
+
if (typeof value.pipeline !== 'string' || value.pipeline.length === 0)
|
|
238
|
+
return null;
|
|
239
|
+
if (!exactRecord(value.source, ['path', 'hash']))
|
|
240
|
+
return null;
|
|
241
|
+
if (!isLocator(value.source.path) || !isRecordedHash(value.source.hash)) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
if (!Array.isArray(value.steps) || value.steps.length === 0)
|
|
245
|
+
return null;
|
|
246
|
+
const seenTargets = new Set();
|
|
247
|
+
const steps = [];
|
|
248
|
+
for (const item of value.steps) {
|
|
249
|
+
if (!exactRecord(item, ['kind', 'name', 'target', 'inputs', 'output'])) {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
if (item.kind !== 'compile' && item.kind !== 'link')
|
|
253
|
+
return null;
|
|
254
|
+
if (typeof item.name !== 'string' || item.name.length === 0)
|
|
255
|
+
return null;
|
|
256
|
+
if (!isConfinedLocator(item.target) || seenTargets.has(item.target))
|
|
257
|
+
return null;
|
|
258
|
+
seenTargets.add(item.target);
|
|
259
|
+
if (!Array.isArray(item.inputs) || item.inputs.length === 0)
|
|
260
|
+
return null;
|
|
261
|
+
const inputs = [];
|
|
262
|
+
for (const input of item.inputs) {
|
|
263
|
+
if (!isRecordedHash(input))
|
|
264
|
+
return null;
|
|
265
|
+
inputs.push(input);
|
|
266
|
+
}
|
|
267
|
+
if (!isRecordedHash(item.output))
|
|
268
|
+
return null;
|
|
269
|
+
steps.push({
|
|
270
|
+
kind: item.kind,
|
|
271
|
+
name: item.name,
|
|
272
|
+
target: item.target,
|
|
273
|
+
inputs,
|
|
274
|
+
output: item.output,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
schema: BUILD_MANIFEST_SCHEMA,
|
|
279
|
+
pipeline: value.pipeline,
|
|
280
|
+
source: { path: value.source.path, hash: value.source.hash },
|
|
281
|
+
steps,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function exactRecord(value, keys) {
|
|
285
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
const actual = Object.keys(value).sort();
|
|
289
|
+
const expected = [...keys].sort();
|
|
290
|
+
return (actual.length === expected.length &&
|
|
291
|
+
actual.every((key, index) => key === expected[index]));
|
|
292
|
+
}
|
|
293
|
+
function isRecordedHash(value) {
|
|
294
|
+
return typeof value === 'string' && isHash(value);
|
|
295
|
+
}
|
|
296
|
+
function isLocator(value) {
|
|
297
|
+
if (typeof value !== 'string' ||
|
|
298
|
+
value.length === 0 ||
|
|
299
|
+
value.includes('\\') ||
|
|
300
|
+
value.includes('\0') ||
|
|
301
|
+
isAbsolute(value)) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
return value.split('/').every((part) => part.length > 0 && part !== '.');
|
|
305
|
+
}
|
|
306
|
+
function isConfinedLocator(value) {
|
|
307
|
+
return isLocator(value) && !value.split('/').includes('..');
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=build-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-history.js","sourceRoot":"","sources":["../src/build-history.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AAE1E,uEAAuE;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAa,MAAM,WAAW,CAAC;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC;AAClC,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAC7C,MAAM,YAAY,GAAG,iBAAiB,CAAC;AACvC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AACrC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AA6ChC,mEAAmE;AACnE,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,IAAY;IACxD,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrD,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,cAAc,CAAC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AG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;QACjC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACpB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACpB,UAAU,CAAC,KAAK,CAAC,EACjB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* becomes the process exit status (CLI-11). All behavior lives in the testable
|
|
11
11
|
* `run`/`interruptSignal`; see app.ts.
|
|
12
12
|
*/
|
|
13
|
+
import { messageOf } from './errors.js';
|
|
13
14
|
import { interruptSignal, run } from './index.js';
|
|
14
15
|
const { signal, dispose } = interruptSignal(process);
|
|
15
16
|
run(process.argv.slice(2), { signal })
|
|
@@ -19,7 +20,7 @@ run(process.argv.slice(2), { signal })
|
|
|
19
20
|
})
|
|
20
21
|
.catch((error) => {
|
|
21
22
|
dispose();
|
|
22
|
-
const message =
|
|
23
|
+
const message = messageOf(error);
|
|
23
24
|
process.stderr.write(`slc: ${message}\n`);
|
|
24
25
|
process.exit(1);
|
|
25
26
|
});
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,sCAAsC;AACtC,0EAA0E;AAE1E;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAErD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC;KACnC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;IACb,OAAO,EAAE,CAAC;IACV,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,OAAO,EAAE,CAAC;IACV,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,sCAAsC;AACtC,0EAA0E;AAE1E;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAErD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC;KACnC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;IACb,OAAO,EAAE,CAAC;IACV,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,OAAO,EAAE,CAAC;IACV,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,OAAO,IAAI,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/cligent-agent.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { AgentAdapter, PermissionPolicy } from '@sublang/cligent';
|
|
2
2
|
import type { AgentClient } from './interpreter.js';
|
|
3
|
+
/** Timer seams for the stall watchdog; injected in tests. */
|
|
4
|
+
export interface WatchdogTimers {
|
|
5
|
+
setTimeout(callback: () => void, ms: number): unknown;
|
|
6
|
+
clearTimeout(handle: unknown): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The production watchdog timers. Exported so a test can assert the ref
|
|
10
|
+
* behavior the watchdog's correctness depends on, which an injected fake
|
|
11
|
+
* would bypass.
|
|
12
|
+
*/
|
|
13
|
+
export declare const defaultWatchdogTimers: WatchdogTimers;
|
|
3
14
|
/** Wraps a Cligent adapter as an {@link AgentClient} for the interpreter. */
|
|
4
15
|
export declare function createCligentAgent(opts: {
|
|
5
16
|
adapter: AgentAdapter;
|
|
@@ -7,5 +18,13 @@ export declare function createCligentAgent(opts: {
|
|
|
7
18
|
permissions?: PermissionPolicy;
|
|
8
19
|
/** Adapter-scoped reasoning effort, validated by the configuration layer. */
|
|
9
20
|
effort?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Milliseconds of adapter-event inactivity after which the in-flight call is
|
|
23
|
+
* aborted and reported as an error (DR-019, PHEXEC-36). Zero or absent
|
|
24
|
+
* disables the watchdog.
|
|
25
|
+
*/
|
|
26
|
+
stallTimeoutMs?: number;
|
|
27
|
+
/** Watchdog timer seams; defaults to real timers. Injected in tests. */
|
|
28
|
+
watchdogTimers?: WatchdogTimers;
|
|
10
29
|
}): AgentClient;
|
|
11
30
|
//# sourceMappingURL=cligent-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cligent-agent.d.ts","sourceRoot":"","sources":["../src/cligent-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cligent-agent.d.ts","sourceRoot":"","sources":["../src/cligent-agent.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,YAAY,EAGZ,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAGpE,6DAA6D;AAC7D,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,cASnC,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,WAAW,CAiFd"}
|
package/dist/cligent-agent.js
CHANGED
|
@@ -7,11 +7,36 @@
|
|
|
7
7
|
* draining its event stream into a normalized {@link AgentRunResult}. The host
|
|
8
8
|
* supplies the concrete `AgentAdapter` (e.g. Claude Code, Codex) and any write
|
|
9
9
|
* permissions, keeping agent selection a configuration concern (PHEXEC-13); the
|
|
10
|
-
* DR-003 write-scope sandbox would be configured here via `permissions`.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* DR-003 write-scope sandbox would be configured here via `permissions`.
|
|
11
|
+
*
|
|
12
|
+
* The transport also owns the agent-stall watchdog (DR-019, PHEXEC-36): with a
|
|
13
|
+
* positive `stallTimeoutMs`, an in-flight call that observes no adapter event
|
|
14
|
+
* for that window is aborted through a call-local controller — the caller's
|
|
15
|
+
* signal is composed in, never mutated — and reported as an error carrying the
|
|
16
|
+
* inactivity duration. Cligent's abort drain guarantees the event loop then
|
|
17
|
+
* terminates promptly with a terminal event, so a tripped watchdog cannot
|
|
18
|
+
* itself hang. No retry occurs at this seam (PHEXEC-12, PHEXEC-23).
|
|
19
|
+
*
|
|
20
|
+
* This transport is exercised by integration runs and by tests that fake the
|
|
21
|
+
* adapter's event stream. See specs/dev/phase-execution.md.
|
|
13
22
|
*/
|
|
14
23
|
import { Cligent } from '@sublang/cligent';
|
|
24
|
+
import { formatElapsed } from './progress.js';
|
|
25
|
+
/**
|
|
26
|
+
* The production watchdog timers. Exported so a test can assert the ref
|
|
27
|
+
* behavior the watchdog's correctness depends on, which an injected fake
|
|
28
|
+
* would bypass.
|
|
29
|
+
*/
|
|
30
|
+
export const defaultWatchdogTimers = {
|
|
31
|
+
// Deliberately referenced: the watchdog is the only thing guaranteed to end
|
|
32
|
+
// a stalled call, so it must hold the event loop open for its window. An
|
|
33
|
+
// unref'd timer lets Node exit the moment a dead agent transport stops
|
|
34
|
+
// holding I/O, killing the run before the stall is ever diagnosed. The
|
|
35
|
+
// timer is cleared on every event and in `dispose`, so it cannot outlive
|
|
36
|
+
// the call it guards.
|
|
37
|
+
setTimeout: (callback, ms) => setTimeout(callback, ms),
|
|
38
|
+
clearTimeout: (handle) => clearTimeout(handle),
|
|
39
|
+
};
|
|
15
40
|
/** Wraps a Cligent adapter as an {@link AgentClient} for the interpreter. */
|
|
16
41
|
export function createCligentAgent(opts) {
|
|
17
42
|
const cligent = new Cligent(opts.adapter, {
|
|
@@ -20,41 +45,66 @@ export function createCligentAgent(opts) {
|
|
|
20
45
|
// Validated adapter-scoped by the configuration layer (CLI-12).
|
|
21
46
|
...(opts.effort !== undefined ? { effort: opts.effort } : {}),
|
|
22
47
|
});
|
|
48
|
+
const stallMs = opts.stallTimeoutMs ?? 0;
|
|
49
|
+
const timers = opts.watchdogTimers ?? defaultWatchdogTimers;
|
|
23
50
|
return {
|
|
24
51
|
async run({ prompt, cwd, model, resume, allowedTools, signal, }) {
|
|
52
|
+
const watchdog = createWatchdog(signal, stallMs, timers);
|
|
25
53
|
const texts = [];
|
|
26
54
|
let resultText = '';
|
|
27
55
|
let status = 'incomplete';
|
|
28
56
|
let resumeToken;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
try {
|
|
58
|
+
for await (const raw of cligent.run(prompt, {
|
|
59
|
+
abortSignal: watchdog.signal,
|
|
60
|
+
cwd,
|
|
61
|
+
model,
|
|
62
|
+
...(resume !== undefined ? { resume } : {}),
|
|
63
|
+
...(allowedTools !== undefined
|
|
64
|
+
? { allowedTools: [...allowedTools] }
|
|
65
|
+
: {}),
|
|
66
|
+
})) {
|
|
67
|
+
// Any adapter event is activity, regardless of type: the reliable
|
|
68
|
+
// event subset differs per adapter, so the watchdog resets on every
|
|
69
|
+
// iteration (DR-019).
|
|
70
|
+
watchdog.touch();
|
|
71
|
+
const event = raw;
|
|
72
|
+
if (event.type === 'text') {
|
|
73
|
+
texts.push(event.payload.content);
|
|
74
|
+
}
|
|
75
|
+
else if (event.type === 'error') {
|
|
76
|
+
status = 'error';
|
|
77
|
+
texts.push(event.payload.message);
|
|
78
|
+
}
|
|
79
|
+
else if (event.type === 'done') {
|
|
80
|
+
status =
|
|
81
|
+
event.payload.status === 'success'
|
|
82
|
+
? 'success'
|
|
83
|
+
: event.payload.status === 'error'
|
|
84
|
+
? 'error'
|
|
85
|
+
: 'incomplete';
|
|
86
|
+
if (event.payload.result)
|
|
87
|
+
resultText = event.payload.result;
|
|
88
|
+
resumeToken = event.payload.resumeToken;
|
|
89
|
+
}
|
|
56
90
|
}
|
|
57
91
|
}
|
|
92
|
+
finally {
|
|
93
|
+
watchdog.dispose();
|
|
94
|
+
}
|
|
95
|
+
// A real success that lands inside Cligent's post-abort drain wins over
|
|
96
|
+
// the stall verdict: the call did complete, and reporting a hang would
|
|
97
|
+
// discard a finished phase — the expensive false negative this watchdog
|
|
98
|
+
// exists to avoid causing. A genuine stall drains to `interrupted`, so
|
|
99
|
+
// this never softens a real hang.
|
|
100
|
+
if (watchdog.tripped && status !== 'success') {
|
|
101
|
+
return {
|
|
102
|
+
status: 'error',
|
|
103
|
+
text: `agent call stalled: no agent activity for ${formatElapsed(stallMs)}; ` +
|
|
104
|
+
'aborted by the stall watchdog (SLC_STALL_TIMEOUT / stallTimeout)',
|
|
105
|
+
...(resumeToken !== undefined ? { resumeToken } : {}),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
58
108
|
return {
|
|
59
109
|
status,
|
|
60
110
|
text: (resultText || texts.join('\n')).trim(),
|
|
@@ -63,4 +113,49 @@ export function createCligentAgent(opts) {
|
|
|
63
113
|
},
|
|
64
114
|
};
|
|
65
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Builds the watchdog for one call: a call-local controller composed with the
|
|
118
|
+
* caller's signal, plus a single reset-on-activity timeout (DR-019). With a
|
|
119
|
+
* non-positive window the caller's signal passes through untouched.
|
|
120
|
+
*/
|
|
121
|
+
function createWatchdog(signal, stallMs, timers) {
|
|
122
|
+
if (stallMs <= 0) {
|
|
123
|
+
return {
|
|
124
|
+
signal,
|
|
125
|
+
touch: () => { },
|
|
126
|
+
tripped: false,
|
|
127
|
+
dispose: () => { },
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const controller = new AbortController();
|
|
131
|
+
let tripped = false;
|
|
132
|
+
let handle;
|
|
133
|
+
const onCallerAbort = () => controller.abort(signal.reason);
|
|
134
|
+
if (signal.aborted) {
|
|
135
|
+
controller.abort(signal.reason);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
signal.addEventListener('abort', onCallerAbort, { once: true });
|
|
139
|
+
}
|
|
140
|
+
const arm = () => timers.setTimeout(() => {
|
|
141
|
+
tripped = true;
|
|
142
|
+
controller.abort(new Error(`agent call stalled for ${formatElapsed(stallMs)}`));
|
|
143
|
+
}, stallMs);
|
|
144
|
+
handle = arm();
|
|
145
|
+
return {
|
|
146
|
+
signal: controller.signal,
|
|
147
|
+
touch: () => {
|
|
148
|
+
timers.clearTimeout(handle);
|
|
149
|
+
if (!tripped && !controller.signal.aborted)
|
|
150
|
+
handle = arm();
|
|
151
|
+
},
|
|
152
|
+
get tripped() {
|
|
153
|
+
return tripped;
|
|
154
|
+
},
|
|
155
|
+
dispose: () => {
|
|
156
|
+
timers.clearTimeout(handle);
|
|
157
|
+
signal.removeEventListener('abort', onCallerAbort);
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
66
161
|
//# sourceMappingURL=cligent-agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cligent-agent.js","sourceRoot":"","sources":["../src/cligent-agent.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AAE1E
|
|
1
|
+
{"version":3,"file":"cligent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
|
2
2
|
import type { AgentClient } from './interpreter.js';
|
|
3
3
|
import { type CompatiblePlaybookRuntimeFactory, type RuntimeContractProfile } from './playbook-contract.js';
|
|
4
4
|
import { type PlayerTransport } from './playbook-ports.js';
|
|
@@ -32,6 +32,12 @@ export declare function createCompiledExecutor(opts: {
|
|
|
32
32
|
cwd?: string;
|
|
33
33
|
/** Stable authored phase identity used as the Playbook session's playbook id. */
|
|
34
34
|
playbookId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Live status sink (DR-019, PHEXEC-25): streams the runtime's human status
|
|
37
|
+
* and non-trace telemetry as it occurs; absent hosts keep the drained
|
|
38
|
+
* end-of-run diagnostics.
|
|
39
|
+
*/
|
|
40
|
+
onStatus?: (line: string) => void;
|
|
35
41
|
/** Session-id seam for deterministic tests; defaults to {@link randomUUID}. */
|
|
36
42
|
createSessionId?: () => string;
|
|
37
43
|
/** Exact pinned runtime boundary; defaults to the current legacy contract. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiled-executor.d.ts","sourceRoot":"","sources":["../src/compiled-executor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compiled-executor.d.ts","sourceRoot":"","sources":["../src/compiled-executor.ts"],"names":[],"mappings":"AAuCA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAOpD,OAAO,EAKL,KAAK,gCAAgC,EAKrC,KAAK,sBAAsB,EAE5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEhF;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,gCAAgC,CAAC,CAW3C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,MAAM,EAAE,eAAe,CAAC;IACxB,oEAAoE;IACpE,KAAK,EAAE,WAAW,CAAC;IACnB,sEAAsE;IACtE,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,+EAA+E;IAC/E,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;IAC/B,8EAA8E;IAC9E,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,4DAA4D;IAC5D,WAAW,CAAC,EAAE,CACZ,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC,gCAAgC,CAAC,CAAC;CAChD,GAAG,aAAa,CA2EhB"}
|
|
@@ -31,6 +31,8 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
31
31
|
import { readFile, stat } from 'node:fs/promises';
|
|
32
32
|
import { basename, resolve } from 'node:path';
|
|
33
33
|
import { pathToFileURL } from 'node:url';
|
|
34
|
+
import { messageOf } from './errors.js';
|
|
35
|
+
import { updateContextLines, } from './execution.js';
|
|
34
36
|
import { composeWorkspaceContract, mapPhaseResult, seedPhaseTurn, } from './phase-runner.js';
|
|
35
37
|
import { isPlaybookRunResult, } from './playbook-contract.js';
|
|
36
38
|
import { createPlaybookPorts } from './playbook-ports.js';
|
|
@@ -70,6 +72,15 @@ export function createCompiledExecutor(opts) {
|
|
|
70
72
|
// transported prompt carries the request's absolute paths and
|
|
71
73
|
// write-scope rules (PHEXEC-34).
|
|
72
74
|
captainWorkspace: composeWorkspaceContract(input),
|
|
75
|
+
// The compiled artifact knows nothing about incremental updates, so
|
|
76
|
+
// the host appends the update context to performing prompts
|
|
77
|
+
// (DR-021, INCR-16).
|
|
78
|
+
...(request.kind === 'compile' && request.update !== undefined
|
|
79
|
+
? {
|
|
80
|
+
updateContext: updateContextLines(request.update, request.target).join('\n'),
|
|
81
|
+
}
|
|
82
|
+
: {}),
|
|
83
|
+
onStatus: opts.onStatus,
|
|
73
84
|
});
|
|
74
85
|
// Hand the runtime only Playbook's ports — never the host-only
|
|
75
86
|
// drainDiagnostics, nor a file capability (DR-005, PHEXEC-23).
|
|
@@ -427,7 +438,4 @@ function phaseInput(request, runRoot) {
|
|
|
427
438
|
function optionsRecord(options) {
|
|
428
439
|
return Object.fromEntries(options.map((option) => [option.name, option.value]));
|
|
429
440
|
}
|
|
430
|
-
function messageOf(error) {
|
|
431
|
-
return error instanceof Error ? error.message : String(error);
|
|
432
|
-
}
|
|
433
441
|
//# sourceMappingURL=compiled-executor.js.map
|