@staff0rd/assist 0.1032.2 → 0.1033.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 +299 -299
- package/dist/index.js +90 -16
- 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.1033.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -19645,16 +19645,23 @@ function harnessActivityFields(harness, claudeSessionId) {
|
|
|
19645
19645
|
return kind === "claude" ? { claudeSessionId } : { harness: kind };
|
|
19646
19646
|
}
|
|
19647
19647
|
|
|
19648
|
-
// src/commands/backlog/
|
|
19649
|
-
function
|
|
19648
|
+
// src/commands/backlog/backlogPhaseActivity.ts
|
|
19649
|
+
function backlogPhaseActivity(item, phaseNumber, totalPhases, phaseName) {
|
|
19650
19650
|
const isReviewPhase = phaseNumber >= totalPhases;
|
|
19651
|
-
|
|
19651
|
+
return {
|
|
19652
19652
|
kind: "backlog",
|
|
19653
19653
|
itemId: item.id,
|
|
19654
19654
|
itemName: item.name,
|
|
19655
19655
|
phase: phaseNumber,
|
|
19656
|
-
phaseName: isReviewPhase ? REVIEW_PHASE_NAME :
|
|
19657
|
-
totalPhases
|
|
19656
|
+
phaseName: isReviewPhase ? REVIEW_PHASE_NAME : phaseName,
|
|
19657
|
+
totalPhases
|
|
19658
|
+
};
|
|
19659
|
+
}
|
|
19660
|
+
|
|
19661
|
+
// src/commands/backlog/reportPhaseActivity.ts
|
|
19662
|
+
function reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessionId, harness) {
|
|
19663
|
+
emitActivity({
|
|
19664
|
+
...backlogPhaseActivity(item, phaseNumber, totalPhases, phase.name),
|
|
19658
19665
|
...harnessActivityFields(harness, claudeSessionId)
|
|
19659
19666
|
});
|
|
19660
19667
|
}
|
|
@@ -54912,6 +54919,71 @@ function addAgentToStream(ctx, targetId, request) {
|
|
|
54912
54919
|
};
|
|
54913
54920
|
}
|
|
54914
54921
|
|
|
54922
|
+
// src/commands/sessions/daemon/seedBacklogRunActivity.ts
|
|
54923
|
+
import { existsSync as existsSync101 } from "fs";
|
|
54924
|
+
|
|
54925
|
+
// src/commands/backlog/backlogRunItemId.ts
|
|
54926
|
+
function backlogRunItemId(assistArgs) {
|
|
54927
|
+
if (assistArgs?.[0] !== "backlog" || assistArgs[1] !== "run") return;
|
|
54928
|
+
if (!assistArgs[2]) return;
|
|
54929
|
+
try {
|
|
54930
|
+
return parseItemId(assistArgs[2]);
|
|
54931
|
+
} catch {
|
|
54932
|
+
return void 0;
|
|
54933
|
+
}
|
|
54934
|
+
}
|
|
54935
|
+
|
|
54936
|
+
// src/commands/backlog/provisionalRunActivity.ts
|
|
54937
|
+
function provisionalRunActivity(item) {
|
|
54938
|
+
if (item.status === "done") return void 0;
|
|
54939
|
+
const plan2 = resolvePlan(item);
|
|
54940
|
+
const startPhase = (item.currentPhase ?? 1) - 1;
|
|
54941
|
+
if (startPhase < 0 || startPhase > plan2.length) return void 0;
|
|
54942
|
+
return backlogPhaseActivity(
|
|
54943
|
+
item,
|
|
54944
|
+
startPhase + 1,
|
|
54945
|
+
plan2.length + 1,
|
|
54946
|
+
plan2[startPhase]?.name ?? ""
|
|
54947
|
+
);
|
|
54948
|
+
}
|
|
54949
|
+
|
|
54950
|
+
// src/commands/sessions/daemon/loadProvisionalRunActivity.ts
|
|
54951
|
+
async function loadProvisionalRunActivity(itemId2) {
|
|
54952
|
+
const label = `provisional activity for ${formatItemId(itemId2)}`;
|
|
54953
|
+
try {
|
|
54954
|
+
if (!process.env.ASSIST_DATABASE_URL && !loadConfig().database.url) {
|
|
54955
|
+
daemonLog(`${label} skipped: no database configured`);
|
|
54956
|
+
return void 0;
|
|
54957
|
+
}
|
|
54958
|
+
const item = await loadItem(await getDb(), itemId2);
|
|
54959
|
+
if (!item) {
|
|
54960
|
+
daemonLog(`${label} skipped: item not found`);
|
|
54961
|
+
return void 0;
|
|
54962
|
+
}
|
|
54963
|
+
const activity2 = provisionalRunActivity(item);
|
|
54964
|
+
if (!activity2) daemonLog(`${label} skipped: no phase left to run`);
|
|
54965
|
+
return activity2;
|
|
54966
|
+
} catch (error) {
|
|
54967
|
+
daemonLog(`${label} lookup failed: ${String(error)}`);
|
|
54968
|
+
return void 0;
|
|
54969
|
+
}
|
|
54970
|
+
}
|
|
54971
|
+
|
|
54972
|
+
// src/commands/sessions/daemon/seedBacklogRunActivity.ts
|
|
54973
|
+
async function seedBacklogRunActivity(sessions, session, notify2) {
|
|
54974
|
+
const itemId2 = backlogRunItemId(session?.assistArgs);
|
|
54975
|
+
if (!session || itemId2 === void 0) return;
|
|
54976
|
+
const activity2 = await loadProvisionalRunActivity(itemId2);
|
|
54977
|
+
if (!activity2 || sessions.get(session.id) !== session) return;
|
|
54978
|
+
if (session.activity || existsSync101(activityPath(session.id))) return;
|
|
54979
|
+
session.activity = { ...activity2, startedAt: Date.now() };
|
|
54980
|
+
reconcileActivity(session.id, session.activity);
|
|
54981
|
+
daemonLog(
|
|
54982
|
+
`session ${session.id} seeded provisional activity for item ${itemId2} phase ${activity2.phase}/${activity2.totalPhases}`
|
|
54983
|
+
);
|
|
54984
|
+
notify2();
|
|
54985
|
+
}
|
|
54986
|
+
|
|
54915
54987
|
// src/commands/sessions/daemon/worktree/spawnInTree.ts
|
|
54916
54988
|
function spawnInTree(ctx, { prompt, cwd, design, auto, harness, inPlace }, context) {
|
|
54917
54989
|
return allocateAndBind(
|
|
@@ -54930,17 +55002,19 @@ function spawnInTree(ctx, { prompt, cwd, design, auto, harness, inPlace }, conte
|
|
|
54930
55002
|
);
|
|
54931
55003
|
}
|
|
54932
55004
|
function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
54933
|
-
|
|
55005
|
+
const id = allocateAndBind(
|
|
54934
55006
|
ctx,
|
|
54935
55007
|
cwd,
|
|
54936
55008
|
(sid, resolvedCwd, holdUntilSeeded) => createAssistSession(sid, assistArgs, resolvedCwd, meta, holdUntilSeeded),
|
|
54937
55009
|
{ inPlace: meta?.inPlace },
|
|
54938
55010
|
context
|
|
54939
55011
|
);
|
|
55012
|
+
void seedBacklogRunActivity(ctx.sessions, ctx.sessions.get(id), ctx.notify);
|
|
55013
|
+
return id;
|
|
54940
55014
|
}
|
|
54941
55015
|
|
|
54942
55016
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
54943
|
-
import { existsSync as
|
|
55017
|
+
import { existsSync as existsSync104 } from "fs";
|
|
54944
55018
|
|
|
54945
55019
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
54946
55020
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -54971,10 +55045,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
54971
55045
|
}
|
|
54972
55046
|
|
|
54973
55047
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
54974
|
-
import { existsSync as
|
|
55048
|
+
import { existsSync as existsSync103 } from "fs";
|
|
54975
55049
|
|
|
54976
55050
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
54977
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
55051
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync102, mkdirSync as mkdirSync43 } from "fs";
|
|
54978
55052
|
import { join as join114 } from "path";
|
|
54979
55053
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
54980
55054
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -54985,7 +55059,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
54985
55059
|
return;
|
|
54986
55060
|
}
|
|
54987
55061
|
const dest = join114(dir, `${claudeSessionId}.jsonl`);
|
|
54988
|
-
if (
|
|
55062
|
+
if (existsSync102(dest)) {
|
|
54989
55063
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
54990
55064
|
return;
|
|
54991
55065
|
}
|
|
@@ -55036,7 +55110,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
55036
55110
|
}
|
|
55037
55111
|
function cloneForReapedTree(missingCwd) {
|
|
55038
55112
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
55039
|
-
if (!clone || !
|
|
55113
|
+
if (!clone || !existsSync103(clone))
|
|
55040
55114
|
throw new Error(
|
|
55041
55115
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
55042
55116
|
);
|
|
@@ -55045,7 +55119,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
55045
55119
|
|
|
55046
55120
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
55047
55121
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
55048
|
-
if (!
|
|
55122
|
+
if (!existsSync104(cwd))
|
|
55049
55123
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
55050
55124
|
const id = ctx.spawnWith(
|
|
55051
55125
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -56246,7 +56320,7 @@ function isPrCheckoutArgs(args) {
|
|
|
56246
56320
|
|
|
56247
56321
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
56248
56322
|
import { execFile as execFile14 } from "child_process";
|
|
56249
|
-
import { existsSync as
|
|
56323
|
+
import { existsSync as existsSync105 } from "fs";
|
|
56250
56324
|
function prHeadBranch2(number, cwd) {
|
|
56251
56325
|
const { headBranch } = prCliCommands(number, cwd);
|
|
56252
56326
|
return new Promise((resolve32) => {
|
|
@@ -56260,12 +56334,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
56260
56334
|
}
|
|
56261
56335
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
56262
56336
|
const number = prCheckoutNumber(assistArgs);
|
|
56263
|
-
if (!number || !cwd || !
|
|
56337
|
+
if (!number || !cwd || !existsSync105(cwd)) return void 0;
|
|
56264
56338
|
const headRef = await prHeadBranch2(number, cwd);
|
|
56265
56339
|
if (!headRef) return void 0;
|
|
56266
56340
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
56267
56341
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
56268
|
-
if (!holder || !
|
|
56342
|
+
if (!holder || !existsSync105(holder)) return void 0;
|
|
56269
56343
|
daemonLog(
|
|
56270
56344
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
56271
56345
|
);
|