issue-flow 0.13.0 → 0.15.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/dist/agent-AT64RXTA.js +30 -0
- package/dist/{analyze-WS47UYGN.js → analyze-O2PYDIFK.js} +21 -18
- package/dist/{analyze-WS47UYGN.js.map → analyze-O2PYDIFK.js.map} +1 -1
- package/dist/{apply-OS62UWRN.js → apply-SSU6QCD4.js} +14 -11
- package/dist/{apply-OS62UWRN.js.map → apply-SSU6QCD4.js.map} +1 -1
- package/dist/{bench-SA3BOME5.js → bench-ODFPAGW6.js} +30 -26
- package/dist/{bench-SA3BOME5.js.map → bench-ODFPAGW6.js.map} +1 -1
- package/dist/{chunk-HJGGNLWI.js → chunk-2ZAM45PZ.js} +9 -9
- package/dist/{chunk-QCXPNSEL.js → chunk-3BWZO4YI.js} +2 -2
- package/dist/{chunk-J62QSVP6.js → chunk-4RXYFWP7.js} +8 -7
- package/dist/{chunk-J62QSVP6.js.map → chunk-4RXYFWP7.js.map} +1 -1
- package/dist/{chunk-ARFVHC2F.js → chunk-5ZKBIXET.js} +115 -23
- package/dist/chunk-5ZKBIXET.js.map +1 -0
- package/dist/{chunk-HEF2RMKN.js → chunk-6E2PEBFT.js} +18 -16
- package/dist/{chunk-HEF2RMKN.js.map → chunk-6E2PEBFT.js.map} +1 -1
- package/dist/{agent-BXRIEKVM.js → chunk-6FXOU2KR.js} +22 -22
- package/dist/chunk-6FXOU2KR.js.map +1 -0
- package/dist/{chunk-IYV6KNVF.js → chunk-6QYMSNVA.js} +66 -240
- package/dist/chunk-6QYMSNVA.js.map +1 -0
- package/dist/{chunk-UOCPC2Y2.js → chunk-6SRE4KD7.js} +4 -4
- package/dist/{chunk-MIVHK5YI.js → chunk-A35HE4V7.js} +3 -3
- package/dist/{chunk-TM67EHSV.js → chunk-ARWNYXFL.js} +19 -19
- package/dist/chunk-ARWNYXFL.js.map +1 -0
- package/dist/chunk-AYYMW33T.js +163 -0
- package/dist/chunk-AYYMW33T.js.map +1 -0
- package/dist/chunk-BMHGRYL6.js +890 -0
- package/dist/chunk-BMHGRYL6.js.map +1 -0
- package/dist/{chunk-PV4OX5TC.js → chunk-F4OK7KEP.js} +11 -11
- package/dist/{chunk-QXDNBYQF.js → chunk-FK4IDY6P.js} +21 -10
- package/dist/chunk-FK4IDY6P.js.map +1 -0
- package/dist/{chunk-KQHB7ZT3.js → chunk-GSZCQUCY.js} +82 -16
- package/dist/chunk-GSZCQUCY.js.map +1 -0
- package/dist/{chunk-TX5WIVYP.js → chunk-HAKDLR6N.js} +6 -1
- package/dist/chunk-HAKDLR6N.js.map +1 -0
- package/dist/{chunk-OPNGPUKJ.js → chunk-HGSYD57B.js} +143 -48
- package/dist/chunk-HGSYD57B.js.map +1 -0
- package/dist/{chunk-PIVGJM6K.js → chunk-KAHQ6F5C.js} +11 -11
- package/dist/{chunk-BHJCGWQX.js → chunk-MEFY4B7T.js} +9 -9
- package/dist/{chunk-BQDQTIM7.js → chunk-MGCOQU6N.js} +4 -4
- package/dist/{chunk-5TB6KLC2.js → chunk-MROS3SKL.js} +8 -8
- package/dist/chunk-NVZMBXTE.js +243 -0
- package/dist/chunk-NVZMBXTE.js.map +1 -0
- package/dist/{chunk-664Y3NDX.js → chunk-PCN7ZQND.js} +8 -8
- package/dist/{chunk-IV5SS4JN.js → chunk-QRCGW2ZO.js} +9 -7
- package/dist/{chunk-IV5SS4JN.js.map → chunk-QRCGW2ZO.js.map} +1 -1
- package/dist/{chunk-7KD66LIM.js → chunk-RPXDBX6R.js} +3 -3
- package/dist/{chunk-SNTTOQAD.js → chunk-RWEXK55D.js} +2 -2
- package/dist/{chunk-6FDFRNXZ.js → chunk-TBDP6QPJ.js} +25 -20
- package/dist/chunk-TBDP6QPJ.js.map +1 -0
- package/dist/chunk-UNQYMR3H.js +25 -0
- package/dist/chunk-UNQYMR3H.js.map +1 -0
- package/dist/{chunk-HQAHNIAR.js → chunk-VR34TXHF.js} +14 -14
- package/dist/{chunk-CNBYCMSU.js → chunk-WM3Y7Q4A.js} +27 -18
- package/dist/{chunk-CNBYCMSU.js.map → chunk-WM3Y7Q4A.js.map} +1 -1
- package/dist/{chunk-NEZZ6KDR.js → chunk-XDKGA6UX.js} +52 -3
- package/dist/chunk-XDKGA6UX.js.map +1 -0
- package/dist/{chunk-FZDR7CGH.js → chunk-XG2NYDRA.js} +3 -3
- package/dist/{chunk-3XLCNVMD.js → chunk-XLVGPXNL.js} +2 -2
- package/dist/{chunk-DIG5XKQQ.js → chunk-XQHFC62U.js} +2 -2
- package/dist/{chunk-UJ7XWK7J.js → chunk-XRLRKTQA.js} +16 -14
- package/dist/{chunk-UJ7XWK7J.js.map → chunk-XRLRKTQA.js.map} +1 -1
- package/dist/{chunk-LZ6GFQAG.js → chunk-ZFIXEYUJ.js} +44 -31
- package/dist/chunk-ZFIXEYUJ.js.map +1 -0
- package/dist/{chunk-37N2RJW2.js → chunk-ZPIVCM7Q.js} +3 -3
- package/dist/{chunk-TVN2JVOF.js → chunk-ZXPASFHG.js} +3 -3
- package/dist/cli.js +58 -64
- package/dist/cli.js.map +1 -1
- package/dist/{config-MEM2IWWN.js → config-UMP6DBJB.js} +12 -9
- package/dist/{conventions-WV4NDXGH.js → conventions-DKH7AE4T.js} +14 -11
- package/dist/{conventions-WV4NDXGH.js.map → conventions-DKH7AE4T.js.map} +1 -1
- package/dist/diagnostics-GOGCLTRS.js +23 -0
- package/dist/execute-E3BRMDAQ.js +35 -0
- package/dist/{generate-MVQI7A45.js → generate-AGBT7EHX.js} +23 -20
- package/dist/{generate-MVQI7A45.js.map → generate-AGBT7EHX.js.map} +1 -1
- package/dist/{git-YRVRUN3C.js → git-AC542GU2.js} +4 -2
- package/dist/init-LLBVJNPE.js +24 -0
- package/dist/{operations-LU6JA3BX.js → operations-JQYK2EMT.js} +17 -14
- package/dist/{operations-LU6JA3BX.js.map → operations-JQYK2EMT.js.map} +1 -1
- package/dist/{permissions-7NMDFU27.js → permissions-6HL52K54.js} +4 -4
- package/dist/plan-HSLWDJEZ.js +34 -0
- package/dist/{policy-JSYEK5B2.js → policy-IMRXGG7X.js} +13 -10
- package/dist/{policy-JSYEK5B2.js.map → policy-IMRXGG7X.js.map} +1 -1
- package/dist/pr-6TCZXG6K.js +39 -0
- package/dist/pr-review-6MWJO2NP.js +32 -0
- package/dist/prd-D6YDYAFX.js +33 -0
- package/dist/{ps-TNE44R5V.js → ps-KUUZ6TUL.js} +11 -8
- package/dist/{ps-TNE44R5V.js.map → ps-KUUZ6TUL.js.map} +1 -1
- package/dist/{recorder-XGF55WXI.js → recorder-BJ2KIAWT.js} +5 -4
- package/dist/registry-SB7XTMGE.js +15 -0
- package/dist/{resume-QMEPMSZW.js → resume-QNLQSCR5.js} +44 -40
- package/dist/{resume-QMEPMSZW.js.map → resume-QNLQSCR5.js.map} +1 -1
- package/dist/review-3KJ4BH2V.js +35 -0
- package/dist/{routing-2ZUMZPJB.js → routing-TN7GLMGU.js} +13 -10
- package/dist/{routing-2ZUMZPJB.js.map → routing-TN7GLMGU.js.map} +1 -1
- package/dist/run-5EHIFF2V.js +54 -0
- package/dist/run-5EHIFF2V.js.map +1 -0
- package/dist/session-publisher-T7EI3CIP.js +11 -0
- package/dist/session-publisher-T7EI3CIP.js.map +1 -0
- package/dist/{state-manager-X3PT3FGT.js → state-manager-ZEPWTCA6.js} +3 -3
- package/dist/state-manager-ZEPWTCA6.js.map +1 -0
- package/dist/{usage-VCFLDA5Y.js → usage-QL563I7F.js} +13 -10
- package/dist/{usage-VCFLDA5Y.js.map → usage-QL563I7F.js.map} +1 -1
- package/dist/{web-XVHLX62B.js → web-PPSMNTQ6.js} +22 -57
- package/dist/{web-XVHLX62B.js.map → web-PPSMNTQ6.js.map} +1 -1
- package/package.json +1 -1
- package/web/AGENTS.md +154 -11
- package/web/public/app.css +343 -110
- package/web/public/app.js +436 -27
- package/web/public/index.html +44 -1
- package/dist/agent-BXRIEKVM.js.map +0 -1
- package/dist/chunk-6FDFRNXZ.js.map +0 -1
- package/dist/chunk-ARFVHC2F.js.map +0 -1
- package/dist/chunk-IHIEXUTC.js +0 -483
- package/dist/chunk-IHIEXUTC.js.map +0 -1
- package/dist/chunk-IYV6KNVF.js.map +0 -1
- package/dist/chunk-KQHB7ZT3.js.map +0 -1
- package/dist/chunk-LZ6GFQAG.js.map +0 -1
- package/dist/chunk-NEZZ6KDR.js.map +0 -1
- package/dist/chunk-OPNGPUKJ.js.map +0 -1
- package/dist/chunk-QXDNBYQF.js.map +0 -1
- package/dist/chunk-TM67EHSV.js.map +0 -1
- package/dist/chunk-TX5WIVYP.js.map +0 -1
- package/dist/execute-NITIHHCK.js +0 -31
- package/dist/init-OKWEC3EV.js +0 -21
- package/dist/plan-LEJJF3DE.js +0 -31
- package/dist/pr-HPVUZ7S3.js +0 -36
- package/dist/pr-review-R2QZBT3F.js +0 -29
- package/dist/prd-5O6GYCC6.js +0 -30
- package/dist/registry-LGPE53QD.js +0 -15
- package/dist/review-YKWD6SNN.js +0 -32
- package/dist/run-YU4TR62R.js +0 -50
- /package/dist/{config-MEM2IWWN.js.map → agent-AT64RXTA.js.map} +0 -0
- /package/dist/{chunk-HJGGNLWI.js.map → chunk-2ZAM45PZ.js.map} +0 -0
- /package/dist/{chunk-QCXPNSEL.js.map → chunk-3BWZO4YI.js.map} +0 -0
- /package/dist/{chunk-UOCPC2Y2.js.map → chunk-6SRE4KD7.js.map} +0 -0
- /package/dist/{chunk-MIVHK5YI.js.map → chunk-A35HE4V7.js.map} +0 -0
- /package/dist/{chunk-PV4OX5TC.js.map → chunk-F4OK7KEP.js.map} +0 -0
- /package/dist/{chunk-PIVGJM6K.js.map → chunk-KAHQ6F5C.js.map} +0 -0
- /package/dist/{chunk-BHJCGWQX.js.map → chunk-MEFY4B7T.js.map} +0 -0
- /package/dist/{chunk-BQDQTIM7.js.map → chunk-MGCOQU6N.js.map} +0 -0
- /package/dist/{chunk-5TB6KLC2.js.map → chunk-MROS3SKL.js.map} +0 -0
- /package/dist/{chunk-664Y3NDX.js.map → chunk-PCN7ZQND.js.map} +0 -0
- /package/dist/{chunk-7KD66LIM.js.map → chunk-RPXDBX6R.js.map} +0 -0
- /package/dist/{chunk-SNTTOQAD.js.map → chunk-RWEXK55D.js.map} +0 -0
- /package/dist/{chunk-HQAHNIAR.js.map → chunk-VR34TXHF.js.map} +0 -0
- /package/dist/{chunk-FZDR7CGH.js.map → chunk-XG2NYDRA.js.map} +0 -0
- /package/dist/{chunk-3XLCNVMD.js.map → chunk-XLVGPXNL.js.map} +0 -0
- /package/dist/{chunk-DIG5XKQQ.js.map → chunk-XQHFC62U.js.map} +0 -0
- /package/dist/{chunk-37N2RJW2.js.map → chunk-ZPIVCM7Q.js.map} +0 -0
- /package/dist/{chunk-TVN2JVOF.js.map → chunk-ZXPASFHG.js.map} +0 -0
- /package/dist/{execute-NITIHHCK.js.map → config-UMP6DBJB.js.map} +0 -0
- /package/dist/{git-YRVRUN3C.js.map → diagnostics-GOGCLTRS.js.map} +0 -0
- /package/dist/{init-OKWEC3EV.js.map → execute-E3BRMDAQ.js.map} +0 -0
- /package/dist/{permissions-7NMDFU27.js.map → git-AC542GU2.js.map} +0 -0
- /package/dist/{plan-LEJJF3DE.js.map → init-LLBVJNPE.js.map} +0 -0
- /package/dist/{pr-HPVUZ7S3.js.map → permissions-6HL52K54.js.map} +0 -0
- /package/dist/{pr-review-R2QZBT3F.js.map → plan-HSLWDJEZ.js.map} +0 -0
- /package/dist/{prd-5O6GYCC6.js.map → pr-6TCZXG6K.js.map} +0 -0
- /package/dist/{recorder-XGF55WXI.js.map → pr-review-6MWJO2NP.js.map} +0 -0
- /package/dist/{registry-LGPE53QD.js.map → prd-D6YDYAFX.js.map} +0 -0
- /package/dist/{review-YKWD6SNN.js.map → recorder-BJ2KIAWT.js.map} +0 -0
- /package/dist/{run-YU4TR62R.js.map → registry-SB7XTMGE.js.map} +0 -0
- /package/dist/{state-manager-X3PT3FGT.js.map → review-3KJ4BH2V.js.map} +0 -0
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
setTelemetrySessionId
|
|
4
4
|
} from "./chunk-P3LRUNC6.js";
|
|
5
|
-
import {
|
|
6
|
-
isoNow
|
|
7
|
-
} from "./chunk-DIG5XKQQ.js";
|
|
8
5
|
|
|
9
6
|
// src/core/session-state.ts
|
|
10
7
|
import { mkdir, rename, utimes, writeFile } from "fs/promises";
|
|
@@ -67,6 +64,9 @@ function createInitialSnapshot() {
|
|
|
67
64
|
stories: [],
|
|
68
65
|
metrics: emptyMetrics(),
|
|
69
66
|
execution: { iteration: 0, retries: 0, correctionCycle: 0, maxCorrectionCycles: null },
|
|
67
|
+
executions: [],
|
|
68
|
+
processLogs: [],
|
|
69
|
+
configuration: null,
|
|
70
70
|
resilience: {
|
|
71
71
|
attempt: 0,
|
|
72
72
|
provider: null,
|
|
@@ -75,7 +75,13 @@ function createInitialSnapshot() {
|
|
|
75
75
|
cooldownUntil: null,
|
|
76
76
|
lastActivityAt: null
|
|
77
77
|
},
|
|
78
|
-
git: {
|
|
78
|
+
git: {
|
|
79
|
+
branch: null,
|
|
80
|
+
baseBranch: null,
|
|
81
|
+
branchCreated: null,
|
|
82
|
+
startCommit: null,
|
|
83
|
+
commits: []
|
|
84
|
+
},
|
|
79
85
|
repository: { name: null, remoteUrl: null, branch: null, headCommit: null, root: null },
|
|
80
86
|
pullRequests: [],
|
|
81
87
|
logs: [],
|
|
@@ -163,6 +169,16 @@ function reduceSessionEvent(snapshot, event, options) {
|
|
|
163
169
|
function isTerminalStage(stage) {
|
|
164
170
|
return stage === "done" || stage === "failed";
|
|
165
171
|
}
|
|
172
|
+
function transitionStory(story, stage, at, detail) {
|
|
173
|
+
if (story.stage === stage && story.stageDetail === detail) return story;
|
|
174
|
+
return {
|
|
175
|
+
...story,
|
|
176
|
+
stage,
|
|
177
|
+
stageSince: at,
|
|
178
|
+
stageDetail: detail,
|
|
179
|
+
history: [...story.history, { at, stage, detail }]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
166
182
|
function deriveStageOnStoriesUpdate(story, before, at) {
|
|
167
183
|
if (!story.passes) {
|
|
168
184
|
return {
|
|
@@ -201,12 +217,19 @@ function applyEvent(snapshot, event, options) {
|
|
|
201
217
|
...emptyPhaseTiming(),
|
|
202
218
|
...emptyUsage()
|
|
203
219
|
})),
|
|
204
|
-
git: {
|
|
220
|
+
git: {
|
|
221
|
+
branch: event.branch ?? null,
|
|
222
|
+
baseBranch: event.baseBranch ?? null,
|
|
223
|
+
branchCreated: event.branchCreated ?? null,
|
|
224
|
+
startCommit: event.startCommit ?? null,
|
|
225
|
+
commits: []
|
|
226
|
+
},
|
|
205
227
|
// The branch is the one piece of repository identity the session
|
|
206
228
|
// already knows here; the rest waits for publishGitState. Seeding it
|
|
207
229
|
// keeps git.branch and repository.branch consistent for a poll that
|
|
208
230
|
// lands before the first git:update.
|
|
209
231
|
repository: { ...initial.repository, branch: event.branch ?? null },
|
|
232
|
+
configuration: event.configuration ?? null,
|
|
210
233
|
environment: event.environment ? {
|
|
211
234
|
node: event.environment.node,
|
|
212
235
|
platform: event.environment.platform,
|
|
@@ -255,7 +278,7 @@ function applyEvent(snapshot, event, options) {
|
|
|
255
278
|
}
|
|
256
279
|
];
|
|
257
280
|
const stories = event.phase === "review" ? snapshot.stories.map(
|
|
258
|
-
(story) => story.passes ?
|
|
281
|
+
(story) => story.passes ? transitionStory(story, "in_review", event.at, null) : story
|
|
259
282
|
) : snapshot.stories;
|
|
260
283
|
return {
|
|
261
284
|
...snapshot,
|
|
@@ -283,9 +306,9 @@ function applyEvent(snapshot, event, options) {
|
|
|
283
306
|
);
|
|
284
307
|
const phasesCompleted = phases.filter((p) => p.status === "completed").length;
|
|
285
308
|
const stories = !event.success ? snapshot.stories.map(
|
|
286
|
-
(story) => isTerminalStage(story.stage) ? story :
|
|
309
|
+
(story) => isTerminalStage(story.stage) ? story : transitionStory(story, "failed", event.at, null)
|
|
287
310
|
) : event.phase === "review" ? snapshot.stories.map(
|
|
288
|
-
(story) => story.passes ?
|
|
311
|
+
(story) => story.passes ? transitionStory(story, "done", event.at, null) : story
|
|
289
312
|
) : snapshot.stories;
|
|
290
313
|
return {
|
|
291
314
|
...snapshot,
|
|
@@ -305,9 +328,9 @@ function applyEvent(snapshot, event, options) {
|
|
|
305
328
|
const stories = snapshot.stories.map((story) => {
|
|
306
329
|
if (story.passes) return story;
|
|
307
330
|
if (story.id === storyId) {
|
|
308
|
-
return story
|
|
331
|
+
return transitionStory(story, "executing", event.at, null);
|
|
309
332
|
}
|
|
310
|
-
return story
|
|
333
|
+
return transitionStory(story, "pending", event.at, null);
|
|
311
334
|
});
|
|
312
335
|
return {
|
|
313
336
|
...snapshot,
|
|
@@ -375,6 +398,9 @@ function applyEvent(snapshot, event, options) {
|
|
|
375
398
|
const stories = event.stories.map((story) => {
|
|
376
399
|
const before = previous.get(story.id);
|
|
377
400
|
const completedAt = !story.passes ? null : before && !before.passes ? event.at : before?.completedAt ?? null;
|
|
401
|
+
const stage = deriveStageOnStoriesUpdate(story, before, event.at);
|
|
402
|
+
const history = before?.history ?? [];
|
|
403
|
+
const stageChanged = before !== void 0 && before.stage !== stage.stage;
|
|
378
404
|
return {
|
|
379
405
|
id: story.id,
|
|
380
406
|
title: story.title,
|
|
@@ -397,7 +423,8 @@ function applyEvent(snapshot, event, options) {
|
|
|
397
423
|
cacheReadTokens: before?.cacheReadTokens ?? null,
|
|
398
424
|
cacheCreationTokens: before?.cacheCreationTokens ?? null,
|
|
399
425
|
costUsd: before?.costUsd ?? null,
|
|
400
|
-
...
|
|
426
|
+
...stage,
|
|
427
|
+
history: stageChanged ? [...history, { at: event.at, stage: stage.stage, detail: stage.stageDetail }] : history
|
|
401
428
|
};
|
|
402
429
|
});
|
|
403
430
|
return {
|
|
@@ -432,12 +459,36 @@ function applyEvent(snapshot, event, options) {
|
|
|
432
459
|
const logs = [...snapshot.logs, entry].slice(-Math.max(1, limit));
|
|
433
460
|
return { ...snapshot, logs };
|
|
434
461
|
}
|
|
462
|
+
case "process:output": {
|
|
463
|
+
const limit = options?.logLimit ?? DEFAULT_LOG_LIMIT;
|
|
464
|
+
const entry = {
|
|
465
|
+
at: event.at,
|
|
466
|
+
phase: event.phase,
|
|
467
|
+
executionId: event.executionId,
|
|
468
|
+
provider: event.provider,
|
|
469
|
+
stream: event.stream,
|
|
470
|
+
message: stripVTControlCharacters(event.message)
|
|
471
|
+
};
|
|
472
|
+
return {
|
|
473
|
+
...snapshot,
|
|
474
|
+
processLogs: [...snapshot.processLogs, entry].slice(-Math.max(1, limit))
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
case "execution:update": {
|
|
478
|
+
const index = snapshot.executions.findIndex((entry) => entry.id === event.execution.id);
|
|
479
|
+
const executions = [...snapshot.executions];
|
|
480
|
+
if (index === -1) executions.push(event.execution);
|
|
481
|
+
else executions[index] = event.execution;
|
|
482
|
+
return { ...snapshot, executions };
|
|
483
|
+
}
|
|
435
484
|
case "git:update":
|
|
436
485
|
return {
|
|
437
486
|
...snapshot,
|
|
438
487
|
git: {
|
|
439
488
|
branch: event.branch ?? snapshot.git.branch,
|
|
440
489
|
baseBranch: event.baseBranch ?? snapshot.git.baseBranch,
|
|
490
|
+
branchCreated: reported(event.branchCreated, snapshot.git.branchCreated),
|
|
491
|
+
startCommit: snapshot.git.startCommit,
|
|
441
492
|
commits: event.commits ?? snapshot.git.commits
|
|
442
493
|
},
|
|
443
494
|
repository: {
|
|
@@ -454,7 +505,7 @@ function applyEvent(snapshot, event, options) {
|
|
|
454
505
|
case "correction:cycle": {
|
|
455
506
|
const stageDetail = `Cycle ${event.cycle}/${event.maxCycles}`;
|
|
456
507
|
const stories = snapshot.stories.map(
|
|
457
|
-
(story) => story.passes ?
|
|
508
|
+
(story) => story.passes ? transitionStory(story, "in_correction", event.at, stageDetail) : story
|
|
458
509
|
);
|
|
459
510
|
return {
|
|
460
511
|
...snapshot,
|
|
@@ -527,7 +578,7 @@ function applyEvent(snapshot, event, options) {
|
|
|
527
578
|
stories: snapshot.stories.map((story) => {
|
|
528
579
|
if (isTerminalStage(story.stage)) return story;
|
|
529
580
|
const stage = event.status === "completed" && story.passes ? "done" : "failed";
|
|
530
|
-
return
|
|
581
|
+
return transitionStory(story, stage, event.at, null);
|
|
531
582
|
}),
|
|
532
583
|
lastError: event.error ? { message: stripVTControlCharacters(event.error), at: event.at } : snapshot.lastError
|
|
533
584
|
};
|
|
@@ -712,205 +763,6 @@ function getSessionPublisher() {
|
|
|
712
763
|
return _publisher;
|
|
713
764
|
}
|
|
714
765
|
|
|
715
|
-
// src/core/verbose.ts
|
|
716
|
-
var _verbose = false;
|
|
717
|
-
function setVerbose(enabled) {
|
|
718
|
-
_verbose = enabled;
|
|
719
|
-
}
|
|
720
|
-
function isVerbose() {
|
|
721
|
-
return _verbose;
|
|
722
|
-
}
|
|
723
|
-
var _onOutput;
|
|
724
|
-
function setOutputCallback(callback) {
|
|
725
|
-
_onOutput = callback;
|
|
726
|
-
}
|
|
727
|
-
function getOutputCallback() {
|
|
728
|
-
return _onOutput;
|
|
729
|
-
}
|
|
730
|
-
var _onStoryUpdate;
|
|
731
|
-
function setStoryUpdateCallback(callback) {
|
|
732
|
-
_onStoryUpdate = callback;
|
|
733
|
-
}
|
|
734
|
-
function getStoryUpdateCallback() {
|
|
735
|
-
return _onStoryUpdate;
|
|
736
|
-
}
|
|
737
|
-
var _onStoryStage;
|
|
738
|
-
function setStoryStageCallback(callback) {
|
|
739
|
-
_onStoryStage = callback;
|
|
740
|
-
}
|
|
741
|
-
function getStoryStageCallback() {
|
|
742
|
-
return _onStoryStage;
|
|
743
|
-
}
|
|
744
|
-
var _onActivity;
|
|
745
|
-
function setActivityCallback(callback) {
|
|
746
|
-
_onActivity = callback;
|
|
747
|
-
}
|
|
748
|
-
function getActivityCallback() {
|
|
749
|
-
return _onActivity;
|
|
750
|
-
}
|
|
751
|
-
var _globalTimeout;
|
|
752
|
-
function setGlobalTimeout(ms) {
|
|
753
|
-
_globalTimeout = ms;
|
|
754
|
-
}
|
|
755
|
-
function getGlobalTimeout() {
|
|
756
|
-
return _globalTimeout;
|
|
757
|
-
}
|
|
758
|
-
var _inactivityTimeout;
|
|
759
|
-
function setInactivityTimeout(ms) {
|
|
760
|
-
_inactivityTimeout = ms;
|
|
761
|
-
}
|
|
762
|
-
function getInactivityTimeout() {
|
|
763
|
-
return _inactivityTimeout;
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
// src/ui/logger.ts
|
|
767
|
-
import chalk from "chalk";
|
|
768
|
-
import ora from "ora";
|
|
769
|
-
function useUnicode() {
|
|
770
|
-
if (process.env.NO_COLOR != null && process.env.NO_COLOR !== "") return false;
|
|
771
|
-
if (!process.stdout.isTTY) return false;
|
|
772
|
-
return true;
|
|
773
|
-
}
|
|
774
|
-
function useColor() {
|
|
775
|
-
if (process.env.NO_COLOR != null && process.env.NO_COLOR !== "") return false;
|
|
776
|
-
if (!process.stdout.isTTY) return false;
|
|
777
|
-
return true;
|
|
778
|
-
}
|
|
779
|
-
function getIcons() {
|
|
780
|
-
if (useUnicode()) {
|
|
781
|
-
return {
|
|
782
|
-
success: "\u2713",
|
|
783
|
-
fail: "\u2717",
|
|
784
|
-
pending: "\u23F3",
|
|
785
|
-
retry: "\u21BB",
|
|
786
|
-
warn: "\u26A0",
|
|
787
|
-
start: "\u25B6",
|
|
788
|
-
end: "\u25A0",
|
|
789
|
-
notReached: "\u25CB",
|
|
790
|
-
tool: "\u25B8",
|
|
791
|
-
connector: "\u2502",
|
|
792
|
-
info: "\xB7"
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
return {
|
|
796
|
-
success: "[OK]",
|
|
797
|
-
fail: "[FAIL]",
|
|
798
|
-
pending: "[...]",
|
|
799
|
-
retry: "[RETRY]",
|
|
800
|
-
warn: "[WARN]",
|
|
801
|
-
start: "[START]",
|
|
802
|
-
end: "[END]",
|
|
803
|
-
notReached: "[ ]",
|
|
804
|
-
tool: ">",
|
|
805
|
-
connector: "|",
|
|
806
|
-
info: "-"
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
function getTermWidth() {
|
|
810
|
-
return process.stdout.columns ?? 80;
|
|
811
|
-
}
|
|
812
|
-
function emit(line, level = "info") {
|
|
813
|
-
getSessionPublisher().publish({ type: "log", at: isoNow(), level, message: line });
|
|
814
|
-
const cb = getOutputCallback();
|
|
815
|
-
if (cb) {
|
|
816
|
-
cb(line);
|
|
817
|
-
} else {
|
|
818
|
-
console.log(line);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
function printSuccess(message) {
|
|
822
|
-
const icons = getIcons();
|
|
823
|
-
if (useColor()) {
|
|
824
|
-
emit(chalk.green(`${icons.success} ${message}`));
|
|
825
|
-
} else {
|
|
826
|
-
emit(`${icons.success} ${message}`);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
function printError(message) {
|
|
830
|
-
const icons = getIcons();
|
|
831
|
-
if (useColor()) {
|
|
832
|
-
emit(chalk.red(`${icons.fail} ${message}`), "error");
|
|
833
|
-
} else {
|
|
834
|
-
emit(`${icons.fail} ${message}`, "error");
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
function printWarning(message) {
|
|
838
|
-
const icons = getIcons();
|
|
839
|
-
if (useColor()) {
|
|
840
|
-
emit(chalk.yellow(`${icons.warn} ${message}`), "warn");
|
|
841
|
-
} else {
|
|
842
|
-
emit(`${icons.warn} ${message}`, "warn");
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
function printRetry(message) {
|
|
846
|
-
const icons = getIcons();
|
|
847
|
-
if (useColor()) {
|
|
848
|
-
emit(chalk.yellow(`${icons.retry} ${message}`), "warn");
|
|
849
|
-
} else {
|
|
850
|
-
emit(`${icons.retry} ${message}`, "warn");
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
function printInfo(message) {
|
|
854
|
-
const icons = getIcons();
|
|
855
|
-
if (useColor()) {
|
|
856
|
-
emit(chalk.blue(`${icons.info} ${message}`));
|
|
857
|
-
} else {
|
|
858
|
-
emit(`${icons.info} ${message}`);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
function createSpinner(message) {
|
|
862
|
-
return ora({
|
|
863
|
-
text: message,
|
|
864
|
-
color: "blue",
|
|
865
|
-
spinner: "dots"
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
function formatDuration(totalSeconds) {
|
|
869
|
-
const hours = Math.floor(totalSeconds / 3600);
|
|
870
|
-
const mins = Math.floor(totalSeconds % 3600 / 60);
|
|
871
|
-
const secs = totalSeconds % 60;
|
|
872
|
-
if (hours > 0) {
|
|
873
|
-
return `${hours}h ${mins}m ${secs}s`;
|
|
874
|
-
}
|
|
875
|
-
if (mins > 0) {
|
|
876
|
-
return `${mins}m ${secs}s`;
|
|
877
|
-
}
|
|
878
|
-
return `${secs}s`;
|
|
879
|
-
}
|
|
880
|
-
var ElapsedTimer = class {
|
|
881
|
-
constructor(onTick) {
|
|
882
|
-
this.onTick = onTick;
|
|
883
|
-
this.startTime = Date.now();
|
|
884
|
-
}
|
|
885
|
-
onTick;
|
|
886
|
-
startTime;
|
|
887
|
-
intervalId = null;
|
|
888
|
-
cleanup = () => this.stop();
|
|
889
|
-
start() {
|
|
890
|
-
this.startTime = Date.now();
|
|
891
|
-
this.intervalId = setInterval(() => {
|
|
892
|
-
const seconds = Math.floor((Date.now() - this.startTime) / 1e3);
|
|
893
|
-
this.onTick(formatDuration(seconds));
|
|
894
|
-
}, 1e3);
|
|
895
|
-
if (this.intervalId && typeof this.intervalId === "object" && "unref" in this.intervalId) {
|
|
896
|
-
this.intervalId.unref();
|
|
897
|
-
}
|
|
898
|
-
process.on("exit", this.cleanup);
|
|
899
|
-
return this;
|
|
900
|
-
}
|
|
901
|
-
getElapsedSeconds() {
|
|
902
|
-
return Math.floor((Date.now() - this.startTime) / 1e3);
|
|
903
|
-
}
|
|
904
|
-
stop() {
|
|
905
|
-
if (this.intervalId) {
|
|
906
|
-
clearInterval(this.intervalId);
|
|
907
|
-
this.intervalId = null;
|
|
908
|
-
}
|
|
909
|
-
process.removeListener("exit", this.cleanup);
|
|
910
|
-
return this.getElapsedSeconds();
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
|
|
914
766
|
export {
|
|
915
767
|
createInitialSnapshot,
|
|
916
768
|
reduceSessionEvent,
|
|
@@ -918,32 +770,6 @@ export {
|
|
|
918
770
|
MemoryPublisher,
|
|
919
771
|
FilePublisher,
|
|
920
772
|
setSessionPublisher,
|
|
921
|
-
getSessionPublisher
|
|
922
|
-
setVerbose,
|
|
923
|
-
isVerbose,
|
|
924
|
-
setOutputCallback,
|
|
925
|
-
getOutputCallback,
|
|
926
|
-
setStoryUpdateCallback,
|
|
927
|
-
getStoryUpdateCallback,
|
|
928
|
-
setStoryStageCallback,
|
|
929
|
-
getStoryStageCallback,
|
|
930
|
-
setActivityCallback,
|
|
931
|
-
getActivityCallback,
|
|
932
|
-
setGlobalTimeout,
|
|
933
|
-
getGlobalTimeout,
|
|
934
|
-
setInactivityTimeout,
|
|
935
|
-
getInactivityTimeout,
|
|
936
|
-
useUnicode,
|
|
937
|
-
useColor,
|
|
938
|
-
getIcons,
|
|
939
|
-
getTermWidth,
|
|
940
|
-
printSuccess,
|
|
941
|
-
printError,
|
|
942
|
-
printWarning,
|
|
943
|
-
printRetry,
|
|
944
|
-
printInfo,
|
|
945
|
-
createSpinner,
|
|
946
|
-
formatDuration,
|
|
947
|
-
ElapsedTimer
|
|
773
|
+
getSessionPublisher
|
|
948
774
|
};
|
|
949
|
-
//# sourceMappingURL=chunk-
|
|
775
|
+
//# sourceMappingURL=chunk-6QYMSNVA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/session-state.ts","../src/core/session-publisher.ts"],"sourcesContent":["import { mkdir, rename, utimes, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { stripVTControlCharacters } from 'node:util';\nimport type { FailureKind } from '../resilience/errors.js';\nimport { setTelemetrySessionId } from '../telemetry/session-id.js';\nimport type { ExecutionRecord } from '../telemetry/types.js';\nimport type { StoryStage, UserStory, UserStoryStatus } from '../types.js';\n\n/**\n * Session state publishing layer for the optional web monitoring mode.\n *\n * Instrumentation points call publish() with SessionEvents; a pure reducer\n * folds each event into an in-memory SessionSnapshot that any surface\n * (file, HTTP endpoint, future webhooks) can consume in a single format.\n *\n * Monitoring must never affect the pipeline: publish() is synchronous and\n * never throws, and all publisher I/O failures are swallowed after a\n * single warning.\n */\n\nexport type SessionLogLevel = 'info' | 'warn' | 'error';\nexport type SessionStatus = 'idle' | 'running' | 'completed' | 'failed';\nexport type SessionPhaseStatus = 'pending' | 'running' | 'completed' | 'failed';\n\n/** Default max entries retained in the logs ring buffer. */\nexport const DEFAULT_LOG_LIMIT = 200;\n\n/** Default minimum interval between FilePublisher disk writes. */\nexport const DEFAULT_THROTTLE_MS = 1000;\n\n/** Default interval for touching a live session file without rewriting it. */\nexport const DEFAULT_SESSION_HEARTBEAT_MS = 10_000;\n\nexport type SessionEvent =\n | {\n type: 'session:start';\n at: string;\n sessionId: string;\n /** `null` for local identifiers that are not numbers. */\n issueNumber: number | null;\n issueUrl?: string;\n branch?: string;\n baseBranch?: string;\n phases: string[];\n environment?: SessionEnvironment;\n configuration?: SessionConfigurationSnapshot;\n branchCreated?: boolean | null;\n startCommit?: string | null;\n }\n | {\n /**\n * Structural data of the Issue being worked on, published once the\n * provider has resolved it. Merged over the `issue` section instead of\n * replacing it, so the number and the URL that came with `session:start`\n * survive an origin that reports neither.\n */\n type: 'issue:update';\n at: string;\n number: number | null;\n url?: string;\n title: string | null;\n /** Issue body, published whole — no truncation. */\n description: string | null;\n labels: string[];\n state: string | null;\n }\n | { type: 'phase:start'; at: string; phase: string }\n | {\n type: 'phase:end';\n at: string;\n phase: string;\n success: boolean;\n error?: string;\n harnessExecutionMs?: number | null;\n orchestrationOverheadMs?: number | null;\n harnessStartupMs?: number | null;\n ttftMs?: number | null;\n attemptCount?: number | null;\n retryDurationMs?: number | null;\n }\n | {\n type: 'iteration:start';\n at: string;\n iteration: number;\n /**\n * Id of the story `execute` is about to work on, computed by\n * `core/engine.ts` with the same \"highest priority, `passes: false`\"\n * rule `prompts/execute.md` gives the agent. Optional so a caller that\n * cannot determine it (or an older build) is still a valid event —\n * `applyEvent` simply skips the `executing`/`pending` transition then.\n */\n storyId?: string;\n }\n | { type: 'iteration:end'; at: string; iteration: number }\n | {\n type: 'retry';\n at: string;\n attempt: number;\n delaySeconds?: number;\n reason?: string;\n /**\n * What the resilience layer classified the failure as. Optional so an\n * event written by an older build — or by a caller with nothing but a\n * message — stays valid; the reducer only counts retries either way.\n */\n kind?: FailureKind;\n }\n | {\n type: 'agent:attempt';\n at: string;\n attempt: number;\n provider: string;\n model?: string | null;\n primaryProvider: string;\n }\n | {\n type: 'failover';\n at: string;\n from: string;\n to: string;\n reason: FailureKind | null;\n cooldownUntil?: string | null;\n }\n | {\n type: 'agent:result';\n at: string;\n provider: string;\n success: boolean;\n failureKind?: FailureKind;\n cooldownUntil?: string | null;\n }\n | { type: 'agent:activity'; at: string; provider: string }\n | { type: 'stories:update'; at: string; stories: UserStory[] }\n | { type: 'activity'; at: string; story?: string; tool?: string; detail?: string }\n | { type: 'log'; at: string; level: SessionLogLevel; message: string }\n | {\n type: 'process:output';\n at: string;\n phase: string;\n executionId: string | null;\n provider: string;\n stream: 'stdout' | 'stderr' | 'combined';\n message: string;\n }\n | { type: 'execution:update'; at: string; execution: ExecutionRecord }\n | { type: 'correction:cycle'; at: string; cycle: number; maxCycles: number }\n | {\n type: 'metrics:update';\n at: string;\n /**\n * Where the metrics land:\n * - `phase`: the named phase plus the issue-wide aggregate;\n * - `iteration`: one execute-loop pass — same targets as `phase`;\n * - `story`: the story alone, never the phase nor the aggregate (the\n * iteration event of the same cycle already counted those tokens).\n */\n scope: 'phase' | 'iteration' | 'story';\n phase?: string;\n storyId?: string;\n iteration?: number;\n inputTokens?: number;\n outputTokens?: number;\n cacheReadTokens?: number;\n cacheCreationTokens?: number;\n costUsd?: number;\n durationSeconds?: number;\n }\n | {\n /**\n * One publication feeds both the `git` section (branch, base, commits)\n * and the `repository` section (identity and location). They come from\n * the same collection pass, so extending this event keeps `branch`\n * consistent across the two instead of racing a second event.\n *\n * Every field is optional: `undefined` means \"not collected in this\n * publication\" and leaves the snapshot untouched, while an explicit\n * `null` means \"collected and unavailable\" and is written as-is.\n */\n type: 'git:update';\n at: string;\n branch?: string;\n baseBranch?: string;\n branchCreated?: boolean | null;\n commits?: SessionCommit[];\n pullRequests?: SessionPullRequest[];\n /** `owner/repo`, derived from the origin remote. */\n repositoryName?: string | null;\n remoteUrl?: string | null;\n headCommit?: string | null;\n repositoryRoot?: string | null;\n }\n | { type: 'session:end'; at: string; status: 'completed' | 'failed'; error?: string }\n | {\n type: 'verify:end';\n at: string;\n verdict: 'passed' | 'failed' | 'unverified';\n level: string;\n independence: string | null;\n executionId: string | null;\n };\n\nexport interface SessionEnvironment {\n node: string;\n platform: string;\n /** Winning agent provider for the run. `null` on snapshots from earlier releases. */\n agent: string | null;\n /** Winning model for the run. `null` when unset or on older snapshots. */\n model: string | null;\n}\n\nexport interface SessionLogEntry {\n at: string;\n level: SessionLogLevel;\n message: string;\n}\n\nexport interface SessionProcessLogEntry {\n at: string;\n phase: string;\n executionId: string | null;\n provider: string;\n stream: 'stdout' | 'stderr' | 'combined';\n message: string;\n}\n\nexport interface SessionConfigurationValue {\n value: string | null;\n source: 'default' | 'global' | 'project' | 'env' | 'cli' | 'fallback';\n}\n\nexport interface SessionPhaseConfiguration {\n phase: string;\n provider: SessionConfigurationValue;\n model: SessionConfigurationValue;\n}\n\nexport interface SessionConfigurationSnapshot {\n precedence: string[];\n defaultProvider: SessionConfigurationValue;\n defaultModel: SessionConfigurationValue;\n phases: SessionPhaseConfiguration[];\n fallbacks: string[];\n overrides: string[];\n}\n\nexport interface SessionStageHistoryEntry {\n at: string;\n stage: StoryStage;\n detail: string | null;\n}\n\n/**\n * Token/cost counters attached to a phase or a story.\n *\n * `null` means \"never reported\" — the `claude` CLI does not always return\n * usage data, and a metric that was never observed must stay distinguishable\n * from an observed zero.\n */\nexport interface SessionUsageSnapshot {\n inputTokens: number | null;\n outputTokens: number | null;\n cacheReadTokens: number | null;\n cacheCreationTokens: number | null;\n costUsd: number | null;\n}\n\n/** Issue-wide totals, accumulated from phase- and iteration-scoped metrics. */\nexport interface SessionMetricsSnapshot {\n totalInputTokens: number | null;\n totalOutputTokens: number | null;\n totalCacheReadTokens: number | null;\n totalCacheCreationTokens: number | null;\n totalCostUsd: number | null;\n}\n\nexport interface SessionPhaseSnapshot extends SessionUsageSnapshot {\n name: string;\n status: SessionPhaseStatus;\n startedAt: string | null;\n endedAt: string | null;\n durationSeconds: number | null;\n error: string | null;\n /** Sum of invocation walls for this phase. */\n harnessExecutionMs: number | null;\n /** Phase wall minus harnessExecutionMs, when both are known. */\n orchestrationOverheadMs: number | null;\n /** Wall clock − CLI `duration_ms`. */\n harnessStartupMs: number | null;\n /** Time to first output, when the harness reports it. */\n ttftMs: number | null;\n attemptCount: number | null;\n retryDurationMs: number | null;\n}\n\nexport interface SessionStorySnapshot extends SessionUsageSnapshot {\n id: string;\n title: string;\n priority: number;\n passes: boolean;\n /**\n * When the story flipped to passing during this session; null for stories\n * that were already passing at session start (their duration is unknown).\n */\n completedAt: string | null;\n /** Wall-clock seconds attributed to the story, or null when unknown. */\n durationSeconds: number | null;\n /**\n * Board-style status, recomputed on every reduction by\n * {@link deriveStoryStatus}. Observational: the pipeline keeps deciding what\n * to execute from `passes`.\n */\n status: UserStoryStatus;\n /** IDs of the stories this one depends on, as declared in the plan. */\n dependencies: string[];\n /** The plan's description; empty string when the plan carries none. */\n description: string;\n /** The plan's acceptance criteria; empty when the plan carries none. */\n acceptanceCriteria: string[];\n /**\n * Fine-grained execution stage, derived only from real pipeline events —\n * see {@link StoryStage} and the `applyEvent` cases for `iteration:start`,\n * `stories:update`, `phase:start`/`phase:end` (phase `'review'`) and\n * `correction:cycle`. Unlike `status`, this is not a post-hoc derivation\n * recomputed on every reduction: it is set directly, event by event, like\n * `completedAt`.\n */\n stage: StoryStage;\n /** ISO timestamp of the event that produced the current `stage`. */\n stageSince: string | null;\n /** Short human detail for the current stage (e.g. a correction cycle). */\n stageDetail: string | null;\n /** Append-only transition history retained in the snapshot for the drawer. */\n history: SessionStageHistoryEntry[];\n}\n\nexport interface SessionActivity {\n story: string | null;\n tool: string | null;\n detail: string | null;\n since: string;\n}\n\n/** Live resilience state for the current agent invocation. */\nexport interface SessionResilienceSnapshot {\n attempt: number;\n provider: string | null;\n model: string | null;\n lastFailureKind: FailureKind | null;\n cooldownUntil: string | null;\n lastActivityAt: string | null;\n}\n\nexport interface SessionCommit {\n hash: string;\n subject: string;\n committedAt?: string | null;\n storyId?: string | null;\n}\n\nexport interface SessionPullRequest {\n number: number;\n url: string;\n title: string;\n}\n\n/**\n * The Issue under execution, as far as the session knows it.\n *\n * `number`/`url` come with `session:start`; the remaining fields arrive with\n * `issue:update`, once the provider has resolved the Issue. Everything is\n * nullable because a run may start before (or without) that resolution —\n * `null` means \"not reported\", never \"empty\".\n */\nexport interface SessionIssueSnapshot {\n number: number | null;\n url: string | null;\n title: string | null;\n /** Issue body in full; the consumer decides how to fold it. */\n description: string | null;\n labels: string[];\n /** Provider lifecycle state ('open' / 'closed' for the built-ins). */\n state: string | null;\n}\n\n/**\n * Where the run is happening: which repository, which checkout, which commit.\n *\n * Fed by `git:update` (see `publishGitState`). Every field is nullable because\n * each source is independent and failure-tolerant — no remote configured, a\n * repository with no commits yet or a missing git binary all show up as\n * `null` instead of failing the publication.\n */\nexport interface SessionRepositorySnapshot {\n /** `owner/repo`, derived from the origin remote; null without one. */\n name: string | null;\n remoteUrl: string | null;\n branch: string | null;\n /** Abbreviated hash of HEAD. */\n headCommit: string | null;\n /** Absolute path of the working directory the pipeline runs from. */\n root: string | null;\n}\n\nexport interface SessionSnapshot {\n schemaVersion: 1;\n sessionId: string | null;\n readOnly: true;\n capabilities: string[];\n issue: SessionIssueSnapshot;\n status: SessionStatus;\n startedAt: string | null;\n updatedAt: string | null;\n endedAt: string | null;\n elapsedSeconds: number | null;\n estimatedRemainingSeconds: number | null;\n progress: {\n percent: number;\n phasesCompleted: number;\n phasesTotal: number;\n storiesCompleted: number;\n storiesTotal: number;\n };\n currentPhase: string | null;\n currentActivity: SessionActivity | null;\n phases: SessionPhaseSnapshot[];\n stories: SessionStorySnapshot[];\n metrics: SessionMetricsSnapshot;\n execution: {\n iteration: number;\n retries: number;\n correctionCycle: number;\n maxCorrectionCycles: number | null;\n };\n executions: ExecutionRecord[];\n processLogs: SessionProcessLogEntry[];\n configuration: SessionConfigurationSnapshot | null;\n resilience: SessionResilienceSnapshot;\n git: {\n branch: string | null;\n baseBranch: string | null;\n branchCreated: boolean | null;\n startCommit: string | null;\n commits: SessionCommit[];\n };\n repository: SessionRepositorySnapshot;\n pullRequests: SessionPullRequest[];\n logs: SessionLogEntry[];\n errors: SessionLogEntry[];\n warnings: SessionLogEntry[];\n lastError: { message: string; at: string } | null;\n nextSteps: string[];\n environment: SessionEnvironment | null;\n /** Acceptance-contract verdict. `null` until a contract has run. */\n verification: {\n verdict: 'passed' | 'failed' | 'unverified' | null;\n level: string | null;\n independence: string | null;\n } | null;\n}\n\nexport interface SessionReducerOptions {\n /** Max entries retained in the logs ring buffer. */\n logLimit?: number;\n}\n\n/** Fresh, all-null usage counters for a new phase or story entry. */\nfunction emptyUsage(): SessionUsageSnapshot {\n return {\n inputTokens: null,\n outputTokens: null,\n cacheReadTokens: null,\n cacheCreationTokens: null,\n costUsd: null,\n };\n}\n\nfunction emptyPhaseTiming(): Pick<\n SessionPhaseSnapshot,\n | 'harnessExecutionMs'\n | 'orchestrationOverheadMs'\n | 'harnessStartupMs'\n | 'ttftMs'\n | 'attemptCount'\n | 'retryDurationMs'\n> {\n return {\n harnessExecutionMs: null,\n orchestrationOverheadMs: null,\n harnessStartupMs: null,\n ttftMs: null,\n attemptCount: null,\n retryDurationMs: null,\n };\n}\n\nfunction emptyMetrics(): SessionMetricsSnapshot {\n return {\n totalInputTokens: null,\n totalOutputTokens: null,\n totalCacheReadTokens: null,\n totalCacheCreationTokens: null,\n totalCostUsd: null,\n };\n}\n\nexport function createInitialSnapshot(): SessionSnapshot {\n return {\n schemaVersion: 1,\n sessionId: null,\n readOnly: true,\n capabilities: [],\n issue: { number: null, url: null, title: null, description: null, labels: [], state: null },\n status: 'idle',\n startedAt: null,\n updatedAt: null,\n endedAt: null,\n elapsedSeconds: null,\n estimatedRemainingSeconds: null,\n progress: {\n percent: 0,\n phasesCompleted: 0,\n phasesTotal: 0,\n storiesCompleted: 0,\n storiesTotal: 0,\n },\n currentPhase: null,\n currentActivity: null,\n phases: [],\n stories: [],\n metrics: emptyMetrics(),\n execution: { iteration: 0, retries: 0, correctionCycle: 0, maxCorrectionCycles: null },\n executions: [],\n processLogs: [],\n configuration: null,\n resilience: {\n attempt: 0,\n provider: null,\n model: null,\n lastFailureKind: null,\n cooldownUntil: null,\n lastActivityAt: null,\n },\n git: {\n branch: null,\n baseBranch: null,\n branchCreated: null,\n startCommit: null,\n commits: [],\n },\n repository: { name: null, remoteUrl: null, branch: null, headCommit: null, root: null },\n pullRequests: [],\n logs: [],\n errors: [],\n warnings: [],\n lastError: null,\n nextSteps: [],\n environment: null,\n verification: null,\n };\n}\n\ntype MetricsUpdateEvent = Extract<SessionEvent, { type: 'metrics:update' }>;\n\n/**\n * Add a reported delta to an accumulator. `undefined` means \"not reported\":\n * it leaves the accumulator untouched, so a metric the CLI never returned\n * stays null instead of collapsing to zero.\n */\nfunction accumulate(current: number | null, delta: number | undefined): number | null {\n return delta === undefined ? current : (current ?? 0) + delta;\n}\n\n/** Fold the event's token/cost fields into a phase or story entry. */\nfunction accumulateUsage<T extends SessionUsageSnapshot>(target: T, event: MetricsUpdateEvent): T {\n return {\n ...target,\n inputTokens: accumulate(target.inputTokens, event.inputTokens),\n outputTokens: accumulate(target.outputTokens, event.outputTokens),\n cacheReadTokens: accumulate(target.cacheReadTokens, event.cacheReadTokens),\n cacheCreationTokens: accumulate(target.cacheCreationTokens, event.cacheCreationTokens),\n costUsd: accumulate(target.costUsd, event.costUsd),\n };\n}\n\n/**\n * Pick between a reported value and the one already in the snapshot.\n * Unlike `??`, an explicitly reported `null` wins: only `undefined` — the\n * absence of the field on the event — keeps the previous value.\n */\nfunction reported<T>(value: T | undefined, previous: T): T {\n return value === undefined ? previous : value;\n}\n\n/**\n * Seconds between two ISO timestamps, or null when either is unparsable.\n */\nfunction secondsBetween(from: string | null, to: string): number | null {\n if (from === null) return null;\n const fromMs = Date.parse(from);\n const toMs = Date.parse(to);\n if (Number.isNaN(fromMs) || Number.isNaN(toMs)) return null;\n return Math.max(0, Math.round((toMs - fromMs) / 1000));\n}\n\nfunction computePercent(phasesCompleted: number, phasesTotal: number): number {\n if (phasesTotal === 0) return 0;\n return Math.round((phasesCompleted / phasesTotal) * 100);\n}\n\n/**\n * Estimated seconds until all stories pass: average duration of the stories\n * completed during this session × pending stories. Durations are the gaps\n * between consecutive completions (the first is measured from startedAt).\n * Published as null with fewer than two samples.\n */\nfunction estimateRemainingSeconds(snapshot: SessionSnapshot): number | null {\n const completions = snapshot.stories\n .map((story) => (story.completedAt === null ? Number.NaN : Date.parse(story.completedAt)))\n .filter((ms) => !Number.isNaN(ms))\n .sort((a, b) => a - b);\n if (completions.length < 2) return null;\n\n const startMs = snapshot.startedAt === null ? Number.NaN : Date.parse(snapshot.startedAt);\n const boundaries = Number.isNaN(startMs) ? completions : [startMs, ...completions];\n const durations: number[] = [];\n for (let i = 1; i < boundaries.length; i++) {\n durations.push(Math.max(0, boundaries[i] - boundaries[i - 1]));\n }\n if (durations.length === 0) return null;\n\n const averageMs = durations.reduce((sum, d) => sum + d, 0) / durations.length;\n const pending = snapshot.stories.filter((story) => !story.passes).length;\n return Math.round((averageMs * pending) / 1000);\n}\n\n/**\n * Remaining pipeline phases, in order. The phase list originates from the\n * session:start event, whose caller passes PIPELINE_PHASES (or\n * PIPELINE_PHASES_NO_BRANCH in --no-branch mode) from src/core/pipeline.ts.\n */\nfunction deriveNextSteps(snapshot: SessionSnapshot): string[] {\n if (snapshot.status === 'completed') return [];\n return snapshot.phases.filter((phase) => phase.status === 'pending').map((phase) => phase.name);\n}\n\n/**\n * Board status of a single story, in a fixed order that makes the derivation\n * idempotent — recomputing it over its own result yields the same value:\n *\n * 1. `passes: true` → `done` (execution is the only authority on completion);\n * 2. already `in_review` → kept, since nothing here can produce or clear it;\n * 3. the story owns the current activity → `in_progress`;\n * 4. otherwise → `backlog`.\n *\n * `in_review` is therefore never derived: it only enters through an explicit\n * `status` in tasks.json, and leaves when the story starts passing.\n */\nfunction deriveStoryStatus(\n story: SessionStorySnapshot,\n activeStory: string | null,\n): UserStoryStatus {\n if (story.passes) return 'done';\n if (story.status === 'in_review') return 'in_review';\n if (activeStory !== null && activeStory === story.id) return 'in_progress';\n return 'backlog';\n}\n\n/** Recompute every story's status; entries that do not change keep identity. */\nfunction deriveStoryStatuses(snapshot: SessionSnapshot): SessionStorySnapshot[] {\n const activeStory = snapshot.currentActivity?.story ?? null;\n return snapshot.stories.map((story) => {\n const status = deriveStoryStatus(story, activeStory);\n return status === story.status ? story : { ...story, status };\n });\n}\n\n/**\n * Fold a SessionEvent into a SessionSnapshot. Pure: never mutates the input\n * and performs no I/O. Unknown event types return the snapshot unchanged.\n *\n * errors/warnings are derived slices of the logs ring buffer, recomputed on\n * each reduction — they are never accumulated separately. The same applies\n * to estimatedRemainingSeconds, nextSteps and each story's status.\n */\nexport function reduceSessionEvent(\n snapshot: SessionSnapshot,\n event: SessionEvent,\n options?: SessionReducerOptions,\n): SessionSnapshot {\n const next = applyEvent(snapshot, event, options);\n if (next === snapshot) return snapshot;\n\n const elapsedSeconds = secondsBetween(next.startedAt, event.at) ?? next.elapsedSeconds;\n return {\n ...next,\n updatedAt: event.at,\n elapsedSeconds,\n stories: deriveStoryStatuses(next),\n estimatedRemainingSeconds: estimateRemainingSeconds(next),\n errors: next.logs.filter((entry) => entry.level === 'error'),\n warnings: next.logs.filter((entry) => entry.level === 'warn'),\n nextSteps: deriveNextSteps(next),\n };\n}\n\n/**\n * Stages that describe a finished story. A run that ends — successfully or\n * not — must never leave a story on any other stage, or the panel keeps\n * claiming it is executing long after the process is gone.\n */\nfunction isTerminalStage(stage: StoryStage): boolean {\n return stage === 'done' || stage === 'failed';\n}\n\nfunction transitionStory(\n story: SessionStorySnapshot,\n stage: StoryStage,\n at: string,\n detail: string | null,\n): SessionStorySnapshot {\n if (story.stage === stage && story.stageDetail === detail) return story;\n return {\n ...story,\n stage,\n stageSince: at,\n stageDetail: detail,\n history: [...story.history, { at, stage, detail }],\n };\n}\n\n/**\n * `stage`/`stageSince`/`stageDetail` for one story, on one `stories:update`.\n *\n * This event owns exactly one transition — `awaiting_review` the moment a\n * story flips to `passes: true` (or is first seen already passing, since its\n * real completion moment is unknown either way). Everything else is a\n * carry-over: a still-`passes: false` story keeps whatever `iteration:start`\n * last gave it (defaulting to `'pending'` the very first time it is ever\n * seen), and a story already passing before this event is left exactly as it\n * was — `phase:start`/`phase:end` (review) and `correction:cycle` own every\n * transition past `awaiting_review`.\n */\nfunction deriveStageOnStoriesUpdate(\n story: UserStory,\n before: SessionStorySnapshot | undefined,\n at: string,\n): Pick<SessionStorySnapshot, 'stage' | 'stageSince' | 'stageDetail'> {\n if (!story.passes) {\n return {\n stage: before?.stage ?? 'pending',\n stageSince: before?.stageSince ?? at,\n stageDetail: before?.stageDetail ?? null,\n };\n }\n if (before?.passes) {\n return { stage: before.stage, stageSince: before.stageSince, stageDetail: before.stageDetail };\n }\n return { stage: 'awaiting_review', stageSince: at, stageDetail: null };\n}\n\nfunction applyEvent(\n snapshot: SessionSnapshot,\n event: SessionEvent,\n options?: SessionReducerOptions,\n): SessionSnapshot {\n switch (event.type) {\n case 'session:start': {\n setTelemetrySessionId(event.sessionId);\n const initial = createInitialSnapshot();\n return {\n ...initial,\n sessionId: event.sessionId,\n issue: { ...initial.issue, number: event.issueNumber, url: event.issueUrl ?? null },\n status: 'running',\n startedAt: event.at,\n progress: {\n ...initial.progress,\n phasesTotal: event.phases.length,\n },\n phases: event.phases.map((name) => ({\n name,\n status: 'pending' as const,\n startedAt: null,\n endedAt: null,\n durationSeconds: null,\n error: null,\n ...emptyPhaseTiming(),\n ...emptyUsage(),\n })),\n git: {\n branch: event.branch ?? null,\n baseBranch: event.baseBranch ?? null,\n branchCreated: event.branchCreated ?? null,\n startCommit: event.startCommit ?? null,\n commits: [],\n },\n // The branch is the one piece of repository identity the session\n // already knows here; the rest waits for publishGitState. Seeding it\n // keeps git.branch and repository.branch consistent for a poll that\n // lands before the first git:update.\n repository: { ...initial.repository, branch: event.branch ?? null },\n configuration: event.configuration ?? null,\n environment: event.environment\n ? {\n node: event.environment.node,\n platform: event.environment.platform,\n agent: event.environment.agent ?? null,\n model: event.environment.model ?? null,\n }\n : null,\n };\n }\n\n case 'issue:update':\n return {\n ...snapshot,\n issue: {\n ...snapshot.issue,\n // Merge, not replacement: the run may know a number and a URL that\n // the provider does not report (a local Issue mirroring a remote\n // one), and enriching the section must never erase them.\n number: event.number ?? snapshot.issue.number,\n url: event.url ?? snapshot.issue.url,\n title: event.title,\n description: event.description,\n labels: event.labels,\n state: event.state,\n },\n };\n\n case 'phase:start': {\n const known = snapshot.phases.some((p) => p.name === event.phase);\n const phases = known\n ? snapshot.phases.map((p) =>\n p.name === event.phase\n ? {\n ...p,\n status: 'running' as const,\n startedAt: event.at,\n endedAt: null,\n error: null,\n }\n : p,\n )\n : [\n ...snapshot.phases,\n {\n name: event.phase,\n status: 'running' as const,\n startedAt: event.at,\n endedAt: null,\n durationSeconds: null,\n error: null,\n ...emptyPhaseTiming(),\n ...emptyUsage(),\n },\n ];\n // The `execute` phase only completes (and `review` only starts) once\n // every story already passes — a pipeline invariant — so entering\n // `review` safely moves every passing story to 'in_review' in one go;\n // there is never a not-yet-passing story to skip over here.\n const stories =\n event.phase === 'review'\n ? snapshot.stories.map((story) =>\n story.passes ? transitionStory(story, 'in_review', event.at, null) : story,\n )\n : snapshot.stories;\n return {\n ...snapshot,\n currentPhase: event.phase,\n phases,\n stories,\n progress: known ? snapshot.progress : { ...snapshot.progress, phasesTotal: phases.length },\n };\n }\n\n case 'phase:end': {\n const phases = snapshot.phases.map((p) =>\n p.name === event.phase\n ? {\n ...p,\n status: event.success ? ('completed' as const) : ('failed' as const),\n endedAt: event.at,\n durationSeconds: secondsBetween(p.startedAt, event.at),\n error: event.error ? stripVTControlCharacters(event.error) : null,\n harnessExecutionMs: event.harnessExecutionMs ?? p.harnessExecutionMs,\n orchestrationOverheadMs: event.orchestrationOverheadMs ?? p.orchestrationOverheadMs,\n harnessStartupMs: event.harnessStartupMs ?? p.harnessStartupMs,\n ttftMs: event.ttftMs ?? p.ttftMs,\n attemptCount: event.attemptCount ?? p.attemptCount,\n retryDurationMs: event.retryDurationMs ?? p.retryDurationMs,\n }\n : p,\n );\n const phasesCompleted = phases.filter((p) => p.status === 'completed').length;\n // Success moves every passing story to 'done'. Failure (the correction\n // loop gave up after maxCorrectionCycles) closes every story that is not\n // already 'done' as 'failed' — including the ones that never reached\n // `passes`, which are precisely the stories the issue calls failed. A\n // phase that fails outside `review` closes the same non-terminal stages,\n // so nothing is left frozen on 'executing' after the run stops.\n const stories = !event.success\n ? snapshot.stories.map((story) =>\n isTerminalStage(story.stage) ? story : transitionStory(story, 'failed', event.at, null),\n )\n : event.phase === 'review'\n ? snapshot.stories.map((story) =>\n story.passes ? transitionStory(story, 'done', event.at, null) : story,\n )\n : snapshot.stories;\n return {\n ...snapshot,\n currentPhase: snapshot.currentPhase === event.phase ? null : snapshot.currentPhase,\n currentActivity: null,\n phases,\n stories,\n progress: {\n ...snapshot.progress,\n phasesCompleted,\n percent: computePercent(phasesCompleted, snapshot.progress.phasesTotal),\n },\n };\n }\n\n case 'iteration:start': {\n // The story matching storyId becomes 'executing'; every other\n // not-yet-passing story becomes 'pending' (a story that was already\n // 'executing' in a previous iteration but lost the turn reverts here).\n // Passing stories are untouched — this event owns only the\n // execute-loop's own pending/executing transition, never review or\n // correction. No-op branches (`return story`) avoid needless object\n // churn when the stage is already correct.\n const storyId = event.storyId;\n const stories = snapshot.stories.map((story) => {\n if (story.passes) return story;\n if (story.id === storyId) {\n return transitionStory(story, 'executing', event.at, null);\n }\n return transitionStory(story, 'pending', event.at, null);\n });\n return {\n ...snapshot,\n execution: { ...snapshot.execution, iteration: event.iteration },\n stories,\n // Finally populates the `story` field of the activity payload during\n // execute — today this phase never publishes an `activity` event at\n // all (no streaming), so `currentActivity` stays whatever an earlier\n // phase left it at. Left untouched when storyId is absent (every\n // story already passes, or the caller could not determine one).\n currentActivity:\n storyId !== undefined\n ? { story: storyId, tool: null, detail: null, since: event.at }\n : snapshot.currentActivity,\n };\n }\n\n case 'iteration:end':\n return { ...snapshot, currentActivity: null };\n\n case 'retry':\n return {\n ...snapshot,\n execution: { ...snapshot.execution, retries: snapshot.execution.retries + 1 },\n };\n\n case 'agent:attempt':\n return {\n ...snapshot,\n resilience: {\n ...snapshot.resilience,\n attempt: event.attempt,\n provider: event.provider,\n model: event.model ?? null,\n lastActivityAt: event.at,\n },\n };\n\n case 'failover':\n return {\n ...snapshot,\n resilience: {\n ...snapshot.resilience,\n provider: event.to,\n lastFailureKind: event.reason,\n cooldownUntil: event.cooldownUntil ?? null,\n lastActivityAt: event.at,\n },\n };\n\n case 'agent:result':\n return {\n ...snapshot,\n resilience: {\n ...snapshot.resilience,\n provider: event.provider,\n lastFailureKind: event.failureKind ?? snapshot.resilience.lastFailureKind,\n cooldownUntil: event.cooldownUntil ?? null,\n lastActivityAt: event.at,\n },\n };\n\n case 'agent:activity':\n return {\n ...snapshot,\n resilience: {\n ...snapshot.resilience,\n provider: event.provider,\n lastActivityAt: event.at,\n },\n };\n\n case 'stories:update': {\n const previous = new Map(snapshot.stories.map((story) => [story.id, story]));\n const stories = event.stories.map((story) => {\n const before = previous.get(story.id);\n // Stamp the flip to passing; stories already passing when first seen\n // keep null (completed before this session, duration unknown).\n const completedAt = !story.passes\n ? null\n : before && !before.passes\n ? event.at\n : (before?.completedAt ?? null);\n // stories:update rebuilds the array from the plan on every publish, so\n // metrics already attributed to a story must be carried over here or\n // the next update would wipe them.\n const stage = deriveStageOnStoriesUpdate(story, before, event.at);\n const history = before?.history ?? [];\n const stageChanged = before !== undefined && before.stage !== stage.stage;\n return {\n id: story.id,\n title: story.title,\n priority: story.priority,\n passes: story.passes,\n completedAt,\n // Seed only: deriveStoryStatus() recomputes it right after, so an\n // explicit 'done' in the plan on a story with passes: false is not\n // honoured — `passes` remains the single source of truth. The plan's\n // value survives just for 'in_review', which no derivation produces.\n status: story.status ?? before?.status ?? 'backlog',\n dependencies: story.dependencies ?? [],\n // Required on UserStory, so the plan is always the source — no\n // carry-over from `before` the way the accumulated fields need.\n description: story.description,\n acceptanceCriteria: story.acceptanceCriteria,\n durationSeconds: before?.durationSeconds ?? null,\n inputTokens: before?.inputTokens ?? null,\n outputTokens: before?.outputTokens ?? null,\n cacheReadTokens: before?.cacheReadTokens ?? null,\n cacheCreationTokens: before?.cacheCreationTokens ?? null,\n costUsd: before?.costUsd ?? null,\n ...stage,\n history: stageChanged\n ? [...history, { at: event.at, stage: stage.stage, detail: stage.stageDetail }]\n : history,\n };\n });\n return {\n ...snapshot,\n stories,\n progress: {\n ...snapshot.progress,\n storiesCompleted: stories.filter((s) => s.passes).length,\n storiesTotal: stories.length,\n },\n };\n }\n\n case 'activity': {\n const story = event.story ?? null;\n const tool = event.tool ?? null;\n const detail = event.detail ?? null;\n const current = snapshot.currentActivity;\n // Same activity repeated: keep `since` so the UI can show \"for how long\".\n const since =\n current && current.story === story && current.tool === tool && current.detail === detail\n ? current.since\n : event.at;\n return {\n ...snapshot,\n currentActivity: { story, tool, detail, since },\n resilience: { ...snapshot.resilience, lastActivityAt: event.at },\n };\n }\n\n case 'log': {\n const limit = options?.logLimit ?? DEFAULT_LOG_LIMIT;\n const entry: SessionLogEntry = {\n at: event.at,\n level: event.level,\n message: stripVTControlCharacters(event.message),\n };\n const logs = [...snapshot.logs, entry].slice(-Math.max(1, limit));\n return { ...snapshot, logs };\n }\n\n case 'process:output': {\n const limit = options?.logLimit ?? DEFAULT_LOG_LIMIT;\n const entry: SessionProcessLogEntry = {\n at: event.at,\n phase: event.phase,\n executionId: event.executionId,\n provider: event.provider,\n stream: event.stream,\n message: stripVTControlCharacters(event.message),\n };\n return {\n ...snapshot,\n processLogs: [...snapshot.processLogs, entry].slice(-Math.max(1, limit)),\n };\n }\n\n case 'execution:update': {\n const index = snapshot.executions.findIndex((entry) => entry.id === event.execution.id);\n const executions = [...snapshot.executions];\n if (index === -1) executions.push(event.execution);\n else executions[index] = event.execution;\n return { ...snapshot, executions };\n }\n\n case 'git:update':\n return {\n ...snapshot,\n git: {\n branch: event.branch ?? snapshot.git.branch,\n baseBranch: event.baseBranch ?? snapshot.git.baseBranch,\n branchCreated: reported(event.branchCreated, snapshot.git.branchCreated),\n startCommit: snapshot.git.startCommit,\n commits: event.commits ?? snapshot.git.commits,\n },\n repository: {\n // `undefined` is \"not collected\", so the previous value stands; an\n // explicit `null` is \"collected and unavailable\" and overwrites it.\n name: reported(event.repositoryName, snapshot.repository.name),\n remoteUrl: reported(event.remoteUrl, snapshot.repository.remoteUrl),\n branch: event.branch ?? snapshot.repository.branch,\n headCommit: reported(event.headCommit, snapshot.repository.headCommit),\n root: reported(event.repositoryRoot, snapshot.repository.root),\n },\n pullRequests: event.pullRequests ?? snapshot.pullRequests,\n };\n\n case 'correction:cycle': {\n // Correction is pipeline-wide, not per-story: commands/run.ts re-runs\n // the whole execute+review cycle on a review failure, with no notion\n // of which story a finding belongs to — so every passing story moves\n // to 'in_correction' together, carrying the cycle count as a readable\n // stageDetail.\n const stageDetail = `Cycle ${event.cycle}/${event.maxCycles}`;\n const stories = snapshot.stories.map((story) =>\n story.passes ? transitionStory(story, 'in_correction', event.at, stageDetail) : story,\n );\n return {\n ...snapshot,\n execution: {\n ...snapshot.execution,\n correctionCycle: event.cycle,\n maxCorrectionCycles: event.maxCycles,\n },\n stories,\n };\n }\n\n case 'metrics:update': {\n if (event.scope === 'story') {\n // Story metrics are a rateio of the iteration that completed them;\n // the iteration-scoped event already fed the phase and the aggregate,\n // so counting them again here would double the totals.\n if (event.storyId === undefined) return snapshot;\n if (!snapshot.stories.some((s) => s.id === event.storyId)) return snapshot;\n return {\n ...snapshot,\n stories: snapshot.stories.map((story) =>\n story.id === event.storyId\n ? {\n ...accumulateUsage(story, event),\n durationSeconds: accumulate(story.durationSeconds, event.durationSeconds),\n }\n : story,\n ),\n };\n }\n\n // phase and iteration scopes both land on the named phase. An event for\n // a phase the snapshot never saw is ignored rather than appended: it\n // would show up as a phantom entry in the UI.\n if (event.phase === undefined) return snapshot;\n if (!snapshot.phases.some((p) => p.name === event.phase)) return snapshot;\n return {\n ...snapshot,\n // durationSeconds is deliberately untouched here: phase:start and\n // phase:end remain the single source of a phase's wall-clock time.\n phases: snapshot.phases.map((phase) =>\n phase.name === event.phase ? accumulateUsage(phase, event) : phase,\n ),\n metrics: {\n totalInputTokens: accumulate(snapshot.metrics.totalInputTokens, event.inputTokens),\n totalOutputTokens: accumulate(snapshot.metrics.totalOutputTokens, event.outputTokens),\n totalCacheReadTokens: accumulate(\n snapshot.metrics.totalCacheReadTokens,\n event.cacheReadTokens,\n ),\n totalCacheCreationTokens: accumulate(\n snapshot.metrics.totalCacheCreationTokens,\n event.cacheCreationTokens,\n ),\n totalCostUsd: accumulate(snapshot.metrics.totalCostUsd, event.costUsd),\n },\n };\n }\n\n case 'verify:end':\n return {\n ...snapshot,\n verification: {\n verdict: event.verdict,\n level: event.level,\n independence: event.independence,\n },\n };\n\n case 'session:end':\n return {\n ...snapshot,\n status: event.status,\n endedAt: event.at,\n currentPhase: null,\n currentActivity: null,\n // Close every non-terminal stage: the run is over, so nothing can be\n // 'executing'/'in_review'/'in_correction' any more. A story that never\n // reached `passes` on a run that did not complete is exactly what the\n // 'failed' stage means; anything else settles as 'done'.\n stories: snapshot.stories.map((story) => {\n if (isTerminalStage(story.stage)) return story;\n const stage =\n event.status === 'completed' && story.passes ? ('done' as const) : ('failed' as const);\n return transitionStory(story, stage, event.at, null);\n }),\n lastError: event.error\n ? { message: stripVTControlCharacters(event.error), at: event.at }\n : snapshot.lastError,\n };\n\n default:\n return snapshot;\n }\n}\n\nexport interface SessionPublisher {\n /**\n * Publish an event. Synchronous, never throws, never returns a promise —\n * safe to call from any instrumentation point without affecting execution.\n */\n publish(event: SessionEvent): void;\n /** Current in-memory snapshot. */\n snapshot(): SessionSnapshot;\n /** Monotonic counter, bumped on every applied event (basis for ETags). */\n version(): number;\n /** Force any pending output to be written. Never rejects. */\n flush(): Promise<void>;\n /** Flush and release resources. Never rejects. */\n close(): Promise<void>;\n}\n\n/**\n * Default publisher when monitoring is off: every call is a no-op, so each\n * instrumentation point costs a method call that returns immediately.\n */\nexport class NullPublisher implements SessionPublisher {\n private readonly empty = createInitialSnapshot();\n\n publish(_event: SessionEvent): void {}\n\n snapshot(): SessionSnapshot {\n return this.empty;\n }\n\n version(): number {\n return 0;\n }\n\n async flush(): Promise<void> {}\n\n async close(): Promise<void> {}\n}\n\nexport interface MemoryPublisherOptions extends SessionReducerOptions {\n /** Called at most once, on the first internal failure. */\n onWarn?: (message: string) => void;\n /**\n * When false, log events are dropped before reaching the snapshot, so no\n * log line is ever published (session.json or HTTP). Default true.\n */\n includeLogs?: boolean;\n}\n\n/**\n * In-memory publisher: reduces events over a snapshot and tracks a monotonic\n * version. Base class for publishers with an output surface (file, HTTP).\n */\nexport class MemoryPublisher implements SessionPublisher {\n protected state: SessionSnapshot = createInitialSnapshot();\n protected versionCounter = 0;\n private warned = false;\n private readonly onWarn: (message: string) => void;\n private readonly reducerOptions: SessionReducerOptions;\n private readonly includeLogs: boolean;\n\n constructor(options: MemoryPublisherOptions = {}) {\n this.onWarn = options.onWarn ?? ((message) => process.stderr.write(`${message}\\n`));\n this.reducerOptions = { logLimit: options.logLimit };\n this.includeLogs = options.includeLogs ?? true;\n }\n\n publish(event: SessionEvent): void {\n if (event.type === 'log' && !this.includeLogs) return;\n try {\n this.state = reduceSessionEvent(this.state, event, this.reducerOptions);\n this.versionCounter++;\n this.afterPublish(event);\n } catch (err) {\n this.warnOnce(err);\n }\n }\n\n /** Hook for subclasses; runs inside publish()'s try/catch. */\n protected afterPublish(_event: SessionEvent): void {}\n\n snapshot(): SessionSnapshot {\n return this.state;\n }\n\n version(): number {\n return this.versionCounter;\n }\n\n async flush(): Promise<void> {}\n\n async close(): Promise<void> {}\n\n protected warnOnce(err: unknown): void {\n if (this.warned) return;\n this.warned = true;\n const message = err instanceof Error ? err.message : String(err);\n try {\n this.onWarn(\n `issue-flow: web monitoring hit an error (will keep retrying silently): ${message}`,\n );\n } catch {\n // Even a failing warn callback must not propagate to the pipeline.\n }\n }\n}\n\nexport interface FilePublisherOptions extends MemoryPublisherOptions {\n /** Minimum interval between disk writes (ms). Default 1000. */\n throttleMs?: number;\n /** Interval between mtime-only heartbeats (ms). Zero disables it. Default 10000. */\n heartbeatMs?: number;\n}\n\n/**\n * Publisher that mirrors the snapshot to issues/N/session.json.\n *\n * Writes are atomic (write-to-temp + rename) and throttled; terminal events\n * (phase:end, session:end) force an immediate write. All I/O failures are\n * swallowed after a single warning.\n */\nexport class FilePublisher extends MemoryPublisher {\n private readonly filePath: string;\n private readonly throttleMs: number;\n private timer: NodeJS.Timeout | null = null;\n private heartbeatTimer: NodeJS.Timeout | null = null;\n private lastWriteStartedAt = 0;\n private lastWrittenVersion = 0;\n private writeChain: Promise<void> = Promise.resolve();\n private closed = false;\n\n constructor(filePath: string, options: FilePublisherOptions = {}) {\n super(options);\n this.filePath = filePath;\n this.throttleMs = options.throttleMs ?? DEFAULT_THROTTLE_MS;\n const heartbeatMs = options.heartbeatMs ?? DEFAULT_SESSION_HEARTBEAT_MS;\n if (heartbeatMs > 0) {\n this.heartbeatTimer = setInterval(() => this.enqueueHeartbeat(), heartbeatMs);\n this.heartbeatTimer.unref();\n }\n }\n\n protected override afterPublish(event: SessionEvent): void {\n if (this.closed) return;\n const terminal =\n event.type === 'phase:end' || event.type === 'session:end' || event.type === 'verify:end';\n this.scheduleWrite(terminal);\n }\n\n private scheduleWrite(force: boolean): void {\n if (force) {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this.enqueueWrite();\n return;\n }\n if (this.timer !== null) return;\n const wait = Math.max(0, this.throttleMs - (Date.now() - this.lastWriteStartedAt));\n if (wait === 0) {\n this.enqueueWrite();\n return;\n }\n this.timer = setTimeout(() => {\n this.timer = null;\n this.enqueueWrite();\n }, wait);\n this.timer.unref();\n }\n\n private enqueueWrite(): void {\n this.lastWriteStartedAt = Date.now();\n this.writeChain = this.writeChain.then(async () => {\n const version = this.versionCounter;\n if (version === this.lastWrittenVersion) return;\n const payload = `${JSON.stringify(this.state, null, 2)}\\n`;\n try {\n await atomicWriteFile(this.filePath, payload);\n this.lastWrittenVersion = version;\n } catch (err) {\n this.warnOnce(err);\n }\n });\n }\n\n /**\n * Keep directory-based discovery alive without changing snapshot content or\n * its content-derived ETag. The write chain serializes the touch with atomic\n * snapshot replacement, and no heartbeat is attempted before the first file\n * has been written successfully.\n */\n private enqueueHeartbeat(): void {\n if (this.closed) return;\n this.writeChain = this.writeChain.then(async () => {\n if (this.closed || this.lastWrittenVersion === 0) return;\n const now = new Date();\n try {\n await utimes(this.filePath, now, now);\n } catch (err) {\n this.warnOnce(err);\n }\n });\n }\n\n override async flush(): Promise<void> {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n if (this.versionCounter !== this.lastWrittenVersion) {\n this.enqueueWrite();\n }\n await this.writeChain;\n }\n\n override async close(): Promise<void> {\n if (this.heartbeatTimer !== null) {\n clearInterval(this.heartbeatTimer);\n this.heartbeatTimer = null;\n }\n this.closed = true;\n await this.flush();\n }\n}\n\n/**\n * Atomic write: write to a temp file next to the target, then rename. The\n * same-directory temp keeps the rename on a single filesystem (rename is\n * atomic; no EXDEV fallback needed, unlike an os.tmpdir() temp on Linux\n * tmpfs) and leaves nothing behind. The FilePublisher write chain is the\n * single writer, so the fixed .tmp name never races.\n *\n * The target directory (issues/N/) may not exist yet the first time a fresh\n * issue publishes — pipeline phases create it lazily, and this can be the\n * very first write. mkdir recursive is idempotent, so it's cheap to ensure\n * on every write rather than relying on call order elsewhere.\n */\nasync function atomicWriteFile(path: string, content: string): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n const tmpFile = `${path}.tmp`;\n await writeFile(tmpFile, content, 'utf-8');\n await rename(tmpFile, path);\n}\n","import { NullPublisher, type SessionPublisher } from './session-state.js';\n\n/**\n * Global slot for the active SessionPublisher, following the same pattern as\n * setVerbose in verbose.ts. Instrumentation points (logger, engine, headless)\n * read the slot via getSessionPublisher(); run.ts installs a MemoryPublisher\n * for every run and a FilePublisher on top when web monitoring is enabled.\n * The default NullPublisher makes every instrumentation point a no-op\n * before a run (or a standalone command) installs a publisher.\n */\n\nconst NULL_PUBLISHER = new NullPublisher();\n\nlet _publisher: SessionPublisher = NULL_PUBLISHER;\n\n/**\n * Install the active session publisher. Pass undefined to reset to the\n * default NullPublisher.\n */\nexport function setSessionPublisher(publisher: SessionPublisher | undefined): void {\n _publisher = publisher ?? NULL_PUBLISHER;\n}\n\nexport function getSessionPublisher(): SessionPublisher {\n return _publisher;\n}\n"],"mappings":";;;;;;AAAA,SAAS,OAAO,QAAQ,QAAQ,iBAAiB;AACjD,SAAS,eAAe;AACxB,SAAS,gCAAgC;AAuBlC,IAAM,oBAAoB;AAG1B,IAAM,sBAAsB;AAG5B,IAAM,+BAA+B;AAmb5C,SAAS,aAAmC;AAC1C,SAAO;AAAA,IACL,aAAa;AAAA,IACb,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB,SAAS;AAAA,EACX;AACF;AAEA,SAAS,mBAQP;AACA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;AACrB,UAAI;AACF,cAAM,OAAO,KAAK,UAAU,KAAK,GAAG;AAAA,MACtC,SAAS,KAAK;AACZ,aAAK,SAAS,GAAG;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAe,QAAuB;AACpC,QAAI,KAAK,UAAU,MAAM;AACvB,mBAAa,KAAK,KAAK;AACvB,WAAK,QAAQ;AAAA,IACf;AACA,QAAI,KAAK,mBAAmB,KAAK,oBAAoB;AACnD,WAAK,aAAa;AAAA,IACpB;AACA,UAAM,KAAK;AAAA,EACb;AAAA,EAEA,MAAe,QAAuB;AACpC,QAAI,KAAK,mBAAmB,MAAM;AAChC,oBAAc,KAAK,cAAc;AACjC,WAAK,iBAAiB;AAAA,IACxB;AACA,SAAK,SAAS;AACd,UAAM,KAAK,MAAM;AAAA,EACnB;AACF;AAcA,eAAe,gBAAgB,MAAc,SAAgC;AAC3E,QAAM,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AAC9C,QAAM,UAAU,GAAG,IAAI;AACvB,QAAM,UAAU,SAAS,SAAS,OAAO;AACzC,QAAM,OAAO,SAAS,IAAI;AAC5B;;;ACt8CA,IAAM,iBAAiB,IAAI,cAAc;AAEzC,IAAI,aAA+B;AAM5B,SAAS,oBAAoB,WAA+C;AACjF,eAAa,aAAa;AAC5B;AAEO,SAAS,sBAAwC;AACtD,SAAO;AACT;","names":[]}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadPolicyConfig,
|
|
4
4
|
mergeConfigLayers
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WM3Y7Q4A.js";
|
|
6
6
|
import {
|
|
7
7
|
printWarning
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NVZMBXTE.js";
|
|
9
9
|
import {
|
|
10
10
|
getProjectRoot,
|
|
11
11
|
run
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GSZCQUCY.js";
|
|
13
13
|
|
|
14
14
|
// src/conventions/git/types.ts
|
|
15
15
|
var CHANGE_TYPES = [
|
|
@@ -1559,4 +1559,4 @@ export {
|
|
|
1559
1559
|
issueReferenceLines,
|
|
1560
1560
|
loadRepositoryPolicy
|
|
1561
1561
|
};
|
|
1562
|
-
//# sourceMappingURL=chunk-
|
|
1562
|
+
//# sourceMappingURL=chunk-6SRE4KD7.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
printWarning
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NVZMBXTE.js";
|
|
5
5
|
import {
|
|
6
6
|
getProjectRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GSZCQUCY.js";
|
|
8
8
|
|
|
9
9
|
// src/core/prompt-resolver.ts
|
|
10
10
|
import { existsSync } from "fs";
|
|
@@ -107,4 +107,4 @@ export {
|
|
|
107
107
|
loadPrompt,
|
|
108
108
|
applyPlaceholders
|
|
109
109
|
};
|
|
110
|
-
//# sourceMappingURL=chunk-
|
|
110
|
+
//# sourceMappingURL=chunk-A35HE4V7.js.map
|