@intentic/sandbox-contract 1.390.0 → 1.392.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 +6 -1
- package/dist/contracts/agents.contract.d.ts +69 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +10 -0
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/ci.contract.d.ts +18 -0
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/ci.contract.js +19 -1
- package/dist/contracts/ci.contract.js.map +1 -1
- package/dist/contracts/device.contract.d.ts +10 -0
- package/dist/contracts/device.contract.d.ts.map +1 -1
- package/dist/contracts/ports.contract.d.ts +5 -0
- package/dist/contracts/ports.contract.d.ts.map +1 -1
- package/dist/contracts/ports.contract.js +1 -1
- package/dist/contracts/ports.contract.js.map +1 -1
- package/dist/contracts/runner.contract.d.ts +12 -4
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/runs.contract.d.ts +16 -0
- package/dist/contracts/runs.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +16 -0
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +66 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.js +10 -1
- package/dist/contracts/system.contract.js.map +1 -1
- package/dist/events/agent-events.d.ts +4 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +1 -0
- 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/failure-rows.js +1 -1
- package/dist/events/failure-rows.js.map +1 -1
- package/dist/events/land-conflict.d.ts +1 -0
- package/dist/events/land-conflict.d.ts.map +1 -1
- package/dist/events/land-conflict.js +4 -3
- package/dist/events/land-conflict.js.map +1 -1
- package/dist/events/requests.d.ts +1 -0
- package/dist/events/requests.d.ts.map +1 -1
- package/dist/events/requests.js +1 -1
- package/dist/events/requests.js.map +1 -1
- package/dist/events/resume.d.ts +2 -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 +1 -0
- package/dist/events/sandbox-notice.d.ts.map +1 -1
- package/dist/events/sandbox-notice.js +1 -0
- package/dist/events/sandbox-notice.js.map +1 -1
- package/dist/events/system-events.d.ts +12 -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 +4 -0
- package/dist/events/transcript.js.map +1 -1
- package/dist/index.d.ts +190 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/models/agent-standing.d.ts +2 -0
- package/dist/models/agent-standing.d.ts.map +1 -1
- package/dist/models/agent-standing.js.map +1 -1
- package/dist/models/model-setups.d.ts.map +1 -1
- package/dist/models/model-setups.js +2 -1
- package/dist/models/model-setups.js.map +1 -1
- package/dist/policy/failure-codes.d.ts +158 -0
- package/dist/policy/failure-codes.d.ts.map +1 -0
- package/dist/policy/failure-codes.js +50 -0
- package/dist/policy/failure-codes.js.map +1 -0
- package/dist/protocol/raw/raw-routes.d.ts +12 -0
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +3 -0
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/agent-press.d.ts +13 -0
- package/dist/schemas/agent-press.d.ts.map +1 -0
- package/dist/schemas/agent-press.js +14 -0
- package/dist/schemas/agent-press.js.map +1 -0
- package/dist/schemas/agents-list.d.ts +6 -0
- package/dist/schemas/agents-list.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +11 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +5 -6
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/ci.d.ts +21 -0
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +29 -0
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/device-resources.d.ts +54 -0
- package/dist/schemas/device-resources.d.ts.map +1 -0
- package/dist/schemas/device-resources.js +29 -0
- package/dist/schemas/device-resources.js.map +1 -0
- package/dist/schemas/devices.d.ts +2 -52
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js +2 -27
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/git/clone.d.ts +12 -0
- package/dist/schemas/git/clone.d.ts.map +1 -0
- package/dist/schemas/git/clone.js +14 -0
- package/dist/schemas/git/clone.js.map +1 -0
- package/dist/schemas/hosts.d.ts +23 -0
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js +14 -1
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/metrics.d.ts +59 -0
- package/dist/schemas/metrics.d.ts.map +1 -1
- package/dist/schemas/metrics.js +19 -0
- package/dist/schemas/metrics.js.map +1 -1
- package/dist/schemas/ports.d.ts +10 -0
- package/dist/schemas/ports.d.ts.map +1 -1
- package/dist/schemas/ports.js +8 -0
- package/dist/schemas/ports.js.map +1 -1
- package/dist/schemas/providers/handoff.d.ts +1 -0
- package/dist/schemas/providers/handoff.d.ts.map +1 -1
- package/dist/schemas/providers/handoff.js +4 -1
- package/dist/schemas/providers/handoff.js.map +1 -1
- package/dist/schemas/providers/plan-limits.js +1 -1
- package/dist/schemas/providers/plan-limits.js.map +1 -1
- package/dist/schemas/run-targets.d.ts +31 -0
- package/dist/schemas/run-targets.d.ts.map +1 -1
- package/dist/schemas/run-targets.js +9 -0
- package/dist/schemas/run-targets.js.map +1 -1
- package/dist/schemas/settings.d.ts +29 -0
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +17 -0
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/stranded-clone.d.ts +9 -0
- package/dist/schemas/stranded-clone.d.ts.map +1 -0
- package/dist/schemas/stranded-clone.js +12 -0
- package/dist/schemas/stranded-clone.js.map +1 -0
- package/dist/state/definition.d.ts +20 -0
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/fix-stance.js +1 -1
- package/dist/state/fix-stance.js.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/state/workspace-state.d.ts.map +1 -1
- package/dist/state/workspace-state.js +1 -1
- package/dist/state/workspace-state.js.map +1 -1
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +6 -6
- package/dist/text/transcript-fold.js.map +1 -1
- package/dist/text/transcript-interruption.d.ts +4 -0
- package/dist/text/transcript-interruption.d.ts.map +1 -0
- package/dist/text/transcript-interruption.js +27 -0
- package/dist/text/transcript-interruption.js.map +1 -0
- package/package.json +5 -5
- package/src/contracts/agents.contract.ts +12 -0
- package/src/contracts/ci.contract.ts +21 -0
- package/src/contracts/ports.contract.ts +3 -2
- package/src/contracts/system.contract.ts +12 -1
- package/src/events/agent-events.ts +2 -0
- package/src/events/failure-rows.ts +1 -1
- package/src/events/land-conflict.test.ts +13 -1
- package/src/events/land-conflict.ts +8 -4
- package/src/events/requests.ts +1 -1
- package/src/events/resume.test.ts +7 -1
- package/src/events/resume.ts +3 -0
- package/src/events/sandbox-notice.ts +1 -0
- package/src/events/transcript.ts +6 -0
- package/src/models/agent-standing.ts +4 -0
- package/src/models/model-setups.test.ts +11 -0
- package/src/models/model-setups.ts +4 -1
- package/src/policy/failure-codes.ts +157 -0
- package/src/policy/tests/failure-codes.test.ts +141 -0
- package/src/protocol/raw/raw-routes.ts +5 -0
- package/src/schemas/agent-press.test.ts +46 -0
- package/src/schemas/agent-press.ts +34 -0
- package/src/schemas/agents.ts +8 -8
- package/src/schemas/ci.ts +45 -0
- package/src/schemas/device-resources.ts +58 -0
- package/src/schemas/devices.ts +20 -56
- package/src/schemas/git/clone.ts +22 -0
- package/src/schemas/hosts.ts +34 -3
- package/src/schemas/metrics.ts +28 -0
- package/src/schemas/ports.ts +12 -0
- package/src/schemas/providers/handoff.test.ts +7 -0
- package/src/schemas/providers/handoff.ts +4 -1
- package/src/schemas/providers/plan-limits.ts +1 -1
- package/src/schemas/run-targets.ts +23 -1
- package/src/schemas/settings.ts +32 -0
- package/src/schemas/stranded-clone.ts +15 -0
- package/src/state/fix-stance.ts +1 -1
- package/src/state/runtime-state.ts +4 -0
- package/src/state/workspace-state.ts +3 -2
- package/src/text/transcript-fold.test.ts +21 -7
- package/src/text/transcript-fold.ts +5 -6
- package/src/text/transcript-interruption.ts +30 -0
- package/dist/policy/turned-away.d.ts +0 -3
- package/dist/policy/turned-away.d.ts.map +0 -1
- package/dist/policy/turned-away.js +0 -33
- package/dist/policy/turned-away.js.map +0 -1
- package/src/policy/turned-away.ts +0 -52
package/src/schemas/agents.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// agents: the conversation fleet
|
|
2
2
|
import { LandingDeliverySchema } from "./project-delivery.js";
|
|
3
3
|
import { AgentNextSchema } from "./agent-next.js";
|
|
4
|
+
import { AgentPressSchema } from "./agent-press.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { AgentHarnessSchema, AgentOriginSchema, AgentProviderSchema, ConversationQueueSchema, ForkedFromSchema, FreshSessionSchema } from "./agent.js";
|
|
6
7
|
import { FROM_BRANCHES_DESCRIPTION } from "./conversation-links.js";
|
|
@@ -9,6 +10,7 @@ import { LoopStateSchema } from "./loops.js";
|
|
|
9
10
|
import { LimitPolicySchema, RetryPolicySchema, RoomPolicySchema, TurnBreakPolicySchema, TurnBreakSchema } from "./turn-break.js";
|
|
10
11
|
import { KeepWarmSchema } from "./keep-warm.js";
|
|
11
12
|
import { AgentNeedSchema } from "./needs.js";
|
|
13
|
+
import { StrandedCloneSchema } from "./stranded-clone.js";
|
|
12
14
|
import { EMOJI_MAX_LENGTH, isSingleEmoji } from "../text/emoji.js";
|
|
13
15
|
import { ProgramAskSchema } from "../events/requests.js";
|
|
14
16
|
import { ReviewTallySchema, TurnProofSchema } from "./work-assurance.js";
|
|
@@ -137,13 +139,7 @@ export const TurnReachSchema = z.object({
|
|
|
137
139
|
),
|
|
138
140
|
liveMore: z.number().optional().describe("How many more such files there were beyond the ones listed. Absent when all are listed."),
|
|
139
141
|
stranded: z
|
|
140
|
-
.array(
|
|
141
|
-
z.object({
|
|
142
|
-
dir: z.string().describe("The clone, as a folder relative to its own copy of the workspace."),
|
|
143
|
-
uncommitted: z.number().describe("Files changed in it and never committed."),
|
|
144
|
-
unpushed: z.number().describe("Commits in it its upstream does not have, or that no remote has when it follows none."),
|
|
145
|
-
}),
|
|
146
|
-
)
|
|
142
|
+
.array(StrandedCloneSchema)
|
|
147
143
|
.max(TURN_REACH_LIST_MAX)
|
|
148
144
|
.optional()
|
|
149
145
|
.describe(
|
|
@@ -304,6 +300,10 @@ export const AgentSummarySchema = z.object({
|
|
|
304
300
|
next: AgentNextSchema.optional().describe(
|
|
305
301
|
"What carries it on next with nobody pressing anything, and when: a held turn re-run, a message held for memory, or messages booked for later. Absent when only a press moves it.",
|
|
306
302
|
),
|
|
303
|
+
// And what a press does instead (agent-press.ts): the daemon's one reading, which every chat window's strip follows.
|
|
304
|
+
press: AgentPressSchema.optional().describe(
|
|
305
|
+
"The daemon's one reading of what a person's Continue does now: carry on from how the last turn ended, or nothing. Every summary a sandbox that knows it writes carries it, `none` included, so its absence means a sandbox older than it.",
|
|
306
|
+
),
|
|
307
307
|
provider: AgentProviderSchema.describe("Which model provider it runs on."),
|
|
308
308
|
harness: AgentHarnessSchema.describe("Which agentic loop it runs on."),
|
|
309
309
|
// Latched with the conversation, so the card can say where work runs without asking anything else.
|
|
@@ -537,7 +537,7 @@ export const AgentSummarySchema = z.object({
|
|
|
537
537
|
.string()
|
|
538
538
|
.optional()
|
|
539
539
|
.describe(
|
|
540
|
-
"Which kind of failure it was, when the sandbox could tell: unlinked when its copy lost its link to the workspace, off_main_line when the shared workspace was moved off its main line and the work waits until it is back. Absent otherwise.",
|
|
540
|
+
"Which kind of failure it was, when the sandbox could tell: unlinked when its copy lost its link to the workspace, off_main_line when the shared workspace was moved off its main line and the work waits until it is back, repo_corrupt when the repository's own git storage is damaged (the sandbox checks and repairs it by itself). Absent otherwise.",
|
|
541
541
|
),
|
|
542
542
|
at: z.number().describe("When it failed, in milliseconds."),
|
|
543
543
|
})
|
package/src/schemas/ci.ts
CHANGED
|
@@ -171,6 +171,30 @@ export const CiMainFailureWorkflowSchema = z.object({
|
|
|
171
171
|
name: z.string().describe("The workflow, by the name the forge gives it. `ci` on a forge that runs one pipeline per commit."),
|
|
172
172
|
runId: z.number().describe("Its newest run that failed."),
|
|
173
173
|
jobs: z.array(z.string()).describe("Its jobs failing now, by name."),
|
|
174
|
+
since: z
|
|
175
|
+
.number()
|
|
176
|
+
.optional()
|
|
177
|
+
.describe(
|
|
178
|
+
"When this workflow began failing on the branch, in milliseconds: each workflow keeps its own, so one failing for weeks does not make another's breakage look as old. Absent for a failure kept before workflows were timed apart.",
|
|
179
|
+
),
|
|
180
|
+
failedAt: z
|
|
181
|
+
.number()
|
|
182
|
+
.optional()
|
|
183
|
+
.describe(
|
|
184
|
+
"When its newest run failed, in milliseconds. A workflow that has not failed for MAIN_FAILURE_STALE_MS, and has not passed either, is taken off the failure by itself.",
|
|
185
|
+
),
|
|
186
|
+
trigger: z
|
|
187
|
+
.string()
|
|
188
|
+
.optional()
|
|
189
|
+
.describe(
|
|
190
|
+
"What set its newest failed run off, in the forge's own word (`push`, `schedule`, …), where it is known: a scheduled workflow is measured by its next scheduled run, or one started by hand, and never by a push.",
|
|
191
|
+
),
|
|
192
|
+
timedOut: z
|
|
193
|
+
.array(z.string())
|
|
194
|
+
.optional()
|
|
195
|
+
.describe(
|
|
196
|
+
"Those of its failing jobs that failed by running out of time, which the forge reports as cancelled rather than failed. Absent when none did.",
|
|
197
|
+
),
|
|
174
198
|
});
|
|
175
199
|
export type CiMainFailureWorkflow = z.infer<typeof CiMainFailureWorkflowSchema>;
|
|
176
200
|
export const CiMainFailureSchema = z.object({
|
|
@@ -192,8 +216,29 @@ export const CiMainFailureSchema = z.object({
|
|
|
192
216
|
decision: MainFailureDecisionSchema.optional().describe(
|
|
193
217
|
"The latest thing decided about it: `fix-up` while the fix agent has it, `spent` once it waits for you (its turns are used up, or it stopped without a fix), `reported` when repairs are off.",
|
|
194
218
|
),
|
|
219
|
+
attempts: z
|
|
220
|
+
.number()
|
|
221
|
+
.optional()
|
|
222
|
+
.describe(
|
|
223
|
+
"How many fix attempts have been opened on it so far. A failure on its tenth attempt is stuck in a way no single attempt says. Absent from a daemon that does not count them.",
|
|
224
|
+
),
|
|
195
225
|
});
|
|
196
226
|
export type CiMainFailure = z.infer<typeof CiMainFailureSchema>;
|
|
227
|
+
// How long a workflow failing on a main-line branch stays on the failure without failing again or passing: its newest
|
|
228
|
+
// failed run is then weeks old, so nothing is measuring it (a one-off run, a workflow renamed or no longer scheduled),
|
|
229
|
+
// and holding the failure open on it only hides the branch's real state.
|
|
230
|
+
export const MAIN_FAILURE_STALE_MS = 14 * 24 * 60 * 60_000;
|
|
231
|
+
// Takes a workflow off a failing main-line branch by hand, or the whole failure when no workflow is named: what a person
|
|
232
|
+
// does when they know better than the forge (the workflow was deleted, or what fails is not the code's to fix).
|
|
233
|
+
export const CiForgetParamSchema = z.object({
|
|
234
|
+
repo: z.string().describe("Which workspace repository."),
|
|
235
|
+
branch: z.string().describe("Which main-line branch."),
|
|
236
|
+
workflow: z
|
|
237
|
+
.string()
|
|
238
|
+
.optional()
|
|
239
|
+
.describe("The workflow to stop tracking, by the name the failure lists it under. Leave it out to end the whole failure, every workflow on it."),
|
|
240
|
+
});
|
|
241
|
+
export type CiForgetParam = z.infer<typeof CiForgetParamSchema>;
|
|
197
242
|
export const CiRunsResponseSchema = z.object({
|
|
198
243
|
repos: z.array(CiRepoSchema).describe("Which workspace repositories are wired to a forge, and how each one's notifications are set up."),
|
|
199
244
|
// Newest first, across all mapped repos.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// One sandbox's resource share as docker currently enforces it, read off the container by the machine agent.
|
|
4
|
+
// `overlayRuntime` is the environment's locked demand; `hostRuntime` is the owner's addition; `privileged`/`gpu` are
|
|
5
|
+
// docker's enforced truth.
|
|
6
|
+
// A delta against what runs: absent means leave it, `null` on the two caps means back to the default; at least one key
|
|
7
|
+
// must be set. What the old `reshape` op carries, which the machine agent carries out as `ic sandbox shape --set` (its
|
|
8
|
+
// `olderResizePlan`); `set-shape` carries a whole shape instead.
|
|
9
|
+
export const SandboxResourcesAskFieldsSchema = z.object({
|
|
10
|
+
memoryGib: z.int().positive().nullable().optional(),
|
|
11
|
+
cpus: z.int().positive().nullable().optional(),
|
|
12
|
+
privileged: z.boolean().optional(),
|
|
13
|
+
gpu: z.boolean().optional(),
|
|
14
|
+
});
|
|
15
|
+
// A sandbox's shape, WHOLE: the owner's own ask for its share of the machine, every field a value. `null` on a cap is
|
|
16
|
+
// the contract's default (the share derived from the engine, or every core). The switches are the owner's ask, not
|
|
17
|
+
// docker's answer: a directive the approved environment demands rides beside it (`overlayRuntime`), and a host
|
|
18
|
+
// without the NVIDIA runtime drops the GPU. `ic` stores it, validates it against the image's run contract when it is
|
|
19
|
+
// saved, and prints it in `ic sandbox list --json`; nobody else merges anything into it.
|
|
20
|
+
export const SandboxShapeSchema = z.object({
|
|
21
|
+
memoryGib: z.int().positive().nullable(),
|
|
22
|
+
cpus: z.int().positive().nullable(),
|
|
23
|
+
privileged: z.boolean(),
|
|
24
|
+
gpu: z.boolean(),
|
|
25
|
+
});
|
|
26
|
+
export type SandboxShape = z.infer<typeof SandboxShapeSchema>;
|
|
27
|
+
// When a `set-shape` takes effect: `now` restarts the sandbox onto it; `nextRestart` saves it in ic's record and
|
|
28
|
+
// restarts nothing, and the next restart through ic applies it — Restart or Start from any door, an update, a rollback
|
|
29
|
+
// or a rebuild. Docker restarting the container by itself (after a crash or a reboot) does not: only ic recreates one.
|
|
30
|
+
export const SandboxShapeWhenSchema = z.enum(["now", "nextRestart"]);
|
|
31
|
+
export type SandboxShapeWhen = z.infer<typeof SandboxShapeWhenSchema>;
|
|
32
|
+
|
|
33
|
+
export const SandboxResourcesSchema = z.object({
|
|
34
|
+
// The cgroup memory ceiling in bytes; absent when docker imposes none (the hosted shape).
|
|
35
|
+
memoryBytes: z.number().optional(),
|
|
36
|
+
// The CFS quota as whole cores; absent when the container may use every core (the default).
|
|
37
|
+
cpus: z.number().optional(),
|
|
38
|
+
privileged: z.boolean(),
|
|
39
|
+
gpu: z.boolean(),
|
|
40
|
+
hostRuntime: z.array(z.string()),
|
|
41
|
+
overlayRuntime: z.array(z.string()),
|
|
42
|
+
// The shape the container runs with (the owner's ask it carries). Absent from an agent older than `set-shape`.
|
|
43
|
+
shape: SandboxShapeSchema.optional(),
|
|
44
|
+
// The shape saved for the sandbox's next restart through ic, and not yet in force. Absent when nothing is saved.
|
|
45
|
+
desired: SandboxShapeSchema.optional(),
|
|
46
|
+
// READ-ONLY, from agents older than `set-shape`: their saved share, a delta against what runs. Nothing new writes
|
|
47
|
+
// it; kept one release so a newer page can still show what an older agent saved. Remove with `later`.
|
|
48
|
+
saved: SandboxResourcesAskFieldsSchema.optional(),
|
|
49
|
+
});
|
|
50
|
+
export type SandboxResources = z.infer<typeof SandboxResourcesSchema>;
|
|
51
|
+
|
|
52
|
+
// Fields also exported separately for callers that compose them and enforce the at-least-one rule themselves.
|
|
53
|
+
// Strict like every device input (DeviceSandboxFlowSchema says why): it is only ever sent to a device.
|
|
54
|
+
export const SandboxResourcesAskSchema = SandboxResourcesAskFieldsSchema.strict().refine((ask) => Object.values(ask).some((value) => value !== undefined), {
|
|
55
|
+
message: "a reshape must change at least one thing",
|
|
56
|
+
});
|
|
57
|
+
export type SandboxResourcesAsk = z.infer<typeof SandboxResourcesAskSchema>;
|
|
58
|
+
|
package/src/schemas/devices.ts
CHANGED
|
@@ -1,71 +1,35 @@
|
|
|
1
1
|
// What one of the user's own machines is running.
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import {
|
|
4
|
+
SandboxResourcesAskSchema,
|
|
5
|
+
SandboxResourcesSchema,
|
|
6
|
+
SandboxShapeSchema,
|
|
7
|
+
SandboxShapeWhenSchema,
|
|
8
|
+
type SandboxShape,
|
|
9
|
+
type SandboxShapeWhen,
|
|
10
|
+
} from "./device-resources.js";
|
|
3
11
|
import { PortNumberSchema } from "./device-commands.js";
|
|
4
12
|
import { DeviceBridgeHoldSchema, DeviceConflictSchema, DeviceCopySchema, DeviceLowDiskSchema } from "./device-folder.js";
|
|
5
13
|
import { parseHostConnection, type DeviceFacts, DeviceFactsSchema, MachineIdentitySchema, MachineIdSchema, userDistrosOf, WslEnvironmentSchema } from "./hosts.js";
|
|
6
14
|
import { EgressOwnerKeysSchema, EgressPolicySchema, EgressProofSchema, EgressStatusSchema } from "./egress.js";
|
|
7
15
|
import { RollbackTargetSchema, UpdateOutcomeSchema } from "./updates.js";
|
|
8
16
|
import { DEV_VERSION } from "../state/versions.js";
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
SandboxResourcesAskFieldsSchema,
|
|
20
|
+
SandboxResourcesAskSchema,
|
|
21
|
+
SandboxResourcesSchema,
|
|
22
|
+
SandboxShapeSchema,
|
|
23
|
+
SandboxShapeWhenSchema,
|
|
24
|
+
type SandboxResources,
|
|
25
|
+
type SandboxResourcesAsk,
|
|
26
|
+
type SandboxShape,
|
|
27
|
+
type SandboxShapeWhen,
|
|
28
|
+
} from "./device-resources.js";
|
|
9
29
|
// Desktop-sync report shape shared by the agent, daemon and browser, produced only by the agent's own `deviceReport`.
|
|
10
30
|
// The agent never reports `sandboxes`; the docker half is filled in by whoever reads the report, scoped to the reader's
|
|
11
31
|
// own pairing.
|
|
12
32
|
|
|
13
|
-
// One sandbox's resource share as docker currently enforces it, read off the container by the machine agent.
|
|
14
|
-
// `overlayRuntime` is the environment's locked demand; `hostRuntime` is the owner's addition; `privileged`/`gpu` are
|
|
15
|
-
// docker's enforced truth.
|
|
16
|
-
// A delta against what runs: absent means leave it, `null` on the two caps means back to the default; at least one key
|
|
17
|
-
// must be set. What the old `reshape` op carries, which the machine agent carries out as `ic sandbox shape --set` (its
|
|
18
|
-
// `olderResizePlan`); `set-shape` carries a whole shape instead.
|
|
19
|
-
export const SandboxResourcesAskFieldsSchema = z.object({
|
|
20
|
-
memoryGib: z.int().positive().nullable().optional(),
|
|
21
|
-
cpus: z.int().positive().nullable().optional(),
|
|
22
|
-
privileged: z.boolean().optional(),
|
|
23
|
-
gpu: z.boolean().optional(),
|
|
24
|
-
});
|
|
25
|
-
// A sandbox's shape, WHOLE: the owner's own ask for its share of the machine, every field a value. `null` on a cap is
|
|
26
|
-
// the contract's default (the share derived from the engine, or every core). The switches are the owner's ask, not
|
|
27
|
-
// docker's answer: a directive the approved environment demands rides beside it (`overlayRuntime`), and a host
|
|
28
|
-
// without the NVIDIA runtime drops the GPU. `ic` stores it, validates it against the image's run contract when it is
|
|
29
|
-
// saved, and prints it in `ic sandbox list --json`; nobody else merges anything into it.
|
|
30
|
-
export const SandboxShapeSchema = z.object({
|
|
31
|
-
memoryGib: z.int().positive().nullable(),
|
|
32
|
-
cpus: z.int().positive().nullable(),
|
|
33
|
-
privileged: z.boolean(),
|
|
34
|
-
gpu: z.boolean(),
|
|
35
|
-
});
|
|
36
|
-
export type SandboxShape = z.infer<typeof SandboxShapeSchema>;
|
|
37
|
-
// When a `set-shape` takes effect: `now` restarts the sandbox onto it; `nextRestart` saves it in ic's record and
|
|
38
|
-
// restarts nothing, and the next restart through ic applies it — Restart or Start from any door, an update, a rollback
|
|
39
|
-
// or a rebuild. Docker restarting the container by itself (after a crash or a reboot) does not: only ic recreates one.
|
|
40
|
-
export const SandboxShapeWhenSchema = z.enum(["now", "nextRestart"]);
|
|
41
|
-
export type SandboxShapeWhen = z.infer<typeof SandboxShapeWhenSchema>;
|
|
42
|
-
|
|
43
|
-
export const SandboxResourcesSchema = z.object({
|
|
44
|
-
// The cgroup memory ceiling in bytes; absent when docker imposes none (the hosted shape).
|
|
45
|
-
memoryBytes: z.number().optional(),
|
|
46
|
-
// The CFS quota as whole cores; absent when the container may use every core (the default).
|
|
47
|
-
cpus: z.number().optional(),
|
|
48
|
-
privileged: z.boolean(),
|
|
49
|
-
gpu: z.boolean(),
|
|
50
|
-
hostRuntime: z.array(z.string()),
|
|
51
|
-
overlayRuntime: z.array(z.string()),
|
|
52
|
-
// The shape the container runs with (the owner's ask it carries). Absent from an agent older than `set-shape`.
|
|
53
|
-
shape: SandboxShapeSchema.optional(),
|
|
54
|
-
// The shape saved for the sandbox's next restart through ic, and not yet in force. Absent when nothing is saved.
|
|
55
|
-
desired: SandboxShapeSchema.optional(),
|
|
56
|
-
// READ-ONLY, from agents older than `set-shape`: their saved share, a delta against what runs. Nothing new writes
|
|
57
|
-
// it; kept one release so a newer page can still show what an older agent saved. Remove with `later`.
|
|
58
|
-
saved: SandboxResourcesAskFieldsSchema.optional(),
|
|
59
|
-
});
|
|
60
|
-
export type SandboxResources = z.infer<typeof SandboxResourcesSchema>;
|
|
61
|
-
|
|
62
|
-
// Fields also exported separately for callers that compose them and enforce the at-least-one rule themselves.
|
|
63
|
-
// Strict like every device input (DeviceSandboxFlowSchema says why): it is only ever sent to a device.
|
|
64
|
-
export const SandboxResourcesAskSchema = SandboxResourcesAskFieldsSchema.strict().refine((ask) => Object.values(ask).some((value) => value !== undefined), {
|
|
65
|
-
message: "a reshape must change at least one thing",
|
|
66
|
-
});
|
|
67
|
-
export type SandboxResourcesAsk = z.infer<typeof SandboxResourcesAskSchema>;
|
|
68
|
-
|
|
69
33
|
// One sandbox container on the machine, the docker half, filled in by the reader, never by the sync agent.
|
|
70
34
|
export const DeviceSandboxSchema = z.object({
|
|
71
35
|
slug: z.string(),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// A clone of its own a turn left inside its copy (TurnReach.stranded), settled one of two ways: folded into the
|
|
4
|
+
// repository it sits in, its own `.git` removed so its files land with the rest, or moved into the workspace as a
|
|
5
|
+
// repository of its own.
|
|
6
|
+
export const AgentCloneSchema = z.object({
|
|
7
|
+
id: z.string().min(1).describe("Which conversation."),
|
|
8
|
+
dir: z.string().min(1).describe("The clone, exactly as the card's reach names it: a folder relative to the conversation's copy of the workspace."),
|
|
9
|
+
action: z
|
|
10
|
+
.enum(["fold", "adopt"])
|
|
11
|
+
.describe(
|
|
12
|
+
"`fold`: remove the clone's own `.git`, so its files are ordinary work of the repository it sits in and land with it. `adopt`: move it into your workspace at the same folder, `.git` and all, as a repository of its own.",
|
|
13
|
+
),
|
|
14
|
+
dropCommits: z
|
|
15
|
+
.number()
|
|
16
|
+
.int()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe(
|
|
19
|
+
"For `fold` of a clone that holds commits: how many the caller was shown and agreed to drop. The files stay; only that history goes. Refused when absent or not the clone's count now.",
|
|
20
|
+
),
|
|
21
|
+
});
|
|
22
|
+
export type AgentClone = z.infer<typeof AgentCloneSchema>;
|
package/src/schemas/hosts.ts
CHANGED
|
@@ -122,9 +122,40 @@ const HostMemorySchema = z.object({
|
|
|
122
122
|
});
|
|
123
123
|
export type HostMemory = z.infer<typeof HostMemorySchema>;
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
/* THE HOST'S GPU RESETS AND CRASHES, ON EVERY HEARTBEAT (2026-11-03). On 2026-11-02 a sandbox agent rendered a page on
|
|
126
|
+
rog's display GPU through WSL (Mesa d3d12 over /dev/dxg); the driver lost the device (LiveKernelEvent 0x141) and the
|
|
127
|
+
PC powered off. All the sandbox could say afterwards was "killed without warning". So the Windows side's agent reads
|
|
128
|
+
Windows' own record of such events (the event log: a GPU timeout or reset, a bluescreen, an unexpected power-off) and
|
|
129
|
+
answers each heartbeat with those of the last day; the daemon keeps every one it has not seen, names them where it
|
|
130
|
+
explains a restart, and pauses GPU work after a GPU reset until the owner resumes it (`gpu.pausedFor` in settings). */
|
|
131
|
+
export const HostCrashEventSchema = z.object({
|
|
132
|
+
// Stable across heartbeats, so the daemon keeps each once: the log and its record id (`System:48213`), or a WER
|
|
133
|
+
// report's own id (`WER:<guid>`), since Windows logs a queued report again every few minutes.
|
|
134
|
+
id: z.string().min(1).max(120),
|
|
135
|
+
// When it happened, ISO 8601 UTC: when Windows logged it, or a WER report's dump time. A Kernel-Power 41 is logged as
|
|
136
|
+
// Windows boots again, after the power-off.
|
|
137
|
+
at: z.string().min(1),
|
|
138
|
+
// `gpu-reset`: the display driver timed out or was reset (LiveKernelEvent 141/117/116, Display 4101, a 0x116/0x117
|
|
139
|
+
// bluescreen). `host-crash`: Windows itself went down (Kernel-Power 41, any other bluescreen).
|
|
140
|
+
kind: z.enum(["gpu-reset", "host-crash"]),
|
|
141
|
+
// Windows' name for it: "LiveKernelEvent 141", "Display 4101", "Kernel-Power 41", "BugCheck 0x116".
|
|
142
|
+
code: z.string().min(1).max(80),
|
|
143
|
+
// Windows' own first line about it, trimmed.
|
|
144
|
+
detail: z.string().max(400).optional(),
|
|
145
|
+
});
|
|
146
|
+
export type HostCrashEvent = z.infer<typeof HostCrashEventSchema>;
|
|
147
|
+
|
|
148
|
+
// How far back the Windows side reports, and how many: a heartbeat answer stays small, and a day covers the reboot.
|
|
149
|
+
export const HOST_CRASH_LOOKBACK_MS = 24 * 60 * 60_000;
|
|
150
|
+
export const HOST_CRASHES_MAX = 20;
|
|
151
|
+
|
|
152
|
+
// The heartbeat's answer. `memory` and `crashes` are absent from an agent older than them and from every side but Windows
|
|
153
|
+
// (above); an older daemon reads the `ok` and nothing else.
|
|
154
|
+
export const DevicePingSchema = z.object({
|
|
155
|
+
ok: z.literal(true),
|
|
156
|
+
memory: HostMemorySchema.optional(),
|
|
157
|
+
crashes: z.array(HostCrashEventSchema).max(HOST_CRASHES_MAX).optional(),
|
|
158
|
+
});
|
|
128
159
|
|
|
129
160
|
const GIB = 1024 ** 3;
|
|
130
161
|
|
package/src/schemas/metrics.ts
CHANGED
|
@@ -233,6 +233,9 @@ export const STORAGE_CLEANABILITY = {
|
|
|
233
233
|
packageStores: "safe",
|
|
234
234
|
// Build tools' output caches.
|
|
235
235
|
buildCaches: "safe",
|
|
236
|
+
// What builds left inside conversation checkouts (a Rust `target/`, Gradle and Flutter output): only checkouts whose
|
|
237
|
+
// conversation has nothing running are cleaned, and their next build makes it again. The checkout itself stays.
|
|
238
|
+
buildOutputs: "safe",
|
|
236
239
|
} as const satisfies Record<string, StorageCleanability>;
|
|
237
240
|
export type StorageCategoryId = keyof typeof STORAGE_CLEANABILITY;
|
|
238
241
|
export const StorageCategoryIdSchema = z.enum(Object.keys(STORAGE_CLEANABILITY) as StorageCategoryId[]);
|
|
@@ -303,6 +306,31 @@ export const StorageReportSchema = z.object({
|
|
|
303
306
|
});
|
|
304
307
|
export type StorageReport = z.infer<typeof StorageReportSchema>;
|
|
305
308
|
|
|
309
|
+
// How close the history volume is to full, as the daemon's disk-pressure watch last read it (GET /system/disk-pressure).
|
|
310
|
+
// `reaping`: under 15% free, settled checkouts' build output is being removed; `low` and `critical` are under 10% and
|
|
311
|
+
// 5%, which the owner is told about once each.
|
|
312
|
+
export const DiskPressureLevelSchema = z.enum(["ok", "reaping", "low", "critical"]);
|
|
313
|
+
export type DiskPressureLevel = z.infer<typeof DiskPressureLevelSchema>;
|
|
314
|
+
|
|
315
|
+
export const DiskPressureSchema = z.object({
|
|
316
|
+
level: DiskPressureLevelSchema,
|
|
317
|
+
freeBytes: z.number().describe("Space available on the history volume at the last reading."),
|
|
318
|
+
totalBytes: z.number().describe("The history volume's size."),
|
|
319
|
+
measuredAt: z.number().describe("When it was read, in milliseconds; 0 before the first reading."),
|
|
320
|
+
reaped: z
|
|
321
|
+
.object({
|
|
322
|
+
bytes: z.number().describe("Space the removals gave back, as the volume measured it before and after."),
|
|
323
|
+
checkouts: z.number().describe("How many conversation checkouts had build output removed."),
|
|
324
|
+
at: z.number().describe("When that pass ended, in milliseconds."),
|
|
325
|
+
})
|
|
326
|
+
.optional()
|
|
327
|
+
.describe("The last pass that removed build output because the disk was short. Absent until one has."),
|
|
328
|
+
using: z
|
|
329
|
+
.array(z.object({ id: StorageCategoryIdSchema, bytes: z.number() }))
|
|
330
|
+
.describe("The biggest categories in the last finished storage scan, largest first, at most three; empty before a scan."),
|
|
331
|
+
});
|
|
332
|
+
export type DiskPressure = z.infer<typeof DiskPressureSchema>;
|
|
333
|
+
|
|
306
334
|
export const StorageCleanInputSchema = z.object({
|
|
307
335
|
category: StorageCategoryIdSchema.describe("The category to clean; one whose cleanability is `none` is refused."),
|
|
308
336
|
});
|
package/src/schemas/ports.ts
CHANGED
|
@@ -55,6 +55,18 @@ export const PortSummarySchema = z.object({
|
|
|
55
55
|
})
|
|
56
56
|
.optional()
|
|
57
57
|
.describe("The background job an agent left running for you on this port, when that is what answers here."),
|
|
58
|
+
// (2026-11-03) In the owner's shinobi workspace 53 conversations ran ss and pgrep to find whose server held a port,
|
|
59
|
+
// and one agent's scratch server sat on the owner's 7878, which the desktop mirror put on his own localhost.
|
|
60
|
+
owner: z
|
|
61
|
+
.object({
|
|
62
|
+
conversationId: z.string().describe("The conversation whose agent opened it, in its shell or a background job."),
|
|
63
|
+
jobId: z.string().optional().describe("The background job serving it, when one job of that conversation can be named."),
|
|
64
|
+
label: z.string().optional().describe("What that job is, in the agent's own words when it gave any."),
|
|
65
|
+
})
|
|
66
|
+
.optional()
|
|
67
|
+
.describe(
|
|
68
|
+
"Which conversation's agent is listening here, when it can be told. Such a port stays off the owner's computers (the desktop mirror leaves it out) unless the job was left running for them (`job`) or the owner asks for it there.",
|
|
69
|
+
),
|
|
58
70
|
forwarded: z.boolean().describe("Whether it is currently reachable from outside."),
|
|
59
71
|
// `https://port-<slot>-<sandboxId>.<zone>`.
|
|
60
72
|
previewUrl: z.string().optional().describe("Where to open it. Present only while forwarded, and only on a sandbox that has an outside address."),
|
|
@@ -62,3 +62,10 @@ describe("a home's fresh start", () => {
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
test("a failed summary carries its reason into both the notice and readable line", () => {
|
|
68
|
+
const event = { mode: "summary", fellBack: true, reason: "Every summary model is out of allowance" } as const;
|
|
69
|
+
expect(handedOffNotice(event)).toEqual({ code: "handedOff", params: event });
|
|
70
|
+
expect(handedOffLine(event)).toBe("Could not write a summary for the hand-off, so the fresh session opened with the recent conversation and where the work stands instead. Reason: Every summary model is out of allowance");
|
|
71
|
+
});
|
|
@@ -90,6 +90,7 @@ export const HandedOffSchema = z.object({
|
|
|
90
90
|
cleared: z.number().optional().describe("Older tool outputs a trimmed copy cleared."),
|
|
91
91
|
model: z.string().optional().describe("The model that wrote the summary."),
|
|
92
92
|
fellBack: z.boolean().optional(),
|
|
93
|
+
reason: z.string().optional().describe("Why the requested hand-off could not be built."),
|
|
93
94
|
});
|
|
94
95
|
export type HandedOff = z.infer<typeof HandedOffSchema>;
|
|
95
96
|
|
|
@@ -102,15 +103,17 @@ export const handedOffNotice = (event: HandedOff): Extract<SandboxNotice, { code
|
|
|
102
103
|
...(event.cleared === undefined ? {} : { cleared: event.cleared }),
|
|
103
104
|
...(event.model === undefined ? {} : { model: event.model }),
|
|
104
105
|
...(event.fellBack === true ? { fellBack: true } : {}),
|
|
106
|
+
...(event.reason === undefined ? {} : { reason: event.reason }),
|
|
105
107
|
},
|
|
106
108
|
});
|
|
107
109
|
|
|
108
110
|
/** The transcript's line for how a held turn continued. */
|
|
109
111
|
export const handedOffLine = (event: HandedOff): string => {
|
|
110
112
|
if (event.fellBack === true) {
|
|
111
|
-
|
|
113
|
+
const line = event.mode === "trim"
|
|
112
114
|
? "Could not trim the session for the hand-off, so it was carried whole."
|
|
113
115
|
: "Could not write a summary for the hand-off, so the fresh session opened with the recent conversation and where the work stands instead.";
|
|
116
|
+
return event.reason === undefined ? line : `${line} Reason: ${event.reason}`;
|
|
114
117
|
}
|
|
115
118
|
const tokens = event.tokens === undefined ? undefined : tokensLabel(event.tokens);
|
|
116
119
|
switch (event.mode) {
|
|
@@ -198,7 +198,7 @@ export const AgentReplySchema = z.discriminatedUnion("kind", [
|
|
|
198
198
|
.describe(
|
|
199
199
|
"Whether to go ahead. Approving means the plan then runs without a prompt per tool, because being asked whether a plan you just approved may run its first command is not a question worth having.",
|
|
200
200
|
),
|
|
201
|
-
feedback: z.string().optional().describe("
|
|
201
|
+
feedback: z.string().optional().describe("Instructions to follow while executing an approved plan, or changes requested when rejecting it."),
|
|
202
202
|
}),
|
|
203
203
|
// Keyed by question text, valued by chosen option label(s), including free-text "Other".
|
|
204
204
|
z.object({
|
|
@@ -126,6 +126,22 @@ export const RunStartedSchema = z.object({ session: z.string() });
|
|
|
126
126
|
export const DeviceRunStateSchema = z.enum(["running", "ended", "unknown"]);
|
|
127
127
|
export type DeviceRunState = z.infer<typeof DeviceRunStateSchema>;
|
|
128
128
|
|
|
129
|
+
// WHAT A RUN WAS BUILT FROM: the repository's commit and how much of its tree was uncommitted when `devices run` began
|
|
130
|
+
// its build (in the owner's tree that is mostly landed work, since a land leaves its changes uncommitted), and whether
|
|
131
|
+
// the tree moved while it compiled. With `landsSince` on the run, the Run dialog says whether the program on the
|
|
132
|
+
// computer is the newest work or a restart would bring more.
|
|
133
|
+
export const RunBuiltFromSchema = z.object({
|
|
134
|
+
// The full sha of HEAD when the build began.
|
|
135
|
+
commit: z.string().min(1).max(64),
|
|
136
|
+
// Paths with uncommitted changes then (`git status`): 0 is a clean tree.
|
|
137
|
+
changed: z.int().nonnegative(),
|
|
138
|
+
// When the build began.
|
|
139
|
+
at: z.string(),
|
|
140
|
+
// The tree changed while it compiled (a land that was already writing, the owner's own edits): it may mix versions.
|
|
141
|
+
movedDuringBuild: z.boolean().optional(),
|
|
142
|
+
});
|
|
143
|
+
export type RunBuiltFrom = z.infer<typeof RunBuiltFromSchema>;
|
|
144
|
+
|
|
129
145
|
export const DeviceRunSchema = z.object({
|
|
130
146
|
device: z.string(),
|
|
131
147
|
// The run id the computer's app_status, app_logs and app_stop take.
|
|
@@ -133,7 +149,7 @@ export const DeviceRunSchema = z.object({
|
|
|
133
149
|
name: z.string(),
|
|
134
150
|
// `unknown`: its process is alive but the computer cannot tell whether it is still this run, so it will not stop it.
|
|
135
151
|
state: DeviceRunStateSchema,
|
|
136
|
-
// The computer's own words for it: "running, pid 4120", "exited with code 101", "stopped by the
|
|
152
|
+
// The computer's own words for it: "running, pid 4120", "exited with code 101", "stopped by the Run dialog's Stop".
|
|
137
153
|
said: z.string(),
|
|
138
154
|
// How it ended, when it exited by itself with a code.
|
|
139
155
|
exitCode: z.int().optional(),
|
|
@@ -143,6 +159,12 @@ export const DeviceRunSchema = z.object({
|
|
|
143
159
|
repo: z.string().optional(),
|
|
144
160
|
// The computer's ports the sandbox reaches for it (the target's `reach`), open while it runs, closed when it stops.
|
|
145
161
|
ports: z.array(z.int().min(1).max(65535)),
|
|
162
|
+
// Who started it, when this sandbox did since its last restart: "the Run dialog", "conversation <id>", "a terminal".
|
|
163
|
+
startedBy: z.string().optional(),
|
|
164
|
+
// What its build was made from, when `devices run` built it (RunBuiltFromSchema).
|
|
165
|
+
builtFrom: RunBuiltFromSchema.optional(),
|
|
166
|
+
// Lands into its repository since its build began, as far as this sandbox has seen since it came up.
|
|
167
|
+
landsSince: z.int().nonnegative().optional(),
|
|
146
168
|
});
|
|
147
169
|
export type DeviceRun = z.infer<typeof DeviceRunSchema>;
|
|
148
170
|
|
package/src/schemas/settings.ts
CHANGED
|
@@ -239,6 +239,35 @@ export const MemberAudienceSchema = z.object({
|
|
|
239
239
|
});
|
|
240
240
|
export type MemberAudience = z.infer<typeof MemberAudienceSchema>;
|
|
241
241
|
|
|
242
|
+
/* THE HOST GPU, FOR A SANDBOX WHOSE GPU SWITCH IS ON (2026-11-03). On a Windows PC that GPU is the owner's display GPU,
|
|
243
|
+
shared through WSL (/dev/dxg). Until 2026-11-03 the engine put its driver libraries on every process's library path,
|
|
244
|
+
so 65 conversations' browsers and shells rendered on it unasked, and one GPU hang powered rog off. Now nothing uses it
|
|
245
|
+
unless asked: `gpu-run <command>` runs one command with it (bin/gpu-run), and `shells: "all"` gives it to every
|
|
246
|
+
command an agent runs. Read by the daemon (gpu/gpu-state.ts), which hands gpu-run what it needs in a state file. */
|
|
247
|
+
export const GpuShellsSchema = z.enum(["on-request", "all"]);
|
|
248
|
+
export const GpuSettingsSchema = z.object({
|
|
249
|
+
shells: GpuShellsSchema.default("on-request").describe(
|
|
250
|
+
"Which of an agent's commands may use this sandbox's GPU. `on-request` (the default): only a command run through `gpu-run`, so a browser, a test run or a build never lands on your display GPU by accident. `all`: every command an agent runs, as if each one went through gpu-run.",
|
|
251
|
+
),
|
|
252
|
+
timeoutMinutes: z
|
|
253
|
+
.number()
|
|
254
|
+
.int()
|
|
255
|
+
.min(0)
|
|
256
|
+
.max(24 * 60)
|
|
257
|
+
.default(0)
|
|
258
|
+
.describe("How long one gpu-run command may run before it is stopped, in minutes. Zero (the default) never stops it; `gpu-run --timeout` sets it for one command."),
|
|
259
|
+
// Written by the daemon when the computer this sandbox runs on reported a GPU reset (hosts/host-crashes.ts); cleared
|
|
260
|
+
// by the owner, which is the "resume" press. A sentence, so whoever reads the file sees why.
|
|
261
|
+
pausedFor: z
|
|
262
|
+
.string()
|
|
263
|
+
.max(400)
|
|
264
|
+
.optional()
|
|
265
|
+
.describe(
|
|
266
|
+
"Set by the sandbox when the computer it runs on reported that its GPU was reset or hung, naming the event: while it is set, gpu-run refuses, and every command runs without the GPU. Clear it once you have looked, to let agents use the GPU again.",
|
|
267
|
+
),
|
|
268
|
+
});
|
|
269
|
+
export type GpuSettings = z.infer<typeof GpuSettingsSchema>;
|
|
270
|
+
|
|
242
271
|
export const SandboxSettingsSchema = z.object({
|
|
243
272
|
// The zone every WALL-CLOCK RULE in this sandbox is meant in — an automation's cron, and anything else that says
|
|
244
273
|
// "at 09:00" instead of naming an instant. It is not a display preference: nothing formats through it, and an
|
|
@@ -557,6 +586,9 @@ export const SandboxSettingsSchema = z.object({
|
|
|
557
586
|
),
|
|
558
587
|
// Speaking replies aloud (schemas/voice.ts): which voice speaks each language, and whether a hands-free turn is
|
|
559
588
|
// answered out loud. Read by the daemon's voice engine on every utterance, so a change is heard on the next one.
|
|
589
|
+
gpu: GpuSettingsSchema.prefault({}).describe(
|
|
590
|
+
"This sandbox's use of the host GPU, where its GPU switch is on: whether agents' commands get it only through gpu-run or all of them do, how long one gpu-run command may run, and whether GPU work is paused after the host reported a GPU reset.",
|
|
591
|
+
),
|
|
560
592
|
voice: VoiceSettingsSchema.prefault({}).describe(
|
|
561
593
|
"How the agent's replies are spoken aloud: whether a hands-free conversation is answered out loud, which voice speaks each language, and a speech provider of your own if you connected one.",
|
|
562
594
|
),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// A repository a conversation cloned (or `git init`ed) inside its own copy of the workspace and left work in: it never
|
|
4
|
+
// rides that conversation's land, so the review lists it with what folding it into its parent, or keeping it as a
|
|
5
|
+
// workspace repository of its own, would carry.
|
|
6
|
+
export const StrandedCloneSchema = z.object({
|
|
7
|
+
dir: z.string().describe("The clone, as a folder relative to its own copy of the workspace."),
|
|
8
|
+
uncommitted: z.number().describe("Files changed in it and never committed."),
|
|
9
|
+
unpushed: z.number().describe("Commits in it its upstream does not have, or that no remote has when it follows none."),
|
|
10
|
+
commits: z
|
|
11
|
+
.number()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Commits it holds at all, 0 for a repository `git init` made and nothing was committed in: what folding it would drop. Absent from a sandbox too old to count them."),
|
|
14
|
+
parent: z.string().optional().describe("The workspace repository it sits inside, `root` for the workspace's own: where folding puts its files."),
|
|
15
|
+
});
|
package/src/state/fix-stance.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { turnedAwayCode } from "../policy/
|
|
1
|
+
import { turnedAwayCode } from "../policy/failure-codes.js";
|
|
2
2
|
import { type AgentSummary, awaitsWake } from "../schemas/agents.js";
|
|
3
3
|
|
|
4
4
|
/* WHAT BECAME OF THE AGENT A SURFACE SENT AFTER A FAILURE — a failed pipeline row, a refused push. */
|
|
@@ -70,6 +70,10 @@ const RUNTIME_DOMAINS = [
|
|
|
70
70
|
// machine: what every page needs to hear before the sandbox goes quiet under it, wherever the reader is.
|
|
71
71
|
{ domain: "update", invalidates: [["update"]] },
|
|
72
72
|
|
|
73
|
+
// The disk watch's level moved or it removed build output to make room (system/resources/storage/disk-pressure.ts):
|
|
74
|
+
// the attention row and the Storage card read it, and no file under /work changes when the history volume fills.
|
|
75
|
+
{ domain: "disk", invalidates: [["disk"]] },
|
|
76
|
+
|
|
73
77
|
// A standing yes written or taken back outside a need's answer: a permission card's pass, a release, a purge. They
|
|
74
78
|
// live under the auth root, which no file push watches, and the Allowed list must move with the card that wrote one.
|
|
75
79
|
{ domain: "grants", invalidates: [["grants"]] },
|
|
@@ -666,8 +666,9 @@ export const REPORTED_MANIFEST_PATHS: readonly string[] = WORKSPACE_STATE_FILES.
|
|
|
666
666
|
// Files on the daemon's own volume whose unreadable records are reported too, named by their absolute path there: the
|
|
667
667
|
// conversation registry's rows, one of which this build could not read costs that conversation until a build that can
|
|
668
668
|
// runs. Reported, never repaired from the card (no route edits them), and refreshed whenever the card is fetched. The
|
|
669
|
-
// boot record (2026-10-05) is reported when a restart storm kept a boot from resuming the turns it cut
|
|
670
|
-
|
|
669
|
+
// boot record (2026-10-05) is reported when a restart storm kept a boot from resuming the turns it cut, and the git dirs
|
|
670
|
+
// (2026-11-03) when a check after an unclean stop found objects nothing could rebuild (git/integrity/crash-check.ts).
|
|
671
|
+
export const REPORTED_VOLUME_FILES: readonly string[] = [`${HISTORY_ROOT}/conversations.db`, `${HISTORY_ROOT}/boot-history.json`, `${HISTORY_ROOT}/gits`];
|
|
671
672
|
|
|
672
673
|
// Accepts either separator; the daemon holds these as platform paths and normalizing at every call site is what
|
|
673
674
|
// eventually gets forgotten.
|