@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,28 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readWorkspace2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-qknd62yj.js";
|
|
4
4
|
import {
|
|
5
5
|
scanWorkspaceResources2
|
|
6
|
-
} from "./compose-
|
|
6
|
+
} from "./compose-mamr4qwf.js";
|
|
7
7
|
import {
|
|
8
8
|
newChatPlugins2
|
|
9
|
-
} from "./compose-
|
|
9
|
+
} from "./compose-6m60v1pk.js";
|
|
10
10
|
import {
|
|
11
11
|
createHookDispatch2
|
|
12
|
-
} from "./compose-
|
|
12
|
+
} from "./compose-31zqcfte.js";
|
|
13
13
|
import {
|
|
14
14
|
createRegistrySet2,
|
|
15
15
|
skillInfos2,
|
|
16
16
|
commandInfos2,
|
|
17
17
|
invokeCommand2,
|
|
18
18
|
completeCommand2
|
|
19
|
-
} from "./compose-
|
|
19
|
+
} from "./compose-r1pxdxbw.js";
|
|
20
20
|
import {
|
|
21
21
|
settingHandle2
|
|
22
|
-
} from "./compose-
|
|
22
|
+
} from "./compose-jrqn6xhy.js";
|
|
23
23
|
import {
|
|
24
24
|
activateApart2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-m1ecjzm2.js";
|
|
26
26
|
|
|
27
27
|
// src/extend/workspace-commands.ts
|
|
28
28
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
} from "./compose-q6c7wswc.js";
|
|
5
5
|
import {
|
|
6
6
|
readReceipt2
|
|
7
|
-
} from "./compose-
|
|
7
|
+
} from "./compose-vn7b7fdj.js";
|
|
8
8
|
import {
|
|
9
9
|
writeReceipt2
|
|
10
|
-
} from "./compose-
|
|
10
|
+
} from "./compose-pnsvwd3m.js";
|
|
11
11
|
import {
|
|
12
12
|
waitFor2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-ks2rdteq.js";
|
|
14
14
|
import {
|
|
15
15
|
settleReceipt2,
|
|
16
16
|
typedReceipt2
|
|
17
|
-
} from "./compose-
|
|
17
|
+
} from "./compose-prchdrqk.js";
|
|
18
18
|
|
|
19
19
|
// src/engine/batches.ts
|
|
20
20
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LOCAL2,
|
|
3
3
|
PARTICIPANT_AUTHORITY2
|
|
4
|
-
} from "./compose-
|
|
4
|
+
} from "./compose-5z835ej2.js";
|
|
5
5
|
import {
|
|
6
6
|
decodeRunRecord2,
|
|
7
7
|
decodePartRecord2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-gxjc6vz9.js";
|
|
9
9
|
import {
|
|
10
10
|
runRef2,
|
|
11
11
|
partRef2,
|
|
12
12
|
callRef2
|
|
13
|
-
} from "./compose-
|
|
13
|
+
} from "./compose-cqpjcx2t.js";
|
|
14
14
|
import {
|
|
15
15
|
dev2
|
|
16
16
|
} from "./compose-n116fnmp.js";
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
readRefExpectation2,
|
|
22
22
|
put2,
|
|
23
23
|
attempt2
|
|
24
|
-
} from "./compose-
|
|
24
|
+
} from "./compose-vn7b7fdj.js";
|
|
25
25
|
import {
|
|
26
26
|
settling2,
|
|
27
27
|
failedParts2
|
|
28
|
-
} from "./compose-
|
|
28
|
+
} from "./compose-c2rnebv0.js";
|
|
29
29
|
import {
|
|
30
30
|
startSpan2,
|
|
31
31
|
traced2,
|
|
@@ -36,26 +36,26 @@ import {
|
|
|
36
36
|
} from "./compose-84272xbk.js";
|
|
37
37
|
import {
|
|
38
38
|
commit2
|
|
39
|
-
} from "./compose-
|
|
39
|
+
} from "./compose-pnsvwd3m.js";
|
|
40
40
|
import {
|
|
41
41
|
withFold2
|
|
42
|
-
} from "./compose-
|
|
42
|
+
} from "./compose-xhtgytrh.js";
|
|
43
43
|
import {
|
|
44
44
|
intendedCall2
|
|
45
|
-
} from "./compose-
|
|
45
|
+
} from "./compose-eemt6sea.js";
|
|
46
46
|
import {
|
|
47
47
|
stopRequested2
|
|
48
|
-
} from "./compose-
|
|
48
|
+
} from "./compose-gvrqkyn4.js";
|
|
49
49
|
import {
|
|
50
50
|
awaitMcpServers2
|
|
51
|
-
} from "./compose-
|
|
51
|
+
} from "./compose-v9yf9mrh.js";
|
|
52
52
|
import {
|
|
53
53
|
publishPatch2
|
|
54
|
-
} from "./compose-
|
|
54
|
+
} from "./compose-jehg40ce.js";
|
|
55
55
|
import {
|
|
56
56
|
modelInfo2,
|
|
57
57
|
withLimits2
|
|
58
|
-
} from "./compose-
|
|
58
|
+
} from "./compose-exfx5b4d.js";
|
|
59
59
|
import {
|
|
60
60
|
agentLoop2
|
|
61
61
|
} from "./compose-e3635qmn.js";
|
|
@@ -65,19 +65,19 @@ import {
|
|
|
65
65
|
charge2,
|
|
66
66
|
requestEvent2,
|
|
67
67
|
providerContext2
|
|
68
|
-
} from "./compose-
|
|
68
|
+
} from "./compose-ccrh32hd.js";
|
|
69
69
|
import {
|
|
70
70
|
requestBody2,
|
|
71
71
|
estimateTranscriptTokens2
|
|
72
|
-
} from "./compose-
|
|
72
|
+
} from "./compose-4770pb1s.js";
|
|
73
73
|
import {
|
|
74
74
|
compact2,
|
|
75
75
|
failLeftoverCompactions2,
|
|
76
76
|
readProviderCheckpoint2
|
|
77
|
-
} from "./compose-
|
|
77
|
+
} from "./compose-hf6xkwdw.js";
|
|
78
78
|
import {
|
|
79
79
|
executeCall2
|
|
80
|
-
} from "./compose-
|
|
80
|
+
} from "./compose-hms4hf6p.js";
|
|
81
81
|
|
|
82
82
|
// src/agent/turn.ts
|
|
83
83
|
import { asId, isJson, SdkError } from "@nyte-ai/schema";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
objectId2
|
|
3
|
+
} from "./compose-q6c7wswc.js";
|
|
4
|
+
import {
|
|
5
|
+
headRef2,
|
|
6
|
+
runRef2,
|
|
7
|
+
runCallsPrefix2
|
|
8
|
+
} from "./compose-cqpjcx2t.js";
|
|
9
|
+
import {
|
|
10
|
+
dev2
|
|
11
|
+
} from "./compose-n116fnmp.js";
|
|
12
|
+
import {
|
|
13
|
+
liveRun3,
|
|
14
|
+
put2
|
|
15
|
+
} from "./compose-vn7b7fdj.js";
|
|
16
|
+
|
|
17
|
+
// src/drive/interruptions.ts
|
|
18
|
+
var RESTART_LIMIT2 = 5;
|
|
19
|
+
function crashLooping2(record) {
|
|
20
|
+
return (record.interrupted?.count ?? 0) >= RESTART_LIMIT2;
|
|
21
|
+
}
|
|
22
|
+
function parkedFailure2(record) {
|
|
23
|
+
return {
|
|
24
|
+
class: "runner",
|
|
25
|
+
message: `Stopped after Nyte was interrupted ${String(record.interrupted?.count ?? RESTART_LIMIT2)} times while working on this, with no progress in between. Send a message to continue.`
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async function interruption2(kernel, session, head) {
|
|
29
|
+
const live = await liveRun3(kernel.store, session, head);
|
|
30
|
+
if (live === null || kernel.executionState.driving.has(live.record.view.id))
|
|
31
|
+
return [];
|
|
32
|
+
const run = live.record.view.id;
|
|
33
|
+
const mark = await progressMark(kernel.store, session, head, run);
|
|
34
|
+
const count = live.record.interrupted?.mark === mark ? live.record.interrupted.count + 1 : 1;
|
|
35
|
+
dev2("execution", "interrupted", { session, head, run, count });
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
name: runRef2(session, run),
|
|
39
|
+
target: await put2(kernel.store, "run", { ...live.record, interrupted: { count, mark } }),
|
|
40
|
+
expect: live.ref.revision
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
async function progressMark(store, session, head, run) {
|
|
45
|
+
const [tip, calls] = await Promise.all([
|
|
46
|
+
store.refs.get(headRef2(session, head)),
|
|
47
|
+
store.refs.list(runCallsPrefix2(session, run))
|
|
48
|
+
]);
|
|
49
|
+
return objectId2([tip?.revision ?? null, ...calls.map((ref) => `${ref.name}@${ref.revision}`)]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { RESTART_LIMIT2, crashLooping2, parkedFailure2, interruption2 };
|
|
@@ -15,5 +15,10 @@ var CORE_CONTEXT2 = {
|
|
|
15
15
|
origin: null
|
|
16
16
|
};
|
|
17
17
|
var PARTICIPANT_AUTHORITY2 = new Set(["participant"]);
|
|
18
|
+
var IMAGE_LIMITS2 = {
|
|
19
|
+
maxWidth: 2000,
|
|
20
|
+
maxHeight: 2000,
|
|
21
|
+
maxBase64Bytes: 4.5 * 1024 * 1024
|
|
22
|
+
};
|
|
18
23
|
|
|
19
|
-
export { LOCAL2, TOKEN2, ALL_AUTHORITY2, TOKEN_AUTHORITY2, CORE_CONTEXT2, PARTICIPANT_AUTHORITY2 };
|
|
24
|
+
export { LOCAL2, TOKEN2, ALL_AUTHORITY2, TOKEN_AUTHORITY2, CORE_CONTEXT2, PARTICIPANT_AUTHORITY2, IMAGE_LIMITS2 };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
START2,
|
|
6
6
|
readPositionCommit2
|
|
7
|
-
} from "./compose-
|
|
7
|
+
} from "./compose-vn7b7fdj.js";
|
|
8
8
|
import {
|
|
9
9
|
IDLE2,
|
|
10
10
|
WORKING2,
|
|
@@ -22,19 +22,23 @@ import {
|
|
|
22
22
|
partView2,
|
|
23
23
|
toPartMessageId2,
|
|
24
24
|
pendingTurn2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-h14pmqv3.js";
|
|
26
26
|
import {
|
|
27
27
|
applyCall2,
|
|
28
28
|
describeLiveActivity2
|
|
29
|
-
} from "./compose-
|
|
29
|
+
} from "./compose-j42p9wfs.js";
|
|
30
30
|
import {
|
|
31
31
|
finish2
|
|
32
|
-
} from "./compose-
|
|
32
|
+
} from "./compose-dbsn3bsy.js";
|
|
33
33
|
|
|
34
34
|
// src/fold/fold.ts
|
|
35
35
|
import { asId, asSeq, isJsonObject } from "@nyte-ai/schema";
|
|
36
36
|
var INACTIVE = { kind: "inactive" };
|
|
37
|
-
var SINGLE = {
|
|
37
|
+
var SINGLE = {
|
|
38
|
+
index: 0,
|
|
39
|
+
count: 1,
|
|
40
|
+
ids: []
|
|
41
|
+
};
|
|
38
42
|
var EMPTY_CATALOG2 = {
|
|
39
43
|
commands: [],
|
|
40
44
|
settings: [],
|
|
@@ -139,7 +143,7 @@ function apply(draft, event) {
|
|
|
139
143
|
case "request":
|
|
140
144
|
return eachHead(draft, event.head, (head) => ({ ...head, context: event.context }));
|
|
141
145
|
case "changes":
|
|
142
|
-
draft.changes =
|
|
146
|
+
draft.changes = event.files;
|
|
143
147
|
return;
|
|
144
148
|
case "session":
|
|
145
149
|
return applySession(draft, event);
|
|
@@ -339,6 +343,7 @@ function admit(draft, event) {
|
|
|
339
343
|
covered: event.covered,
|
|
340
344
|
configuration: event.configuration,
|
|
341
345
|
replaced: event.replaced,
|
|
346
|
+
requires: event.requires ?? null,
|
|
342
347
|
landed: null
|
|
343
348
|
});
|
|
344
349
|
setMessage2(draft, {
|
|
@@ -648,13 +653,5 @@ function sameTurnState(left, right) {
|
|
|
648
653
|
return left.on === right.on;
|
|
649
654
|
return left === right;
|
|
650
655
|
}
|
|
651
|
-
function mergeChanges(kept, files) {
|
|
652
|
-
if (kept.length === 0)
|
|
653
|
-
return files;
|
|
654
|
-
const merged = new Map(kept.map((file) => [file.path, file]));
|
|
655
|
-
for (const file of files)
|
|
656
|
-
merged.set(file.path, file);
|
|
657
|
-
return [...merged.values()];
|
|
658
|
-
}
|
|
659
656
|
|
|
660
657
|
export { EMPTY_CATALOG2, emptyFold2, fold2 };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requireSession2,
|
|
3
3
|
coveredHere2
|
|
4
|
-
} from "./compose-
|
|
4
|
+
} from "./compose-vn7b7fdj.js";
|
|
5
5
|
import {
|
|
6
6
|
UnavailableError2,
|
|
7
7
|
readWorkspace2
|
|
8
|
-
} from "./compose-
|
|
8
|
+
} from "./compose-qknd62yj.js";
|
|
9
9
|
import {
|
|
10
10
|
projectTrust2
|
|
11
|
-
} from "./compose-
|
|
11
|
+
} from "./compose-h3pch7ch.js";
|
|
12
12
|
import {
|
|
13
13
|
settle2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-tb5ywdfk.js";
|
|
15
15
|
|
|
16
16
|
// src/extend/activation.ts
|
|
17
17
|
var ACTIVE = { kind: "active" };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
START2,
|
|
6
6
|
readPositionCommit2
|
|
7
|
-
} from "./compose-
|
|
7
|
+
} from "./compose-vn7b7fdj.js";
|
|
8
8
|
import {
|
|
9
9
|
ZERO_USAGE2,
|
|
10
10
|
addUsage2
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
snapshots2,
|
|
14
14
|
emptyHead2,
|
|
15
15
|
reuse2
|
|
16
|
-
} from "./compose-
|
|
16
|
+
} from "./compose-h14pmqv3.js";
|
|
17
17
|
|
|
18
18
|
// src/fold/project.ts
|
|
19
19
|
var DEFAULT_TAIL = 200;
|
|
@@ -35,13 +35,15 @@ function project2(state, head, options) {
|
|
|
35
35
|
return cached;
|
|
36
36
|
const messages = readMessageTail(folded.messages, tail);
|
|
37
37
|
const turns = frozen(folded.turns);
|
|
38
|
+
const path = state[INDEX2].paths.get(head);
|
|
38
39
|
const view = {
|
|
39
40
|
revision: folded.revision,
|
|
40
41
|
seq: state.seq,
|
|
41
42
|
activation: state.activation,
|
|
42
43
|
messages,
|
|
44
|
+
leadingPrompt: findLeadingPrompt2(path, folded.messages.length - messages.length),
|
|
43
45
|
parts: state.partViews,
|
|
44
|
-
turns: readTurnWindow(turns,
|
|
46
|
+
turns: readTurnWindow(turns, path, messages),
|
|
45
47
|
usage: sumCompletedUsage(turns),
|
|
46
48
|
execution: folded.info.execution,
|
|
47
49
|
background: folded.background,
|
|
@@ -98,6 +100,15 @@ function readMessageTail(messages, tail) {
|
|
|
98
100
|
tails.set(messages, known);
|
|
99
101
|
return slice;
|
|
100
102
|
}
|
|
103
|
+
function findLeadingPrompt2(path, start) {
|
|
104
|
+
const first = path?.messages[start];
|
|
105
|
+
if (path === undefined || first === undefined)
|
|
106
|
+
return null;
|
|
107
|
+
const prompt = path.turns[path.turnAt.get(first.turn) ?? -1]?.prompt ?? null;
|
|
108
|
+
const at = prompt === null ? undefined : path.at.get(prompt);
|
|
109
|
+
const message = at === undefined || at >= start ? undefined : path.messages[at];
|
|
110
|
+
return message?.kind === "user" ? message : null;
|
|
111
|
+
}
|
|
101
112
|
function readTurnWindow(turns, path, messages) {
|
|
102
113
|
if (path === undefined)
|
|
103
114
|
return turns;
|
|
@@ -127,4 +138,4 @@ function frozen(turns) {
|
|
|
127
138
|
return snapshot;
|
|
128
139
|
}
|
|
129
140
|
|
|
130
|
-
export { project2, readSeenCommit2, withPair2 };
|
|
141
|
+
export { project2, readSeenCommit2, withPair2, findLeadingPrompt2 };
|
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
} from "./compose-1c6w12g1.js";
|
|
4
4
|
import {
|
|
5
5
|
STORED_RECORD_TYPES2
|
|
6
|
-
} from "./compose-
|
|
6
|
+
} from "./compose-gxjc6vz9.js";
|
|
7
7
|
import {
|
|
8
8
|
decodeObject2
|
|
9
|
-
} from "./compose-
|
|
9
|
+
} from "./compose-kwkna3cg.js";
|
|
10
10
|
import {
|
|
11
11
|
STORE_VERSION2
|
|
12
|
-
} from "./compose-
|
|
12
|
+
} from "./compose-nj4nj5n9.js";
|
|
13
13
|
import {
|
|
14
14
|
dev2
|
|
15
15
|
} from "./compose-n116fnmp.js";
|
|
16
16
|
import {
|
|
17
17
|
FOLD_CODE2
|
|
18
|
-
} from "./compose-
|
|
18
|
+
} from "./compose-767bb340.js";
|
|
19
19
|
import {
|
|
20
20
|
EMPTY_CATALOG2
|
|
21
|
-
} from "./compose-
|
|
21
|
+
} from "./compose-6gt28900.js";
|
|
22
22
|
|
|
23
23
|
// src/fold/checkpoint.ts
|
|
24
24
|
import {
|
|
@@ -92,6 +92,7 @@ var FoldCheckpointType = Type.Object({
|
|
|
92
92
|
covered: Type.Boolean(),
|
|
93
93
|
configuration: typed()(ConfigurationType),
|
|
94
94
|
replaced: nullable(Type.Object({ previous: message, stopped: nullable(idSchema()) })),
|
|
95
|
+
requires: nullable(list(Type.String())),
|
|
95
96
|
landed: nullable(Type.Object({ commit: idSchema(), run: nullable(idSchema()) }))
|
|
96
97
|
}))),
|
|
97
98
|
parts: list(entry(idSchema(), typed()(STORED_RECORD_TYPES2.part))),
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CORE_CONTEXT2,
|
|
3
3
|
PARTICIPANT_AUTHORITY2
|
|
4
|
-
} from "./compose-
|
|
4
|
+
} from "./compose-5z835ej2.js";
|
|
5
5
|
import {
|
|
6
6
|
decodePartRecord2
|
|
7
|
-
} from "./compose-
|
|
7
|
+
} from "./compose-gxjc6vz9.js";
|
|
8
8
|
import {
|
|
9
9
|
objectId2
|
|
10
10
|
} from "./compose-q6c7wswc.js";
|
|
11
11
|
import {
|
|
12
12
|
headRef2,
|
|
13
13
|
partRef2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-cqpjcx2t.js";
|
|
15
15
|
import {
|
|
16
16
|
MAIN2,
|
|
17
17
|
STALE2,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
attempt2,
|
|
24
24
|
toCommitObjectId2,
|
|
25
25
|
readCall2
|
|
26
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-vn7b7fdj.js";
|
|
27
27
|
import {
|
|
28
28
|
convertJsonSchema2,
|
|
29
29
|
check2
|
|
@@ -32,16 +32,16 @@ import {
|
|
|
32
32
|
settle3,
|
|
33
33
|
release2,
|
|
34
34
|
storedAnswer2
|
|
35
|
-
} from "./compose-
|
|
35
|
+
} from "./compose-c2rnebv0.js";
|
|
36
36
|
import {
|
|
37
37
|
commit2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-pnsvwd3m.js";
|
|
39
39
|
import {
|
|
40
40
|
runAction2,
|
|
41
41
|
reserveRerun2,
|
|
42
42
|
openAction2,
|
|
43
43
|
recordAcquisition2
|
|
44
|
-
} from "./compose-
|
|
44
|
+
} from "./compose-eemt6sea.js";
|
|
45
45
|
import {
|
|
46
46
|
RESERVED_PART_KINDS2
|
|
47
47
|
} from "./compose-0rx7ygxq.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decodeRunRecord2
|
|
3
|
+
} from "./compose-gxjc6vz9.js";
|
|
4
|
+
import {
|
|
5
|
+
runRef2
|
|
6
|
+
} from "./compose-cqpjcx2t.js";
|
|
7
|
+
import {
|
|
8
|
+
load2
|
|
9
|
+
} from "./compose-vn7b7fdj.js";
|
|
10
|
+
|
|
11
|
+
// src/engine/surface.ts
|
|
12
|
+
var NONE = new Set;
|
|
13
|
+
async function readRequires(kernel, session, run) {
|
|
14
|
+
const found = await load2(kernel.store, await kernel.store.refs.get(runRef2(session, run)), decodeRunRecord2);
|
|
15
|
+
return found?.record.requires;
|
|
16
|
+
}
|
|
17
|
+
async function hiddenOwners2(kernel, session, run) {
|
|
18
|
+
const mine = kernel.presence?.member.capabilities ?? [];
|
|
19
|
+
if (mine.length === 0 || run === null)
|
|
20
|
+
return NONE;
|
|
21
|
+
const requires = await readRequires(kernel, session, run);
|
|
22
|
+
return requires === undefined ? NONE : new Set(mine.filter((owner) => !requires.includes(owner)));
|
|
23
|
+
}
|
|
24
|
+
async function missingCapabilities2(kernel, session, run) {
|
|
25
|
+
if (run === null)
|
|
26
|
+
return [];
|
|
27
|
+
const mine = kernel.presence?.member.capabilities ?? [];
|
|
28
|
+
const requires = await readRequires(kernel, session, run) ?? [];
|
|
29
|
+
return requires.filter((capability) => !mine.includes(capability));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { hiddenOwners2, missingCapabilities2 };
|
|
@@ -6,19 +6,19 @@ import {
|
|
|
6
6
|
} from "./compose-bjx8s01m.js";
|
|
7
7
|
import {
|
|
8
8
|
decodePartRecord2
|
|
9
|
-
} from "./compose-
|
|
9
|
+
} from "./compose-gxjc6vz9.js";
|
|
10
10
|
import {
|
|
11
11
|
parseSessionRef2,
|
|
12
12
|
headRef2,
|
|
13
13
|
partRef2
|
|
14
|
-
} from "./compose-
|
|
14
|
+
} from "./compose-cqpjcx2t.js";
|
|
15
15
|
import {
|
|
16
16
|
load2,
|
|
17
17
|
readRefExpectation2,
|
|
18
18
|
put2,
|
|
19
19
|
toCommitObjectId2,
|
|
20
20
|
readCall2
|
|
21
|
-
} from "./compose-
|
|
21
|
+
} from "./compose-vn7b7fdj.js";
|
|
22
22
|
|
|
23
23
|
// src/store/parts.ts
|
|
24
24
|
import { asId } from "@nyte-ai/schema";
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IMAGE_LIMITS2
|
|
3
|
+
} from "./compose-5z835ej2.js";
|
|
4
|
+
import {
|
|
5
|
+
dev2
|
|
6
|
+
} from "./compose-n116fnmp.js";
|
|
7
|
+
|
|
8
|
+
// src/agent/images.ts
|
|
9
|
+
var INLINE_IMAGE_TYPES = new Set([
|
|
10
|
+
"image/png",
|
|
11
|
+
"image/jpeg",
|
|
12
|
+
"image/gif",
|
|
13
|
+
"image/webp"
|
|
14
|
+
]);
|
|
15
|
+
async function modelImage2(images, file) {
|
|
16
|
+
const mime = normalizeImageType(file.mime);
|
|
17
|
+
const label = `Image ${file.name}, ${mime}`;
|
|
18
|
+
if (images === null)
|
|
19
|
+
return passThrough(file.bytes, mime, label, "no image processor is configured");
|
|
20
|
+
let prepared;
|
|
21
|
+
try {
|
|
22
|
+
prepared = await images.prepare(file.bytes, mime, IMAGE_LIMITS2);
|
|
23
|
+
} catch (cause) {
|
|
24
|
+
dev2("images", "prepare failed", { name: file.name, mime, cause: String(cause) });
|
|
25
|
+
return passThrough(file.bytes, mime, label, "the image processor failed");
|
|
26
|
+
}
|
|
27
|
+
if (prepared === undefined)
|
|
28
|
+
return [{ type: "text", text: `[${label}: left out, it cannot be prepared for the model]` }];
|
|
29
|
+
const image = { type: "image", data: prepared.data, mimeType: prepared.mimeType };
|
|
30
|
+
if (prepared.resized === undefined)
|
|
31
|
+
return [image];
|
|
32
|
+
const { from, to } = prepared.resized;
|
|
33
|
+
return [
|
|
34
|
+
image,
|
|
35
|
+
{
|
|
36
|
+
type: "text",
|
|
37
|
+
text: `[${label}: resized from ${from.width}x${from.height} to ${to.width}x${to.height}. Multiply coordinates by ${(from.width / to.width).toFixed(2)} to map them to the original.]`
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
function passThrough(bytes, mime, label, unprepared) {
|
|
42
|
+
const omitted = (reason) => [
|
|
43
|
+
{ type: "text", text: `[${label}: left out, ${reason} and ${unprepared}]` }
|
|
44
|
+
];
|
|
45
|
+
if (!INLINE_IMAGE_TYPES.has(mime))
|
|
46
|
+
return omitted("the model does not take this format");
|
|
47
|
+
if (Math.ceil(bytes.byteLength / 3) * 4 > IMAGE_LIMITS2.maxBase64Bytes)
|
|
48
|
+
return omitted(`${String(bytes.byteLength)} bytes is too large to send`);
|
|
49
|
+
const size = imageDimensions(bytes, mime);
|
|
50
|
+
if (size === undefined)
|
|
51
|
+
return omitted("its size cannot be read");
|
|
52
|
+
if (size.width > IMAGE_LIMITS2.maxWidth || size.height > IMAGE_LIMITS2.maxHeight)
|
|
53
|
+
return omitted(`${String(size.width)}x${String(size.height)} is larger than ${String(IMAGE_LIMITS2.maxWidth)}x${String(IMAGE_LIMITS2.maxHeight)}`);
|
|
54
|
+
return [{ type: "image", data: bytes.toBase64(), mimeType: mime }];
|
|
55
|
+
}
|
|
56
|
+
function normalizeImageType(mime) {
|
|
57
|
+
const base = mime.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
58
|
+
return base === "image/jpg" ? "image/jpeg" : base;
|
|
59
|
+
}
|
|
60
|
+
function imageDimensions(bytes, mime) {
|
|
61
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
62
|
+
switch (mime) {
|
|
63
|
+
case "image/png":
|
|
64
|
+
return bytes.length < 24 ? undefined : { width: view.getUint32(16), height: view.getUint32(20) };
|
|
65
|
+
case "image/gif":
|
|
66
|
+
return bytes.length < 10 ? undefined : { width: view.getUint16(6, true), height: view.getUint16(8, true) };
|
|
67
|
+
case "image/webp": {
|
|
68
|
+
if (bytes.length < 30)
|
|
69
|
+
return;
|
|
70
|
+
const chunk = new TextDecoder().decode(bytes.subarray(12, 16));
|
|
71
|
+
if (chunk === "VP8 ")
|
|
72
|
+
return {
|
|
73
|
+
width: view.getUint16(26, true) & 16383,
|
|
74
|
+
height: view.getUint16(28, true) & 16383
|
|
75
|
+
};
|
|
76
|
+
if (chunk === "VP8L") {
|
|
77
|
+
const bits = view.getUint32(21, true);
|
|
78
|
+
return { width: (bits & 16383) + 1, height: (bits >>> 14 & 16383) + 1 };
|
|
79
|
+
}
|
|
80
|
+
if (chunk === "VP8X") {
|
|
81
|
+
const uint24 = (offset) => view.getUint16(offset, true) + view.getUint8(offset + 2) * 65536;
|
|
82
|
+
return { width: uint24(24) + 1, height: uint24(27) + 1 };
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
case "image/jpeg":
|
|
87
|
+
for (let offset = 2;offset + 9 <= bytes.length; ) {
|
|
88
|
+
if (bytes[offset] !== 255)
|
|
89
|
+
return;
|
|
90
|
+
const marker = view.getUint8(offset + 1);
|
|
91
|
+
if (marker === 255) {
|
|
92
|
+
offset++;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204)
|
|
96
|
+
return { width: view.getUint16(offset + 7), height: view.getUint16(offset + 5) };
|
|
97
|
+
offset += 2 + view.getUint16(offset + 2);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
default:
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { modelImage2 };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LOCAL2
|
|
3
|
-
} from "./compose-
|
|
3
|
+
} from "./compose-5z835ej2.js";
|
|
4
4
|
import {
|
|
5
5
|
decodeRunRecord2
|
|
6
|
-
} from "./compose-
|
|
6
|
+
} from "./compose-gxjc6vz9.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionRef2,
|
|
9
9
|
runRef2
|
|
10
|
-
} from "./compose-
|
|
10
|
+
} from "./compose-cqpjcx2t.js";
|
|
11
11
|
import {
|
|
12
12
|
dev2
|
|
13
13
|
} from "./compose-n116fnmp.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
requireSession2,
|
|
18
18
|
put2,
|
|
19
19
|
attempt2
|
|
20
|
-
} from "./compose-
|
|
20
|
+
} from "./compose-vn7b7fdj.js";
|
|
21
21
|
import {
|
|
22
22
|
convertJsonSchema2,
|
|
23
23
|
check2
|
|
@@ -28,11 +28,11 @@ import {
|
|
|
28
28
|
} from "./compose-84272xbk.js";
|
|
29
29
|
import {
|
|
30
30
|
commit2
|
|
31
|
-
} from "./compose-
|
|
31
|
+
} from "./compose-pnsvwd3m.js";
|
|
32
32
|
import {
|
|
33
33
|
modelInfo2,
|
|
34
34
|
withLimits2
|
|
35
|
-
} from "./compose-
|
|
35
|
+
} from "./compose-exfx5b4d.js";
|
|
36
36
|
|
|
37
37
|
// src/agent/request.ts
|
|
38
38
|
import { contentText } from "@nyte-ai/schema/model";
|