@staff0rd/assist 0.534.0 → 0.535.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/commands/sessions/web/bundle.js +385 -385
- package/dist/index.js +109 -59
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.535.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -8146,8 +8146,27 @@ function removeActivity(sessionId) {
|
|
|
8146
8146
|
}
|
|
8147
8147
|
}
|
|
8148
8148
|
|
|
8149
|
+
// src/shared/harnessLabel.ts
|
|
8150
|
+
var HARNESS_LABELS = {
|
|
8151
|
+
claude: "Claude",
|
|
8152
|
+
codex: "Codex",
|
|
8153
|
+
pi: "pi"
|
|
8154
|
+
};
|
|
8155
|
+
function resolveHarness(harness) {
|
|
8156
|
+
return harness ?? "claude";
|
|
8157
|
+
}
|
|
8158
|
+
function harnessLabel(harness) {
|
|
8159
|
+
return HARNESS_LABELS[resolveHarness(harness)];
|
|
8160
|
+
}
|
|
8161
|
+
|
|
8162
|
+
// src/shared/harnessActivityFields.ts
|
|
8163
|
+
function harnessActivityFields(harness, claudeSessionId) {
|
|
8164
|
+
const kind = resolveHarness(harness);
|
|
8165
|
+
return kind === "claude" ? { claudeSessionId } : { harness: kind };
|
|
8166
|
+
}
|
|
8167
|
+
|
|
8149
8168
|
// src/commands/backlog/reportPhaseActivity.ts
|
|
8150
|
-
function reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessionId) {
|
|
8169
|
+
function reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessionId, harness) {
|
|
8151
8170
|
const isReviewPhase = phaseNumber >= totalPhases;
|
|
8152
8171
|
emitActivity({
|
|
8153
8172
|
kind: "backlog",
|
|
@@ -8156,7 +8175,7 @@ function reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessio
|
|
|
8156
8175
|
phase: phaseNumber,
|
|
8157
8176
|
phaseName: isReviewPhase ? REVIEW_PHASE_NAME : phase.name,
|
|
8158
8177
|
totalPhases,
|
|
8159
|
-
claudeSessionId
|
|
8178
|
+
...harnessActivityFields(harness, claudeSessionId)
|
|
8160
8179
|
});
|
|
8161
8180
|
}
|
|
8162
8181
|
|
|
@@ -8405,7 +8424,14 @@ async function preparePhaseSession(item, phase, phaseIndex, phaseNumber, totalPh
|
|
|
8405
8424
|
if (resumeSessionId && !await verifyPhaseResume(item.id, resumeSessionId, phaseLabel2)) {
|
|
8406
8425
|
return void 0;
|
|
8407
8426
|
}
|
|
8408
|
-
reportPhaseActivity(
|
|
8427
|
+
reportPhaseActivity(
|
|
8428
|
+
item,
|
|
8429
|
+
phaseNumber,
|
|
8430
|
+
totalPhases,
|
|
8431
|
+
phase,
|
|
8432
|
+
claudeSessionId,
|
|
8433
|
+
spawnOptions?.harness
|
|
8434
|
+
);
|
|
8409
8435
|
if (!resumeSessionId) {
|
|
8410
8436
|
await persistPhaseSessionId(item.id, phaseIndex, claudeSessionId);
|
|
8411
8437
|
}
|
|
@@ -14192,6 +14218,17 @@ This is usually a transient database/network blip \u2014 the work is saved and t
|
|
|
14192
14218
|
}
|
|
14193
14219
|
}
|
|
14194
14220
|
|
|
14221
|
+
// src/commands/backlog/reportLaunchActivity.ts
|
|
14222
|
+
function reportLaunchActivity(slashCommand, claudeSessionId, harness, item) {
|
|
14223
|
+
emitActivity({
|
|
14224
|
+
kind: "command",
|
|
14225
|
+
name: slashCommand,
|
|
14226
|
+
itemId: item?.itemId,
|
|
14227
|
+
itemName: item?.itemName,
|
|
14228
|
+
...harnessActivityFields(harness, claudeSessionId)
|
|
14229
|
+
});
|
|
14230
|
+
}
|
|
14231
|
+
|
|
14195
14232
|
// src/commands/backlog/launchMode.ts
|
|
14196
14233
|
function buildSlashCommand(slashCommand, description) {
|
|
14197
14234
|
const trimmed = description?.trim();
|
|
@@ -14202,15 +14239,10 @@ async function launchMode(slashCommand, options2) {
|
|
|
14202
14239
|
if (!resumeSessionId) pullIfConfigured();
|
|
14203
14240
|
process.env.ASSIST_SESSION_ID ??= String(process.pid);
|
|
14204
14241
|
const claudeSessionId = resumeSessionId ?? randomUUID4();
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
name: slashCommand,
|
|
14208
|
-
itemId: options2?.itemId,
|
|
14209
|
-
itemName: options2?.itemName,
|
|
14210
|
-
claudeSessionId
|
|
14211
|
-
});
|
|
14242
|
+
const harness = options2?.harness ?? "claude";
|
|
14243
|
+
reportLaunchActivity(slashCommand, claudeSessionId, harness, options2);
|
|
14212
14244
|
const prompt = resumeSessionId ? resumeNudge() : buildSlashCommand(slashCommand, options2?.description);
|
|
14213
|
-
const { child, done: done2 } = spawnHarness(
|
|
14245
|
+
const { child, done: done2 } = spawnHarness(harness, prompt, {
|
|
14214
14246
|
sessionId: claudeSessionId,
|
|
14215
14247
|
resumeSessionId,
|
|
14216
14248
|
cwd: process.cwd()
|
|
@@ -14265,7 +14297,7 @@ async function refine(id, options2) {
|
|
|
14265
14297
|
}
|
|
14266
14298
|
|
|
14267
14299
|
// src/commands/backlog/resolveHarness.ts
|
|
14268
|
-
function
|
|
14300
|
+
function resolveHarness2(value) {
|
|
14269
14301
|
if (value === "claude" || value === "codex" || value === "pi") return value;
|
|
14270
14302
|
return loadConfig().harness.engine;
|
|
14271
14303
|
}
|
|
@@ -14278,7 +14310,7 @@ function registerRefineCommand(cmd) {
|
|
|
14278
14310
|
).action(
|
|
14279
14311
|
(id, opts) => refine(id, {
|
|
14280
14312
|
once: opts.once,
|
|
14281
|
-
harness:
|
|
14313
|
+
harness: resolveHarness2(opts.harness)
|
|
14282
14314
|
})
|
|
14283
14315
|
);
|
|
14284
14316
|
}
|
|
@@ -14321,7 +14353,7 @@ function registerRunCommand(cmd) {
|
|
|
14321
14353
|
if (!opts.resumeSession) pullIfConfigured();
|
|
14322
14354
|
await run2(id, {
|
|
14323
14355
|
allowEdits: opts.write !== false,
|
|
14324
|
-
harness:
|
|
14356
|
+
harness: resolveHarness2(opts.harness),
|
|
14325
14357
|
resumeSessionId: opts.resumeSession
|
|
14326
14358
|
});
|
|
14327
14359
|
}
|
|
@@ -19972,7 +20004,7 @@ function runRefine(id, opts) {
|
|
|
19972
20004
|
return refine(id, {
|
|
19973
20005
|
once: opts.once,
|
|
19974
20006
|
resumeSessionId: opts.resumeSession,
|
|
19975
|
-
harness:
|
|
20007
|
+
harness: resolveHarness2(opts.harness)
|
|
19976
20008
|
});
|
|
19977
20009
|
}
|
|
19978
20010
|
function registerRefineLaunch(program2, resumeFlag) {
|
|
@@ -31362,6 +31394,14 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
31362
31394
|
import { existsSync as existsSync74, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
|
|
31363
31395
|
import { dirname as dirname37 } from "path";
|
|
31364
31396
|
|
|
31397
|
+
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
31398
|
+
function applyActivityToSession(session, activity2) {
|
|
31399
|
+
session.activity = activity2;
|
|
31400
|
+
if (activity2.harness) session.harness = activity2.harness;
|
|
31401
|
+
if (activity2.claudeSessionId)
|
|
31402
|
+
session.claudeSessionId = activity2.claudeSessionId;
|
|
31403
|
+
}
|
|
31404
|
+
|
|
31365
31405
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
31366
31406
|
function applyReviewPause(session, activity2) {
|
|
31367
31407
|
const inReview = activity2.kind === "backlog" && activity2.phase !== void 0 && activity2.phase === activity2.totalPhases;
|
|
@@ -31426,11 +31466,8 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
31426
31466
|
timer = null;
|
|
31427
31467
|
const activity2 = readActivity(path73);
|
|
31428
31468
|
if (!activity2) return;
|
|
31429
|
-
session
|
|
31430
|
-
if (activity2.claudeSessionId)
|
|
31431
|
-
session.claudeSessionId = activity2.claudeSessionId;
|
|
31432
|
-
onClaudeSessionId?.(session);
|
|
31433
|
-
}
|
|
31469
|
+
applyActivityToSession(session, activity2);
|
|
31470
|
+
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
31434
31471
|
applyReviewPause(session, activity2);
|
|
31435
31472
|
void seedRunningMsFromUsage(session, notify2);
|
|
31436
31473
|
notify2();
|
|
@@ -31446,9 +31483,7 @@ function refreshActivity(session) {
|
|
|
31446
31483
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
31447
31484
|
const activity2 = readActivity(activityPath(session.id));
|
|
31448
31485
|
if (!activity2) return;
|
|
31449
|
-
session
|
|
31450
|
-
if (activity2.claudeSessionId)
|
|
31451
|
-
session.claudeSessionId = activity2.claudeSessionId;
|
|
31486
|
+
applyActivityToSession(session, activity2);
|
|
31452
31487
|
}
|
|
31453
31488
|
|
|
31454
31489
|
// src/commands/sessions/daemon/handleStoppedExit.ts
|
|
@@ -32353,8 +32388,15 @@ function respawnSession(session, respawn, status3, clients, onStatusChange) {
|
|
|
32353
32388
|
wirePtyEvents(session, clients, onStatusChange);
|
|
32354
32389
|
}
|
|
32355
32390
|
|
|
32356
|
-
// src/
|
|
32357
|
-
|
|
32391
|
+
// src/shared/harnessResumesConversation.ts
|
|
32392
|
+
var RESUMES_CONVERSATION = {
|
|
32393
|
+
claude: true,
|
|
32394
|
+
codex: false,
|
|
32395
|
+
pi: false
|
|
32396
|
+
};
|
|
32397
|
+
function harnessResumesConversation(harness) {
|
|
32398
|
+
return RESUMES_CONVERSATION[resolveHarness(harness)];
|
|
32399
|
+
}
|
|
32358
32400
|
|
|
32359
32401
|
// src/commands/sessions/daemon/assistResumeArgs.ts
|
|
32360
32402
|
function assistResumeArgs(session) {
|
|
@@ -32362,36 +32404,22 @@ function assistResumeArgs(session) {
|
|
|
32362
32404
|
return session.claudeSessionId ? [...args, "--resume-session", session.claudeSessionId] : args;
|
|
32363
32405
|
}
|
|
32364
32406
|
|
|
32365
|
-
// src/commands/sessions/daemon/
|
|
32366
|
-
|
|
32367
|
-
|
|
32368
|
-
|
|
32369
|
-
|
|
32370
|
-
|
|
32371
|
-
spawn: () => spawnClaude2({
|
|
32372
|
-
resumeSessionId: claudeSessionId,
|
|
32373
|
-
cwd,
|
|
32374
|
-
sessionId: session.id
|
|
32375
|
-
}),
|
|
32376
|
-
status: "waiting"
|
|
32377
|
-
};
|
|
32378
|
-
if (initialPrompt) return freshClaudePlan(session, initialPrompt, cwd);
|
|
32379
|
-
if (cwd && session.harness !== "pi")
|
|
32380
|
-
return freshClaudePlan(session, void 0, cwd);
|
|
32381
|
-
return null;
|
|
32382
|
-
}
|
|
32383
|
-
if (commandType === "assist" && assistArgs) {
|
|
32384
|
-
const idle = session.status === "waiting";
|
|
32407
|
+
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
32408
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
32409
|
+
function interactiveRespawnPlan(session, resumes) {
|
|
32410
|
+
const { claudeSessionId, cwd, initialPrompt } = session;
|
|
32411
|
+
if (!resumes) return null;
|
|
32412
|
+
if (claudeSessionId)
|
|
32385
32413
|
return {
|
|
32386
|
-
spawn: () =>
|
|
32387
|
-
|
|
32414
|
+
spawn: () => spawnClaude2({
|
|
32415
|
+
resumeSessionId: claudeSessionId,
|
|
32388
32416
|
cwd,
|
|
32389
|
-
session.id
|
|
32390
|
-
|
|
32391
|
-
|
|
32392
|
-
status: idle ? "waiting" : "running"
|
|
32417
|
+
sessionId: session.id
|
|
32418
|
+
}),
|
|
32419
|
+
status: "waiting"
|
|
32393
32420
|
};
|
|
32394
|
-
|
|
32421
|
+
if (initialPrompt) return freshClaudePlan(session, initialPrompt, cwd);
|
|
32422
|
+
if (cwd) return freshClaudePlan(session, void 0, cwd);
|
|
32395
32423
|
return null;
|
|
32396
32424
|
}
|
|
32397
32425
|
function freshClaudePlan(session, prompt, cwd) {
|
|
@@ -32410,6 +32438,29 @@ function freshClaudePlan(session, prompt, cwd) {
|
|
|
32410
32438
|
};
|
|
32411
32439
|
}
|
|
32412
32440
|
|
|
32441
|
+
// src/commands/sessions/daemon/respawnPlan.ts
|
|
32442
|
+
function respawnPlan(session) {
|
|
32443
|
+
const { commandType, claudeSessionId, cwd, assistArgs } = session;
|
|
32444
|
+
const resumes = harnessResumesConversation(session.harness);
|
|
32445
|
+
if (commandType === "claude") return interactiveRespawnPlan(session, resumes);
|
|
32446
|
+
if (commandType === "assist" && assistArgs) {
|
|
32447
|
+
const idle = session.status === "waiting";
|
|
32448
|
+
return {
|
|
32449
|
+
spawn: () => spawnPty(
|
|
32450
|
+
assistResumeArgs({
|
|
32451
|
+
assistArgs,
|
|
32452
|
+
claudeSessionId: resumes ? claudeSessionId : void 0
|
|
32453
|
+
}),
|
|
32454
|
+
cwd,
|
|
32455
|
+
session.id,
|
|
32456
|
+
idle ? { ASSIST_RESUME_IDLE: "1" } : void 0
|
|
32457
|
+
),
|
|
32458
|
+
status: idle ? "waiting" : "running"
|
|
32459
|
+
};
|
|
32460
|
+
}
|
|
32461
|
+
return null;
|
|
32462
|
+
}
|
|
32463
|
+
|
|
32413
32464
|
// src/commands/sessions/daemon/restartSession.ts
|
|
32414
32465
|
function restartSession(session, clients, onStatusChange) {
|
|
32415
32466
|
const plan2 = respawnPlan(session);
|
|
@@ -32619,7 +32670,7 @@ function restoredSession(base, persisted, pty2, status3) {
|
|
|
32619
32670
|
|
|
32620
32671
|
// src/commands/sessions/daemon/restoreInteractiveSession.ts
|
|
32621
32672
|
function restoreInteractiveSession(id, persisted, base, idle) {
|
|
32622
|
-
if (persisted.commandType !== "run" && persisted.claudeSessionId) {
|
|
32673
|
+
if (persisted.commandType !== "run" && persisted.claudeSessionId && harnessResumesConversation(persisted.harness)) {
|
|
32623
32674
|
return resumeViaClaude(id, persisted, base, idle);
|
|
32624
32675
|
}
|
|
32625
32676
|
if (persisted.commandType === "claude") {
|
|
@@ -32643,11 +32694,10 @@ function resumeViaClaude(id, persisted, base, idle) {
|
|
|
32643
32694
|
return idle ? waitingSession(base, persisted, pty2) : runningSession(base, persisted, pty2);
|
|
32644
32695
|
}
|
|
32645
32696
|
function unrecoverableClaude(id, persisted) {
|
|
32646
|
-
return errorSession(
|
|
32647
|
-
|
|
32648
|
-
|
|
32649
|
-
|
|
32650
|
-
);
|
|
32697
|
+
return errorSession(id, persisted, unresumableReason(persisted.harness));
|
|
32698
|
+
}
|
|
32699
|
+
function unresumableReason(harness) {
|
|
32700
|
+
return harnessResumesConversation(harness) ? "no claude session id was recorded before the daemon stopped, so the conversation cannot be resumed" : `${harnessLabel(harness)} sessions cannot be resumed yet, so the conversation cannot be restored`;
|
|
32651
32701
|
}
|
|
32652
32702
|
function notRestoredStub(base, persisted) {
|
|
32653
32703
|
return {
|