@staff0rd/assist 0.713.2 → 0.714.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/README.md +1 -1
- package/dist/commands/sessions/web/bundle.js +343 -343
- package/dist/index.js +64 -44
- 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.714.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -714,7 +714,7 @@ var assistConfigShape = {
|
|
|
714
714
|
}).optional(),
|
|
715
715
|
prs: z3.strictObject({
|
|
716
716
|
slack: z3.string().optional(),
|
|
717
|
-
required: z3.boolean().default(
|
|
717
|
+
required: z3.boolean().default(true),
|
|
718
718
|
promptJira: z3.boolean().default(false),
|
|
719
719
|
promptGithub: z3.boolean().default(false),
|
|
720
720
|
draft: z3.boolean().default(false),
|
|
@@ -7363,8 +7363,8 @@ function buildPrompt(description) {
|
|
|
7363
7363
|
// src/commands/backlog/ensureStoryBranch.ts
|
|
7364
7364
|
async function ensureStoryBranch(item) {
|
|
7365
7365
|
const config = loadConfig();
|
|
7366
|
-
if (
|
|
7367
|
-
log(item, "prs.required
|
|
7366
|
+
if (config.prs?.required === false) {
|
|
7367
|
+
log(item, "prs.required is false; left the session on its current branch");
|
|
7368
7368
|
return;
|
|
7369
7369
|
}
|
|
7370
7370
|
const recorded = recordedBranch(item);
|
|
@@ -7375,7 +7375,7 @@ async function ensureStoryBranch(item) {
|
|
|
7375
7375
|
process.env.ASSIST_BACKLOG_ITEM_ID = String(item.id);
|
|
7376
7376
|
const slug2 = await generateBranchSlug(item.name);
|
|
7377
7377
|
const { branchName } = await createBranch({ slug: slug2, jira: item.jiraKey });
|
|
7378
|
-
log(item, `prs.required
|
|
7378
|
+
log(item, `prs.required on and no branch recorded; created ${branchName}`);
|
|
7379
7379
|
}
|
|
7380
7380
|
function recordedBranch(item) {
|
|
7381
7381
|
return (item.gitRefs ?? []).find((ref) => ref.kind === "branch")?.ref;
|
|
@@ -12578,8 +12578,8 @@ var prsConfigHelp = [
|
|
|
12578
12578
|
},
|
|
12579
12579
|
{
|
|
12580
12580
|
key: "prs.required",
|
|
12581
|
-
setter: "assist config set prs.required
|
|
12582
|
-
note: "require a branch when running a backlog item"
|
|
12581
|
+
setter: "assist config set prs.required false",
|
|
12582
|
+
note: "require a branch when running a backlog item (default true; set false to opt out)"
|
|
12583
12583
|
},
|
|
12584
12584
|
...prsRaiseConfigHelp
|
|
12585
12585
|
];
|
|
@@ -43702,6 +43702,35 @@ var VerifyTracker = class {
|
|
|
43702
43702
|
}
|
|
43703
43703
|
};
|
|
43704
43704
|
|
|
43705
|
+
// src/commands/sessions/daemon/withRepoGroups.ts
|
|
43706
|
+
function withRepoGroups(sessions) {
|
|
43707
|
+
const existence = /* @__PURE__ */ new Map();
|
|
43708
|
+
const exists = (dir) => {
|
|
43709
|
+
const cached = existence.get(dir);
|
|
43710
|
+
if (cached !== void 0) return cached;
|
|
43711
|
+
const result = repoDirExists(dir);
|
|
43712
|
+
existence.set(dir, result);
|
|
43713
|
+
return result;
|
|
43714
|
+
};
|
|
43715
|
+
return sessions.map((session) => {
|
|
43716
|
+
const repoGroup = repoGroupForCwd(session.cwd);
|
|
43717
|
+
const dir = repoGroup?.clone || session.cwd;
|
|
43718
|
+
const cwdMissing = Boolean(dir) && !exists(dir);
|
|
43719
|
+
if (!repoGroup && !cwdMissing) return session;
|
|
43720
|
+
return {
|
|
43721
|
+
...session,
|
|
43722
|
+
...repoGroup && { repoGroup },
|
|
43723
|
+
...cwdMissing && { cwdMissing }
|
|
43724
|
+
};
|
|
43725
|
+
});
|
|
43726
|
+
}
|
|
43727
|
+
|
|
43728
|
+
// src/commands/sessions/daemon/collectHistory.ts
|
|
43729
|
+
async function collectHistory(linked) {
|
|
43730
|
+
const [local, remote] = await Promise.all([discoverSessions(), linked]);
|
|
43731
|
+
return withRepoGroups(local).concat(remote);
|
|
43732
|
+
}
|
|
43733
|
+
|
|
43705
43734
|
// src/commands/sessions/daemon/links/connectLinkWebSocket.ts
|
|
43706
43735
|
import WebSocket from "ws";
|
|
43707
43736
|
var HANDSHAKE_TIMEOUT_MS = 5e3;
|
|
@@ -43930,7 +43959,7 @@ var LaunchCircuitBreaker = class {
|
|
|
43930
43959
|
|
|
43931
43960
|
// src/commands/sessions/daemon/links/LinkRelayState.ts
|
|
43932
43961
|
var MAX_SCROLLBACK2 = 256 * 1024;
|
|
43933
|
-
function createRelayState(node, viewers, onSessionsChanged) {
|
|
43962
|
+
function createRelayState(node, { viewers, onSessionsChanged, onHistoryChanged }) {
|
|
43934
43963
|
return {
|
|
43935
43964
|
node,
|
|
43936
43965
|
sessions: [],
|
|
@@ -43938,7 +43967,8 @@ function createRelayState(node, viewers, onSessionsChanged) {
|
|
|
43938
43967
|
pendingCreators: [],
|
|
43939
43968
|
historyWaiters: [],
|
|
43940
43969
|
viewers,
|
|
43941
|
-
onSessionsChanged
|
|
43970
|
+
onSessionsChanged,
|
|
43971
|
+
onHistoryChanged
|
|
43942
43972
|
};
|
|
43943
43973
|
}
|
|
43944
43974
|
function broadcastToViewers(state, msg) {
|
|
@@ -43987,7 +44017,7 @@ function createLinkContext(spec, deps2) {
|
|
|
43987
44017
|
return {
|
|
43988
44018
|
spec,
|
|
43989
44019
|
deps: deps2,
|
|
43990
|
-
relay: createRelayState(spec.name, deps2
|
|
44020
|
+
relay: createRelayState(spec.name, deps2),
|
|
43991
44021
|
breaker: new LaunchCircuitBreaker(`link ${spec.name} ws`),
|
|
43992
44022
|
tunnel: deps2.tunnel(spec),
|
|
43993
44023
|
socket: null,
|
|
@@ -44299,10 +44329,18 @@ var relayToCreator = (label2) => (state, msg) => {
|
|
|
44299
44329
|
daemonLog(`link ${state.node} ws: ${msg.type} with no pending creator`);
|
|
44300
44330
|
};
|
|
44301
44331
|
var relayHistory = (state, msg) => {
|
|
44302
|
-
const sessions = msg.sessions ?? []
|
|
44303
|
-
|
|
44304
|
-
|
|
44305
|
-
);
|
|
44332
|
+
const sessions = (msg.sessions ?? []).map((s) => ({
|
|
44333
|
+
...s,
|
|
44334
|
+
node: state.node
|
|
44335
|
+
}));
|
|
44336
|
+
const changed = JSON.stringify(sessions) !== JSON.stringify(state.lastHistory);
|
|
44337
|
+
state.lastHistory = sessions;
|
|
44338
|
+
const waiter = state.historyWaiters.shift();
|
|
44339
|
+
if (waiter) waiter(sessions);
|
|
44340
|
+
else if (changed) {
|
|
44341
|
+
daemonLog(`link ${state.node} ws: late history reply changed, pushing`);
|
|
44342
|
+
state.onHistoryChanged();
|
|
44343
|
+
}
|
|
44306
44344
|
};
|
|
44307
44345
|
var relays = {
|
|
44308
44346
|
sessions: relayLinkSessions,
|
|
@@ -44335,6 +44373,7 @@ function onHello(ctx, msg) {
|
|
|
44335
44373
|
ctx.breaker.clear();
|
|
44336
44374
|
ctx.lastError = void 0;
|
|
44337
44375
|
setLinkState(ctx, "connected");
|
|
44376
|
+
ctx.deps.onHistoryChanged();
|
|
44338
44377
|
ctx.onCompatible();
|
|
44339
44378
|
}
|
|
44340
44379
|
function onLinkLine(ctx, line) {
|
|
@@ -44391,7 +44430,7 @@ function requestLinkHistory(ctx) {
|
|
|
44391
44430
|
const index3 = waiters.indexOf(settle);
|
|
44392
44431
|
if (index3 !== -1) waiters.splice(index3, 1);
|
|
44393
44432
|
daemonLog(`link ${ctx.spec.name} ws: history timed out`);
|
|
44394
|
-
resolve25([]);
|
|
44433
|
+
resolve25(ctx.relay.lastHistory ?? []);
|
|
44395
44434
|
}, HISTORY_TIMEOUT_MS);
|
|
44396
44435
|
timer.unref?.();
|
|
44397
44436
|
waiters.push(settle);
|
|
@@ -44480,7 +44519,8 @@ var NodeLinks = class {
|
|
|
44480
44519
|
const deps2 = linkDeps(this.options, {
|
|
44481
44520
|
viewers: () => this.clients.viewers(),
|
|
44482
44521
|
onSessionsChanged: this.onSessionsChanged,
|
|
44483
|
-
onStateChanged: () => broadcast(this.clients.viewers(), this.nodes())
|
|
44522
|
+
onStateChanged: () => broadcast(this.clients.viewers(), this.nodes()),
|
|
44523
|
+
onHistoryChanged: () => void this.broadcastHistory()
|
|
44484
44524
|
});
|
|
44485
44525
|
reconcileLinks(this.links, specs, (spec) => new NodeLink(spec, deps2));
|
|
44486
44526
|
this.onSessionsChanged();
|
|
@@ -44493,6 +44533,13 @@ var NodeLinks = class {
|
|
|
44493
44533
|
for (const link3 of this.all()) link3.replayScrollback(client);
|
|
44494
44534
|
}
|
|
44495
44535
|
history = async () => (await Promise.all(this.all().map((link3) => link3.history()))).flat();
|
|
44536
|
+
broadcastHistory = async () => {
|
|
44537
|
+
const sessions = await collectHistory(this.history());
|
|
44538
|
+
daemonLog(
|
|
44539
|
+
`links: pushing history (${sessions.length} sessions) to viewers`
|
|
44540
|
+
);
|
|
44541
|
+
broadcast(this.clients.viewers(), { type: "history", sessions });
|
|
44542
|
+
};
|
|
44496
44543
|
nodes = () => ({
|
|
44497
44544
|
type: "nodes",
|
|
44498
44545
|
local: this.localNode(),
|
|
@@ -45312,37 +45359,10 @@ function routed(local) {
|
|
|
45312
45359
|
};
|
|
45313
45360
|
}
|
|
45314
45361
|
|
|
45315
|
-
// src/commands/sessions/daemon/withRepoGroups.ts
|
|
45316
|
-
function withRepoGroups(sessions) {
|
|
45317
|
-
const existence = /* @__PURE__ */ new Map();
|
|
45318
|
-
const exists = (dir) => {
|
|
45319
|
-
const cached = existence.get(dir);
|
|
45320
|
-
if (cached !== void 0) return cached;
|
|
45321
|
-
const result = repoDirExists(dir);
|
|
45322
|
-
existence.set(dir, result);
|
|
45323
|
-
return result;
|
|
45324
|
-
};
|
|
45325
|
-
return sessions.map((session) => {
|
|
45326
|
-
const repoGroup = repoGroupForCwd(session.cwd);
|
|
45327
|
-
const dir = repoGroup?.clone || session.cwd;
|
|
45328
|
-
const cwdMissing = Boolean(dir) && !exists(dir);
|
|
45329
|
-
if (!repoGroup && !cwdMissing) return session;
|
|
45330
|
-
return {
|
|
45331
|
-
...session,
|
|
45332
|
-
...repoGroup && { repoGroup },
|
|
45333
|
-
...cwdMissing && { cwdMissing }
|
|
45334
|
-
};
|
|
45335
|
-
});
|
|
45336
|
-
}
|
|
45337
|
-
|
|
45338
45362
|
// src/commands/sessions/daemon/lifecycleHandlers.ts
|
|
45339
45363
|
async function handleHistory(client, manager) {
|
|
45340
45364
|
const linked = manager.clients.isPeer(client) ? [] : manager.links.history();
|
|
45341
|
-
|
|
45342
|
-
sendTo(client, {
|
|
45343
|
-
type: "history",
|
|
45344
|
-
sessions: withRepoGroups(local).concat(remote)
|
|
45345
|
-
});
|
|
45365
|
+
sendTo(client, { type: "history", sessions: await collectHistory(linked) });
|
|
45346
45366
|
}
|
|
45347
45367
|
function handleFetchTranscript(client, _manager, data) {
|
|
45348
45368
|
const sessionId = data.sessionId;
|