@intentic/sandbox-contract 1.399.0 → 1.400.1

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.
Files changed (125) hide show
  1. package/dist/contracts/agent.contract.d.ts +9 -0
  2. package/dist/contracts/agent.contract.d.ts.map +1 -1
  3. package/dist/contracts/agents.contract.d.ts +1045 -96
  4. package/dist/contracts/agents.contract.d.ts.map +1 -1
  5. package/dist/contracts/agents.contract.js +12 -2
  6. package/dist/contracts/agents.contract.js.map +1 -1
  7. package/dist/contracts/automations.contract.d.ts +2 -0
  8. package/dist/contracts/automations.contract.d.ts.map +1 -1
  9. package/dist/contracts/endpoints.contract.d.ts +29 -0
  10. package/dist/contracts/endpoints.contract.d.ts.map +1 -1
  11. package/dist/contracts/endpoints.contract.js +22 -0
  12. package/dist/contracts/endpoints.contract.js.map +1 -1
  13. package/dist/contracts/needs.contract.d.ts +9 -0
  14. package/dist/contracts/needs.contract.d.ts.map +1 -1
  15. package/dist/contracts/privacy.contract.d.ts +17 -0
  16. package/dist/contracts/privacy.contract.d.ts.map +1 -1
  17. package/dist/contracts/privacy.contract.js +10 -1
  18. package/dist/contracts/privacy.contract.js.map +1 -1
  19. package/dist/contracts/runner.contract.d.ts +252 -246
  20. package/dist/contracts/runner.contract.d.ts.map +1 -1
  21. package/dist/contracts/seal.contract.d.ts +100 -0
  22. package/dist/contracts/seal.contract.d.ts.map +1 -1
  23. package/dist/contracts/sessions.contract.d.ts +1 -0
  24. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  25. package/dist/contracts/settings.contract.d.ts +0 -108
  26. package/dist/contracts/settings.contract.d.ts.map +1 -1
  27. package/dist/contracts/settings.contract.js +1 -10
  28. package/dist/contracts/settings.contract.js.map +1 -1
  29. package/dist/contracts/system.contract.d.ts +108 -18
  30. package/dist/contracts/system.contract.d.ts.map +1 -1
  31. package/dist/events/agent-events.d.ts +4 -0
  32. package/dist/events/agent-events.d.ts.map +1 -1
  33. package/dist/events/agent-transcript.d.ts +1 -0
  34. package/dist/events/agent-transcript.d.ts.map +1 -1
  35. package/dist/events/system-events.d.ts +84 -0
  36. package/dist/events/system-events.d.ts.map +1 -1
  37. package/dist/events/system-events.js +10 -2
  38. package/dist/events/system-events.js.map +1 -1
  39. package/dist/events/transcript.d.ts +5 -0
  40. package/dist/events/transcript.d.ts.map +1 -1
  41. package/dist/index.d.ts +3 -2
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +7 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/protocol/routes.d.ts +7 -4
  46. package/dist/protocol/routes.d.ts.map +1 -1
  47. package/dist/protocol/routes.js +80 -23
  48. package/dist/protocol/routes.js.map +1 -1
  49. package/dist/schemas/agent-people.d.ts +65 -0
  50. package/dist/schemas/agent-people.d.ts.map +1 -1
  51. package/dist/schemas/agent-people.js +45 -0
  52. package/dist/schemas/agent-people.js.map +1 -1
  53. package/dist/schemas/agents-list.d.ts +40 -0
  54. package/dist/schemas/agents-list.d.ts.map +1 -1
  55. package/dist/schemas/agents.d.ts +61 -1
  56. package/dist/schemas/agents.d.ts.map +1 -1
  57. package/dist/schemas/agents.js +10 -2
  58. package/dist/schemas/agents.js.map +1 -1
  59. package/dist/schemas/automations.d.ts +3 -0
  60. package/dist/schemas/automations.d.ts.map +1 -1
  61. package/dist/schemas/automations.js +4 -0
  62. package/dist/schemas/automations.js.map +1 -1
  63. package/dist/schemas/composer-drafts.d.ts +2 -0
  64. package/dist/schemas/composer-drafts.d.ts.map +1 -1
  65. package/dist/schemas/composer-drafts.js +3 -0
  66. package/dist/schemas/composer-drafts.js.map +1 -1
  67. package/dist/schemas/needs.d.ts +8 -0
  68. package/dist/schemas/needs.d.ts.map +1 -1
  69. package/dist/schemas/privacy.d.ts +17 -0
  70. package/dist/schemas/privacy.d.ts.map +1 -1
  71. package/dist/schemas/privacy.js +7 -1
  72. package/dist/schemas/privacy.js.map +1 -1
  73. package/dist/schemas/providers/usage.d.ts +0 -3
  74. package/dist/schemas/providers/usage.d.ts.map +1 -1
  75. package/dist/schemas/providers/usage.js +0 -3
  76. package/dist/schemas/providers/usage.js.map +1 -1
  77. package/dist/schemas/settings-history.d.ts +1 -1
  78. package/dist/schemas/settings-history.d.ts.map +1 -1
  79. package/dist/schemas/settings-history.js +1 -0
  80. package/dist/schemas/settings-history.js.map +1 -1
  81. package/dist/schemas/settings-savings.d.ts +0 -103
  82. package/dist/schemas/settings-savings.d.ts.map +1 -1
  83. package/dist/schemas/settings-savings.js +0 -12
  84. package/dist/schemas/settings-savings.js.map +1 -1
  85. package/dist/schemas/settings.d.ts +0 -6
  86. package/dist/schemas/settings.d.ts.map +1 -1
  87. package/dist/schemas/settings.js +0 -17
  88. package/dist/schemas/settings.js.map +1 -1
  89. package/dist/schemas/system-prompt.d.ts +0 -4
  90. package/dist/schemas/system-prompt.d.ts.map +1 -1
  91. package/dist/schemas/system-prompt.js +1 -1
  92. package/dist/schemas/system-prompt.js.map +1 -1
  93. package/dist/state/definition.d.ts +0 -12
  94. package/dist/state/definition.d.ts.map +1 -1
  95. package/dist/state/runtime-state.d.ts +3 -0
  96. package/dist/state/runtime-state.d.ts.map +1 -1
  97. package/dist/state/runtime-state.js +1 -0
  98. package/dist/state/runtime-state.js.map +1 -1
  99. package/dist/state/workspace-state.d.ts +0 -6
  100. package/dist/state/workspace-state.d.ts.map +1 -1
  101. package/dist/state/workspace-state.js +0 -7
  102. package/dist/state/workspace-state.js.map +1 -1
  103. package/package.json +5 -5
  104. package/src/contracts/agents.contract.ts +14 -2
  105. package/src/contracts/endpoints.contract.ts +36 -0
  106. package/src/contracts/privacy.contract.ts +12 -0
  107. package/src/contracts/settings.contract.ts +0 -12
  108. package/src/events/system-events.ts +17 -2
  109. package/src/index.ts +15 -2
  110. package/src/protocol/routes.test.ts +38 -2
  111. package/src/protocol/routes.ts +121 -28
  112. package/src/schemas/agent-people.ts +95 -0
  113. package/src/schemas/agents.ts +34 -2
  114. package/src/schemas/automations.ts +7 -0
  115. package/src/schemas/composer-drafts.ts +10 -0
  116. package/src/schemas/privacy.ts +12 -1
  117. package/src/schemas/providers/usage.ts +0 -6
  118. package/src/schemas/settings-history.ts +3 -0
  119. package/src/schemas/settings-savings.ts +1 -26
  120. package/src/schemas/settings.test.ts +7 -0
  121. package/src/schemas/settings.ts +0 -28
  122. package/src/schemas/system-prompt.ts +1 -1
  123. package/src/state/runtime-state.ts +5 -2
  124. package/src/state/workspace-state.test.ts +1 -6
  125. package/src/state/workspace-state.ts +0 -11
