@staff0rd/assist 0.1183.0 → 0.1185.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/.build-files +69 -67
- package/dist/{addActivity-5UWKDHCJ.js → addActivity-Z5MLKDWA.js} +1 -1
- package/dist/built-version +1 -1
- package/dist/{chunk-KRKOPIZX.js → chunk-2I4XK5MA.js} +20 -12
- package/dist/{chunk-LJBRFKVU.js → chunk-4544QWU5.js} +1 -1
- package/dist/{chunk-EUXPITGV.js → chunk-5EJ2LGA3.js} +4 -4
- package/dist/{chunk-V7LKPU6K.js → chunk-5XN4S6XZ.js} +1 -1
- package/dist/{chunk-OSZLOSQ7.js → chunk-BV5VIK2W.js} +2 -2
- package/dist/{chunk-COVJ6KFD.js → chunk-BXGPF3TG.js} +13 -9
- package/dist/{chunk-HLGG6372.js → chunk-DQG77KTT.js} +1 -1
- package/dist/{chunk-OTBG7NWH.js → chunk-EOWEKIC2.js} +1 -1
- package/dist/chunk-FQZ6D3OJ.js +13 -0
- package/dist/{chunk-6O7EFYYQ.js → chunk-GCZ6AEIL.js} +2 -2
- package/dist/{chunk-2OZNXGMF.js → chunk-I2HNRZ6B.js} +1 -1
- package/dist/{chunk-BC5UJTW6.js → chunk-IELKR6CL.js} +17 -17
- package/dist/{chunk-GMZZH3NG.js → chunk-JUGJ42KK.js} +2 -2
- package/dist/{chunk-BCN5YGN4.js → chunk-LP7YYJC7.js} +1 -1
- package/dist/{chunk-TH6Y7OK4.js → chunk-OLE3K5FV.js} +1 -1
- package/dist/{chunk-6A7PMRDC.js → chunk-UC3HBCZ4.js} +1 -1
- package/dist/{chunk-XHPQVAVX.js → chunk-UPGNKZVA.js} +2 -2
- package/dist/{chunk-NGEJFH3F.js → chunk-VNADAKHS.js} +155 -150
- package/dist/{chunk-C6H77UCJ.js → chunk-Z2IQ4336.js} +1 -1
- package/dist/{cliHook-CCSWXSD7.js → cliHook-4HD2X27X.js} +5 -5
- package/dist/{codexHook-IH3XPACG.js → codexHook-DK2IZG3D.js} +5 -5
- package/dist/commands/sessions/web/bundle.js +456 -456
- package/dist/{comment-GDQRDDFY.js → comment-O7CAONH7.js} +2 -2
- package/dist/{commit-DQHAKNLH.js → commit-F22DVTS3.js} +3 -3
- package/dist/configKeys-HDARPPPH.js +1 -1
- package/dist/configKeys-KFWJBDSL.js +1 -1
- package/dist/{configSet-MSRWXZP3.js → configSet-5CHXIWZ2.js} +3 -3
- package/dist/{doctorNodes-ODYR6ZAC.js → doctorNodes-IH2N2BQY.js} +3 -3
- package/dist/{drainDaemon-LRMJS4UO.js → drainDaemon-ZHP2VY7D.js} +1 -1
- package/dist/{editHook-STPJOEOR.js → editHook-V3W4F23Z.js} +9 -9
- package/dist/{fixConflict-KMBO5NJ5.js → fixConflict-FW55CRP4.js} +3 -3
- package/dist/index.js +53 -52
- package/dist/isWake-SLMDAWOG.js +6 -0
- package/dist/{launchMode-QIZDZ7Z6.js → launchMode-LZ55HQJ5.js} +5 -4
- package/dist/{migrate-L4TWI5WU.js → migrate-3QULGPPE.js} +2 -2
- package/dist/{next-F5F5BL4P.js → next-KVT7J4K4.js} +4 -3
- package/dist/{piHook-CTS4AMQB.js → piHook-L32HW3PZ.js} +5 -5
- package/dist/{refine-GF4LESB3.js → refine-BGZNRL5F.js} +6 -5
- package/dist/{restartNode-DIC2TQJ3.js → restartNode-SJJTDHUZ.js} +5 -5
- package/dist/{review-GLH254ZE.js → review-SCZRZF24.js} +12 -12
- package/dist/{reviewPrComments-Q3JLGPEX.js → reviewPrComments-DWD6XA5X.js} +3 -3
- package/dist/{run-57MVTMKW.js → run-5KBJUBC5.js} +3 -2
- package/dist/{run-RAHLYZBV.js → run-VCAHBLHN.js} +3 -2
- package/dist/{runDaemon-HL5GQ34S.js → runDaemon-TF7BLARP.js} +3193 -3119
- package/dist/{runRefine-YW3U55TY.js → runRefine-IXOOMH5R.js} +8 -7
- package/dist/{signExtension-6PJQNRY6.js → signExtension-HBEXRIMY.js} +1 -1
- package/dist/{sqlColumns-IY3EPG2K.js → sqlColumns-D3ATP3WO.js} +2 -2
- package/dist/{sqlMutate-CKW3YQ6I.js → sqlMutate-JHR2MYX6.js} +2 -2
- package/dist/{sqlQuery-TEPL6L7Q.js → sqlQuery-Q72JEI5P.js} +2 -2
- package/dist/{sqlTables-T6APJAHH.js → sqlTables-M3VHLZKZ.js} +2 -2
- package/dist/startIssue-MAZ7G4IH.js +1 -1
- package/dist/{updateNode-WNYIOE7M.js → updateNode-ZGAOKVWQ.js} +5 -5
- package/dist/{web-KETYWG4M.js → web-GSYSNJL4.js} +14 -14
- package/dist/{web-YYRJTAU7.js → web-VZLRDCEQ.js} +14 -14
- package/package.json +1 -1
- package/dist/{analyze-WFFDLZQU.js → analyze-V4KQTHT3.js} +3 -3
- package/dist/{blockCodeComments-63L7F6T4.js → blockCodeComments-OUTWI4N4.js} +1 -1
- package/dist/{chunk-XKJJ7CSC.js → chunk-2K4KYWJP.js} +3 -3
- package/dist/{chunk-JDPIT22R.js → chunk-SIFUWUCY.js} +8 -8
- package/dist/{chunk-IQGY6BGN.js → chunk-TM3TO23X.js} +3 -3
- package/dist/{chunk-DZ63MNUG.js → chunk-UUVGQEPE.js} +3 -3
- package/dist/{chunk-ZPGJZFFQ.js → chunk-WEFNGOOK.js} +3 -3
- package/dist/{configGet-QX3RMIEE.js → configGet-PUN6DH6S.js} +10 -10
- package/dist/{docsConfirm-GDHYL52L.js → docsConfirm-4QFZB55D.js} +3 -3
- package/dist/{docsUnlock-IO2JFHLH.js → docsUnlock-YOBAXRNU.js} +3 -3
- package/dist/{list-KRQZ2B62.js → list-3CB46CZF.js} +4 -4
- package/dist/{next-I6SRSJ6Q.js → next-PTVGLQNQ.js} +3 -3
- package/dist/{reply-TP5KOGGN.js → reply-GTYV733P.js} +3 -3
- package/dist/{schemaConfirm-X7BAD6DC.js → schemaConfirm-XOLIB2IE.js} +8 -8
- package/dist/{schemaLock-VY76ZB5O.js → schemaLock-WB3S7LCZ.js} +3 -3
- package/dist/{schemaUnlock-ZIRINECP.js → schemaUnlock-VL7UM72M.js} +3 -3
- package/dist/{slack-UTI3VEV7.js → slack-XPBJ6FBO.js} +3 -3
- package/dist/{version-WWNN3LFM.js → version-IRNIB54T.js} +4 -4
- package/dist/{wontfix-3U7LZF2M.js → wontfix-W2DXPEE4.js} +3 -3
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-JM57BCD6.js";
|
|
11
11
|
import {
|
|
12
12
|
firstBrokenHop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5XN4S6XZ.js";
|
|
14
14
|
import {
|
|
15
15
|
describePeerError,
|
|
16
16
|
fetchPeerJson
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
resolveLinkTarget,
|
|
40
40
|
usageWindowKey,
|
|
41
41
|
watcherLogPath
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-SIFUWUCY.js";
|
|
43
43
|
import {
|
|
44
44
|
TRACE_HEADER,
|
|
45
45
|
newTraceId
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import {
|
|
48
48
|
ASSIST_VERSION,
|
|
49
49
|
PROTOCOL_VERSION
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-EOWEKIC2.js";
|
|
51
51
|
import {
|
|
52
52
|
findLinkSpec
|
|
53
53
|
} from "./chunk-B2OH3RAT.js";
|
|
@@ -73,6 +73,9 @@ import {
|
|
|
73
73
|
import {
|
|
74
74
|
enumerateConfigLeafKeys
|
|
75
75
|
} from "./chunk-PB3F4XB3.js";
|
|
76
|
+
import {
|
|
77
|
+
splitFrontmatter
|
|
78
|
+
} from "./chunk-GVI4JSG7.js";
|
|
76
79
|
import {
|
|
77
80
|
addTesterOutcome,
|
|
78
81
|
connectAsc,
|
|
@@ -82,9 +85,6 @@ import {
|
|
|
82
85
|
import {
|
|
83
86
|
targetConversationEvents
|
|
84
87
|
} from "./chunk-MBXPXTLB.js";
|
|
85
|
-
import {
|
|
86
|
-
splitFrontmatter
|
|
87
|
-
} from "./chunk-GVI4JSG7.js";
|
|
88
88
|
import {
|
|
89
89
|
configEntryLayers,
|
|
90
90
|
ghFailure,
|
|
@@ -168,7 +168,7 @@ import {
|
|
|
168
168
|
} from "./chunk-G3ROBZ4I.js";
|
|
169
169
|
import {
|
|
170
170
|
coerceConfigValue
|
|
171
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-WEFNGOOK.js";
|
|
172
172
|
import {
|
|
173
173
|
applyUserConfigSet
|
|
174
174
|
} from "./chunk-3Y3VVI23.js";
|
|
@@ -198,6 +198,12 @@ import {
|
|
|
198
198
|
import {
|
|
199
199
|
readUserConfig
|
|
200
200
|
} from "./chunk-W2VCUKA4.js";
|
|
201
|
+
import {
|
|
202
|
+
configHelpForKey
|
|
203
|
+
} from "./chunk-7SMQSAXT.js";
|
|
204
|
+
import {
|
|
205
|
+
describeConfigLeaves
|
|
206
|
+
} from "./chunk-YRE5VUW7.js";
|
|
201
207
|
import {
|
|
202
208
|
getNestedValue
|
|
203
209
|
} from "./chunk-OU6Q5ZS3.js";
|
|
@@ -212,12 +218,6 @@ import {
|
|
|
212
218
|
dbBackedConfigKeys,
|
|
213
219
|
isDbBackedConfigKey
|
|
214
220
|
} from "./chunk-7XTWLKFV.js";
|
|
215
|
-
import {
|
|
216
|
-
configHelpForKey
|
|
217
|
-
} from "./chunk-7SMQSAXT.js";
|
|
218
|
-
import {
|
|
219
|
-
describeConfigLeaves
|
|
220
|
-
} from "./chunk-YRE5VUW7.js";
|
|
221
221
|
import {
|
|
222
222
|
mapConfigSecrets
|
|
223
223
|
} from "./chunk-YNHPTUHS.js";
|
|
@@ -236,16 +236,16 @@ import {
|
|
|
236
236
|
import {
|
|
237
237
|
updateStarred
|
|
238
238
|
} from "./chunk-7Z4FT2ZQ.js";
|
|
239
|
+
import {
|
|
240
|
+
loadBacklogSummaries,
|
|
241
|
+
searchBacklogSummaries
|
|
242
|
+
} from "./chunk-JQRXCIMN.js";
|
|
239
243
|
import {
|
|
240
244
|
requestDocsRefresh
|
|
241
245
|
} from "./chunk-SEHUEJ2O.js";
|
|
242
246
|
import {
|
|
243
247
|
rewindItemToPhase
|
|
244
248
|
} from "./chunk-QYXD4GZN.js";
|
|
245
|
-
import {
|
|
246
|
-
loadBacklogSummaries,
|
|
247
|
-
searchBacklogSummaries
|
|
248
|
-
} from "./chunk-JQRXCIMN.js";
|
|
249
249
|
import {
|
|
250
250
|
loadItemSummaries,
|
|
251
251
|
phaseUsageTotals,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
next
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BV5VIK2W.js";
|
|
4
4
|
import {
|
|
5
5
|
pullIfConfigured
|
|
6
6
|
} from "./chunk-FKPXA6JH.js";
|
|
7
7
|
import {
|
|
8
8
|
run
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VNADAKHS.js";
|
|
10
10
|
import {
|
|
11
11
|
launchBlocker
|
|
12
12
|
} from "./chunk-AFQMD7AO.js";
|
|
@@ -51,7 +51,7 @@ var persistedSessionSchema = z2.object({
|
|
|
51
51
|
subtitle: z2.string().optional(),
|
|
52
52
|
commandType: z2.enum(["claude", "run", "assist"]),
|
|
53
53
|
harness: z2.enum(harnessKinds).optional(),
|
|
54
|
-
status: z2.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
|
|
54
|
+
status: z2.enum(["running", "waiting", "done", "error", "stopped", "parked"]).optional(),
|
|
55
55
|
error: z2.string().optional(),
|
|
56
56
|
cwd: z2.string(),
|
|
57
57
|
startedAt: z2.number(),
|
|
@@ -159,7 +159,7 @@ function savePersistedSessions(sessions) {
|
|
|
159
159
|
}
|
|
160
160
|
function persistLiveSessions(sessions) {
|
|
161
161
|
const live = [...sessions.values()].filter(
|
|
162
|
-
(s) => (s.pty || s.status === "stopped" || s.status === "error" || s.awaitingSeed && s.pendingStart) && s.status !== "done"
|
|
162
|
+
(s) => (s.pty || s.status === "stopped" || s.status === "parked" || s.status === "error" || s.awaitingSeed && s.pendingStart) && s.status !== "done"
|
|
163
163
|
);
|
|
164
164
|
savePersistedSessions(live.map(toPersistedSession));
|
|
165
165
|
logPersist(live);
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
foreignLockHolder,
|
|
7
7
|
foreignOriginError,
|
|
8
8
|
isPausePending,
|
|
9
|
+
parkedExitCode,
|
|
9
10
|
releaseLock
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BXGPF3TG.js";
|
|
11
12
|
import {
|
|
12
13
|
worktreeConfigFor
|
|
13
14
|
} from "./chunk-6Z5ZFMOK.js";
|
|
@@ -22,9 +23,7 @@ import {
|
|
|
22
23
|
inWebSession
|
|
23
24
|
} from "./chunk-HKGCLAZ7.js";
|
|
24
25
|
import {
|
|
25
|
-
|
|
26
|
-
executePhase,
|
|
27
|
-
readSignal
|
|
26
|
+
executePhase
|
|
28
27
|
} from "./chunk-B734T35U.js";
|
|
29
28
|
import {
|
|
30
29
|
backlogPhaseActivity
|
|
@@ -35,6 +34,9 @@ import {
|
|
|
35
34
|
import {
|
|
36
35
|
emitActivity
|
|
37
36
|
} from "./chunk-4YAIQN3S.js";
|
|
37
|
+
import {
|
|
38
|
+
isWake
|
|
39
|
+
} from "./chunk-FQZ6D3OJ.js";
|
|
38
40
|
import {
|
|
39
41
|
loadPhaseProgress,
|
|
40
42
|
markPhaseDone
|
|
@@ -104,77 +106,6 @@ import {
|
|
|
104
106
|
// src/commands/backlog/run.ts
|
|
105
107
|
import chalk8 from "chalk";
|
|
106
108
|
|
|
107
|
-
// src/commands/backlog/ensureStoryBranch.ts
|
|
108
|
-
import { execSync } from "child_process";
|
|
109
|
-
import { basename } from "path";
|
|
110
|
-
async function ensureStoryBranch(item) {
|
|
111
|
-
const config = loadConfig();
|
|
112
|
-
if (config.prs?.required === false) {
|
|
113
|
-
log(item, "prs.required is false; left the session on its current branch");
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const recorded = recordedBranch(item);
|
|
117
|
-
if (recorded) {
|
|
118
|
-
adoptRecordedBranch(item, recorded);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
process.env.ASSIST_BACKLOG_ITEM_ID = String(item.id);
|
|
122
|
-
const slug = await generateBranchSlug(item.name);
|
|
123
|
-
const { branchName } = await createBranch({ slug, jira: item.jiraKey });
|
|
124
|
-
log(item, `prs.required on and no branch recorded; created ${branchName}`);
|
|
125
|
-
}
|
|
126
|
-
function recordedBranch(item) {
|
|
127
|
-
return (item.gitRefs ?? []).find((ref) => ref.kind === "branch")?.ref;
|
|
128
|
-
}
|
|
129
|
-
function adoptRecordedBranch(item, branch) {
|
|
130
|
-
const parked = worktreeBranchInPlay();
|
|
131
|
-
if (!parked) {
|
|
132
|
-
log(
|
|
133
|
-
item,
|
|
134
|
-
`branch ${branch} already recorded; left the session on its current branch`
|
|
135
|
-
);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
try {
|
|
139
|
-
execSync("git fetch", { stdio: "ignore" });
|
|
140
|
-
} catch {
|
|
141
|
-
}
|
|
142
|
-
try {
|
|
143
|
-
execSync(`git switch ${shellQuote(branch)}`, { stdio: "pipe" });
|
|
144
|
-
log(
|
|
145
|
-
item,
|
|
146
|
-
`branch ${branch} already recorded; switched off ${parked} onto it`
|
|
147
|
-
);
|
|
148
|
-
} catch (error) {
|
|
149
|
-
log(
|
|
150
|
-
item,
|
|
151
|
-
`branch ${branch} already recorded but the worktree stayed on ${parked}: ${message(error)}`
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function worktreeBranchInPlay() {
|
|
156
|
-
const tree = linkedWorktree(process.cwd());
|
|
157
|
-
if (!tree) return null;
|
|
158
|
-
const head = currentBranch();
|
|
159
|
-
return head === basename(tree.root) ? head : null;
|
|
160
|
-
}
|
|
161
|
-
function currentBranch() {
|
|
162
|
-
try {
|
|
163
|
-
return execSync("git rev-parse --abbrev-ref HEAD", {
|
|
164
|
-
encoding: "utf8",
|
|
165
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
166
|
-
}).trim();
|
|
167
|
-
} catch {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function log(item, outcome) {
|
|
172
|
-
appendDaemonLog(`backlog run ${item.id}: ${outcome}`);
|
|
173
|
-
}
|
|
174
|
-
function message(error) {
|
|
175
|
-
return error instanceof Error ? error.message : String(error);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
109
|
// src/commands/backlog/prepareRun.ts
|
|
179
110
|
import chalk2 from "chalk";
|
|
180
111
|
|
|
@@ -318,21 +249,6 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
318
249
|
return await awaitHarness(done, label, adapter.label) === 0;
|
|
319
250
|
}
|
|
320
251
|
|
|
321
|
-
// src/commands/backlog/discardStalePause.ts
|
|
322
|
-
function discardStalePause(itemId) {
|
|
323
|
-
if (!isPausePending(itemId)) return;
|
|
324
|
-
if (process.env.ASSIST_KEEP_PAUSE) {
|
|
325
|
-
appendDaemonLog(
|
|
326
|
-
`backlog run ${itemId}: kept the pending pause file at run start; this run was relaunched by a daemon restore, so the user's Continue-off still applies`
|
|
327
|
-
);
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
clearPause(itemId);
|
|
331
|
-
appendDaemonLog(
|
|
332
|
-
`backlog run ${itemId}: discarded stale pause file at run start; this run starts auto-advancing (Continue on) regardless of a prior run's pause`
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
252
|
// src/commands/backlog/handleReviewResult.ts
|
|
337
253
|
async function handleReviewResult(id, review) {
|
|
338
254
|
if (review.kind === "fail" || review.kind === "abort")
|
|
@@ -396,13 +312,6 @@ async function runInlinePhase(item, idx, plan, spawnOptions) {
|
|
|
396
312
|
return { preferred };
|
|
397
313
|
}
|
|
398
314
|
|
|
399
|
-
// src/commands/backlog/reloadPlan.ts
|
|
400
|
-
async function reloadPlan(id) {
|
|
401
|
-
const found = await findOneItem(String(id));
|
|
402
|
-
if (!found) return void 0;
|
|
403
|
-
return resolvePlan(found.item);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
315
|
// src/commands/backlog/phaseRun/announceWaiting.ts
|
|
407
316
|
import chalk5 from "chalk";
|
|
408
317
|
function announceWaiting(item, running, totalPhases) {
|
|
@@ -474,31 +383,8 @@ async function launchReady(item, schedule, cap, itemTree, spawnOptions) {
|
|
|
474
383
|
return cap;
|
|
475
384
|
}
|
|
476
385
|
|
|
477
|
-
// src/commands/backlog/phaseRun/
|
|
478
|
-
|
|
479
|
-
var POLL_MS = 3e3;
|
|
480
|
-
function progressKey(progress) {
|
|
481
|
-
return JSON.stringify(progress);
|
|
482
|
-
}
|
|
483
|
-
async function waitForPhaseProgress(itemId, since, planLength, onPause) {
|
|
484
|
-
const before = progressKey(since);
|
|
485
|
-
const length = await planLength();
|
|
486
|
-
const { orm } = await getReady();
|
|
487
|
-
while (true) {
|
|
488
|
-
await sleep(POLL_MS);
|
|
489
|
-
const signal = readSignal();
|
|
490
|
-
if (signal) {
|
|
491
|
-
cleanupSignal();
|
|
492
|
-
if (signal.event === "rewind") return;
|
|
493
|
-
}
|
|
494
|
-
if (consumePause(itemId)) onPause();
|
|
495
|
-
if (progressKey(await loadPhaseProgress(orm, itemId)) !== before) return;
|
|
496
|
-
if (await planLength() !== length) return;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// src/commands/backlog/phaseRun/waitOnParallelPhases.ts
|
|
501
|
-
async function waitOnParallelPhases(item, plan, schedule, state) {
|
|
386
|
+
// src/commands/backlog/phaseRun/parkOnParallelPhases.ts
|
|
387
|
+
async function parkOnParallelPhases(item, plan, schedule, state) {
|
|
502
388
|
if (!state.pauseRequested)
|
|
503
389
|
state.cap = await launchReady(
|
|
504
390
|
item,
|
|
@@ -508,27 +394,21 @@ async function waitOnParallelPhases(item, plan, schedule, state) {
|
|
|
508
394
|
state.spawnOptions
|
|
509
395
|
);
|
|
510
396
|
const { orm } = await getReady();
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
announceWaiting(item,
|
|
514
|
-
|
|
515
|
-
item.id,
|
|
516
|
-
launched,
|
|
517
|
-
async () => (await reloadPlan(item.id) ?? plan).length,
|
|
518
|
-
() => {
|
|
519
|
-
state.pauseRequested = true;
|
|
520
|
-
appendDaemonLog(
|
|
521
|
-
`backlog run ${item.id}: pause requested; waiting for running phases before pausing`
|
|
522
|
-
);
|
|
523
|
-
}
|
|
397
|
+
const { running } = await loadPhaseProgress(orm, item.id);
|
|
398
|
+
if (running.length === 0) return false;
|
|
399
|
+
announceWaiting(item, running, plan.length + 1);
|
|
400
|
+
appendDaemonLog(
|
|
401
|
+
`backlog run ${item.id}: parked while phase ${running.map((idx) => idx + 1).join(", ")} run`
|
|
524
402
|
);
|
|
403
|
+
return true;
|
|
525
404
|
}
|
|
526
405
|
|
|
527
406
|
// src/commands/backlog/phaseRun/runPhaseStep.ts
|
|
528
407
|
async function runPhaseStep(item, plan, schedule, parallel, preferred, phaseOptions) {
|
|
529
408
|
const inline = parallel.pauseRequested ? void 0 : inlinePhase(schedule, parallel.cap, preferred);
|
|
530
409
|
if (inline === void 0) {
|
|
531
|
-
await
|
|
410
|
+
if (await parkOnParallelPhases(item, plan, schedule, parallel))
|
|
411
|
+
return { stop: { kind: "parked" }, ranInline: false };
|
|
532
412
|
return { preferred, ranInline: false };
|
|
533
413
|
}
|
|
534
414
|
const result = await runInlinePhase(item, inline, plan, phaseOptions);
|
|
@@ -551,12 +431,20 @@ function settledResult(schedule, pauseRequested) {
|
|
|
551
431
|
return { kind: "fail" };
|
|
552
432
|
}
|
|
553
433
|
|
|
434
|
+
// src/commands/backlog/reloadPlan.ts
|
|
435
|
+
async function reloadPlan(id) {
|
|
436
|
+
const found = await findOneItem(String(id));
|
|
437
|
+
if (!found) return void 0;
|
|
438
|
+
return resolvePlan(found.item);
|
|
439
|
+
}
|
|
440
|
+
|
|
554
441
|
// src/commands/backlog/runPhases.ts
|
|
555
442
|
async function runPhases(item, startPhase, plan, spawnOptions) {
|
|
556
443
|
const itemTree = process.cwd();
|
|
557
444
|
const parallel = {
|
|
558
445
|
cap: parallelPhaseCap(itemTree),
|
|
559
|
-
|
|
446
|
+
// why: a pause requested while parked applies once the daemon wakes the run.
|
|
447
|
+
pauseRequested: isWake() && consumePause(item.id),
|
|
560
448
|
itemTree,
|
|
561
449
|
spawnOptions: withoutResumeSession(spawnOptions)
|
|
562
450
|
};
|
|
@@ -619,6 +507,7 @@ async function runOnce(item, startPhase, plan, spawnOptions) {
|
|
|
619
507
|
const phases = await runPhases(item, startPhase, plan, spawnOptions);
|
|
620
508
|
if (phases.kind === "fail") return { kind: "fail" };
|
|
621
509
|
if (phases.kind === "paused") return { kind: "paused" };
|
|
510
|
+
if (phases.kind === "parked") return { kind: "parked" };
|
|
622
511
|
return runReview(item, plan, reviewOptions);
|
|
623
512
|
}
|
|
624
513
|
|
|
@@ -630,6 +519,10 @@ async function runPrepared(id, prepared, spawnOptions) {
|
|
|
630
519
|
while (true) {
|
|
631
520
|
const review = await runOnce(item, startPhase, plan, spawnOptions);
|
|
632
521
|
spawnOptions = withoutResumeSession(spawnOptions);
|
|
522
|
+
if (review.kind === "parked") {
|
|
523
|
+
process.exitCode = parkedExitCode;
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
633
526
|
const outcome = await handleReviewResult(id, review);
|
|
634
527
|
if (outcome.kind === "stop") {
|
|
635
528
|
return outcome.success;
|
|
@@ -642,15 +535,6 @@ async function runPrepared(id, prepared, spawnOptions) {
|
|
|
642
535
|
}
|
|
643
536
|
}
|
|
644
537
|
|
|
645
|
-
// src/commands/backlog/phaseRun/clearFailedPhases.ts
|
|
646
|
-
import { and as and2, eq as eq2 } from "drizzle-orm";
|
|
647
|
-
async function clearFailedPhases(itemId) {
|
|
648
|
-
const { orm } = await getReady();
|
|
649
|
-
await orm.update(planPhases).set({ runState: null, runToken: null }).where(
|
|
650
|
-
and2(eq2(planPhases.itemId, itemId), eq2(planPhases.runState, "failed"))
|
|
651
|
-
);
|
|
652
|
-
}
|
|
653
|
-
|
|
654
538
|
// src/commands/backlog/logProgress.ts
|
|
655
539
|
import chalk7 from "chalk";
|
|
656
540
|
function logProgress({ plan, startPhase, item }) {
|
|
@@ -670,6 +554,129 @@ function logProgress({ plan, startPhase, item }) {
|
|
|
670
554
|
}
|
|
671
555
|
}
|
|
672
556
|
|
|
557
|
+
// src/commands/backlog/discardStalePause.ts
|
|
558
|
+
function discardStalePause(itemId) {
|
|
559
|
+
if (!isPausePending(itemId)) return;
|
|
560
|
+
if (isWake()) return;
|
|
561
|
+
if (process.env.ASSIST_KEEP_PAUSE) {
|
|
562
|
+
appendDaemonLog(
|
|
563
|
+
`backlog run ${itemId}: kept the pending pause file at run start; this run was relaunched by a daemon restore, so the user's Continue-off still applies`
|
|
564
|
+
);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
clearPause(itemId);
|
|
568
|
+
appendDaemonLog(
|
|
569
|
+
`backlog run ${itemId}: discarded stale pause file at run start; this run starts auto-advancing (Continue on) regardless of a prior run's pause`
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// src/commands/backlog/ensureStoryBranch.ts
|
|
574
|
+
import { execSync } from "child_process";
|
|
575
|
+
import { basename } from "path";
|
|
576
|
+
async function ensureStoryBranch(item) {
|
|
577
|
+
const config = loadConfig();
|
|
578
|
+
if (config.prs?.required === false) {
|
|
579
|
+
log(item, "prs.required is false; left the session on its current branch");
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const recorded = recordedBranch(item);
|
|
583
|
+
if (recorded) {
|
|
584
|
+
adoptRecordedBranch(item, recorded);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
process.env.ASSIST_BACKLOG_ITEM_ID = String(item.id);
|
|
588
|
+
const slug = await generateBranchSlug(item.name);
|
|
589
|
+
const { branchName } = await createBranch({ slug, jira: item.jiraKey });
|
|
590
|
+
log(item, `prs.required on and no branch recorded; created ${branchName}`);
|
|
591
|
+
}
|
|
592
|
+
function recordedBranch(item) {
|
|
593
|
+
return (item.gitRefs ?? []).find((ref) => ref.kind === "branch")?.ref;
|
|
594
|
+
}
|
|
595
|
+
function adoptRecordedBranch(item, branch) {
|
|
596
|
+
const parked = worktreeBranchInPlay();
|
|
597
|
+
if (!parked) {
|
|
598
|
+
log(
|
|
599
|
+
item,
|
|
600
|
+
`branch ${branch} already recorded; left the session on its current branch`
|
|
601
|
+
);
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
try {
|
|
605
|
+
execSync("git fetch", { stdio: "ignore" });
|
|
606
|
+
} catch {
|
|
607
|
+
}
|
|
608
|
+
try {
|
|
609
|
+
execSync(`git switch ${shellQuote(branch)}`, { stdio: "pipe" });
|
|
610
|
+
log(
|
|
611
|
+
item,
|
|
612
|
+
`branch ${branch} already recorded; switched off ${parked} onto it`
|
|
613
|
+
);
|
|
614
|
+
} catch (error) {
|
|
615
|
+
log(
|
|
616
|
+
item,
|
|
617
|
+
`branch ${branch} already recorded but the worktree stayed on ${parked}: ${message(error)}`
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
function worktreeBranchInPlay() {
|
|
622
|
+
const tree = linkedWorktree(process.cwd());
|
|
623
|
+
if (!tree) return null;
|
|
624
|
+
const head = currentBranch();
|
|
625
|
+
return head === basename(tree.root) ? head : null;
|
|
626
|
+
}
|
|
627
|
+
function currentBranch() {
|
|
628
|
+
try {
|
|
629
|
+
return execSync("git rev-parse --abbrev-ref HEAD", {
|
|
630
|
+
encoding: "utf8",
|
|
631
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
632
|
+
}).trim();
|
|
633
|
+
} catch {
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
function log(item, outcome) {
|
|
638
|
+
appendDaemonLog(`backlog run ${item.id}: ${outcome}`);
|
|
639
|
+
}
|
|
640
|
+
function message(error) {
|
|
641
|
+
return error instanceof Error ? error.message : String(error);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// src/commands/backlog/phaseRun/clearFailedPhases.ts
|
|
645
|
+
import { and as and2, eq as eq2 } from "drizzle-orm";
|
|
646
|
+
async function clearFailedPhases(itemId) {
|
|
647
|
+
const { orm } = await getReady();
|
|
648
|
+
await orm.update(planPhases).set({ runState: null, runToken: null }).where(
|
|
649
|
+
and2(eq2(planPhases.itemId, itemId), eq2(planPhases.runState, "failed"))
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// src/commands/backlog/phaseRun/failOrphanedPhases.ts
|
|
654
|
+
async function failOrphanedPhases(itemId) {
|
|
655
|
+
const { orm } = await getReady();
|
|
656
|
+
const { running } = await loadPhaseProgress(orm, itemId);
|
|
657
|
+
if (running.length === 0) return;
|
|
658
|
+
appendDaemonLog(
|
|
659
|
+
`backlog run ${itemId}: woke with phase ${running.map((idx) => idx + 1).join(", ")} still marked running but no session left; marking failed`
|
|
660
|
+
);
|
|
661
|
+
await setPhaseRunState(orm, itemId, running, "failed");
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// src/commands/backlog/readyRunStart.ts
|
|
665
|
+
async function readyRunStart(id, item, resumeSessionId) {
|
|
666
|
+
if (isWake() && item.status !== "in-progress") {
|
|
667
|
+
appendDaemonLog(
|
|
668
|
+
`backlog run ${item.id}: woke with the item ${item.status}; nothing to resume`
|
|
669
|
+
);
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
await ensureStoryBranch(item);
|
|
673
|
+
await setStatus(id, "in-progress");
|
|
674
|
+
discardStalePause(item.id);
|
|
675
|
+
if (isWake()) await failOrphanedPhases(item.id);
|
|
676
|
+
else if (!resumeSessionId) await clearFailedPhases(item.id);
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
679
|
+
|
|
673
680
|
// src/commands/backlog/run.ts
|
|
674
681
|
async function run(id, spawnOptions) {
|
|
675
682
|
const blocker = launchBlocker(
|
|
@@ -701,10 +708,8 @@ async function runLocked(id, spawnOptions) {
|
|
|
701
708
|
if ("kind" in prepared) {
|
|
702
709
|
return resumeDoneConversation(prepared, spawnOptions);
|
|
703
710
|
}
|
|
704
|
-
await
|
|
705
|
-
|
|
706
|
-
discardStalePause(prepared.item.id);
|
|
707
|
-
if (!spawnOptions?.resumeSessionId) await clearFailedPhases(prepared.item.id);
|
|
711
|
+
if (!await readyRunStart(id, prepared.item, spawnOptions?.resumeSessionId))
|
|
712
|
+
return true;
|
|
708
713
|
logProgress(prepared);
|
|
709
714
|
return runPrepared(
|
|
710
715
|
id,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decideToolOperations,
|
|
3
3
|
logPolicyDeny
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GCZ6AEIL.js";
|
|
5
5
|
import "./chunk-CDU6M5IX.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-Z2IQ4336.js";
|
|
7
|
+
import "./chunk-UUVGQEPE.js";
|
|
8
|
+
import "./chunk-CUOHHT2F.js";
|
|
8
9
|
import {
|
|
9
10
|
currentExecutionIdentity
|
|
10
11
|
} from "./chunk-WDDYURVQ.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZMH7UZNP.js";
|
|
12
13
|
import "./chunk-BI3ORSJ6.js";
|
|
13
14
|
import "./chunk-VDXS55BC.js";
|
|
14
|
-
import "./chunk-ZMH7UZNP.js";
|
|
15
15
|
import "./chunk-HKGCLAZ7.js";
|
|
16
16
|
import "./chunk-FPWL4VRC.js";
|
|
17
17
|
import "./chunk-H63MI5HI.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decideToolOperations,
|
|
3
3
|
logPolicyDeny
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GCZ6AEIL.js";
|
|
5
5
|
import "./chunk-CDU6M5IX.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-Z2IQ4336.js";
|
|
7
|
+
import "./chunk-UUVGQEPE.js";
|
|
8
|
+
import "./chunk-CUOHHT2F.js";
|
|
8
9
|
import {
|
|
9
10
|
currentExecutionIdentity
|
|
10
11
|
} from "./chunk-WDDYURVQ.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZMH7UZNP.js";
|
|
12
13
|
import "./chunk-BI3ORSJ6.js";
|
|
13
14
|
import "./chunk-VDXS55BC.js";
|
|
14
|
-
import "./chunk-ZMH7UZNP.js";
|
|
15
15
|
import "./chunk-HKGCLAZ7.js";
|
|
16
16
|
import {
|
|
17
17
|
setSessionStatus
|