@intentic/sandbox-contract 1.317.0 → 1.319.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 (348) hide show
  1. package/README.md +16 -6
  2. package/dist/chores/chores.js +1 -1
  3. package/dist/chores/chores.js.map +1 -1
  4. package/dist/chores/probes.js +1 -1
  5. package/dist/chores/probes.js.map +1 -1
  6. package/dist/contracts/accounts.contract.d.ts +75 -0
  7. package/dist/contracts/accounts.contract.d.ts.map +1 -1
  8. package/dist/contracts/accounts.contract.js +10 -1
  9. package/dist/contracts/accounts.contract.js.map +1 -1
  10. package/dist/contracts/agent.contract.d.ts +62 -1
  11. package/dist/contracts/agent.contract.d.ts.map +1 -1
  12. package/dist/contracts/agents.contract.d.ts +830 -93
  13. package/dist/contracts/agents.contract.d.ts.map +1 -1
  14. package/dist/contracts/agents.contract.js +12 -12
  15. package/dist/contracts/agents.contract.js.map +1 -1
  16. package/dist/contracts/ci.contract.d.ts +22 -4
  17. package/dist/contracts/ci.contract.d.ts.map +1 -1
  18. package/dist/contracts/device.contract.d.ts +38 -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/endpoints.contract.d.ts +23 -0
  23. package/dist/contracts/endpoints.contract.d.ts.map +1 -1
  24. package/dist/contracts/endpoints.contract.js +6 -1
  25. package/dist/contracts/endpoints.contract.js.map +1 -1
  26. package/dist/contracts/extensions.contract.d.ts +12 -0
  27. package/dist/contracts/extensions.contract.d.ts.map +1 -1
  28. package/dist/contracts/needs.contract.d.ts +2 -0
  29. package/dist/contracts/needs.contract.d.ts.map +1 -1
  30. package/dist/contracts/providers.contract.d.ts +4 -0
  31. package/dist/contracts/providers.contract.d.ts.map +1 -1
  32. package/dist/contracts/runner.contract.d.ts +143 -124
  33. package/dist/contracts/runner.contract.d.ts.map +1 -1
  34. package/dist/contracts/secrets.contract.d.ts +37 -0
  35. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  36. package/dist/contracts/secrets.contract.js +20 -1
  37. package/dist/contracts/secrets.contract.js.map +1 -1
  38. package/dist/contracts/sessions.contract.d.ts +4 -0
  39. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  40. package/dist/contracts/settings.contract.d.ts +31 -4
  41. package/dist/contracts/settings.contract.d.ts.map +1 -1
  42. package/dist/contracts/settings.contract.js +20 -1
  43. package/dist/contracts/settings.contract.js.map +1 -1
  44. package/dist/contracts/system.contract.d.ts +102 -464
  45. package/dist/contracts/system.contract.d.ts.map +1 -1
  46. package/dist/contracts/system.contract.js +2 -12
  47. package/dist/contracts/system.contract.js.map +1 -1
  48. package/dist/contracts/translator.contract.d.ts +7 -0
  49. package/dist/contracts/translator.contract.d.ts.map +1 -1
  50. package/dist/contracts/translator.contract.js.map +1 -1
  51. package/dist/contracts/webext.contract.d.ts +38 -0
  52. package/dist/contracts/webext.contract.d.ts.map +1 -1
  53. package/dist/contracts/webext.contract.js +3 -0
  54. package/dist/contracts/webext.contract.js.map +1 -1
  55. package/dist/contracts/workspace.contract.d.ts +1 -133
  56. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  57. package/dist/contracts/workspace.contract.js +1 -37
  58. package/dist/contracts/workspace.contract.js.map +1 -1
  59. package/dist/events/agent-events.d.ts +21 -0
  60. package/dist/events/agent-events.d.ts.map +1 -1
  61. package/dist/events/agent-events.js +11 -0
  62. package/dist/events/agent-events.js.map +1 -1
  63. package/dist/events/agent-words.d.ts +1 -0
  64. package/dist/events/agent-words.d.ts.map +1 -1
  65. package/dist/events/agent-words.js +1 -1
  66. package/dist/events/agent-words.js.map +1 -1
  67. package/dist/events/land-breakage.d.ts.map +1 -1
  68. package/dist/events/land-breakage.js.map +1 -1
  69. package/dist/events/resume.d.ts +6 -1
  70. package/dist/events/resume.d.ts.map +1 -1
  71. package/dist/events/resume.js +17 -10
  72. package/dist/events/resume.js.map +1 -1
  73. package/dist/events/sandbox-notice.d.ts +183 -0
  74. package/dist/events/sandbox-notice.d.ts.map +1 -0
  75. package/dist/events/sandbox-notice.js +56 -0
  76. package/dist/events/sandbox-notice.js.map +1 -0
  77. package/dist/events/system-events.d.ts +50 -18
  78. package/dist/events/system-events.d.ts.map +1 -1
  79. package/dist/events/system-events.js +4 -2
  80. package/dist/events/system-events.js.map +1 -1
  81. package/dist/events/transcript.d.ts +24 -0
  82. package/dist/events/transcript.d.ts.map +1 -1
  83. package/dist/events/transcript.js +3 -1
  84. package/dist/events/transcript.js.map +1 -1
  85. package/dist/front/generated/browser-wire.d.ts +13 -0
  86. package/dist/front/generated/browser-wire.d.ts.map +1 -1
  87. package/dist/front/generated/wire.d.ts +4 -0
  88. package/dist/front/generated/wire.d.ts.map +1 -1
  89. package/dist/ids/conversation-ids.d.ts +1 -3
  90. package/dist/ids/conversation-ids.d.ts.map +1 -1
  91. package/dist/ids/conversation-ids.js +1 -3
  92. package/dist/ids/conversation-ids.js.map +1 -1
  93. package/dist/ids/project-dir.d.ts +6 -0
  94. package/dist/ids/project-dir.d.ts.map +1 -0
  95. package/dist/ids/project-dir.js +43 -0
  96. package/dist/ids/project-dir.js.map +1 -0
  97. package/dist/index.d.ts +11543 -11039
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +8 -4
  100. package/dist/index.js.map +1 -1
  101. package/dist/models/agent-runtimes.d.ts.map +1 -1
  102. package/dist/models/agent-runtimes.js +2 -2
  103. package/dist/models/agent-runtimes.js.map +1 -1
  104. package/dist/models/model-roles.d.ts +1 -9
  105. package/dist/models/model-roles.d.ts.map +1 -1
  106. package/dist/models/model-roles.js +1 -9
  107. package/dist/models/model-roles.js.map +1 -1
  108. package/dist/policy/command-classes.d.ts.map +1 -1
  109. package/dist/policy/command-classes.js +52 -3
  110. package/dist/policy/command-classes.js.map +1 -1
  111. package/dist/policy/safety-policy.d.ts +7 -1
  112. package/dist/policy/safety-policy.d.ts.map +1 -1
  113. package/dist/policy/safety-policy.js +2 -0
  114. package/dist/policy/safety-policy.js.map +1 -1
  115. package/dist/policy/secret-hosts.d.ts +13 -0
  116. package/dist/policy/secret-hosts.d.ts.map +1 -0
  117. package/dist/policy/secret-hosts.js +41 -0
  118. package/dist/policy/secret-hosts.js.map +1 -0
  119. package/dist/policy/turned-away.d.ts.map +1 -1
  120. package/dist/policy/turned-away.js +1 -0
  121. package/dist/policy/turned-away.js.map +1 -1
  122. package/dist/protocol/raw-routes.d.ts +12 -0
  123. package/dist/protocol/raw-routes.d.ts.map +1 -1
  124. package/dist/protocol/raw-routes.js +5 -0
  125. package/dist/protocol/raw-routes.js.map +1 -1
  126. package/dist/protocol/routes.d.ts +2 -6
  127. package/dist/protocol/routes.d.ts.map +1 -1
  128. package/dist/protocol/routes.js +2 -3
  129. package/dist/protocol/routes.js.map +1 -1
  130. package/dist/protocol/stream-of.d.ts +6 -0
  131. package/dist/protocol/stream-of.d.ts.map +1 -0
  132. package/dist/protocol/stream-of.js +4 -0
  133. package/dist/protocol/stream-of.js.map +1 -0
  134. package/dist/protocol/vitals.d.ts +8 -0
  135. package/dist/protocol/vitals.d.ts.map +1 -0
  136. package/dist/protocol/vitals.js +16 -0
  137. package/dist/protocol/vitals.js.map +1 -0
  138. package/dist/schemas/activity.js +1 -1
  139. package/dist/schemas/activity.js.map +1 -1
  140. package/dist/schemas/agent.d.ts +25 -2
  141. package/dist/schemas/agent.d.ts.map +1 -1
  142. package/dist/schemas/agent.js +14 -3
  143. package/dist/schemas/agent.js.map +1 -1
  144. package/dist/schemas/agents.d.ts +67 -0
  145. package/dist/schemas/agents.d.ts.map +1 -1
  146. package/dist/schemas/agents.js +36 -0
  147. package/dist/schemas/agents.js.map +1 -1
  148. package/dist/schemas/automations.d.ts +20 -0
  149. package/dist/schemas/automations.d.ts.map +1 -1
  150. package/dist/schemas/capabilities.d.ts +2 -0
  151. package/dist/schemas/capabilities.d.ts.map +1 -1
  152. package/dist/schemas/capabilities.js +34 -4
  153. package/dist/schemas/capabilities.js.map +1 -1
  154. package/dist/schemas/ci.d.ts +69 -9
  155. package/dist/schemas/ci.d.ts.map +1 -1
  156. package/dist/schemas/ci.js +29 -8
  157. package/dist/schemas/ci.js.map +1 -1
  158. package/dist/schemas/context-trim.d.ts +5 -1
  159. package/dist/schemas/context-trim.d.ts.map +1 -1
  160. package/dist/schemas/context-trim.js +8 -4
  161. package/dist/schemas/context-trim.js.map +1 -1
  162. package/dist/schemas/devices.d.ts +23 -0
  163. package/dist/schemas/devices.d.ts.map +1 -1
  164. package/dist/schemas/devices.js +16 -1
  165. package/dist/schemas/devices.js.map +1 -1
  166. package/dist/schemas/environment.d.ts +48 -0
  167. package/dist/schemas/environment.d.ts.map +1 -1
  168. package/dist/schemas/environment.js +15 -0
  169. package/dist/schemas/environment.js.map +1 -1
  170. package/dist/schemas/extension-updates.d.ts +24 -0
  171. package/dist/schemas/extension-updates.d.ts.map +1 -1
  172. package/dist/schemas/git/git.d.ts +13 -0
  173. package/dist/schemas/git/git.d.ts.map +1 -1
  174. package/dist/schemas/git/git.js +11 -1
  175. package/dist/schemas/git/git.js.map +1 -1
  176. package/dist/schemas/hosts.d.ts +2 -0
  177. package/dist/schemas/hosts.d.ts.map +1 -1
  178. package/dist/schemas/hosts.js +2 -1
  179. package/dist/schemas/hosts.js.map +1 -1
  180. package/dist/schemas/keep-warm.d.ts +4 -0
  181. package/dist/schemas/keep-warm.d.ts.map +1 -1
  182. package/dist/schemas/keep-warm.js +15 -5
  183. package/dist/schemas/keep-warm.js.map +1 -1
  184. package/dist/schemas/loopback-catch.d.ts +33 -0
  185. package/dist/schemas/loopback-catch.d.ts.map +1 -0
  186. package/dist/schemas/loopback-catch.js +20 -0
  187. package/dist/schemas/loopback-catch.js.map +1 -0
  188. package/dist/schemas/maintenance.js +1 -1
  189. package/dist/schemas/maintenance.js.map +1 -1
  190. package/dist/schemas/needs.d.ts +3 -0
  191. package/dist/schemas/needs.d.ts.map +1 -1
  192. package/dist/schemas/needs.js +10 -3
  193. package/dist/schemas/needs.js.map +1 -1
  194. package/dist/schemas/personas.d.ts.map +1 -1
  195. package/dist/schemas/personas.js +6 -3
  196. package/dist/schemas/personas.js.map +1 -1
  197. package/dist/schemas/providers/provider-oauth.d.ts +87 -0
  198. package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
  199. package/dist/schemas/providers/provider-oauth.js +20 -0
  200. package/dist/schemas/providers/provider-oauth.js.map +1 -1
  201. package/dist/schemas/secrets.d.ts +66 -0
  202. package/dist/schemas/secrets.d.ts.map +1 -1
  203. package/dist/schemas/secrets.js +50 -0
  204. package/dist/schemas/secrets.js.map +1 -1
  205. package/dist/schemas/settings-history.d.ts +2 -2
  206. package/dist/schemas/settings-history.d.ts.map +1 -1
  207. package/dist/schemas/settings-history.js +2 -0
  208. package/dist/schemas/settings-history.js.map +1 -1
  209. package/dist/schemas/settings.d.ts +42 -4
  210. package/dist/schemas/settings.d.ts.map +1 -1
  211. package/dist/schemas/settings.js +26 -8
  212. package/dist/schemas/settings.js.map +1 -1
  213. package/dist/schemas/terminal.d.ts +2 -3
  214. package/dist/schemas/terminal.d.ts.map +1 -1
  215. package/dist/schemas/terminal.js +12 -4
  216. package/dist/schemas/terminal.js.map +1 -1
  217. package/dist/schemas/webext.d.ts +3 -0
  218. package/dist/schemas/webext.d.ts.map +1 -1
  219. package/dist/schemas/webext.js +1 -0
  220. package/dist/schemas/webext.js.map +1 -1
  221. package/dist/schemas/workflows.js +3 -3
  222. package/dist/schemas/workflows.js.map +1 -1
  223. package/dist/schemas/workspace/workspace-tree.d.ts +2 -56
  224. package/dist/schemas/workspace/workspace-tree.d.ts.map +1 -1
  225. package/dist/schemas/workspace/workspace-tree.js +7 -15
  226. package/dist/schemas/workspace/workspace-tree.js.map +1 -1
  227. package/dist/state/definition.d.ts +12 -8
  228. package/dist/state/definition.d.ts.map +1 -1
  229. package/dist/state/history-state.d.ts.map +1 -1
  230. package/dist/state/history-state.js +7 -0
  231. package/dist/state/history-state.js.map +1 -1
  232. package/dist/state/runtime-state.d.ts +0 -3
  233. package/dist/state/runtime-state.d.ts.map +1 -1
  234. package/dist/state/runtime-state.js +0 -1
  235. package/dist/state/runtime-state.js.map +1 -1
  236. package/dist/state/workspace-state.d.ts +0 -5
  237. package/dist/state/workspace-state.d.ts.map +1 -1
  238. package/dist/state/workspace-state.js +0 -6
  239. package/dist/state/workspace-state.js.map +1 -1
  240. package/dist/text/documents.d.ts +3 -0
  241. package/dist/text/documents.d.ts.map +1 -1
  242. package/dist/text/documents.js +14 -0
  243. package/dist/text/documents.js.map +1 -1
  244. package/dist/text/transcript-fold.d.ts +4 -3
  245. package/dist/text/transcript-fold.d.ts.map +1 -1
  246. package/dist/text/transcript-fold.js +137 -31
  247. package/dist/text/transcript-fold.js.map +1 -1
  248. package/dist/webext/index.d.ts +1 -0
  249. package/dist/webext/index.d.ts.map +1 -1
  250. package/dist/webext/index.js +1 -0
  251. package/dist/webext/index.js.map +1 -1
  252. package/package.json +5 -5
  253. package/src/chores/chores.ts +2 -2
  254. package/src/chores/probes.ts +1 -1
  255. package/src/contracts/accounts.contract.ts +12 -0
  256. package/src/contracts/agents.contract.ts +13 -13
  257. package/src/contracts/device.contract.ts +5 -0
  258. package/src/contracts/endpoints.contract.ts +20 -4
  259. package/src/contracts/secrets.contract.ts +28 -0
  260. package/src/contracts/settings.contract.ts +29 -0
  261. package/src/contracts/system.contract.ts +5 -14
  262. package/src/contracts/translator.contract.ts +2 -1
  263. package/src/contracts/webext.contract.ts +7 -1
  264. package/src/contracts/workspace.contract.ts +0 -49
  265. package/src/events/agent-events.ts +18 -1
  266. package/src/events/agent-words.ts +4 -1
  267. package/src/events/land-breakage.ts +3 -4
  268. package/src/events/resume.test.ts +13 -2
  269. package/src/events/resume.ts +25 -12
  270. package/src/events/sandbox-notice.ts +92 -0
  271. package/src/events/system-events.ts +12 -5
  272. package/src/events/transcript.ts +7 -1
  273. package/src/events/verify-nudge.ts +3 -3
  274. package/src/front/generated/browser-wire.json +95 -0
  275. package/src/front/generated/browser-wire.ts +36 -0
  276. package/src/front/generated/front-wire.json +25 -0
  277. package/src/front/generated/wire.ts +2 -2
  278. package/src/front/wire-manifests.test.ts +7 -0
  279. package/src/ids/conversation-ids.test.ts +2 -26
  280. package/src/ids/conversation-ids.ts +6 -12
  281. package/src/ids/project-dir.fixture.json +65 -0
  282. package/src/ids/project-dir.test.ts +60 -0
  283. package/src/ids/project-dir.ts +70 -0
  284. package/src/index.ts +13 -4
  285. package/src/models/agent-catalog.test.ts +7 -1
  286. package/src/models/agent-runtimes.ts +7 -5
  287. package/src/models/model-roles.ts +1 -9
  288. package/src/policy/command-classes.test.ts +39 -0
  289. package/src/policy/command-classes.ts +70 -3
  290. package/src/policy/safety-policy.ts +10 -0
  291. package/src/policy/secret-hosts.test.ts +89 -0
  292. package/src/policy/secret-hosts.ts +73 -0
  293. package/src/policy/turned-away.ts +1 -0
  294. package/src/protocol/raw-routes.ts +8 -1
  295. package/src/protocol/routes.test.ts +6 -6
  296. package/src/protocol/routes.ts +2 -9
  297. package/src/protocol/stream-of.ts +13 -0
  298. package/src/protocol/vitals.test.ts +46 -0
  299. package/src/protocol/vitals.ts +38 -0
  300. package/src/schemas/activity.ts +1 -1
  301. package/src/schemas/agent.ts +20 -3
  302. package/src/schemas/agents.ts +58 -4
  303. package/src/schemas/automations.ts +2 -2
  304. package/src/schemas/capabilities.ts +44 -7
  305. package/src/schemas/ci.ts +56 -11
  306. package/src/schemas/context-trim.ts +11 -6
  307. package/src/schemas/devices.ts +38 -2
  308. package/src/schemas/environment.ts +39 -0
  309. package/src/schemas/git/git.ts +20 -2
  310. package/src/schemas/hosts.ts +4 -1
  311. package/src/schemas/keep-warm.ts +19 -6
  312. package/src/schemas/loopback-catch.ts +45 -0
  313. package/src/schemas/maintenance.ts +1 -1
  314. package/src/schemas/needs.ts +12 -3
  315. package/src/schemas/personas.ts +8 -3
  316. package/src/schemas/providers/provider-oauth.ts +35 -0
  317. package/src/schemas/secrets.ts +70 -0
  318. package/src/schemas/settings-history.ts +3 -0
  319. package/src/schemas/settings.test.ts +19 -1
  320. package/src/schemas/settings.ts +59 -16
  321. package/src/schemas/speaker.ts +5 -5
  322. package/src/schemas/terminal.ts +19 -6
  323. package/src/schemas/webext.ts +3 -0
  324. package/src/schemas/workflows.ts +5 -5
  325. package/src/schemas/workspace/workspace-tree.ts +12 -20
  326. package/src/state/fix-attempt-plan.test.ts +1 -1
  327. package/src/state/fix-stance.ts +1 -1
  328. package/src/state/history-state.ts +14 -0
  329. package/src/state/runtime-state.ts +0 -3
  330. package/src/state/workspace-state.ts +0 -6
  331. package/src/text/documents.test.ts +25 -1
  332. package/src/text/documents.ts +24 -0
  333. package/src/text/title.ts +1 -1
  334. package/src/text/transcript-fold.test.ts +218 -25
  335. package/src/text/transcript-fold.ts +166 -45
  336. package/src/webext/index.ts +1 -0
  337. package/dist/schemas/workspace/push-checks.d.ts +0 -222
  338. package/dist/schemas/workspace/push-checks.d.ts.map +0 -1
  339. package/dist/schemas/workspace/push-checks.js +0 -97
  340. package/dist/schemas/workspace/push-checks.js.map +0 -1
  341. package/dist/state/red-streak.d.ts +0 -7
  342. package/dist/state/red-streak.d.ts.map +0 -1
  343. package/dist/state/red-streak.js +0 -11
  344. package/dist/state/red-streak.js.map +0 -1
  345. package/src/schemas/workspace/push-checks.test.ts +0 -28
  346. package/src/schemas/workspace/push-checks.ts +0 -155
  347. package/src/state/red-streak.test.ts +0 -28
  348. package/src/state/red-streak.ts +0 -28
