@staff0rd/assist 0.1033.0 → 0.1033.2
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/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.1033.
|
|
9
|
+
version: "0.1033.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -19632,6 +19632,17 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
19632
19632
|
mkdirSync14(dirname28(path109), { recursive: true });
|
|
19633
19633
|
writeFileSync23(path109, JSON.stringify(activity2));
|
|
19634
19634
|
}
|
|
19635
|
+
function writeActivityIfAbsent(sessionId, activity2) {
|
|
19636
|
+
const path109 = activityPath(sessionId);
|
|
19637
|
+
mkdirSync14(dirname28(path109), { recursive: true });
|
|
19638
|
+
try {
|
|
19639
|
+
writeFileSync23(path109, JSON.stringify(activity2), { flag: "wx" });
|
|
19640
|
+
return true;
|
|
19641
|
+
} catch (error) {
|
|
19642
|
+
if (error.code === "EEXIST") return false;
|
|
19643
|
+
throw error;
|
|
19644
|
+
}
|
|
19645
|
+
}
|
|
19635
19646
|
function removeActivity(sessionId) {
|
|
19636
19647
|
try {
|
|
19637
19648
|
rmSync4(activityPath(sessionId));
|
|
@@ -54919,9 +54930,6 @@ function addAgentToStream(ctx, targetId, request) {
|
|
|
54919
54930
|
};
|
|
54920
54931
|
}
|
|
54921
54932
|
|
|
54922
|
-
// src/commands/sessions/daemon/seedBacklogRunActivity.ts
|
|
54923
|
-
import { existsSync as existsSync101 } from "fs";
|
|
54924
|
-
|
|
54925
54933
|
// src/commands/backlog/backlogRunItemId.ts
|
|
54926
54934
|
function backlogRunItemId(assistArgs) {
|
|
54927
54935
|
if (assistArgs?.[0] !== "backlog" || assistArgs[1] !== "run") return;
|
|
@@ -54973,15 +54981,27 @@ async function loadProvisionalRunActivity(itemId2) {
|
|
|
54973
54981
|
async function seedBacklogRunActivity(sessions, session, notify2) {
|
|
54974
54982
|
const itemId2 = backlogRunItemId(session?.assistArgs);
|
|
54975
54983
|
if (!session || itemId2 === void 0) return;
|
|
54976
|
-
|
|
54977
|
-
|
|
54978
|
-
|
|
54979
|
-
|
|
54980
|
-
|
|
54981
|
-
|
|
54982
|
-
|
|
54983
|
-
|
|
54984
|
-
|
|
54984
|
+
try {
|
|
54985
|
+
const activity2 = await loadProvisionalRunActivity(itemId2);
|
|
54986
|
+
if (!activity2 || sessions.get(session.id) !== session) return;
|
|
54987
|
+
if (session.activity) return;
|
|
54988
|
+
const provisional = { ...activity2, startedAt: Date.now() };
|
|
54989
|
+
if (!writeActivityIfAbsent(session.id, provisional)) {
|
|
54990
|
+
daemonLog(
|
|
54991
|
+
`session ${session.id} provisional activity skipped: child already reported`
|
|
54992
|
+
);
|
|
54993
|
+
return;
|
|
54994
|
+
}
|
|
54995
|
+
session.activity = provisional;
|
|
54996
|
+
daemonLog(
|
|
54997
|
+
`session ${session.id} seeded provisional activity for item ${itemId2} phase ${activity2.phase}/${activity2.totalPhases}`
|
|
54998
|
+
);
|
|
54999
|
+
notify2();
|
|
55000
|
+
} catch (error) {
|
|
55001
|
+
daemonLog(
|
|
55002
|
+
`session ${session.id} provisional activity failed: ${String(error)}`
|
|
55003
|
+
);
|
|
55004
|
+
}
|
|
54985
55005
|
}
|
|
54986
55006
|
|
|
54987
55007
|
// src/commands/sessions/daemon/worktree/spawnInTree.ts
|
|
@@ -55014,7 +55034,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
55014
55034
|
}
|
|
55015
55035
|
|
|
55016
55036
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
55017
|
-
import { existsSync as
|
|
55037
|
+
import { existsSync as existsSync103 } from "fs";
|
|
55018
55038
|
|
|
55019
55039
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
55020
55040
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -55045,10 +55065,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
55045
55065
|
}
|
|
55046
55066
|
|
|
55047
55067
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
55048
|
-
import { existsSync as
|
|
55068
|
+
import { existsSync as existsSync102 } from "fs";
|
|
55049
55069
|
|
|
55050
55070
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
55051
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
55071
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync101, mkdirSync as mkdirSync43 } from "fs";
|
|
55052
55072
|
import { join as join114 } from "path";
|
|
55053
55073
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
55054
55074
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -55059,7 +55079,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
55059
55079
|
return;
|
|
55060
55080
|
}
|
|
55061
55081
|
const dest = join114(dir, `${claudeSessionId}.jsonl`);
|
|
55062
|
-
if (
|
|
55082
|
+
if (existsSync101(dest)) {
|
|
55063
55083
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
55064
55084
|
return;
|
|
55065
55085
|
}
|
|
@@ -55110,7 +55130,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
55110
55130
|
}
|
|
55111
55131
|
function cloneForReapedTree(missingCwd) {
|
|
55112
55132
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
55113
|
-
if (!clone || !
|
|
55133
|
+
if (!clone || !existsSync102(clone))
|
|
55114
55134
|
throw new Error(
|
|
55115
55135
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
55116
55136
|
);
|
|
@@ -55119,7 +55139,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
55119
55139
|
|
|
55120
55140
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
55121
55141
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
55122
|
-
if (!
|
|
55142
|
+
if (!existsSync103(cwd))
|
|
55123
55143
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
55124
55144
|
const id = ctx.spawnWith(
|
|
55125
55145
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -56320,7 +56340,7 @@ function isPrCheckoutArgs(args) {
|
|
|
56320
56340
|
|
|
56321
56341
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
56322
56342
|
import { execFile as execFile14 } from "child_process";
|
|
56323
|
-
import { existsSync as
|
|
56343
|
+
import { existsSync as existsSync104 } from "fs";
|
|
56324
56344
|
function prHeadBranch2(number, cwd) {
|
|
56325
56345
|
const { headBranch } = prCliCommands(number, cwd);
|
|
56326
56346
|
return new Promise((resolve32) => {
|
|
@@ -56334,12 +56354,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
56334
56354
|
}
|
|
56335
56355
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
56336
56356
|
const number = prCheckoutNumber(assistArgs);
|
|
56337
|
-
if (!number || !cwd || !
|
|
56357
|
+
if (!number || !cwd || !existsSync104(cwd)) return void 0;
|
|
56338
56358
|
const headRef = await prHeadBranch2(number, cwd);
|
|
56339
56359
|
if (!headRef) return void 0;
|
|
56340
56360
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
56341
56361
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
56342
|
-
if (!holder || !
|
|
56362
|
+
if (!holder || !existsSync104(holder)) return void 0;
|
|
56343
56363
|
daemonLog(
|
|
56344
56364
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
56345
56365
|
);
|