@intentic/sandbox-contract 1.364.0 → 1.365.0
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 +3 -0
- package/dist/contracts/agents.contract.d.ts +253 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +18 -0
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/needs.contract.d.ts +232 -0
- package/dist/contracts/needs.contract.d.ts.map +1 -1
- package/dist/contracts/needs.contract.js +11 -1
- package/dist/contracts/needs.contract.js.map +1 -1
- package/dist/contracts/runner.contract.d.ts +32 -0
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +2 -0
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +33 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.d.ts +232 -0
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +12 -1
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/agent-events.d.ts +14 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +5 -1
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/sandbox-notice.d.ts +14 -0
- package/dist/events/sandbox-notice.d.ts.map +1 -1
- package/dist/events/sandbox-notice.js +13 -1
- package/dist/events/sandbox-notice.js.map +1 -1
- package/dist/events/system-events.d.ts +26 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/tool-update.d.ts +6 -0
- package/dist/events/tool-update.d.ts.map +1 -0
- package/dist/events/tool-update.js +12 -0
- package/dist/events/tool-update.js.map +1 -0
- package/dist/events/transcript.d.ts +1 -0
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +4 -0
- package/dist/events/transcript.js.map +1 -1
- package/dist/index.d.ts +752 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/models/device-deadlines.d.ts +34 -0
- package/dist/models/device-deadlines.d.ts.map +1 -0
- package/dist/models/device-deadlines.js +28 -0
- package/dist/models/device-deadlines.js.map +1 -0
- package/dist/protocol/member-reach.d.ts +18 -0
- package/dist/protocol/member-reach.d.ts.map +1 -0
- package/dist/protocol/member-reach.js +31 -0
- package/dist/protocol/member-reach.js.map +1 -0
- package/dist/protocol/raw/raw-json-routes.d.ts +114 -0
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +4 -1
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +16 -0
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +6 -3
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/agents-list.d.ts +26 -0
- package/dist/schemas/agents-list.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +50 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +17 -0
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/environment.d.ts +5 -0
- package/dist/schemas/environment.d.ts.map +1 -1
- package/dist/schemas/environment.js +3 -0
- package/dist/schemas/environment.js.map +1 -1
- package/dist/schemas/members.d.ts +52 -0
- package/dist/schemas/members.d.ts.map +1 -1
- package/dist/schemas/members.js +15 -0
- package/dist/schemas/members.js.map +1 -1
- package/dist/schemas/needs.d.ts +7 -0
- package/dist/schemas/needs.d.ts.map +1 -1
- package/dist/schemas/needs.js +3 -0
- package/dist/schemas/needs.js.map +1 -1
- package/dist/schemas/providers/handoff.d.ts +24 -0
- package/dist/schemas/providers/handoff.d.ts.map +1 -1
- package/dist/schemas/providers/handoff.js +32 -0
- package/dist/schemas/providers/handoff.js.map +1 -1
- package/dist/schemas/providers/usage.d.ts +6 -0
- package/dist/schemas/providers/usage.d.ts.map +1 -1
- package/dist/schemas/providers/usage.js +2 -0
- package/dist/schemas/providers/usage.js.map +1 -1
- package/dist/schemas/settings-experiments.d.ts.map +1 -1
- package/dist/schemas/settings-experiments.js +1 -1
- package/dist/schemas/settings-experiments.js.map +1 -1
- package/dist/schemas/settings.d.ts +2 -0
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +6 -0
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/workspace/workspace-search.d.ts +93 -0
- package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-search.js +10 -0
- package/dist/schemas/workspace/workspace-search.js.map +1 -1
- package/dist/state/definition.d.ts +4 -0
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/runtime-state.d.ts +3 -0
- package/dist/state/runtime-state.d.ts.map +1 -1
- package/dist/state/runtime-state.js +1 -0
- package/dist/state/runtime-state.js.map +1 -1
- package/dist/text/land-rows.d.ts.map +1 -1
- package/dist/text/land-rows.js +5 -2
- package/dist/text/land-rows.js.map +1 -1
- package/dist/text/notice-rows.d.ts +8 -0
- package/dist/text/notice-rows.d.ts.map +1 -0
- package/dist/text/notice-rows.js +14 -0
- package/dist/text/notice-rows.js.map +1 -0
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +25 -26
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +5 -5
- package/src/contracts/agents.contract.ts +21 -0
- package/src/contracts/needs.contract.ts +14 -0
- package/src/contracts/workspace.contract.ts +15 -1
- package/src/events/agent-events.ts +11 -1
- package/src/events/sandbox-notice.ts +17 -1
- package/src/events/tool-update.ts +18 -0
- package/src/events/transcript.ts +5 -0
- package/src/models/device-deadlines.ts +62 -0
- package/src/protocol/member-reach.test.ts +221 -0
- package/src/protocol/member-reach.ts +78 -0
- package/src/protocol/raw/raw-json-routes.ts +12 -1
- package/src/protocol/raw/raw-routes.ts +10 -4
- package/src/schemas/agents.ts +30 -0
- package/src/schemas/environment.ts +9 -0
- package/src/schemas/members.ts +30 -0
- package/src/schemas/needs.ts +4 -0
- package/src/schemas/providers/handoff.test.ts +23 -1
- package/src/schemas/providers/handoff.ts +49 -0
- package/src/schemas/providers/usage.ts +4 -0
- package/src/schemas/settings-experiments.ts +5 -1
- package/src/schemas/settings.ts +12 -0
- package/src/schemas/shared.ts +1 -1
- package/src/schemas/workspace/workspace-search.ts +16 -0
- package/src/state/runtime-state.ts +5 -0
- package/src/state/workspace-state.ts +1 -1
- package/src/text/land-rows.ts +6 -2
- package/src/text/notice-rows.ts +21 -0
- package/src/text/transcript-fold.test.ts +102 -2
- package/src/text/transcript-fold.ts +29 -30
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
type TranscriptSubagent,
|
|
12
12
|
type TranscriptTool,
|
|
13
13
|
} from "../events/transcript.js";
|
|
14
|
-
import { contextTrimLine, contextTrimNotice } from "../schemas/context-trim.js";
|
|
15
14
|
import { keptWarmLine, keptWarmNotice } from "../schemas/keep-warm.js";
|
|
16
|
-
import {
|
|
15
|
+
import { startingRow } from "./notice-rows.js";
|
|
17
16
|
import { isLandConflict } from "../events/land-conflict.js";
|
|
18
17
|
import { turnedAwayCode } from "../policy/turned-away.js";
|
|
19
18
|
import { errorRow, RENEWAL_WITHDRAWN, RENEWING } from "../events/failure-rows.js";
|
|
20
19
|
import { mentionedPathTokens } from "./mentions.js";
|
|
21
20
|
import { unspokenPromptRow } from "../events/agent-words.js";
|
|
21
|
+
import { takeToolUpdate } from "../events/tool-update.js";
|
|
22
22
|
import { needRowText } from "../events/need-wake.js";
|
|
23
23
|
import { noticeCode, sandboxNoticeOf } from "../events/sandbox-notice.js";
|
|
24
24
|
import { installRow, landedRow, syncLine } from "./land-rows.js";
|
|
@@ -73,6 +73,7 @@ const cardOf = (event: Extract<AgentEvent, { kind: "tool_call" }>, at: number |
|
|
|
73
73
|
...(event.locations !== undefined ? { locations: event.locations } : {}),
|
|
74
74
|
...(event.content !== undefined ? { content: event.content } : {}),
|
|
75
75
|
...(event.input !== undefined ? { input: event.input } : {}),
|
|
76
|
+
...(event.server !== undefined ? { server: event.server } : {}),
|
|
76
77
|
...(at !== undefined ? { startedAt: at, ...(ended(event.status) ? { endedAt: at } : {}) } : {}),
|
|
77
78
|
});
|
|
78
79
|
|
|
@@ -191,16 +192,11 @@ export class TranscriptFold {
|
|
|
191
192
|
tool.endedAt = this.now();
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
|
-
|
|
195
|
-
tool.exitCode = event.exitCode;
|
|
196
|
-
}
|
|
195
|
+
takeToolUpdate(tool, event);
|
|
197
196
|
if (event.content !== undefined) {
|
|
198
197
|
tool.content = event.content;
|
|
199
198
|
this.claimByResult(tool);
|
|
200
199
|
}
|
|
201
|
-
if (event.locations !== undefined) {
|
|
202
|
-
tool.locations = event.locations;
|
|
203
|
-
}
|
|
204
200
|
});
|
|
205
201
|
case "subagent":
|
|
206
202
|
return this.subagentBorn(event);
|
|
@@ -247,12 +243,12 @@ export class TranscriptFold {
|
|
|
247
243
|
const notice = keptWarmNotice(event);
|
|
248
244
|
return line === undefined || notice === undefined ? [] : this.pushRow({ role: "notice", text: line, noticeCode: noticeCode(notice) });
|
|
249
245
|
}
|
|
246
|
+
// Each a row of its own rather than a stamp on the message: what was left out is not part of what was sent, and
|
|
247
|
+
// the fold beside the message only ever lists notes that actually rode.
|
|
250
248
|
case "context_trim":
|
|
251
|
-
// A row of its own rather than a stamp on the message: what was left out is not part of what was sent,
|
|
252
|
-
// and the fold beside the message only ever lists notes that actually rode.
|
|
253
|
-
return this.pushRow({ role: "notice", text: contextTrimLine(event), noticeCode: noticeCode(contextTrimNotice(event)) });
|
|
254
249
|
case "handoff":
|
|
255
|
-
|
|
250
|
+
case "fresh_start":
|
|
251
|
+
return this.pushRow(startingRow(event));
|
|
256
252
|
case "worktree":
|
|
257
253
|
return this.synced(event.sync);
|
|
258
254
|
case "landed":
|
|
@@ -737,14 +733,18 @@ export const patchedRow = <R extends TranscriptRow>(row: R, patch: RowPatch): R
|
|
|
737
733
|
|
|
738
734
|
/** Applies one patch to a row list; only what the patch names moves (patchedRow). */
|
|
739
735
|
export const applyTranscriptPatch = (rows: readonly TranscriptRow[], patch: TranscriptPatch): TranscriptRow[] => {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
return [...rows, patch.row];
|
|
743
|
-
case "drop":
|
|
744
|
-
return rows.filter((_row, index) => index !== patch.index);
|
|
745
|
-
default:
|
|
746
|
-
return rows.map((row, index) => (index === patch.index ? patchedRow(row, patch) : row));
|
|
736
|
+
if (patch.op === "append") {
|
|
737
|
+
return [...rows, patch.row];
|
|
747
738
|
}
|
|
739
|
+
if (patch.op === "drop") {
|
|
740
|
+
return rows.filter((_row, index) => index !== patch.index);
|
|
741
|
+
}
|
|
742
|
+
const next = [...rows];
|
|
743
|
+
const row = next[patch.index];
|
|
744
|
+
if (row !== undefined) {
|
|
745
|
+
next[patch.index] = patchedRow(row, patch);
|
|
746
|
+
}
|
|
747
|
+
return next;
|
|
748
748
|
};
|
|
749
749
|
|
|
750
750
|
// Appends a delegated subagent's reasoning onto the card with this id, wherever it nests.
|
|
@@ -771,25 +771,24 @@ const upsertTool = (tools: readonly TranscriptTool[], tool: TranscriptTool, pare
|
|
|
771
771
|
return [...tools, tool];
|
|
772
772
|
};
|
|
773
773
|
|
|
774
|
-
// Applies `fn` to the tool with `id` anywhere in the tree;
|
|
775
|
-
// identity
|
|
774
|
+
// Applies `fn` to the tool with `id` anywhere in the tree; copies only arrays on a changed branch, so an unrelated
|
|
775
|
+
// subtree keeps its identity without allocating an array for every streamed update.
|
|
776
776
|
export const mapTool = (tools: readonly TranscriptTool[], id: string, fn: (tool: TranscriptTool) => TranscriptTool): readonly TranscriptTool[] => {
|
|
777
|
-
let
|
|
778
|
-
|
|
777
|
+
let next: TranscriptTool[] | undefined;
|
|
778
|
+
for (let index = 0; index < tools.length; index += 1) {
|
|
779
|
+
const tool = tools[index]!;
|
|
779
780
|
if (tool.id === id) {
|
|
780
|
-
|
|
781
|
-
|
|
781
|
+
(next ??= [...tools])[index] = fn(tool);
|
|
782
|
+
continue;
|
|
782
783
|
}
|
|
783
784
|
if (tool.children !== undefined) {
|
|
784
785
|
const children = mapTool(tool.children, id, fn);
|
|
785
786
|
if (children !== tool.children) {
|
|
786
|
-
|
|
787
|
-
return { ...tool, children: [...children] };
|
|
787
|
+
(next ??= [...tools])[index] = { ...tool, children: [...children] };
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
return changed ? next : tools;
|
|
790
|
+
}
|
|
791
|
+
return next ?? tools;
|
|
793
792
|
};
|
|
794
793
|
|
|
795
794
|
// Which row fields are cards, exported for readers that count rows by them.
|