@staff0rd/assist 0.967.0 → 0.968.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/claude/skills/review-ci/scripts/review.mjs +1 -1
- package/dist/commands/sessions/web/bundle.js +165 -165
- package/dist/index.js +126 -23
- 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.968.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1291,6 +1291,9 @@ var assistConfigShape = {
|
|
|
1291
1291
|
})
|
|
1292
1292
|
).default([])
|
|
1293
1293
|
}).optional(),
|
|
1294
|
+
inbox: z6.strictObject({
|
|
1295
|
+
intervalMinutes: z6.number().int().positive().optional()
|
|
1296
|
+
}).optional(),
|
|
1294
1297
|
autoUpdate: z6.strictObject({
|
|
1295
1298
|
enabled: z6.boolean().default(true)
|
|
1296
1299
|
}).optional(),
|
|
@@ -5781,6 +5784,15 @@ var harnessConfigHelp = [
|
|
|
5781
5784
|
}
|
|
5782
5785
|
];
|
|
5783
5786
|
|
|
5787
|
+
// src/commands/inbox/inboxConfigHelp.ts
|
|
5788
|
+
var inboxConfigHelp = [
|
|
5789
|
+
{
|
|
5790
|
+
key: "inbox.intervalMinutes",
|
|
5791
|
+
setter: "assist config set inbox.intervalMinutes <n> --node",
|
|
5792
|
+
note: "minutes between scheduled inbox scans run by this machine's daemon (restart the daemon to apply); read from ~/.assist.yml only, so a repo's assist.yml or shared overrides can't enable it. Unset by default: no scheduled scans"
|
|
5793
|
+
}
|
|
5794
|
+
];
|
|
5795
|
+
|
|
5784
5796
|
// src/commands/backup/backupConfigHelp.ts
|
|
5785
5797
|
var backupConfigHelp = [
|
|
5786
5798
|
{
|
|
@@ -6393,6 +6405,7 @@ var configHelpEntries = [
|
|
|
6393
6405
|
...devlogConfigHelp,
|
|
6394
6406
|
...dotnetConfigHelp,
|
|
6395
6407
|
...harnessConfigHelp,
|
|
6408
|
+
...inboxConfigHelp,
|
|
6396
6409
|
...jiraConfigHelp,
|
|
6397
6410
|
...litellmConfigHelp,
|
|
6398
6411
|
...mermaidConfigHelp,
|
|
@@ -6425,7 +6438,7 @@ function configHelpForKey(key) {
|
|
|
6425
6438
|
}
|
|
6426
6439
|
|
|
6427
6440
|
// src/commands/config/isGlobalOnlyConfigKey.ts
|
|
6428
|
-
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
6441
|
+
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm", "inbox.intervalMinutes"];
|
|
6429
6442
|
function isGlobalOnlyConfigKey(key) {
|
|
6430
6443
|
return GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k));
|
|
6431
6444
|
}
|
|
@@ -28530,7 +28543,7 @@ async function runInboxScanClaude(since) {
|
|
|
28530
28543
|
return parseInboxScanOutput(stdout);
|
|
28531
28544
|
}
|
|
28532
28545
|
|
|
28533
|
-
// src/commands/inbox/
|
|
28546
|
+
// src/commands/inbox/runInboxScan.ts
|
|
28534
28547
|
var FIRST_SCAN_LOOKBACK_MS = 24 * 60 * 6e4;
|
|
28535
28548
|
function toRow2(message3) {
|
|
28536
28549
|
const receivedAt = message3.receivedAt ? new Date(message3.receivedAt) : void 0;
|
|
@@ -28543,18 +28556,26 @@ function toRow2(message3) {
|
|
|
28543
28556
|
receivedAt: receivedAt && !Number.isNaN(receivedAt.getTime()) ? receivedAt : null
|
|
28544
28557
|
};
|
|
28545
28558
|
}
|
|
28546
|
-
async function
|
|
28547
|
-
const orm = await getDb();
|
|
28559
|
+
async function runInboxScan(orm, wrap = (_since, run4) => run4()) {
|
|
28548
28560
|
const startedAt = /* @__PURE__ */ new Date();
|
|
28549
28561
|
const since = await readInboxLastScan(orm) ?? new Date(startedAt.getTime() - FIRST_SCAN_LOOKBACK_MS);
|
|
28550
|
-
const flagged = await
|
|
28551
|
-
`Scanning Gmail and Slack (Slack since ${since.toISOString()})`,
|
|
28552
|
-
() => runInboxScanClaude(since)
|
|
28553
|
-
);
|
|
28562
|
+
const flagged = await wrap(since, () => runInboxScanClaude(since));
|
|
28554
28563
|
const added = await upsertInboxMessages(orm, flagged.map(toRow2));
|
|
28555
28564
|
await writeInboxLastScan(orm, startedAt);
|
|
28565
|
+
return { flagged: flagged.length, added };
|
|
28566
|
+
}
|
|
28567
|
+
|
|
28568
|
+
// src/commands/inbox/scan.ts
|
|
28569
|
+
async function scan() {
|
|
28570
|
+
const { flagged, added } = await runInboxScan(
|
|
28571
|
+
await getDb(),
|
|
28572
|
+
(since, run4) => withSpinner(
|
|
28573
|
+
`Scanning Gmail and Slack (Slack since ${since.toISOString()})`,
|
|
28574
|
+
run4
|
|
28575
|
+
)
|
|
28576
|
+
);
|
|
28556
28577
|
console.log(
|
|
28557
|
-
`Flagged ${flagged
|
|
28578
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk177.bold(added)} new.`
|
|
28558
28579
|
);
|
|
28559
28580
|
}
|
|
28560
28581
|
|
|
@@ -28565,6 +28586,7 @@ function registerInbox(program) {
|
|
|
28565
28586
|
"Scan unread Gmail inbox threads and Slack DMs and @mentions since the last scan with a read-only headless Claude, storing flagged messages"
|
|
28566
28587
|
).action(scan);
|
|
28567
28588
|
inboxCommand.command("list").description("List flagged inbox messages, newest first").action(list3);
|
|
28589
|
+
configHelp(inboxCommand, inboxConfigHelp);
|
|
28568
28590
|
}
|
|
28569
28591
|
|
|
28570
28592
|
// src/commands/jira/acceptanceCriteria.ts
|
|
@@ -33834,10 +33856,10 @@ async function getAccessToken(apiKey) {
|
|
|
33834
33856
|
}
|
|
33835
33857
|
});
|
|
33836
33858
|
if (!response.ok) {
|
|
33837
|
-
const
|
|
33859
|
+
const errorText4 = await response.text();
|
|
33838
33860
|
throw new Error(
|
|
33839
33861
|
`Failed to get access token: ${response.status} ${response.statusText}
|
|
33840
|
-
${
|
|
33862
|
+
${errorText4}`
|
|
33841
33863
|
);
|
|
33842
33864
|
}
|
|
33843
33865
|
const tokenData = await response.json();
|
|
@@ -46016,6 +46038,17 @@ function requestDrain(socket, lines2) {
|
|
|
46016
46038
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
46017
46039
|
import { mkdirSync as mkdirSync41 } from "fs";
|
|
46018
46040
|
|
|
46041
|
+
// src/commands/sessions/daemon/broadcast.ts
|
|
46042
|
+
function sendTo(client, msg) {
|
|
46043
|
+
client.send(JSON.stringify(msg));
|
|
46044
|
+
}
|
|
46045
|
+
function broadcast(clients, msg) {
|
|
46046
|
+
const json = JSON.stringify(msg);
|
|
46047
|
+
for (const client of clients) {
|
|
46048
|
+
client.send(json);
|
|
46049
|
+
}
|
|
46050
|
+
}
|
|
46051
|
+
|
|
46019
46052
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
46020
46053
|
var DEFAULT_GRACE_MS = 6e4;
|
|
46021
46054
|
function createAutoExit(exit, graceMs = DEFAULT_GRACE_MS) {
|
|
@@ -46119,17 +46152,6 @@ var ActiveSelection = class {
|
|
|
46119
46152
|
}
|
|
46120
46153
|
};
|
|
46121
46154
|
|
|
46122
|
-
// src/commands/sessions/daemon/broadcast.ts
|
|
46123
|
-
function sendTo(client, msg) {
|
|
46124
|
-
client.send(JSON.stringify(msg));
|
|
46125
|
-
}
|
|
46126
|
-
function broadcast(clients, msg) {
|
|
46127
|
-
const json = JSON.stringify(msg);
|
|
46128
|
-
for (const client of clients) {
|
|
46129
|
-
client.send(json);
|
|
46130
|
-
}
|
|
46131
|
-
}
|
|
46132
|
-
|
|
46133
46155
|
// src/commands/sessions/shared/promptIssueRef.ts
|
|
46134
46156
|
var issuePrompt = /^Issue ([^\s#]+\/[^\s#]+)#(\d+):/;
|
|
46135
46157
|
var issueUrlPrompt = /^https?:\/\/(?:www\.)?github\.com\/([^\s/#?]+\/[^\s/#?]+)\/issues\/(\d+)(?![^\s?#])/;
|
|
@@ -51837,6 +51859,7 @@ var relays = {
|
|
|
51837
51859
|
created: relayToCreator("created session"),
|
|
51838
51860
|
error: relayToCreator("peer error:"),
|
|
51839
51861
|
notice: (state, msg) => broadcastToViewers(state, msg),
|
|
51862
|
+
inbox: (state, msg) => broadcastToViewers(state, msg),
|
|
51840
51863
|
"run-conflict": relayRunConflict,
|
|
51841
51864
|
history: relayHistory,
|
|
51842
51865
|
"user-messages": (state, msg) => broadcastToViewers(state, { ...msg, sessionId: nsId(state, msg) }),
|
|
@@ -53624,6 +53647,85 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
53624
53647
|
listenWithSingleOnListening(server, manager, checkAutoExit);
|
|
53625
53648
|
}
|
|
53626
53649
|
|
|
53650
|
+
// src/commands/sessions/daemon/inbox/firstDelayMs.ts
|
|
53651
|
+
async function firstDelayMs(intervalMs) {
|
|
53652
|
+
try {
|
|
53653
|
+
const last = await readInboxLastScan(await getDb());
|
|
53654
|
+
if (!last) return 0;
|
|
53655
|
+
return Math.max(0, last.getTime() + intervalMs - Date.now());
|
|
53656
|
+
} catch (error) {
|
|
53657
|
+
daemonLog(`inbox: reading the last scan time failed: ${errorText(error)}`);
|
|
53658
|
+
return intervalMs;
|
|
53659
|
+
}
|
|
53660
|
+
}
|
|
53661
|
+
function errorText(error) {
|
|
53662
|
+
return error instanceof Error ? error.message : String(error);
|
|
53663
|
+
}
|
|
53664
|
+
|
|
53665
|
+
// src/commands/inbox/readInboxIntervalMinutes.ts
|
|
53666
|
+
function readInboxIntervalMinutes(globalConfigPath) {
|
|
53667
|
+
const raw = loadGlobalConfigRaw(globalConfigPath);
|
|
53668
|
+
return assistConfigSchema.shape.inbox.parse(raw.inbox)?.intervalMinutes;
|
|
53669
|
+
}
|
|
53670
|
+
|
|
53671
|
+
// src/commands/sessions/daemon/inbox/intervalMinutes.ts
|
|
53672
|
+
function intervalMinutes() {
|
|
53673
|
+
try {
|
|
53674
|
+
return readInboxIntervalMinutes();
|
|
53675
|
+
} catch (error) {
|
|
53676
|
+
daemonLog(
|
|
53677
|
+
`inbox: ignoring invalid inbox.intervalMinutes: ${errorText2(error)}`
|
|
53678
|
+
);
|
|
53679
|
+
return void 0;
|
|
53680
|
+
}
|
|
53681
|
+
}
|
|
53682
|
+
function errorText2(error) {
|
|
53683
|
+
return error instanceof Error ? error.message : String(error);
|
|
53684
|
+
}
|
|
53685
|
+
|
|
53686
|
+
// src/commands/sessions/daemon/startInboxScans.ts
|
|
53687
|
+
function errorText3(error) {
|
|
53688
|
+
return error instanceof Error ? error.message : String(error);
|
|
53689
|
+
}
|
|
53690
|
+
function startInboxScans(onAdded) {
|
|
53691
|
+
const minutes = intervalMinutes();
|
|
53692
|
+
if (!minutes) {
|
|
53693
|
+
daemonLog("inbox: scheduled scans off (inbox.intervalMinutes unset)");
|
|
53694
|
+
return () => {
|
|
53695
|
+
};
|
|
53696
|
+
}
|
|
53697
|
+
if (!process.env.ASSIST_DATABASE_URL && !loadConfig().database.url) {
|
|
53698
|
+
daemonLog("inbox: scheduled scans off (no database configured)");
|
|
53699
|
+
return () => {
|
|
53700
|
+
};
|
|
53701
|
+
}
|
|
53702
|
+
const intervalMs = minutes * 6e4;
|
|
53703
|
+
let timer;
|
|
53704
|
+
let stopped = false;
|
|
53705
|
+
const schedule = (delayMs) => {
|
|
53706
|
+
if (stopped) return;
|
|
53707
|
+
timer = setTimeout(() => void tick(), delayMs);
|
|
53708
|
+
timer.unref();
|
|
53709
|
+
};
|
|
53710
|
+
const tick = async () => {
|
|
53711
|
+
daemonLog("inbox: scan started");
|
|
53712
|
+
try {
|
|
53713
|
+
const { flagged, added } = await runInboxScan(await getDb());
|
|
53714
|
+
daemonLog(`inbox: scan flagged ${flagged} message(s), ${added} new`);
|
|
53715
|
+
if (added > 0) onAdded();
|
|
53716
|
+
} catch (error) {
|
|
53717
|
+
daemonLog(`inbox: scan failed: ${errorText3(error)}`);
|
|
53718
|
+
}
|
|
53719
|
+
schedule(intervalMs);
|
|
53720
|
+
};
|
|
53721
|
+
daemonLog(`inbox: scanning every ${minutes} minute(s)`);
|
|
53722
|
+
void firstDelayMs(intervalMs).then(schedule);
|
|
53723
|
+
return () => {
|
|
53724
|
+
stopped = true;
|
|
53725
|
+
clearTimeout(timer);
|
|
53726
|
+
};
|
|
53727
|
+
}
|
|
53728
|
+
|
|
53627
53729
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
53628
53730
|
async function runDaemon() {
|
|
53629
53731
|
mkdirSync41(daemonPaths.dir, { recursive: true });
|
|
@@ -53643,6 +53745,7 @@ async function runDaemon() {
|
|
|
53643
53745
|
setDaemonLogSink(manager.clients.emitLog);
|
|
53644
53746
|
startDaemonLogTrimmer();
|
|
53645
53747
|
pollRepoConfigCache();
|
|
53748
|
+
startInboxScans(() => broadcast(manager.clients, { type: "inbox" }));
|
|
53646
53749
|
await startDaemonServer(manager, checkAutoExit);
|
|
53647
53750
|
await refreshRepoConfigCacheOnStart();
|
|
53648
53751
|
}
|