@intentic/sandbox-contract 1.421.0 → 1.423.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.
Files changed (251) hide show
  1. package/dist/chores/chores.d.ts.map +1 -1
  2. package/dist/chores/chores.js +1 -48
  3. package/dist/chores/chores.js.map +1 -1
  4. package/dist/chores/index.d.ts +1 -1
  5. package/dist/chores/index.d.ts.map +1 -1
  6. package/dist/chores/index.js +1 -1
  7. package/dist/chores/index.js.map +1 -1
  8. package/dist/chores/prompt.d.ts +0 -1
  9. package/dist/chores/prompt.d.ts.map +1 -1
  10. package/dist/chores/prompt.js +0 -2
  11. package/dist/chores/prompt.js.map +1 -1
  12. package/dist/contracts/capabilities.contract.d.ts +0 -28
  13. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  14. package/dist/contracts/ci.contract.d.ts +30 -0
  15. package/dist/contracts/ci.contract.d.ts.map +1 -1
  16. package/dist/contracts/ci.contract.js +10 -1
  17. package/dist/contracts/ci.contract.js.map +1 -1
  18. package/dist/contracts/device.contract.d.ts +46 -0
  19. package/dist/contracts/device.contract.d.ts.map +1 -1
  20. package/dist/contracts/device.contract.js +2 -0
  21. package/dist/contracts/device.contract.js.map +1 -1
  22. package/dist/contracts/issues.contract.d.ts +6 -0
  23. package/dist/contracts/issues.contract.d.ts.map +1 -1
  24. package/dist/contracts/offload.contract.d.ts +51 -0
  25. package/dist/contracts/offload.contract.d.ts.map +1 -1
  26. package/dist/contracts/offload.contract.js +3 -3
  27. package/dist/contracts/offload.contract.js.map +1 -1
  28. package/dist/contracts/panels.contract.d.ts +0 -7
  29. package/dist/contracts/panels.contract.d.ts.map +1 -1
  30. package/dist/contracts/runner.contract.d.ts +48 -0
  31. package/dist/contracts/runner.contract.d.ts.map +1 -1
  32. package/dist/contracts/secrets.contract.d.ts +2 -17
  33. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  34. package/dist/contracts/secrets.contract.js +2 -2
  35. package/dist/contracts/secrets.contract.js.map +1 -1
  36. package/dist/contracts/settings.contract.d.ts +0 -135
  37. package/dist/contracts/settings.contract.d.ts.map +1 -1
  38. package/dist/contracts/system.contract.d.ts +18 -18
  39. package/dist/contracts/workspace.contract.d.ts +0 -60
  40. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  41. package/dist/contracts/workspace.contract.js +1 -11
  42. package/dist/contracts/workspace.contract.js.map +1 -1
  43. package/dist/events/requests.js +1 -1
  44. package/dist/events/requests.js.map +1 -1
  45. package/dist/ids/project-id.d.ts +3 -0
  46. package/dist/ids/project-id.d.ts.map +1 -0
  47. package/dist/ids/project-id.js +25 -0
  48. package/dist/ids/project-id.js.map +1 -0
  49. package/dist/ids/tunnel-ids.d.ts +0 -1
  50. package/dist/ids/tunnel-ids.d.ts.map +1 -1
  51. package/dist/ids/tunnel-ids.js +0 -1
  52. package/dist/ids/tunnel-ids.js.map +1 -1
  53. package/dist/index.d.ts +0 -4
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +0 -4
  56. package/dist/index.js.map +1 -1
  57. package/dist/models/account-moves.js +4 -4
  58. package/dist/models/account-moves.js.map +1 -1
  59. package/dist/models/model-roles.d.ts +1 -1
  60. package/dist/models/model-roles.d.ts.map +1 -1
  61. package/dist/models/model-roles.js +1 -1
  62. package/dist/models/model-roles.js.map +1 -1
  63. package/dist/models/plan-pools.d.ts +3 -1
  64. package/dist/models/plan-pools.d.ts.map +1 -1
  65. package/dist/models/plan-pools.js +26 -3
  66. package/dist/models/plan-pools.js.map +1 -1
  67. package/dist/protocol/doors/runner-protocol.d.ts +42 -0
  68. package/dist/protocol/doors/runner-protocol.d.ts.map +1 -1
  69. package/dist/protocol/doors/runner-protocol.js +23 -0
  70. package/dist/protocol/doors/runner-protocol.js.map +1 -1
  71. package/dist/protocol/doors/sandbox-pass.d.ts +22 -0
  72. package/dist/protocol/doors/sandbox-pass.d.ts.map +1 -0
  73. package/dist/protocol/doors/sandbox-pass.js +72 -0
  74. package/dist/protocol/doors/sandbox-pass.js.map +1 -0
  75. package/dist/protocol/raw/raw-json-routes.d.ts +96 -9
  76. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  77. package/dist/protocol/raw/raw-json-routes.js +6 -2
  78. package/dist/protocol/raw/raw-json-routes.js.map +1 -1
  79. package/dist/protocol/raw/raw-routes.d.ts +24 -7
  80. package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
  81. package/dist/protocol/raw/raw-routes.js +6 -2
  82. package/dist/protocol/raw/raw-routes.js.map +1 -1
  83. package/dist/schemas/capabilities.d.ts +0 -14
  84. package/dist/schemas/capabilities.d.ts.map +1 -1
  85. package/dist/schemas/capabilities.js +0 -4
  86. package/dist/schemas/capabilities.js.map +1 -1
  87. package/dist/schemas/certificate-request.d.ts +0 -2
  88. package/dist/schemas/certificate-request.d.ts.map +1 -1
  89. package/dist/schemas/ci.d.ts +69 -0
  90. package/dist/schemas/ci.d.ts.map +1 -1
  91. package/dist/schemas/ci.js +30 -0
  92. package/dist/schemas/ci.js.map +1 -1
  93. package/dist/schemas/device-files.d.ts +71 -0
  94. package/dist/schemas/device-files.d.ts.map +1 -0
  95. package/dist/schemas/device-files.js +53 -0
  96. package/dist/schemas/device-files.js.map +1 -0
  97. package/dist/schemas/devices.d.ts.map +1 -1
  98. package/dist/schemas/devices.js.map +1 -1
  99. package/dist/schemas/hosts.d.ts +3 -0
  100. package/dist/schemas/hosts.d.ts.map +1 -1
  101. package/dist/schemas/hosts.js +3 -0
  102. package/dist/schemas/hosts.js.map +1 -1
  103. package/dist/schemas/issues.d.ts +133 -0
  104. package/dist/schemas/issues.d.ts.map +1 -1
  105. package/dist/schemas/issues.js +34 -0
  106. package/dist/schemas/issues.js.map +1 -1
  107. package/dist/schemas/maintenance.d.ts.map +1 -1
  108. package/dist/schemas/maintenance.js +16 -10
  109. package/dist/schemas/maintenance.js.map +1 -1
  110. package/dist/schemas/metrics.d.ts.map +1 -1
  111. package/dist/schemas/metrics.js.map +1 -1
  112. package/dist/schemas/offload.d.ts +40 -0
  113. package/dist/schemas/offload.d.ts.map +1 -1
  114. package/dist/schemas/offload.js +21 -0
  115. package/dist/schemas/offload.js.map +1 -1
  116. package/dist/schemas/panels.d.ts +0 -14
  117. package/dist/schemas/panels.d.ts.map +1 -1
  118. package/dist/schemas/panels.js +0 -6
  119. package/dist/schemas/panels.js.map +1 -1
  120. package/dist/schemas/personas.d.ts.map +1 -1
  121. package/dist/schemas/personas.js +0 -6
  122. package/dist/schemas/personas.js.map +1 -1
  123. package/dist/schemas/providers/plan-limits.d.ts +1 -0
  124. package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
  125. package/dist/schemas/providers/plan-limits.js +5 -1
  126. package/dist/schemas/providers/plan-limits.js.map +1 -1
  127. package/dist/schemas/providers/usage.d.ts +0 -12
  128. package/dist/schemas/providers/usage.d.ts.map +1 -1
  129. package/dist/schemas/providers/usage.js +0 -5
  130. package/dist/schemas/providers/usage.js.map +1 -1
  131. package/dist/schemas/secrets.d.ts +1 -22
  132. package/dist/schemas/secrets.d.ts.map +1 -1
  133. package/dist/schemas/secrets.js +3 -13
  134. package/dist/schemas/secrets.js.map +1 -1
  135. package/dist/schemas/settings-experiments.d.ts +0 -4
  136. package/dist/schemas/settings-experiments.d.ts.map +1 -1
  137. package/dist/schemas/settings-experiments.js +0 -12
  138. package/dist/schemas/settings-experiments.js.map +1 -1
  139. package/dist/schemas/settings-history.d.ts +1 -1
  140. package/dist/schemas/settings-history.d.ts.map +1 -1
  141. package/dist/schemas/settings-history.js +1 -0
  142. package/dist/schemas/settings-history.js.map +1 -1
  143. package/dist/schemas/settings-savings.d.ts +0 -144
  144. package/dist/schemas/settings-savings.d.ts.map +1 -1
  145. package/dist/schemas/settings-savings.js +1 -3
  146. package/dist/schemas/settings-savings.js.map +1 -1
  147. package/dist/schemas/settings.d.ts +0 -4
  148. package/dist/schemas/settings.d.ts.map +1 -1
  149. package/dist/schemas/settings.js +3 -4
  150. package/dist/schemas/settings.js.map +1 -1
  151. package/dist/schemas/short-codes.d.ts +0 -10
  152. package/dist/schemas/short-codes.d.ts.map +1 -1
  153. package/dist/schemas/short-codes.js +1 -9
  154. package/dist/schemas/short-codes.js.map +1 -1
  155. package/dist/schemas/workspace/workspace-search.d.ts +0 -12
  156. package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
  157. package/dist/schemas/workspace/workspace-search.js +5 -12
  158. package/dist/schemas/workspace/workspace-search.js.map +1 -1
  159. package/dist/state/definition.d.ts +0 -24
  160. package/dist/state/definition.d.ts.map +1 -1
  161. package/dist/state/update-probation.d.ts +1 -1
  162. package/dist/state/update-probation.d.ts.map +1 -1
  163. package/dist/state/update-probation.js +1 -1
  164. package/dist/state/update-probation.js.map +1 -1
  165. package/dist/state/workspace-state.d.ts +6 -1
  166. package/dist/state/workspace-state.d.ts.map +1 -1
  167. package/dist/state/workspace-state.js +7 -1
  168. package/dist/state/workspace-state.js.map +1 -1
  169. package/package.json +27 -5
  170. package/src/chores/chores.test.ts +1 -2
  171. package/src/chores/chores.ts +2 -62
  172. package/src/chores/index.ts +1 -1
  173. package/src/chores/prompt.ts +1 -6
  174. package/src/chores/verdict.test.ts +3 -44
  175. package/src/contracts/ci.contract.ts +13 -0
  176. package/src/contracts/device.contract.ts +5 -0
  177. package/src/contracts/offload.contract.ts +3 -2
  178. package/src/contracts/secrets.contract.ts +4 -5
  179. package/src/contracts/workspace.contract.ts +2 -14
  180. package/src/events/requests.ts +1 -1
  181. package/src/events/system-events.ts +2 -2
  182. package/src/ids/project-id.test.ts +26 -0
  183. package/src/ids/project-id.ts +34 -0
  184. package/src/ids/tunnel-ids.test.ts +2 -23
  185. package/src/ids/tunnel-ids.ts +0 -4
  186. package/src/index.ts +0 -6
  187. package/src/models/account-moves.ts +6 -6
  188. package/src/models/model-roles.ts +3 -1
  189. package/src/models/plan-pools.test.ts +57 -20
  190. package/src/models/plan-pools.ts +48 -8
  191. package/src/policy/persona-capability.ts +1 -1
  192. package/src/protocol/doors/runner-protocol.ts +42 -2
  193. package/src/protocol/doors/sandbox-pass.test.ts +51 -0
  194. package/src/protocol/doors/sandbox-pass.ts +119 -0
  195. package/src/protocol/headers.ts +2 -2
  196. package/src/protocol/member-reach.test.ts +0 -1
  197. package/src/protocol/raw/raw-json-routes.ts +14 -2
  198. package/src/protocol/raw/raw-routes.ts +14 -5
  199. package/src/protocol/routes.test.ts +0 -4
  200. package/src/schemas/automations.ts +3 -3
  201. package/src/schemas/capabilities.ts +0 -6
  202. package/src/schemas/ci.ts +42 -0
  203. package/src/schemas/device-files.ts +90 -0
  204. package/src/schemas/devices.ts +5 -4
  205. package/src/schemas/hosts.ts +15 -3
  206. package/src/schemas/issues.ts +54 -0
  207. package/src/schemas/maintenance.ts +20 -12
  208. package/src/schemas/metrics.ts +2 -0
  209. package/src/schemas/offload.ts +39 -2
  210. package/src/schemas/panels.ts +0 -8
  211. package/src/schemas/personas.ts +2 -6
  212. package/src/schemas/providers/plan-limits.ts +7 -1
  213. package/src/schemas/providers/usage.ts +5 -14
  214. package/src/schemas/secrets.ts +8 -20
  215. package/src/schemas/settings-experiments.ts +0 -17
  216. package/src/schemas/settings-history.ts +3 -0
  217. package/src/schemas/settings-savings.ts +2 -9
  218. package/src/schemas/settings.test.ts +16 -9
  219. package/src/schemas/settings.ts +5 -5
  220. package/src/schemas/short-codes.ts +2 -14
  221. package/src/schemas/version-seam.test.ts +2 -2
  222. package/src/schemas/workspace/workspace-search.ts +12 -25
  223. package/src/state/update-probation.ts +4 -3
  224. package/src/state/workspace-state.test.ts +2 -2
  225. package/src/state/workspace-state.ts +10 -1
  226. package/src/text/path-refs.test.ts +1 -1
  227. package/dist/contracts/intentic.contract.d.ts +0 -30
  228. package/dist/contracts/intentic.contract.d.ts.map +0 -1
  229. package/dist/contracts/intentic.contract.js +0 -34
  230. package/dist/contracts/intentic.contract.js.map +0 -1
  231. package/dist/contracts/inventory.contract.d.ts +0 -138
  232. package/dist/contracts/inventory.contract.d.ts.map +0 -1
  233. package/dist/contracts/inventory.contract.js +0 -31
  234. package/dist/contracts/inventory.contract.js.map +0 -1
  235. package/dist/schemas/codebase-health.d.ts +0 -56
  236. package/dist/schemas/codebase-health.d.ts.map +0 -1
  237. package/dist/schemas/codebase-health.js +0 -43
  238. package/dist/schemas/codebase-health.js.map +0 -1
  239. package/dist/schemas/intentic.d.ts +0 -5
  240. package/dist/schemas/intentic.d.ts.map +0 -1
  241. package/dist/schemas/intentic.js +0 -3
  242. package/dist/schemas/intentic.js.map +0 -1
  243. package/dist/schemas/inventory.d.ts +0 -175
  244. package/dist/schemas/inventory.d.ts.map +0 -1
  245. package/dist/schemas/inventory.js +0 -62
  246. package/dist/schemas/inventory.js.map +0 -1
  247. package/src/contracts/intentic.contract.ts +0 -45
  248. package/src/contracts/inventory.contract.ts +0 -35
  249. package/src/schemas/codebase-health.ts +0 -60
  250. package/src/schemas/intentic.ts +0 -2
  251. package/src/schemas/inventory.ts +0 -83
