@intentic/sandbox-contract 1.396.0 → 1.397.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 +11 -0
- package/dist/app-routes/index.d.ts +1 -0
- package/dist/app-routes/index.d.ts.map +1 -1
- package/dist/app-routes/index.js +1 -0
- package/dist/app-routes/index.js.map +1 -1
- package/dist/app-routes/sandbox-segment.d.ts +9 -0
- package/dist/app-routes/sandbox-segment.d.ts.map +1 -0
- package/dist/app-routes/sandbox-segment.js +52 -0
- package/dist/app-routes/sandbox-segment.js.map +1 -0
- package/dist/contracts/agents.contract.d.ts +98 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/device.contract.d.ts +1 -0
- package/dist/contracts/device.contract.d.ts.map +1 -1
- package/dist/contracts/providers.contract.d.ts +2 -0
- package/dist/contracts/providers.contract.d.ts.map +1 -1
- package/dist/contracts/providers.contract.js +1 -0
- package/dist/contracts/providers.contract.js.map +1 -1
- package/dist/contracts/runner.contract.d.ts +276 -250
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/seal.contract.d.ts +25 -0
- package/dist/contracts/seal.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +8 -0
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +23 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/events/agent-events.d.ts +6 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +7 -1
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/agent-transcript.d.ts +1 -0
- package/dist/events/agent-transcript.d.ts.map +1 -1
- package/dist/events/resume.d.ts +1 -0
- package/dist/events/resume.d.ts.map +1 -1
- package/dist/events/resume.js +2 -0
- package/dist/events/resume.js.map +1 -1
- package/dist/events/sandbox-notice.d.ts +7 -0
- package/dist/events/sandbox-notice.d.ts.map +1 -1
- package/dist/events/sandbox-notice.js +2 -0
- package/dist/events/sandbox-notice.js.map +1 -1
- package/dist/events/system-events.d.ts +20 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/transcript.d.ts +1 -0
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +2 -1
- package/dist/events/transcript.js.map +1 -1
- package/dist/models/key-providers.d.ts +17 -0
- package/dist/models/key-providers.d.ts.map +1 -0
- package/dist/models/key-providers.js +65 -0
- package/dist/models/key-providers.js.map +1 -0
- package/dist/policy/failure-codes.d.ts +8 -0
- package/dist/policy/failure-codes.d.ts.map +1 -1
- package/dist/policy/failure-codes.js +9 -0
- package/dist/policy/failure-codes.js.map +1 -1
- package/dist/policy/safety-policy.d.ts +2 -1
- package/dist/policy/safety-policy.d.ts.map +1 -1
- package/dist/policy/safety-policy.js +6 -0
- package/dist/policy/safety-policy.js.map +1 -1
- package/dist/schemas/agent-search.d.ts +4 -0
- package/dist/schemas/agent-search.d.ts.map +1 -1
- package/dist/schemas/agent-search.js +9 -2
- package/dist/schemas/agent-search.js.map +1 -1
- package/dist/schemas/agents-list.d.ts +10 -0
- package/dist/schemas/agents-list.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +17 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +8 -1
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/device-resources.d.ts +5 -0
- package/dist/schemas/device-resources.d.ts.map +1 -1
- package/dist/schemas/device-resources.js +16 -0
- package/dist/schemas/device-resources.js.map +1 -1
- package/dist/schemas/devices.d.ts +14 -0
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/metrics.js +1 -1
- package/dist/schemas/metrics.js.map +1 -1
- package/dist/schemas/settings.d.ts +8 -0
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +4 -3
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/turn-break.d.ts +9 -0
- package/dist/schemas/turn-break.d.ts.map +1 -1
- package/dist/schemas/turn-break.js +9 -2
- package/dist/schemas/turn-break.js.map +1 -1
- package/dist/state/definition.d.ts +4 -0
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/text/notice-rows.d.ts +1 -1
- package/dist/text/notice-rows.d.ts.map +1 -1
- package/dist/text/notice-rows.js +6 -1
- package/dist/text/notice-rows.js.map +1 -1
- package/package.json +5 -5
- package/src/app-routes/index.ts +4 -2
- package/src/app-routes/sandbox-segment.test.ts +77 -0
- package/src/app-routes/sandbox-segment.ts +82 -0
- package/src/contracts/providers.contract.ts +5 -0
- package/src/events/agent-events.ts +14 -1
- package/src/events/resume.test.ts +22 -0
- package/src/events/resume.ts +11 -0
- package/src/events/sandbox-notice.ts +7 -0
- package/src/events/transcript.ts +2 -1
- package/src/models/key-providers.ts +97 -0
- package/src/policy/failure-codes.ts +26 -0
- package/src/policy/safety-policy.ts +11 -0
- package/src/policy/tests/command-classes.test.ts +15 -0
- package/src/policy/tests/failure-codes.test.ts +23 -2
- package/src/policy/tests/safety-policy.test.ts +9 -1
- package/src/schemas/agent-search.test.ts +22 -0
- package/src/schemas/agent-search.ts +23 -4
- package/src/schemas/agents.ts +17 -1
- package/src/schemas/device-resources.ts +28 -0
- package/src/schemas/devices.ts +2 -1
- package/src/schemas/ic-shape-args.test.ts +17 -2
- package/src/schemas/metrics.ts +1 -1
- package/src/schemas/settings.test.ts +15 -0
- package/src/schemas/settings.ts +15 -3
- package/src/schemas/turn-break.ts +30 -4
- package/src/text/notice-rows.ts +12 -4
package/src/schemas/settings.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { GpuSettingsSchema } from "./gpu-settings.js";
|
|
|
11
11
|
import { NightHoursSchema } from "./night-hours.js";
|
|
12
12
|
import { LimitHandoffSchema } from "./providers/handoff.js";
|
|
13
13
|
import { SessionsPlacementSchema } from "./offload.js";
|
|
14
|
-
import { LimitPolicySchema, RetryPolicySchema, RoomPolicySchema } from "./turn-break.js";
|
|
14
|
+
import { LimitPolicySchema, MemoryKillPolicySchema, RetryPolicySchema, RoomPolicySchema } from "./turn-break.js";
|
|
15
15
|
import { ZoneSchema } from "../time/zone.js";
|
|
16
16
|
import { DEFAULT_SANDBOX_MODE, SandboxModeSchema } from "./sandbox-mode.js";
|
|
17
17
|
import { VoiceSettingsSchema } from "./voice.js";
|
|
@@ -503,6 +503,18 @@ export const SandboxSettingsSchema = z.object({
|
|
|
503
503
|
memoryPolicy: RoomPolicySchema.default("resend").describe(
|
|
504
504
|
"What happens to a message the sandbox held because it was short of memory: nothing ran, so nothing was spent. `resend` sends it by itself once memory has stayed free for a while, one held conversation at a time. `wait` holds it until somebody presses Send anyway. The sandbox-wide default; any one conversation can say otherwise.",
|
|
505
505
|
),
|
|
506
|
+
// The one answer that re-runs a turn which RAN without being asked, on by default, where autoResumeOnRestart (below)
|
|
507
|
+
// is off by default. The two differ in what the sandbox knows. A restart is any cause (an update, a rebuild, a crash
|
|
508
|
+
// nobody named), and re-running everything it cut, all at once, spends the allowance on work nobody is watching and
|
|
509
|
+
// edits files while the owner still waits for the sandbox to come back. A memory kill is one named cause the sandbox
|
|
510
|
+
// can steer around: its turns go one at a time, only once memory has stayed free, never the turn whose own process was
|
|
511
|
+
// the one killed, and not after a second memory kill of the same request (MEMORY_KILL_RERUNS), so what comes back is
|
|
512
|
+
// the victims and not the runaway. Held for a press instead, every victim of the 2026-11-05 runaway sat in Attention
|
|
513
|
+
// with "autoResumeOnRestart is off" though only one conversation had caused it; and switching autoResumeOnRestart on
|
|
514
|
+
// to avoid that would have re-run the cause too, all at once, into a machine still recovering.
|
|
515
|
+
memoryKillPolicy: MemoryKillPolicySchema.default("resume").describe(
|
|
516
|
+
"What happens to a turn the sandbox killed because it ran out of memory, whether only that turn was killed or the whole sandbox restarted. `resume` sends it again by itself once memory has stayed free for a while, one conversation at a time, and tells it what happened. Never a turn whose own process was the one using the memory, and never one killed for memory twice already: those wait for a press whatever this says. `wait` holds every such turn until somebody presses Continue. After a restart that ran out of memory this decides for the turns it cut, instead of the switch for resuming after a restart. The sandbox-wide default; any one conversation can say otherwise.",
|
|
517
|
+
),
|
|
506
518
|
// How a held turn continues once its cache has gone cold (schemas/providers/handoff.ts). The card asks each time and
|
|
507
519
|
// preselects this; a booked send (a move, a resend at the reset) uses it unless a person picked on the card.
|
|
508
520
|
limitHandoff: LimitHandoffSchema.default("suggested").describe(
|
|
@@ -590,7 +602,7 @@ export const SandboxSettingsSchema = z.object({
|
|
|
590
602
|
.boolean()
|
|
591
603
|
.default(false)
|
|
592
604
|
.describe(
|
|
593
|
-
"Whether a turn killed by the sandbox restarting is re-run once it comes back. A switch rather than one of the policies above, because a restart is the one ending with nobody watching it, so there is no in-chat question to answer. Off to begin with: it would spend your allowance on work you are not watching and edit files while you are still waiting for the sandbox to return. Either way the interruption is recorded rather than silently lost.",
|
|
605
|
+
"Whether a turn killed by the sandbox restarting is re-run once it comes back. A switch rather than one of the policies above, because a restart is the one ending with nobody watching it, so there is no in-chat question to answer. Off to begin with: it would spend your allowance on work you are not watching and edit files while you are still waiting for the sandbox to return. Either way the interruption is recorded rather than silently lost. A restart the sandbox traces to memory running out goes by `memoryKillPolicy` instead, whatever this says.",
|
|
594
606
|
),
|
|
595
607
|
// The owner's night (night-hours.ts): with nobody at the editor inside it, an agent's own question is answered by the
|
|
596
608
|
// sandbox rather than parking the turn until morning. Off until the owner sets the hours: a sleep window guessed for
|
|
@@ -671,7 +683,7 @@ export const SandboxSettingsSchema = z.object({
|
|
|
671
683
|
.describe("What an agent may do out in the world, per kind of action: go ahead, ask first, or never."),
|
|
672
684
|
// Command policy itself lives at .intentic/config/safety.md (edited by the Safety page), not here; this only says
|
|
673
685
|
// whether the judge runs at all. Which model judges is the `safety-judge` job's setup (`roleSetups`), not a field here.
|
|
674
|
-
commandJudge: CommandJudgeModeSchema.default("
|
|
686
|
+
commandJudge: CommandJudgeModeSchema.default("off").describe(
|
|
675
687
|
"Whether a model reads your safety policy before a flagged command runs. Off judges nothing and asks about nothing; Watch judges everything and records it without ever interrupting you, which is how you find out what your policy actually does before you let it stop anything; On lets the verdict decide. Wiping a disk or deleting under /history asks at every setting — that rule is typed rather than judged, and cannot be turned off.",
|
|
676
688
|
),
|
|
677
689
|
// Only whether a person is asked: where the install lands (the conversation's own copy, or the daemon's install lane
|
|
@@ -10,9 +10,12 @@ import { z } from "zod";
|
|
|
10
10
|
// The walls a turn can stop at that take a standing answer. The first three end a turn that leaves finished work behind
|
|
11
11
|
// a live session, spelled exactly as `TurnEndingSchema.reason` spells them, so the ending a surface reads and the
|
|
12
12
|
// question it asks are one word. `memory` is the door: the sandbox too short of memory to start the turn at all, which
|
|
13
|
-
// holds the message (or the turn the sandbox kept) until a press or room comes back.
|
|
13
|
+
// holds the message (or the turn the sandbox kept) until a press or room comes back. `memoryKill` is a turn that was
|
|
14
|
+
// running when the sandbox ran out of memory and was killed for it, whether its runtime alone was killed or the whole
|
|
15
|
+
// daemon went down with it (2026-11-05): it reads as a stopped turn, but what brings it back is room, not a clock, and it
|
|
16
|
+
// ran, so it is a question of its own rather than the stop ladder's or the door's. A restart is otherwise handled apart
|
|
14
17
|
// (SandboxSettings.autoResumeOnRestart): nobody is watching a restart, so it has no in-chat question.
|
|
15
|
-
export const TurnBreakSchema = z.enum(["limit", "outage", "stopped", "memory"]);
|
|
18
|
+
export const TurnBreakSchema = z.enum(["limit", "outage", "stopped", "memory", "memoryKill"]);
|
|
16
19
|
export type TurnBreak = z.infer<typeof TurnBreakSchema>;
|
|
17
20
|
|
|
18
21
|
// Every ending that leaves a held turn behind: a spent allowance, an outage, a turn that stopped short, plus the
|
|
@@ -39,8 +42,14 @@ export type RetryPolicy = z.infer<typeof RetryPolicySchema>;
|
|
|
39
42
|
export const RoomPolicySchema = z.enum(["wait", "resend"]);
|
|
40
43
|
export type RoomPolicy = z.infer<typeof RoomPolicySchema>;
|
|
41
44
|
|
|
42
|
-
//
|
|
43
|
-
|
|
45
|
+
// A memory kill's two answers: hold it for a press, or send it again by itself once memory has stayed free, one
|
|
46
|
+
// conversation at a time. Never the turn whose own process was the one killed, nor one killed for memory twice already
|
|
47
|
+
// (MEMORY_KILL_RERUNS): those wait for a press whatever the answer, since re-running them is re-running the runaway.
|
|
48
|
+
export const MemoryKillPolicySchema = z.enum(["wait", "resume"]);
|
|
49
|
+
export type MemoryKillPolicy = z.infer<typeof MemoryKillPolicySchema>;
|
|
50
|
+
|
|
51
|
+
// One answer, whichever ending asked. Read against the ending: only `limit` can be `move`, only `memoryKill` `resume`.
|
|
52
|
+
export const TurnBreakPolicySchema = z.enum(["wait", "resend", "move", "retry", "resume"]);
|
|
44
53
|
export type TurnBreakPolicy = z.infer<typeof TurnBreakPolicySchema>;
|
|
45
54
|
|
|
46
55
|
// Which answers an ending may take, so a surface offers exactly these and a writer refuses anything else.
|
|
@@ -49,6 +58,7 @@ export const TURN_BREAK_POLICIES: Readonly<Record<TurnBreak, readonly TurnBreakP
|
|
|
49
58
|
outage: ["wait", "retry"],
|
|
50
59
|
stopped: ["wait", "retry"],
|
|
51
60
|
memory: ["wait", "resend"],
|
|
61
|
+
memoryKill: ["wait", "resume"],
|
|
52
62
|
};
|
|
53
63
|
|
|
54
64
|
/** Whether this ending may be answered this way; the one gate every writer goes through. */
|
|
@@ -63,6 +73,22 @@ export const breakArmed = (policy: TurnBreakPolicy): boolean => policy !== "wait
|
|
|
63
73
|
export const RETRY_LADDER_MS = [5_000, 15_000, 45_000] as const;
|
|
64
74
|
export const RETRY_LADDER_TRIES = RETRY_LADDER_MS.length;
|
|
65
75
|
|
|
76
|
+
// How many times the sandbox sends one request again by itself after memory killed it. The kill after that holds it for
|
|
77
|
+
// a press: a turn killed for memory every time it runs is more likely the cause than a victim, whatever its process was
|
|
78
|
+
// called. Quoted in the notice that holds it, so the number and the sentence cannot drift.
|
|
79
|
+
export const MEMORY_KILL_RERUNS = 2;
|
|
80
|
+
|
|
81
|
+
// The mark a held turn carries where memory killed it: the failure frame's `held` (agent-events.ts) and the recorded
|
|
82
|
+
// ending's (transcript.ts TurnEnding), which the card's press repeats. A memory kill is held as a stop, so without the
|
|
83
|
+
// mark a surface asked the stop's question, whose answer sets the stop ladder that a memory kill never climbs, and the
|
|
84
|
+
// question that does decide it was asked nowhere. One schema for both, so the frame and the record cannot word it apart.
|
|
85
|
+
export const MemoryKillMarkSchema = z
|
|
86
|
+
.boolean()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe(
|
|
89
|
+
"Killed because the sandbox ran out of memory: the answer that decides whether it goes again by itself is the memory kill's (wait, or resume once memory has stayed free), not the stop's. Absent for every other hold.",
|
|
90
|
+
);
|
|
91
|
+
|
|
66
92
|
/** The wait before the next rung, or undefined once the ladder is spent. */
|
|
67
93
|
export const retryLadderDelay = (triesWithoutProgress: number): number | undefined => RETRY_LADDER_MS[triesWithoutProgress];
|
|
68
94
|
|
package/src/text/notice-rows.ts
CHANGED
|
@@ -6,10 +6,16 @@ import { freshStartLine, freshStartNotice, handedOffLine, handedOffNotice } from
|
|
|
6
6
|
import { switchedLine, switchedNotice } from "../schemas/providers/switched.js";
|
|
7
7
|
|
|
8
8
|
// The notices that say what a turn was given to start from, each a row of its own worded from its frame's facts: what
|
|
9
|
-
// the window left out of the message, how a held turn continued, where a home's session started over,
|
|
10
|
-
//
|
|
11
|
-
type StartingFrame = Extract<AgentEvent, { kind: "context_trim" | "handoff" | "fresh_start" | "switched" }>;
|
|
12
|
-
const STARTING_KINDS: ReadonlySet<AgentEvent["kind"]> = new Set<StartingFrame["kind"]>(["context_trim", "handoff", "fresh_start", "switched"]);
|
|
9
|
+
// the window left out of the message, how a held turn continued, where a home's session started over, what the turn
|
|
10
|
+
// switched to since the one before it, and the copy of the workspace the sandbox had to set up again for it.
|
|
11
|
+
type StartingFrame = Extract<AgentEvent, { kind: "context_trim" | "handoff" | "fresh_start" | "switched" | "workspace_repaired" }>;
|
|
12
|
+
const STARTING_KINDS: ReadonlySet<AgentEvent["kind"]> = new Set<StartingFrame["kind"]>(["context_trim", "handoff", "fresh_start", "switched", "workspace_repaired"]);
|
|
13
|
+
|
|
14
|
+
// The sandbox's one repair of a conversation's view of the workspace, made before the model was asked anything.
|
|
15
|
+
const repairedLine = (layers: number): string =>
|
|
16
|
+
layers === 0
|
|
17
|
+
? "This conversation's copy of the workspace failed to come up, and was set up again."
|
|
18
|
+
: `This conversation's copy of the workspace failed to come up, so its installed dependencies (${String(layers)} ${layers === 1 ? "layer" : "layers"}) were set aside and it was set up again. Install them again if the work needs them.`;
|
|
13
19
|
|
|
14
20
|
/** Whether the frame is one of those notices. */
|
|
15
21
|
export const isStartingFrame = (event: AgentEvent): event is StartingFrame => STARTING_KINDS.has(event.kind);
|
|
@@ -25,6 +31,8 @@ export const startingRow = (event: StartingFrame): TranscriptRow => {
|
|
|
25
31
|
return { role: "notice", text: freshStartLine(event), noticeCode: noticeCode(freshStartNotice(event)) };
|
|
26
32
|
case "switched":
|
|
27
33
|
return { role: "notice", text: switchedLine(event), noticeCode: noticeCode(switchedNotice(event)) };
|
|
34
|
+
case "workspace_repaired":
|
|
35
|
+
return { role: "notice", text: repairedLine(event.layers), noticeCode: noticeCode({ code: "workspaceRepaired", params: { layers: event.layers } }) };
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
38
|
|