@@ -38,6 +38,10 @@ export const ComposerDraftSchema = z.object({
38
38
  });
39
39
  export type ComposerDraft = z.infer<typeof ComposerDraftSchema>;
40
40
 
41
+ // A count of one person's drafts and marks moving, kept by the daemon for its run: what a write answers with, what a
42
+ // list was read at, and what a `drafts` push names (system-events.ts `draftsGeneration`).
43
+ const DraftsGenerationSchema = z.number().int().nonnegative();
44
+
41
45
  export const ComposerDraftsSchema = z.object({
42
46
  drafts: z.array(ComposerDraftSchema).describe("Every draft you hold in this sandbox, newest first. Only your own: another member's unsent words are theirs."),
43
47
  revision: z
@@ -48,6 +52,9 @@ export const ComposerDraftsSchema = z.object({
48
52
  .describe(
49
53
  "The newest revision handed out when this list was read. A draft you hold at a revision past it was written after the read, so its absence here says nothing about it.",
50
54
  ),
55
+ generation: DraftsGenerationSchema.optional().describe(
56
+ "How many times your drafts and marks had moved in this sandbox's run when this list was read: everything up to it is in the list. Absent from a sandbox that does not count.",
57
+ ),
51
58
  reactions: z
52
59
  .record(z.string(), z.array(AgentReactionSchema))
53
60
  .optional()
@@ -78,6 +85,9 @@ export const DraftWrittenSchema = z.object({
78
85
  .literal(true)
79
86
  .optional()
80
87
  .describe("Nothing was written: the draft had moved past `base`. Merge your words into this one and write again from its revision."),
88
+ generation: DraftsGenerationSchema.optional().describe(
89
+ "The count of your drafts' moves this write or clear made (the list's `generation` after it). Absent when it moved nothing.",
90
+ ),
81
91
  });
82
92
  export type DraftWritten = z.infer<typeof DraftWrittenSchema>;
83
93
 
@@ -358,7 +358,7 @@ export const PrivacyLedgerEntrySchema = z.object({
358
358
  action: PrivacyLedgerActionSchema,
359
359
  counts: z.partialRecord(PersonalDataClassSchema, z.number().int()).describe("How many of each kind were found in what this request added."),
360
360
  images: z.number().int().describe("Images the shield changed: personal data painted over, or held back when they could not be read."),
361
- documents: z.number().int().describe("Documents replaced by their masked text."),
361
+ documents: z.number().int().describe("Documents read here: a PDF sent as its pages painted over, another as its masked text, or either withheld."),
362
362
  protocol: z.string().describe("Which wire format the request spoke."),
363
363
  detail: z.string().optional().describe("Why it was refused, when it was."),
364
364
  replacements: z
@@ -476,3 +476,14 @@ export type PrivacyPreviewSpan = z.infer<typeof PrivacyPreviewSpanSchema>;
476
476
 
477
477
  export const PrivacyPreviewSchema = z.object({ spans: z.array(PrivacyPreviewSpanSchema) });
478
478
  export type PrivacyPreview = z.infer<typeof PrivacyPreviewSchema>;
479
+
480
+ // The words in a conversation's replies its model never read: values it wrote as tokens, put back on this machine before
481
+ // anyone saw the reply. Each as the reply spells it, with the token the model wrote in its place, so a reader can tell
482
+ // the model's words from the shield's.
483
+ export const PRIVACY_SHIELDED_MAX = 500;
484
+ export const PrivacyShieldedValueSchema = z.object({
485
+ text: z.string().describe("The value as it stands in the reply."),
486
+ token: z.string().describe("What the model read and wrote instead."),
487
+ class: PersonalDataClassSchema,
488
+ });
489
+ export type PrivacyShieldedValue = z.infer<typeof PrivacyShieldedValueSchema>;
@@ -93,12 +93,6 @@ export const UsageTurnSchema = z.object({
93
93
  // 10-12, when the arm was the compact map and the holdout the full one; "map-vs-none" for 2026-10-12 to 10-13, the map
94
94
  // against none; "map-vs-none-2" since, the same with readings off the main agent's calls and spawned children out.
95
95
  mapCohort: z.string().optional(),
96
- // Arm of the field-notes experiment, stable per conversation; notesChars is what the budget let through.
97
- notesArm: z.boolean().optional(),
98
- notesChars: z.number().optional(),
99
- // Hash of the brief that was sent, recorded on control turns too. Load-bearing rather than decorative: the file is
100
- // rewritten monthly, so a 30-day window holds two different treatments and pooling them would measure neither.
101
- notesCohort: z.string().optional(),
102
96
  // Arm of the tool-search experiment, stable per conversation: true loads connected tools' schemas on demand, false
103
97
  // sends them all with every request. Absent where the turn was not a native Claude one on the Claude Code loop.
104
98
  toolSearchArm: z.boolean().optional(),
@@ -174,4 +174,7 @@ export const SETTINGS_HISTORY = [
174
174
  // every point and where the settings page had saved the old default, which no reading could tell apart: the key is
175
175
  // retired, a positive choice carries over, and a stored zero takes the new default.
176
176
  at("retention", restorePointsKept),
177
+ // The field notes (2026-11-06): a ranked brief on this place's traps sent with every turn moved neither failed calls
178
+ // nor calls before the edited file against a held-out half, across two revisions of it, while every call carried it.
179
+ ...dropAll(["fieldNotes", "fieldNotesBudget", "fieldNotesHoldout"]),
177
180
  ] as const;
@@ -35,7 +35,7 @@ export const SavingsArmSchema = z.object({ turns: z.number(), mean: z.number() }
35
35
  // openingSearches: same, narrowed to before the turn first touched a file.
36
36
  // openedWithListing: whether a turn listed directories to orient itself, as a share of turns (the project map).
37
37
  // callsBeforeTarget: how far a turn walked before touching a file it went on to edit.
38
- // failedCalls: tool calls that ended in error (the field notes, whose largest section is a failure taxonomy).
38
+ // failedCalls: tool calls that ended in error (the price tool search, the stable prompt and cold trim could charge).
39
39
  // openingPrompt: tokens a turn's first request sent (cache reads plus cache writes), which is what every later call of
40
40
  // the turn reads again (tool search, which moves the tool schemas out of it).
41
41
  // openingWrite: tokens a follow-up turn's first request wrote to the cache instead of reading them (the stable prompt).
@@ -88,36 +88,11 @@ export const TurnExperimentSchema = z.object({
88
88
  uptake: z.object({ on: z.number(), off: z.number(), turns: z.number() }).optional(),
89
89
  });
90
90
  export type TurnExperiment = z.infer<typeof TurnExperimentSchema>;
91
- // What the settings row can say about the brief without opening it: whether there is one, how much of it this budget
92
- // reaches, and whether anything is scheduled to rewrite it. Read off the file and the automation store, never stored.
93
- export const FieldNotesStatusSchema = z.object({
94
- // False means the automation has never run (or was never set up) — the ordinary state before the first month.
95
- present: z.boolean(),
96
- // Epoch ms the file was last written. Absent when there is no file.
97
- writtenAt: z.number().optional(),
98
- // How many ranked sections the current budget reaches, out of how many the file holds. The pair is the point: "5"
99
- // alone cannot tell a generous budget from a short file.
100
- ranksSent: z.number().optional(),
101
- ranksTotal: z.number().optional(),
102
- // What the brief costs the prompt, in characters, at the current budget.
103
- chars: z.number().optional(),
104
- // The monthly rewrite: absent until the owner creates it from the offered template, since an automation names the
105
- // models it spends and nothing chooses those for them.
106
- automation: z.enum(["missing", "enabled", "disabled"]),
107
- // When it next runs, epoch ms; absent when there is nothing scheduled.
108
- nextRunAt: z.number().optional(),
109
- // Said out loud rather than shown as "no file": a brief that exists and cannot be read is a broken automation.
110
- unreadable: z.string().optional(),
111
- // Blocks of the file its priority table does not rank, so no limit ever sends them. Absent when there are none.
112
- unlisted: z.array(z.string()).optional(),
113
- });
114
- export type FieldNotesStatus = z.infer<typeof FieldNotesStatusSchema>;
115
91
  export const SavingsReportSchema = z.object({
116
92
  input: InputSavingsSchema,
117
93
  search: TurnExperimentSchema.optional(),
118
94
  // Same absence rule as `search`: not measured, never zero.
119
95
  map: TurnExperimentSchema.optional(),
120
- notes: TurnExperimentSchema.optional(),
121
96
  toolSearch: TurnExperimentSchema.optional(),
122
97
  stablePrompt: TurnExperimentSchema.optional(),
123
98
  coldTrim: TurnExperimentSchema.optional(),
@@ -128,6 +128,13 @@ test(`a stored tool-result clearing switch is dropped, and the rest of the file
128
128
  expect(SandboxSettingsSchema.parse(converted.value).iqSearch).toBe(true);
129
129
  });
130
130
 
131
+ // The field notes were removed (2026-11-06); a file that still switches them on reads, without them.
132
+ test(`stored field-notes settings are dropped, and the rest of the file kept`, () => {
133
+ const converted = convertDocument(SETTINGS_HISTORY, `object`, { iqSearch: true, fieldNotes: true, fieldNotesBudget: 4000, fieldNotesHoldout: 0.5 }, true);
134
+ expect(converted.value).toEqual({ iqSearch: true });
135
+ expect(SandboxSettingsSchema.parse(converted.value).iqSearch).toBe(true);
136
+ });
137
+
131
138
  // What a job runs on, read the way every reader reads it, over a sandbox with nothing connected: the setups a stored
132
139
  // file converts into are judged by what they make each job run on, not by their shape.
133
140
  const runsOn = (stored: unknown, role: ModelRole): readonly unknown[] => {
@@ -366,34 +366,6 @@ export const SandboxSettingsSchema = z.object({
366
366
  .describe(
367
367
  "What share of conversations to open without the map, so the two can be compared. Whole conversations rather than individual turns, because the map is sent once and stays in the conversation's history afterwards.",
368
368
  ),
369
- // The one composed piece that is WRITTEN rather than derived: a monthly automation rewrites it off the session
370
- // corpus, so it carries what no scan of the tree can (which commands really work here, what the box can take, how
371
- // the owner asks for things) and the map keeps carrying what a scan can.
372
- fieldNotes: z
373
- .boolean()
374
- .default(false)
375
- .describe(
376
- "Open every turn with a brief on how work actually goes in this sandbox: the traps that cost past sessions calls, the commands that really verify, what the machine can take. Written once a month by an automation that reads back the sessions run here, rather than worked out per turn, because it is drawn from history rather than from the tree. Off by default, since it rides every turn of every conversation.",
377
- ),
378
- // Characters, not sections: the file's own ranking decides WHICH sections, this decides HOW MANY fit. Same unit as
379
- // the project map's ceiling so the two costs read on one scale.
380
- fieldNotesBudget: z
381
- .number()
382
- .int()
383
- .min(500)
384
- .max(20000)
385
- .default(4000)
386
- .describe(
387
- "How much of that brief to send. Its sections are ranked, most costly-to-not-know first, and they are taken whole in that order until this runs out — so raising it buys more of the tail, never a fuller version of the same thing.",
388
- ),
389
- fieldNotesHoldout: z
390
- .number()
391
- .min(0)
392
- .max(1)
393
- .default(0)
394
- .describe(
395
- "What share of conversations to run without the brief, so the two can be compared. Whole conversations rather than individual turns, because the brief sits in the prompt for the whole session and withholding it from one turn would not take it back.",
396
- ),
397
369
  outputCleaners: z
398
370
  .string()
399
371
  .default("")
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import { SystemPromptModeSchema } from "./settings.js";
4
4
 
5
5
  // Every section names its mechanism: the reader asks "did my AGENTS.md arrive", not "what does paragraph nine say".
6
- export const PromptSectionSourceSchema = z.enum(["guidance", "persona", "field-notes", "memory"]);
6
+ export const PromptSectionSourceSchema = z.enum(["guidance", "persona", "memory"]);
7
7
  export type PromptSectionSource = z.infer<typeof PromptSectionSourceSchema>;
8
8
 
9
9
  export const PromptSectionSchema = z.object({
@@ -40,9 +40,12 @@ const RUNTIME_DOMAINS = [
40
40
  // Machines on the other end of a socket (devices, browsers, phones, runners); "online" is the socket itself, never
41
41
  // sampled. hosts/webext/phones land on capabilities since a pairing card's state is literally the hub's online answer,
42
42
  // and each on the roster its dialogs and rows read (`hosts`, `webext`, `phones`; the editor's PAIRED_* families).
43
- // `hosts` also carries a device reading that landed too late for the reader waiting on it (hosts/device-reports.ts),
44
- // and a desktop-sync enrollment made or revoked, which is what moves `sync-health` (GET /system/sync).
43
+ // `hosts` also carries a desktop-sync enrollment made or revoked, which is what moves `sync-health` (GET /system/sync).
45
44
  { domain: "hosts", invalidates: [["capabilities"], ["devices"], ["hosts"], ["sync-health"]] },
45
+ // A machine's reading landing with news: its first, a change in whether it answers or in the containers it holds, or
46
+ // one replacing a copy old enough to read as quiet (hosts/device-reports.ts). Only the Devices read moves with it: it
47
+ // rode `hosts` until 2026-11-06, which re-read the capability list, the rosters and the sync state in every window too.
48
+ { domain: "devices", invalidates: [["devices"]] },
46
49
  { domain: "webext", invalidates: [["capabilities"], ["webext"]] },
47
50
  { domain: "phones", invalidates: [["capabilities"], ["phones"]] },
48
51
  { domain: "runners", invalidates: [["runners"]] },
@@ -169,9 +169,7 @@ describe(`WORKSPACE_STATE_FILES`, () => {
169
169
  for (const file of WORKSPACE_STATE_FILES.filter((entry) => entry.invalidates.length > 0)) {
170
170
  const isFamilyPrefix = file.path.endsWith(`.`);
171
171
  // .md is the safety policy: the one state file a model reads as prose rather than a parser reading JSON.
172
- // .toon is the field-notes brief, read by rank into every turn.
173
- const isFile =
174
- file.path.endsWith(`.json`) || file.path.endsWith(`.Dockerfile`) || file.path.endsWith(`.md`) || file.path.endsWith(`.toon`);
172
+ const isFile = file.path.endsWith(`.json`) || file.path.endsWith(`.Dockerfile`) || file.path.endsWith(`.md`);
175
173
  expect(isFile || isFamilyPrefix || file.path.endsWith(`/`), file.path).toBe(true);
176
174
  }
177
175
  });
@@ -393,9 +391,6 @@ describe(`VERSIONED_STATE_PATHS`, () => {
393
391
  `${STATE_DIR}/config/extension-settings.json`,
394
392
  // Per-extension update posture (notify/agent/auto): a standing decision on what may run unattended.
395
393
  `${STATE_DIR}/config/extension-update-policy.json`,
396
- // The field-notes brief every turn opens with. Tracked so the automation that rewrites it, which always
397
- // runs isolated, can land its rewrite at all; and a new revision is worth a reviewable diff.
398
- `${STATE_DIR}/config/field-notes.toon`,
399
394
  // Which commands count as heavy, and how many may run at once; a shared-box decision worth a `git log`
400
395
  // line.
401
396
  `${STATE_DIR}/config/heavy-commands.json`,
@@ -135,17 +135,6 @@ const STATE_FILES = [
135
135
  // Bash command. `carry`: a property of the workspace, not the machine. `versioned`: raising the limit is a decision
136
136
  // worth a diff.
137
137
  { path: ".intentic/config/heavy-commands.json", invalidates: ["settings"], portability: "carry", versioned: true },
138
- // The field-notes brief composed into every turn (agent-context field-notes.ts), rewritten by the monthly
139
- // `field-notes` automation. `versioned` is load-bearing, not just reviewability: automation wakes always run
140
- // isolated, and an unversioned path is excluded from the root repo, so the rewrite would never leave its worktree.
141
- // Feeds the agent-settings row (`settings.fieldNotes`).
142
- {
143
- path: ".intentic/config/field-notes.toon",
144
- invalidates: ["settings"],
145
- portability: "carry",
146
- versioned: true,
147
- outsideWriter: "the field-notes automation's agent turn (the daemon only reads it, through FIELD_NOTES_FILE)",
148
- },
149
138
  // Last-fired stamps for the rule table. `derived`: records what happened on this machine, not carried.
150
139
  {
151
140
  path: ".intentic/local/rule-firings.json",