@intentic/sandbox-contract 1.288.0 → 1.291.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 +4 -1
- package/dist/contracts/agent.contract.d.ts +54 -12
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +14 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +4 -4
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/diff.contract.d.ts +49 -0
- package/dist/contracts/diff.contract.d.ts.map +1 -0
- package/dist/contracts/diff.contract.js +14 -0
- package/dist/contracts/diff.contract.js.map +1 -0
- package/dist/contracts/extensions.contract.d.ts +1 -0
- package/dist/contracts/extensions.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +95 -95
- package/dist/contracts/sessions.contract.d.ts +13 -0
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +58 -30
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/usage.contract.d.ts +15 -0
- package/dist/contracts/usage.contract.d.ts.map +1 -1
- package/dist/contracts/usage.contract.js +12 -2
- package/dist/contracts/usage.contract.js.map +1 -1
- package/dist/events/agent-events.d.ts +39 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/transcript.d.ts +95 -0
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +16 -2
- package/dist/events/transcript.js.map +1 -1
- package/dist/events/verify-nudge.d.ts +4 -0
- package/dist/events/verify-nudge.d.ts.map +1 -0
- package/dist/events/verify-nudge.js +4 -0
- package/dist/events/verify-nudge.js.map +1 -0
- package/dist/events/watch-wake.d.ts +14 -0
- package/dist/events/watch-wake.d.ts.map +1 -0
- package/dist/events/watch-wake.js +42 -0
- package/dist/events/watch-wake.js.map +1 -0
- package/dist/index.d.ts +168 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/models/agent-catalog.d.ts +1 -0
- package/dist/models/agent-catalog.d.ts.map +1 -1
- package/dist/models/agent-catalog.js +1 -0
- package/dist/models/agent-catalog.js.map +1 -1
- package/dist/models/agent-runtimes.d.ts.map +1 -1
- package/dist/models/agent-runtimes.js +2 -2
- package/dist/models/agent-runtimes.js.map +1 -1
- package/dist/models/plan-pools.d.ts +13 -0
- package/dist/models/plan-pools.d.ts.map +1 -1
- package/dist/models/plan-pools.js +43 -0
- package/dist/models/plan-pools.js.map +1 -1
- package/dist/schemas/agents.d.ts +4 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +3 -0
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/devices.d.ts +21 -0
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js +7 -1
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/diff.d.ts +62 -0
- package/dist/schemas/diff.d.ts.map +1 -0
- package/dist/schemas/diff.js +59 -0
- package/dist/schemas/diff.js.map +1 -0
- package/dist/schemas/extension-updates.d.ts +2 -0
- package/dist/schemas/extension-updates.d.ts.map +1 -1
- package/dist/schemas/terminal.d.ts +22 -0
- package/dist/schemas/terminal.d.ts.map +1 -1
- package/dist/schemas/terminal.js +9 -0
- package/dist/schemas/terminal.js.map +1 -1
- package/dist/state/history-state.d.ts.map +1 -1
- package/dist/state/history-state.js +1 -0
- package/dist/state/history-state.js.map +1 -1
- package/dist/text/transcript-fold.d.ts +1 -0
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +17 -10
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +5 -5
- package/src/contracts/agents.contract.ts +4 -3
- package/src/contracts/diff.contract.ts +17 -0
- package/src/contracts/usage.contract.ts +19 -2
- package/src/events/transcript.ts +25 -2
- package/src/events/verify-nudge.ts +14 -0
- package/src/events/watch-wake.test.ts +67 -0
- package/src/events/watch-wake.ts +78 -0
- package/src/index.ts +7 -1
- package/src/models/agent-catalog.test.ts +6 -2
- package/src/models/agent-catalog.ts +5 -0
- package/src/models/agent-runtimes.ts +7 -4
- package/src/models/plan-pools.test.ts +40 -1
- package/src/models/plan-pools.ts +69 -0
- package/src/schemas/agents.ts +6 -0
- package/src/schemas/devices.ts +20 -1
- package/src/schemas/diff.ts +72 -0
- package/src/schemas/terminal.ts +11 -0
- package/src/state/history-state.ts +3 -0
- package/src/text/transcript-fold.test.ts +21 -0
- package/src/text/transcript-fold.ts +23 -11
package/src/schemas/terminal.ts
CHANGED
|
@@ -106,6 +106,17 @@ export const BrowserSessionSchema = z.object({
|
|
|
106
106
|
.describe(
|
|
107
107
|
"The agent has hit something only a person can clear: a captcha, a password it does not hold, a check on your phone. Present only while it is waiting.",
|
|
108
108
|
),
|
|
109
|
+
// A JavaScript dialog a page has open; held by the daemon for whoever answers first, the owner over the live view
|
|
110
|
+
// or the agent through its tool. Present only while open.
|
|
111
|
+
dialog: z
|
|
112
|
+
.object({
|
|
113
|
+
pageId: z.string().describe("Which page opened it."),
|
|
114
|
+
kind: z.enum(["alert", "confirm", "prompt", "beforeunload"]).describe("What it asks: an alert wants dismissing, a confirm a yes or no, a prompt a text."),
|
|
115
|
+
message: z.string().describe("What the page says."),
|
|
116
|
+
defaultValue: z.string().optional().describe("A prompt's prefilled answer."),
|
|
117
|
+
})
|
|
118
|
+
.optional()
|
|
119
|
+
.describe("A dialog a page has open and is waiting on. You or the agent answers it; present only while it is open."),
|
|
109
120
|
pages: z
|
|
110
121
|
.array(BrowserPageSchema)
|
|
111
122
|
.describe("Every page it has open. A browser holds several at once, which is the reason it is listed apart from the terminals."),
|
|
@@ -26,6 +26,9 @@ export const HISTORY_STATE_FILES: readonly StateFile[] = [
|
|
|
26
26
|
{ path: "activity.jsonl", portability: "carry" },
|
|
27
27
|
{ path: "usage.jsonl", portability: "carry" },
|
|
28
28
|
{ path: "account-usage.json", portability: "carry" },
|
|
29
|
+
// Per-account stay-away for a provider's usage endpoint. Carried, not re-earned: earning one costs the very read it
|
|
30
|
+
// holds off, and is answered with a deadline measured from that moment. Entries past their instant are inert.
|
|
31
|
+
{ path: "usage-parks.json", portability: "carry" },
|
|
29
32
|
{ path: "provider-refusals.json", portability: "carry" },
|
|
30
33
|
// Models refused to this sandbox's credentials; expires daily, same subscriptions apply elsewhere.
|
|
31
34
|
{ path: "model-refusals.json", portability: "carry" },
|
|
@@ -2,6 +2,7 @@ import { STATE_DIR } from "@intentic/constants";
|
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import type { AgentEvent } from "../events/agent-events.js";
|
|
4
4
|
import type { TranscriptPatch, TranscriptRow } from "../events/transcript.js";
|
|
5
|
+
import { watchWakePrompt } from "../events/watch-wake.js";
|
|
5
6
|
import { applyTranscriptPatch, foldTurn, TranscriptFold, userRow } from "./transcript-fold.js";
|
|
6
7
|
|
|
7
8
|
// Epoch ms stamped on the opening user row's sentAt.
|
|
@@ -441,6 +442,26 @@ describe("patches", () => {
|
|
|
441
442
|
]);
|
|
442
443
|
});
|
|
443
444
|
|
|
445
|
+
// The other half of the wake's delivery: a live turn takes it as a steer. It is the daemon's own words either way,
|
|
446
|
+
// so it must not become a user row here, and must not leave a rewind anchor pointing at a message nobody sent.
|
|
447
|
+
it("writes a watch's wake into a live turn as a notice, and never as a steer to rewind to", () => {
|
|
448
|
+
const prompt = watchWakePrompt({
|
|
449
|
+
outcome: "timeout",
|
|
450
|
+
id: "watch-1",
|
|
451
|
+
note: "the deploy",
|
|
452
|
+
elapsed: "2h",
|
|
453
|
+
command: "curl -sf https://example.test/health",
|
|
454
|
+
exitCode: 22,
|
|
455
|
+
output: "404",
|
|
456
|
+
});
|
|
457
|
+
const fold = new TranscriptFold(openingOf("ship it"));
|
|
458
|
+
fold.apply({ kind: "delta", text: "watching" });
|
|
459
|
+
fold.apply({ kind: "steer", text: prompt, sentAt: SENT_AT + 1 });
|
|
460
|
+
expect(fold.rows.map((row) => row.role)).toEqual(["user", "assistant", "notice"]);
|
|
461
|
+
expect(fold.rows.at(-1)?.text).toBe("the deploy — the watch gave up after 2h.");
|
|
462
|
+
expect(fold.steerRows).toEqual([]);
|
|
463
|
+
});
|
|
464
|
+
|
|
444
465
|
it("drop an empty bubble the turn opened and abandoned", () => {
|
|
445
466
|
const events: AgentEvent[] = [
|
|
446
467
|
{ kind: "todos", items: [] },
|
|
@@ -2,6 +2,7 @@ import { cancelledCards, settledCards } from "../policy/card-status.js";
|
|
|
2
2
|
import type { AgentEvent } from "../events/agent-events.js";
|
|
3
3
|
import { CARD_FIELDS, holdsCard, isAwaitingDecision, type TranscriptCards, type TranscriptPatch, type TranscriptRow, type TranscriptSubagent, type TranscriptTool } from "../events/transcript.js";
|
|
4
4
|
import { mentionedPathTokens } from "./mentions.js";
|
|
5
|
+
import { watchWakeRow } from "../events/watch-wake.js";
|
|
5
6
|
|
|
6
7
|
// Folds a turn's frames into rows once, live and for the settled record alike, so a reopened chat matches what was on
|
|
7
8
|
// screen. `tag` selects the stream read: undefined is the main turn, a tool-call id is the subagent it spawned; other
|
|
@@ -236,17 +237,8 @@ export class TranscriptFold {
|
|
|
236
237
|
this.rows[index]!.usage = usage;
|
|
237
238
|
return [...closed, this.replace(index)];
|
|
238
239
|
}
|
|
239
|
-
case "steer":
|
|
240
|
-
|
|
241
|
-
const patches = this.pushRow({
|
|
242
|
-
role: "user",
|
|
243
|
-
text: event.text,
|
|
244
|
-
sentAt: event.sentAt,
|
|
245
|
-
...(event.attachments === undefined ? {} : { attachments: [...event.attachments] }),
|
|
246
|
-
});
|
|
247
|
-
this.steerRows.push(this.rows.length - 1);
|
|
248
|
-
return patches;
|
|
249
|
-
}
|
|
240
|
+
case "steer":
|
|
241
|
+
return this.steered(event);
|
|
250
242
|
case "checkpoint":
|
|
251
243
|
// Anchors the pre-turn snapshot id and this turn's transcript position on its user row, for rewind.
|
|
252
244
|
return this.stampOpener((row) => {
|
|
@@ -370,6 +362,26 @@ export class TranscriptFold {
|
|
|
370
362
|
}
|
|
371
363
|
}
|
|
372
364
|
|
|
365
|
+
/**
|
|
366
|
+
* A message pushed into a turn already running. A condition watch's wake arrives this way too, and it is the
|
|
367
|
+
* daemon's own words: it becomes a notice, and never an anchor the rewind can return a person to.
|
|
368
|
+
*/
|
|
369
|
+
private steered(event: Extract<AgentEvent, { kind: "steer" }>): TranscriptPatch[] {
|
|
370
|
+
const wake = watchWakeRow(event.text);
|
|
371
|
+
if (wake !== undefined) {
|
|
372
|
+
return this.pushRow(wake);
|
|
373
|
+
}
|
|
374
|
+
// A steer also closes the bubble, or the next answer would print over it mid-call.
|
|
375
|
+
const patches = this.pushRow({
|
|
376
|
+
role: "user",
|
|
377
|
+
text: event.text,
|
|
378
|
+
sentAt: event.sentAt,
|
|
379
|
+
...(event.attachments === undefined ? {} : { attachments: [...event.attachments] }),
|
|
380
|
+
});
|
|
381
|
+
this.steerRows.push(this.rows.length - 1);
|
|
382
|
+
return patches;
|
|
383
|
+
}
|
|
384
|
+
|
|
373
385
|
/** Appends a daemon-authored row (a decision notice, card feedback) after everything said so far. */
|
|
374
386
|
note(row: TranscriptRow): TranscriptPatch[] {
|
|
375
387
|
return this.pushRow(row);
|