@staff0rd/assist 0.1140.2 → 0.1141.1
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/built-version +1 -1
- package/dist/commands/extension/extension/content.js +1 -1
- package/dist/commands/extension/extension/docs.js +1 -1
- package/dist/commands/sessions/web/bundle.js +434 -434
- package/dist/index.js +1 -1
- package/dist/{runCli-5IYVWCER.js → runCli-67OAEPRI.js} +110 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,6 @@ if (isStatusLineInvocation(process.argv)) {
|
|
|
10
10
|
const { runStatusLine } = await import("./runStatusLine-6VBMFNUZ.js");
|
|
11
11
|
await runStatusLine();
|
|
12
12
|
} else {
|
|
13
|
-
const { runCli } = await import("./runCli-
|
|
13
|
+
const { runCli } = await import("./runCli-67OAEPRI.js");
|
|
14
14
|
await runCli();
|
|
15
15
|
}
|
|
@@ -16,7 +16,7 @@ import { Command } from "commander";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "@staff0rd/assist",
|
|
19
|
-
version: "0.
|
|
19
|
+
version: "0.1141.1",
|
|
20
20
|
type: "module",
|
|
21
21
|
main: "dist/index.js",
|
|
22
22
|
bin: {
|
|
@@ -6574,12 +6574,12 @@ function createClaudeConnectorStream(onEvent) {
|
|
|
6574
6574
|
let result;
|
|
6575
6575
|
const emitUsage = () => onEvent({ type: "usage", usage: usage.current() });
|
|
6576
6576
|
const onAssistant = (message4) => {
|
|
6577
|
-
const
|
|
6577
|
+
const counted2 = usage.addTurn(message4.id, message4.usage);
|
|
6578
6578
|
for (const block of claudeContentBlocks(message4.content)) {
|
|
6579
6579
|
const event = claudeBlockEvent(block, usage.takeTurnTokens);
|
|
6580
6580
|
if (event) onEvent(event);
|
|
6581
6581
|
}
|
|
6582
|
-
if (
|
|
6582
|
+
if (counted2) emitUsage();
|
|
6583
6583
|
};
|
|
6584
6584
|
return {
|
|
6585
6585
|
onLine(line) {
|
|
@@ -12399,16 +12399,85 @@ async function untrackedPaths(cwd) {
|
|
|
12399
12399
|
return list7.split("\n").filter(Boolean);
|
|
12400
12400
|
}
|
|
12401
12401
|
async function groupedCounts(cwd, groups) {
|
|
12402
|
-
const outputs =
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12402
|
+
const outputs = [];
|
|
12403
|
+
for (const group of groups) {
|
|
12404
|
+
outputs.push(
|
|
12405
|
+
await execGit(cwd, [
|
|
12406
|
+
"diff",
|
|
12407
|
+
"--name-status",
|
|
12408
|
+
group.base,
|
|
12409
|
+
"--",
|
|
12410
|
+
...group.paths
|
|
12411
|
+
])
|
|
12412
|
+
);
|
|
12413
|
+
}
|
|
12407
12414
|
const counts2 = parseDiffNameStatus(outputs.join(""));
|
|
12408
12415
|
counts2.new.push(...await untrackedPaths(cwd));
|
|
12409
12416
|
return counts2;
|
|
12410
12417
|
}
|
|
12411
12418
|
|
|
12419
|
+
// src/commands/sessions/web/itemCountsFingerprint.ts
|
|
12420
|
+
async function headCommit2(cwd) {
|
|
12421
|
+
try {
|
|
12422
|
+
return (await execGit(cwd, ["rev-parse", "HEAD"])).trim();
|
|
12423
|
+
} catch {
|
|
12424
|
+
return "";
|
|
12425
|
+
}
|
|
12426
|
+
}
|
|
12427
|
+
async function dirtyItemContents(cwd, groups, uncommitted) {
|
|
12428
|
+
const dirty = /* @__PURE__ */ new Set([...uncommitted.modified, ...uncommitted.new]);
|
|
12429
|
+
const paths = groups.flatMap((group) => group.paths).filter((path129) => dirty.has(path129));
|
|
12430
|
+
if (paths.length === 0) return "";
|
|
12431
|
+
try {
|
|
12432
|
+
return await execGit(cwd, ["hash-object", "--", ...paths]);
|
|
12433
|
+
} catch {
|
|
12434
|
+
return `unhashed ${Date.now()} ${Math.random()}`;
|
|
12435
|
+
}
|
|
12436
|
+
}
|
|
12437
|
+
async function itemCountsFingerprint(cwd, groups, uncommitted) {
|
|
12438
|
+
const [head, contents] = await Promise.all([
|
|
12439
|
+
headCommit2(cwd),
|
|
12440
|
+
dirtyItemContents(cwd, groups, uncommitted)
|
|
12441
|
+
]);
|
|
12442
|
+
return JSON.stringify([head, groups, uncommitted, contents]);
|
|
12443
|
+
}
|
|
12444
|
+
|
|
12445
|
+
// src/commands/sessions/web/groupedCountsUnlessUnchanged.ts
|
|
12446
|
+
var RECOUNT_AFTER_MS = 3e4;
|
|
12447
|
+
var counted = /* @__PURE__ */ new Map();
|
|
12448
|
+
var counting = /* @__PURE__ */ new Map();
|
|
12449
|
+
function remember2(scope, fingerprint3, counts2) {
|
|
12450
|
+
const now = Date.now();
|
|
12451
|
+
for (const [other, entry] of counted) {
|
|
12452
|
+
if (entry.expiresAt <= now) counted.delete(other);
|
|
12453
|
+
}
|
|
12454
|
+
counted.set(scope, {
|
|
12455
|
+
fingerprint: fingerprint3,
|
|
12456
|
+
counts: counts2,
|
|
12457
|
+
expiresAt: now + RECOUNT_AFTER_MS
|
|
12458
|
+
});
|
|
12459
|
+
}
|
|
12460
|
+
function recalled(scope, fingerprint3) {
|
|
12461
|
+
const known = counted.get(scope);
|
|
12462
|
+
const fresh = known?.fingerprint === fingerprint3 && known.expiresAt > Date.now();
|
|
12463
|
+
return fresh ? known.counts : void 0;
|
|
12464
|
+
}
|
|
12465
|
+
async function groupedCountsUnlessUnchanged(scope, cwd, groups, uncommitted) {
|
|
12466
|
+
const fingerprint3 = await itemCountsFingerprint(cwd, groups, uncommitted);
|
|
12467
|
+
const known = recalled(scope, fingerprint3);
|
|
12468
|
+
if (known) return known;
|
|
12469
|
+
const pending = counting.get(scope);
|
|
12470
|
+
if (pending?.fingerprint === fingerprint3) return pending.counts;
|
|
12471
|
+
const counts2 = groupedCounts(cwd, groups).then((result) => {
|
|
12472
|
+
remember2(scope, fingerprint3, result);
|
|
12473
|
+
return result;
|
|
12474
|
+
}).finally(() => {
|
|
12475
|
+
if (counting.get(scope)?.counts === counts2) counting.delete(scope);
|
|
12476
|
+
});
|
|
12477
|
+
counting.set(scope, { fingerprint: fingerprint3, counts: counts2 });
|
|
12478
|
+
return counts2;
|
|
12479
|
+
}
|
|
12480
|
+
|
|
12412
12481
|
// src/commands/sessions/web/parseGitStatus.ts
|
|
12413
12482
|
function extractPath(rest) {
|
|
12414
12483
|
const arrow = rest.indexOf(" -> ");
|
|
@@ -12452,17 +12521,19 @@ async function gitStatus(req, res) {
|
|
|
12452
12521
|
if (!cwd) return;
|
|
12453
12522
|
try {
|
|
12454
12523
|
const branch2 = await gitBranchInfo(cwd);
|
|
12455
|
-
const
|
|
12456
|
-
|
|
12457
|
-
);
|
|
12524
|
+
const session = getConversationParam(req);
|
|
12525
|
+
const changeSet = await itemChangeSet(cwd, session).catch(() => void 0);
|
|
12526
|
+
const uncommitted = await workingTreeCounts(cwd);
|
|
12458
12527
|
if (!changeSet) {
|
|
12459
|
-
respondJson(res, 200, { ...
|
|
12528
|
+
respondJson(res, 200, { ...uncommitted, ...branch2 });
|
|
12460
12529
|
return;
|
|
12461
12530
|
}
|
|
12462
|
-
const
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12531
|
+
const counts2 = await groupedCountsUnlessUnchanged(
|
|
12532
|
+
`${cwd} ${session?.harness ?? ""}:${session?.conversationId ?? ""}`,
|
|
12533
|
+
cwd,
|
|
12534
|
+
changeSet.groups,
|
|
12535
|
+
uncommitted
|
|
12536
|
+
);
|
|
12466
12537
|
respondJson(res, 200, {
|
|
12467
12538
|
...counts2,
|
|
12468
12539
|
...branch2,
|
|
@@ -13723,7 +13794,7 @@ function resolveUpstream(cwd) {
|
|
|
13723
13794
|
}
|
|
13724
13795
|
|
|
13725
13796
|
// src/commands/watch/headCommit.ts
|
|
13726
|
-
function
|
|
13797
|
+
function headCommit3(cwd) {
|
|
13727
13798
|
try {
|
|
13728
13799
|
return runGit3(["rev-parse", "HEAD"], cwd);
|
|
13729
13800
|
} catch {
|
|
@@ -13735,7 +13806,7 @@ function headCommit2(cwd) {
|
|
|
13735
13806
|
var captured;
|
|
13736
13807
|
var webStartCommit = {
|
|
13737
13808
|
capture: () => {
|
|
13738
|
-
captured =
|
|
13809
|
+
captured = headCommit3(getInstallDir());
|
|
13739
13810
|
},
|
|
13740
13811
|
value: () => captured
|
|
13741
13812
|
};
|
|
@@ -14399,7 +14470,7 @@ var ownerOpenPrsQuery = `query($requested: String!, $authored: String!, $mine: S
|
|
|
14399
14470
|
var sameLogin = (a, b) => a?.toLowerCase() === b.toLowerCase();
|
|
14400
14471
|
|
|
14401
14472
|
// src/commands/sessions/web/next/headCommit.ts
|
|
14402
|
-
function
|
|
14473
|
+
function headCommit4(node) {
|
|
14403
14474
|
return node.commits?.nodes?.[0]?.commit ?? null;
|
|
14404
14475
|
}
|
|
14405
14476
|
|
|
@@ -14418,7 +14489,7 @@ function lastRequestedAt(node, viewer) {
|
|
|
14418
14489
|
return events.at(-1)?.createdAt ?? node.createdAt;
|
|
14419
14490
|
}
|
|
14420
14491
|
function toNextPr(node, author, requested, viewer) {
|
|
14421
|
-
const rollup =
|
|
14492
|
+
const rollup = headCommit4(node)?.statusCheckRollup?.state;
|
|
14422
14493
|
return {
|
|
14423
14494
|
number: node.number,
|
|
14424
14495
|
title: node.title,
|
|
@@ -16135,7 +16206,7 @@ function deploymentsQuery(environments) {
|
|
|
16135
16206
|
}
|
|
16136
16207
|
|
|
16137
16208
|
// src/commands/sessions/web/releases/liveDeployments.ts
|
|
16138
|
-
function
|
|
16209
|
+
function headCommit5(node) {
|
|
16139
16210
|
return node?.oid ? releaseCommit(node.oid, node) : null;
|
|
16140
16211
|
}
|
|
16141
16212
|
function environmentNodes(repository, count10) {
|
|
@@ -16162,7 +16233,7 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
16162
16233
|
if (!repository) throw new Error(`Repository not readable: ${repo}`);
|
|
16163
16234
|
return {
|
|
16164
16235
|
defaultBranch: repository.defaultBranchRef?.name ?? null,
|
|
16165
|
-
head:
|
|
16236
|
+
head: headCommit5(repository.defaultBranchRef?.target),
|
|
16166
16237
|
...deploymentMaps(environmentNodes(repository, distinct.length))
|
|
16167
16238
|
};
|
|
16168
16239
|
}
|
|
@@ -57496,6 +57567,21 @@ function holdsNoCheckout(path129) {
|
|
|
57496
57567
|
return existsSync104(path129) && !existsSync104(join127(path129, ".git"));
|
|
57497
57568
|
}
|
|
57498
57569
|
|
|
57570
|
+
// src/commands/sessions/daemon/worktree/tipOnRemote.ts
|
|
57571
|
+
function tipWasFetched(reflog) {
|
|
57572
|
+
const entries2 = reflog.split("\n").map((line) => line.trim().split(" "));
|
|
57573
|
+
const tip = entries2[0]?.[0];
|
|
57574
|
+
return !!tip && entries2.some(([sha, action]) => sha === tip && action === "fetch");
|
|
57575
|
+
}
|
|
57576
|
+
function* tipOnRemote() {
|
|
57577
|
+
const remoteBranches = yield ["branch", "-r", "--contains", "HEAD"];
|
|
57578
|
+
if (remoteBranches.ok && remoteBranches.out !== "") return true;
|
|
57579
|
+
const branch2 = yield ["symbolic-ref", "--quiet", "HEAD"];
|
|
57580
|
+
if (!branch2.ok || !branch2.out) return false;
|
|
57581
|
+
const reflog = yield ["reflog", "show", "--format=%H %gs", branch2.out];
|
|
57582
|
+
return reflog.ok && tipWasFetched(reflog.out);
|
|
57583
|
+
}
|
|
57584
|
+
|
|
57499
57585
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
57500
57586
|
var treeIsGone = { durable: true, gone: true };
|
|
57501
57587
|
function treeDurability(state) {
|
|
@@ -57521,10 +57607,9 @@ function* durabilityProbes(cwd) {
|
|
|
57521
57607
|
if (ahead.ok && Number(ahead.out) === 0)
|
|
57522
57608
|
return treeDurability({ dirty, localOnlyCommits: false });
|
|
57523
57609
|
}
|
|
57524
|
-
const remoteBranches = yield ["branch", "-r", "--contains", "HEAD"];
|
|
57525
57610
|
return treeDurability({
|
|
57526
57611
|
dirty,
|
|
57527
|
-
localOnlyCommits: !
|
|
57612
|
+
localOnlyCommits: !(yield* tipOnRemote())
|
|
57528
57613
|
});
|
|
57529
57614
|
}
|
|
57530
57615
|
function notACheckout(cwd, error) {
|
|
@@ -57769,7 +57854,7 @@ function startAutoUpdate(ctx) {
|
|
|
57769
57854
|
stayOff(`${installDir} is not a git clone`);
|
|
57770
57855
|
return;
|
|
57771
57856
|
}
|
|
57772
|
-
autoUpdateState.setStartCommit(
|
|
57857
|
+
autoUpdateState.setStartCommit(headCommit3(installDir));
|
|
57773
57858
|
if (!autoUpdateEnabled(installDir)) {
|
|
57774
57859
|
stayOff("autoUpdate.enabled is false");
|
|
57775
57860
|
return;
|