@@ -346,8 +346,6 @@ describe(`the real sandbox contract`, () => {
346
346
  `exit.rotate`,
347
347
  `exit.start`,
348
348
  `exit.use`,
349
- `intentic.applyEvents`,
350
- `intentic.run`,
351
349
  `netdisk.mount`,
352
350
  `system.events`,
353
351
  `system.manageDeviceSandbox`,
@@ -362,8 +360,6 @@ describe(`the real sandbox contract`, () => {
362
360
  `exit.rotate`,
363
361
  `exit.start`,
364
362
  `exit.use`,
365
- `intentic.applyEvents`,
366
- `intentic.run`,
367
363
  `netdisk.mount`,
368
364
  `system.events`,
369
365
  `system.manageDeviceSandbox`,
@@ -397,9 +397,9 @@ export const AutomationSchema = z.object({
397
397
  "Which models this automation may run on, best first. Required when it starts a new agent, and nothing is chosen for you: work that fires while nobody is watching spends a real allowance, so it names the models it spends rather than inheriting one. Tried in order, so a spent account does not silently stop the job. Not needed to continue a conversation, which runs on its own model, or to only notify.",
398
398
  ),
399
399
  // Absent means the daemon's pick: the account its conversation runs on for a continuing thread (moved off one that
400
- // can no longer serve), else the one that can serve with the most room. Named, it is a pin, run whatever its state,
401
- // so a refused account says so rather than being swapped; pinning matters more here than for a chat, since nobody
402
- // is watching to notice a stuck one.
400
+ // can no longer serve), else the sandbox's pick among those that can serve (the first to renew unless nearly out).
401
+ // Named, it is a pin, run whatever its state, so a refused account says so rather than being swapped; pinning
402
+ // matters more here than for a chat, since nobody is watching to notice a stuck one.
403
403
  account: z.string().optional().describe("Which account pays for it."),
404
404
  // Absent means the wake reaches no logged-in account at all, the strictest default here, since nobody is at the
405
405
  // composer when it fires. Posture only: what the wake may reach is `runAs`'s (docs/architecture/access.md).
@@ -13,8 +13,6 @@ import { PhoneConfigSchema } from "./phone.js";
13
13
  // truth for what's active, and `mcp`-kind entries also feed the agent's MCP servers each turn.
14
14
 
15
15
  export const CapabilityKindSchema = z.enum([
16
- "devops",
17
- "monorepo",
18
16
  "mcp",
19
17
  "cli",
20
18
  "plugin",
@@ -365,10 +363,6 @@ export type DeviceConfig = z.infer<typeof DeviceConfigSchema>;
365
363
  export type AcpAgentConfig = z.infer<typeof AcpAgentConfigSchema>;
366
364
  export type EndpointConfig = z.infer<typeof EndpointConfigSchema>;
367
365
  export const CapabilitySchema = z.discriminatedUnion("kind", [
368
- z.object({ id: entryId, kind: z.literal("devops"), config: z.object({}) }),
369
- // A pnpm+turbo monorepo the user scaffolds as its own repo, named by `id`; apps are added afterwards from its
370
- // operator panel.
371
- z.object({ id: entryId, kind: z.literal("monorepo"), config: z.object({}) }),
372
366
  z.object({ id: entryId, kind: z.literal("mcp"), config: McpConfigSchema }),
373
367
  z.object({ id: entryId, kind: z.literal("cli"), config: CliConfigSchema }),
374
368
  z.object({ id: entryId, kind: z.literal("plugin"), config: PluginConfigSchema }),
package/src/schemas/ci.ts CHANGED
@@ -265,6 +265,48 @@ export const CiRunsResponseSchema = z.object({
265
265
  ),
266
266
  });
267
267
  export type CiRunsResponse = z.infer<typeof CiRunsResponseSchema>;
268
+ // 2026-11-17, the shinobi-society audit: conversation after conversation spent calls finding out whether a test that
269
+ // failed for it was its own or already failing on main (stashing its work, re-running main, comparing), while the daemon
270
+ // had already read every failed main-line job's log. `GET /ci/main` (`agents ci`) answers from what it heard, asking no
271
+ // forge: each job failing on a main line, the run and commit it last failed in, when that was read, and what its log
272
+ // named. A main line nothing is known of says so, so silence never reads as a passing main.
273
+ export const CiMainJobSchema = z.object({
274
+ workflow: z.string().describe("The workflow it is a job of, by the forge's name. `ci` on a forge that runs one pipeline per commit."),
275
+ job: z.string().describe("The job, by name."),
276
+ runId: z.number().optional().describe("The run it last failed in. Absent for a failure heard before the daemon kept it."),
277
+ sha: z.string().optional().describe("That run's commit, where the forge said."),
278
+ readAt: z.number().optional().describe("When the daemon read that failure, in milliseconds."),
279
+ errors: z
280
+ .array(z.string())
281
+ .optional()
282
+ .describe(
283
+ "What its failed steps printed, one line each and bounded: failing tests by name (`(fail) …`, `test … FAILED`), type and lint errors, failed checks, and how a task ended (a signal's exit code, a heap run out). Empty when its log named nothing of the kind; absent when the log was not read.",
284
+ ),
285
+ timedOut: z.boolean().optional().describe("Whether it failed by running out of time. Absent when it did not."),
286
+ });
287
+ export type CiMainJob = z.infer<typeof CiMainJobSchema>;
288
+ export const CiMainBranchSchema = z.object({
289
+ repo: z.string().describe("Which workspace repository."),
290
+ branch: z.string().optional().describe("Its main line. Absent when neither the forge nor the clone named a default branch and no run of one was heard."),
291
+ state: z
292
+ .enum(["failing", "clear", "unread"])
293
+ .describe(
294
+ "`failing`: the jobs below fail on it now. `clear`: a finished run of it was heard and no job of main's own code is known to fail. `unread`: no finished run of it has been heard, so nothing is known.",
295
+ ),
296
+ since: z.number().optional().describe("When its first job failed, on a failing one, in milliseconds."),
297
+ jobs: z.array(CiMainJobSchema).describe("The jobs failing on it now, in the order they began failing. Empty unless it is failing."),
298
+ lastRun: z
299
+ .object({ status: z.enum(["success", "failed"]), at: z.number() })
300
+ .optional()
301
+ .describe("The newest finished run of it the daemon heard, any workflow: how it ended and when it was heard. Absent when none was."),
302
+ fixer: z.string().optional().describe("The fix agent on its failure, when one is."),
303
+ });
304
+ export type CiMainBranch = z.infer<typeof CiMainBranchSchema>;
305
+ export const CiMainResponseSchema = z.object({
306
+ text: z.string().describe("The whole answer in words, as `agents ci` prints it."),
307
+ branches: z.array(CiMainBranchSchema).describe("Each repository wired to CI, and any main line still failing in one no longer wired."),
308
+ });
309
+ export type CiMainResponse = z.infer<typeof CiMainResponseSchema>;
268
310
  // Re-resolves repo → project + token on every call, so a stale card can't act on a mapping the workspace no longer has.
269
311
  export const CiRunParamSchema = z.object({
270
312
  repo: z
@@ -0,0 +1,90 @@
1
+ import { z } from "zod";
2
+ import { ARTIFACT_CHUNK_BYTES } from "./device-artifacts.js";
3
+
4
+ // A FILE OR A FOLDER COPIED BETWEEN THIS SANDBOX AND A CONNECTED COMPUTER (`devices copy`), either way, to a path the
5
+ // agent names. 2026-11-17, the shinobi-society audit: to move a 12 MB tarball or a built binary, agents ran `docker exec …
6
+ // && docker cp …` on rog through run_command, which works only where the sandbox's own container is on that very machine,
7
+ // needs its container name, and passes every guard by. read_file and write_file carry text alone, through the model.
8
+ // The CLI reads and writes the bytes in the agent's own shell (its view of /work), the daemon relays them over the device
9
+ // link in chunks through `copyFile`, and the machine checks every chunk against the same rules as its file tools: the
10
+ // folders it may touch for both ways, and "Create and change files" (`write`) for a copy onto it.
11
+
12
+ // One chunk's decoded size: the artifact push's, which a tunnel already carries.
13
+ export const FILE_COPY_CHUNK_BYTES = ARTIFACT_CHUNK_BYTES;
14
+ // The most one copy carries, decoded: a thousand chunks, minutes on a good link. Anything bigger is a disk image or a
15
+ // backup, which a command on the computer moves better than a relay through the sandbox.
16
+ export const FILE_COPY_MAX_BYTES = 2 * 1024 * 1024 * 1024;
17
+ // How long packing or unpacking a folder may take on the computer; the daemon waits that plus the device's answer.
18
+ export const FILE_COPY_TAR_TIMEOUT_MS = 10 * 60_000;
19
+
20
+ const Sha256Schema = z.string().regex(/^[0-9a-f]{64}$/, "a lowercase hex sha256");
21
+ const CopyIdSchema = z.string().regex(/^[0-9a-f]{32}$/);
22
+ // A path on the computer as the agent wrote it; the machine resolves it, links and all, against its folders.
23
+ const DevicePathSchema = z.string().min(1).max(4096);
24
+ // The source's own name, which a copy into a folder that exists lands under: one path segment, never `.` or `..`.
25
+ export const CopyNameSchema = z
26
+ .string()
27
+ .min(1)
28
+ .max(255)
29
+ .refine((name) => !/[/\\\0]/.test(name) && name !== "." && name !== "..", "a plain file or folder name");
30
+ // `file` is one file; `tar` a folder, packed by whichever side holds it and unpacked by the other.
31
+ export const CopyKindSchema = z.enum(["file", "tar"]);
32
+ export type CopyKind = z.infer<typeof CopyKindSchema>;
33
+ const ChunkDataSchema = z.string().max(Math.ceil(FILE_COPY_CHUNK_BYTES / 3) * 4);
34
+
35
+ export const CopyFileSchema = z.discriminatedUnion("op", [
36
+ // Onto the computer: where it will land (`path`, or `path/name` when `path` is a folder that exists), refused when
37
+ // that is taken unless `overwrite`. `executable` carries the sandbox file's x bit to a POSIX computer. `probe` asks
38
+ // every question and opens nothing, so a refusal is read before the first byte is sent.
39
+ z
40
+ .object({
41
+ op: z.literal("put-open"),
42
+ copy: CopyIdSchema,
43
+ path: DevicePathSchema,
44
+ name: CopyNameSchema,
45
+ kind: CopyKindSchema,
46
+ size: z.int().nonnegative().max(FILE_COPY_MAX_BYTES),
47
+ overwrite: z.boolean(),
48
+ executable: z.boolean(),
49
+ probe: z.boolean().optional(),
50
+ })
51
+ .strict(),
52
+ // One piece, at its offset; pieces arrive in order and a gap is refused.
53
+ z.object({ op: z.literal("put-chunk"), copy: CopyIdSchema, offset: z.int().nonnegative(), data: ChunkDataSchema }).strict(),
54
+ // The last word: the machine checks size and hash, then puts it in place. A mismatch throws the copy away.
55
+ z.object({ op: z.literal("put-commit"), copy: CopyIdSchema, sha256: Sha256Schema }).strict(),
56
+ // Off the computer: a file as it is, a folder packed as one tar first.
57
+ z.object({ op: z.literal("get-open"), copy: CopyIdSchema, path: DevicePathSchema }).strict(),
58
+ // The piece at `offset`, in order.
59
+ z.object({ op: z.literal("get-chunk"), copy: CopyIdSchema, offset: z.int().nonnegative() }).strict(),
60
+ // A copy finished or given up on: a put's part file is deleted, a get's handle and packed tar let go.
61
+ z.object({ op: z.literal("close"), copy: CopyIdSchema }).strict(),
62
+ ]);
63
+ export type CopyFile = z.infer<typeof CopyFileSchema>;
64
+
65
+ export const CopyFileResultSchema = z.object({
66
+ // Where it is on the computer: where a put lands or landed, what a get reads.
67
+ path: z.string().optional(),
68
+ // A get-open's: what is coming, how big, under what name, and whether a POSIX computer has it executable.
69
+ kind: CopyKindSchema.optional(),
70
+ size: z.int().nonnegative().optional(),
71
+ name: z.string().optional(),
72
+ executable: z.boolean().optional(),
73
+ // How many bytes of a put the machine holds, answered to every put-chunk.
74
+ received: z.int().nonnegative().optional(),
75
+ // A get-chunk's bytes, base64.
76
+ data: ChunkDataSchema.optional(),
77
+ // On a get's last chunk: the hash of everything it served, which the daemon checks what it relayed against.
78
+ sha256: Sha256Schema.optional(),
79
+ });
80
+ export type CopyFileResult = z.infer<typeof CopyFileResultSchema>;
81
+
82
+ // What `POST /devices/{name}/files` answers the CLI; a GET answers the bytes, with these in `x-intentic-copy-*` headers.
83
+ export const CopiedFileSchema = z.object({
84
+ device: z.string(),
85
+ path: z.string(),
86
+ kind: CopyKindSchema,
87
+ size: z.int().nonnegative(),
88
+ sha256: Sha256Schema,
89
+ });
90
+ export type CopiedFile = z.infer<typeof CopiedFileSchema>;
@@ -209,10 +209,11 @@ export const DeviceFlowLineSchema = z.discriminatedUnion("kind", [
209
209
  export type DeviceFlowLine = z.infer<typeof DeviceFlowLineSchema>;
210
210
  // Every op stops the resident process mid-command; a stream ending with no terminal frame is normal, not a failure, and
211
211
  // confirmation is the version moving on the next poll. `restart` is just a bare `intentic-machine run`.
212
- // `forget-unreachable` drops the machine's links to sandboxes that have answered nothing for long enough to be gone
213
- // (peer-dial's LONG_OUTAGE_ATTEMPTS) — never the link carrying the request, which is by definition answering. Never
214
- // automatic either: a laptop closed for a fortnight must find its sandboxes again, so nothing expires on its own and
215
- // dropping one is always somebody's decision.
212
+ // `forget-unreachable` drops the machine's links to sandboxes the platform has said no longer exist (the edge's final
213
+ // `unknown-sandbox`, which the machine's link marks as `goneSince`) — never one that is merely down, since it is offered
214
+ // on every sandbox's page and a sibling restarting or asleep must keep this machine, and never the link carrying the
215
+ // request, which is by definition answering. Before 2026-11-17 it took any link that had failed twenty dials (about
216
+ // eight minutes), and one sandbox's button disconnected the machine from another.
216
217
  export const DeviceAgentOpSchema = z.enum(["upgrade", "restart", "forget-unreachable"]);
217
218
  export type DeviceAgentOp = z.infer<typeof DeviceAgentOpSchema>;
218
219
  export const DeviceAgentFlowSchema = z.strictObject({ op: DeviceAgentOpSchema });
@@ -76,9 +76,11 @@ export const DeviceFactsSchema = z.object({
76
76
  wsl: WslEnvironmentSchema.optional(),
77
77
  // Windows only: the distros `wsl -l -q` lists, the names `run_command`'s `in: "wsl:<name>"` accepts.
78
78
  wslDistros: z.array(z.string()).optional(),
79
- // What this machine's agent is holding links to, and how much of it is answering nothing. COUNTS AND AN AGE ONLY:
80
- // the rest are other sandboxes' addresses, and a sandbox has no business learning its siblings'. Absent from an
81
- // agent older than this field, which is why "none unreachable" is not the same value as "did not say".
79
+ // What this machine's agent is holding links to, and how many of them are to sandboxes the platform has said no
80
+ // longer exist (since 2026-11-17; before, any link that had failed twenty dials, a sandbox merely down included).
81
+ // COUNTS AND AN AGE ONLY: the rest are other sandboxes' addresses, and a sandbox has no business learning its
82
+ // siblings'. Absent from an agent older than this field, which is why "none unreachable" is not the same value as
83
+ // "did not say".
82
84
  links: z.object({ total: z.number(), unreachable: z.number(), unreachableSince: z.number().optional() }).optional(),
83
85
  // Which of the optional ops this agent AND the `ic` it drives implement (DeviceFeatureSchema), for a page to offer
84
86
  // only what works and for the daemon to refuse an op before sending it. Strings on the wire, so a newer agent's
@@ -192,6 +194,9 @@ export const DeviceFeatureSchema = z.enum([
192
194
  // (2026-11-11) The `move-prepare`, `move-out` and `move-in` ops: an agent that has them driving an ic that says
193
195
  // `sandbox-move` (`ic sandbox move-out` / `move-in`), so a sandbox can be carried to another of the owner's computers.
194
196
  "sandbox-move",
197
+ // (2026-11-17) `copyFile`: a file or a folder copied to or from a path the agent names (`devices copy`), held to the
198
+ // folders and the write switch the file tools are.
199
+ "file-copy",
195
200
  ]);
196
201
  export type DeviceFeature = z.infer<typeof DeviceFeatureSchema>;
197
202
  export const DEVICE_FEATURE_RESHAPE_LATER: DeviceFeature = "reshape-later";
@@ -207,6 +212,7 @@ export const DEVICE_FEATURE_EGRESS: DeviceFeature = "egress";
207
212
  export const DEVICE_FEATURE_REACHABLE_WAYS_BACK: DeviceFeature = "reachable-ways-back";
208
213
  export const DEVICE_FEATURE_REACH_NETWORK: DeviceFeature = "reach-network";
209
214
  export const DEVICE_FEATURE_SANDBOX_MOVE: DeviceFeature = "sandbox-move";
215
+ export const DEVICE_FEATURE_FILE_COPY: DeviceFeature = "file-copy";
210
216
  // What `ic features --json` answers (_sandbox/ic/src/features.rs, golden/ic-features.json): the optional ops that ic
211
217
  // implements, as strings, since a newer ic's word means nothing to an older agent.
212
218
  export const IcFeaturesAnswerSchema = z.object({ features: z.array(z.string()) });
@@ -245,6 +251,12 @@ export const windowsPathOf = (distro: string, linuxPath: string): string => `\\\
245
251
  // own — but the owner connected a computer, not a shell, so the grant, the row and the tools are the machine's.
246
252
  export const HOST_NATIVE_ENVIRONMENT = "native";
247
253
 
254
+ // What a device card's status says of a machine that is paired and holds no socket right now (the device handler's
255
+ // `awayHint`, beside a `pending` state). Shared so the editor can read it as offline, which waits on the machine, rather
256
+ // than as a setup to finish, which a fresh pairing would: a machine whose sandbox had restarted read "needs setup" with a
257
+ // Connect button beside it (2026-11-17).
258
+ export const DEVICE_AWAY_DETAIL = "the device is offline";
259
+
248
260
  // Which environment a machine is describing when it connects: the distro by the name WSL registered (what `wsl -l -q`
249
261
  // prints and `in: "wsl:<name>"` takes), or the metal. Facts arrive at connect and no scope withholds them, so this is
250
262
  // always answerable — unlike `environmentOf` (devices.ts), which weighs a report too and may hold no evidence at all.
@@ -83,6 +83,58 @@ export const IssueRunSchema = z.object({
83
83
  });
84
84
  export type IssueRun = z.infer<typeof IssueRunSchema>;
85
85
 
86
+ // Who reported it, when the reporter was another sandbox on the owner's account (account-level report routing). Read
87
+ // from the platform-signed pass, except `conversationId`, which the sending daemon names for its own conversation.
88
+ export const IssueSenderSchema = z.object({
89
+ sandboxId: z.string().max(40).describe("The reporting sandbox's id."),
90
+ sandboxName: z.string().max(120).describe("Its name on your account."),
91
+ project: z.string().max(200).describe("The project it reported about, as this sandbox claims it."),
92
+ conversationId: z.string().max(120).optional().describe("The conversation over there that reported it."),
93
+ });
94
+ export type IssueSender = z.infer<typeof IssueSenderSchema>;
95
+
96
+ // POSTed to /account/report by another of the owner's sandboxes, under a pass (sandbox-contract policy/sandbox-pass.ts).
97
+ // Only what groups: an agent's problem is a `detection` (or a `crash` with a stack), never an ungrouped `report`, so five
98
+ // sandboxes seeing one broken thing fold into one issue. `times` carries repeats the sender folded while it could not
99
+ // deliver.
100
+ export const AccountProblemSchema = IssueReportSchema.extend({ kind: z.enum(["crash", "detection"]) });
101
+ export type AccountProblem = z.infer<typeof AccountProblemSchema>;
102
+ export const AccountReportSchema = z.object({
103
+ report: AccountProblemSchema,
104
+ conversationId: z.string().max(120).optional(),
105
+ times: z.number().int().min(1).max(10_000).optional(),
106
+ });
107
+ export type AccountReport = z.infer<typeof AccountReportSchema>;
108
+
109
+ // The sending side, over loopback from the `projects report` command: a problem for whichever sandbox on the owner's
110
+ // account claims `project`, and what came of it (delivered now, waiting in the outbox, or refused for good).
111
+ export const AccountSendSchema = z.object({
112
+ project: z.string().min(1).max(300),
113
+ report: AccountProblemSchema,
114
+ });
115
+ export type AccountSend = z.infer<typeof AccountSendSchema>;
116
+ export const AccountSendOutcomeSchema = z.discriminatedUnion("state", [
117
+ z.object({ state: z.literal("delivered"), to: z.string(), id: z.string() }),
118
+ z.object({ state: z.literal("queued"), to: z.string().optional(), reason: z.string(), times: z.number() }),
119
+ z.object({ state: z.literal("refused"), reason: z.string() }),
120
+ ]);
121
+ export type AccountSendOutcome = z.infer<typeof AccountSendOutcomeSchema>;
122
+ export const AccountOutboxSchema = z.object({
123
+ waiting: z.array(
124
+ z.object({
125
+ id: z.string(),
126
+ project: z.string(),
127
+ title: z.string(),
128
+ times: z.number(),
129
+ firstAt: z.number(),
130
+ nextAt: z.number(),
131
+ lastError: z.string().optional(),
132
+ }),
133
+ ),
134
+ });
135
+ export type AccountOutbox = z.infer<typeof AccountOutboxSchema>;
136
+ export const AccountProjectsSchema = z.object({ projects: z.array(z.string()) });
137
+
86
138
  // One group; the id is the fingerprint and the filename, never in the body, so a body cannot disagree with its own
87
139
  // grouping.
88
140
  export const IssueSchema = z.object({
@@ -106,6 +158,8 @@ export const IssueSchema = z.object({
106
158
  // Stored, since a restart can't derive it from a count and timestamp.
107
159
  firedAt: z.number().optional().describe("What the count stood at the last time this woke an agent."),
108
160
  runs: z.array(IssueRunSchema).max(20).optional().describe("The turns started for it."),
161
+ // Set only by the daemon, from a pass the platform signed: never a field a reporter can type.
162
+ sender: IssueSenderSchema.optional().describe("The sandbox on your account that reported the latest one, when another sandbox did."),
109
163
  });
110
164
  export type Issue = z.infer<typeof IssueSchema>;
111
165
 
@@ -1,6 +1,5 @@
1
1
  // maintenance: the standing evidence a chore is decided from
2
2
  import { z } from "zod";
3
- import { WorkspaceHotspotSchema, WorkspaceKeyModuleSchema } from "./codebase-health.js";
4
3
  // The daemon serves facts, never a verdict: which chore is due is computed by shared code
5
4
  // (`@intentic/sandbox-contract/chores`) so the tile and panel can't disagree. Split by cost: probes (subprocesses,
6
5
  // cached with a TTL) vs signals (cheap, recomputed per request).
@@ -246,24 +245,33 @@ export const ChoreShapeSchema = z.object({
246
245
  ),
247
246
  });
248
247
  export type ChoreShape = z.infer<typeof ChoreShapeSchema>;
248
+ // A file iq once ranked as churning and tangled; kept only as the shape of the retired `hotspots` field.
249
+ const RetiredHotspotSchema = z.object({
250
+ path: z.string(),
251
+ commits: z.number(),
252
+ adds: z.number(),
253
+ dels: z.number(),
254
+ complexity: z.number(),
255
+ score: z.number(),
256
+ latestMs: z.number(),
257
+ });
249
258
  export const ChoreSignalsSchema = z.object({
250
259
  packages: z.array(ChorePackageSchema).describe("Each package in the repository, as its own manifest declares it."),
251
260
  shape: ChoreShapeSchema.describe("What the repository is made of, which decides whether a given chore is even a sensible question to ask of it."),
252
- hotspots: z
253
- .array(WorkspaceHotspotSchema)
254
- .describe(
255
- "Files that change often and are complicated at once, capped tight: a chore only asks whether something has entered the top of the ranking.",
256
- ),
257
- keyModules: z.array(WorkspaceKeyModuleSchema).describe("The parts the rest of the code leans on most, capped the same way."),
261
+ // Retired with iq (2026-11-18), which ranked them: always empty, zeros and false now, nothing reads them, and they stay
262
+ // so a Maintenance extension built before then still parses the report. `totals.files` is still counted: older
263
+ // builds gate the cross-cutting-patterns survey on it.
264
+ hotspots: z.array(RetiredHotspotSchema).describe("Retired: always empty."),
265
+ keyModules: z.array(z.object({ path: z.string(), exports: z.number() })).describe("Retired: always empty."),
258
266
  totals: z
259
267
  .object({
260
- files: z.number().describe("Files counted."),
261
- symbols: z.number().describe("Named things they export."),
262
- complexity: z.number().describe("Branch points added up."),
263
- hotspots: z.number().describe("How many files qualify as hotspots at all."),
268
+ files: z.number().describe("Code files in the repository: source, not data, configuration or prose."),
269
+ symbols: z.number().describe("Retired: always zero."),
270
+ complexity: z.number().describe("Retired: always zero."),
271
+ hotspots: z.number().describe("Retired: always zero."),
264
272
  })
265
273
  .describe("The repository in numbers."),
266
- indexed: z.boolean().describe("Whether the index these rankings came from is finished. Nothing should act on a half-built one."),
274
+ indexed: z.boolean().describe("Retired: always false, so a build that still ranks hotspots never acts on these."),
267
275
  });
268
276
  export type ChoreSignals = z.infer<typeof ChoreSignalsSchema>;
269
277
  // `clean` is the important value: without it, a false-positive finding restarts the same turn forever.
@@ -6,6 +6,8 @@ import { z } from "zod";
6
6
  // The kinds of process a sandbox runs, as the daemon classifies them by command line.
7
7
  export const PROCESS_ROLES = [
8
8
  "languageServer",
9
+ // iq's resident engine, removed 2026-11-18: no daemon classifies a process as it now, but an editor reads an older
10
+ // daemon's metrics against this list, and an unknown role would fail the whole reading.
9
11
  "searchEngine",
10
12
  "agentRuntime",
11
13
  "browser",
@@ -18,9 +18,30 @@ export const OffloadTargetSchema = z.object({
18
18
  });
19
19
  export type OffloadTarget = z.infer<typeof OffloadTargetSchema>;
20
20
 
21
+ // What a line needs of the machine it runs on, said by whoever starts it (`remote-run --needs mem=12G,gpu`); the
22
+ // daemon adds what the line's own profile measured (offload/command-profiles.ts). A machine short of it is never picked.
23
+ export const OffloadNeedsSchema = z.object({
24
+ memoryMb: z.number().int().positive().optional(),
25
+ gpu: z.boolean().optional(),
26
+ });
27
+ export type OffloadNeeds = z.infer<typeof OffloadNeedsSchema>;
28
+
29
+ // The question `offload-run` asks before it snapshots anything. `eager` (remote-run's) picks the machine with the most
30
+ // room that fits even while this sandbox is calm; without it a line leaves only a busy sandbox, or one it does not fit.
31
+ // `label` and `command` name the line, so what it measured on earlier runs counts.
32
+ export const OffloadTargetInputSchema = z.object({
33
+ runner: z.string().min(1),
34
+ memoryMb: z.coerce.number().int().positive().optional(),
35
+ gpu: z.stringbool().optional(),
36
+ eager: z.stringbool().optional(),
37
+ label: z.string().min(1).max(80).optional(),
38
+ command: z.string().max(4000).optional(),
39
+ });
40
+ export type OffloadTargetInput = z.infer<typeof OffloadTargetInputSchema>;
41
+
21
42
  // What settings `offload.commands` names instead of one runner: whichever has the most room at the moment the command
22
- // starts, and only while this sandbox is busy (runners/fleet-advice.ts `roomierRunner`). While this sandbox is calm the
23
- // command runs here without a word. Reserved: no runner is ever enrolled under it.
43
+ // starts, and only while this sandbox is busy or cannot fit the line (runners/fleet-advice.ts `placeCommand`). While
44
+ // this sandbox is calm the command runs here without a word. Reserved: no runner is ever enrolled under it.
24
45
  export const OFFLOAD_ANY_RUNNER = "auto";
25
46
 
26
47
  export const OffloadRunSchema = RunnerCommandSchema.extend({ runner: z.string().min(1) });
@@ -43,9 +64,25 @@ export const OffloadRecordSchema = z.object({
43
64
  endedAt: z.number().optional(),
44
65
  code: z.number().int().optional(),
45
66
  failure: z.string().optional(),
67
+ // What the runner measured: the most memory the line held at once, and how long it ran there.
68
+ peakMemoryMb: z.number().int().nonnegative().optional(),
69
+ durationMs: z.number().int().nonnegative().optional(),
46
70
  });
47
71
  export type OffloadRecord = z.infer<typeof OffloadRecordSchema>;
48
72
 
73
+ // What earlier runs of one kind of line measured (offload/command-profiles.ts), keyed by its rule and the parts of the
74
+ // line that decide its size (`cargo test -p shinobi-society`, not the test filter after it).
75
+ export const CommandProfileSchema = z.object({
76
+ key: z.string().min(1),
77
+ runs: z.number().int().positive(),
78
+ // The most any of the last few runs held: memory is planned for the worst recent run, not the average.
79
+ peakMemoryMb: z.number().int().nonnegative().optional(),
80
+ // A moving average of how long it ran, on whichever machine.
81
+ durationMs: z.number().int().nonnegative().optional(),
82
+ lastAt: z.number(),
83
+ });
84
+ export type CommandProfile = z.infer<typeof CommandProfileSchema>;
85
+
49
86
  // One kind of heavy work the owner can send elsewhere: a heavy-command rule this sandbox queues (its id, as settings
50
87
  // `offload.commands` keys it) and the pattern that sorts a line into it.
51
88
  export const OffloadKindSchema = z.object({ id: z.string().min(1), pattern: z.string() });
@@ -93,20 +93,12 @@ export const PanelSummarySchema = z.object({
93
93
  .string()
94
94
  .optional()
95
95
  .describe("Where to open it from outside, present only while that address really serves it. Absent on a sandbox with no outside address."),
96
- role: z
97
- .enum(["intent", "desired-state", "app"])
98
- .optional()
99
- .describe("Which of the workspace's three fixed roles this repository fills. Absent for one that was simply cloned in."),
100
96
  // Detected from specific files:
101
- // deployConfig: deploy.config.ts.
102
- // desiredState: desired-state.json (present after the first resolve).
103
97
  // directoryUi: .intentic/ui/index.html.
104
98
  // monorepo: pnpm-workspace.yaml + turbo.json.
105
99
  // tests: a root `test` script or runner config (vitest.config.ts, bunfig.toml), or "vitest" in the workspace catalog.
106
100
  // userStories: docs/user-stories.
107
101
  // docs: docs/architecture.
108
- deployConfig: z.boolean().describe("It declares infrastructure."),
109
- desiredState: z.boolean().describe("That declaration has been resolved at least once."),
110
102
  directoryUi: z.boolean().describe("It carries a small interface of its own."),
111
103
  monorepo: z.boolean().describe("It holds several packages."),
112
104
  tests: z.boolean().describe("It has tests that can be run."),
@@ -91,6 +91,8 @@ export type PersonaContext = z.infer<typeof PersonaContextSchema>;
91
91
  // editor has to name the same rows the transcript does, and two lists would drift into two vocabularies for one thing.
92
92
  // Ids, not titles, are what a card stores: a title is display text and gets reworded, and a reworded title must not
93
93
  // silently switch a note back on. The daemon maps each id to the titles it covers (agent/prompt/turn-briefing.ts).
94
+ // `search` named the iq teaching note, removed with iq (2026-11-18); it stays readable because a saved card may still
95
+ // list it, and covers no row now.
94
96
  export const TurnBriefingNoteIdSchema = z.enum(["map", "context", "skills", "search", "delegation", "checks", "dependencies", "repoSync", "handoff"]);
95
97
  export type TurnBriefingNoteId = z.infer<typeof TurnBriefingNoteIdSchema>;
96
98
 
@@ -128,12 +130,6 @@ export const TURN_BRIEFING_NOTES: readonly TurnBriefingNote[] = [
128
130
  when: "First message, on a runtime that cannot read the skills folder for itself.",
129
131
  cost: "On those runtimes the agent never learns its skills exist, so it will not load one.",
130
132
  },
131
- {
132
- id: "search",
133
- label: "Using iq for workspace search",
134
- when: "First message, when the workspace search setting is on and the runtime has no plugin seam.",
135
- cost: "The agent falls back to grep-style searching, which it can already do.",
136
- },
137
133
  {
138
134
  id: "delegation",
139
135
  label: "Spawning subagents",
@@ -97,7 +97,13 @@ export const AccountStateSchema = z.discriminatedUnion("kind", [
97
97
  room: z
98
98
  .number()
99
99
  .describe(
100
- "How much of the fullest pool that gates the turn is left, in percent (0 up to 100). Pickers take the most room. 0 is a rounded pool read at 100: at the line, tried after an unmeasured account, never a limit move's destination.",
100
+ "How much of the fullest pool that gates the turn is left, in percent (0 up to 100). 0 is a rounded pool read at 100: at the line, tried after an unmeasured account, never a limit move's destination. An account nearly out (plan-pools.ts NEARLY_OUT_ROOM) ranks after every one with more.",
101
+ ),
102
+ renewsAt: z
103
+ .number()
104
+ .optional()
105
+ .describe(
106
+ "When the longest pool that gates the turn resets, in epoch seconds: the moment what is left of it goes unspent for good. Pickers take the account that renews soonest among those not nearly out, then the most room. Absent where no such pool publishes a reset.",
101
107
  ),
102
108
  }),
103
109
  z.object({
@@ -69,14 +69,10 @@ export const UsageTurnSchema = z.object({
69
69
  // with `costUsd: 0, costKnown: false` rather than silently claiming they were free.
70
70
  costKnown: z.boolean().optional().describe("False when the vendor did not report a cost and the recorded zero is a placeholder, not a price. Absent or true means the cost is real."),
71
71
  durationMs: z.number().describe("How long it took, in milliseconds."),
72
- // Arm of the search-teaching experiment; stable per conversation. Absent means unmeasured.
73
- iqSearchArm: z.boolean().optional(),
74
- // Hash of the plugin nudge and skill body for this arm; recorded on control turns too, for report pairing.
75
- iqSearchCohort: z.string().optional(),
76
- // Every tool call that searched, including CLI searches like `iq q`; absent means unmeasured, not zero.
72
+ // Every tool call that searched, including CLI searches like `rg`; absent means unmeasured, not zero. Rows written
73
+ // before 2026-11-18 can also carry the iq teaching's arm, cohort and uptake (iqSearchArm, iqSearchCohort,
74
+ // iqSearches) and its pre-turn retrieval (turnContext, turnContextMs), which nothing reads now that iq is gone.
77
75
  searchCalls: z.number().optional(),
78
- // Of searchCalls, the ones that ran iq: the search teaching's uptake. Absent on rows written before 2026-10-19.
79
- iqSearches: z.number().optional(),
80
76
  // Search calls before the first file touch; absent as searchCalls; a turn touching nothing counts them all.
81
77
  openingSearches: z.number().optional(),
82
78
  // Directory listings (ls, tree, LS tool) before the turn's first file touch, same window as openingSearches.
@@ -91,7 +87,8 @@ export const UsageTurnSchema = z.object({
91
87
  mapChars: z.number().optional(),
92
88
  // Which comparison `mapArm` belongs to: absent on the first map-or-none rows; "compact-vs-full" from 2026-10-06 to
93
89
  // 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
- // against none; "map-vs-none-2" since, the same with readings off the main agent's calls and spawned children out.
90
+ // against none; "map-vs-none-2" for 2026-10-13 to 11-18, the same with readings off the main agent's calls and spawned
91
+ // children out; "map-vs-none-3" since, the map pointing at `rg --files` once iq was gone.
95
92
  mapCohort: z.string().optional(),
96
93
  // Arm of the tool-search experiment, stable per conversation: true loads connected tools' schemas on demand, false
97
94
  // sends them all with every request. Absent where the turn was not a native Claude one on the Claude Code loop.
@@ -105,12 +102,6 @@ export const UsageTurnSchema = z.object({
105
102
  // A home conversation's turn that opened a fresh session rather than resuming its old one, and why (handoff.ts
106
103
  // FreshStartSchema). Absent on every other turn, a home's included. What `bench:home` reads the rollover's cost off.
107
104
  homeFresh: FreshStartWhySchema.optional(),
108
- // What became of pre-turn retrieval on this turn, and how long it took. Assignment and DELIVERY are different
109
- // facts: the first version of this mechanism was assigned to every eligible turn and reached four in five of them,
110
- // which is the difference between a null result and a mechanism that never ran. Absent means the flag was off, so
111
- // nothing was attempted; `ineligible` means the message carried nothing to look up.
112
- turnContext: z.enum(["delivered", "ineligible", "deadline", "indexing", "no-hits", "failed"]).optional(),
113
- turnContextMs: z.number().optional(),
114
105
  // Zero-based turn count in its conversation; 0 marks the opening turn. Absent means unmeasured.
115
106
  turnIndex: z.number().optional(),
116
107
  // outcome alone can't tell a turn that finished from one that stopped talking; these fields carry the difference
@@ -1,9 +1,9 @@
1
- // secrets: user-supplied env-var secrets the daemon writes to desired-state/.env
1
+ // secrets: user-supplied env-var secrets the daemon keeps in the sandbox's own secret store
2
2
  import { BrokerRuleSchema } from "@intentic/extension-manifest";
3
3
  import { z } from "zod";
4
4
  import { KEYRING_PROGRAMS_MAX, KeyringPackageSchema, KeyringProgramSchema, KeyringShareModeSchema, KeyringSourceSchema } from "./keyring.js";
5
5
  import { SECRET_HOST_MAX, SECRET_HOST_PATTERN_RE, SECRET_HOSTS_MAX } from "../policy/secret-hosts.js";
6
- // Straight to the sandbox daemon, never through the platform; `apply` reloads .env with no restart. `list` returns keys
6
+ // Straight to the sandbox daemon, never through the platform; a set value resolves with no restart. `list` returns keys
7
7
  // only; `reveal` is the one owner-only exception that returns a value.
8
8
  // An env var name, as a shell exports it. Exported so the browser validates against this rather than restating it:
9
9
  // stated twice, the two drifted, and a box with no limit fed a rejection the user could not have predicted.
@@ -52,7 +52,7 @@ export const SecretRegenerateSchema = SecretGenerateSchema.extend({
52
52
  export const SecretGeneratedSchema = z.object({
53
53
  key: z.string().describe("The name it is stored under."),
54
54
  length: z.number().int().describe("How many characters it is, which a reader's validation may care about."),
55
- stored: z.enum(["env", "sandbox"]).describe("Where it was kept: desired-state/.env once DevOps is active, the sandbox's own store before that."),
55
+ stored: z.literal("sandbox").describe("Where it was kept: the sandbox's own secret store."),
56
56
  });
57
57
 
58
58
  // A wall against the agent's own judgment, not a compromised container: a shell here can read the policy same as the
@@ -294,21 +294,17 @@ export const SandboxKeyringPairResultSchema = z.object({
294
294
  });
295
295
 
296
296
  export const SecretInventoryEntrySchema = z.object({
297
- // Env-var key for env|generated; `<provider>:<accountId>` for provider; capability instance id otherwise.
297
+ // Env-var key for env; `<provider>:<accountId>` for provider; capability instance id otherwise.
298
298
  key: z.string().describe("What identifies it. Unique across the whole inventory, so several accounts of one provider each get their own entry."),
299
299
  kind: z
300
- .enum(["env", "generated", "capability", "provider", "device"])
300
+ .enum(["env", "capability", "provider", "device"])
301
301
  .describe(
302
- "Where it came from: you set it, the sandbox generated it, a connection needs it, it is a model account's credential, or it lives in the keyring on one of your computers and this sandbox holds only a pointer to it.",
302
+ "Where it came from: you set it (or had the sandbox generate it), a connection needs it, it is a model account's credential, or it lives in the keyring on one of your computers and this sandbox holds only a pointer to it.",
303
303
  ),
304
- // e.g. "<ProviderName> · <accountLabel>" for provider entries; absent on env/generated.
304
+ // e.g. "<ProviderName> · <accountLabel>" for provider entries; absent on env.
305
305
  label: z.string().optional().describe("A friendlier name, for entries that have one."),
306
306
  status: z.enum(["missing", "set", "connected"]).describe("Whether it exists and, for a connection, whether it is working."),
307
- // Resources referencing it via `{$secret}` refs.
308
- requiredBy: z
309
- .array(z.object({ resourceId: z.string().describe("Which resource."), type: z.string().describe("What kind of resource it is.") }))
310
- .describe("What is waiting on it. Empty for a connection's or an account's own credential."),
311
- // e.g. "desired-state/.env".
307
+ // e.g. ".intentic/secrets/auth/sandbox-secrets.json".
312
308
  storedAt: z.string().describe("Where it actually lives, in words."),
313
309
  revealable: z.boolean().describe("Whether its value can be shown at all. Everything except a model account's credential can be."),
314
310
  // From the masking floor (agent-redaction.ts): names only, never values or lengths.
@@ -318,14 +314,6 @@ export const SecretInventoryEntrySchema = z.object({
318
314
  .describe(
319
315
  "Which of its values are too short for the sandbox to hide from the model everywhere, by the name the agent sees each under. They are hidden only right after a word, flag or address that names a secret, and read in full anywhere else. Absent when none are.",
320
316
  ),
321
- // Forgejo Actions only, and only after adopt, on env|generated entries.
322
- ci: z
323
- .object({
324
- synced: z.boolean().describe("Whether the pipeline has it."),
325
- pushedAt: z.string().optional().describe("When it was last sent there."),
326
- })
327
- .optional()
328
- .describe("Whether a copy has been given to the build pipeline."),
329
317
  // Records only the lane and a destination (command/script head, or page host) — never values.
330
318
  lastUse: z
331
319
  .object({