@nyte-ai/core 0.0.18 → 0.0.19
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 +1 -1
- package/THIRD-PARTY-NOTICES.md +66 -0
- package/dist/chunks/{compose-q1b0tppc.js → compose-0827b2k4.js} +4 -4
- package/dist/chunks/{compose-j3tkz0tb.js → compose-1g03zpvn.js} +6 -6
- package/dist/chunks/{compose-2g3enfv5.js → compose-31zqcfte.js} +4 -4
- package/dist/chunks/{compose-4b1zf3p0.js → compose-4770pb1s.js} +62 -46
- package/dist/chunks/{compose-madtxnp1.js → compose-47f47sgy.js} +7 -7
- package/dist/chunks/{compose-1z7q169s.js → compose-5489evqa.js} +67 -39
- package/dist/chunks/{compose-yk3y0jap.js → compose-54svedb8.js} +7 -7
- package/dist/chunks/{compose-9tqm6g18.js → compose-57j0pme0.js} +4 -4
- package/dist/chunks/{compose-k8aghhv2.js → compose-5cmp34zp.js} +16 -16
- package/dist/chunks/compose-5rg7askh.js +52 -0
- package/dist/chunks/{compose-mryw0674.js → compose-5z835ej2.js} +6 -1
- package/dist/chunks/{compose-7k6nsmtq.js → compose-6gt28900.js} +11 -14
- package/dist/chunks/{compose-q1n2dgrs.js → compose-6m60v1pk.js} +4 -4
- package/dist/chunks/{compose-2eg8w67t.js → compose-6r5ymwyr.js} +15 -4
- package/dist/chunks/{compose-q1ts0v6k.js → compose-767bb340.js} +1 -1
- package/dist/chunks/{compose-pgeemk2b.js → compose-a7k9h27z.js} +6 -5
- package/dist/chunks/{compose-wgphshsn.js → compose-azq5jxr2.js} +7 -7
- package/dist/chunks/compose-bd8c5n7k.js +32 -0
- package/dist/chunks/{compose-drdej9yt.js → compose-c2rnebv0.js} +3 -3
- package/dist/chunks/compose-c4238qkb.js +105 -0
- package/dist/chunks/{compose-djq2bt61.js → compose-ccrh32hd.js} +6 -6
- package/dist/chunks/{compose-kb22bkpt.js → compose-cqpjcx2t.js} +12 -1
- package/dist/chunks/{compose-dbx6ftbm.js → compose-csh5vv2t.js} +42 -4
- package/dist/chunks/{compose-jc22rsz4.js → compose-dbsn3bsy.js} +2 -2
- package/dist/chunks/{compose-rehp8epe.js → compose-eemt6sea.js} +7 -7
- package/dist/chunks/{compose-r7dx7rpz.js → compose-exfx5b4d.js} +72 -15
- package/dist/chunks/{compose-p3q14yt1.js → compose-g2a1f1yx.js} +5 -5
- package/dist/chunks/compose-gvm49f4b.js +155 -0
- package/dist/chunks/{compose-9m19b27b.js → compose-gvrqkyn4.js} +7 -7
- package/dist/chunks/{compose-1jz2j92f.js → compose-gxjc6vz9.js} +30 -2
- package/dist/chunks/{compose-s2aew2c9.js → compose-gxvetm0j.js} +5 -5
- package/dist/chunks/{compose-cq1zx4gp.js → compose-h14pmqv3.js} +1 -1
- package/dist/chunks/{compose-5w5bbakh.js → compose-h3pch7ch.js} +5 -5
- package/dist/chunks/{compose-r12cnkpc.js → compose-hf6xkwdw.js} +10 -10
- package/dist/chunks/{compose-aa73dbe8.js → compose-hms4hf6p.js} +92 -49
- package/dist/chunks/{compose-jjchxce6.js → compose-j42p9wfs.js} +1 -1
- package/dist/chunks/{compose-vmhv4e00.js → compose-jehg40ce.js} +13 -12
- package/dist/chunks/{compose-5tkyrzr0.js → compose-jhs91x01.js} +4 -4
- package/dist/chunks/{compose-xd0kdp3t.js → compose-jrqn6xhy.js} +8 -8
- package/dist/chunks/{compose-ef936rsa.js → compose-ks2rdteq.js} +27 -11
- package/dist/chunks/{compose-k35b75k9.js → compose-kwkna3cg.js} +2 -4
- package/dist/chunks/{compose-gaps3heh.js → compose-m1ecjzm2.js} +8 -8
- package/dist/chunks/{compose-xtkavyrw.js → compose-m6nsbnkk.js} +17 -9
- package/dist/chunks/{compose-y478gv6x.js → compose-mamr4qwf.js} +4 -4
- package/dist/chunks/{compose-j12n448k.js → compose-nj4nj5n9.js} +36 -3
- package/dist/chunks/{compose-cdy4q5mv.js → compose-pe0cgbv0.js} +17 -16
- package/dist/chunks/{compose-xpfr4wt3.js → compose-pnsvwd3m.js} +7 -4
- package/dist/chunks/{compose-52afaf3v.js → compose-prchdrqk.js} +7 -7
- package/dist/chunks/{compose-7pc3p5ex.js → compose-q1d09qpr.js} +8 -8
- package/dist/chunks/{compose-amr0k1m1.js → compose-q1rrtq3a.js} +2 -2
- package/dist/chunks/{compose-0bpspysf.js → compose-qknd62yj.js} +5 -5
- package/dist/chunks/{compose-b5xz0dj7.js → compose-qwbe95qs.js} +2 -2
- package/dist/chunks/{compose-064y3n82.js → compose-r1pxdxbw.js} +5 -5
- package/dist/chunks/{compose-7b8ajk7a.js → compose-rd5e5nxg.js} +8 -8
- package/dist/chunks/{compose-gg8b9b21.js → compose-s5522cth.js} +23 -18
- package/dist/chunks/{compose-t53j8yxv.js → compose-se7wwcq1.js} +1 -1
- package/dist/chunks/{compose-dc2ns6gd.js → compose-seyhq3fb.js} +10 -10
- package/dist/chunks/{compose-ffk8dnbh.js → compose-smsafpqe.js} +3 -3
- package/dist/chunks/{compose-eqr5qwp1.js → compose-tb5ywdfk.js} +56 -21
- package/dist/chunks/{compose-dckpgtks.js → compose-ts08bth2.js} +3 -3
- package/dist/chunks/{compose-1gd9vkye.js → compose-v9yf9mrh.js} +3 -3
- package/dist/chunks/{compose-n10w4nkk.js → compose-vn7b7fdj.js} +12 -3
- package/dist/chunks/{compose-kmzr06mw.js → compose-w2ac7xjx.js} +8 -5
- package/dist/chunks/{compose-rpq9n0nz.js → compose-xaegezm3.js} +84 -26
- package/dist/chunks/{compose-6vf6dkk2.js → compose-xhtgytrh.js} +2 -2
- package/dist/chunks/{compose-4tb2vn84.js → compose-y6xgbg2h.js} +1 -1
- package/dist/chunks/{compose-yn2et568.js → compose-y9c31w4e.js} +118 -9
- package/dist/chunks/{compose-h272znxk.js → compose-z6hbq6y0.js} +7 -7
- package/dist/chunks/{compose-d2s80zg2.js → compose-zch4zapc.js} +5 -5
- package/dist/src/agent/compaction.js +39 -37
- package/dist/src/agent/images.d.ts +7 -0
- package/dist/src/agent/images.js +8 -0
- package/dist/src/agent/request.js +28 -28
- package/dist/src/agent/tool-runner.d.ts +1 -7
- package/dist/src/agent/tool-runner.js +29 -28
- package/dist/src/agent/transcript.d.ts +0 -1
- package/dist/src/agent/transcript.js +35 -33
- package/dist/src/agent/turn.js +43 -41
- package/dist/src/api/connection.js +56 -53
- package/dist/src/api/head.js +39 -39
- package/dist/src/api/part.js +20 -20
- package/dist/src/api/server.js +45 -42
- package/dist/src/api/session.js +44 -44
- package/dist/src/builtins/environment.js +1 -1
- package/dist/src/compose.d.ts +6 -7
- package/dist/src/compose.js +68 -64
- package/dist/src/contract/fold.d.ts +1 -3
- package/dist/src/contract/host.d.ts +30 -1
- package/dist/src/contract/host.js +4 -2
- package/dist/src/contract/kernel.d.ts +6 -35
- package/dist/src/contract/records.d.ts +69 -3
- package/dist/src/contract/records.js +5 -1
- package/dist/src/contract/session.d.ts +2 -1
- package/dist/src/contract/workspace.d.ts +5 -3
- package/dist/src/drive/execution.js +43 -40
- package/dist/src/drive/interruptions.d.ts +7 -0
- package/dist/src/drive/interruptions.js +17 -0
- package/dist/src/engine/admission.js +22 -22
- package/dist/src/engine/batches.js +21 -21
- package/dist/src/engine/branch-summary.js +20 -20
- package/dist/src/engine/durable.d.ts +0 -2
- package/dist/src/engine/durable.js +19 -19
- package/dist/src/engine/fence.js +19 -19
- package/dist/src/engine/jobs.d.ts +1 -0
- package/dist/src/engine/jobs.js +27 -25
- package/dist/src/engine/move.js +22 -22
- package/dist/src/engine/presence.d.ts +39 -0
- package/dist/src/engine/presence.js +16 -0
- package/dist/src/engine/principals.js +16 -16
- package/dist/src/engine/receipts.js +20 -20
- package/dist/src/engine/runs.d.ts +1 -1
- package/dist/src/engine/runs.js +23 -23
- package/dist/src/engine/start.js +33 -33
- package/dist/src/engine/surface.d.ts +4 -0
- package/dist/src/engine/surface.js +13 -0
- package/dist/src/engine/waits.d.ts +5 -15
- package/dist/src/engine/waits.js +22 -18
- package/dist/src/env/browser.js +25 -25
- package/dist/src/env/environment.js +27 -27
- package/dist/src/env/mcp.js +29 -29
- package/dist/src/env/trust.js +28 -28
- package/dist/src/env/workspaces.js +31 -31
- package/dist/src/env/worktrees.js +32 -32
- package/dist/src/extend/activation.js +32 -32
- package/dist/src/extend/hooks.js +21 -21
- package/dist/src/extend/models.d.ts +2 -1
- package/dist/src/extend/models.js +30 -28
- package/dist/src/extend/plugin-api.js +17 -17
- package/dist/src/extend/plugin-runtime.js +38 -38
- package/dist/src/extend/registry.js +25 -25
- package/dist/src/extend/resources.js +29 -29
- package/dist/src/extend/setting-layers.js +4 -4
- package/dist/src/extend/settings.js +35 -35
- package/dist/src/extend/workspace-commands.js +39 -39
- package/dist/src/fold/calls.js +5 -5
- package/dist/src/fold/checkpoint.js +11 -11
- package/dist/src/fold/code.d.ts +1 -2
- package/dist/src/fold/code.js +1 -1
- package/dist/src/fold/commit.d.ts +0 -4
- package/dist/src/fold/commit.js +15 -15
- package/dist/src/fold/draft.js +4 -4
- package/dist/src/fold/fold.js +7 -7
- package/dist/src/fold/paths.js +5 -5
- package/dist/src/fold/project.d.ts +3 -1
- package/dist/src/fold/project.js +8 -6
- package/dist/src/fold/reads.js +5 -5
- package/dist/src/fold/seen.js +18 -18
- package/dist/src/fold/view.d.ts +1 -1
- package/dist/src/fold/view.js +19 -19
- package/dist/src/fold/watch.js +14 -14
- package/dist/src/harness.d.ts +2 -1
- package/dist/src/harness.js +71 -67
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +4 -2
- package/dist/src/server.js +66 -62
- package/dist/src/store/inspect.js +4 -4
- package/dist/src/store/log.d.ts +0 -2
- package/dist/src/store/log.js +2 -2
- package/dist/src/store/memory-store.js +5 -5
- package/dist/src/store/migrations.js +3 -3
- package/dist/src/store/model-state.d.ts +6 -1
- package/dist/src/store/model-state.js +14 -4
- package/dist/src/store/parts.js +4 -4
- package/dist/src/store/refs.d.ts +6 -5
- package/dist/src/store/refs.js +11 -1
- package/dist/src/store/session-index.js +2 -2
- package/dist/src/store/session.d.ts +3 -1
- package/dist/src/store/session.js +5 -3
- package/dist/src/store.d.ts +1 -1
- package/dist/src/store.js +11 -7
- package/dist/src/testing.d.ts +2 -0
- package/dist/src/testing.js +77 -65
- package/package.json +4 -4
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeTrustRecord2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-gxjc6vz9.js";
|
|
4
4
|
import {
|
|
5
5
|
trustRef2,
|
|
6
6
|
trustTarget2,
|
|
7
7
|
kvRef2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-cqpjcx2t.js";
|
|
9
9
|
import {
|
|
10
10
|
load2,
|
|
11
11
|
put2,
|
|
12
12
|
readKv2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-vn7b7fdj.js";
|
|
14
14
|
import {
|
|
15
15
|
commit2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-pnsvwd3m.js";
|
|
17
17
|
import {
|
|
18
18
|
workspaceRecords2
|
|
19
|
-
} from "./compose-
|
|
19
|
+
} from "./compose-qknd62yj.js";
|
|
20
20
|
|
|
21
21
|
// src/env/trust.ts
|
|
22
22
|
import { Value } from "typebox/value";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LOCAL2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-5z835ej2.js";
|
|
4
4
|
import {
|
|
5
5
|
check2
|
|
6
6
|
} from "./compose-bj54tkph.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
decodeRunRecord2,
|
|
12
12
|
decodePartRecord2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-gxjc6vz9.js";
|
|
14
14
|
import {
|
|
15
15
|
collectContributions2
|
|
16
16
|
} from "./compose-66009v9f.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
headRef2,
|
|
20
20
|
runRef2,
|
|
21
21
|
partRef2
|
|
22
|
-
} from "./compose-
|
|
22
|
+
} from "./compose-cqpjcx2t.js";
|
|
23
23
|
import {
|
|
24
24
|
dev2
|
|
25
25
|
} from "./compose-n116fnmp.js";
|
|
@@ -35,23 +35,23 @@ import {
|
|
|
35
35
|
walkCommitPath2,
|
|
36
36
|
readPositionCommit2,
|
|
37
37
|
toCommitObjectId2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-vn7b7fdj.js";
|
|
39
39
|
import {
|
|
40
40
|
settling2,
|
|
41
41
|
failedParts2
|
|
42
|
-
} from "./compose-
|
|
42
|
+
} from "./compose-c2rnebv0.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-pnsvwd3m.js";
|
|
49
49
|
import {
|
|
50
50
|
withFold2
|
|
51
|
-
} from "./compose-
|
|
51
|
+
} from "./compose-xhtgytrh.js";
|
|
52
52
|
import {
|
|
53
53
|
modelInfo2
|
|
54
|
-
} from "./compose-
|
|
54
|
+
} from "./compose-exfx5b4d.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-ccrh32hd.js";
|
|
64
64
|
import {
|
|
65
65
|
projectedCommit2,
|
|
66
66
|
requestBody2,
|
|
67
67
|
estimateTranscriptTokens2
|
|
68
|
-
} from "./compose-
|
|
68
|
+
} from "./compose-4770pb1s.js";
|
|
69
69
|
|
|
70
70
|
// src/agent/compaction.ts
|
|
71
71
|
import { asId, isJsonObject, SdkError } from "@nyte-ai/schema";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PARTICIPANT_AUTHORITY2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-5z835ej2.js";
|
|
4
4
|
import {
|
|
5
5
|
check2
|
|
6
6
|
} from "./compose-bj54tkph.js";
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
decodeRunRecord2,
|
|
13
13
|
decodePartRecord2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-gxjc6vz9.js";
|
|
15
15
|
import {
|
|
16
16
|
runRef2,
|
|
17
17
|
partRef2
|
|
18
|
-
} from "./compose-
|
|
18
|
+
} from "./compose-cqpjcx2t.js";
|
|
19
19
|
import {
|
|
20
20
|
dev2
|
|
21
21
|
} from "./compose-n116fnmp.js";
|
|
@@ -24,29 +24,34 @@ import {
|
|
|
24
24
|
load2,
|
|
25
25
|
requireSession2,
|
|
26
26
|
readTip2,
|
|
27
|
+
threadStart2,
|
|
27
28
|
readRefExpectation2,
|
|
28
29
|
put2,
|
|
29
30
|
attempt2,
|
|
30
31
|
readCall2,
|
|
31
32
|
readCalls2
|
|
32
|
-
} from "./compose-
|
|
33
|
+
} from "./compose-vn7b7fdj.js";
|
|
33
34
|
import {
|
|
34
35
|
settling2
|
|
35
|
-
} from "./compose-
|
|
36
|
+
} from "./compose-c2rnebv0.js";
|
|
36
37
|
import {
|
|
37
38
|
commit2
|
|
38
|
-
} from "./compose-
|
|
39
|
+
} from "./compose-pnsvwd3m.js";
|
|
39
40
|
import {
|
|
40
41
|
signalsPark2,
|
|
41
42
|
parkStep2,
|
|
42
43
|
runStep2
|
|
43
|
-
} from "./compose-
|
|
44
|
+
} from "./compose-eemt6sea.js";
|
|
44
45
|
import {
|
|
45
46
|
publishPatch2
|
|
46
|
-
} from "./compose-
|
|
47
|
+
} from "./compose-jehg40ce.js";
|
|
48
|
+
import {
|
|
49
|
+
hiddenOwners2,
|
|
50
|
+
missingCapabilities2
|
|
51
|
+
} from "./compose-bd8c5n7k.js";
|
|
47
52
|
import {
|
|
48
53
|
toolSource2
|
|
49
|
-
} from "./compose-
|
|
54
|
+
} from "./compose-r1pxdxbw.js";
|
|
50
55
|
|
|
51
56
|
// src/agent/tool-runner.ts
|
|
52
57
|
import { Type } from "typebox";
|
|
@@ -175,6 +180,7 @@ async function perform(kernel, where) {
|
|
|
175
180
|
if (planned.kind === "parked")
|
|
176
181
|
return PARKED;
|
|
177
182
|
let concluded;
|
|
183
|
+
let before = null;
|
|
178
184
|
const snapshotted = planned.kind === "execute" && where.covered !== true && planned.definition.effects !== "none";
|
|
179
185
|
const step = await runStep2(kernel, {
|
|
180
186
|
session,
|
|
@@ -187,13 +193,17 @@ async function perform(kernel, where) {
|
|
|
187
193
|
opening: { updates: () => partOpening(kernel.store, where, planned), fenced: STOPPED },
|
|
188
194
|
part: asId(call),
|
|
189
195
|
signal,
|
|
190
|
-
body: planned.kind === "execute" ?
|
|
196
|
+
body: planned.kind === "execute" ? async (durable) => {
|
|
197
|
+
const executed = await execute(kernel, where, planned, durable, snapshotted);
|
|
198
|
+
before = executed.before;
|
|
199
|
+
return executed.outcome;
|
|
200
|
+
} : async () => planned.outcome,
|
|
191
201
|
async settle(ended) {
|
|
192
|
-
concluded ??= conclude(kernel, where, ended,
|
|
202
|
+
concluded ??= conclude(kernel, where, ended, before);
|
|
193
203
|
const settled = await concluded;
|
|
194
204
|
return {
|
|
195
205
|
result: settled.outcome,
|
|
196
|
-
updates: await settlement(kernel.store, where, planned, settled)
|
|
206
|
+
updates: await settlement(kernel.store, where, planned, settled, before)
|
|
197
207
|
};
|
|
198
208
|
},
|
|
199
209
|
decode: (value) => outcomes.Check(value) ? outcomes.Decode(value) : null
|
|
@@ -206,14 +216,18 @@ async function perform(kernel, where) {
|
|
|
206
216
|
async function plan(kernel, where, intent) {
|
|
207
217
|
const { session, head, run, call, name } = where;
|
|
208
218
|
const custom = { kind: "custom", label: name };
|
|
209
|
-
const
|
|
210
|
-
|
|
219
|
+
const found = toolSource2(where.runtime).get(name);
|
|
220
|
+
const hidden = await hiddenOwners2(kernel, session, run);
|
|
221
|
+
const definition = found === undefined || hidden.has(found.owner) ? undefined : found.definition;
|
|
222
|
+
if (definition === undefined) {
|
|
223
|
+
const missing = found === undefined ? await missingCapabilities2(kernel, session, run) : [];
|
|
211
224
|
return {
|
|
212
225
|
kind: "settle",
|
|
213
|
-
outcome: failed(`No tool is named ${name}.`),
|
|
226
|
+
outcome: failed(missing.length === 0 ? `No tool is named ${name}.` : `${name} isn't available here: this chat uses ${missing.join(", ")}, which only Nyte.app has. Open Nyte.app to continue.`),
|
|
214
227
|
args: where.args,
|
|
215
228
|
class: custom
|
|
216
229
|
};
|
|
230
|
+
}
|
|
217
231
|
if (where.argumentsError !== undefined)
|
|
218
232
|
return {
|
|
219
233
|
kind: "settle",
|
|
@@ -314,14 +328,17 @@ async function partOpening(store, where, planned) {
|
|
|
314
328
|
}
|
|
315
329
|
async function execute(kernel, where, planned, durable, snapshotted) {
|
|
316
330
|
const { session, run, signal } = where;
|
|
331
|
+
let before = null;
|
|
317
332
|
try {
|
|
318
333
|
if (snapshotted)
|
|
319
|
-
await baseline(kernel, session, run);
|
|
320
|
-
const [env, found] = await Promise.all([
|
|
334
|
+
before = await durable.memo("nyte:snapshot", () => baseline(kernel, session, run));
|
|
335
|
+
const [env, found, hidden] = await Promise.all([
|
|
321
336
|
kernel.environments.attach(session),
|
|
322
|
-
requireSession2(kernel.store, session)
|
|
337
|
+
requireSession2(kernel.store, session),
|
|
338
|
+
hiddenOwners2(kernel, session, run)
|
|
323
339
|
]);
|
|
324
340
|
const invocation = createInvocation2(kernel, {
|
|
341
|
+
hidden,
|
|
325
342
|
session,
|
|
326
343
|
head: where.head,
|
|
327
344
|
run,
|
|
@@ -335,11 +352,17 @@ async function execute(kernel, where, planned, durable, snapshotted) {
|
|
|
335
352
|
covered: where.covered === true || snapshotted
|
|
336
353
|
});
|
|
337
354
|
const result = await planned.definition.execute(planned.input, invocation);
|
|
338
|
-
return
|
|
355
|
+
return {
|
|
356
|
+
outcome: signal.aborted ? STOPPED : await validateToolResult(planned.definition, result),
|
|
357
|
+
before
|
|
358
|
+
};
|
|
339
359
|
} catch (error) {
|
|
340
360
|
if (signalsPark2(error))
|
|
341
361
|
throw error;
|
|
342
|
-
return
|
|
362
|
+
return {
|
|
363
|
+
outcome: signal.aborted ? STOPPED : failed(error instanceof Error ? error.message : String(error)),
|
|
364
|
+
before
|
|
365
|
+
};
|
|
343
366
|
}
|
|
344
367
|
}
|
|
345
368
|
async function validateToolResult(definition, result) {
|
|
@@ -361,15 +384,42 @@ async function validateToolResult(definition, result) {
|
|
|
361
384
|
parts
|
|
362
385
|
};
|
|
363
386
|
}
|
|
364
|
-
async function conclude(kernel, where, ended,
|
|
387
|
+
async function conclude(kernel, where, ended, before) {
|
|
365
388
|
const { session, head, run } = where;
|
|
366
389
|
const outcome = await where.runtime.hooks.transform("after_tool", ended.kind === "done" ? ended.value : INTERRUPTED, { session, head, run, principal: where.context.principal });
|
|
367
|
-
const snapshots =
|
|
368
|
-
if (snapshots === null)
|
|
369
|
-
return { outcome,
|
|
370
|
-
const from =
|
|
390
|
+
const snapshots = before !== null && ended.kind === "done" ? await kernel.environments.snapshots(session) : null;
|
|
391
|
+
if (snapshots === null || before === null)
|
|
392
|
+
return { outcome, files: null, thread: null, snapshot: null };
|
|
393
|
+
const from = before.snapshot;
|
|
371
394
|
const to = await snapshots.after(run);
|
|
372
|
-
const files = (await snapshots.diff(from, to))
|
|
395
|
+
const files = fileChanges(await snapshots.diff(from, to));
|
|
396
|
+
const thread = files.length === 0 ? null : fileChanges(await snapshots.diff(await threadStart2(kernel.store, session) ?? from, to));
|
|
397
|
+
return {
|
|
398
|
+
outcome,
|
|
399
|
+
files,
|
|
400
|
+
thread,
|
|
401
|
+
snapshot: to
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
async function readCountedPaths(store, where, after) {
|
|
405
|
+
const through = await store.refs.tail(where.session);
|
|
406
|
+
const paths = new Set;
|
|
407
|
+
let cursor = after;
|
|
408
|
+
while (cursor < through) {
|
|
409
|
+
const events = await store.refs.log(where.session, cursor, 256);
|
|
410
|
+
for (const event of events)
|
|
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
|
+
}
|
|
421
|
+
function fileChanges(set) {
|
|
422
|
+
return set.files.map((file) => {
|
|
373
423
|
const change = {
|
|
374
424
|
path: file.path,
|
|
375
425
|
status: file.status,
|
|
@@ -378,18 +428,8 @@ async function conclude(kernel, where, ended, snapshotted) {
|
|
|
378
428
|
};
|
|
379
429
|
return file.from === undefined ? change : { ...change, from: file.from };
|
|
380
430
|
});
|
|
381
|
-
return {
|
|
382
|
-
outcome,
|
|
383
|
-
changes: {
|
|
384
|
-
added: files.reduce((sum, file) => sum + file.added, 0),
|
|
385
|
-
removed: files.reduce((sum, file) => sum + file.removed, 0),
|
|
386
|
-
paths: files.map((file) => file.path)
|
|
387
|
-
},
|
|
388
|
-
files,
|
|
389
|
-
snapshot: to
|
|
390
|
-
};
|
|
391
431
|
}
|
|
392
|
-
async function settlement(store, where, planned, settled) {
|
|
432
|
+
async function settlement(store, where, planned, settled, before) {
|
|
393
433
|
const { session, head, run, call } = where;
|
|
394
434
|
const part = asId(call);
|
|
395
435
|
const name = partRef2(session, part);
|
|
@@ -399,6 +439,13 @@ async function settlement(store, where, planned, settled) {
|
|
|
399
439
|
]);
|
|
400
440
|
if (found === null)
|
|
401
441
|
return [];
|
|
442
|
+
const counted = before === null ? new Set : await readCountedPaths(store, where, before.seq);
|
|
443
|
+
const files = settled.files?.filter((file) => !counted.has(file.path));
|
|
444
|
+
const changes = files === undefined ? null : {
|
|
445
|
+
added: files.reduce((sum, file) => sum + file.added, 0),
|
|
446
|
+
removed: files.reduce((sum, file) => sum + file.removed, 0),
|
|
447
|
+
paths: files.map((file) => file.path)
|
|
448
|
+
};
|
|
402
449
|
const at = Date.now();
|
|
403
450
|
const state = {
|
|
404
451
|
call,
|
|
@@ -407,7 +454,7 @@ async function settlement(store, where, planned, settled) {
|
|
|
407
454
|
class: planned.class,
|
|
408
455
|
phase: "settled",
|
|
409
456
|
outcome: settled.outcome,
|
|
410
|
-
changes
|
|
457
|
+
changes
|
|
411
458
|
};
|
|
412
459
|
const based = settled.snapshot === null ? [] : await nextBase(store, session, run, settled.snapshot);
|
|
413
460
|
const record = { ...found.record, state, version: found.record.version + 1 };
|
|
@@ -419,9 +466,9 @@ async function settlement(store, where, planned, settled) {
|
|
|
419
466
|
part,
|
|
420
467
|
change: "settled",
|
|
421
468
|
outcome: settled.outcome,
|
|
422
|
-
changes
|
|
469
|
+
changes
|
|
423
470
|
},
|
|
424
|
-
...settled.
|
|
471
|
+
...settled.thread === null ? [] : [{ head: null, kind: "changes", files: settled.thread }]
|
|
425
472
|
];
|
|
426
473
|
if (found.record.status.kind === "failed" || found.record.status.kind === "settled")
|
|
427
474
|
return [
|
|
@@ -448,12 +495,11 @@ async function settlement(store, where, planned, settled) {
|
|
|
448
495
|
return [...landed.updates, ...based];
|
|
449
496
|
}
|
|
450
497
|
async function baseline(kernel, session, run) {
|
|
451
|
-
if (await diffBase(kernel.store, session, run) !== null)
|
|
452
|
-
return;
|
|
453
498
|
const snapshots = await kernel.environments.snapshots(session);
|
|
454
499
|
if (snapshots === null)
|
|
455
|
-
return;
|
|
456
|
-
const
|
|
500
|
+
return null;
|
|
501
|
+
const seq = await kernel.store.refs.tail(session);
|
|
502
|
+
const before = await snapshots.after(run);
|
|
457
503
|
await attempt2(`Recording run ${run}'s snapshot`, async () => {
|
|
458
504
|
const found = await load2(kernel.store, await kernel.store.refs.get(runRef2(session, run)), decodeRunRecord2);
|
|
459
505
|
if (found === null || found.record.snapshot !== null)
|
|
@@ -467,10 +513,7 @@ async function baseline(kernel, session, run) {
|
|
|
467
513
|
]);
|
|
468
514
|
return outcome.kind === "set" ? undefined : STALE2;
|
|
469
515
|
});
|
|
470
|
-
}
|
|
471
|
-
async function diffBase(store, session, run) {
|
|
472
|
-
const found = await load2(store, await store.refs.get(runRef2(session, run)), decodeRunRecord2);
|
|
473
|
-
return found?.record.lastSnapshot ?? found?.record.snapshot ?? null;
|
|
516
|
+
return { snapshot: before, seq };
|
|
474
517
|
}
|
|
475
518
|
async function nextBase(store, session, run, to) {
|
|
476
519
|
const found = await load2(store, await store.refs.get(runRef2(session, run)), decodeRunRecord2);
|
|
@@ -554,7 +597,7 @@ function createInvocation2(kernel, input) {
|
|
|
554
597
|
});
|
|
555
598
|
return outcome.kind === "parked" ? parkStep2(durable) : outcome;
|
|
556
599
|
},
|
|
557
|
-
list: () => source.list()
|
|
600
|
+
list: () => source.list().filter((info) => input.hidden?.has(info.owner) !== true)
|
|
558
601
|
},
|
|
559
602
|
wait: (target) => durable.wait(target),
|
|
560
603
|
memo: (name, compute) => durable.memo(name, compute),
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LOCAL2,
|
|
3
3
|
CORE_CONTEXT2
|
|
4
|
-
} from "./compose-
|
|
4
|
+
} from "./compose-5z835ej2.js";
|
|
5
5
|
import {
|
|
6
6
|
decodeRunRecord2,
|
|
7
7
|
decodeCallRecord2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-gxjc6vz9.js";
|
|
9
9
|
import {
|
|
10
10
|
sessionRef2,
|
|
11
11
|
inboxRef2,
|
|
12
12
|
runRef2,
|
|
13
13
|
endedRunRef2,
|
|
14
14
|
liveRef2
|
|
15
|
-
} from "./compose-
|
|
15
|
+
} from "./compose-cqpjcx2t.js";
|
|
16
16
|
import {
|
|
17
17
|
MAIN2,
|
|
18
18
|
STALE2,
|
|
@@ -25,36 +25,36 @@ import {
|
|
|
25
25
|
put2,
|
|
26
26
|
attempt2,
|
|
27
27
|
sessionEvent2
|
|
28
|
-
} from "./compose-
|
|
28
|
+
} from "./compose-vn7b7fdj.js";
|
|
29
29
|
import {
|
|
30
30
|
failedParts2
|
|
31
|
-
} from "./compose-
|
|
31
|
+
} from "./compose-c2rnebv0.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-pnsvwd3m.js";
|
|
38
38
|
import {
|
|
39
39
|
withFold2,
|
|
40
40
|
liveParts2,
|
|
41
41
|
readRunEnd2
|
|
42
|
-
} from "./compose-
|
|
42
|
+
} from "./compose-xhtgytrh.js";
|
|
43
43
|
import {
|
|
44
44
|
waitFor2
|
|
45
|
-
} from "./compose-
|
|
45
|
+
} from "./compose-ks2rdteq.js";
|
|
46
46
|
import {
|
|
47
47
|
FENCED2,
|
|
48
48
|
stopRun2
|
|
49
|
-
} from "./compose-
|
|
49
|
+
} from "./compose-gvrqkyn4.js";
|
|
50
50
|
import {
|
|
51
51
|
send2
|
|
52
|
-
} from "./compose-
|
|
52
|
+
} from "./compose-pe0cgbv0.js";
|
|
53
53
|
|
|
54
54
|
// src/engine/runs.ts
|
|
55
55
|
import { asId, isJsonObject, SdkError } from "@nyte-ai/schema";
|
|
56
56
|
var REPORT_LIMIT = 4096;
|
|
57
|
-
async function newRun2(store, session, head, origin, configuration) {
|
|
57
|
+
async function newRun2(store, session, head, origin, configuration, requires = []) {
|
|
58
58
|
const id = asId(crypto.randomUUID());
|
|
59
59
|
const startedAt = Date.now();
|
|
60
60
|
const view = { id, head, startedAt, attempt: 1, configuration, origin };
|
|
@@ -68,7 +68,8 @@ async function newRun2(store, session, head, origin, configuration) {
|
|
|
68
68
|
lastSnapshot: null,
|
|
69
69
|
usage: null,
|
|
70
70
|
requests: 0,
|
|
71
|
-
parked: []
|
|
71
|
+
parked: [],
|
|
72
|
+
requires: [...requires]
|
|
72
73
|
};
|
|
73
74
|
const target = await put2(store, "run", record, startedAt);
|
|
74
75
|
return {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodePrincipalRecord2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-gxjc6vz9.js";
|
|
4
4
|
import {
|
|
5
5
|
hostPrincipalsRef2
|
|
6
|
-
} from "./compose-
|
|
6
|
+
} from "./compose-cqpjcx2t.js";
|
|
7
7
|
import {
|
|
8
8
|
load2,
|
|
9
9
|
readRefExpectation2,
|
|
10
10
|
put2
|
|
11
|
-
} from "./compose-
|
|
11
|
+
} from "./compose-vn7b7fdj.js";
|
|
12
12
|
import {
|
|
13
13
|
commit2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-pnsvwd3m.js";
|
|
15
15
|
|
|
16
16
|
// src/engine/principals.ts
|
|
17
17
|
import { asId, OPERATIONS, SdkError } from "@nyte-ai/schema";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
sessionRef2,
|
|
6
6
|
headRef2,
|
|
7
7
|
kvRef2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-cqpjcx2t.js";
|
|
9
9
|
import {
|
|
10
10
|
MAIN2,
|
|
11
11
|
EMPTY_REVISION2,
|
|
@@ -13,31 +13,31 @@ import {
|
|
|
13
13
|
requireSession2,
|
|
14
14
|
put2,
|
|
15
15
|
attempt2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-vn7b7fdj.js";
|
|
17
17
|
import {
|
|
18
18
|
check2
|
|
19
19
|
} from "./compose-bj54tkph.js";
|
|
20
20
|
import {
|
|
21
21
|
commit2
|
|
22
|
-
} from "./compose-
|
|
22
|
+
} from "./compose-pnsvwd3m.js";
|
|
23
23
|
import {
|
|
24
24
|
WORKSPACE_TRUST2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-h3pch7ch.js";
|
|
26
26
|
import {
|
|
27
27
|
SKILL_PATHS2,
|
|
28
28
|
dropScans2
|
|
29
|
-
} from "./compose-
|
|
29
|
+
} from "./compose-mamr4qwf.js";
|
|
30
30
|
import {
|
|
31
31
|
trustChanged2
|
|
32
|
-
} from "./compose-
|
|
32
|
+
} from "./compose-tb5ywdfk.js";
|
|
33
33
|
import {
|
|
34
34
|
settingInfos2,
|
|
35
35
|
readSettingLayers2,
|
|
36
36
|
findSettingDefinition2
|
|
37
|
-
} from "./compose-
|
|
37
|
+
} from "./compose-qwbe95qs.js";
|
|
38
38
|
import {
|
|
39
39
|
publishCatalog2
|
|
40
|
-
} from "./compose-
|
|
40
|
+
} from "./compose-r1pxdxbw.js";
|
|
41
41
|
|
|
42
42
|
// src/extend/settings.ts
|
|
43
43
|
import { isJson, SdkError } from "@nyte-ai/schema";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeRunRecord2,
|
|
3
3
|
decodePartRecord2,
|
|
4
|
-
decodeCallRecord2
|
|
5
|
-
|
|
4
|
+
decodeCallRecord2,
|
|
5
|
+
decodeJobRecord2
|
|
6
|
+
} from "./compose-gxjc6vz9.js";
|
|
6
7
|
import {
|
|
7
8
|
runRef2,
|
|
8
9
|
partRef2,
|
|
9
|
-
callRef2
|
|
10
|
-
|
|
10
|
+
callRef2,
|
|
11
|
+
jobRef2
|
|
12
|
+
} from "./compose-cqpjcx2t.js";
|
|
11
13
|
import {
|
|
12
14
|
dev2
|
|
13
15
|
} from "./compose-n116fnmp.js";
|
|
@@ -15,10 +17,10 @@ import {
|
|
|
15
17
|
load2,
|
|
16
18
|
put2,
|
|
17
19
|
readCall2
|
|
18
|
-
} from "./compose-
|
|
20
|
+
} from "./compose-vn7b7fdj.js";
|
|
19
21
|
import {
|
|
20
22
|
storedAnswer2
|
|
21
|
-
} from "./compose-
|
|
23
|
+
} from "./compose-c2rnebv0.js";
|
|
22
24
|
import {
|
|
23
25
|
WAITS2,
|
|
24
26
|
TIME2,
|
|
@@ -33,10 +35,10 @@ import {
|
|
|
33
35
|
import {
|
|
34
36
|
commit2,
|
|
35
37
|
changeCall2
|
|
36
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-pnsvwd3m.js";
|
|
37
39
|
import {
|
|
38
40
|
readRunEnd2
|
|
39
|
-
} from "./compose-
|
|
41
|
+
} from "./compose-xhtgytrh.js";
|
|
40
42
|
|
|
41
43
|
// src/engine/waits.ts
|
|
42
44
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
@@ -141,8 +143,8 @@ function createWaitRegistry2(kernel, rerunAction) {
|
|
|
141
143
|
return answer === null ? null : { kind: "part", part: target.part, answer };
|
|
142
144
|
}
|
|
143
145
|
case "job": {
|
|
144
|
-
const
|
|
145
|
-
return
|
|
146
|
+
const end = await jobOutcome2(kernel, target.job);
|
|
147
|
+
return end === null ? null : { kind: "job", job: target.job, end };
|
|
146
148
|
}
|
|
147
149
|
case "timer":
|
|
148
150
|
return null;
|
|
@@ -304,6 +306,20 @@ async function pendingCalls(kernel, sessions) {
|
|
|
304
306
|
}));
|
|
305
307
|
return found.flat();
|
|
306
308
|
}
|
|
309
|
+
async function readJob2(store, id) {
|
|
310
|
+
return load2(store, await store.refs.get(jobRef2(id)), decodeJobRecord2);
|
|
311
|
+
}
|
|
312
|
+
async function jobOutcome2(kernel, id) {
|
|
313
|
+
const local = kernel.jobs.get(id)?.view.state;
|
|
314
|
+
if (local !== undefined)
|
|
315
|
+
return local.kind === "running" ? null : local;
|
|
316
|
+
const found = await readJob2(kernel.store, id);
|
|
317
|
+
if (found === null)
|
|
318
|
+
return LOST;
|
|
319
|
+
if (found.record.end !== null)
|
|
320
|
+
return found.record.end;
|
|
321
|
+
return found.record.instance === kernel.instance || kernel.presence === null ? LOST : null;
|
|
322
|
+
}
|
|
307
323
|
function wake(kernel, session, record) {
|
|
308
324
|
if (record.head === null && lapsed2(kernel, record))
|
|
309
325
|
kernel.waits.rerun(session, record.id);
|
|
@@ -428,4 +444,4 @@ function lapsed2(kernel, record) {
|
|
|
428
444
|
return record.result === null && record.waiting === null && record.reran !== null && record.reran.waits === record.waits.length && record.reran.holder !== kernel.instance && record.reran.expiresAt <= Date.now();
|
|
429
445
|
}
|
|
430
446
|
|
|
431
|
-
export { createWaitRegistry2, listSessionWaits2, loadWaits2, earliestWake2, waitFor2, runWait2, readParkedWait2, waitingOn2, lapsed2 };
|
|
447
|
+
export { createWaitRegistry2, listSessionWaits2, loadWaits2, readJob2, jobOutcome2, earliestWake2, waitFor2, runWait2, readParkedWait2, waitingOn2, lapsed2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSessionRef2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-cqpjcx2t.js";
|
|
4
4
|
|
|
5
5
|
// src/store/log.ts
|
|
6
6
|
import { SdkError, SessionEventSchema } from "@nyte-ai/schema";
|
|
@@ -12,9 +12,7 @@ function admits2(update, current) {
|
|
|
12
12
|
return current?.revision === update.expect;
|
|
13
13
|
}
|
|
14
14
|
function fenceNames2(updates) {
|
|
15
|
-
return [
|
|
16
|
-
...new Set(updates.flatMap((update) => update.fence === undefined ? [] : [update.fence]))
|
|
17
|
-
];
|
|
15
|
+
return [...new Set(updates.flatMap((update) => update.fences ?? []))];
|
|
18
16
|
}
|
|
19
17
|
function collectSessionEvents2(updates) {
|
|
20
18
|
return updates.flatMap((update) => {
|