@@ -1,97 +0,0 @@
1
- import { z } from "zod";
2
- import { pushFixConversationId } from "../../ids/conversation-ids.js";
3
- import { AgentRunPickSchema } from "../agent.js";
4
- export const FindingSchema = z.object({
5
- id: z.string().describe("Stable across measurements: the same problem found again is the same id."),
6
- source: z.string().describe("What measured it, in the repository's own words: a check's id, `lint`, a hook."),
7
- text: z.string().describe("The finding as it was printed."),
8
- path: z.string().optional().describe("The repository path it is about, when it names one."),
9
- command: z.string().optional().describe("The command that shows it again."),
10
- recheckable: z
11
- .boolean()
12
- .describe("Whether a later measurement can find it gone. False for one about commits already made, which ends only when dismissed."),
13
- gate: z
14
- .enum(["code", "tidy"])
15
- .optional()
16
- .describe("For a check's finding: `code` means the tree fails the check whoever caused it; `tidy` means the change measured added this line."),
17
- commit: z
18
- .object({ sha: z.string(), subject: z.string() })
19
- .optional()
20
- .describe("The newest commit of the change measured that touched the path it names, when it names one."),
21
- });
22
- export const RedDecisionKindSchema = z.enum([
23
- "fix-up",
24
- "reported",
25
- "resolved",
26
- "spent",
27
- "dismissed",
28
- ]);
29
- export const RedDecisionSchema = z.object({
30
- kind: RedDecisionKindSchema.describe("What was decided."),
31
- conversationId: z.string().optional().describe("The conversation working on it, when one is."),
32
- at: z.number().describe("When that was decided, in milliseconds."),
33
- detail: z.string().optional().describe("One sentence on why, in the sandbox's words."),
34
- findings: z
35
- .array(z.string())
36
- .optional()
37
- .describe("The findings it was about, by id, when it was about some of a red's findings rather than the whole red."),
38
- });
39
- export const RedSourceSchema = z.enum(["push", "ci"]);
40
- export const RedSchema = z.object({
41
- source: RedSourceSchema.describe("What went red."),
42
- scope: z.string().describe("Where: a project's folder, or a repository and branch."),
43
- since: z.number().describe("When the red streak began (state/red-streak.ts)."),
44
- findings: z.array(FindingSchema).default([]).describe("What it owes, as the red's own measurement named it."),
45
- decisions: z.array(RedDecisionSchema).default([]).describe("What was decided about it, oldest first."),
46
- });
47
- export const PushCheckSchema = z.object({
48
- project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
49
- id: z.string().describe("The report's own id."),
50
- at: z.number().describe("When the push check ran, in milliseconds."),
51
- remote: z.string().optional().describe("The remote it was pushed to."),
52
- branch: z.string().optional().describe("The branch it was pushed to."),
53
- base: z.string().optional().describe("The commit the pushed range starts from; absent when the remote had nothing to compare with."),
54
- head: z.string().describe("The commit that was pushed."),
55
- commits: z.number().describe("How many commits the push carried."),
56
- findings: z
57
- .array(FindingSchema)
58
- .describe("What it found that this push brought in, less what an earlier push had already left open. Empty for a clean push."),
59
- refused: z
60
- .boolean()
61
- .optional()
62
- .describe("True when the repository's own pre-push hook refused it, so nothing reached the remote and its one finding is what the hook said."),
63
- });
64
- export const PushChecksSchema = z.object({
65
- pushed: z.array(PushCheckSchema).describe("The latest pushes the hook measured across every project, newest first, with what each brought in."),
66
- reds: z.array(RedSchema).describe("What pushes left in each project and is still owed, one push Red per project, with every decision about it."),
67
- });
68
- export const PushDismissSchema = z.object({
69
- project: z.string().describe("Which project, by folder relative to the workspace."),
70
- ids: z.array(z.string()).optional().describe("Which findings. Leave it out for every open one in the project."),
71
- restore: z.boolean().optional().describe("Undo: open the named dismissed findings again."),
72
- });
73
- export const PushDismissResultSchema = z.object({
74
- changed: z.number().describe("How many findings changed state."),
75
- });
76
- export const PushRecheckSchema = z.object({
77
- project: z.string().describe("Which project, by folder relative to the workspace."),
78
- });
79
- export const PushRecheckResultSchema = z.object({
80
- measured: z.boolean().describe("Whether the project could be measured at all; false leaves every finding as it was."),
81
- resolved: z.number().describe("How many findings the measurement no longer saw."),
82
- open: z.number().describe("How many are still open."),
83
- });
84
- export const PushFixSchema = z.object({
85
- project: z.string().describe("Which project's open push findings to hand over, by folder relative to the workspace."),
86
- pick: AgentRunPickSchema.describe("Which model to open the conversation on, when somebody chose one. Leave it out for the sandbox's own choice."),
87
- mode: z
88
- .enum(["continue", "start-over"])
89
- .optional()
90
- .describe("What to do about an attempt already made at these findings: `continue` carries on in it, `start-over` files it away and opens the next attempt. Leave it out for the plain press."),
91
- });
92
- export const PushFixResultSchema = z.object({
93
- conversationId: z.string().describe("The conversation holding the findings. Open it to watch."),
94
- });
95
- export const pushRedOf = (reds, project) => reds?.find((red) => red.source === "push" && red.scope === project);
96
- export const pushFixBase = (red) => red === undefined ? undefined : pushFixConversationId(red.scope === "" ? "workspace" : red.scope, `red:${red.since}`);
97
- //# sourceMappingURL=push-checks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"push-checks.js","sourceRoot":"","sources":["../../../src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MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CAClG,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAgC,EAAE,OAAe,EAAmB,EAAE,CAC5F,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;AAKxE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAA6C,EAAsB,EAAE,CAC7F,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- export interface Streak {
2
- readonly since: number;
3
- readonly count: number;
4
- }
5
- export declare const nextStreak: (previous: Streak | undefined, red: boolean, at: number, continues?: boolean) => Streak | undefined;
6
- export declare const headStreak: <T>(newestFirst: readonly T[], isRed: (item: T) => boolean) => T[];
7
- //# sourceMappingURL=red-streak.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"red-streak.d.ts","sourceRoot":"","sources":["../../src/state/red-streak.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,MAAM;IAEnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAMD,eAAO,MAAM,UAAU,aAAc,MAAM,GAAG,SAAS,OAAO,OAAO,MAAM,MAAM,0BAAqB,MAAM,GAAG,SAK9G,CAAC;AAGF,eAAO,MAAM,UAAU,GAAI,CAAC,eAAe,SAAS,CAAC,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,KAAG,CAAC,EAGvF,CAAC"}
@@ -1,11 +0,0 @@
1
- export const nextStreak = (previous, red, at, continues = true) => {
2
- if (!red) {
3
- return undefined;
4
- }
5
- return previous !== undefined && continues ? { since: previous.since, count: previous.count + 1 } : { since: at, count: 1 };
6
- };
7
- export const headStreak = (newestFirst, isRed) => {
8
- const end = newestFirst.findIndex((item) => !isRed(item));
9
- return end === -1 ? [...newestFirst] : newestFirst.slice(0, end);
10
- };
11
- //# sourceMappingURL=red-streak.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"red-streak.js","sourceRoot":"","sources":["../../src/state/red-streak.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAA4B,EAAE,GAAY,EAAE,EAAU,EAAE,SAAS,GAAG,IAAI,EAAsB,EAAE;IACvH,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,QAAQ,KAAK,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAChI,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,WAAyB,EAAE,KAA2B,EAAO,EAAE;IACzF,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACrE,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- import { pushFixConversationId } from "../../ids/conversation-ids.js";
2
- import { pushFixBase, pushRedOf, type Red, RedSchema } from "./push-checks.js";
3
-
4
- // What a push left is a Red like any other (source `push`, scope the project), and the hand-over's id is named by when
5
- // that red began, so the editor and the daemon find the same attempt whichever of them asks.
6
-
7
- const red = (over: Partial<Red>): Red => RedSchema.parse({ source: `push`, scope: `app`, since: 100, ...over });
8
-
9
- describe(`a project's push red`, () => {
10
- test(`is the push red of that project, never a CI red of the same name or another project's`, () => {
11
- const ci = red({ source: `ci` });
12
- const other = red({ scope: `web` });
13
- const mine = red({});
14
- expect(pushRedOf([ci, other, mine], `app`)).toBe(mine);
15
- expect(pushRedOf([ci, other], `app`)).toBeUndefined();
16
- expect(pushRedOf(undefined, `app`)).toBeUndefined();
17
- });
18
-
19
- test(`names its hand-over by when it began, with the workspace root spelled as the workspace`, () => {
20
- expect(pushFixBase(red({}))).toBe(pushFixConversationId(`app`, `red:100`));
21
- expect(pushFixBase(red({ scope: `` }))).toBe(pushFixConversationId(`workspace`, `red:100`));
22
- expect(pushFixBase(undefined)).toBeUndefined();
23
- });
24
-
25
- test(`that began later is a fresh attempt`, () => {
26
- expect(pushFixBase(red({ since: 200 }))).toBe(pushFixConversationId(`app`, `red:200`));
27
- });
28
- });
@@ -1,155 +0,0 @@
1
- // what the pre-push hook let through, and the one record every red keeps, whatever went red
2
- import { z } from "zod";
3
- import { pushFixConversationId } from "../../ids/conversation-ids.js";
4
- import { AgentRunPickSchema } from "../agent.js";
5
-
6
- // Nothing checks work inside a conversation or after it lands: CI checks what the owner pushes (ci/main-fixer.ts puts
7
- // one fix agent on main's red), and the pre-push hook measures the push on the way out without ever refusing it
8
- // (verify-push.mjs, `--advisory`). What the hook found used to vanish with the terminal it printed to. It now leaves a
9
- // report in the repository's git dir, the daemon files it once the push has actually reached the remote, and what it
10
- // found is owed, as the project's push Red, until a later measurement no longer prints it or somebody dismisses it.
11
- // Nobody is sent after it: acting on it is the owner's call.
12
-
13
- // ONE FINDING, whatever measured it: a check run's line as the repository's own tooling printed it, named by what
14
- // printed it (`source`, the repository's word: a check's id, `lint`, a hook), with the command that shows it again and
15
- // whether a later measurement can say it is gone. A push's findings are these; a CI run's failed jobs become them too.
16
- export const FindingSchema = z.object({
17
- id: z.string().describe("Stable across measurements: the same problem found again is the same id."),
18
- source: z.string().describe("What measured it, in the repository's own words: a check's id, `lint`, a hook."),
19
- text: z.string().describe("The finding as it was printed."),
20
- path: z.string().optional().describe("The repository path it is about, when it names one."),
21
- command: z.string().optional().describe("The command that shows it again."),
22
- recheckable: z
23
- .boolean()
24
- .describe("Whether a later measurement can find it gone. False for one about commits already made, which ends only when dismissed."),
25
- gate: z
26
- .enum(["code", "tidy"])
27
- .optional()
28
- .describe(
29
- "For a check's finding: `code` means the tree fails the check whoever caused it; `tidy` means the change measured added this line.",
30
- ),
31
- commit: z
32
- .object({ sha: z.string(), subject: z.string() })
33
- .optional()
34
- .describe("The newest commit of the change measured that touched the path it names, when it names one."),
35
- });
36
- export type Finding = z.infer<typeof FindingSchema>;
37
-
38
- // What was decided about a red, in the order it was decided.
39
- export const RedDecisionKindSchema = z.enum([
40
- // A fix agent was put on it: pressed for by a person, or started by the sandbox on main's red CI.
41
- "fix-up",
42
- // Nobody was sent: repairs are switched off, or nothing could take it.
43
- "reported",
44
- // A later measurement no longer found it (`findings` names which).
45
- "resolved",
46
- // The fix agent had its turns, or stopped without a fix: it waits for a person.
47
- "spent",
48
- // A person set findings aside as not to be fixed (`findings` names which).
49
- "dismissed",
50
- ]);
51
- export type RedDecisionKind = z.infer<typeof RedDecisionKindSchema>;
52
-
53
- export const RedDecisionSchema = z.object({
54
- kind: RedDecisionKindSchema.describe("What was decided."),
55
- conversationId: z.string().optional().describe("The conversation working on it, when one is."),
56
- at: z.number().describe("When that was decided, in milliseconds."),
57
- detail: z.string().optional().describe("One sentence on why, in the sandbox's words."),
58
- findings: z
59
- .array(z.string())
60
- .optional()
61
- .describe("The findings it was about, by id, when it was about some of a red's findings rather than the whole red."),
62
- });
63
- export type RedDecision = z.infer<typeof RedDecisionSchema>;
64
-
65
- // ONE RED, whatever went red: what a push left in a project, main's CI on a branch. What it owes (its findings) and every
66
- // decision about it, oldest first. A push's red waits for the owner's press (conversations/fix/push-fix.ts); main's CI
67
- // red gets one fix agent by itself (ci/main-fixer.ts). The record is the same.
68
- export const RedSourceSchema = z.enum(["push", "ci"]);
69
- export type RedSource = z.infer<typeof RedSourceSchema>;
70
-
71
- export const RedSchema = z.object({
72
- source: RedSourceSchema.describe("What went red."),
73
- scope: z.string().describe("Where: a project's folder, or a repository and branch."),
74
- since: z.number().describe("When the red streak began (state/red-streak.ts)."),
75
- findings: z.array(FindingSchema).default([]).describe("What it owes, as the red's own measurement named it."),
76
- decisions: z.array(RedDecisionSchema).default([]).describe("What was decided about it, oldest first."),
77
- });
78
- export type Red = z.infer<typeof RedSchema>;
79
-
80
- // ONE PUSH THE HOOK MEASURED, as the record lists it: where it went and what it found that it brought in. What of that is
81
- // still owed is the project's push Red's to say (`findings`), never the push's.
82
- export const PushCheckSchema = z.object({
83
- project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
84
- id: z.string().describe("The report's own id."),
85
- at: z.number().describe("When the push check ran, in milliseconds."),
86
- remote: z.string().optional().describe("The remote it was pushed to."),
87
- branch: z.string().optional().describe("The branch it was pushed to."),
88
- base: z.string().optional().describe("The commit the pushed range starts from; absent when the remote had nothing to compare with."),
89
- head: z.string().describe("The commit that was pushed."),
90
- commits: z.number().describe("How many commits the push carried."),
91
- findings: z
92
- .array(FindingSchema)
93
- .describe("What it found that this push brought in, less what an earlier push had already left open. Empty for a clean push."),
94
- refused: z
95
- .boolean()
96
- .optional()
97
- .describe(
98
- "True when the repository's own pre-push hook refused it, so nothing reached the remote and its one finding is what the hook said.",
99
- ),
100
- });
101
- export type PushCheck = z.infer<typeof PushCheckSchema>;
102
-
103
- export const PushChecksSchema = z.object({
104
- pushed: z.array(PushCheckSchema).describe("The latest pushes the hook measured across every project, newest first, with what each brought in."),
105
- reds: z.array(RedSchema).describe("What pushes left in each project and is still owed, one push Red per project, with every decision about it."),
106
- });
107
- export type PushChecks = z.infer<typeof PushChecksSchema>;
108
-
109
- export const PushDismissSchema = z.object({
110
- project: z.string().describe("Which project, by folder relative to the workspace."),
111
- ids: z.array(z.string()).optional().describe("Which findings. Leave it out for every open one in the project."),
112
- restore: z.boolean().optional().describe("Undo: open the named dismissed findings again."),
113
- });
114
- export type PushDismiss = z.infer<typeof PushDismissSchema>;
115
-
116
- export const PushDismissResultSchema = z.object({
117
- changed: z.number().describe("How many findings changed state."),
118
- });
119
-
120
- export const PushRecheckSchema = z.object({
121
- project: z.string().describe("Which project, by folder relative to the workspace."),
122
- });
123
-
124
- export const PushRecheckResultSchema = z.object({
125
- measured: z.boolean().describe("Whether the project could be measured at all; false leaves every finding as it was."),
126
- resolved: z.number().describe("How many findings the measurement no longer saw."),
127
- open: z.number().describe("How many are still open."),
128
- });
129
- export type PushRecheckResult = z.infer<typeof PushRecheckResultSchema>;
130
-
131
- export const PushFixSchema = z.object({
132
- project: z.string().describe("Which project's open push findings to hand over, by folder relative to the workspace."),
133
- pick: AgentRunPickSchema.describe("Which model to open the conversation on, when somebody chose one. Leave it out for the sandbox's own choice."),
134
- mode: z
135
- .enum(["continue", "start-over"])
136
- .optional()
137
- .describe(
138
- "What to do about an attempt already made at these findings: `continue` carries on in it, `start-over` files it away and opens the next attempt. Leave it out for the plain press.",
139
- ),
140
- });
141
- export type PushFix = z.infer<typeof PushFixSchema>;
142
-
143
- export const PushFixResultSchema = z.object({
144
- conversationId: z.string().describe("The conversation holding the findings. Open it to watch."),
145
- });
146
-
147
- // What pushes left in `project`, as the reds name it; undefined while nothing is owed.
148
- export const pushRedOf = (reds: readonly Red[] | undefined, project: string): Red | undefined =>
149
- reds?.find((red) => red.source === "push" && red.scope === project);
150
-
151
- // The conversation id a hand-over of a push red wears (attempt 1), derived from when the red began, so the editor and the
152
- // daemon agree on whether an agent is already on it: pressing again while anything is owed continues the same attempt,
153
- // and a red that begins after everything was handled starts a fresh one. Undefined when nothing is owed.
154
- export const pushFixBase = (red: Pick<Red, "scope" | "since"> | undefined): string | undefined =>
155
- red === undefined ? undefined : pushFixConversationId(red.scope === "" ? "workspace" : red.scope, `red:${red.since}`);
@@ -1,28 +0,0 @@
1
- import { headStreak, nextStreak } from "./red-streak.js";
2
-
3
- // The five places that asked "is this still the same red" asked it five ways; these are the two answers they share.
4
-
5
- describe(`a streak followed one observation at a time`, () => {
6
- test(`begins at the first red, keeps that start through every red after it, and ends at anything else`, () => {
7
- const first = nextStreak(undefined, true, 10);
8
- expect(first).toEqual({ since: 10, count: 1 });
9
- const second = nextStreak(first, true, 20);
10
- expect(second).toEqual({ since: 10, count: 2 });
11
- expect(nextStreak(second, false, 30)).toBeUndefined();
12
- expect(nextStreak(undefined, false, 30)).toBeUndefined();
13
- });
14
-
15
- test(`begins again when the red is a different failure`, () => {
16
- expect(nextStreak({ since: 10, count: 3 }, true, 40, false)).toEqual({ since: 40, count: 1 });
17
- });
18
- });
19
-
20
- describe(`a streak read off a history`, () => {
21
- test(`is the unbroken run of red at the head, newest first`, () => {
22
- const history = [`red-3`, `red-2`, `green-1`, `red-0`];
23
- expect(headStreak(history, (item) => item.startsWith(`red`))).toEqual([`red-3`, `red-2`]);
24
- expect(headStreak([`green`, `red`], (item) => item === `red`)).toEqual([]);
25
- expect(headStreak([`red`, `red`], (item) => item === `red`)).toEqual([`red`, `red`]);
26
- expect(headStreak([], () => true)).toEqual([]);
27
- });
28
- });
@@ -1,28 +0,0 @@
1
- // ONE DEFINITION OF A RED STREAK, for every source that goes red: what a project's pushes left (push-checks-store.ts)
2
- // and a pipeline branch on the board (the pipelines extension's ciStreaks.ts). A streak is the unbroken run of red at
3
- // the head: a red extends it, anything else ends it, and `since` is where it began, which is what names one failure
4
- // across every red that continues it.
5
-
6
- export interface Streak {
7
- // When (or at which run) the streak began: the first red of the unbroken run.
8
- readonly since: number;
9
- // How many reds in a row it holds.
10
- readonly count: number;
11
- }
12
-
13
- /**
14
- * One observation's effect on the streak before it. A red continues it, unless `continues` says this red is a different
15
- * failure (CI: no failed job repeats), which begins one of its own; anything else ends it.
16
- */
17
- export const nextStreak = (previous: Streak | undefined, red: boolean, at: number, continues = true): Streak | undefined => {
18
- if (!red) {
19
- return undefined;
20
- }
21
- return previous !== undefined && continues ? { since: previous.since, count: previous.count + 1 } : { since: at, count: 1 };
22
- };
23
-
24
- /** The streak a newest-first history stands on: its unbroken run of red at the head, newest first; empty when the head is not red. */
25
- export const headStreak = <T>(newestFirst: readonly T[], isRed: (item: T) => boolean): T[] => {
26
- const end = newestFirst.findIndex((item) => !isRed(item));
27
- return end === -1 ? [...newestFirst] : newestFirst.slice(0, end);
28
- };