flowviant 0.116.0 → 0.124.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 +66 -12
- package/bin/cli.mjs +50 -17
- package/bin/lib/admission.mjs +7 -14
- package/bin/lib/agentAsk.mjs +123 -0
- package/bin/lib/agentBrief.mjs +36 -0
- package/bin/lib/agentFootprint.mjs +76 -0
- package/bin/lib/agentInternalWait.mjs +83 -0
- package/bin/lib/agentPlan.mjs +134 -31
- package/bin/lib/agentPrerequisiteContract.mjs +43 -0
- package/bin/lib/agentPublish.mjs +12 -13
- package/bin/lib/agentTaskKinds.mjs +5 -8
- package/bin/lib/agySessions.mjs +3 -3
- package/bin/lib/artifactContracts.mjs +91 -20
- package/bin/lib/artifactIteration.mjs +182 -0
- package/bin/lib/artifactPreview.mjs +92 -18
- package/bin/lib/artifactRecovery.mjs +36 -0
- package/bin/lib/artifactReporter.mjs +194 -22
- package/bin/lib/artifacts.mjs +70 -63
- package/bin/lib/authproxy.mjs +2 -1
- package/bin/lib/childEnv.mjs +9 -4
- package/bin/lib/claude.mjs +10 -20
- package/bin/lib/claudeAuth.mjs +15 -5
- package/bin/lib/claudePersonal.mjs +71 -6
- package/bin/lib/claudePosture.mjs +227 -54
- package/bin/lib/claudeSessions.mjs +7 -7
- package/bin/lib/claudeStream.mjs +27 -13
- package/bin/lib/cliLimit.mjs +2 -2
- package/bin/lib/codexHome.mjs +17 -0
- package/bin/lib/codexPersonal.mjs +44 -3
- package/bin/lib/codexProjectRead.mjs +63 -0
- package/bin/lib/codexRelay.mjs +21 -5
- package/bin/lib/codexResearch.mjs +193 -0
- package/bin/lib/commandSpecs.mjs +6 -0
- package/bin/lib/config.mjs +37 -24
- package/bin/lib/conversationIds.mjs +51 -0
- package/bin/lib/credentials.mjs +2 -7
- package/bin/lib/daemonLocks.mjs +90 -0
- package/bin/lib/daemonState.mjs +5 -5
- package/bin/lib/deploy.mjs +6 -9
- package/bin/lib/deployCheckout.mjs +26 -22
- package/bin/lib/deployRunner.mjs +54 -18
- package/bin/lib/deployWire.mjs +32 -23
- package/bin/lib/desktopContract.mjs +6 -5
- package/bin/lib/discoveryContract.mjs +19 -0
- package/bin/lib/env.mjs +104 -35
- package/bin/lib/fleet.mjs +53 -13
- package/bin/lib/fleetPost.mjs +172 -25
- package/bin/lib/fleetReports.mjs +172 -171
- package/bin/lib/fleetStartup.mjs +6 -6
- package/bin/lib/fleetWire.mjs +42 -0
- package/bin/lib/git.mjs +111 -61
- package/bin/lib/gitMergeIdentity.mjs +2 -8
- package/bin/lib/grant.mjs +23 -7
- package/bin/lib/holder.mjs +108 -81
- package/bin/lib/hooks/mcpAllow.mjs +60 -0
- package/bin/lib/hooks/readGuard.mjs +54 -11
- package/bin/lib/imageArtifact.mjs +74 -0
- package/bin/lib/install.mjs +80 -33
- package/bin/lib/instance.mjs +36 -83
- package/bin/lib/intakeDraft.mjs +4 -1
- package/bin/lib/knowledgeFileSync.mjs +31 -0
- package/bin/lib/knowledgeFiles.mjs +28 -83
- package/bin/lib/landed.mjs +22 -29
- package/bin/lib/launchCommand.mjs +91 -0
- package/bin/lib/listeners.mjs +0 -5
- package/bin/lib/localSessions.mjs +52 -39
- package/bin/lib/login.mjs +22 -12
- package/bin/lib/loginPath.mjs +22 -17
- package/bin/lib/machineListing.mjs +6 -3
- package/bin/lib/maintenance.mjs +47 -0
- package/bin/lib/maintenanceInventory.mjs +39 -0
- package/bin/lib/mcp-cli.mjs +9 -10
- package/bin/lib/mcpInstall.mjs +163 -0
- package/bin/lib/mcpInventory.mjs +119 -0
- package/bin/lib/noWindowEnv.mjs +23 -3
- package/bin/lib/ownedDirs.mjs +99 -0
- package/bin/lib/pinnedCapture.mjs +383 -0
- package/bin/lib/planDependencies.mjs +70 -0
- package/bin/lib/postureTools.mjs +85 -0
- package/bin/lib/prWorkflow.mjs +94 -17
- package/bin/lib/preflight.mjs +8 -25
- package/bin/lib/preview.mjs +19 -25
- package/bin/lib/previewGatePolicy.mjs +34 -9
- package/bin/lib/previewRegistry.mjs +4 -11
- package/bin/lib/printable.mjs +70 -7
- package/bin/lib/procRegistry.mjs +33 -13
- package/bin/lib/procScan.mjs +2 -3
- package/bin/lib/procStat.mjs +76 -0
- package/bin/lib/processGroup.mjs +48 -0
- package/bin/lib/processes.mjs +10 -24
- package/bin/lib/projectToolRuntimes.mjs +328 -19
- package/bin/lib/projectTools.mjs +109 -34
- package/bin/lib/prompts.mjs +205 -60
- package/bin/lib/repoPath.mjs +19 -0
- package/bin/lib/repoState.mjs +17 -19
- package/bin/lib/repositoryBaseline.mjs +68 -0
- package/bin/lib/runTurn.mjs +286 -209
- package/bin/lib/runtimeAntigravity.mjs +16 -5
- package/bin/lib/runtimeCapabilities.mjs +215 -21
- package/bin/lib/runtimeClaude.mjs +78 -10
- package/bin/lib/runtimeCodex.mjs +217 -209
- package/bin/lib/runtimeDetection.mjs +8 -2
- package/bin/lib/runtimeEvents.mjs +28 -11
- package/bin/lib/runtimeLimits.mjs +5 -6
- package/bin/lib/runtimeOfferings.mjs +99 -14
- package/bin/lib/runtimes.mjs +10 -0
- package/bin/lib/shipSweep.mjs +5 -3
- package/bin/lib/shot.mjs +91 -17
- package/bin/lib/sleep.mjs +11 -0
- package/bin/lib/startProject.mjs +5 -5
- package/bin/lib/statePaths.mjs +40 -0
- package/bin/lib/tty.mjs +25 -15
- package/bin/lib/turnDiagnostics.mjs +93 -0
- package/bin/lib/turnLock.mjs +7 -14
- package/bin/lib/turnProfile.mjs +16 -4
- package/bin/lib/ui.mjs +0 -3
- package/bin/lib/uninstall.mjs +30 -26
- package/bin/lib/update.mjs +79 -27
- package/bin/lib/uplinkScrub.mjs +296 -31
- package/bin/lib/vault.mjs +78 -10
- package/bin/lib/vaultDiff.mjs +5 -2
- package/bin/lib/views.mjs +37 -12
- package/bin/lib/wikiRunner.mjs +40 -61
- package/bin/lib/work.mjs +44 -13
- package/bin/lib/workAdoptCarry.mjs +2 -4
- package/bin/lib/workAgentBrief.mjs +92 -0
- package/bin/lib/workAgentBriefRunner.mjs +59 -0
- package/bin/lib/workAgentCheck.mjs +104 -57
- package/bin/lib/workAgentMerges.mjs +62 -57
- package/bin/lib/workAgentPlans.mjs +82 -199
- package/bin/lib/workAgentPrecheck.mjs +76 -138
- package/bin/lib/workAgentPublish.mjs +6 -8
- package/bin/lib/workAgentTurnBegun.mjs +15 -11
- package/bin/lib/workAgentTurnExecution.mjs +131 -67
- package/bin/lib/workAgentTurnOutcome.mjs +11 -2
- package/bin/lib/workAgentTurnReports.mjs +9 -37
- package/bin/lib/workAgentTurns.mjs +64 -7
- package/bin/lib/workArtifactReconcile.mjs +79 -0
- package/bin/lib/workAttachments.mjs +66 -11
- package/bin/lib/workBrain.mjs +9 -4
- package/bin/lib/workCappedTurn.mjs +119 -0
- package/bin/lib/workChildren.mjs +5 -5
- package/bin/lib/workCommandAudit.mjs +18 -2
- package/bin/lib/workDiffs.mjs +52 -6
- package/bin/lib/workIntake.mjs +35 -60
- package/bin/lib/workPlaceReports.mjs +7 -4
- package/bin/lib/workPlaces.mjs +113 -31
- package/bin/lib/workPreviews.mjs +47 -112
- package/bin/lib/workProcesses.mjs +8 -35
- package/bin/lib/workPullRequests.mjs +37 -56
- package/bin/lib/workReportQueue.mjs +100 -148
- package/bin/lib/workRetire.mjs +2 -1
- package/bin/lib/workSessionRuntime.mjs +38 -37
- package/bin/lib/workSessionTurns.mjs +256 -199
- package/bin/lib/workShip.mjs +43 -23
- package/bin/lib/workToolLog.mjs +70 -3
- package/bin/lib/workTurnShape.mjs +165 -0
- package/npm-shrinkwrap.json +69 -0
- package/package.json +9 -4
- package/bin/lib/fleetJobs.mjs +0 -120
- package/bin/lib/patchRevert.mjs +0 -60
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* is parsed, scrubbed and re-sent), the project check for SECURITY ones. The
|
|
8
8
|
* review entry beat sequences the two and owns neither.
|
|
9
9
|
*/
|
|
10
|
-
import { FLEET_URL
|
|
11
|
-
import {
|
|
10
|
+
import { FLEET_URL } from './config.mjs';
|
|
11
|
+
import { gitOrNull } from './git.mjs';
|
|
12
12
|
import { parsePrecheck } from './agentPlan.mjs';
|
|
13
13
|
import { readStash } from './agentCards.mjs';
|
|
14
14
|
import { c, note } from './ui.mjs';
|
|
@@ -16,10 +16,11 @@ import { runTurn } from './runTurn.mjs';
|
|
|
16
16
|
import { SYSTEM_PRECHECK, AGENT_PRECHECK_KICKOFF } from './prompts.mjs';
|
|
17
17
|
import { scrub as envScrub } from './uplinkScrub.mjs';
|
|
18
18
|
import { pickRuntimeFor } from './runtimeDetection.mjs';
|
|
19
|
-
import {
|
|
19
|
+
import { runCappedTurn } from './workCappedTurn.mjs';
|
|
20
20
|
import { taskIdsFromMessage } from './worktreeDiff.mjs';
|
|
21
21
|
import { limitLine } from './cliLimit.mjs';
|
|
22
|
-
import { fleetEndpoint } from './fleetWire.mjs';
|
|
22
|
+
import { fleetEndpoint, isConsideredRefusal } from './fleetWire.mjs';
|
|
23
|
+
import { postFleetJson } from './fleetPost.mjs';
|
|
23
24
|
import { agentBrowserHome } from './noWindowEnv.mjs';
|
|
24
25
|
|
|
25
26
|
export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workChildren }) {
|
|
@@ -38,7 +39,8 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
38
39
|
// meets the card it answers from the very context that produced the work. The
|
|
39
40
|
// reviewer stands IN the agent's worktree because it needs the code and the
|
|
40
41
|
// diff, under the `consult` profile (`consultPermFor` — the fenced Read/Glob rules plus
|
|
41
|
-
// a few
|
|
42
|
+
// a few shell readers; the `git` ones are fenced by the read guard's refusal,
|
|
43
|
+
// hooks/readGuard.mjs, not by the CLI) with NO MCP passed at all, so there is no
|
|
42
44
|
// control plane on this turn even if the repository it reads tries to steer
|
|
43
45
|
// it.
|
|
44
46
|
//
|
|
@@ -94,20 +96,8 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
94
96
|
*/
|
|
95
97
|
const postPre = async (body) => {
|
|
96
98
|
try {
|
|
97
|
-
const res = await
|
|
98
|
-
|
|
99
|
-
headers: {
|
|
100
|
-
Authorization: `Bearer ${FLEET_TOKEN}`,
|
|
101
|
-
'User-Agent': USER_AGENT,
|
|
102
|
-
'Content-Type': 'application/json',
|
|
103
|
-
},
|
|
104
|
-
signal: AbortSignal.timeout(30_000),
|
|
105
|
-
body: JSON.stringify(body),
|
|
106
|
-
});
|
|
107
|
-
return (
|
|
108
|
-
res.ok ||
|
|
109
|
-
(res.status >= 400 && res.status < 500 && res.status !== 408 && res.status !== 429)
|
|
110
|
-
);
|
|
99
|
+
const res = await postFleetJson(AGENT_PRECHECK_URL, body, { timeoutMs: 30_000 });
|
|
100
|
+
return res.ok || isConsideredRefusal(res.status);
|
|
111
101
|
} catch {
|
|
112
102
|
return false; // a blip — worth one more attempt at a model call's answer
|
|
113
103
|
}
|
|
@@ -127,13 +117,8 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
127
117
|
* review-entry beat it is standing in.
|
|
128
118
|
*/
|
|
129
119
|
const branchLog = (wt) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
out = git(['log', '--format=%s%n%b%n--', `${baseRef()}..HEAD`, '--not', baseRef()], wt);
|
|
133
|
-
} catch {
|
|
134
|
-
return { text: '', taskIds: [] };
|
|
135
|
-
}
|
|
136
|
-
if (typeof out !== 'string') return { text: '', taskIds: [] };
|
|
120
|
+
const out = gitOrNull(['log', '--format=%s%n%b%n--', `${baseRef()}..HEAD`, '--not', baseRef()], wt);
|
|
121
|
+
if (out == null) return { text: '', taskIds: [] };
|
|
137
122
|
// LINEAR, never backtracking (audit 2026-09-24) — this was
|
|
138
123
|
// `out.matchAll(/^\s*Flowviant-Task:\s*(\S+)\s*$/gm)`, whose `\s*$` is
|
|
139
124
|
// quadratic against a long trailing run of whitespace on one line
|
|
@@ -178,12 +163,7 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
178
163
|
// `checkFingerprint` shape, so a commit landing after this voids it rather
|
|
179
164
|
// than letting an old reading label a branch it never saw. Optional: an
|
|
180
165
|
// unreadable head costs the staleness comparison, not the precheck.
|
|
181
|
-
|
|
182
|
-
try {
|
|
183
|
-
headSha = (git(['rev-parse', 'HEAD'], wt) || '').trim() || null;
|
|
184
|
-
} catch {
|
|
185
|
-
headSha = null;
|
|
186
|
-
}
|
|
166
|
+
const headSha = gitOrNull(['rev-parse', 'HEAD'], wt);
|
|
187
167
|
|
|
188
168
|
const stash = readStash(sessionMetaPath(wt, 'flowviant-agent-cards', agentId));
|
|
189
169
|
const log = branchLog(wt);
|
|
@@ -193,8 +173,6 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
193
173
|
const missingSpecs = log.taskIds.filter((id) => !held.has(id)).length;
|
|
194
174
|
|
|
195
175
|
let out = '';
|
|
196
|
-
let child = null;
|
|
197
|
-
let timer = null;
|
|
198
176
|
/** The cap fired: the CLI was still running when this machine stopped it. */
|
|
199
177
|
let wedged = false;
|
|
200
178
|
/**
|
|
@@ -202,8 +180,8 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
202
180
|
* other lane that charges an AGENT (2026-09-19).
|
|
203
181
|
*
|
|
204
182
|
* It rides the agent and never a card link: a pre-review belongs to no card
|
|
205
|
-
* (the same reason `workChildren`
|
|
206
|
-
* counters it adds to are the container's alone. That is also why an
|
|
183
|
+
* (the same reason its `workChildren` entry carries a null task id), so the
|
|
184
|
+
* four counters it adds to are the container's alone. That is also why an
|
|
207
185
|
* agent's links can never sum to its total, and the schema says so.
|
|
208
186
|
*
|
|
209
187
|
* A WEDGED OR UNPARSEABLE READING POSTS NOTHING AT ALL, so it charges
|
|
@@ -212,116 +190,71 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
212
190
|
* settle to carry a number would be a post whose only content is a bill.
|
|
213
191
|
*/
|
|
214
192
|
let usage = null;
|
|
215
|
-
/**
|
|
216
|
-
* THE CONVERSATION THIS READING SPEAKS UNDER — held for exactly one reason:
|
|
217
|
-
* to DELETE the transcript it leaves behind (review, 2026-09-17).
|
|
218
|
-
*
|
|
219
|
-
* This is the first thing in the daemon to run a second `claude -p` inside
|
|
220
|
-
* an AGENT's worktree, and the agent's own resume is `--continue`, which is
|
|
221
|
-
* CWD-KEYED — the invariant `runAgentTurn` states in words ("ONE AGENT IS
|
|
222
|
-
* ONE DIRECTORY, so the CLI's own cwd-keyed resume is exactly right here").
|
|
223
|
-
* Leaving this turn's `~/.claude/projects/<munged-cwd>/<id>.jsonl` in place
|
|
224
|
-
* makes the read-only stranger the newest conversation in that directory,
|
|
225
|
-
* so the agent's NEXT turn — a send-back's re-queued card, a merge-resolve,
|
|
226
|
-
* a human's typed answer — resumes "you are a SECOND reviewer… YOU ARE
|
|
227
|
-
* READ-ONLY" instead of its own four-turn context, under build permissions.
|
|
228
|
-
* That is the 0.69.0 Workbench cross-resume and codex's `resume --last`,
|
|
229
|
-
* arriving a third time by a third route.
|
|
230
|
-
*
|
|
231
|
-
* `removeProbeTranscript` is exported for precisely this and already serves
|
|
232
|
-
* the skills probe and the dev-command resolver.
|
|
233
|
-
*/
|
|
234
|
-
let preSession = null;
|
|
235
193
|
try {
|
|
236
194
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
195
|
+
* ONE CAPPED CONSULT TURN (workCappedTurn.mjs), the planner's and
|
|
196
|
+
* intake's shape: the child registered and removed on every exit, the
|
|
197
|
+
* reservation released at the spawn, the cap armed at the spawn and
|
|
198
|
+
* resolving the wait itself — this promise is inside the place's writer
|
|
199
|
+
* lock — and THIS READING'S TRANSCRIPT REMOVED FROM THE WORKTREE
|
|
200
|
+
* (review, 2026-09-17).
|
|
201
|
+
*
|
|
202
|
+
* This is the first thing in the daemon to run a second `claude -p`
|
|
203
|
+
* inside an AGENT's worktree, and the agent's own resume is
|
|
204
|
+
* `--continue`, which is CWD-KEYED — the invariant `runAgentTurn` states
|
|
205
|
+
* in words ("ONE AGENT IS ONE DIRECTORY, so the CLI's own cwd-keyed
|
|
206
|
+
* resume is exactly right here"). Leaving this turn's
|
|
207
|
+
* `~/.claude/projects/<munged-cwd>/<id>.jsonl` in place makes the
|
|
208
|
+
* read-only stranger the newest conversation in that directory, so the
|
|
209
|
+
* agent's NEXT turn — a send-back's re-queued card, a merge-resolve, a
|
|
210
|
+
* human's typed answer — resumes "you are a SECOND reviewer… YOU ARE
|
|
211
|
+
* READ-ONLY" instead of its own four-turn context, under build
|
|
212
|
+
* permissions. That is the 0.69.0 Workbench cross-resume and codex's
|
|
213
|
+
* `resume --last`, arriving a third time by a third route.
|
|
242
214
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// The CLI's own count for this reading. Set, never accumulated: one
|
|
279
|
-
// turn is one `result` event, and the adding-up is the server's.
|
|
280
|
-
// Tagged with the CLI, so a Claude pre-review of a Codex agent is
|
|
281
|
-
// charged as Claude's and not folded into the agent's own figure.
|
|
282
|
-
onUsage: (u) => {
|
|
283
|
-
usage = { ...u, runtime: rt };
|
|
215
|
+
({ out, wedged } = await runCappedTurn({
|
|
216
|
+
runTurn,
|
|
217
|
+
capMs: PRECHECK_TIMEOUT_MS,
|
|
218
|
+
workChildren,
|
|
219
|
+
releaseSlot,
|
|
220
|
+
transcriptCwd: wt,
|
|
221
|
+
turnArgs: {
|
|
222
|
+
prompt: AGENT_PRECHECK_KICKOFF({
|
|
223
|
+
agentName,
|
|
224
|
+
cards: stash.map((s) => s.prompt).join('\n---\n'),
|
|
225
|
+
missingSpecs,
|
|
226
|
+
commits: log.text,
|
|
227
|
+
diffCommand: `git diff ${baseRef()}...HEAD`,
|
|
228
|
+
}),
|
|
229
|
+
system: SYSTEM_PRECHECK,
|
|
230
|
+
// READ-ONLY, and no MCP: `mcpArgs` is omitted entirely rather than
|
|
231
|
+
// passed empty, so there is no control plane on this turn at all.
|
|
232
|
+
profile: 'consult',
|
|
233
|
+
cwd: wt,
|
|
234
|
+
runtime: rt,
|
|
235
|
+
// The agent's own browser profile, in the worktree this reader stands
|
|
236
|
+
// in; no display either way (noWindowEnv.mjs, 2026-09-29).
|
|
237
|
+
browserHome: agentBrowserHome(sessionMetaPath, wt, agentId),
|
|
238
|
+
// NO `resume`, AND THAT IS THE FEATURE. A resumed turn would be the
|
|
239
|
+
// agent grading its own homework out of its own context; this is a
|
|
240
|
+
// stranger reading a diff.
|
|
241
|
+
answerFromResult: true,
|
|
242
|
+
label: c.cyan('[pre-review]'),
|
|
243
|
+
// The CLI's own count for this reading. Set, never accumulated: one
|
|
244
|
+
// turn is one `result` event, and the adding-up is the server's.
|
|
245
|
+
// Tagged with the CLI, so a Claude pre-review of a Codex agent is
|
|
246
|
+
// charged as Claude's and not folded into the agent's own figure.
|
|
247
|
+
onUsage: (u) => {
|
|
248
|
+
usage = { ...u, runtime: rt };
|
|
249
|
+
},
|
|
284
250
|
},
|
|
285
|
-
|
|
286
|
-
child = ch;
|
|
287
|
-
// No task id: a pre-review belongs to no card, and the machine
|
|
288
|
-
// snapshot's per-task rows must not invent one. It still COUNTS
|
|
289
|
-
// against the machine's ceiling — see liveTurnCount.
|
|
290
|
-
workChildren.set(ch, null);
|
|
291
|
-
releaseSlot();
|
|
292
|
-
// ARMED AT THE SPAWN, not at entry: time spent getting here is not a
|
|
293
|
-
// wedged CLI. The CHILD and never its group — a read-only turn starts
|
|
294
|
-
// no server, so there is nothing behind it worth signalling and
|
|
295
|
-
// everything to lose by signalling somebody else's.
|
|
296
|
-
timer = setTimeout(() => {
|
|
297
|
-
wedged = true;
|
|
298
|
-
try {
|
|
299
|
-
ch.kill('SIGKILL');
|
|
300
|
-
} catch {
|
|
301
|
-
/* already gone */
|
|
302
|
-
}
|
|
303
|
-
stopWaiting('');
|
|
304
|
-
}, PRECHECK_TIMEOUT_MS);
|
|
305
|
-
timer.unref?.();
|
|
306
|
-
},
|
|
307
|
-
});
|
|
308
|
-
out = await Promise.race([turn, capped]);
|
|
251
|
+
}));
|
|
309
252
|
} catch {
|
|
310
253
|
return; // a label may never fail the beat it rides
|
|
311
254
|
} finally {
|
|
312
|
-
|
|
313
|
-
|
|
255
|
+
// The reservation this lane took itself, released on every exit — the
|
|
256
|
+
// turn's own release covers a spawn; this covers everything else.
|
|
314
257
|
releaseSlot();
|
|
315
|
-
/**
|
|
316
|
-
* DELETE THIS READING'S TRANSCRIPT, on EVERY exit — settled, wedged and
|
|
317
|
-
* killed, or thrown — because every one of them leaves the file behind
|
|
318
|
-
* and the agent's `--continue` reads the newest one in the directory.
|
|
319
|
-
*
|
|
320
|
-
* AFTER the kill and ON A DELAY, the skills probe's own shape: the
|
|
321
|
-
* transcript is the CHILD's file, so removing it while the child is still
|
|
322
|
-
* dying races a recreate. Unref'd — it must not hold the process open.
|
|
323
|
-
*/
|
|
324
|
-
if (preSession) setTimeout(() => removeProbeTranscript(wt, preSession), 750).unref?.();
|
|
325
258
|
}
|
|
326
259
|
|
|
327
260
|
// A WEDGED READING POSTS NOTHING. There is no row to settle and nobody
|
|
@@ -381,10 +314,15 @@ export function createWorkAgentPrecheck({ baseRef, admit, sessionMetaPath, workC
|
|
|
381
314
|
agentId,
|
|
382
315
|
...(headSha ? { headSha } : {}),
|
|
383
316
|
...(usage ? { usage } : {}),
|
|
317
|
+
// Named fields, never a spread of what the parser returned: a field it
|
|
318
|
+
// keeps must be passed on here as well. `criteria` rides beside the verdict
|
|
319
|
+
// and note (2026-10-10), and an older server strips it and draws the one
|
|
320
|
+
// row it always drew.
|
|
384
321
|
cards: result.cards.map((cd) => ({
|
|
385
322
|
taskId: cd.taskId,
|
|
386
323
|
verdict: cd.verdict,
|
|
387
324
|
...(cd.note ? { note: cd.note } : {}),
|
|
325
|
+
...(cd.criteria ? { criteria: cd.criteria } : {}),
|
|
388
326
|
})),
|
|
389
327
|
...(result.overall ? { overall: result.overall } : {}),
|
|
390
328
|
};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* begun-guard, the sweep keeps a published branch current, the merge lane
|
|
11
11
|
* retires the ref — all through the maps and two functions returned here.
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { gitOrNull, sessionBranchRef } from './git.mjs';
|
|
14
14
|
import { publishPushArgs, publishFetchArgs, publishErrorText } from './agentPublish.mjs';
|
|
15
15
|
import { scrub as envScrub } from './uplinkScrub.mjs';
|
|
16
16
|
|
|
@@ -67,13 +67,11 @@ export function createWorkAgentPublish({ repoRoot, gitNet }) {
|
|
|
67
67
|
* — which is a perfectly ordinary state (the begun-guard's whole subject) and
|
|
68
68
|
* means there is nothing to publish, never that a push failed. */
|
|
69
69
|
const agentBranchSha = (place) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
70
|
+
// The one branch-name definition (git.mjs): an unsafe place names no
|
|
71
|
+
// branch, which is the same "nothing to publish" as an absent one.
|
|
72
|
+
const ref = sessionBranchRef(place);
|
|
73
|
+
if (!ref) return null;
|
|
74
|
+
return gitOrNull(['rev-parse', '--verify', '--quiet', ref], repoRoot);
|
|
77
75
|
};
|
|
78
76
|
/**
|
|
79
77
|
* PUSH ONE AGENT'S BRANCH TO THE NAME THE SERVER GAVE IT.
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* through the one turn-done wire (workAgentTurnReports.mjs). Null means go on.
|
|
14
14
|
*/
|
|
15
15
|
import { existsSync } from 'node:fs';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { git, sessionBranchRef } from './git.mjs';
|
|
17
|
+
import { worktreePath } from './workPlaces.mjs';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* WORK THAT HAS BEGUN LIVES ON EXACTLY ONE BOX, AND THIS MAY NOT BE IT.
|
|
@@ -45,7 +45,11 @@ import { git } from './git.mjs';
|
|
|
45
45
|
* remedy somebody cannot carry out is worse than none.
|
|
46
46
|
*/
|
|
47
47
|
export function begunTurnRefusal(job, place, { baseDir, repoRoot, fetchPublishedBranch }) {
|
|
48
|
-
|
|
48
|
+
// The caller validated `place` (workAgentTurns); an unsafe one would give a
|
|
49
|
+
// null directory AND a null ref below, and the null ref stands the guard
|
|
50
|
+
// down — the same fail-open direction as an unreadable repo.
|
|
51
|
+
const wtDir = worktreePath(baseDir, place);
|
|
52
|
+
const ref = sessionBranchRef(place);
|
|
49
53
|
let hasBranch = false;
|
|
50
54
|
/**
|
|
51
55
|
* THREE STATES, AND THE MIDDLE ONE IS WHY THIS IS NOT A BARE CATCH.
|
|
@@ -63,14 +67,14 @@ export function begunTurnRefusal(job, place, { baseDir, repoRoot, fetchPublished
|
|
|
63
67
|
* `placeWtFor` is about to fail on the same unreadable repo and say so
|
|
64
68
|
* in its own words, which is the honest sentence.
|
|
65
69
|
*/
|
|
66
|
-
let branchMeasured =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
git(['rev-parse', '--verify', '--quiet',
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
let branchMeasured = ref !== null;
|
|
71
|
+
if (branchMeasured) {
|
|
72
|
+
try {
|
|
73
|
+
hasBranch = Boolean(git(['rev-parse', '--verify', '--quiet', ref], repoRoot));
|
|
74
|
+
} catch (e) {
|
|
75
|
+
if (e?.status === 1) hasBranch = false;
|
|
76
|
+
else branchMeasured = false;
|
|
77
|
+
}
|
|
74
78
|
}
|
|
75
79
|
if (branchMeasured && !existsSync(wtDir) && !hasBranch) {
|
|
76
80
|
/**
|