@intentic/sandbox-contract 1.315.0 → 1.316.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/contracts/agent.contract.d.ts +1 -0
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +3 -3
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/ci.contract.d.ts +22 -0
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +0 -3
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +3 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.d.ts +15 -137
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +25 -15
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/land-breakage.d.ts +0 -2
- package/dist/events/land-breakage.d.ts.map +1 -1
- package/dist/events/land-breakage.js +0 -2
- package/dist/events/land-breakage.js.map +1 -1
- package/dist/events/system-events.d.ts +2 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/index.d.ts +43 -142
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/models/agent-runtimes.d.ts.map +1 -1
- package/dist/models/agent-runtimes.js +1 -1
- package/dist/models/agent-runtimes.js.map +1 -1
- package/dist/models/plan-pools.d.ts +2 -1
- package/dist/models/plan-pools.d.ts.map +1 -1
- package/dist/models/plan-pools.js +8 -4
- package/dist/models/plan-pools.js.map +1 -1
- package/dist/protocol/raw-routes.d.ts +9 -0
- package/dist/protocol/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw-routes.js +2 -0
- package/dist/protocol/raw-routes.js.map +1 -1
- package/dist/protocol/request-id.d.ts +0 -1
- package/dist/protocol/request-id.d.ts.map +1 -1
- package/dist/protocol/request-id.js +0 -1
- package/dist/protocol/request-id.js.map +1 -1
- package/dist/schemas/agent.js +1 -1
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents.d.ts +0 -1
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +2 -2
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/ci.d.ts +45 -0
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +18 -0
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/devices.d.ts +0 -1
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js +3 -4
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/personas.js +2 -2
- package/dist/schemas/personas.js.map +1 -1
- package/dist/schemas/providers/plan-limits.d.ts +2 -0
- package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
- package/dist/schemas/providers/plan-limits.js +4 -0
- package/dist/schemas/providers/plan-limits.js.map +1 -1
- package/dist/schemas/settings-history.d.ts +1 -1
- package/dist/schemas/settings-history.d.ts.map +1 -1
- package/dist/schemas/settings-history.js +2 -1
- package/dist/schemas/settings-history.js.map +1 -1
- package/dist/schemas/settings.d.ts +0 -4
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +6 -13
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/workspace/push-checks.d.ts +222 -0
- package/dist/schemas/workspace/push-checks.d.ts.map +1 -0
- package/dist/schemas/workspace/push-checks.js +97 -0
- package/dist/schemas/workspace/push-checks.js.map +1 -0
- package/dist/schemas/workspace/workspace-tree.d.ts +9 -0
- package/dist/schemas/workspace/workspace-tree.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-tree.js +12 -0
- package/dist/schemas/workspace/workspace-tree.js.map +1 -1
- package/dist/state/definition.d.ts +0 -4
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/runtime-state.d.ts +2 -2
- package/dist/state/runtime-state.d.ts.map +1 -1
- package/dist/state/runtime-state.js +1 -1
- package/dist/state/runtime-state.js.map +1 -1
- package/dist/state/workspace-state.d.ts +1 -11
- package/dist/state/workspace-state.d.ts.map +1 -1
- package/dist/state/workspace-state.js +1 -13
- package/dist/state/workspace-state.js.map +1 -1
- package/package.json +5 -5
- package/src/contracts/agents.contract.ts +3 -3
- package/src/contracts/workspace.contract.ts +35 -21
- package/src/events/errands.test.ts +4 -4
- package/src/events/land-breakage.ts +5 -9
- package/src/events/verify-nudge.ts +3 -3
- package/src/index.ts +2 -2
- package/src/models/agent-runtimes.ts +5 -4
- package/src/models/plan-pools.test.ts +15 -0
- package/src/models/plan-pools.ts +20 -4
- package/src/protocol/ingress-contract.fixture.json +2 -0
- package/src/protocol/raw-routes.ts +4 -1
- package/src/protocol/request-id.ts +0 -3
- package/src/schemas/agent.ts +1 -1
- package/src/schemas/agents.ts +5 -7
- package/src/schemas/automations.ts +2 -2
- package/src/schemas/ci.ts +25 -0
- package/src/schemas/devices.ts +8 -12
- package/src/schemas/personas.ts +2 -2
- package/src/schemas/providers/plan-limits.ts +8 -0
- package/src/schemas/settings-history.ts +3 -1
- package/src/schemas/settings.test.ts +4 -3
- package/src/schemas/settings.ts +17 -31
- package/src/schemas/speaker.ts +4 -4
- package/src/schemas/workspace/{mainline.test.ts → push-checks.test.ts} +5 -5
- package/src/schemas/workspace/push-checks.ts +155 -0
- package/src/schemas/workspace/workspace-tree.ts +15 -0
- package/src/state/fix-stance.test.ts +2 -1
- package/src/state/landed-commit.ts +1 -1
- package/src/state/red-streak.ts +4 -4
- package/src/state/runtime-state.ts +2 -3
- package/src/state/workspace-state.ts +1 -13
- package/dist/schemas/workspace/mainline.d.ts +0 -513
- package/dist/schemas/workspace/mainline.d.ts.map +0 -1
- package/dist/schemas/workspace/mainline.js +0 -182
- package/dist/schemas/workspace/mainline.js.map +0 -1
- package/src/schemas/workspace/mainline.ts +0 -268
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { pushFixConversationId } from "../../ids/conversation-ids.js";
|
|
3
|
-
import { AgentRunPickSchema } from "../agent.js";
|
|
4
|
-
export const MainlineLandSchema = z.object({
|
|
5
|
-
conversationId: z.string().describe("The conversation whose work landed."),
|
|
6
|
-
title: z.string().optional().describe("Its title when it landed."),
|
|
7
|
-
at: z.number().describe("When the land asked for the check, in milliseconds."),
|
|
8
|
-
});
|
|
9
|
-
export const MainlineLandRefSchema = z.object({
|
|
10
|
-
conversationId: z.string().describe("The conversation whose work landed."),
|
|
11
|
-
title: z.string().optional().describe("Its title when it landed."),
|
|
12
|
-
});
|
|
13
|
-
export const MainlineFailureSchema = z.object({
|
|
14
|
-
name: z.string().describe("What failed: a test by its own name, anything else (a type error, a whole task) as the check printed it."),
|
|
15
|
-
path: z.string().optional().describe("The repository path it failed in, when it names one."),
|
|
16
|
-
});
|
|
17
|
-
export const MainlineRoutingKindSchema = z.enum([
|
|
18
|
-
"waiting",
|
|
19
|
-
"held",
|
|
20
|
-
"original",
|
|
21
|
-
"fix-up",
|
|
22
|
-
"reported",
|
|
23
|
-
"resolved",
|
|
24
|
-
"spent",
|
|
25
|
-
"dismissed",
|
|
26
|
-
]);
|
|
27
|
-
export const MainlineRoutingSchema = z.object({
|
|
28
|
-
kind: MainlineRoutingKindSchema.describe("What became of the failures."),
|
|
29
|
-
conversationId: z
|
|
30
|
-
.string()
|
|
31
|
-
.optional()
|
|
32
|
-
.describe("The conversation working on them (the original or a fresh one), or the one still working that the repair waits for."),
|
|
33
|
-
at: z.number().describe("When that was decided, in milliseconds."),
|
|
34
|
-
detail: z.string().optional().describe("One sentence on why, in the sandbox's words."),
|
|
35
|
-
findings: z
|
|
36
|
-
.array(z.string())
|
|
37
|
-
.optional()
|
|
38
|
-
.describe("The findings it was about, by id, when it was about some of a red's findings rather than the whole red."),
|
|
39
|
-
});
|
|
40
|
-
export const MAINLINE_FAILURES_KEPT = 30;
|
|
41
|
-
export const MainlineRunSchema = z.object({
|
|
42
|
-
project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
|
|
43
|
-
command: z.string().describe("What ran."),
|
|
44
|
-
status: z.enum(["green", "red"]).describe("How it ended."),
|
|
45
|
-
startedAt: z.number().describe("When it started, in milliseconds."),
|
|
46
|
-
at: z.number().describe("When it ended, in milliseconds."),
|
|
47
|
-
lands: z.array(MainlineLandSchema).describe("The lands it answered for, oldest first. Empty for a run no land asked for."),
|
|
48
|
-
failures: z.array(z.string()).describe(`The first failures it named, at most ${MAINLINE_FAILURES_KEPT}.`),
|
|
49
|
-
failureCount: z.number().describe("How many failures it named in all. Zero on a red run that wrote no list."),
|
|
50
|
-
attempt: z.number().describe("How many red runs in a row this is for the project; zero when green."),
|
|
51
|
-
suspects: z
|
|
52
|
-
.array(z.string())
|
|
53
|
-
.optional()
|
|
54
|
-
.describe("The conversations whose lands these failures were laid at, when any could be named."),
|
|
55
|
-
named: z
|
|
56
|
-
.boolean()
|
|
57
|
-
.optional()
|
|
58
|
-
.describe("Whether the failures were laid at the suspects by the paths they changed. False when nobody could be told apart (every land the run covered is a suspect) or nothing new failed in it (none is). Absent on green, and from a daemon that did not say."),
|
|
59
|
-
units: z
|
|
60
|
-
.array(MainlineFailureSchema)
|
|
61
|
-
.optional()
|
|
62
|
-
.describe("The same first failures, split into a name and the path they failed in. Absent from a daemon that does not split them."),
|
|
63
|
-
routing: MainlineRoutingSchema.optional().describe("What became of a red run's failures. Absent on green, and until it is decided."),
|
|
64
|
-
});
|
|
65
|
-
export const MainlineProjectSchema = z.object({
|
|
66
|
-
project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
|
|
67
|
-
running: z
|
|
68
|
-
.object({
|
|
69
|
-
command: z.string().describe("What is running."),
|
|
70
|
-
startedAt: z.number().describe("When it started, in milliseconds."),
|
|
71
|
-
lands: z.array(MainlineLandSchema).describe("The lands it answers for."),
|
|
72
|
-
on: z.string().optional().describe("The runner it was sent to, on one of your machines. Absent when it runs in this sandbox."),
|
|
73
|
-
})
|
|
74
|
-
.optional()
|
|
75
|
-
.describe("The check running on it now, if any."),
|
|
76
|
-
session: z
|
|
77
|
-
.string()
|
|
78
|
-
.optional()
|
|
79
|
-
.describe("The terminal session its check runs in, running or last, to attach to for the whole log. Absent from a daemon that does not say."),
|
|
80
|
-
queued: z.array(MainlineLandSchema).describe("Lands waiting for the next check, which will measure them together."),
|
|
81
|
-
last: MainlineRunSchema.optional().describe("Its most recent settled check."),
|
|
82
|
-
redSince: z.number().optional().describe("When its checks went red and stayed so, in milliseconds. Absent while green."),
|
|
83
|
-
red: z
|
|
84
|
-
.object({
|
|
85
|
-
since: z.number().describe("When its checks went red and stayed so, in milliseconds."),
|
|
86
|
-
cause: z
|
|
87
|
-
.array(MainlineLandRefSchema)
|
|
88
|
-
.describe("The work this red is laid at, oldest first: the lands its failures were laid at on the latest run of the streak that could name any. Empty when none could be."),
|
|
89
|
-
named: z.boolean().describe("Whether `cause` was narrowed by the paths the lands changed; false when it is every land the run covered."),
|
|
90
|
-
fixer: MainlineRoutingSchema.optional().describe("The latest decision about who has it. Absent until one is made."),
|
|
91
|
-
})
|
|
92
|
-
.optional()
|
|
93
|
-
.describe("The red streak it is in, as the sandbox laid it. Absent while green, and from a daemon that does not lay it."),
|
|
94
|
-
});
|
|
95
|
-
export const FindingSchema = z.object({
|
|
96
|
-
id: z.string().describe("Stable across measurements: the same problem found again is the same id."),
|
|
97
|
-
source: z.string().describe("What measured it, in the repository's own words: a check's id, `lint`, a hook."),
|
|
98
|
-
text: z.string().describe("The finding as it was printed."),
|
|
99
|
-
path: z.string().optional().describe("The repository path it is about, when it names one."),
|
|
100
|
-
command: z.string().optional().describe("The command that shows it again."),
|
|
101
|
-
recheckable: z
|
|
102
|
-
.boolean()
|
|
103
|
-
.describe("Whether a later measurement can find it gone. False for one about commits already made, which ends only when dismissed."),
|
|
104
|
-
gate: z
|
|
105
|
-
.enum(["code", "tidy"])
|
|
106
|
-
.optional()
|
|
107
|
-
.describe("For a check's finding: `code` means the tree fails the check whoever caused it; `tidy` means the change measured added this line."),
|
|
108
|
-
commit: z
|
|
109
|
-
.object({ sha: z.string(), subject: z.string() })
|
|
110
|
-
.optional()
|
|
111
|
-
.describe("The newest commit of the change measured that touched the path it names, when it names one."),
|
|
112
|
-
});
|
|
113
|
-
export const RedSourceSchema = z.enum(["land", "push", "ci"]);
|
|
114
|
-
export const RED_POLICY = { land: "route", push: "owner", ci: "fix-agent" };
|
|
115
|
-
export const RedSchema = z.object({
|
|
116
|
-
source: RedSourceSchema.describe("What went red."),
|
|
117
|
-
scope: z.string().describe("Where: a project's folder, or a repository and branch."),
|
|
118
|
-
since: z.number().describe("When the red streak began (state/red-streak.ts)."),
|
|
119
|
-
findings: z.array(FindingSchema).default([]).describe("What it owes, as the red's own measurement named it."),
|
|
120
|
-
suspects: z.array(z.string()).default([]).describe("The conversations it was laid at."),
|
|
121
|
-
named: z.boolean().default(false).describe("Whether the paths they changed narrowed it to them."),
|
|
122
|
-
decisions: z.array(MainlineRoutingSchema).default([]).describe("What was decided about it, oldest first."),
|
|
123
|
-
});
|
|
124
|
-
export const MainlinePushSchema = z.object({
|
|
125
|
-
project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
|
|
126
|
-
id: z.string().describe("The report's own id."),
|
|
127
|
-
at: z.number().describe("When the push check ran, in milliseconds."),
|
|
128
|
-
remote: z.string().optional().describe("The remote it was pushed to."),
|
|
129
|
-
branch: z.string().optional().describe("The branch it was pushed to."),
|
|
130
|
-
base: z.string().optional().describe("The commit the pushed range starts from; absent when the remote had nothing to compare with."),
|
|
131
|
-
head: z.string().describe("The commit that was pushed."),
|
|
132
|
-
commits: z.number().describe("How many commits the push carried."),
|
|
133
|
-
findings: z
|
|
134
|
-
.array(FindingSchema)
|
|
135
|
-
.describe("What it found that this push brought in, less what an earlier push had already left open. Empty for a clean push."),
|
|
136
|
-
refused: z
|
|
137
|
-
.boolean()
|
|
138
|
-
.optional()
|
|
139
|
-
.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."),
|
|
140
|
-
});
|
|
141
|
-
export const MainlineStatusSchema = z.object({
|
|
142
|
-
projects: z.array(MainlineProjectSchema).describe("Every project a land has been checked in, or is waiting to be."),
|
|
143
|
-
recent: z.array(MainlineRunSchema).describe("The latest settled checks across every project, newest first."),
|
|
144
|
-
pushed: z
|
|
145
|
-
.array(MainlinePushSchema)
|
|
146
|
-
.optional()
|
|
147
|
-
.describe("The latest pushes the hook measured across every project, newest first, with what each brought in. Absent from a daemon that records none."),
|
|
148
|
-
reds: z
|
|
149
|
-
.array(RedSchema)
|
|
150
|
-
.optional()
|
|
151
|
-
.describe("Every red the main line holds, one record whatever went red: each red project's land check and what pushes left in each project, with what each owes and every decision about it. Absent from a daemon that keeps none."),
|
|
152
|
-
});
|
|
153
|
-
export const MainlinePushDismissSchema = z.object({
|
|
154
|
-
project: z.string().describe("Which project, by folder relative to the workspace."),
|
|
155
|
-
ids: z.array(z.string()).optional().describe("Which findings. Leave it out for every open one in the project."),
|
|
156
|
-
restore: z.boolean().optional().describe("Undo: open the named dismissed findings again."),
|
|
157
|
-
});
|
|
158
|
-
export const MainlinePushDismissResultSchema = z.object({
|
|
159
|
-
changed: z.number().describe("How many findings changed state."),
|
|
160
|
-
});
|
|
161
|
-
export const MainlinePushRecheckSchema = z.object({
|
|
162
|
-
project: z.string().describe("Which project, by folder relative to the workspace."),
|
|
163
|
-
});
|
|
164
|
-
export const MainlinePushRecheckResultSchema = z.object({
|
|
165
|
-
measured: z.boolean().describe("Whether the project could be measured at all; false leaves every finding as it was."),
|
|
166
|
-
resolved: z.number().describe("How many findings the measurement no longer saw."),
|
|
167
|
-
open: z.number().describe("How many are still open."),
|
|
168
|
-
});
|
|
169
|
-
export const MainlinePushFixSchema = z.object({
|
|
170
|
-
project: z.string().describe("Which project's open push findings to hand over, by folder relative to the workspace."),
|
|
171
|
-
pick: AgentRunPickSchema.describe("Which model to open the conversation on, when somebody chose one. Leave it out for the sandbox's own choice."),
|
|
172
|
-
mode: z
|
|
173
|
-
.enum(["continue", "start-over"])
|
|
174
|
-
.optional()
|
|
175
|
-
.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."),
|
|
176
|
-
});
|
|
177
|
-
export const MainlinePushFixResultSchema = z.object({
|
|
178
|
-
conversationId: z.string().describe("The conversation holding the findings. Open it to watch."),
|
|
179
|
-
});
|
|
180
|
-
export const pushRedOf = (reds, project) => reds?.find((red) => red.source === "push" && red.scope === project);
|
|
181
|
-
export const pushFixBase = (red) => red === undefined ? undefined : pushFixConversationId(red.scope === "" ? "workspace" : red.scope, `red:${red.since}`);
|
|
182
|
-
//# sourceMappingURL=mainline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mainline.js","sourceRoot":"","sources":["../../../src/schemas/workspace/mainline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAClE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;CACjF,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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,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,268 +0,0 @@
|
|
|
1
|
-
// main-line checks: the whole-tree check the daemon runs after work lands, and what became of what it found
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { pushFixConversationId } from "../../ids/conversation-ids.js";
|
|
4
|
-
import { AgentRunPickSchema } from "../agent.js";
|
|
5
|
-
|
|
6
|
-
// Nothing is verified inside a conversation any more: a turn ends when the model says it is done, its work lands, and
|
|
7
|
-
// the main tree's own check runs afterwards, off everyone's clock, one project at a time. This is that check as the
|
|
8
|
-
// editor reads it: what is being measured, what is waiting, what the last run said, and who is working on a red one.
|
|
9
|
-
|
|
10
|
-
export const MainlineLandSchema = z.object({
|
|
11
|
-
conversationId: z.string().describe("The conversation whose work landed."),
|
|
12
|
-
title: z.string().optional().describe("Its title when it landed."),
|
|
13
|
-
at: z.number().describe("When the land asked for the check, in milliseconds."),
|
|
14
|
-
});
|
|
15
|
-
export type MainlineLand = z.infer<typeof MainlineLandSchema>;
|
|
16
|
-
|
|
17
|
-
// A land a red is laid at, as a reader names it.
|
|
18
|
-
export const MainlineLandRefSchema = z.object({
|
|
19
|
-
conversationId: z.string().describe("The conversation whose work landed."),
|
|
20
|
-
title: z.string().optional().describe("Its title when it landed."),
|
|
21
|
-
});
|
|
22
|
-
export type MainlineLandRef = z.infer<typeof MainlineLandRefSchema>;
|
|
23
|
-
|
|
24
|
-
// One failure a run named, split the way a reader scans it.
|
|
25
|
-
export const MainlineFailureSchema = z.object({
|
|
26
|
-
name: z.string().describe("What failed: a test by its own name, anything else (a type error, a whole task) as the check printed it."),
|
|
27
|
-
path: z.string().optional().describe("The repository path it failed in, when it names one."),
|
|
28
|
-
});
|
|
29
|
-
export type MainlineFailure = z.infer<typeof MainlineFailureSchema>;
|
|
30
|
-
|
|
31
|
-
// What happened to a red verdict's failures, decided once the lands behind it had their own check.
|
|
32
|
-
export const MainlineRoutingKindSchema = z.enum([
|
|
33
|
-
// More work landed while this ran; the check that measures it decides, so nobody is sent after a failure it may fix.
|
|
34
|
-
"waiting",
|
|
35
|
-
// A conversation still working touches what failed; nobody else is started until it stops.
|
|
36
|
-
"held",
|
|
37
|
-
// Sent back to the conversation that landed it, which still had the work in mind.
|
|
38
|
-
"original",
|
|
39
|
-
// A fresh conversation was started on it with the failures, the suspects' changes and where to read their sessions.
|
|
40
|
-
"fix-up",
|
|
41
|
-
// Nobody was sent: repairs are switched off, or no conversation could take it. An automation may.
|
|
42
|
-
"reported",
|
|
43
|
-
// Gone at the next check, before anybody was sent.
|
|
44
|
-
"resolved",
|
|
45
|
-
// The sends and fresh attempts a red streak allows are used up; it waits for a person.
|
|
46
|
-
"spent",
|
|
47
|
-
// A person set findings aside as not to be fixed (`findings` names which); what a push left is the owner's to dismiss.
|
|
48
|
-
"dismissed",
|
|
49
|
-
]);
|
|
50
|
-
export type MainlineRoutingKind = z.infer<typeof MainlineRoutingKindSchema>;
|
|
51
|
-
|
|
52
|
-
export const MainlineRoutingSchema = z.object({
|
|
53
|
-
kind: MainlineRoutingKindSchema.describe("What became of the failures."),
|
|
54
|
-
conversationId: z
|
|
55
|
-
.string()
|
|
56
|
-
.optional()
|
|
57
|
-
.describe("The conversation working on them (the original or a fresh one), or the one still working that the repair waits for."),
|
|
58
|
-
at: z.number().describe("When that was decided, in milliseconds."),
|
|
59
|
-
detail: z.string().optional().describe("One sentence on why, in the sandbox's words."),
|
|
60
|
-
findings: z
|
|
61
|
-
.array(z.string())
|
|
62
|
-
.optional()
|
|
63
|
-
.describe("The findings it was about, by id, when it was about some of a red's findings rather than the whole red."),
|
|
64
|
-
});
|
|
65
|
-
export type MainlineRouting = z.infer<typeof MainlineRoutingSchema>;
|
|
66
|
-
|
|
67
|
-
// The first failures a run names; the whole list stays in its terminal.
|
|
68
|
-
export const MAINLINE_FAILURES_KEPT = 30;
|
|
69
|
-
|
|
70
|
-
export const MainlineRunSchema = z.object({
|
|
71
|
-
project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
|
|
72
|
-
command: z.string().describe("What ran."),
|
|
73
|
-
status: z.enum(["green", "red"]).describe("How it ended."),
|
|
74
|
-
startedAt: z.number().describe("When it started, in milliseconds."),
|
|
75
|
-
at: z.number().describe("When it ended, in milliseconds."),
|
|
76
|
-
lands: z.array(MainlineLandSchema).describe("The lands it answered for, oldest first. Empty for a run no land asked for."),
|
|
77
|
-
failures: z.array(z.string()).describe(`The first failures it named, at most ${MAINLINE_FAILURES_KEPT}.`),
|
|
78
|
-
failureCount: z.number().describe("How many failures it named in all. Zero on a red run that wrote no list."),
|
|
79
|
-
attempt: z.number().describe("How many red runs in a row this is for the project; zero when green."),
|
|
80
|
-
suspects: z
|
|
81
|
-
.array(z.string())
|
|
82
|
-
.optional()
|
|
83
|
-
.describe("The conversations whose lands these failures were laid at, when any could be named."),
|
|
84
|
-
named: z
|
|
85
|
-
.boolean()
|
|
86
|
-
.optional()
|
|
87
|
-
.describe(
|
|
88
|
-
"Whether the failures were laid at the suspects by the paths they changed. False when nobody could be told apart (every land the run covered is a suspect) or nothing new failed in it (none is). Absent on green, and from a daemon that did not say.",
|
|
89
|
-
),
|
|
90
|
-
units: z
|
|
91
|
-
.array(MainlineFailureSchema)
|
|
92
|
-
.optional()
|
|
93
|
-
.describe("The same first failures, split into a name and the path they failed in. Absent from a daemon that does not split them."),
|
|
94
|
-
routing: MainlineRoutingSchema.optional().describe("What became of a red run's failures. Absent on green, and until it is decided."),
|
|
95
|
-
});
|
|
96
|
-
export type MainlineRun = z.infer<typeof MainlineRunSchema>;
|
|
97
|
-
|
|
98
|
-
export const MainlineProjectSchema = z.object({
|
|
99
|
-
project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
|
|
100
|
-
running: z
|
|
101
|
-
.object({
|
|
102
|
-
command: z.string().describe("What is running."),
|
|
103
|
-
startedAt: z.number().describe("When it started, in milliseconds."),
|
|
104
|
-
lands: z.array(MainlineLandSchema).describe("The lands it answers for."),
|
|
105
|
-
on: z.string().optional().describe("The runner it was sent to, on one of your machines. Absent when it runs in this sandbox."),
|
|
106
|
-
})
|
|
107
|
-
.optional()
|
|
108
|
-
.describe("The check running on it now, if any."),
|
|
109
|
-
session: z
|
|
110
|
-
.string()
|
|
111
|
-
.optional()
|
|
112
|
-
.describe("The terminal session its check runs in, running or last, to attach to for the whole log. Absent from a daemon that does not say."),
|
|
113
|
-
queued: z.array(MainlineLandSchema).describe("Lands waiting for the next check, which will measure them together."),
|
|
114
|
-
last: MainlineRunSchema.optional().describe("Its most recent settled check."),
|
|
115
|
-
redSince: z.number().optional().describe("When its checks went red and stayed so, in milliseconds. Absent while green."),
|
|
116
|
-
red: z
|
|
117
|
-
.object({
|
|
118
|
-
since: z.number().describe("When its checks went red and stayed so, in milliseconds."),
|
|
119
|
-
cause: z
|
|
120
|
-
.array(MainlineLandRefSchema)
|
|
121
|
-
.describe("The work this red is laid at, oldest first: the lands its failures were laid at on the latest run of the streak that could name any. Empty when none could be."),
|
|
122
|
-
named: z.boolean().describe("Whether `cause` was narrowed by the paths the lands changed; false when it is every land the run covered."),
|
|
123
|
-
fixer: MainlineRoutingSchema.optional().describe("The latest decision about who has it. Absent until one is made."),
|
|
124
|
-
})
|
|
125
|
-
.optional()
|
|
126
|
-
.describe("The red streak it is in, as the sandbox laid it. Absent while green, and from a daemon that does not lay it."),
|
|
127
|
-
});
|
|
128
|
-
export type MainlineProject = z.infer<typeof MainlineProjectSchema>;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// WHAT A PUSH LEFT BEHIND. The pre-push hook never refuses (verify-push.mjs, `--advisory`): it measures, reports, and the
|
|
132
|
-
// push goes. What it found used to vanish with the terminal it printed to. It now leaves a report in the repository's
|
|
133
|
-
// git dir, the daemon files it once the push has actually reached the remote, and what it found is owed, as the
|
|
134
|
-
// project's push Red, until a later measurement no longer prints it or somebody dismisses it. Nobody is sent after it:
|
|
135
|
-
// acting on it is the owner's call (RED_POLICY).
|
|
136
|
-
|
|
137
|
-
// ONE FINDING, whatever measured it: a check run's line as the repository's own tooling printed it, named by what
|
|
138
|
-
// printed it (`source`, the repository's word: a check's id, `lint`, a hook), with the command that shows it again and
|
|
139
|
-
// whether a later measurement can say it is gone. A push's findings are these; a land check's failures and a CI run's
|
|
140
|
-
// failed jobs become them too.
|
|
141
|
-
export const FindingSchema = z.object({
|
|
142
|
-
id: z.string().describe("Stable across measurements: the same problem found again is the same id."),
|
|
143
|
-
source: z.string().describe("What measured it, in the repository's own words: a check's id, `lint`, a hook."),
|
|
144
|
-
text: z.string().describe("The finding as it was printed."),
|
|
145
|
-
path: z.string().optional().describe("The repository path it is about, when it names one."),
|
|
146
|
-
command: z.string().optional().describe("The command that shows it again."),
|
|
147
|
-
recheckable: z
|
|
148
|
-
.boolean()
|
|
149
|
-
.describe("Whether a later measurement can find it gone. False for one about commits already made, which ends only when dismissed."),
|
|
150
|
-
gate: z
|
|
151
|
-
.enum(["code", "tidy"])
|
|
152
|
-
.optional()
|
|
153
|
-
.describe("For a check's finding: `code` means the tree fails the check whoever caused it; `tidy` means the change measured added this line."),
|
|
154
|
-
commit: z
|
|
155
|
-
.object({ sha: z.string(), subject: z.string() })
|
|
156
|
-
.optional()
|
|
157
|
-
.describe("The newest commit of the change measured that touched the path it names, when it names one."),
|
|
158
|
-
});
|
|
159
|
-
export type Finding = z.infer<typeof FindingSchema>;
|
|
160
|
-
|
|
161
|
-
// ONE RED, whatever went red: a land check's project, what a push left in a project, main's CI on a branch. What it owes
|
|
162
|
-
// (its findings), who it was laid at and whether that was narrowed, and every decision about it, oldest first. Each
|
|
163
|
-
// source answers its own red by its own policy (RED_POLICY); the record is the same.
|
|
164
|
-
export const RedSourceSchema = z.enum(["land", "push", "ci"]);
|
|
165
|
-
export type RedSource = z.infer<typeof RedSourceSchema>;
|
|
166
|
-
|
|
167
|
-
// Who answers a red: `route` sends it itself (the land check's router, conversations/land/land-breakage.ts), `owner`
|
|
168
|
-
// waits for a person's press (what a push left, conversations/fix/push-fix.ts), `fix-agent` starts the source's own fix
|
|
169
|
-
// agent once the red is main's standing word (CI, ci/repair-gate.ts).
|
|
170
|
-
export const RED_POLICY = { land: "route", push: "owner", ci: "fix-agent" } as const satisfies Record<RedSource, "route" | "owner" | "fix-agent">;
|
|
171
|
-
|
|
172
|
-
export const RedSchema = z.object({
|
|
173
|
-
source: RedSourceSchema.describe("What went red."),
|
|
174
|
-
scope: z.string().describe("Where: a project's folder, or a repository and branch."),
|
|
175
|
-
since: z.number().describe("When the red streak began (state/red-streak.ts)."),
|
|
176
|
-
findings: z.array(FindingSchema).default([]).describe("What it owes, as the red's own measurement named it."),
|
|
177
|
-
suspects: z.array(z.string()).default([]).describe("The conversations it was laid at."),
|
|
178
|
-
named: z.boolean().default(false).describe("Whether the paths they changed narrowed it to them."),
|
|
179
|
-
decisions: z.array(MainlineRoutingSchema).default([]).describe("What was decided about it, oldest first."),
|
|
180
|
-
});
|
|
181
|
-
export type Red = z.infer<typeof RedSchema>;
|
|
182
|
-
|
|
183
|
-
// 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
|
|
184
|
-
// still owed is the project's push Red's to say (`findings`), never the push's.
|
|
185
|
-
export const MainlinePushSchema = z.object({
|
|
186
|
-
project: z.string().describe("Which project, by folder relative to the workspace. Empty is the workspace root."),
|
|
187
|
-
id: z.string().describe("The report's own id."),
|
|
188
|
-
at: z.number().describe("When the push check ran, in milliseconds."),
|
|
189
|
-
remote: z.string().optional().describe("The remote it was pushed to."),
|
|
190
|
-
branch: z.string().optional().describe("The branch it was pushed to."),
|
|
191
|
-
base: z.string().optional().describe("The commit the pushed range starts from; absent when the remote had nothing to compare with."),
|
|
192
|
-
head: z.string().describe("The commit that was pushed."),
|
|
193
|
-
commits: z.number().describe("How many commits the push carried."),
|
|
194
|
-
findings: z
|
|
195
|
-
.array(FindingSchema)
|
|
196
|
-
.describe("What it found that this push brought in, less what an earlier push had already left open. Empty for a clean push."),
|
|
197
|
-
refused: z
|
|
198
|
-
.boolean()
|
|
199
|
-
.optional()
|
|
200
|
-
.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."),
|
|
201
|
-
});
|
|
202
|
-
export type MainlinePush = z.infer<typeof MainlinePushSchema>;
|
|
203
|
-
|
|
204
|
-
export const MainlineStatusSchema = z.object({
|
|
205
|
-
projects: z.array(MainlineProjectSchema).describe("Every project a land has been checked in, or is waiting to be."),
|
|
206
|
-
recent: z.array(MainlineRunSchema).describe("The latest settled checks across every project, newest first."),
|
|
207
|
-
pushed: z
|
|
208
|
-
.array(MainlinePushSchema)
|
|
209
|
-
.optional()
|
|
210
|
-
.describe("The latest pushes the hook measured across every project, newest first, with what each brought in. Absent from a daemon that records none."),
|
|
211
|
-
reds: z
|
|
212
|
-
.array(RedSchema)
|
|
213
|
-
.optional()
|
|
214
|
-
.describe(
|
|
215
|
-
"Every red the main line holds, one record whatever went red: each red project's land check and what pushes left in each project, with what each owes and every decision about it. Absent from a daemon that keeps none.",
|
|
216
|
-
),
|
|
217
|
-
});
|
|
218
|
-
export type MainlineStatus = z.infer<typeof MainlineStatusSchema>;
|
|
219
|
-
|
|
220
|
-
export const MainlinePushDismissSchema = z.object({
|
|
221
|
-
project: z.string().describe("Which project, by folder relative to the workspace."),
|
|
222
|
-
ids: z.array(z.string()).optional().describe("Which findings. Leave it out for every open one in the project."),
|
|
223
|
-
restore: z.boolean().optional().describe("Undo: open the named dismissed findings again."),
|
|
224
|
-
});
|
|
225
|
-
export type MainlinePushDismiss = z.infer<typeof MainlinePushDismissSchema>;
|
|
226
|
-
|
|
227
|
-
export const MainlinePushDismissResultSchema = z.object({
|
|
228
|
-
changed: z.number().describe("How many findings changed state."),
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
export const MainlinePushRecheckSchema = z.object({
|
|
232
|
-
project: z.string().describe("Which project, by folder relative to the workspace."),
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
export const MainlinePushRecheckResultSchema = z.object({
|
|
236
|
-
measured: z.boolean().describe("Whether the project could be measured at all; false leaves every finding as it was."),
|
|
237
|
-
resolved: z.number().describe("How many findings the measurement no longer saw."),
|
|
238
|
-
open: z.number().describe("How many are still open."),
|
|
239
|
-
});
|
|
240
|
-
export type MainlinePushRecheckResult = z.infer<typeof MainlinePushRecheckResultSchema>;
|
|
241
|
-
|
|
242
|
-
export const MainlinePushFixSchema = z.object({
|
|
243
|
-
project: z.string().describe("Which project's open push findings to hand over, by folder relative to the workspace."),
|
|
244
|
-
pick: AgentRunPickSchema.describe(
|
|
245
|
-
"Which model to open the conversation on, when somebody chose one. Leave it out for the sandbox's own choice.",
|
|
246
|
-
),
|
|
247
|
-
mode: z
|
|
248
|
-
.enum(["continue", "start-over"])
|
|
249
|
-
.optional()
|
|
250
|
-
.describe(
|
|
251
|
-
"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.",
|
|
252
|
-
),
|
|
253
|
-
});
|
|
254
|
-
export type MainlinePushFix = z.infer<typeof MainlinePushFixSchema>;
|
|
255
|
-
|
|
256
|
-
export const MainlinePushFixResultSchema = z.object({
|
|
257
|
-
conversationId: z.string().describe("The conversation holding the findings. Open it to watch."),
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
// What pushes left in `project`, as the reds name it; undefined while nothing is owed.
|
|
261
|
-
export const pushRedOf = (reds: readonly Red[] | undefined, project: string): Red | undefined =>
|
|
262
|
-
reds?.find((red) => red.source === "push" && red.scope === project);
|
|
263
|
-
|
|
264
|
-
// The conversation id a hand-over of a push red wears (attempt 1), derived from when the red began, so the editor and the
|
|
265
|
-
// daemon agree on whether an agent is already on it: pressing again while anything is owed continues the same attempt,
|
|
266
|
-
// and a red that begins after everything was handled starts a fresh one. Undefined when nothing is owed.
|
|
267
|
-
export const pushFixBase = (red: Pick<Red, "scope" | "since"> | undefined): string | undefined =>
|
|
268
|
-
red === undefined ? undefined : pushFixConversationId(red.scope === "" ? "workspace" : red.scope, `red:${red.since}`);
|