@nyte-ai/core 0.0.24 → 0.0.25-beta.1
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-nj4nj5n9.js → compose-0f9x3cjd.js} +1 -1
- package/dist/chunks/{compose-yfcb6w2h.js → compose-0zrwy7nk.js} +1 -1
- package/dist/chunks/{compose-xhtgytrh.js → compose-122g5jvb.js} +1 -1
- package/dist/chunks/{compose-nkxwrphm.js → compose-17xxey5y.js} +6 -6
- package/dist/chunks/compose-1hgkp0q6.js +154 -0
- package/dist/chunks/{compose-ad80nkkn.js → compose-1kvvrw50.js} +6 -6
- package/dist/chunks/{compose-jeemzja1.js → compose-1nqjy2z5.js} +3 -3
- package/dist/chunks/compose-2e84znn8.js +62 -0
- package/dist/chunks/{compose-sprfv38c.js → compose-34cqydxc.js} +4 -4
- package/dist/chunks/{compose-ee0h1pk1.js → compose-3qkhfwtd.js} +4 -4
- package/dist/chunks/{compose-yr19b453.js → compose-4jqwbez4.js} +7 -7
- package/dist/chunks/{compose-5rg7askh.js → compose-4krv4vzw.js} +13 -5
- package/dist/chunks/{compose-byse0eqj.js → compose-4s0c5zqv.js} +6 -6
- package/dist/chunks/{compose-gj2ypr7q.js → compose-5ygdrc65.js} +3 -3
- package/dist/chunks/{compose-csh5vv2t.js → compose-6e9ktyhr.js} +1 -1
- package/dist/chunks/{compose-dbsn3bsy.js → compose-6zgf2dtw.js} +6 -3
- package/dist/chunks/{compose-ht1tbyr3.js → compose-75pnchkk.js} +22 -10
- package/dist/chunks/{compose-vzvm76dn.js → compose-79h43be5.js} +13 -5
- package/dist/chunks/compose-7bpnxft1.js +20 -0
- package/dist/chunks/{compose-jwy1gba9.js → compose-7sjf0y70.js} +3 -3
- package/dist/chunks/{compose-1tdb9ezw.js → compose-8nysak5a.js} +33 -22
- package/dist/chunks/{compose-ay7t13m9.js → compose-8p6emvvh.js} +8 -8
- package/dist/chunks/{compose-e3635qmn.js → compose-8ranx653.js} +17 -2
- package/dist/chunks/{compose-5njywhy8.js → compose-9tntshv3.js} +6 -6
- package/dist/chunks/{compose-gvm49f4b.js → compose-b10qcn9b.js} +1 -1
- package/dist/chunks/{compose-42egt9y7.js → compose-b4zb2rpb.js} +21 -12
- package/dist/chunks/{compose-767bb340.js → compose-c7jk6qr1.js} +1 -1
- package/dist/chunks/{compose-hfsn6pnt.js → compose-chcqk093.js} +39 -17
- package/dist/chunks/{compose-nw5hdpxk.js → compose-ct1h40fd.js} +8 -8
- package/dist/chunks/{compose-smsafpqe.js → compose-d5yhtpa7.js} +2 -2
- package/dist/chunks/{compose-qxfq6dn9.js → compose-d95420jw.js} +8 -8
- package/dist/chunks/{compose-gxjc6vz9.js → compose-dw8fvn94.js} +4 -2
- package/dist/chunks/{compose-fnncnk81.js → compose-dywbt4he.js} +5 -5
- package/dist/chunks/{compose-xvbyp65f.js → compose-gnfmty38.js} +30 -10
- package/dist/chunks/{compose-mdwr0er9.js → compose-h0d0vess.js} +4 -4
- package/dist/chunks/{compose-2gsbcjgv.js → compose-hf0nrd46.js} +22 -18
- package/dist/chunks/{compose-mcz93154.js → compose-ht5fhzzw.js} +10 -10
- package/dist/chunks/{compose-8pp3vtv0.js → compose-hx8j2kef.js} +4 -4
- package/dist/chunks/{compose-c4z4kp98.js → compose-j8xmyfy6.js} +118 -42
- package/dist/chunks/{compose-9jvn2wvh.js → compose-jawbhn7q.js} +21 -5
- package/dist/chunks/{compose-2rha31fc.js → compose-jbrtw0md.js} +4 -4
- package/dist/chunks/{compose-m01wspwf.js → compose-jrxg4vqg.js} +1 -1
- package/dist/chunks/{compose-bz70g01d.js → compose-kf2k4hq5.js} +5 -5
- package/dist/chunks/{compose-w6zb11k1.js → compose-kgdmzx0n.js} +6 -6
- package/dist/chunks/{compose-qjxtbzgq.js → compose-krkyrds4.js} +11 -5
- package/dist/chunks/{compose-tppkp915.js → compose-kw3bf8mf.js} +4 -4
- package/dist/chunks/{compose-d95fwwvw.js → compose-kwbs1f34.js} +2 -2
- package/dist/chunks/{compose-j42p9wfs.js → compose-n29d5dzv.js} +1 -1
- package/dist/chunks/{compose-qwbe95qs.js → compose-n5f6w2y6.js} +1 -1
- package/dist/chunks/{compose-a7k9h27z.js → compose-nc60858y.js} +4 -4
- package/dist/chunks/{compose-6r5ymwyr.js → compose-nenmmq5w.js} +30 -10
- package/dist/chunks/{compose-enq3x3rq.js → compose-p7j0gt4t.js} +22 -7
- package/dist/chunks/compose-pb3420v8.js +74 -0
- package/dist/chunks/{compose-ts08bth2.js → compose-pcfvksb2.js} +1 -1
- package/dist/chunks/{compose-917xy085.js → compose-pjkzf9ev.js} +9 -9
- package/dist/chunks/{compose-c9wxgbjp.js → compose-prek5sd9.js} +2 -2
- package/dist/chunks/{compose-h14pmqv3.js → compose-qgz6q016.js} +1 -1
- package/dist/chunks/{compose-y6xgbg2h.js → compose-qq85vkhf.js} +1 -1
- package/dist/chunks/{compose-bd8c5n7k.js → compose-qyjchprv.js} +2 -2
- package/dist/chunks/{compose-97y00axn.js → compose-rh1d2g0s.js} +30 -16
- package/dist/chunks/compose-s23st6q6.js +4 -0
- package/dist/chunks/{compose-bbhk8vnr.js → compose-s4kyfjj6.js} +2 -2
- package/dist/chunks/{compose-t9fcqtby.js → compose-sjfbxw65.js} +93 -85
- package/dist/chunks/{compose-a40dnhy5.js → compose-vphbntyn.js} +7 -7
- package/dist/chunks/compose-vxme67gg.js +63 -0
- package/dist/chunks/compose-wgs4rgfp.js +32 -0
- package/dist/chunks/{compose-1xn3eecn.js → compose-xdq54csy.js} +39 -35
- package/dist/chunks/{compose-v46qmh60.js → compose-yd5t8qj3.js} +63 -126
- package/dist/chunks/{compose-vn7b7fdj.js → compose-ydth4n0z.js} +7 -3
- package/dist/chunks/{compose-6gt28900.js → compose-yxhvzsed.js} +4 -4
- package/dist/chunks/{compose-matk94se.js → compose-zajq79k0.js} +6 -6
- package/dist/chunks/{compose-ae5t6v5b.js → compose-zq7ar8qm.js} +4 -4
- package/dist/chunks/{compose-4ppmas7g.js → compose-zt2qtrxj.js} +4 -4
- package/dist/chunks/compose-ztyjpn84.js +59 -0
- package/dist/chunks/{compose-m91ffwss.js → compose-zv0t13e7.js} +2 -2
- package/dist/chunks/{compose-r8tz1xfj.js → compose-zx78edb2.js} +9 -5
- package/dist/src/agent/agent-loop.d.ts +4 -0
- package/dist/src/agent/agent-loop.js +3 -1
- package/dist/src/agent/compaction.js +38 -37
- package/dist/src/agent/open-parts.d.ts +34 -0
- package/dist/src/agent/open-parts.js +22 -0
- package/dist/src/agent/request.js +27 -26
- package/dist/src/agent/tool-runner.d.ts +5 -5
- package/dist/src/agent/tool-runner.js +31 -30
- package/dist/src/agent/transcript.js +34 -33
- package/dist/src/agent/turn.js +48 -43
- package/dist/src/api/connection.js +61 -56
- package/dist/src/api/head.d.ts +1 -2
- package/dist/src/api/head.js +43 -39
- package/dist/src/api/hold.d.ts +7 -0
- package/dist/src/api/hold.js +7 -0
- package/dist/src/api/part.js +20 -18
- package/dist/src/api/server.js +48 -45
- package/dist/src/api/session.js +48 -44
- package/dist/src/builtins/delegation.js +1 -1
- package/dist/src/builtins/environment.d.ts +8 -0
- package/dist/src/builtins/environment.js +3 -1
- package/dist/src/builtins/interruptions.d.ts +4 -0
- package/dist/src/builtins/interruptions.js +8 -0
- package/dist/src/compose.js +75 -68
- package/dist/src/contract/host.d.ts +6 -0
- package/dist/src/contract/kernel.d.ts +9 -6
- package/dist/src/contract/parts.d.ts +48 -46
- package/dist/src/contract/records.d.ts +429 -419
- package/dist/src/contract/records.js +1 -1
- package/dist/src/contract/server.d.ts +3 -1
- package/dist/src/contract/session.d.ts +31 -1
- package/dist/src/contract/session.js +6 -0
- package/dist/src/contract/workspace.d.ts +3 -1
- package/dist/src/drive/execution.js +44 -43
- package/dist/src/drive/interruptions.d.ts +10 -2
- package/dist/src/drive/interruptions.js +9 -5
- package/dist/src/drive/pause.d.ts +11 -0
- package/dist/src/drive/pause.js +10 -0
- package/dist/src/engine/admission-writes.d.ts +22 -0
- package/dist/src/engine/admission-writes.js +15 -0
- package/dist/src/engine/admission.d.ts +15 -1
- package/dist/src/engine/admission.js +25 -20
- package/dist/src/engine/batches.js +18 -18
- package/dist/src/engine/branch-summary.js +17 -17
- package/dist/src/engine/durable.js +17 -17
- package/dist/src/engine/fence.js +16 -16
- package/dist/src/engine/holds.d.ts +4 -0
- package/dist/src/engine/holds.js +43 -0
- package/dist/src/engine/jobs.js +24 -23
- package/dist/src/engine/lease.d.ts +5 -4
- package/dist/src/engine/lease.js +1 -1
- package/dist/src/engine/move.js +19 -19
- package/dist/src/engine/presence.js +2 -2
- package/dist/src/engine/principals.js +14 -14
- package/dist/src/engine/receipts.js +17 -17
- package/dist/src/engine/runs.js +22 -21
- package/dist/src/engine/start.js +34 -33
- package/dist/src/engine/surface.js +3 -3
- package/dist/src/engine/waits.js +15 -15
- package/dist/src/env/browser.js +25 -24
- package/dist/src/env/environment.js +27 -26
- package/dist/src/env/mcp.js +29 -28
- package/dist/src/env/session-changes.js +3 -3
- package/dist/src/env/trust.js +28 -27
- package/dist/src/env/workspaces.js +32 -31
- package/dist/src/env/worktrees.js +33 -32
- package/dist/src/extend/activation.d.ts +3 -0
- package/dist/src/extend/activation.js +35 -32
- package/dist/src/extend/hooks.js +19 -19
- package/dist/src/extend/models.js +26 -25
- package/dist/src/extend/plugin-api.js +14 -14
- package/dist/src/extend/plugin-runtime.d.ts +3 -1
- package/dist/src/extend/plugin-runtime.js +39 -38
- package/dist/src/extend/registry.js +24 -23
- package/dist/src/extend/resources.js +29 -28
- package/dist/src/extend/setting-layers.js +3 -3
- package/dist/src/extend/settings.js +36 -35
- package/dist/src/extend/workspace-commands.js +40 -39
- package/dist/src/fold/calls.js +4 -4
- package/dist/src/fold/checkpoint.js +9 -9
- package/dist/src/fold/code.d.ts +1 -1
- package/dist/src/fold/code.js +1 -1
- package/dist/src/fold/commit.js +13 -13
- package/dist/src/fold/draft.d.ts +37 -37
- package/dist/src/fold/draft.js +3 -3
- package/dist/src/fold/fold.js +6 -6
- package/dist/src/fold/paths.js +4 -4
- package/dist/src/fold/project.d.ts +2 -2
- package/dist/src/fold/project.js +6 -6
- package/dist/src/fold/reads.js +3 -3
- package/dist/src/fold/seen.d.ts +3 -5
- package/dist/src/fold/seen.js +17 -17
- package/dist/src/fold/view.d.ts +7 -1
- package/dist/src/fold/view.js +8 -23
- package/dist/src/fold/watch.js +12 -12
- package/dist/src/harness.d.ts +257 -257
- package/dist/src/harness.js +78 -71
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +13 -3
- package/dist/src/server.js +73 -66
- package/dist/src/store/inspect.js +3 -3
- package/dist/src/store/memory-store.js +3 -3
- package/dist/src/store/migrations.js +2 -2
- package/dist/src/store/model-state.js +2 -2
- package/dist/src/store/parts.js +3 -3
- package/dist/src/store/session-index.js +2 -2
- package/dist/src/store/session.js +2 -2
- package/dist/src/store.js +5 -5
- package/dist/src/testing.js +76 -69
- package/dist/src/util/line-diff.d.ts +5 -5
- package/package.json +4 -5
- package/dist/chunks/compose-hfrjm4a1.js +0 -88
|
@@ -7,20 +7,26 @@ function holdLease2(what, renew, timing) {
|
|
|
7
7
|
const lost = new AbortController;
|
|
8
8
|
let renewed = Date.now();
|
|
9
9
|
let renewing = false;
|
|
10
|
-
|
|
10
|
+
let stopped = false;
|
|
11
|
+
const stop = () => {
|
|
12
|
+
stopped = true;
|
|
13
|
+
clearInterval(timer);
|
|
14
|
+
};
|
|
11
15
|
const lose = (reason) => {
|
|
12
16
|
dev2("lease", "lost", { what, reason });
|
|
13
17
|
stop();
|
|
14
18
|
lost.abort();
|
|
15
19
|
};
|
|
16
20
|
const timer = setInterval(() => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const lapsed = Date.now() - renewed >= timing.lapse;
|
|
22
|
+
if (renewing) {
|
|
23
|
+
if (lapsed)
|
|
24
|
+
lose("lapsed");
|
|
20
25
|
return;
|
|
26
|
+
}
|
|
21
27
|
renewing = true;
|
|
22
28
|
renew().then((held) => {
|
|
23
|
-
if (
|
|
29
|
+
if (stopped)
|
|
24
30
|
return;
|
|
25
31
|
if (!held)
|
|
26
32
|
return lose("refused");
|
|
@@ -30,6 +36,8 @@ function holdLease2(what, renew, timing) {
|
|
|
30
36
|
what,
|
|
31
37
|
error: error instanceof Error ? error.message : String(error)
|
|
32
38
|
});
|
|
39
|
+
if (lapsed && !stopped)
|
|
40
|
+
lose("lapsed");
|
|
33
41
|
}).finally(() => {
|
|
34
42
|
renewing = false;
|
|
35
43
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/builtins/interruptions.ts
|
|
2
|
+
import { standard } from "@nyte-ai/schema";
|
|
3
|
+
import { Type } from "typebox";
|
|
4
|
+
var CONTINUE_INTERRUPTED2 = "continueInterrupted";
|
|
5
|
+
var interruptionsPlugin2 = {
|
|
6
|
+
id: "interruptions",
|
|
7
|
+
contribute: {
|
|
8
|
+
settings: [
|
|
9
|
+
{
|
|
10
|
+
id: CONTINUE_INTERRUPTED2,
|
|
11
|
+
label: "Continue cut-off responses",
|
|
12
|
+
schema: standard(Type.Boolean()),
|
|
13
|
+
default: true,
|
|
14
|
+
scope: "host"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { CONTINUE_INTERRUPTED2, interruptionsPlugin2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodePrincipalRecord2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-dw8fvn94.js";
|
|
4
4
|
import {
|
|
5
5
|
hostPrincipalsRef2
|
|
6
6
|
} from "./compose-cqpjcx2t.js";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
load2,
|
|
9
9
|
readRefExpectation2,
|
|
10
10
|
put2
|
|
11
|
-
} from "./compose-
|
|
11
|
+
} from "./compose-ydth4n0z.js";
|
|
12
12
|
import {
|
|
13
13
|
commit2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-s4kyfjj6.js";
|
|
15
15
|
|
|
16
16
|
// src/engine/principals.ts
|
|
17
17
|
import { asId, OPERATIONS, SdkError } from "@nyte-ai/schema";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
decodeRunRecord2,
|
|
6
6
|
decodeLease2
|
|
7
|
-
} from "./compose-
|
|
7
|
+
} from "./compose-dw8fvn94.js";
|
|
8
8
|
import {
|
|
9
9
|
dev2
|
|
10
10
|
} from "./compose-n116fnmp.js";
|
|
@@ -24,57 +24,57 @@ import {
|
|
|
24
24
|
covers2,
|
|
25
25
|
coveredSessions2,
|
|
26
26
|
coveredHere2
|
|
27
|
-
} from "./compose-
|
|
27
|
+
} from "./compose-ydth4n0z.js";
|
|
28
28
|
import {
|
|
29
29
|
commit2
|
|
30
|
-
} from "./compose-
|
|
30
|
+
} from "./compose-s4kyfjj6.js";
|
|
31
31
|
import {
|
|
32
32
|
holdLease2
|
|
33
|
-
} from "./compose-
|
|
33
|
+
} from "./compose-79h43be5.js";
|
|
34
34
|
import {
|
|
35
35
|
withFold2
|
|
36
|
-
} from "./compose-
|
|
36
|
+
} from "./compose-122g5jvb.js";
|
|
37
37
|
import {
|
|
38
38
|
loadWaits2,
|
|
39
39
|
earliestWake2
|
|
40
|
-
} from "./compose-
|
|
40
|
+
} from "./compose-kf2k4hq5.js";
|
|
41
41
|
import {
|
|
42
42
|
LEASE_MS2
|
|
43
|
-
} from "./compose-
|
|
43
|
+
} from "./compose-4s0c5zqv.js";
|
|
44
44
|
import {
|
|
45
45
|
stopRequested2
|
|
46
|
-
} from "./compose-
|
|
46
|
+
} from "./compose-kgdmzx0n.js";
|
|
47
47
|
import {
|
|
48
48
|
selectRunStart2,
|
|
49
49
|
landing2
|
|
50
|
-
} from "./compose-
|
|
50
|
+
} from "./compose-sjfbxw65.js";
|
|
51
51
|
import {
|
|
52
52
|
reapJobs2
|
|
53
|
-
} from "./compose-
|
|
53
|
+
} from "./compose-17xxey5y.js";
|
|
54
54
|
import {
|
|
55
55
|
newRun2,
|
|
56
56
|
begin2,
|
|
57
57
|
endRun2
|
|
58
|
-
} from "./compose-
|
|
58
|
+
} from "./compose-d95420jw.js";
|
|
59
59
|
import {
|
|
60
60
|
executeCall2,
|
|
61
61
|
owedCalls2,
|
|
62
62
|
readToolInput2
|
|
63
|
-
} from "./compose-
|
|
63
|
+
} from "./compose-ht5fhzzw.js";
|
|
64
64
|
import {
|
|
65
65
|
recoverMoves2
|
|
66
|
-
} from "./compose-
|
|
66
|
+
} from "./compose-zajq79k0.js";
|
|
67
67
|
import {
|
|
68
68
|
BEAT_MS2
|
|
69
|
-
} from "./compose-
|
|
69
|
+
} from "./compose-b10qcn9b.js";
|
|
70
70
|
import {
|
|
71
71
|
recoverStarts2
|
|
72
|
-
} from "./compose-
|
|
72
|
+
} from "./compose-ct1h40fd.js";
|
|
73
73
|
import {
|
|
74
74
|
crashLooping2,
|
|
75
75
|
parkedFailure2,
|
|
76
76
|
interruption2
|
|
77
|
-
} from "./compose-
|
|
77
|
+
} from "./compose-4krv4vzw.js";
|
|
78
78
|
|
|
79
79
|
// src/drive/execution.ts
|
|
80
80
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
@@ -97,7 +97,9 @@ function createExecutionState2() {
|
|
|
97
97
|
callQueue: keyedSerial(),
|
|
98
98
|
starting: new Map,
|
|
99
99
|
timer: null,
|
|
100
|
-
closing: new AbortController
|
|
100
|
+
closing: new AbortController,
|
|
101
|
+
streams: new AbortController,
|
|
102
|
+
paused: null
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
105
|
async function cover2(kernel, coverage) {
|
|
@@ -181,6 +183,8 @@ async function step(kernel, session, head) {
|
|
|
181
183
|
const due = await dueInputs(kernel, session, head);
|
|
182
184
|
if (due === null)
|
|
183
185
|
return { kind: "idle" };
|
|
186
|
+
if (due.kind === "held")
|
|
187
|
+
return { kind: "retry", until: due.until };
|
|
184
188
|
const run = await newRun2(kernel.store, session, head, due.origin, due.input.configuration, due.input.requires ?? kernel.presence?.member.capabilities ?? []);
|
|
185
189
|
if ((await landing2(kernel, session, head, due.ids, run.view.id, run.updates)).length === 0)
|
|
186
190
|
return next(kernel, session, head);
|
|
@@ -409,7 +413,7 @@ async function claimNow(kernel, session, head) {
|
|
|
409
413
|
expect: ref === null ? "absent" : ref.revision
|
|
410
414
|
},
|
|
411
415
|
...holder?.kind === "dead" ? [{ name: holder.name, target: null, expect: holder.expect }] : [],
|
|
412
|
-
...
|
|
416
|
+
...mine === undefined ? await interruption2(kernel, session, head, foreign) : []
|
|
413
417
|
]);
|
|
414
418
|
dev2("execution", "claim", { session, head, outcome: outcome.kind });
|
|
415
419
|
if (outcome.kind !== "set") {
|
|
@@ -605,17 +609,24 @@ async function dueInputs(kernel, session, head) {
|
|
|
605
609
|
const { inputs, start } = read;
|
|
606
610
|
if (start === null)
|
|
607
611
|
return null;
|
|
612
|
+
const { hold } = inbox;
|
|
613
|
+
if (hold?.message === start.input.id)
|
|
614
|
+
return { kind: "held", until: hold.until };
|
|
608
615
|
const key = await objectId2(start.input.configuration);
|
|
609
616
|
const ids = [];
|
|
610
617
|
for (const input of inputs)
|
|
611
|
-
if (input === start.input || input.delivery === "attach" || input.delivery === "steer" && await objectId2(input.configuration) === key)
|
|
618
|
+
if (input.id !== hold?.message && (input === start.input || input.delivery === "attach" || input.delivery === "steer" && await objectId2(input.configuration) === key))
|
|
612
619
|
ids.push(input.id);
|
|
613
|
-
return { ...start, ids };
|
|
620
|
+
return { kind: "start", ...start, ids };
|
|
614
621
|
}
|
|
615
622
|
async function next(kernel, session, head) {
|
|
616
623
|
const live = await liveRun3(kernel.store, session, head);
|
|
617
|
-
if (live === null)
|
|
618
|
-
|
|
624
|
+
if (live === null) {
|
|
625
|
+
const due = await dueInputs(kernel, session, head);
|
|
626
|
+
if (due?.kind === "held")
|
|
627
|
+
return { kind: "retry", until: due.until };
|
|
628
|
+
return due === null ? { kind: "idle" } : { kind: "continue" };
|
|
629
|
+
}
|
|
619
630
|
const { record } = live;
|
|
620
631
|
const run = record.view.id;
|
|
621
632
|
if (kernel.executionState.driving.has(run))
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
decodeRunRecord2,
|
|
12
12
|
decodePartRecord2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-dw8fvn94.js";
|
|
14
14
|
import {
|
|
15
15
|
collectContributions2
|
|
16
16
|
} from "./compose-66009v9f.js";
|
|
@@ -35,23 +35,23 @@ import {
|
|
|
35
35
|
walkCommitPath2,
|
|
36
36
|
readPositionCommit2,
|
|
37
37
|
toCommitObjectId2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-ydth4n0z.js";
|
|
39
39
|
import {
|
|
40
40
|
settling2,
|
|
41
41
|
failedParts2
|
|
42
|
-
} from "./compose-
|
|
42
|
+
} from "./compose-kwbs1f34.js";
|
|
43
43
|
import {
|
|
44
44
|
ZERO_USAGE2
|
|
45
45
|
} from "./compose-84272xbk.js";
|
|
46
46
|
import {
|
|
47
47
|
commit2
|
|
48
|
-
} from "./compose-
|
|
48
|
+
} from "./compose-s4kyfjj6.js";
|
|
49
49
|
import {
|
|
50
50
|
withFold2
|
|
51
|
-
} from "./compose-
|
|
51
|
+
} from "./compose-122g5jvb.js";
|
|
52
52
|
import {
|
|
53
53
|
modelInfo2
|
|
54
|
-
} from "./compose-
|
|
54
|
+
} from "./compose-h0d0vess.js";
|
|
55
55
|
import {
|
|
56
56
|
extractUserText2
|
|
57
57
|
} from "./compose-rxsqmcgq.js";
|
|
@@ -60,12 +60,12 @@ import {
|
|
|
60
60
|
requestEvent2,
|
|
61
61
|
rideRef2,
|
|
62
62
|
complete2
|
|
63
|
-
} from "./compose-
|
|
63
|
+
} from "./compose-34cqydxc.js";
|
|
64
64
|
import {
|
|
65
65
|
projectedCommit2,
|
|
66
66
|
requestBody2,
|
|
67
67
|
estimateTranscriptTokens2
|
|
68
|
-
} from "./compose-
|
|
68
|
+
} from "./compose-p7j0gt4t.js";
|
|
69
69
|
|
|
70
70
|
// src/agent/compaction.ts
|
|
71
71
|
import { asId, isJsonObject, SdkError } from "@nyte-ai/schema";
|
|
@@ -8,6 +8,10 @@ var UNFINISHED = {
|
|
|
8
8
|
class: "provider",
|
|
9
9
|
message: "The response ended without a result."
|
|
10
10
|
};
|
|
11
|
+
var INTERRUPTED2 = {
|
|
12
|
+
class: "runner",
|
|
13
|
+
message: "The response was interrupted before it finished."
|
|
14
|
+
};
|
|
11
15
|
function agentLoop2(config, signal) {
|
|
12
16
|
const events = run(config, signal);
|
|
13
17
|
const ended = Promise.withResolvers();
|
|
@@ -34,6 +38,7 @@ async function* run(config, signal) {
|
|
|
34
38
|
for (;; ) {
|
|
35
39
|
const next = overflow === null ? attempt : attempt + 1;
|
|
36
40
|
yield { type: "turn_start", attempt: next };
|
|
41
|
+
await config.ready(signal);
|
|
37
42
|
if (signal.aborted)
|
|
38
43
|
return yield* end({ reason: "stopped", response: overflow?.response ?? null });
|
|
39
44
|
const prepared = await config.prepareRequest({ attempt: next, overflow: overflow?.failure ?? null }, signal);
|
|
@@ -54,6 +59,16 @@ async function* run(config, signal) {
|
|
|
54
59
|
return yield* end({ reason: "stopped", response: { usage: outcome.usage, prepared } });
|
|
55
60
|
case "unfinished":
|
|
56
61
|
return yield* end({ reason: "failed", failure: UNFINISHED, response: null });
|
|
62
|
+
case "interrupted":
|
|
63
|
+
attempt += 1;
|
|
64
|
+
yield {
|
|
65
|
+
type: "turn_retry",
|
|
66
|
+
attempt,
|
|
67
|
+
until: Date.now(),
|
|
68
|
+
failure: INTERRUPTED2,
|
|
69
|
+
response: { usage: outcome.usage, prepared }
|
|
70
|
+
};
|
|
71
|
+
continue;
|
|
57
72
|
case "failed": {
|
|
58
73
|
const { failure } = outcome;
|
|
59
74
|
const response = { usage: outcome.usage, prepared };
|
|
@@ -133,7 +148,7 @@ async function* respond(config, prepared, signal) {
|
|
|
133
148
|
await response.settled;
|
|
134
149
|
const usage = prepared.usage(final);
|
|
135
150
|
if (final.stopReason === "aborted")
|
|
136
|
-
return { kind: "stopped", usage };
|
|
151
|
+
return signal.aborted ? { kind: "stopped", usage } : { kind: "interrupted", usage };
|
|
137
152
|
if (final.stopReason === "error")
|
|
138
153
|
return overflowsContext(final) ? { kind: "overflow", failure: buildContextOverflowFailure(final), usage } : {
|
|
139
154
|
kind: "failed",
|
|
@@ -166,4 +181,4 @@ function buildContextOverflowFailure(message) {
|
|
|
166
181
|
return failure.class === "context_window" ? failure : { class: "context_window", message: "The response ran out of context." };
|
|
167
182
|
}
|
|
168
183
|
|
|
169
|
-
export { agentLoop2 };
|
|
184
|
+
export { INTERRUPTED2, agentLoop2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
envelope2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-dw8fvn94.js";
|
|
4
4
|
import {
|
|
5
5
|
partRef2,
|
|
6
6
|
workspaceRef2,
|
|
@@ -9,23 +9,23 @@ import {
|
|
|
9
9
|
} from "./compose-cqpjcx2t.js";
|
|
10
10
|
import {
|
|
11
11
|
publishSet2
|
|
12
|
-
} from "./compose-
|
|
12
|
+
} from "./compose-1kvvrw50.js";
|
|
13
13
|
import {
|
|
14
14
|
newRun2,
|
|
15
15
|
begin2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-d95420jw.js";
|
|
17
17
|
import {
|
|
18
18
|
createHostState2
|
|
19
19
|
} from "./compose-xm52jghq.js";
|
|
20
20
|
import {
|
|
21
21
|
createHost2
|
|
22
|
-
} from "./compose-
|
|
22
|
+
} from "./compose-rh1d2g0s.js";
|
|
23
23
|
import {
|
|
24
24
|
createKernel2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-xdq54csy.js";
|
|
26
26
|
import {
|
|
27
27
|
memoryStore2
|
|
28
|
-
} from "./compose-
|
|
28
|
+
} from "./compose-pcfvksb2.js";
|
|
29
29
|
|
|
30
30
|
// src/harness.ts
|
|
31
31
|
import { asId } from "@nyte-ai/schema";
|
|
@@ -14,33 +14,34 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
requireSession2,
|
|
16
16
|
coveredHere2
|
|
17
|
-
} from "./compose-
|
|
17
|
+
} from "./compose-ydth4n0z.js";
|
|
18
18
|
import {
|
|
19
19
|
callable2
|
|
20
20
|
} from "./compose-ry29956g.js";
|
|
21
21
|
import {
|
|
22
22
|
scanResources2
|
|
23
|
-
} from "./compose-
|
|
23
|
+
} from "./compose-j8xmyfy6.js";
|
|
24
24
|
import {
|
|
25
|
-
activateSession2
|
|
26
|
-
|
|
25
|
+
activateSession2,
|
|
26
|
+
loadPlugins2
|
|
27
|
+
} from "./compose-75pnchkk.js";
|
|
27
28
|
import {
|
|
28
29
|
corePluginApi2,
|
|
29
30
|
build2
|
|
30
|
-
} from "./compose-
|
|
31
|
+
} from "./compose-prek5sd9.js";
|
|
31
32
|
import {
|
|
32
33
|
createHookDispatch2,
|
|
33
34
|
namesCoreHook2
|
|
34
|
-
} from "./compose-
|
|
35
|
+
} from "./compose-1nqjy2z5.js";
|
|
35
36
|
import {
|
|
36
37
|
createRegistrySet2,
|
|
37
38
|
publishCatalog2,
|
|
38
39
|
bumpGeneration2
|
|
39
|
-
} from "./compose-
|
|
40
|
+
} from "./compose-zq7ar8qm.js";
|
|
40
41
|
import {
|
|
41
42
|
settingHandle2,
|
|
42
43
|
publishSettings2
|
|
43
|
-
} from "./compose-
|
|
44
|
+
} from "./compose-vphbntyn.js";
|
|
44
45
|
|
|
45
46
|
// src/extend/plugin-runtime.ts
|
|
46
47
|
import { SdkError } from "@nyte-ai/schema";
|
|
@@ -49,7 +50,8 @@ var BUILT_IN = new Set([
|
|
|
49
50
|
"system-prompt",
|
|
50
51
|
"environment",
|
|
51
52
|
"resources",
|
|
52
|
-
"delegation"
|
|
53
|
+
"delegation",
|
|
54
|
+
"interruptions"
|
|
53
55
|
]);
|
|
54
56
|
var RESERVED_IDS = ["models", "settings"];
|
|
55
57
|
var ACTIVATE_SECONDS = 30;
|
|
@@ -347,20 +349,27 @@ function checkPlugins2(plugins) {
|
|
|
347
349
|
collisions: collisions(plugins)
|
|
348
350
|
};
|
|
349
351
|
}
|
|
350
|
-
async function replacePlugins2(kernel,
|
|
352
|
+
async function replacePlugins2(kernel, requested, scope) {
|
|
351
353
|
const { assigned } = kernel.plugins.state;
|
|
352
354
|
const builtins = kernel.plugins.builtins.length;
|
|
353
355
|
if (scope !== undefined) {
|
|
354
356
|
await requireSession2(kernel.store, scope.session);
|
|
355
|
-
|
|
357
|
+
await loadPlugins2(kernel, requested);
|
|
358
|
+
assigned.set(scope.session, requested);
|
|
356
359
|
const outcomes = await reloadSession(kernel, scope.session);
|
|
357
360
|
return { generation: bumpGeneration2(kernel), plugins: outcomes.slice(builtins) };
|
|
358
361
|
}
|
|
362
|
+
const plugins = await loadPlugins2(kernel, requested);
|
|
359
363
|
const before = kernel.plugins.host;
|
|
360
364
|
const checked = preflight(plugins, []);
|
|
361
365
|
kernel.plugins.host = plugins;
|
|
362
366
|
const sessions = await Promise.all([...kernel.plugins.runtimes().keys()].map(async (session) => {
|
|
363
|
-
assigned.
|
|
367
|
+
if (assigned.has(session)) {
|
|
368
|
+
await kernel.plugins.reload(session).catch(() => {
|
|
369
|
+
return;
|
|
370
|
+
});
|
|
371
|
+
return { kind: "reassigned" };
|
|
372
|
+
}
|
|
364
373
|
try {
|
|
365
374
|
return { kind: "loaded", outcomes: (await reloadSession(kernel, session)).slice(builtins) };
|
|
366
375
|
} catch (error) {
|
|
@@ -7,24 +7,21 @@ import {
|
|
|
7
7
|
closable2,
|
|
8
8
|
coalesce2
|
|
9
9
|
} from "./compose-zfjxkavf.js";
|
|
10
|
+
import {
|
|
11
|
+
partView2
|
|
12
|
+
} from "./compose-qgz6q016.js";
|
|
10
13
|
import {
|
|
11
14
|
project2,
|
|
12
|
-
readSeenCommit2,
|
|
13
15
|
findLeadingPrompt2
|
|
14
|
-
} from "./compose-
|
|
15
|
-
import {
|
|
16
|
-
seenWriter2
|
|
17
|
-
} from "./compose-hfrjm4a1.js";
|
|
16
|
+
} from "./compose-nenmmq5w.js";
|
|
18
17
|
|
|
19
18
|
// src/fold/view.ts
|
|
20
19
|
function watchHead2(kernel, input) {
|
|
21
20
|
return closable2(() => {
|
|
22
21
|
const hold = kernel.folds.acquire(input.session, input.principal);
|
|
23
|
-
const seen = seenWriter2(kernel, input);
|
|
24
22
|
let states = null;
|
|
25
23
|
let closed = false;
|
|
26
24
|
let shown = null;
|
|
27
|
-
let marked;
|
|
28
25
|
return {
|
|
29
26
|
async pull() {
|
|
30
27
|
if (states === null) {
|
|
@@ -37,17 +34,10 @@ function watchHead2(kernel, input) {
|
|
|
37
34
|
const next = await states.next();
|
|
38
35
|
if (next.done || closed)
|
|
39
36
|
return DONE2;
|
|
40
|
-
const
|
|
41
|
-
const view = project2(state, input.head, input.options);
|
|
37
|
+
const view = project2(hold.state(), input.head, input.options);
|
|
42
38
|
if (view === shown)
|
|
43
39
|
continue;
|
|
44
40
|
shown = view;
|
|
45
|
-
const head = state.heads.get(input.head);
|
|
46
|
-
const tip = head?.info.tip.kind === "commit" ? head.info.tip.id : null;
|
|
47
|
-
if (head !== undefined && tip !== readSeenCommit2(state, input.head) && tip !== marked) {
|
|
48
|
-
marked = tip;
|
|
49
|
-
seen.note(tip);
|
|
50
|
-
}
|
|
51
41
|
return { done: false, value: view };
|
|
52
42
|
}
|
|
53
43
|
},
|
|
@@ -55,7 +45,39 @@ function watchHead2(kernel, input) {
|
|
|
55
45
|
closed = true;
|
|
56
46
|
states?.return?.();
|
|
57
47
|
hold.release();
|
|
58
|
-
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function watchPart2(kernel, input) {
|
|
53
|
+
return closable2(() => {
|
|
54
|
+
const hold = kernel.folds.acquire(input.session, input.principal);
|
|
55
|
+
let states = null;
|
|
56
|
+
let closed = false;
|
|
57
|
+
let shown = null;
|
|
58
|
+
return {
|
|
59
|
+
async pull() {
|
|
60
|
+
if (states === null) {
|
|
61
|
+
await hold.ready();
|
|
62
|
+
if (closed)
|
|
63
|
+
return DONE2;
|
|
64
|
+
states = coalesce2(latest2(hold.state(), (push) => hold.subscribe(push)))[Symbol.asyncIterator]();
|
|
65
|
+
}
|
|
66
|
+
for (;; ) {
|
|
67
|
+
const next = await states.next();
|
|
68
|
+
if (next.done || closed)
|
|
69
|
+
return DONE2;
|
|
70
|
+
const record = hold.state().parts.get(input.part) ?? null;
|
|
71
|
+
if (shown !== null && shown.record === record)
|
|
72
|
+
continue;
|
|
73
|
+
shown = { record };
|
|
74
|
+
return { done: false, value: record === null ? null : partView2(record) };
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
close() {
|
|
78
|
+
closed = true;
|
|
79
|
+
states?.return?.();
|
|
80
|
+
hold.release();
|
|
59
81
|
}
|
|
60
82
|
};
|
|
61
83
|
});
|
|
@@ -95,4 +117,4 @@ async function historyHead2(kernel, input) {
|
|
|
95
117
|
}
|
|
96
118
|
}
|
|
97
119
|
|
|
98
|
-
export { watchHead2, viewHead2, historyHead2 };
|
|
120
|
+
export { watchHead2, watchPart2, viewHead2, historyHead2 };
|
|
@@ -17,28 +17,28 @@ import {
|
|
|
17
17
|
readInbox2,
|
|
18
18
|
attempt2,
|
|
19
19
|
sessionEvent2
|
|
20
|
-
} from "./compose-
|
|
20
|
+
} from "./compose-ydth4n0z.js";
|
|
21
21
|
import {
|
|
22
22
|
releaseParts2
|
|
23
|
-
} from "./compose-
|
|
23
|
+
} from "./compose-kwbs1f34.js";
|
|
24
24
|
import {
|
|
25
25
|
commit2
|
|
26
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-s4kyfjj6.js";
|
|
27
27
|
import {
|
|
28
28
|
withFold2
|
|
29
|
-
} from "./compose-
|
|
29
|
+
} from "./compose-122g5jvb.js";
|
|
30
30
|
import {
|
|
31
31
|
listSessionWaits2
|
|
32
|
-
} from "./compose-
|
|
32
|
+
} from "./compose-kf2k4hq5.js";
|
|
33
33
|
import {
|
|
34
34
|
readmitDeciding2
|
|
35
|
-
} from "./compose-
|
|
35
|
+
} from "./compose-sjfbxw65.js";
|
|
36
36
|
import {
|
|
37
37
|
dropScans2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-j8xmyfy6.js";
|
|
39
39
|
import {
|
|
40
40
|
releaseWorktree2
|
|
41
|
-
} from "./compose-
|
|
41
|
+
} from "./compose-3qkhfwtd.js";
|
|
42
42
|
|
|
43
43
|
// src/engine/start.ts
|
|
44
44
|
import { SdkError } from "@nyte-ai/schema";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeCommitRecord2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-dw8fvn94.js";
|
|
4
4
|
import {
|
|
5
5
|
sessionRef2
|
|
6
6
|
} from "./compose-cqpjcx2t.js";
|
|
7
7
|
import {
|
|
8
8
|
toCommitObjectId2,
|
|
9
9
|
readCommit2
|
|
10
|
-
} from "./compose-
|
|
10
|
+
} from "./compose-ydth4n0z.js";
|
|
11
11
|
|
|
12
12
|
// src/store/inspect.ts
|
|
13
13
|
import { asId, isJsonObject } from "@nyte-ai/schema";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
decodeRunRecord2,
|
|
7
7
|
decodeCallRecord2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-dw8fvn94.js";
|
|
9
9
|
import {
|
|
10
10
|
sessionRef2,
|
|
11
11
|
inboxRef2,
|
|
@@ -25,31 +25,31 @@ import {
|
|
|
25
25
|
put2,
|
|
26
26
|
attempt2,
|
|
27
27
|
sessionEvent2
|
|
28
|
-
} from "./compose-
|
|
28
|
+
} from "./compose-ydth4n0z.js";
|
|
29
29
|
import {
|
|
30
30
|
failedParts2
|
|
31
|
-
} from "./compose-
|
|
31
|
+
} from "./compose-kwbs1f34.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-s4kyfjj6.js";
|
|
38
38
|
import {
|
|
39
39
|
withFold2,
|
|
40
40
|
liveParts2,
|
|
41
41
|
readRunEnd2
|
|
42
|
-
} from "./compose-
|
|
42
|
+
} from "./compose-122g5jvb.js";
|
|
43
43
|
import {
|
|
44
44
|
waitFor2
|
|
45
|
-
} from "./compose-
|
|
45
|
+
} from "./compose-kf2k4hq5.js";
|
|
46
46
|
import {
|
|
47
47
|
FENCED2,
|
|
48
48
|
stopRun2
|
|
49
|
-
} from "./compose-
|
|
49
|
+
} from "./compose-kgdmzx0n.js";
|
|
50
50
|
import {
|
|
51
51
|
send2
|
|
52
|
-
} from "./compose-
|
|
52
|
+
} from "./compose-sjfbxw65.js";
|
|
53
53
|
|
|
54
54
|
// src/engine/runs.ts
|
|
55
55
|
import { asId, isJsonObject, SdkError } from "@nyte-ai/schema";
|
|
@@ -49,7 +49,8 @@ var SessionRecordType = record({
|
|
|
49
49
|
createdAt: Type.Number(),
|
|
50
50
|
lastActivityAt: Type.Number(),
|
|
51
51
|
heads: list(HeadRecordType),
|
|
52
|
-
prompt: nullable(typed()(PromptOverrideType))
|
|
52
|
+
prompt: nullable(typed()(PromptOverrideType)),
|
|
53
|
+
contextFiles: Type.Optional(Type.Literal(false))
|
|
53
54
|
});
|
|
54
55
|
var CommitRecordType = record({
|
|
55
56
|
parent: nullable(idSchema()),
|
|
@@ -59,7 +60,8 @@ var CommitRecordType = record({
|
|
|
59
60
|
});
|
|
60
61
|
var InboxRecordType = record({
|
|
61
62
|
messages: list(idSchema()),
|
|
62
|
-
pendingInput: list(idSchema())
|
|
63
|
+
pendingInput: list(idSchema()),
|
|
64
|
+
hold: Type.Optional(record({ message: idSchema(), until: Type.Number() }))
|
|
63
65
|
});
|
|
64
66
|
var RunRecordType = record({
|
|
65
67
|
view: typed()(RunViewType),
|