@intentic/sandbox-contract 1.396.0 → 1.398.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/privacy.contract.d.ts +330 -0
- package/dist/contracts/privacy.contract.d.ts.map +1 -1
- package/dist/contracts/privacy.contract.js +89 -0
- package/dist/contracts/privacy.contract.js.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 +30 -4
- 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/privacy-leaks.d.ts +487 -0
- package/dist/schemas/privacy-leaks.d.ts.map +1 -0
- package/dist/schemas/privacy-leaks.js +129 -0
- package/dist/schemas/privacy-leaks.js.map +1 -0
- 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/auth-state.d.ts.map +1 -1
- package/dist/state/auth-state.js +1 -0
- package/dist/state/auth-state.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/privacy.contract.ts +107 -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/privacy-leaks.ts +212 -0
- 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/state/auth-state.ts +3 -0
- package/src/text/notice-rows.ts +12 -4
package/src/schemas/agents.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { AgentHarnessSchema, AgentOriginSchema, AgentProviderSchema, Conversatio
|
|
|
7
7
|
import { FROM_BRANCHES_DESCRIPTION } from "./conversation-links.js";
|
|
8
8
|
import { RepoBranchSchema } from "./shared.js";
|
|
9
9
|
import { LoopStateSchema } from "./loops.js";
|
|
10
|
-
import { LimitPolicySchema, RetryPolicySchema, RoomPolicySchema, TurnBreakPolicySchema, TurnBreakSchema } from "./turn-break.js";
|
|
10
|
+
import { LimitPolicySchema, MemoryKillPolicySchema, RetryPolicySchema, RoomPolicySchema, TurnBreakPolicySchema, TurnBreakSchema } from "./turn-break.js";
|
|
11
11
|
import { KeepWarmSchema } from "./keep-warm.js";
|
|
12
12
|
import { AgentNeedSchema } from "./needs.js";
|
|
13
13
|
import { StrandedCloneSchema } from "./stranded-clone.js";
|
|
@@ -281,6 +281,16 @@ export const AgentSummarySchema = z.object({
|
|
|
281
281
|
.describe(
|
|
282
282
|
"Whether `failure` is the sandbox's own sentence rather than the provider's or the harness's words. Absent for theirs, and for an ending recorded before it was said.",
|
|
283
283
|
),
|
|
284
|
+
// How many turns in a row ended on this same failure with nothing run (failure-codes.ts failureFingerprint): the chat
|
|
285
|
+
// stops offering Continue at two, since a third press would only fail the same way, and offers the ways out instead.
|
|
286
|
+
failureRepeats: z
|
|
287
|
+
.number()
|
|
288
|
+
.int()
|
|
289
|
+
.min(2)
|
|
290
|
+
.optional()
|
|
291
|
+
.describe(
|
|
292
|
+
"How many turns in a row have ended on this same failure before the model answered. Absent until it has happened twice: sending again would most likely fail the same way.",
|
|
293
|
+
),
|
|
284
294
|
// Epoch seconds the spent allowance reopens; absent means genuinely unknown (Grok, Cursor) — never guess one.
|
|
285
295
|
limitResetsAt: z.number().optional().describe("When the spent allowance reopens, in epoch seconds. Absent when the provider publishes no instant."),
|
|
286
296
|
limitHeld: z.boolean().optional().describe("Whether the refused turn is held whole, so sending again re-runs it instead of appending to it."),
|
|
@@ -339,6 +349,12 @@ export const AgentSummarySchema = z.object({
|
|
|
339
349
|
outagePolicy: RetryPolicySchema.optional(),
|
|
340
350
|
stopPolicy: RetryPolicySchema.optional(),
|
|
341
351
|
memoryPolicy: RoomPolicySchema.optional(),
|
|
352
|
+
// Carried like the four above, so the chat's control and the board's menu show this conversation's own answer to a
|
|
353
|
+
// memory kill rather than the sandbox's: without it the card could only ever say the sandbox-wide answer, and an
|
|
354
|
+
// answer given in one window read as unchanged in every other until the setting itself moved.
|
|
355
|
+
memoryKillPolicy: MemoryKillPolicySchema.optional().describe(
|
|
356
|
+
"This conversation's own answer to a turn the sandbox killed because it ran out of memory: `resume` sends it again by itself once memory has stayed free, `wait` holds it for a press. Absent means it follows the sandbox-wide setting.",
|
|
357
|
+
),
|
|
342
358
|
// A collaborator's ask to land (collaborators can't merge themselves); cleared by whichever merge or discard
|
|
343
359
|
// answers it.
|
|
344
360
|
landRequested: z
|
|
@@ -17,11 +17,23 @@ export const SandboxResourcesAskFieldsSchema = z.object({
|
|
|
17
17
|
// docker's answer: a directive the approved environment demands rides beside it (`overlayRuntime`), and a host
|
|
18
18
|
// without the NVIDIA runtime drops the GPU. `ic` stores it, validates it against the image's run contract when it is
|
|
19
19
|
// saved, and prints it in `ic sandbox list --json`; nobody else merges anything into it.
|
|
20
|
+
//
|
|
21
|
+
// `swapGib` (2026-11-05) is the one field that may be absent: ABSENT is an ic or a machine agent from before it, which
|
|
22
|
+
// neither reports nor takes it (an older agent's reading strips it, and its strict order schema refuses it), so a caller
|
|
23
|
+
// sends it only to a machine whose report carried it. `null` is the default, a value is the owner's ask.
|
|
20
24
|
export const SandboxShapeSchema = z.object({
|
|
21
25
|
memoryGib: z.int().positive().nullable(),
|
|
22
26
|
cpus: z.int().positive().nullable(),
|
|
23
27
|
privileged: z.boolean(),
|
|
24
28
|
gpu: z.boolean(),
|
|
29
|
+
swapGib: z
|
|
30
|
+
.int()
|
|
31
|
+
.positive()
|
|
32
|
+
.nullable()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe(
|
|
35
|
+
"Whole GiB of swap the sandbox's work (its `workload` cgroup) may page into, the swap alone, not memory plus swap; null for the default, a quarter of the memory cap between 1 and 4 GiB (@intentic/sandbox-run defaultSandboxSwapGib). Changed alone and now, ic applies it to the running sandbox without a restart. Absent from an ic or agent older than it.",
|
|
36
|
+
),
|
|
25
37
|
});
|
|
26
38
|
export type SandboxShape = z.infer<typeof SandboxShapeSchema>;
|
|
27
39
|
// When a `set-shape` takes effect: `now` restarts the sandbox onto it; `nextRestart` saves it in ic's record and
|
|
@@ -46,6 +58,22 @@ export const SandboxResourcesSchema = z.object({
|
|
|
46
58
|
// READ-ONLY, from agents older than `set-shape`: their saved share, a delta against what runs. Nothing new writes
|
|
47
59
|
// it; kept one release so a newer page can still show what an older agent saved. Remove with `later`.
|
|
48
60
|
saved: SandboxResourcesAskFieldsSchema.optional(),
|
|
61
|
+
// (2026-11-05) The swap bound IN FORCE, read by ic inside the running container from the kernel's own files, never
|
|
62
|
+
// from docker: an engine without swap-limit support records MemorySwap -1 whatever it was asked, and drops the bound.
|
|
63
|
+
swapMaxBytes: z
|
|
64
|
+
.number()
|
|
65
|
+
.nullable()
|
|
66
|
+
.optional()
|
|
67
|
+
.describe(
|
|
68
|
+
"The container's own swap bound as /sys/fs/cgroup/memory.swap.max inside it holds it, in bytes; null when unbounded. Absent when it was not read: the sandbox is not running, did not answer in time, or ic is older than this field.",
|
|
69
|
+
),
|
|
70
|
+
workloadSwapMaxBytes: z
|
|
71
|
+
.number()
|
|
72
|
+
.nullable()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe(
|
|
75
|
+
"The swap bound of the sandbox's work (/sys/fs/cgroup/workload/memory.swap.max: everything but the daemon and netd), in bytes; null when unbounded. Absent when it was not read, or the image is older than the bound a sandbox holds its own work to.",
|
|
76
|
+
),
|
|
49
77
|
});
|
|
50
78
|
export type SandboxResources = z.infer<typeof SandboxResourcesSchema>;
|
|
51
79
|
|
package/src/schemas/devices.ts
CHANGED
|
@@ -136,7 +136,8 @@ export const DeviceSandboxFlowSchema = z.strictObject({
|
|
|
136
136
|
to: z.string().min(1).optional(),
|
|
137
137
|
// `set-shape` only, both required by it: the whole shape, and when it takes effect.
|
|
138
138
|
// Strict too, unlike the same shape read off a report (where a newer ic's extra field must not fail an older
|
|
139
|
-
// reader): an order carrying a field this agent does not know is refused rather than carried out without it.
|
|
139
|
+
// reader): an order carrying a field this agent does not know is refused rather than carried out without it. So the
|
|
140
|
+
// shape's `swapGib` (2026-11-05) is sent only to a machine whose report carried it, which an older agent's never does.
|
|
140
141
|
shape: z.strictObject(SandboxShapeSchema.shape).optional(),
|
|
141
142
|
when: SandboxShapeWhenSchema.optional(),
|
|
142
143
|
// `set-egress` only: the whole policy (required), the owner's passkey over a change that loosens it, and,
|
|
@@ -37,6 +37,14 @@ test("a field left out is left to ic, which keeps what it has for it", () => {
|
|
|
37
37
|
expect(icShapeArgs("work", { memoryGib: 12, gpu: undefined }, "now")).toEqual(["sandbox", "shape", "work", "--set", "memoryGib=12", "--when", "now"]);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
// The swap (2026-11-05) travels like the caps, null being the default; left out, it is left to ic, which is how a page
|
|
41
|
+
// talking to a machine whose report never carried it sends nothing an older agent would refuse.
|
|
42
|
+
test("the swap is one more `--set`, in the contract's own name, and only when it is named", () => {
|
|
43
|
+
expect(icShapeArgs("work", { swapGib: 4 }, "now")).toEqual(["sandbox", "shape", "work", "--set", "swapGib=4", "--when", "now"]);
|
|
44
|
+
expect(icShapeArgs("work", { memoryGib: 20, swapGib: null }, "nextRestart").slice(3, 7)).toEqual(["--set", "memoryGib=20", "--set", "swapGib=null"]);
|
|
45
|
+
expect(icShapeArgs("work", { memoryGib: 20, swapGib: undefined }, "now")).toEqual(["sandbox", "shape", "work", "--set", "memoryGib=20", "--when", "now"]);
|
|
46
|
+
});
|
|
47
|
+
|
|
40
48
|
test("forgetting and power name only the sandbox", () => {
|
|
41
49
|
expect(icForgetShapeArgs("work")).toEqual(["sandbox", "shape", "work", "--forget"]);
|
|
42
50
|
expect(icPowerArgs("restart", "work")).toEqual(["sandbox", "restart", "work"]);
|
|
@@ -47,6 +55,10 @@ test("a shape missing a field is not a shape", () => {
|
|
|
47
55
|
expect(SandboxShapeSchema.safeParse({ memoryGib: 20, cpus: null, privileged: false }).success).toBe(false);
|
|
48
56
|
expect(SandboxShapeSchema.safeParse({ memoryGib: 0, cpus: null, privileged: false, gpu: false }).success).toBe(false);
|
|
49
57
|
expect(SandboxShapeSchema.safeParse({ memoryGib: null, cpus: null, privileged: false, gpu: false }).success).toBe(true);
|
|
58
|
+
// The swap alone may be absent: an ic or agent older than it reports a whole shape without it.
|
|
59
|
+
expect(SandboxShapeSchema.safeParse({ memoryGib: null, cpus: null, privileged: false, gpu: false, swapGib: null }).success).toBe(true);
|
|
60
|
+
expect(SandboxShapeSchema.safeParse({ memoryGib: null, cpus: null, privileged: false, gpu: false, swapGib: 0 }).success).toBe(false);
|
|
61
|
+
expect(SandboxShapeSchema.safeParse({ memoryGib: null, cpus: null, privileged: false, gpu: false, swapGib: 1.5 }).success).toBe(false);
|
|
50
62
|
});
|
|
51
63
|
|
|
52
64
|
// Every device input is strict, the shape nested in one included: an agent that dropped a field it did not know would
|
|
@@ -57,8 +69,11 @@ test("a device order refuses a shape or delta field it does not know", () => {
|
|
|
57
69
|
const accepted = (fields: object): boolean =>
|
|
58
70
|
DeviceSandboxFlowSchema.safeParse(JSON.parse(`{"op":"set-shape","slug":"work","when":"now","shape":${JSON.stringify(fields)}}`)).success;
|
|
59
71
|
expect(accepted(whole)).toBe(true);
|
|
60
|
-
|
|
72
|
+
// The swap is the contract's own now; a field it does not know is still refused.
|
|
73
|
+
expect(accepted({ ...whole, swapGib: 4 })).toBe(true);
|
|
74
|
+
expect(accepted({ ...whole, diskGib: 40 })).toBe(false);
|
|
75
|
+
// The old `reshape` op's delta stays as it was released: nothing new sends it, so it never learned the swap.
|
|
61
76
|
expect(DeviceSandboxFlowSchema.safeParse({ op: "reshape", slug: "work", resources: { memoryGib: 20, swapGib: 4 } }).success).toBe(false);
|
|
62
77
|
// A report is read leniently: a newer ic's extra field must not fail an older reader.
|
|
63
|
-
expect(SandboxShapeSchema.safeParse({ ...whole,
|
|
78
|
+
expect(SandboxShapeSchema.safeParse({ ...whole, diskGib: 40 }).success).toBe(true);
|
|
64
79
|
});
|
package/src/schemas/metrics.ts
CHANGED
|
@@ -89,7 +89,7 @@ export const SandboxUsageSchema = z.object({
|
|
|
89
89
|
memoryLimitBytes: z
|
|
90
90
|
.number()
|
|
91
91
|
.describe(
|
|
92
|
-
"The memory limit work is admitted against: where the kernel starts throttling the container (memory.high), else its hard limit, else the machine's memory.",
|
|
92
|
+
"The memory limit work is admitted against: where the kernel starts throttling the container (memory.high), else its hard limit, else the machine's memory; never above the workload cgroup leaf's own limit plus what runs outside that leaf, since admitted work runs in it.",
|
|
93
93
|
),
|
|
94
94
|
memoryBreakdown: z
|
|
95
95
|
.object({
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// LEAKS AND HARDENING: personal data that reached an untrusted provider as it was, and the work of making the shield
|
|
2
|
+
// catch values like it. A leak is reported by a person ("this should have been masked") or suspected by a scan run on
|
|
3
|
+
// this machine over recent conversations; a confirmed leak's exact value is taught to the vault at once, so it is masked
|
|
4
|
+
// from then on, whoever asks. What a leak teaches beyond itself (a pattern for the form its kind takes here, a list of
|
|
5
|
+
// the surnames this sandbox's data holds) is the hardening session's: an agent reads each leak as its outline, measures a
|
|
6
|
+
// candidate rule against the leaks and against recent text on this machine, and proposes it; the owner applies it.
|
|
7
|
+
//
|
|
8
|
+
// An agent on a provider nobody trusted never reads a leak's value or the text around it: the text around a value can
|
|
9
|
+
// hold other values nobody reported, and the value itself is exactly what the shield did not recognise, so it would
|
|
10
|
+
// leave a second time. It reads the outline, the field label before it and what the name lists say of each word, and
|
|
11
|
+
// names a word it wants on a list by the leak it comes from (PrivacyLeakWordSchema), which the daemon resolves when the
|
|
12
|
+
// owner applies the proposal.
|
|
13
|
+
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import {
|
|
16
|
+
PersonalDataClassSchema,
|
|
17
|
+
PrivacyNameListKindSchema,
|
|
18
|
+
PrivacyNameMatchingSchema,
|
|
19
|
+
PRIVACY_PATTERN_MAX,
|
|
20
|
+
PRIVACY_RULE_TERMS_MAX,
|
|
21
|
+
PRIVACY_TERM_MAX,
|
|
22
|
+
PRIVACY_TITLE_MAX,
|
|
23
|
+
PRIVACY_WORD_MAX,
|
|
24
|
+
PrivacyRuleMatchSchema,
|
|
25
|
+
} from "./privacy.js";
|
|
26
|
+
|
|
27
|
+
export const PRIVACY_LEAKS_MAX = 500;
|
|
28
|
+
// How much text on each side of a leak is kept with it, for the owner and a trusted session to read it where it stood.
|
|
29
|
+
export const PRIVACY_LEAK_CONTEXT_REACH = 200;
|
|
30
|
+
export const PRIVACY_LEAK_VALUE_MAX = 500;
|
|
31
|
+
export const PRIVACY_PROPOSALS_MAX = 20;
|
|
32
|
+
// The most recent conversations a scan reads, and the default.
|
|
33
|
+
export const PRIVACY_SCAN_CONVERSATIONS_MAX = 100;
|
|
34
|
+
export const PRIVACY_SCAN_CONVERSATIONS_DEFAULT = 20;
|
|
35
|
+
|
|
36
|
+
// A leak's id as the daemon mints it: `L` and a number, never reused.
|
|
37
|
+
export const PRIVACY_LEAK_ID = /^L[1-9]\d{0,6}$/u;
|
|
38
|
+
export const PRIVACY_PROPOSAL_ID = /^P[1-9]\d{0,6}$/u;
|
|
39
|
+
|
|
40
|
+
// reported: a person (or an agent) said it should have been masked. scan: the local scan found it unmasked where the
|
|
41
|
+
// name model reads a name, or under a field whose label says what it holds.
|
|
42
|
+
export const PrivacyLeakOriginSchema = z.enum(["reported", "scan"]);
|
|
43
|
+
export type PrivacyLeakOrigin = z.infer<typeof PrivacyLeakOriginSchema>;
|
|
44
|
+
|
|
45
|
+
// suspected: a scan's find nobody has judged yet; nothing is taught. confirmed: personal data, taught to the vault.
|
|
46
|
+
// dismissed: not personal data; kept so the next scan does not suggest it again.
|
|
47
|
+
export const PrivacyLeakStateSchema = z.enum(["suspected", "confirmed", "dismissed"]);
|
|
48
|
+
export type PrivacyLeakState = z.infer<typeof PrivacyLeakStateSchema>;
|
|
49
|
+
|
|
50
|
+
// One leak as the daemon keeps it, off the workspace beside the vault: the value as it was written, and the text around it.
|
|
51
|
+
export const PrivacyLeakSchema = z.object({
|
|
52
|
+
id: z.string().regex(PRIVACY_LEAK_ID),
|
|
53
|
+
at: z.string().describe("When it was reported or found, as an ISO timestamp."),
|
|
54
|
+
class: PersonalDataClassSchema,
|
|
55
|
+
value: z.string().min(2).max(PRIVACY_LEAK_VALUE_MAX),
|
|
56
|
+
context: z
|
|
57
|
+
.string()
|
|
58
|
+
.max(PRIVACY_LEAK_CONTEXT_REACH * 2 + PRIVACY_LEAK_VALUE_MAX)
|
|
59
|
+
.default("")
|
|
60
|
+
.describe("The text around the value as it was written, the value in it; empty when it was reported alone."),
|
|
61
|
+
conversationId: z.string().max(200).optional(),
|
|
62
|
+
origin: PrivacyLeakOriginSchema,
|
|
63
|
+
state: PrivacyLeakStateSchema,
|
|
64
|
+
why: z.string().max(200).optional().describe("Why a scan suspects it: the field label it stood under, or the name model."),
|
|
65
|
+
});
|
|
66
|
+
export type PrivacyLeak = z.infer<typeof PrivacyLeakSchema>;
|
|
67
|
+
|
|
68
|
+
// What the name lists say of one word of a leak, for a session that may not read the word.
|
|
69
|
+
export const PrivacyLeakWordFactsSchema = z.object({
|
|
70
|
+
outline: z.string().describe("The word with each capital as A, small letter as a, digit as 9; anything else as it is."),
|
|
71
|
+
firstName: z.boolean(),
|
|
72
|
+
surname: z.boolean(),
|
|
73
|
+
surnameForm: z.boolean().describe("Shaped like a Polish surname (-ski, -cki, -wicz…)."),
|
|
74
|
+
ambiguous: z.boolean().describe("Also an ordinary word in some language."),
|
|
75
|
+
never: z.boolean(),
|
|
76
|
+
});
|
|
77
|
+
export type PrivacyLeakWordFacts = z.infer<typeof PrivacyLeakWordFactsSchema>;
|
|
78
|
+
|
|
79
|
+
// What finds a leak now, without the vault's exact copy of it: the question hardening answers.
|
|
80
|
+
export const PrivacyLeakCaughtSchema = z.enum(["rule", "detector", "model", "no"]);
|
|
81
|
+
export type PrivacyLeakCaught = z.infer<typeof PrivacyLeakCaughtSchema>;
|
|
82
|
+
|
|
83
|
+
// A leak as a reader is shown it: always its outline, the label before it and what the lists say of its words; its value
|
|
84
|
+
// and the text around it only for someone who may read them (`revealed` on the view).
|
|
85
|
+
export const PrivacyLeakViewSchema = z.object({
|
|
86
|
+
id: z.string(),
|
|
87
|
+
at: z.string(),
|
|
88
|
+
class: PersonalDataClassSchema,
|
|
89
|
+
origin: PrivacyLeakOriginSchema,
|
|
90
|
+
state: PrivacyLeakStateSchema,
|
|
91
|
+
why: z.string().optional(),
|
|
92
|
+
conversationId: z.string().optional(),
|
|
93
|
+
outline: z.string().describe("The value with each capital as A, small letter as a, digit as 9; separators as they are."),
|
|
94
|
+
length: z.number().int(),
|
|
95
|
+
label: z
|
|
96
|
+
.string()
|
|
97
|
+
.optional()
|
|
98
|
+
.describe("Up to four words just before the value on its line or in the cell before it (a field's label: `Nr paszportu`), each word that could be a name or holds a digit written as its outline."),
|
|
99
|
+
words: z.array(PrivacyLeakWordFactsSchema).describe("Each word of the value, in order: what a list proposal names by its position."),
|
|
100
|
+
caught: PrivacyLeakCaughtSchema.describe("What finds it now with the policy as saved, its exact copy in the vault set aside."),
|
|
101
|
+
value: z.string().optional().describe("Only for someone who may read it."),
|
|
102
|
+
context: z.string().optional().describe("Only for someone who may read it."),
|
|
103
|
+
});
|
|
104
|
+
export type PrivacyLeakView = z.infer<typeof PrivacyLeakViewSchema>;
|
|
105
|
+
|
|
106
|
+
// One word of a leak's value, by its position (0 is the first): how a session that never read the value puts it on a list.
|
|
107
|
+
export const PrivacyLeakWordSchema = z.object({
|
|
108
|
+
leak: z.string().regex(PRIVACY_LEAK_ID),
|
|
109
|
+
word: z.number().int().min(0).max(20),
|
|
110
|
+
});
|
|
111
|
+
export type PrivacyLeakWord = z.infer<typeof PrivacyLeakWordSchema>;
|
|
112
|
+
|
|
113
|
+
// A rule a session proposes: the owner's rule without its id and switch, which applying mints and turns on.
|
|
114
|
+
export const PrivacyProposedRuleSchema = z.object({
|
|
115
|
+
title: z.string().min(1).max(PRIVACY_TITLE_MAX),
|
|
116
|
+
class: PersonalDataClassSchema,
|
|
117
|
+
match: PrivacyRuleMatchSchema,
|
|
118
|
+
terms: z.array(z.string().min(1).max(PRIVACY_TERM_MAX)).max(PRIVACY_RULE_TERMS_MAX).default([]),
|
|
119
|
+
pattern: z.string().max(PRIVACY_PATTERN_MAX).default(""),
|
|
120
|
+
matchCase: z.boolean().default(false),
|
|
121
|
+
});
|
|
122
|
+
export type PrivacyProposedRule = z.infer<typeof PrivacyProposedRuleSchema>;
|
|
123
|
+
|
|
124
|
+
// Words for a name list a session proposes: written out, or named by the leak they come from. Applied onto the owner's
|
|
125
|
+
// own list of the same title and kind when there is one, else as a new list.
|
|
126
|
+
export const PrivacyProposedListSchema = z.object({
|
|
127
|
+
title: z.string().min(1).max(PRIVACY_TITLE_MAX),
|
|
128
|
+
kind: PrivacyNameListKindSchema,
|
|
129
|
+
matching: PrivacyNameMatchingSchema.default("inflected"),
|
|
130
|
+
words: z.array(z.string().min(1).max(PRIVACY_WORD_MAX)).max(500).default([]),
|
|
131
|
+
fromLeaks: z.array(PrivacyLeakWordSchema).max(500).default([]),
|
|
132
|
+
});
|
|
133
|
+
export type PrivacyProposedList = z.infer<typeof PrivacyProposedListSchema>;
|
|
134
|
+
|
|
135
|
+
// What a session measures and proposes: rules and name-list words added to the policy as saved.
|
|
136
|
+
export const PrivacyHardeningSchema = z.object({
|
|
137
|
+
rules: z.array(PrivacyProposedRuleSchema).max(20).default([]),
|
|
138
|
+
lists: z.array(PrivacyProposedListSchema).max(10).default([]),
|
|
139
|
+
});
|
|
140
|
+
export type PrivacyHardening = z.infer<typeof PrivacyHardeningSchema>;
|
|
141
|
+
|
|
142
|
+
// One value the additions would mask in recent text that nothing masks today: a false positive to look at, or one more leak.
|
|
143
|
+
export const PrivacyHardeningSampleSchema = z.object({
|
|
144
|
+
class: PersonalDataClassSchema,
|
|
145
|
+
outline: z.string(),
|
|
146
|
+
label: z.string().optional(),
|
|
147
|
+
value: z.string().optional().describe("Only for someone who may read it."),
|
|
148
|
+
});
|
|
149
|
+
export type PrivacyHardeningSample = z.infer<typeof PrivacyHardeningSampleSchema>;
|
|
150
|
+
|
|
151
|
+
// What the additions do, measured on this machine: against the confirmed leaks, and against recent conversations.
|
|
152
|
+
export const PrivacyHardeningMeasureSchema = z.object({
|
|
153
|
+
leaks: z.object({
|
|
154
|
+
total: z.number().int().describe("Confirmed leaks measured against."),
|
|
155
|
+
before: z.number().int().describe("Caught by the policy as saved, without the vault's exact copies."),
|
|
156
|
+
after: z.number().int().describe("Caught with the additions."),
|
|
157
|
+
missed: z.array(z.string()).describe("Ids of the confirmed leaks still not caught."),
|
|
158
|
+
}),
|
|
159
|
+
control: z.object({
|
|
160
|
+
conversations: z.number().int(),
|
|
161
|
+
chars: z.number().int(),
|
|
162
|
+
added: z.number().int().describe("Values the additions would mask there that nothing masks today, the leaks themselves left out."),
|
|
163
|
+
samples: z.array(PrivacyHardeningSampleSchema).max(12),
|
|
164
|
+
}),
|
|
165
|
+
problems: z.array(z.string()).describe("Rules that cannot be saved as written, each with why."),
|
|
166
|
+
});
|
|
167
|
+
export type PrivacyHardeningMeasure = z.infer<typeof PrivacyHardeningMeasureSchema>;
|
|
168
|
+
|
|
169
|
+
// A session's proposal, waiting for the owner: what to add, why, and what it measured when proposed.
|
|
170
|
+
export const PrivacyProposalSchema = z.object({
|
|
171
|
+
id: z.string().regex(PRIVACY_PROPOSAL_ID),
|
|
172
|
+
at: z.string(),
|
|
173
|
+
conversationId: z.string().max(200).optional(),
|
|
174
|
+
title: z.string().min(1).max(PRIVACY_TITLE_MAX),
|
|
175
|
+
why: z.string().max(2000).default(""),
|
|
176
|
+
hardening: PrivacyHardeningSchema,
|
|
177
|
+
measured: PrivacyHardeningMeasureSchema,
|
|
178
|
+
});
|
|
179
|
+
export type PrivacyProposal = z.infer<typeof PrivacyProposalSchema>;
|
|
180
|
+
|
|
181
|
+
// The leaks, the proposals and the session working on them, as one reader is shown them.
|
|
182
|
+
export const PrivacyLeaksSchema = z.object({
|
|
183
|
+
leaks: z.array(PrivacyLeakViewSchema),
|
|
184
|
+
proposals: z.array(PrivacyProposalSchema),
|
|
185
|
+
// The proposals' leak words as the reader may read them, by `L3:1`; empty for one who may not.
|
|
186
|
+
words: z.record(z.string(), z.string()),
|
|
187
|
+
revealed: z.boolean().describe("Whether this reader is shown values: a person who runs the shield, or a session on a trusted or local provider."),
|
|
188
|
+
session: z
|
|
189
|
+
.object({ conversationId: z.string(), at: z.string() })
|
|
190
|
+
.optional()
|
|
191
|
+
.describe("The hardening session last started from the page."),
|
|
192
|
+
});
|
|
193
|
+
export type PrivacyLeaks = z.infer<typeof PrivacyLeaksSchema>;
|
|
194
|
+
|
|
195
|
+
export const PrivacyLeakReportSchema = z.object({
|
|
196
|
+
value: z.string().trim().min(2).max(PRIVACY_LEAK_VALUE_MAX),
|
|
197
|
+
class: PersonalDataClassSchema,
|
|
198
|
+
context: z.string().max(20_000).optional().describe("The text it stood in; the daemon keeps the stretch around the value."),
|
|
199
|
+
conversationId: z.string().max(200).optional(),
|
|
200
|
+
});
|
|
201
|
+
export type PrivacyLeakReport = z.infer<typeof PrivacyLeakReportSchema>;
|
|
202
|
+
|
|
203
|
+
// The vault source a confirmed leak's exact value is taught under: one per leak, so dismissing one forgets that value
|
|
204
|
+
// alone. The privacy page lists these with the leaks, not with the datasets.
|
|
205
|
+
export const PRIVACY_LEAK_SOURCE_PREFIX = "leak:";
|
|
206
|
+
export const leakSource = (id: string): string => `${PRIVACY_LEAK_SOURCE_PREFIX}${id}`;
|
|
207
|
+
|
|
208
|
+
// How a leak's words are named in `PrivacyLeaks.words`.
|
|
209
|
+
export const leakWordKey = (word: { readonly leak: string; readonly word: number }): string => `${word.leak}:${String(word.word)}`;
|
|
210
|
+
|
|
211
|
+
// A value's words, as a list proposal counts them.
|
|
212
|
+
export const leakWordsOf = (value: string): string[] => value.split(/[\s,;|]+/u).filter((word) => word !== "");
|
|
@@ -283,3 +283,18 @@ describe(`default job setups`, () => {
|
|
|
283
283
|
expect(SandboxSettingsWriteSchema.parse({ ...saved, commandJudge: `watch` }).roleSetups).toEqual({});
|
|
284
284
|
});
|
|
285
285
|
});
|
|
286
|
+
|
|
287
|
+
// A memory kill's answer is on to begin with where the restart switch is off: the sandbox knows the cause, and lets its
|
|
288
|
+
// victims back one at a time once memory settles (turn-break.ts). Only the two answers it takes are written.
|
|
289
|
+
describe(`the answer to a memory kill`, () => {
|
|
290
|
+
test(`resumes by default, while resuming after any restart stays off`, () => {
|
|
291
|
+
const defaults = SandboxSettingsSchema.parse({});
|
|
292
|
+
expect(defaults.memoryKillPolicy).toBe(`resume`);
|
|
293
|
+
expect(defaults.autoResumeOnRestart).toBe(false);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test(`takes wait or resume and nothing else`, () => {
|
|
297
|
+
expect(SandboxSettingsSchema.parse({ memoryKillPolicy: `wait` }).memoryKillPolicy).toBe(`wait`);
|
|
298
|
+
expect(SandboxSettingsSchema.safeParse({ memoryKillPolicy: `retry` }).success).toBe(false);
|
|
299
|
+
});
|
|
300
|
+
});
|
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/state/auth-state.ts
CHANGED
|
@@ -42,6 +42,9 @@ export const AUTH_STATE_FILES: readonly StateFile[] = [
|
|
|
42
42
|
// The personal data the shield masked, by token, and the pictures it painted over.
|
|
43
43
|
{ path: "privacy-vault.json", portability: "secret" },
|
|
44
44
|
{ path: "privacy-images/", portability: "secret" },
|
|
45
|
+
// Values the shield let through, with the text around them, and the hardening proposals waiting on them
|
|
46
|
+
// (privacy/leaks/leak-store.ts): personal data, so it goes where the vault goes.
|
|
47
|
+
{ path: "privacy-leaks.json", portability: "secret" },
|
|
45
48
|
{ path: "ssh-keys/", portability: "secret" },
|
|
46
49
|
// An update's pre-images of the files above; a vault's copy is a vault.
|
|
47
50
|
{ path: "converting/", portability: "secret" },
|
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
|
|