@hearsay-tools/squawk 0.18.0-dev.6433 → 0.18.0-dev.6448
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/ci-wait/tools.d.ts +4 -4
- package/dist/contract/index.js +6 -3
- package/dist/contract/repo.d.ts +2 -0
- package/dist/contract/run-predicates.d.ts +3 -1
- package/dist/delegation/family-end.d.ts +9 -0
- package/dist/delegation/family-end.js +108 -0
- package/dist/delegation/family-end.js.map +1 -0
- package/dist/delegation/routes.d.ts +11 -11
- package/dist/delegation/transport.d.ts +13 -13
- package/dist/delegation/workspace-record.d.ts +7 -0
- package/dist/delegation/workspace-record.js +24 -1
- package/dist/delegation/workspace-record.js.map +1 -1
- package/dist/delegation/workspace-removal.js +56 -13
- package/dist/delegation/workspace-removal.js.map +1 -1
- package/dist/runs/branch-owners.d.ts +30 -0
- package/dist/runs/branch-owners.js +81 -0
- package/dist/runs/branch-owners.js.map +1 -0
- package/dist/runs/retention.d.ts +24 -15
- package/dist/runs/retention.js +57 -39
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/run-database.d.ts +1 -0
- package/dist/runs/run-database.js +3 -4
- package/dist/runs/run-database.js.map +1 -1
- package/dist/runs/run-row.d.ts +3 -0
- package/dist/runs/run-row.js +5 -0
- package/dist/runs/run-row.js.map +1 -1
- package/dist/runs/store.d.ts +7 -17
- package/dist/runs/store.js +22 -38
- package/dist/runs/store.js.map +1 -1
- package/dist/server/project-context.d.ts +9 -2
- package/dist/server/project-context.js +24 -5
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/repo-branch-sweep.d.ts +23 -1
- package/dist/server/repo-branch-sweep.js +9 -1
- package/dist/server/repo-branch-sweep.js.map +1 -1
- package/dist/server/repo-branches.d.ts +12 -0
- package/dist/server/repo-branches.js +86 -10
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/server.d.ts +36 -34
- package/dist/server/server.js +1 -1
- package/dist/server/server.js.map +1 -1
- package/dist/server/start-server.js +2 -2
- package/dist/server/start-server.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +72 -72
- package/dist/workflows/run/maintenance-claims.js +7 -2
- package/dist/workflows/run/maintenance-claims.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/package.json +4 -4
- package/web/dist/assets/{activity-motion-u7cCOvIh.js → activity-motion-BeswQRe1.js} +1 -1
- package/web/dist/assets/{activity-route-BthlzLJS.js → activity-route-su3KawLr.js} +1 -1
- package/web/dist/assets/{agent-accounts-CbqP0u9A.js → agent-accounts-DseqHuGY.js} +1 -1
- package/web/dist/assets/attention-DlfFfWoj.js +1 -0
- package/web/dist/assets/{commit-diff-panel-B1FnfuXx.js → commit-diff-panel-DmhrguZk.js} +1 -1
- package/web/dist/assets/{diff-DwhVa59f.js → diff-DDwr1gUX.js} +2 -2
- package/web/dist/assets/{diff-view-C4JhxweA.js → diff-view-BNL7l7Vp.js} +1 -1
- package/web/dist/assets/{file-preview-xqxo9aYs.js → file-preview-Cm1jWwBy.js} +1 -1
- package/web/dist/assets/{git-toolbar-B5EhJG95.js → git-toolbar-Dya9briW.js} +1 -1
- package/web/dist/assets/{github-CGvl-B9Z.js → github-wWGhoE3O.js} +1 -1
- package/web/dist/assets/{global-activity-route-n_BdJZWx.js → global-activity-route-DpQr_eU9.js} +1 -1
- package/web/dist/assets/{index-O1VoICYw.js → index-DYx21hr3.js} +4 -4
- package/web/dist/assets/{preview-pane-connected-OWg6VXKi.js → preview-pane-connected-DSStovll.js} +1 -1
- package/web/dist/assets/{project-router-Coo_s3l-.js → project-router-uJ3SkX70.js} +1 -1
- package/web/dist/assets/{project-scope-context-WiGQMFsB.js → project-scope-context-X6-LgbYE.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-Ch7UoIKH.js → prompt-template-menu-D5T9W-K3.js} +1 -1
- package/web/dist/assets/{queries-BLvbAnL8.js → queries-00V5jnAV.js} +1 -1
- package/web/dist/assets/{reference-chip-P6ytqWNt.js → reference-chip-AZWOlSRV.js} +1 -1
- package/web/dist/assets/{repo-git-ZeZnpwuR.js → repo-git-DJPSn50o.js} +1 -1
- package/web/dist/assets/{report-reader-D_uzPRmR.js → report-reader-kzlovTso.js} +1 -1
- package/web/dist/assets/{reports-C49_pROg.js → reports-Ds7nog_M.js} +1 -1
- package/web/dist/assets/{run-header-BR1PGTJB.js → run-header-skVwUvR-.js} +1 -1
- package/web/dist/assets/{skills-BHpdpRR-.js → skills-BJPLRZL5.js} +1 -1
- package/web/dist/assets/{tab-link-CONf2d_z.js → tab-link-h4IjTsRH.js} +1 -1
- package/web/dist/assets/{task-changes-DqcCJDTC.js → task-changes-Db3dmYAT.js} +1 -1
- package/web/dist/assets/{task-commits-Jmpz5NtV.js → task-commits-D4HdW5xE.js} +1 -1
- package/web/dist/assets/{task-files-BFSteFDh.js → task-files-sdaEBCfr.js} +1 -1
- package/web/dist/assets/{task-github-item-CIno99eX.js → task-github-item-DyZdbhco.js} +1 -1
- package/web/dist/assets/{task-thread-BKkxwKd_.js → task-thread-QKAKHYiJ.js} +1 -1
- package/web/dist/assets/{thread-state-Bwt_th_-.js → thread-state-hhRCETQT.js} +1 -1
- package/web/dist/assets/{use-desktop-CW-Femww.js → use-desktop-C3yCutND.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-XV1UwyxH.js → use-hand-to-agent-state-wGtVosbN.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BgLdxmcZ.js → useInfiniteQuery-BcY0ra-k.js} +1 -1
- package/web/dist/assets/useQuery-C96hAjNV.js +1 -0
- package/web/dist/assets/{workflows-DUCROjgb.js → workflows-DRO8PcD-.js} +1 -1
- package/web/dist/assets/{ws-8bmD25V4.js → ws-BD6s7UXb.js} +1 -1
- package/web/dist/index.html +12 -12
- package/web/dist/assets/attention-CCx8Iagl.js +0 -1
- package/web/dist/assets/useQuery-CY8bJTYi.js +0 -1
package/dist/runs/store.js
CHANGED
|
@@ -46,6 +46,7 @@ import { assertConversationIdFree } from './conversation-identity.js';
|
|
|
46
46
|
export { ConversationIdInUseError } from './conversation-identity.js';
|
|
47
47
|
import { RUNNER_IDS } from '../core/agent-runner.js';
|
|
48
48
|
import { ARCHIVED_ROOT, RUNS_DB_FILE, RUNS_IMPORT_COMPLETE_KEY, RunConflictError, RunDatabase, RunDatabaseBusyError, } from './run-database.js';
|
|
49
|
+
import { listBranchOwners } from './branch-owners.js';
|
|
49
50
|
import { restoreLostReferencedPullRequest } from './loaded-run-healing.js';
|
|
50
51
|
import { failLoadedInterruptedRun, restoreLoadedUsageLimitHold, settleLoadedStop } from './loaded-run-exits.js';
|
|
51
52
|
import { hasLegacyWaitFields, upgradeLegacyWaits, UNREADABLE_WAIT } from './legacy-waits.js';
|
|
@@ -312,19 +313,7 @@ export const LOAD_REPAIR_SQL = `live = 1 OR ${LEGACY_REFERENCE_HEAL_SQL}`;
|
|
|
312
313
|
*/
|
|
313
314
|
const AUTOMATION_ORIGIN_HEAL_SQL = "instr(data, '\"automation') > 0 AND json_extract(summary, '$.automationId') IS NULL" +
|
|
314
315
|
" AND (json_extract(data, '$.automation.automationId') IS NOT NULL OR json_extract(data, '$.automationTrigger.automationId') IS NOT NULL)";
|
|
315
|
-
|
|
316
|
-
* projection `listBranchOwners` reads off a row's summary and columns, computed from memory. */
|
|
317
|
-
export function branchOwnerOf(run) {
|
|
318
|
-
const branch = encodeRunRow(run).branch;
|
|
319
|
-
if (!branch && run.pullRequestUrl === undefined)
|
|
320
|
-
return undefined;
|
|
321
|
-
return {
|
|
322
|
-
id: run.id, title: run.title, status: run.status, archived: run.archived, createdAt: run.createdAt,
|
|
323
|
-
...(branch ? { branch } : {}),
|
|
324
|
-
...(run.baseBranch === undefined ? {} : { baseBranch: run.baseBranch }),
|
|
325
|
-
...(run.pullRequestUrl === undefined ? {} : { pullRequestUrl: run.pullRequestUrl }),
|
|
326
|
-
};
|
|
327
|
-
}
|
|
316
|
+
export { branchOwnerOf } from './branch-owners.js';
|
|
328
317
|
/** The one answer every control gives for a run another Squawk process owns (`409 { error }`). */
|
|
329
318
|
export const RUN_IN_USE_ELSEWHERE = `run is in use by another ${productName('cezar')} process`;
|
|
330
319
|
/** The answer for a run this process stopped writing after a conflicting write. */
|
|
@@ -1434,25 +1423,9 @@ export class RunStore extends EventEmitter {
|
|
|
1434
1423
|
* no record. Held runs answer from memory.
|
|
1435
1424
|
*/
|
|
1436
1425
|
listBranchOwners() {
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
continue;
|
|
1441
|
-
const summary = parseStoredSummary(row.summary);
|
|
1442
|
-
owners.set(row.id, {
|
|
1443
|
-
id: row.id, createdAt: row.createdAt, status: row.status, archived: row.archived,
|
|
1444
|
-
...(row.branch === null ? {} : { branch: row.branch }),
|
|
1445
|
-
...(row.baseBranch === null ? {} : { baseBranch: row.baseBranch }),
|
|
1446
|
-
title: summary?.title ?? row.id,
|
|
1447
|
-
...(summary?.pullRequestUrl === undefined ? {} : { pullRequestUrl: summary.pullRequestUrl }),
|
|
1448
|
-
});
|
|
1449
|
-
}
|
|
1450
|
-
for (const run of this.held.values()) {
|
|
1451
|
-
const owner = branchOwnerOf(run);
|
|
1452
|
-
if (owner)
|
|
1453
|
-
owners.set(run.id, owner);
|
|
1454
|
-
}
|
|
1455
|
-
return [...owners.values()];
|
|
1426
|
+
const rows = (this.db?.listBranchOwners("branch IS NOT NULL OR json_extract(summary, '$.pullRequestUrl') IS NOT NULL") ?? [])
|
|
1427
|
+
.filter((row) => !this.deleted.has(row.id) && !this.held.has(row.id));
|
|
1428
|
+
return listBranchOwners(rows, [...this.held.values()], (id) => this.getRun(id));
|
|
1456
1429
|
}
|
|
1457
1430
|
/** The rows a column query returned, as records, with memory laid over them: a held run
|
|
1458
1431
|
* answers from memory (matching `matches` there, not on its maybe-older row). */
|
|
@@ -3214,8 +3187,8 @@ export class RunStore extends EventEmitter {
|
|
|
3214
3187
|
}
|
|
3215
3188
|
/**
|
|
3216
3189
|
* Count-based history retention: of the runs past the newest `MAX_RUNS_KEPT` unarchived ones,
|
|
3217
|
-
* archive each
|
|
3218
|
-
*
|
|
3190
|
+
* archive each settled task that is not pinned and whose family this store can claim, together
|
|
3191
|
+
* with its workers, once no member of the family is live (hearsay-tools/squawk#777). Ranked over the row keys (the `created_at` index, no record decoded) with memory
|
|
3219
3192
|
* laid over them, since a run created or archived since the last save has no row yet; the rows
|
|
3220
3193
|
* past the cut are then filtered in `runs.db`, so only real candidates decode. Archived runs
|
|
3221
3194
|
* are never deleted by retention — only an explicit delete, worker destruction, or history
|
|
@@ -3235,8 +3208,7 @@ export class RunStore extends EventEmitter {
|
|
|
3235
3208
|
return;
|
|
3236
3209
|
const stale = overflow.flatMap((id) => {
|
|
3237
3210
|
const run = this.held.get(id);
|
|
3238
|
-
// Retention must not archive a live task between turns, a pinned run, or a
|
|
3239
|
-
// family whose history is promised until explicit deletion.
|
|
3211
|
+
// Retention must not archive a live task between turns, a pinned run, or a worker on its own.
|
|
3240
3212
|
return run && !this.hasFallbackRun(id) && RETENTION_RUN_RULE.matches(run) ? [id] : [];
|
|
3241
3213
|
});
|
|
3242
3214
|
const skipped = overflow.filter(id => this.hasFallbackRun(id)).length;
|
|
@@ -3255,8 +3227,20 @@ export class RunStore extends EventEmitter {
|
|
|
3255
3227
|
const run = this.record(id);
|
|
3256
3228
|
if (!run || run.archived || !RETENTION_RUN_RULE.matches(run))
|
|
3257
3229
|
continue;
|
|
3258
|
-
this.
|
|
3259
|
-
|
|
3230
|
+
this.archiveSettledFamily(run);
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
/** Archive a root with its workers unless a member is live, mid-destroy or pinned, or a history
|
|
3234
|
+
* deletion is under way. Each member is marked dirty: the next save writes the family at once. */
|
|
3235
|
+
archiveSettledFamily(root) {
|
|
3236
|
+
const workers = this.listWorkersOf(root.id), family = [root, ...workers];
|
|
3237
|
+
if (family.some((run) => isLiveRecord(run) || run.pinned) || (root.delegation?.role === 'root' && root.delegation.historyDeletion))
|
|
3238
|
+
return;
|
|
3239
|
+
for (const member of [root, ...workers.flatMap((worker) => this.record(worker.id) ?? [])]) {
|
|
3240
|
+
if (member.archived)
|
|
3241
|
+
continue;
|
|
3242
|
+
this.applyArchived(member, true);
|
|
3243
|
+
removeAgentTmpDir(this.dataDir, member.id);
|
|
3260
3244
|
}
|
|
3261
3245
|
}
|
|
3262
3246
|
/** Debounced so token-usage updates don't rewrite a row per event. Nothing to schedule without
|