@nyte-ai/core 0.0.24 → 0.0.25-nightly.20261025.2
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/THIRD-PARTY-NOTICES.md +13 -5
- package/dist/chunks/{compose-nj4nj5n9.js → compose-0f9x3cjd.js} +1 -1
- package/dist/chunks/{compose-nkxwrphm.js → compose-0jtc3169.js} +39 -25
- package/dist/chunks/{compose-matk94se.js → compose-0rpfpwsp.js} +6 -6
- 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-5njywhy8.js → compose-16d6m2yk.js} +6 -6
- package/dist/chunks/compose-1hgkp0q6.js +154 -0
- package/dist/chunks/{compose-ht1tbyr3.js → compose-1zcz79y0.js} +22 -10
- package/dist/chunks/{compose-tppkp915.js → compose-2686emyc.js} +4 -4
- package/dist/chunks/compose-2e84znn8.js +62 -0
- package/dist/chunks/{compose-jwy1gba9.js → compose-2k9gtwym.js} +3 -3
- package/dist/chunks/{compose-mcz93154.js → compose-2zv4kak9.js} +15 -11
- package/dist/chunks/{compose-qjxtbzgq.js → compose-30wjb3f7.js} +13 -7
- package/dist/chunks/{compose-r8tz1xfj.js → compose-3fsmzem7.js} +9 -5
- package/dist/chunks/{compose-5rg7askh.js → compose-4krv4vzw.js} +13 -5
- package/dist/chunks/{compose-csh5vv2t.js → compose-6e9ktyhr.js} +1 -1
- package/dist/chunks/{compose-9jvn2wvh.js → compose-6sf5hp8s.js} +100 -16
- package/dist/chunks/{compose-dbsn3bsy.js → compose-6zgf2dtw.js} +6 -3
- package/dist/chunks/{compose-fnncnk81.js → compose-71gcpf17.js} +5 -5
- package/dist/chunks/{compose-vzvm76dn.js → compose-79h43be5.js} +13 -5
- package/dist/chunks/compose-7bpnxft1.js +20 -0
- package/dist/chunks/{compose-e3635qmn.js → compose-8ranx653.js} +17 -2
- package/dist/chunks/{compose-42egt9y7.js → compose-9bdnm7rj.js} +24 -12
- package/dist/chunks/{compose-enq3x3rq.js → compose-ae3zaa70.js} +69 -16
- package/dist/chunks/{compose-gvm49f4b.js → compose-b10qcn9b.js} +1 -1
- package/dist/chunks/{compose-2rha31fc.js → compose-c258nc2c.js} +4 -4
- 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-smsafpqe.js → compose-d5yhtpa7.js} +2 -2
- package/dist/chunks/{compose-97y00axn.js → compose-dp3h0fc0.js} +30 -16
- package/dist/chunks/{compose-gxjc6vz9.js → compose-dw8fvn94.js} +4 -2
- package/dist/chunks/{compose-nw5hdpxk.js → compose-egbfgq9x.js} +8 -8
- package/dist/chunks/{compose-1tdb9ezw.js → compose-ek8qhasq.js} +33 -22
- package/dist/chunks/{compose-qwbe95qs.js → compose-enaz2vzg.js} +12 -3
- package/dist/chunks/{compose-bz70g01d.js → compose-eyf1k580.js} +5 -5
- package/dist/chunks/{compose-gj2ypr7q.js → compose-f5m11q9e.js} +3 -3
- package/dist/chunks/{compose-w6zb11k1.js → compose-g3t6wvp4.js} +8 -8
- package/dist/chunks/{compose-917xy085.js → compose-hjssyk7n.js} +174 -13
- package/dist/chunks/{compose-bbhk8vnr.js → compose-hyv5s2ds.js} +2 -2
- package/dist/chunks/{compose-d95fwwvw.js → compose-kwbs1f34.js} +2 -2
- package/dist/chunks/{compose-v46qmh60.js → compose-m24z174t.js} +64 -127
- package/dist/chunks/{compose-j42p9wfs.js → compose-n29d5dzv.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-pb3420v8.js +74 -0
- package/dist/chunks/{compose-ts08bth2.js → compose-pcfvksb2.js} +1 -1
- package/dist/chunks/{compose-byse0eqj.js → compose-pmg34fjv.js} +6 -6
- package/dist/chunks/{compose-yr19b453.js → compose-pt48xw3f.js} +7 -7
- 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-a40dnhy5.js → compose-qxn2kq6e.js} +11 -18
- package/dist/chunks/{compose-bd8c5n7k.js → compose-qyjchprv.js} +2 -2
- package/dist/chunks/{compose-c4z4kp98.js → compose-r2h4fwk1.js} +118 -42
- package/dist/chunks/{compose-ae5t6v5b.js → compose-r9q7jf4e.js} +8 -5
- package/dist/chunks/compose-rdprm263.js +63 -0
- package/dist/chunks/compose-s23st6q6.js +4 -0
- package/dist/chunks/{compose-t9fcqtby.js → compose-sewnv4bq.js} +97 -88
- package/dist/chunks/{compose-sd0stm97.js → compose-sp6d0d37.js} +1 -13
- package/dist/chunks/compose-sr2wnvct.js +96 -0
- package/dist/chunks/{compose-ay7t13m9.js → compose-szzyh482.js} +8 -8
- package/dist/chunks/{compose-jeemzja1.js → compose-t76kg3y3.js} +3 -3
- package/dist/chunks/compose-tgca43vp.js +59 -0
- package/dist/chunks/{compose-ad80nkkn.js → compose-vax85d5c.js} +7 -7
- package/dist/chunks/{compose-m01wspwf.js → compose-vyyb17zb.js} +1 -1
- package/dist/chunks/compose-wgs4rgfp.js +32 -0
- package/dist/chunks/{compose-mdwr0er9.js → compose-wvhedsv0.js} +4 -4
- package/dist/chunks/{compose-qxfq6dn9.js → compose-wwf4z4kq.js} +8 -8
- package/dist/chunks/{compose-4ppmas7g.js → compose-xb1js0ah.js} +4 -4
- package/dist/chunks/{compose-c9wxgbjp.js → compose-xf3fht3g.js} +2 -2
- package/dist/chunks/{compose-8pp3vtv0.js → compose-xh3v0ppv.js} +4 -4
- package/dist/chunks/{compose-vn7b7fdj.js → compose-ydth4n0z.js} +7 -3
- package/dist/chunks/{compose-sprfv38c.js → compose-yvzt0tk5.js} +4 -4
- package/dist/chunks/{compose-xvbyp65f.js → compose-ywhk6fhv.js} +30 -10
- package/dist/chunks/{compose-6gt28900.js → compose-yxhvzsed.js} +4 -4
- package/dist/chunks/{compose-1xn3eecn.js → compose-zehjryd3.js} +47 -42
- package/dist/chunks/{compose-2gsbcjgv.js → compose-zg6mejam.js} +23 -19
- 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 +39 -38
- 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 +28 -27
- package/dist/src/agent/tool-runner.d.ts +5 -5
- package/dist/src/agent/tool-runner.js +39 -31
- package/dist/src/agent/transcript.d.ts +7 -1
- package/dist/src/agent/transcript.js +37 -34
- package/dist/src/agent/turn.js +49 -44
- package/dist/src/api/connection.js +63 -57
- package/dist/src/api/head.d.ts +1 -2
- package/dist/src/api/head.js +44 -40
- package/dist/src/api/hold.d.ts +7 -0
- package/dist/src/api/hold.js +7 -0
- package/dist/src/api/part.js +21 -19
- package/dist/src/api/server.js +50 -46
- package/dist/src/api/session.js +48 -45
- 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/builtins/mcp.d.ts +2 -2
- package/dist/src/builtins/mcp.js +1 -1
- package/dist/src/compose.js +75 -70
- 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/plugin.d.ts +17 -0
- 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/tools.d.ts +25 -3
- package/dist/src/contract/workspace.d.ts +18 -6
- package/dist/src/drive/execution.js +46 -44
- 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 +26 -21
- package/dist/src/engine/batches.js +19 -19
- package/dist/src/engine/branch-summary.js +18 -18
- package/dist/src/engine/durable.js +18 -18
- package/dist/src/engine/fence.js +17 -17
- package/dist/src/engine/holds.d.ts +4 -0
- package/dist/src/engine/holds.js +43 -0
- package/dist/src/engine/jobs.d.ts +1 -1
- package/dist/src/engine/jobs.js +25 -24
- package/dist/src/engine/lease.d.ts +5 -4
- package/dist/src/engine/lease.js +1 -1
- package/dist/src/engine/move.js +20 -20
- package/dist/src/engine/presence.js +2 -2
- package/dist/src/engine/principals.js +15 -15
- package/dist/src/engine/receipts.js +18 -18
- package/dist/src/engine/runs.js +23 -22
- package/dist/src/engine/start.js +35 -34
- package/dist/src/engine/surface.js +3 -3
- package/dist/src/engine/waits.js +16 -16
- package/dist/src/env/browser.js +26 -25
- package/dist/src/env/environment.js +28 -27
- package/dist/src/env/mcp.js +30 -29
- package/dist/src/env/session-changes.js +3 -3
- package/dist/src/env/trust.js +29 -28
- package/dist/src/env/workspaces.js +34 -32
- package/dist/src/env/worktrees.d.ts +4 -1
- package/dist/src/env/worktrees.js +40 -35
- package/dist/src/extend/activation.d.ts +3 -0
- package/dist/src/extend/activation.js +37 -33
- package/dist/src/extend/hooks.js +20 -20
- package/dist/src/extend/models.js +27 -26
- package/dist/src/extend/plugin-api.js +15 -15
- package/dist/src/extend/plugin-runtime.d.ts +3 -1
- package/dist/src/extend/plugin-runtime.js +40 -39
- package/dist/src/extend/registry.js +25 -24
- package/dist/src/extend/resources.js +30 -29
- package/dist/src/extend/setting-layers.d.ts +1 -0
- package/dist/src/extend/setting-layers.js +5 -3
- package/dist/src/extend/settings.js +37 -36
- package/dist/src/extend/workspace-commands.js +41 -40
- 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 +14 -14
- 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 +18 -18
- package/dist/src/fold/view.d.ts +7 -1
- package/dist/src/fold/view.js +8 -23
- package/dist/src/fold/watch.js +13 -13
- package/dist/src/harness.d.ts +257 -257
- package/dist/src/harness.js +78 -73
- package/dist/src/index.d.ts +5 -3
- package/dist/src/index.js +14 -4
- package/dist/src/server.js +73 -68
- 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 +77 -72
- package/dist/src/util/line-diff.d.ts +5 -5
- package/dist/src/util/trace.d.ts +0 -4
- package/dist/src/util/trace.js +1 -5
- package/package.json +4 -5
- package/dist/chunks/compose-597de3tc.js +0 -68
- package/dist/chunks/compose-ee0h1pk1.js +0 -120
- package/dist/chunks/compose-hfrjm4a1.js +0 -88
- package/dist/chunks/compose-m91ffwss.js +0 -343
- package/dist/src/builtins/delegation.d.ts +0 -2
- package/dist/src/builtins/delegation.js +0 -10
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -55,6 +55,11 @@ SOFTWARE.
|
|
|
55
55
|
`@earendil-works/pi-codemode` 1.0.0 supply the MCP client and QuickJS
|
|
56
56
|
executor. Tool discovery and code-mode integration are adapted from commit
|
|
57
57
|
`86dfceec402ad77e563bf4feab5f26c42d5f5db6`.
|
|
58
|
+
- BM25 tool search (`tool_search`, `searchTools()`), tool namespaces with
|
|
59
|
+
`describeNamespace()`, the budgeted codemode listing and the one-line MCP
|
|
60
|
+
server summary (`packages/plugin/src/tool-search.ts`,
|
|
61
|
+
`packages/plugin/src/codemode.ts`, `packages/core/src/builtins/mcp.ts`) are
|
|
62
|
+
ported from commit `d5b3de22d0e24a3e9c38a9410d3329b099717283`.
|
|
58
63
|
- Transcript reconciliation, checkpoint instruction snapshots, provider system
|
|
59
64
|
updates, and cache warming are ported from the 1.0.0 release commit
|
|
60
65
|
`a13d35a742c6ef8462812a28fbe1d8c8b7431c32`.
|
|
@@ -312,11 +317,14 @@ Copyright 2025 OpenAI
|
|
|
312
317
|
front of the queue (`packages/tui/src/model/interactions.ts`) is its
|
|
313
318
|
`onEmptySubmit`. The rename
|
|
314
319
|
plugin's context construction, prompt, model fallback, and output cleanup
|
|
315
|
-
(`packages/plugin/src/rename.ts`) port OpenCode v2. The web
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
(`packages/plugin/src/rename.ts`) port OpenCode v2. The web plugin
|
|
321
|
+
(`packages/plugin/src/web/`) ports OpenCode v2's web search and fetch tools:
|
|
322
|
+
the search provider registry any plugin can add to (`searchProviders` in
|
|
323
|
+
`packages/core/src/contract/plugin.ts`), its Exa, Firecrawl, Parallel, and
|
|
324
|
+
Tavily adapters, their stateless MCP `tools/call` transport and response
|
|
325
|
+
bounds, the result and error vocabulary, `web_fetch`'s Accept headers,
|
|
326
|
+
Cloudflare-challenge retry and size limits, and the streaming HTML-to-Markdown
|
|
327
|
+
and HTML-to-text converters (`packages/plugin/src/web/html-markdown.ts`).
|
|
320
328
|
- Core's ripgrep resolver and search adapter (`packages/core/src/ripgrep.ts`,
|
|
321
329
|
`packages/core/src/ripgrep/binary.ts`) and filename search
|
|
322
330
|
(`packages/core/src/file-search.ts`) adapt OpenCode v2's core implementation.
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./compose-5z835ej2.js";
|
|
4
4
|
import {
|
|
5
5
|
decodeJobRecord2
|
|
6
|
-
} from "./compose-
|
|
6
|
+
} from "./compose-dw8fvn94.js";
|
|
7
7
|
import {
|
|
8
8
|
JOBS2,
|
|
9
9
|
jobRef2
|
|
@@ -16,28 +16,28 @@ import {
|
|
|
16
16
|
load2,
|
|
17
17
|
readSession2,
|
|
18
18
|
put2
|
|
19
|
-
} from "./compose-
|
|
19
|
+
} from "./compose-ydth4n0z.js";
|
|
20
20
|
import {
|
|
21
21
|
followedTrace2,
|
|
22
22
|
traceparent2
|
|
23
|
-
} from "./compose-
|
|
23
|
+
} from "./compose-sp6d0d37.js";
|
|
24
24
|
import {
|
|
25
25
|
commit2
|
|
26
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-hyv5s2ds.js";
|
|
27
27
|
import {
|
|
28
28
|
closable2
|
|
29
29
|
} from "./compose-zfjxkavf.js";
|
|
30
30
|
import {
|
|
31
31
|
readJob2,
|
|
32
32
|
waitFor2
|
|
33
|
-
} from "./compose-
|
|
33
|
+
} from "./compose-eyf1k580.js";
|
|
34
34
|
import {
|
|
35
35
|
send2
|
|
36
|
-
} from "./compose-
|
|
36
|
+
} from "./compose-sewnv4bq.js";
|
|
37
37
|
import {
|
|
38
38
|
recordAcquisition2,
|
|
39
39
|
recordedAcquisition2
|
|
40
|
-
} from "./compose-
|
|
40
|
+
} from "./compose-pmg34fjv.js";
|
|
41
41
|
|
|
42
42
|
// src/engine/jobs.ts
|
|
43
43
|
import { asId, asSeq, foldJobChange, SdkError } from "@nyte-ai/schema";
|
|
@@ -81,6 +81,16 @@ function createJobTable2(kernel) {
|
|
|
81
81
|
item
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
|
+
const update = (id, change) => {
|
|
85
|
+
const previous = entries.get(id);
|
|
86
|
+
if (previous === undefined)
|
|
87
|
+
return;
|
|
88
|
+
const next = { ...previous, view: change(previous.view) };
|
|
89
|
+
entries.set(id, next);
|
|
90
|
+
announce(next, previous);
|
|
91
|
+
if (previous.view.state.kind === "running" && next.view.state.kind !== "running")
|
|
92
|
+
forgetEnded(next.workspace);
|
|
93
|
+
};
|
|
84
94
|
return {
|
|
85
95
|
get: (id) => entries.get(id),
|
|
86
96
|
byKey: (key) => [...entries.values()].find((entry) => entry.key === key),
|
|
@@ -98,16 +108,7 @@ function createJobTable2(kernel) {
|
|
|
98
108
|
entries.set(entry.view.id, entry);
|
|
99
109
|
announce(entry, null);
|
|
100
110
|
},
|
|
101
|
-
update
|
|
102
|
-
const previous = entries.get(id);
|
|
103
|
-
if (previous === undefined)
|
|
104
|
-
return;
|
|
105
|
-
const next = { ...previous, view: change(previous.view) };
|
|
106
|
-
entries.set(id, next);
|
|
107
|
-
announce(next, previous);
|
|
108
|
-
if (previous.view.state.kind === "running" && next.view.state.kind !== "running")
|
|
109
|
-
forgetEnded(next.workspace);
|
|
110
|
-
},
|
|
111
|
+
update,
|
|
111
112
|
subscribe(workspace, listener) {
|
|
112
113
|
const known = listeners.get(workspace) ?? new Set;
|
|
113
114
|
known.add(listener);
|
|
@@ -125,8 +126,14 @@ function createJobTable2(kernel) {
|
|
|
125
126
|
release(session, call) {
|
|
126
127
|
const started = [...entries.values()].filter((entry) => entry.owner?.session === session && entry.owner.startedBy === call && entry.view.state.kind === "running");
|
|
127
128
|
for (const entry of started)
|
|
128
|
-
|
|
129
|
+
update(entry.view.id, (view) => ({ ...view, foreground: false }));
|
|
129
130
|
return started.length > 0;
|
|
131
|
+
},
|
|
132
|
+
markStopping(id) {
|
|
133
|
+
const entry = entries.get(id);
|
|
134
|
+
if (entry === undefined)
|
|
135
|
+
return;
|
|
136
|
+
entries.set(id, { ...entry, stopping: true });
|
|
130
137
|
}
|
|
131
138
|
};
|
|
132
139
|
}
|
|
@@ -256,6 +263,7 @@ function jobHandle2(kernel, id) {
|
|
|
256
263
|
const state = entry.view.state;
|
|
257
264
|
if (state.kind !== "running")
|
|
258
265
|
return { kind: "settled", outcome: state };
|
|
266
|
+
kernel.jobs.markStopping(id);
|
|
259
267
|
await entry.process.stop();
|
|
260
268
|
return { kind: "settled", outcome: await settled() };
|
|
261
269
|
},
|
|
@@ -278,11 +286,12 @@ async function endJob(kernel, id, end) {
|
|
|
278
286
|
endedAt: Date.now(),
|
|
279
287
|
tail: entry.output.tail()
|
|
280
288
|
}));
|
|
281
|
-
const
|
|
289
|
+
const ended = kernel.jobs.get(id);
|
|
290
|
+
const silent = ended !== undefined && (ended.view.foreground || ended.stopping);
|
|
282
291
|
entry.output.end(end.kind === "exited" ? end.code : null);
|
|
283
292
|
const consumed = await kernel.waits.jobEnded(id, end);
|
|
284
293
|
const owner = entry.owner;
|
|
285
|
-
if (consumed || owner === null || !recorded ||
|
|
294
|
+
if (consumed || owner === null || !recorded || silent)
|
|
286
295
|
return;
|
|
287
296
|
await send2(kernel, {
|
|
288
297
|
session: owner.session,
|
|
@@ -294,7 +303,7 @@ async function endJob(kernel, id, end) {
|
|
|
294
303
|
return;
|
|
295
304
|
});
|
|
296
305
|
}
|
|
297
|
-
async function startJob2(kernel, origin, workspace, input,
|
|
306
|
+
async function startJob2(kernel, origin, workspace, input, foreground = false) {
|
|
298
307
|
const digest = JSON.stringify([
|
|
299
308
|
input.command ?? null,
|
|
300
309
|
input.session ?? null,
|
|
@@ -314,10 +323,14 @@ async function startJob2(kernel, origin, workspace, input, hold = false) {
|
|
|
314
323
|
if (acquired.kind === "recorded")
|
|
315
324
|
return held(asId(acquired.id));
|
|
316
325
|
const id = acquired.value.id;
|
|
317
|
-
await kernel.jobs.start(id, digest, () => spawn(kernel, origin, workspace, input, { id, digest,
|
|
326
|
+
await kernel.jobs.start(id, digest, () => spawn(kernel, origin, workspace, input, { id, digest, foreground }));
|
|
318
327
|
return jobHandle2(kernel, id);
|
|
319
328
|
}
|
|
320
|
-
async function spawn(kernel, origin, workspace, input, {
|
|
329
|
+
async function spawn(kernel, origin, workspace, input, {
|
|
330
|
+
id,
|
|
331
|
+
digest,
|
|
332
|
+
foreground
|
|
333
|
+
}) {
|
|
321
334
|
const on = async (session) => (await readSession2(kernel.store, session))?.record.workspace === workspace;
|
|
322
335
|
if (input.session !== undefined && !await on(input.session))
|
|
323
336
|
throw new SdkError("invalid", `Session ${input.session} is not on workspace ${workspace}.`);
|
|
@@ -377,7 +390,8 @@ async function spawn(kernel, origin, workspace, input, { id, digest, held }) {
|
|
|
377
390
|
state: { kind: "running" },
|
|
378
391
|
startedAt: Date.now(),
|
|
379
392
|
endedAt: null,
|
|
380
|
-
tail: ""
|
|
393
|
+
tail: "",
|
|
394
|
+
foreground
|
|
381
395
|
},
|
|
382
396
|
workspace,
|
|
383
397
|
key: input.pty === undefined ? null : asId(crypto.randomUUID()),
|
|
@@ -385,7 +399,7 @@ async function spawn(kernel, origin, workspace, input, { id, digest, held }) {
|
|
|
385
399
|
owner,
|
|
386
400
|
digest,
|
|
387
401
|
output,
|
|
388
|
-
|
|
402
|
+
stopping: false
|
|
389
403
|
});
|
|
390
404
|
pump(kernel, id, process, output);
|
|
391
405
|
}
|
|
@@ -20,28 +20,28 @@ import {
|
|
|
20
20
|
createPosition2,
|
|
21
21
|
toCommitObjectId2,
|
|
22
22
|
guard2
|
|
23
|
-
} from "./compose-
|
|
23
|
+
} from "./compose-ydth4n0z.js";
|
|
24
24
|
import {
|
|
25
25
|
commit2
|
|
26
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-hyv5s2ds.js";
|
|
27
27
|
import {
|
|
28
28
|
withFold2
|
|
29
|
-
} from "./compose-
|
|
29
|
+
} from "./compose-122g5jvb.js";
|
|
30
30
|
import {
|
|
31
31
|
fence2,
|
|
32
32
|
finishFence2
|
|
33
|
-
} from "./compose-
|
|
33
|
+
} from "./compose-g3t6wvp4.js";
|
|
34
34
|
import {
|
|
35
35
|
holdSummary2,
|
|
36
36
|
summaryHeld2,
|
|
37
37
|
summarizedMove2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-2686emyc.js";
|
|
39
39
|
import {
|
|
40
40
|
settleReceipt2,
|
|
41
41
|
reserve2,
|
|
42
42
|
known2,
|
|
43
43
|
typedReceipt2
|
|
44
|
-
} from "./compose-
|
|
44
|
+
} from "./compose-71gcpf17.js";
|
|
45
45
|
|
|
46
46
|
// src/engine/move.ts
|
|
47
47
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
@@ -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-vax85d5c.js";
|
|
13
13
|
import {
|
|
14
14
|
newRun2,
|
|
15
15
|
begin2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-wwf4z4kq.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-dp3h0fc0.js";
|
|
23
23
|
import {
|
|
24
24
|
createKernel2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-zehjryd3.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";
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
check2
|
|
3
|
+
} from "./compose-bj54tkph.js";
|
|
4
|
+
import {
|
|
5
|
+
text2,
|
|
6
|
+
thinking2
|
|
7
|
+
} from "./compose-fqsqjbrf.js";
|
|
8
|
+
import {
|
|
9
|
+
decodePartRecord2
|
|
10
|
+
} from "./compose-dw8fvn94.js";
|
|
11
|
+
import {
|
|
12
|
+
partRef2
|
|
13
|
+
} from "./compose-cqpjcx2t.js";
|
|
14
|
+
import {
|
|
15
|
+
load2,
|
|
16
|
+
readTip2,
|
|
17
|
+
readRefExpectation2,
|
|
18
|
+
put2
|
|
19
|
+
} from "./compose-ydth4n0z.js";
|
|
20
|
+
import {
|
|
21
|
+
settling2
|
|
22
|
+
} from "./compose-kwbs1f34.js";
|
|
23
|
+
|
|
24
|
+
// src/agent/open-parts.ts
|
|
25
|
+
var ABORTED2 = { class: "aborted", message: "The run was stopped." };
|
|
26
|
+
async function settledParts2(context, opened) {
|
|
27
|
+
const { kernel, session, head } = context;
|
|
28
|
+
if (opened.length === 0)
|
|
29
|
+
return [];
|
|
30
|
+
const [found, tip] = await Promise.all([
|
|
31
|
+
Promise.all(opened.map(async (entry) => ({ entry, found: await readPart(context, entry) }))),
|
|
32
|
+
readTip2(kernel.store, session, head)
|
|
33
|
+
]);
|
|
34
|
+
const at = Date.now();
|
|
35
|
+
const updates = [];
|
|
36
|
+
let parent = tip.id;
|
|
37
|
+
for (const { entry, found: part } of found) {
|
|
38
|
+
if (part === null || part.record.status.kind === "settled")
|
|
39
|
+
continue;
|
|
40
|
+
if (part.record.status.kind !== "live") {
|
|
41
|
+
updates.push(...await keep(context, entry, part, ABORTED2));
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const state = buildPartState(entry);
|
|
45
|
+
const version = Math.max(part.record.version, entry.version) + 1;
|
|
46
|
+
const landed = await settling2(kernel.store, {
|
|
47
|
+
session,
|
|
48
|
+
head,
|
|
49
|
+
run: part.record.run,
|
|
50
|
+
parent,
|
|
51
|
+
expect: parent === tip.id ? readRefExpectation2(tip.ref) : undefined,
|
|
52
|
+
record: { ...part.record, state, version },
|
|
53
|
+
revision: part.ref.revision,
|
|
54
|
+
logged: [{ head, kind: "part", part: entry.part, change: "updated", state, version }],
|
|
55
|
+
body: { kind: "part", part: entry.part },
|
|
56
|
+
at
|
|
57
|
+
});
|
|
58
|
+
updates.push(...landed.updates);
|
|
59
|
+
parent = landed.landed;
|
|
60
|
+
}
|
|
61
|
+
return updates;
|
|
62
|
+
}
|
|
63
|
+
function buildPartState(entry) {
|
|
64
|
+
if (entry.kind === "text")
|
|
65
|
+
return { markdown: entry.markdown, signature: entry.textSignature };
|
|
66
|
+
return {
|
|
67
|
+
markdown: entry.markdown,
|
|
68
|
+
merged: entry.merged,
|
|
69
|
+
signature: entry.thoughts.some((thought) => thought.signature !== null || thought.redacted) ? entry.thoughts.map((thought) => ({ ...thought })) : null
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async function readPart(context, entry) {
|
|
73
|
+
const { kernel, session } = context;
|
|
74
|
+
return load2(kernel.store, await kernel.store.refs.get(partRef2(session, entry.part)), decodePartRecord2);
|
|
75
|
+
}
|
|
76
|
+
async function keep(context, entry, found, failure) {
|
|
77
|
+
const { kernel, session, head } = context;
|
|
78
|
+
const { record } = found;
|
|
79
|
+
const name = partRef2(session, entry.part);
|
|
80
|
+
const part = entry.part;
|
|
81
|
+
const state = buildPartState(entry);
|
|
82
|
+
const version = Math.max(record.version, entry.version) + 1;
|
|
83
|
+
const live = record.status.kind === "live" || record.status.kind === "waiting";
|
|
84
|
+
const status = live ? { kind: "failed", run: record.run, failure } : record.status;
|
|
85
|
+
const target = await put2(kernel.store, "part", { ...record, state, version, status });
|
|
86
|
+
return [
|
|
87
|
+
{
|
|
88
|
+
name,
|
|
89
|
+
target,
|
|
90
|
+
expect: found.ref.revision,
|
|
91
|
+
events: [{ head, kind: "part", part, change: "updated", state, version }]
|
|
92
|
+
},
|
|
93
|
+
...live ? [
|
|
94
|
+
{
|
|
95
|
+
name,
|
|
96
|
+
target,
|
|
97
|
+
events: [{ head, kind: "part", part, change: "failed", failure }]
|
|
98
|
+
}
|
|
99
|
+
] : []
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
async function keepOpen2(context, opened, failure) {
|
|
103
|
+
const kept = await Promise.all(opened.map(async (entry) => {
|
|
104
|
+
const found = await readPart(context, entry);
|
|
105
|
+
return found === null || found.record.status.kind === "settled" ? [] : keep(context, entry, found, failure);
|
|
106
|
+
}));
|
|
107
|
+
return kept.flat();
|
|
108
|
+
}
|
|
109
|
+
async function savedOpen2(context, opened) {
|
|
110
|
+
const { kernel, session, head } = context;
|
|
111
|
+
const saved = await Promise.all(opened.map(async (entry) => {
|
|
112
|
+
const found = await readPart(context, entry);
|
|
113
|
+
if (found === null || found.record.status.kind !== "live")
|
|
114
|
+
return [];
|
|
115
|
+
const state = buildPartState(entry);
|
|
116
|
+
const version = Math.max(found.record.version, entry.version) + 1;
|
|
117
|
+
const part = entry.part;
|
|
118
|
+
return [
|
|
119
|
+
{
|
|
120
|
+
name: partRef2(session, part),
|
|
121
|
+
target: await put2(kernel.store, "part", { ...found.record, state, version }),
|
|
122
|
+
expect: found.ref.revision,
|
|
123
|
+
events: [{ head, kind: "part", part, change: "updated", state, version }]
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
}));
|
|
127
|
+
return saved.flat();
|
|
128
|
+
}
|
|
129
|
+
async function adopt2(part) {
|
|
130
|
+
const adopted = {
|
|
131
|
+
part: part.id,
|
|
132
|
+
version: part.version,
|
|
133
|
+
textSignature: null,
|
|
134
|
+
thoughts: []
|
|
135
|
+
};
|
|
136
|
+
if (part.partKind === "text") {
|
|
137
|
+
const saved = await check2(text2.state, part.state);
|
|
138
|
+
return {
|
|
139
|
+
...adopted,
|
|
140
|
+
kind: "text",
|
|
141
|
+
markdown: saved.kind === "valid" ? saved.value.markdown : "",
|
|
142
|
+
merged: 1
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const saved = await check2(thinking2.state, part.state);
|
|
146
|
+
return {
|
|
147
|
+
...adopted,
|
|
148
|
+
kind: "thinking",
|
|
149
|
+
markdown: saved.kind === "valid" ? saved.value.markdown : "",
|
|
150
|
+
merged: saved.kind === "valid" ? saved.value.merged : 1
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export { ABORTED2, settledParts2, keepOpen2, savedOpen2, adopt2 };
|
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requireSession2,
|
|
3
3
|
coveredHere2
|
|
4
|
-
} from "./compose-
|
|
4
|
+
} from "./compose-ydth4n0z.js";
|
|
5
5
|
import {
|
|
6
6
|
UnavailableError2,
|
|
7
7
|
readWorkspace2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-xb1js0ah.js";
|
|
9
9
|
import {
|
|
10
10
|
projectTrust2
|
|
11
|
-
} from "./compose-
|
|
11
|
+
} from "./compose-xh3v0ppv.js";
|
|
12
12
|
import {
|
|
13
13
|
settle2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-hjssyk7n.js";
|
|
15
15
|
|
|
16
16
|
// src/extend/activation.ts
|
|
17
|
+
import { SdkError } from "@nyte-ai/schema";
|
|
17
18
|
var ACTIVE = { kind: "active" };
|
|
18
19
|
var INACTIVE = { kind: "inactive" };
|
|
19
20
|
async function activateSession2(kernel, session, runtime) {
|
|
20
21
|
const workspace = (await requireSession2(kernel.store, session)).record.workspace;
|
|
21
22
|
const attached = await coveredHere2(kernel, session) ? kernel.environments.attach(session).then(() => ACTIVE, (error) => classifyActivationFailure(workspace, error)) : INACTIVE;
|
|
22
|
-
const
|
|
23
|
+
const assigned = runtime.assigned();
|
|
24
|
+
const project = assigned === null ? await projectPlugins(kernel, workspace) : [];
|
|
23
25
|
try {
|
|
24
|
-
await runtime.load([
|
|
26
|
+
await runtime.load([
|
|
27
|
+
...kernel.plugins.builtins,
|
|
28
|
+
...assigned === null ? kernel.plugins.host : await loadAssigned(kernel, assigned),
|
|
29
|
+
...project
|
|
30
|
+
]);
|
|
25
31
|
} catch (error) {
|
|
26
32
|
settle2(kernel, session, workspace, classifyActivationFailure(workspace, error));
|
|
27
33
|
throw error;
|
|
28
34
|
}
|
|
29
35
|
settle2(kernel, session, workspace, await attached);
|
|
30
36
|
}
|
|
37
|
+
async function loadPlugins2(kernel, plugins) {
|
|
38
|
+
const each = await Promise.all(plugins.map(async (plugin) => ("id" in plugin) ? [plugin] : kernel.plugins.load([plugin.path])));
|
|
39
|
+
return each.flat();
|
|
40
|
+
}
|
|
41
|
+
async function loadAssigned(kernel, plugins) {
|
|
42
|
+
return loadPlugins2(kernel, plugins).catch((error) => {
|
|
43
|
+
throw new SdkError("unavailable", `The plugins assigned to this session did not load: ${error instanceof Error ? error.message : String(error)}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
31
46
|
async function newChatPlugins2(kernel, workspace) {
|
|
32
47
|
return [
|
|
33
48
|
...kernel.plugins.builtins,
|
|
@@ -70,8 +85,5 @@ async function projectPlugins(kernel, workspace) {
|
|
|
70
85
|
function classifyActivationFailure(workspace, error) {
|
|
71
86
|
return error instanceof UnavailableError2 ? { kind: "unavailable", workspace, reason: error.reason } : { kind: "failed", message: error instanceof Error ? error.message : String(error) };
|
|
72
87
|
}
|
|
73
|
-
function sessionPlugins(kernel, runtime) {
|
|
74
|
-
return [...kernel.plugins.builtins, ...runtime.assigned() ?? kernel.plugins.host];
|
|
75
|
-
}
|
|
76
88
|
|
|
77
|
-
export { activateSession2, newChatPlugins2 };
|
|
89
|
+
export { activateSession2, loadPlugins2, newChatPlugins2 };
|
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
walkCommitPath2,
|
|
14
14
|
toCommitObjectId2,
|
|
15
15
|
guard2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-ydth4n0z.js";
|
|
17
17
|
import {
|
|
18
18
|
commit2
|
|
19
|
-
} from "./compose-
|
|
19
|
+
} from "./compose-hyv5s2ds.js";
|
|
20
20
|
import {
|
|
21
21
|
withFold2
|
|
22
|
-
} from "./compose-
|
|
22
|
+
} from "./compose-122g5jvb.js";
|
|
23
23
|
import {
|
|
24
24
|
fence2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-g3t6wvp4.js";
|
|
26
26
|
|
|
27
27
|
// src/engine/branch-summary.ts
|
|
28
28
|
import { asId } from "@nyte-ai/schema";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inboxRef2,
|
|
3
|
+
receiptRef2
|
|
4
|
+
} from "./compose-cqpjcx2t.js";
|
|
5
|
+
import {
|
|
6
|
+
inboxWithout2,
|
|
7
|
+
readRefExpectation2,
|
|
8
|
+
put2
|
|
9
|
+
} from "./compose-ydth4n0z.js";
|
|
10
|
+
|
|
11
|
+
// src/engine/admission-writes.ts
|
|
12
|
+
function buildMessage2(id, submission, placed) {
|
|
13
|
+
return {
|
|
14
|
+
id,
|
|
15
|
+
at: Date.now(),
|
|
16
|
+
content: submission.content,
|
|
17
|
+
source: submission.source,
|
|
18
|
+
delivery: submission.delivery,
|
|
19
|
+
...placed
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async function admitted2(kernel, session, head, inbox, messages, message) {
|
|
23
|
+
const input = message.source.kind === "user" && message.delivery !== "attach";
|
|
24
|
+
const pendingInput = [
|
|
25
|
+
...inbox.pendingInput.filter((id) => id !== message.id),
|
|
26
|
+
...input ? [message.id] : []
|
|
27
|
+
];
|
|
28
|
+
return {
|
|
29
|
+
name: inboxRef2(session, head),
|
|
30
|
+
target: await put2(kernel.store, "inbox", {
|
|
31
|
+
...inboxWithout2(inbox, []),
|
|
32
|
+
messages,
|
|
33
|
+
pendingInput
|
|
34
|
+
}),
|
|
35
|
+
expect: readRefExpectation2(inbox.ref),
|
|
36
|
+
events: [
|
|
37
|
+
{
|
|
38
|
+
head,
|
|
39
|
+
kind: "input",
|
|
40
|
+
message: message.id,
|
|
41
|
+
change: "admitted",
|
|
42
|
+
content: message.content,
|
|
43
|
+
source: message.source,
|
|
44
|
+
delivery: message.delivery,
|
|
45
|
+
schedule: message.schedule,
|
|
46
|
+
covered: message.covered,
|
|
47
|
+
configuration: message.configuration,
|
|
48
|
+
replaced: message.replaced,
|
|
49
|
+
requires: [...kernel.presence?.member.capabilities ?? []]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async function pendingReceipt2(store, session, id, digest, expect) {
|
|
55
|
+
return {
|
|
56
|
+
name: receiptRef2(session, id),
|
|
57
|
+
target: await put2(store, "receipt", { id, kind: "send", digest, outcome: null }),
|
|
58
|
+
expect
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { buildMessage2, admitted2, pendingReceipt2 };
|
|
@@ -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-hyv5s2ds.js";
|
|
15
15
|
|
|
16
16
|
// src/engine/principals.ts
|
|
17
17
|
import { asId, OPERATIONS, SdkError } from "@nyte-ai/schema";
|