@nyte-ai/core 0.0.19 → 0.0.23
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/chunks/{compose-xaegezm3.js → compose-1tdb9ezw.js} +17 -18
- package/dist/chunks/{compose-5489evqa.js → compose-1xn3eecn.js} +29 -29
- package/dist/chunks/{compose-s5522cth.js → compose-2gsbcjgv.js} +12 -12
- package/dist/chunks/{compose-57j0pme0.js → compose-2rha31fc.js} +3 -3
- package/dist/chunks/{compose-m1ecjzm2.js → compose-42egt9y7.js} +7 -7
- package/dist/chunks/{compose-qknd62yj.js → compose-4ppmas7g.js} +2 -2
- package/dist/chunks/{compose-z6hbq6y0.js → compose-5njywhy8.js} +4 -4
- package/dist/chunks/{compose-h3pch7ch.js → compose-8pp3vtv0.js} +2 -2
- package/dist/chunks/{compose-tb5ywdfk.js → compose-917xy085.js} +13 -8
- package/dist/chunks/{compose-q1d09qpr.js → compose-97y00axn.js} +6 -6
- package/dist/chunks/{compose-q1rrtq3a.js → compose-9jvn2wvh.js} +140 -31
- package/dist/chunks/{compose-jrqn6xhy.js → compose-a40dnhy5.js} +5 -5
- package/dist/chunks/{compose-rd5e5nxg.js → compose-ad80nkkn.js} +1 -1
- package/dist/chunks/{compose-r1pxdxbw.js → compose-ae5t6v5b.js} +2 -2
- package/dist/chunks/{compose-hf6xkwdw.js → compose-ay7t13m9.js} +6 -6
- package/dist/chunks/{compose-pnsvwd3m.js → compose-bbhk8vnr.js} +1 -1
- package/dist/chunks/{compose-eemt6sea.js → compose-byse0eqj.js} +3 -3
- package/dist/chunks/{compose-ks2rdteq.js → compose-bz70g01d.js} +2 -2
- package/dist/chunks/{compose-mamr4qwf.js → compose-c4z4kp98.js} +77 -22
- package/dist/chunks/{compose-0827b2k4.js → compose-c9wxgbjp.js} +1 -1
- package/dist/chunks/{compose-c2rnebv0.js → compose-d95fwwvw.js} +1 -1
- package/dist/chunks/{compose-gxvetm0j.js → compose-ee0h1pk1.js} +3 -3
- package/dist/chunks/{compose-4770pb1s.js → compose-enq3x3rq.js} +3 -3
- package/dist/chunks/{compose-prchdrqk.js → compose-fnncnk81.js} +3 -3
- package/dist/chunks/{compose-bjx8s01m.js → compose-fqsqjbrf.js} +1 -1
- package/dist/chunks/{compose-v9yf9mrh.js → compose-gj2ypr7q.js} +2 -2
- package/dist/chunks/{compose-zch4zapc.js → compose-hfrjm4a1.js} +1 -1
- package/dist/chunks/{compose-w2ac7xjx.js → compose-hfsn6pnt.js} +1 -1
- package/dist/chunks/{compose-6m60v1pk.js → compose-ht1tbyr3.js} +3 -3
- package/dist/chunks/{compose-31zqcfte.js → compose-jeemzja1.js} +2 -2
- package/dist/chunks/{compose-jhs91x01.js → compose-jwy1gba9.js} +1 -1
- package/dist/chunks/{compose-se7wwcq1.js → compose-m01wspwf.js} +1 -1
- package/dist/chunks/{compose-n93897b0.js → compose-m91ffwss.js} +1 -1
- package/dist/chunks/{compose-47f47sgy.js → compose-matk94se.js} +4 -4
- package/dist/chunks/{compose-hms4hf6p.js → compose-mcz93154.js} +63 -47
- package/dist/chunks/{compose-exfx5b4d.js → compose-mdwr0er9.js} +2 -2
- package/dist/chunks/{compose-y9c31w4e.js → compose-nkxwrphm.js} +30 -13
- package/dist/chunks/{compose-seyhq3fb.js → compose-nw5hdpxk.js} +6 -6
- package/dist/chunks/{compose-1g03zpvn.js → compose-qjxtbzgq.js} +5 -5
- package/dist/chunks/{compose-jehg40ce.js → compose-qxfq6dn9.js} +5 -5
- package/dist/chunks/{compose-azq5jxr2.js → compose-r8tz1xfj.js} +4 -4
- package/dist/chunks/{compose-ccrh32hd.js → compose-sprfv38c.js} +2 -2
- package/dist/chunks/{compose-pe0cgbv0.js → compose-t9fcqtby.js} +4 -4
- package/dist/chunks/{compose-g2a1f1yx.js → compose-tppkp915.js} +2 -2
- package/dist/chunks/{compose-5cmp34zp.js → compose-v46qmh60.js} +11 -11
- package/dist/chunks/{compose-gvrqkyn4.js → compose-w6zb11k1.js} +3 -3
- package/dist/chunks/{compose-m6nsbnkk.js → compose-xvbyp65f.js} +5 -5
- package/dist/chunks/compose-yfcb6w2h.js +58 -0
- package/dist/chunks/{compose-54svedb8.js → compose-yr19b453.js} +7 -7
- package/dist/chunks/{compose-0rx7ygxq.js → compose-zaanjpb7.js} +1 -1
- package/dist/src/agent/compaction.js +23 -23
- package/dist/src/agent/request.js +14 -14
- package/dist/src/agent/tool-runner.d.ts +2 -0
- package/dist/src/agent/tool-runner.js +18 -15
- package/dist/src/agent/transcript.js +20 -20
- package/dist/src/agent/turn.js +28 -27
- package/dist/src/api/connection.js +41 -40
- package/dist/src/api/head.js +27 -26
- package/dist/src/api/part.js +8 -8
- package/dist/src/api/server.js +30 -29
- package/dist/src/api/session.js +33 -32
- package/dist/src/builtins/delegation.js +2 -2
- package/dist/src/builtins/environment.js +1 -2
- package/dist/src/compose.js +50 -49
- package/dist/src/contract/parts.d.ts +4 -0
- package/dist/src/contract/parts.js +1 -1
- package/dist/src/contract/tools.d.ts +10 -1
- package/dist/src/contract/workspace.d.ts +2 -0
- package/dist/src/drive/execution.js +28 -27
- package/dist/src/engine/admission.js +10 -10
- package/dist/src/engine/batches.js +8 -8
- package/dist/src/engine/branch-summary.js +7 -7
- package/dist/src/engine/durable.js +6 -6
- package/dist/src/engine/fence.js +6 -6
- package/dist/src/engine/jobs.d.ts +1 -0
- package/dist/src/engine/jobs.js +15 -13
- package/dist/src/engine/move.js +9 -9
- package/dist/src/engine/part-definitions.js +2 -2
- package/dist/src/engine/principals.js +5 -5
- package/dist/src/engine/receipts.js +7 -7
- package/dist/src/engine/runs.js +11 -11
- package/dist/src/engine/start.js +22 -21
- package/dist/src/engine/waits.js +5 -5
- package/dist/src/env/browser.js +13 -13
- package/dist/src/env/environment.js +15 -15
- package/dist/src/env/mcp.js +17 -17
- package/dist/src/env/session-changes.d.ts +10 -0
- package/dist/src/env/session-changes.js +15 -0
- package/dist/src/env/trust.js +16 -16
- package/dist/src/env/workspaces.js +20 -19
- package/dist/src/env/worktrees.js +21 -20
- package/dist/src/extend/activation.js +21 -20
- package/dist/src/extend/hooks.js +8 -8
- package/dist/src/extend/models.js +13 -13
- package/dist/src/extend/plugin-api.js +5 -5
- package/dist/src/extend/plugin-runtime.js +27 -26
- package/dist/src/extend/registry.js +12 -12
- package/dist/src/extend/resources.js +17 -17
- package/dist/src/extend/settings.js +23 -22
- package/dist/src/extend/workspace-commands.js +28 -27
- package/dist/src/fold/commit.js +4 -4
- package/dist/src/fold/seen.js +5 -5
- package/dist/src/fold/view.js +6 -6
- package/dist/src/fold/watch.js +3 -3
- package/dist/src/harness.d.ts +1 -0
- package/dist/src/harness.js +51 -50
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/server.js +49 -48
- package/dist/src/store/parts.js +2 -2
- package/dist/src/testing.js +52 -51
- package/package.json +6 -5
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
UnavailableError2,
|
|
7
7
|
readWorkspace2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-4ppmas7g.js";
|
|
9
9
|
import {
|
|
10
10
|
projectTrust2
|
|
11
|
-
} from "./compose-
|
|
11
|
+
} from "./compose-8pp3vtv0.js";
|
|
12
12
|
import {
|
|
13
13
|
settle2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-917xy085.js";
|
|
15
15
|
|
|
16
16
|
// src/extend/activation.ts
|
|
17
17
|
var ACTIVE = { kind: "active" };
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
signalsPark2,
|
|
12
12
|
runStep2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-byse0eqj.js";
|
|
14
14
|
import {
|
|
15
15
|
stepPluginApi2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-c9wxgbjp.js";
|
|
17
17
|
|
|
18
18
|
// src/extend/hooks.ts
|
|
19
19
|
import { compile, JsonType, SdkError, SubmissionType, withJson } from "@nyte-ai/schema";
|
|
@@ -23,25 +23,25 @@ import {
|
|
|
23
23
|
} from "./compose-vn7b7fdj.js";
|
|
24
24
|
import {
|
|
25
25
|
commit2
|
|
26
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-bbhk8vnr.js";
|
|
27
27
|
import {
|
|
28
28
|
withFold2
|
|
29
29
|
} from "./compose-xhtgytrh.js";
|
|
30
30
|
import {
|
|
31
31
|
fence2,
|
|
32
32
|
finishFence2
|
|
33
|
-
} from "./compose-
|
|
33
|
+
} from "./compose-w6zb11k1.js";
|
|
34
34
|
import {
|
|
35
35
|
holdSummary2,
|
|
36
36
|
summaryHeld2,
|
|
37
37
|
summarizedMove2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-tppkp915.js";
|
|
39
39
|
import {
|
|
40
40
|
settleReceipt2,
|
|
41
41
|
reserve2,
|
|
42
42
|
known2,
|
|
43
43
|
typedReceipt2
|
|
44
|
-
} from "./compose-
|
|
44
|
+
} from "./compose-fnncnk81.js";
|
|
45
45
|
|
|
46
46
|
// src/engine/move.ts
|
|
47
47
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
@@ -7,51 +7,58 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
definePart2,
|
|
9
9
|
tool2
|
|
10
|
-
} from "./compose-
|
|
10
|
+
} from "./compose-fqsqjbrf.js";
|
|
11
11
|
import {
|
|
12
12
|
decodeRunRecord2,
|
|
13
13
|
decodePartRecord2
|
|
14
14
|
} from "./compose-gxjc6vz9.js";
|
|
15
|
+
import {
|
|
16
|
+
dev2
|
|
17
|
+
} from "./compose-n116fnmp.js";
|
|
15
18
|
import {
|
|
16
19
|
runRef2,
|
|
17
20
|
partRef2
|
|
18
21
|
} from "./compose-cqpjcx2t.js";
|
|
19
|
-
import {
|
|
20
|
-
dev2
|
|
21
|
-
} from "./compose-n116fnmp.js";
|
|
22
22
|
import {
|
|
23
23
|
STALE2,
|
|
24
24
|
load2,
|
|
25
25
|
requireSession2,
|
|
26
26
|
readTip2,
|
|
27
|
-
threadStart2,
|
|
28
27
|
readRefExpectation2,
|
|
29
28
|
put2,
|
|
30
29
|
attempt2,
|
|
31
30
|
readCall2,
|
|
32
31
|
readCalls2
|
|
33
32
|
} from "./compose-vn7b7fdj.js";
|
|
33
|
+
import {
|
|
34
|
+
readAttributedPaths2,
|
|
35
|
+
ownedChanges2,
|
|
36
|
+
anotherChatLive2
|
|
37
|
+
} from "./compose-yfcb6w2h.js";
|
|
34
38
|
import {
|
|
35
39
|
settling2
|
|
36
|
-
} from "./compose-
|
|
40
|
+
} from "./compose-d95fwwvw.js";
|
|
37
41
|
import {
|
|
38
42
|
commit2
|
|
39
|
-
} from "./compose-
|
|
43
|
+
} from "./compose-bbhk8vnr.js";
|
|
40
44
|
import {
|
|
41
45
|
signalsPark2,
|
|
42
46
|
parkStep2,
|
|
43
47
|
runStep2
|
|
44
|
-
} from "./compose-
|
|
48
|
+
} from "./compose-byse0eqj.js";
|
|
49
|
+
import {
|
|
50
|
+
startJob2
|
|
51
|
+
} from "./compose-nkxwrphm.js";
|
|
45
52
|
import {
|
|
46
53
|
publishPatch2
|
|
47
|
-
} from "./compose-
|
|
54
|
+
} from "./compose-qxfq6dn9.js";
|
|
48
55
|
import {
|
|
49
56
|
hiddenOwners2,
|
|
50
57
|
missingCapabilities2
|
|
51
58
|
} from "./compose-bd8c5n7k.js";
|
|
52
59
|
import {
|
|
53
60
|
toolSource2
|
|
54
|
-
} from "./compose-
|
|
61
|
+
} from "./compose-ae5t6v5b.js";
|
|
55
62
|
|
|
56
63
|
// src/agent/tool-runner.ts
|
|
57
64
|
import { Type } from "typebox";
|
|
@@ -95,9 +102,10 @@ function runningCalls(kernel) {
|
|
|
95
102
|
async function executeCall2(kernel, input) {
|
|
96
103
|
const { session, call } = input;
|
|
97
104
|
const controller = new AbortController;
|
|
105
|
+
const running = { stop: controller, move: new AbortController };
|
|
98
106
|
const live = runningCalls(kernel);
|
|
99
107
|
const controllers = live.get(call) ?? new Set;
|
|
100
|
-
controllers.add(
|
|
108
|
+
controllers.add(running);
|
|
101
109
|
live.set(call, controllers);
|
|
102
110
|
const steps = await Promise.all([
|
|
103
111
|
readCall2(kernel.store, session, call),
|
|
@@ -108,10 +116,11 @@ async function executeCall2(kernel, input) {
|
|
|
108
116
|
try {
|
|
109
117
|
return await perform(kernel, {
|
|
110
118
|
...input,
|
|
111
|
-
signal: AbortSignal.any([input.signal, controller.signal])
|
|
119
|
+
signal: AbortSignal.any([input.signal, controller.signal]),
|
|
120
|
+
released: running.move.signal
|
|
112
121
|
});
|
|
113
122
|
} finally {
|
|
114
|
-
controllers.delete(
|
|
123
|
+
controllers.delete(running);
|
|
115
124
|
if (controllers.size === 0 && live.get(call) === controllers)
|
|
116
125
|
live.delete(call);
|
|
117
126
|
}
|
|
@@ -155,13 +164,20 @@ function stoppableTool2(kernel) {
|
|
|
155
164
|
async stop(_input, context) {
|
|
156
165
|
const running = runningCalls(kernel).get(context.part.id);
|
|
157
166
|
if (running !== undefined && running.size > 0) {
|
|
158
|
-
for (const
|
|
159
|
-
|
|
167
|
+
for (const live of running)
|
|
168
|
+
live.stop.abort();
|
|
160
169
|
return;
|
|
161
170
|
}
|
|
162
171
|
for (const call of [context.part.id, `${HOOK}${context.part.id}`])
|
|
163
172
|
await kernel.waits.callStopped(context.session, asId(call));
|
|
164
173
|
return;
|
|
174
|
+
},
|
|
175
|
+
background(_input, context) {
|
|
176
|
+
if (!kernel.jobs.release(context.session, asId(context.part.id)))
|
|
177
|
+
return;
|
|
178
|
+
for (const live of runningCalls(kernel).get(context.part.id) ?? [])
|
|
179
|
+
live.move.abort();
|
|
180
|
+
return;
|
|
165
181
|
}
|
|
166
182
|
};
|
|
167
183
|
return definePart2({
|
|
@@ -199,7 +215,7 @@ async function perform(kernel, where) {
|
|
|
199
215
|
return executed.outcome;
|
|
200
216
|
} : async () => planned.outcome,
|
|
201
217
|
async settle(ended) {
|
|
202
|
-
concluded ??= conclude(kernel, where, ended, before);
|
|
218
|
+
concluded ??= conclude(kernel, where, ended, before, planned.class);
|
|
203
219
|
const settled = await concluded;
|
|
204
220
|
return {
|
|
205
221
|
result: settled.outcome,
|
|
@@ -345,6 +361,7 @@ async function execute(kernel, where, planned, durable, snapshotted) {
|
|
|
345
361
|
call: where.call,
|
|
346
362
|
context: where.context,
|
|
347
363
|
signal,
|
|
364
|
+
released: where.released,
|
|
348
365
|
workspace: found.record.workspace,
|
|
349
366
|
env,
|
|
350
367
|
durable,
|
|
@@ -384,39 +401,29 @@ async function validateToolResult(definition, result) {
|
|
|
384
401
|
parts
|
|
385
402
|
};
|
|
386
403
|
}
|
|
387
|
-
async function conclude(kernel, where, ended, before) {
|
|
404
|
+
async function conclude(kernel, where, ended, before, toolClass) {
|
|
388
405
|
const { session, head, run } = where;
|
|
389
406
|
const outcome = await where.runtime.hooks.transform("after_tool", ended.kind === "done" ? ended.value : INTERRUPTED, { session, head, run, principal: where.context.principal });
|
|
390
407
|
const snapshots = before !== null && ended.kind === "done" ? await kernel.environments.snapshots(session) : null;
|
|
391
408
|
if (snapshots === null || before === null)
|
|
392
|
-
return { outcome, files: null, thread: null, snapshot: null };
|
|
393
|
-
const from = before.snapshot;
|
|
409
|
+
return { outcome, files: null, thread: null, snapshot: null, path: null, unattributed: false };
|
|
394
410
|
const to = await snapshots.after(run);
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
};
|
|
411
|
+
const [changed, path] = await Promise.all([
|
|
412
|
+
snapshots.diff(before.snapshot, to).then(fileChanges),
|
|
413
|
+
editedPath(kernel, session, toolClass)
|
|
414
|
+
]);
|
|
415
|
+
const unattributed = path === null && changed.length > 0 && (before.contended || await anotherChatLive2(kernel, session));
|
|
416
|
+
const files = unattributed ? [] : changed.filter((file) => path === null || file.path === path || file.from === path);
|
|
417
|
+
const thread = files.length === 0 && !unattributed ? null : fileChanges(await ownedChanges2(kernel.store, snapshots, session, to, files.map((file) => file.path)));
|
|
418
|
+
return { outcome, files, thread, snapshot: to, path, unattributed };
|
|
403
419
|
}
|
|
404
|
-
async function
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (event.seq <= through && event.kind === "call" && event.change === "settled" && event.head === where.head && event.call !== where.call)
|
|
412
|
-
for (const path of event.changes?.paths ?? [])
|
|
413
|
-
paths.add(path);
|
|
414
|
-
const last = events.at(-1);
|
|
415
|
-
if (last === undefined)
|
|
416
|
-
break;
|
|
417
|
-
cursor = last.seq;
|
|
418
|
-
}
|
|
419
|
-
return paths;
|
|
420
|
+
async function editedPath(kernel, session, toolClass) {
|
|
421
|
+
if (toolClass.kind !== "edit")
|
|
422
|
+
return null;
|
|
423
|
+
if (!/^(?:[\\/]|[A-Za-z]:)/.test(toolClass.path))
|
|
424
|
+
return toolClass.path.replace(/^\.\//, "");
|
|
425
|
+
const root = (await kernel.environments.attach(session)).cwd.replace(/[\\/]+$/, "");
|
|
426
|
+
return toolClass.path.startsWith(`${root}/`) || toolClass.path.startsWith(`${root}\\`) ? toolClass.path.slice(root.length + 1).replaceAll("\\", "/") : null;
|
|
420
427
|
}
|
|
421
428
|
function fileChanges(set) {
|
|
422
429
|
return set.files.map((file) => {
|
|
@@ -439,12 +446,13 @@ async function settlement(store, where, planned, settled, before) {
|
|
|
439
446
|
]);
|
|
440
447
|
if (found === null)
|
|
441
448
|
return [];
|
|
442
|
-
const counted = before === null ? new Set : await
|
|
449
|
+
const counted = before === null || settled.path !== null ? new Set : await readAttributedPaths2(store, session, before.seq, (event) => event.head === head && event.call !== call);
|
|
443
450
|
const files = settled.files?.filter((file) => !counted.has(file.path));
|
|
444
451
|
const changes = files === undefined ? null : {
|
|
445
452
|
added: files.reduce((sum, file) => sum + file.added, 0),
|
|
446
453
|
removed: files.reduce((sum, file) => sum + file.removed, 0),
|
|
447
|
-
paths: files.map((file) => file.path)
|
|
454
|
+
paths: files.map((file) => file.path),
|
|
455
|
+
...settled.unattributed && { unattributed: true }
|
|
448
456
|
};
|
|
449
457
|
const at = Date.now();
|
|
450
458
|
const state = {
|
|
@@ -499,7 +507,10 @@ async function baseline(kernel, session, run) {
|
|
|
499
507
|
if (snapshots === null)
|
|
500
508
|
return null;
|
|
501
509
|
const seq = await kernel.store.refs.tail(session);
|
|
502
|
-
const before = await
|
|
510
|
+
const [before, contended] = await Promise.all([
|
|
511
|
+
snapshots.after(run),
|
|
512
|
+
anotherChatLive2(kernel, session)
|
|
513
|
+
]);
|
|
503
514
|
await attempt2(`Recording run ${run}'s snapshot`, async () => {
|
|
504
515
|
const found = await load2(kernel.store, await kernel.store.refs.get(runRef2(session, run)), decodeRunRecord2);
|
|
505
516
|
if (found === null || found.record.snapshot !== null)
|
|
@@ -513,7 +524,7 @@ async function baseline(kernel, session, run) {
|
|
|
513
524
|
]);
|
|
514
525
|
return outcome.kind === "set" ? undefined : STALE2;
|
|
515
526
|
});
|
|
516
|
-
return { snapshot: before, seq };
|
|
527
|
+
return { snapshot: before, seq, contended };
|
|
517
528
|
}
|
|
518
529
|
async function nextBase(store, session, run, to) {
|
|
519
530
|
const found = await load2(store, await store.refs.get(runRef2(session, run)), decodeRunRecord2);
|
|
@@ -579,6 +590,11 @@ function createInvocation2(kernel, input) {
|
|
|
579
590
|
progress: update
|
|
580
591
|
});
|
|
581
592
|
},
|
|
593
|
+
foreground: {
|
|
594
|
+
start: (job) => startJob2(kernel, context.origin, input.workspace, { ...job, session }, true),
|
|
595
|
+
release: () => kernel.jobs.release(session, call),
|
|
596
|
+
released: input.released ?? new AbortController().signal
|
|
597
|
+
},
|
|
582
598
|
tools: {
|
|
583
599
|
async execute(name, args, options) {
|
|
584
600
|
const key = options?.key ?? `${calls}`;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./compose-bj54tkph.js";
|
|
11
11
|
import {
|
|
12
12
|
commit2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-bbhk8vnr.js";
|
|
14
14
|
import {
|
|
15
15
|
MODEL_PREFERENCE2,
|
|
16
16
|
modelListingRef2,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./compose-zfjxkavf.js";
|
|
26
26
|
import {
|
|
27
27
|
bumpGeneration2
|
|
28
|
-
} from "./compose-
|
|
28
|
+
} from "./compose-ae5t6v5b.js";
|
|
29
29
|
|
|
30
30
|
// src/extend/models.ts
|
|
31
31
|
import { SdkError } from "@nyte-ai/schema";
|
|
@@ -17,23 +17,27 @@ import {
|
|
|
17
17
|
readSession2,
|
|
18
18
|
put2
|
|
19
19
|
} from "./compose-vn7b7fdj.js";
|
|
20
|
+
import {
|
|
21
|
+
followedTrace2,
|
|
22
|
+
traceparent2
|
|
23
|
+
} from "./compose-sd0stm97.js";
|
|
20
24
|
import {
|
|
21
25
|
commit2
|
|
22
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-bbhk8vnr.js";
|
|
23
27
|
import {
|
|
24
28
|
closable2
|
|
25
29
|
} from "./compose-zfjxkavf.js";
|
|
26
30
|
import {
|
|
27
31
|
readJob2,
|
|
28
32
|
waitFor2
|
|
29
|
-
} from "./compose-
|
|
33
|
+
} from "./compose-bz70g01d.js";
|
|
30
34
|
import {
|
|
31
35
|
send2
|
|
32
|
-
} from "./compose-
|
|
36
|
+
} from "./compose-t9fcqtby.js";
|
|
33
37
|
import {
|
|
34
38
|
recordAcquisition2,
|
|
35
39
|
recordedAcquisition2
|
|
36
|
-
} from "./compose-
|
|
40
|
+
} from "./compose-byse0eqj.js";
|
|
37
41
|
|
|
38
42
|
// src/engine/jobs.ts
|
|
39
43
|
import { asId, asSeq, foldJobChange, SdkError } from "@nyte-ai/schema";
|
|
@@ -117,13 +121,19 @@ function createJobTable2(kernel) {
|
|
|
117
121
|
background: (session) => [...entries.values()].flatMap((entry) => {
|
|
118
122
|
const item = createJobBackgroundItem(entry);
|
|
119
123
|
return entry.owner?.session === session && item !== null ? [{ head: entry.owner.head, item }] : [];
|
|
120
|
-
})
|
|
124
|
+
}),
|
|
125
|
+
release(session, call) {
|
|
126
|
+
const started = [...entries.values()].filter((entry) => entry.owner?.session === session && entry.owner.startedBy === call && entry.view.state.kind === "running");
|
|
127
|
+
for (const entry of started)
|
|
128
|
+
entries.set(entry.view.id, { ...entry, held: false });
|
|
129
|
+
return started.length > 0;
|
|
130
|
+
}
|
|
121
131
|
};
|
|
122
132
|
}
|
|
123
133
|
function createJobs2(kernel, context, workspace) {
|
|
124
134
|
const views = () => kernel.jobs.list(workspace).map((entry) => entry.view);
|
|
125
135
|
return {
|
|
126
|
-
start: (input) =>
|
|
136
|
+
start: (input) => startJob2(kernel, context.origin, workspace, input),
|
|
127
137
|
async recover(key) {
|
|
128
138
|
const entry = kernel.jobs.byKey(key);
|
|
129
139
|
if (entry === undefined || entry.workspace !== workspace)
|
|
@@ -268,10 +278,11 @@ async function endJob(kernel, id, end) {
|
|
|
268
278
|
endedAt: Date.now(),
|
|
269
279
|
tail: entry.output.tail()
|
|
270
280
|
}));
|
|
281
|
+
const held = kernel.jobs.get(id)?.held === true;
|
|
271
282
|
entry.output.end(end.kind === "exited" ? end.code : null);
|
|
272
283
|
const consumed = await kernel.waits.jobEnded(id, end);
|
|
273
284
|
const owner = entry.owner;
|
|
274
|
-
if (consumed || owner === null || !recorded)
|
|
285
|
+
if (consumed || owner === null || !recorded || held)
|
|
275
286
|
return;
|
|
276
287
|
await send2(kernel, {
|
|
277
288
|
session: owner.session,
|
|
@@ -283,7 +294,7 @@ async function endJob(kernel, id, end) {
|
|
|
283
294
|
return;
|
|
284
295
|
});
|
|
285
296
|
}
|
|
286
|
-
async function
|
|
297
|
+
async function startJob2(kernel, origin, workspace, input, hold = false) {
|
|
287
298
|
const digest = JSON.stringify([
|
|
288
299
|
input.command ?? null,
|
|
289
300
|
input.session ?? null,
|
|
@@ -303,10 +314,10 @@ async function startJob(kernel, origin, workspace, input) {
|
|
|
303
314
|
if (acquired.kind === "recorded")
|
|
304
315
|
return held(asId(acquired.id));
|
|
305
316
|
const id = acquired.value.id;
|
|
306
|
-
await kernel.jobs.start(id, digest, () => spawn(kernel, origin, workspace, input, id, digest));
|
|
317
|
+
await kernel.jobs.start(id, digest, () => spawn(kernel, origin, workspace, input, { id, digest, held: hold }));
|
|
307
318
|
return jobHandle2(kernel, id);
|
|
308
319
|
}
|
|
309
|
-
async function spawn(kernel, origin, workspace, input, id, digest) {
|
|
320
|
+
async function spawn(kernel, origin, workspace, input, { id, digest, held }) {
|
|
310
321
|
const on = async (session) => (await readSession2(kernel.store, session))?.record.workspace === workspace;
|
|
311
322
|
if (input.session !== undefined && !await on(input.session))
|
|
312
323
|
throw new SdkError("invalid", `Session ${input.session} is not on workspace ${workspace}.`);
|
|
@@ -341,7 +352,12 @@ async function spawn(kernel, origin, workspace, input, id, digest) {
|
|
|
341
352
|
if (reserved.kind !== "set")
|
|
342
353
|
throw new SdkError("stale", `Job ${id} was already started.`);
|
|
343
354
|
}
|
|
344
|
-
const
|
|
355
|
+
const trace = owner === null || owner.startedBy === null ? null : followedTrace2(owner.session);
|
|
356
|
+
const process = await env.exec(input.command ?? [], {
|
|
357
|
+
cwd: env.cwd,
|
|
358
|
+
pty: input.pty,
|
|
359
|
+
env: trace === null ? undefined : { TRACEPARENT: traceparent2(trace) }
|
|
360
|
+
}).catch(async (cause) => {
|
|
345
361
|
if (owner !== null)
|
|
346
362
|
await recordJobEnd(kernel, id, LOST).catch(() => false);
|
|
347
363
|
throw cause;
|
|
@@ -368,7 +384,8 @@ async function spawn(kernel, origin, workspace, input, id, digest) {
|
|
|
368
384
|
process,
|
|
369
385
|
owner,
|
|
370
386
|
digest,
|
|
371
|
-
output
|
|
387
|
+
output,
|
|
388
|
+
held
|
|
372
389
|
});
|
|
373
390
|
pump(kernel, id, process, output);
|
|
374
391
|
}
|
|
@@ -639,4 +656,4 @@ function report(view, end, tail) {
|
|
|
639
656
|
${text}`;
|
|
640
657
|
}
|
|
641
658
|
|
|
642
|
-
export { createJobTable2, createJobs2, jobHandle2, reapJobs2, acquire2 };
|
|
659
|
+
export { createJobTable2, createJobs2, jobHandle2, startJob2, reapJobs2, acquire2 };
|
|
@@ -20,25 +20,25 @@ import {
|
|
|
20
20
|
} from "./compose-vn7b7fdj.js";
|
|
21
21
|
import {
|
|
22
22
|
releaseParts2
|
|
23
|
-
} from "./compose-
|
|
23
|
+
} from "./compose-d95fwwvw.js";
|
|
24
24
|
import {
|
|
25
25
|
commit2
|
|
26
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-bbhk8vnr.js";
|
|
27
27
|
import {
|
|
28
28
|
withFold2
|
|
29
29
|
} from "./compose-xhtgytrh.js";
|
|
30
30
|
import {
|
|
31
31
|
listSessionWaits2
|
|
32
|
-
} from "./compose-
|
|
32
|
+
} from "./compose-bz70g01d.js";
|
|
33
33
|
import {
|
|
34
34
|
readmitDeciding2
|
|
35
|
-
} from "./compose-
|
|
35
|
+
} from "./compose-t9fcqtby.js";
|
|
36
36
|
import {
|
|
37
37
|
dropScans2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-c4z4kp98.js";
|
|
39
39
|
import {
|
|
40
40
|
releaseWorktree2
|
|
41
|
-
} from "./compose-
|
|
41
|
+
} from "./compose-ee0h1pk1.js";
|
|
42
42
|
|
|
43
43
|
// src/engine/start.ts
|
|
44
44
|
import { SdkError } from "@nyte-ai/schema";
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "./compose-cqpjcx2t.js";
|
|
4
4
|
import {
|
|
5
5
|
sendReceipt2
|
|
6
|
-
} from "./compose-
|
|
6
|
+
} from "./compose-fnncnk81.js";
|
|
7
7
|
import {
|
|
8
8
|
move2
|
|
9
|
-
} from "./compose-
|
|
9
|
+
} from "./compose-matk94se.js";
|
|
10
10
|
import {
|
|
11
11
|
heldReceipt2,
|
|
12
12
|
applyBatch2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-2rha31fc.js";
|
|
14
14
|
import {
|
|
15
15
|
driveInProcess2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-1tdb9ezw.js";
|
|
17
17
|
import {
|
|
18
18
|
redeemPairing2,
|
|
19
19
|
authenticateToken2
|
|
20
|
-
} from "./compose-
|
|
20
|
+
} from "./compose-jwy1gba9.js";
|
|
21
21
|
|
|
22
22
|
// src/api/server.ts
|
|
23
23
|
function createServerHost2(kernel) {
|
|
@@ -28,13 +28,13 @@ import {
|
|
|
28
28
|
} from "./compose-vn7b7fdj.js";
|
|
29
29
|
import {
|
|
30
30
|
failedParts2
|
|
31
|
-
} from "./compose-
|
|
31
|
+
} from "./compose-d95fwwvw.js";
|
|
32
32
|
import {
|
|
33
33
|
wokenIndex2
|
|
34
34
|
} from "./compose-0wq555bd.js";
|
|
35
35
|
import {
|
|
36
36
|
commit2
|
|
37
|
-
} from "./compose-
|
|
37
|
+
} from "./compose-bbhk8vnr.js";
|
|
38
38
|
import {
|
|
39
39
|
withFold2,
|
|
40
40
|
liveParts2,
|
|
@@ -42,14 +42,14 @@ import {
|
|
|
42
42
|
} from "./compose-xhtgytrh.js";
|
|
43
43
|
import {
|
|
44
44
|
waitFor2
|
|
45
|
-
} from "./compose-
|
|
45
|
+
} from "./compose-bz70g01d.js";
|
|
46
46
|
import {
|
|
47
47
|
FENCED2,
|
|
48
48
|
stopRun2
|
|
49
|
-
} from "./compose-
|
|
49
|
+
} from "./compose-w6zb11k1.js";
|
|
50
50
|
import {
|
|
51
51
|
send2
|
|
52
|
-
} from "./compose-
|
|
52
|
+
} from "./compose-t9fcqtby.js";
|
|
53
53
|
|
|
54
54
|
// src/engine/runs.ts
|
|
55
55
|
import { asId, isJsonObject, SdkError } from "@nyte-ai/schema";
|
|
@@ -32,19 +32,19 @@ import {
|
|
|
32
32
|
settle3,
|
|
33
33
|
release2,
|
|
34
34
|
storedAnswer2
|
|
35
|
-
} from "./compose-
|
|
35
|
+
} from "./compose-d95fwwvw.js";
|
|
36
36
|
import {
|
|
37
37
|
commit2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-bbhk8vnr.js";
|
|
39
39
|
import {
|
|
40
40
|
runAction2,
|
|
41
41
|
reserveRerun2,
|
|
42
42
|
openAction2,
|
|
43
43
|
recordAcquisition2
|
|
44
|
-
} from "./compose-
|
|
44
|
+
} from "./compose-byse0eqj.js";
|
|
45
45
|
import {
|
|
46
46
|
RESERVED_PART_KINDS2
|
|
47
|
-
} from "./compose-
|
|
47
|
+
} from "./compose-zaanjpb7.js";
|
|
48
48
|
import {
|
|
49
49
|
callable2
|
|
50
50
|
} from "./compose-ry29956g.js";
|
|
@@ -28,11 +28,11 @@ import {
|
|
|
28
28
|
} from "./compose-84272xbk.js";
|
|
29
29
|
import {
|
|
30
30
|
commit2
|
|
31
|
-
} from "./compose-
|
|
31
|
+
} from "./compose-bbhk8vnr.js";
|
|
32
32
|
import {
|
|
33
33
|
modelInfo2,
|
|
34
34
|
withLimits2
|
|
35
|
-
} from "./compose-
|
|
35
|
+
} from "./compose-mdwr0er9.js";
|
|
36
36
|
|
|
37
37
|
// src/agent/request.ts
|
|
38
38
|
import { contentText } from "@nyte-ai/schema/model";
|
|
@@ -35,18 +35,18 @@ import {
|
|
|
35
35
|
} from "./compose-sd0stm97.js";
|
|
36
36
|
import {
|
|
37
37
|
commit2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-bbhk8vnr.js";
|
|
39
39
|
import {
|
|
40
40
|
withFold2
|
|
41
41
|
} from "./compose-xhtgytrh.js";
|
|
42
42
|
import {
|
|
43
43
|
fence2,
|
|
44
44
|
finishFence2
|
|
45
|
-
} from "./compose-
|
|
45
|
+
} from "./compose-w6zb11k1.js";
|
|
46
46
|
import {
|
|
47
47
|
holdSummary2,
|
|
48
48
|
summarizedMove2
|
|
49
|
-
} from "./compose-
|
|
49
|
+
} from "./compose-tppkp915.js";
|
|
50
50
|
import {
|
|
51
51
|
refusalError2,
|
|
52
52
|
collectContributions2
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
settleReceipt2,
|
|
60
60
|
reserve2,
|
|
61
61
|
known2
|
|
62
|
-
} from "./compose-
|
|
62
|
+
} from "./compose-fnncnk81.js";
|
|
63
63
|
import {
|
|
64
64
|
landed2,
|
|
65
65
|
chooseSendSchedule2
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
} from "./compose-vn7b7fdj.js";
|
|
17
17
|
import {
|
|
18
18
|
commit2
|
|
19
|
-
} from "./compose-
|
|
19
|
+
} from "./compose-bbhk8vnr.js";
|
|
20
20
|
import {
|
|
21
21
|
withFold2
|
|
22
22
|
} from "./compose-xhtgytrh.js";
|
|
23
23
|
import {
|
|
24
24
|
fence2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-w6zb11k1.js";
|
|
26
26
|
|
|
27
27
|
// src/engine/branch-summary.ts
|
|
28
28
|
import { asId } from "@nyte-ai/schema";
|