@hearsay-tools/squawk 0.18.0-dev.7956 → 0.18.0-dev.7961
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/runs/transcript-facts-queue.d.ts +5 -1
- package/dist/runs/transcript-facts-queue.js +48 -9
- package/dist/runs/transcript-facts-queue.js.map +1 -1
- package/dist/server/bounded-read-cache.d.ts +10 -0
- package/dist/server/bounded-read-cache.js +54 -0
- package/dist/server/bounded-read-cache.js.map +1 -0
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/repo-branch-forge.js +38 -10
- package/dist/server/repo-branch-forge.js.map +1 -1
- package/dist/server/repo-branches.js +28 -17
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/repo-read-cache.d.ts +22 -0
- package/dist/server/repo-read-cache.js +51 -0
- package/dist/server/repo-read-cache.js.map +1 -0
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/server.d.ts +1551 -1551
- package/dist/server/server.js +26 -23
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/server/worktree-size-cache.d.ts +3 -0
- package/dist/server/worktree-size-cache.js +8 -0
- package/dist/server/worktree-size-cache.js.map +1 -0
- package/package.json +4 -4
package/dist/server/server.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { memoizeRead } from './bounded-read-cache.js';
|
|
2
|
+
import { cachedWorktreeSizeBytes } from './worktree-size-cache.js';
|
|
3
|
+
import { readRepoRefs, forgetRepoRead } from './repo-read-cache.js';
|
|
1
4
|
import { allocateAgentProfileId } from './agent-profile-id.js';
|
|
2
5
|
import { runnerSkillsQuerySchema } from '../contract/index.js';
|
|
3
6
|
import { readRunnerSkills } from './runner-skills.js';
|
|
@@ -112,14 +115,14 @@ import { listArtifacts, readArtifact, readArtifactMetadata } from '../artifacts/
|
|
|
112
115
|
import { artifactPreview, loadFileLink, rasterMime } from '../artifacts/resolve.js';
|
|
113
116
|
import { toPastedContent } from '../workflows/pasted-content.js';
|
|
114
117
|
import { isUntouchedCancelledRun } from '../workflows/run/run-guards.js';
|
|
115
|
-
import { worktreeDiff
|
|
118
|
+
import { worktreeDiff } from '../git-worktree.js';
|
|
116
119
|
import { releaseThenRemoveWorktree } from '../git-worktree-release.js';
|
|
117
120
|
import { isReclaimable, reclaimWorktree, reclaimWorktrees, selectReclaimableWorktrees } from '../runs/retention.js';
|
|
118
|
-
import {
|
|
121
|
+
import { getCommit, getDiff, getRepoInfo, getStatus } from './git.js';
|
|
119
122
|
import { createHealthCache, HEALTH_TTL_MS } from './health-cache.js';
|
|
120
123
|
import { createBackendChecks } from './backend-checks.js';
|
|
121
124
|
import { createGithubBranchForge } from './repo-branch-forge.js';
|
|
122
|
-
import {
|
|
125
|
+
import { classifyInputFor, deleteBranches, forgetRepoBranches, readRepoBranchCounts, readRepoBranches } from './repo-branches.js';
|
|
123
126
|
import { claimRepoGitMutation, localPullBranches, pullRepoCheckout } from './repo-pull.js';
|
|
124
127
|
import { collectChanges, collectCommitChanges, collectRunCommits, commitAll, createOrSwitchBranch, pushCurrentBranch, readWorktreePath, } from './git-changes.js';
|
|
125
128
|
import { healthConfig, loadConfig, resolveWorktreeRetention } from '../config.js';
|
|
@@ -3240,16 +3243,18 @@ export function createApp(deps) {
|
|
|
3240
3243
|
// so a live `worktree: false` parent is not treated as gone (#570 honesty).
|
|
3241
3244
|
const runs = withWorktree.filter((r) => r.worktreePath && existsSync(r.worktreePath));
|
|
3242
3245
|
// The rows the enforcer would reclaim right now: reclaimable AND past the newest `keep`.
|
|
3243
|
-
const
|
|
3246
|
+
const getRun = memoizeRead((id) => store.getRun(id));
|
|
3247
|
+
const workersOf = memoizeRead((id) => store.queries.listWorkersOf(id));
|
|
3248
|
+
const pastKeep = new Set(selectReclaimableWorktrees(withWorktree, keep, getRun, workersOf));
|
|
3244
3249
|
const worktrees = await Promise.all(runs.map(async (r) => ({
|
|
3245
3250
|
runId: r.id,
|
|
3246
3251
|
title: r.title ?? r.id,
|
|
3247
3252
|
status: r.status,
|
|
3248
3253
|
branch: r.branch ?? null,
|
|
3249
3254
|
// POSIX `du` — degrades to null (Windows / du missing / error); never blocks.
|
|
3250
|
-
sizeBytes: await
|
|
3255
|
+
sizeBytes: await cachedWorktreeSizeBytes(r.worktreePath),
|
|
3251
3256
|
finishedAt: r.finishedAt ?? null,
|
|
3252
|
-
reclaimable: isReclaimable(r,
|
|
3257
|
+
reclaimable: isReclaimable(r, getRun, workersOf),
|
|
3253
3258
|
pastKeep: pastKeep.has(r.id),
|
|
3254
3259
|
})));
|
|
3255
3260
|
// Total is null when any size degraded, so the panel never shows a wrong sum.
|
|
@@ -3267,8 +3272,10 @@ export function createApp(deps) {
|
|
|
3267
3272
|
claim: (run) => manager.claimWorktreeReclaim(run.id),
|
|
3268
3273
|
previewHost: deps.previewHost,
|
|
3269
3274
|
});
|
|
3270
|
-
if (reclaimed.length > 0)
|
|
3275
|
+
if (reclaimed.length > 0) {
|
|
3271
3276
|
forgetRepoBranches(repoRoot);
|
|
3277
|
+
forgetRepoRead(repoRoot);
|
|
3278
|
+
}
|
|
3272
3279
|
return c.json({ reclaimed });
|
|
3273
3280
|
})
|
|
3274
3281
|
// One row's reclaim (issue 08 §B4): the DIRECTORY only, by retention's own rule and helper —
|
|
@@ -3288,6 +3295,7 @@ export function createApp(deps) {
|
|
|
3288
3295
|
return c.json({ error: await reclaimCheckoutError(run) }, 409);
|
|
3289
3296
|
}
|
|
3290
3297
|
forgetRepoBranches(repoRoot);
|
|
3298
|
+
forgetRepoRead(repoRoot);
|
|
3291
3299
|
return c.json({ runId: run.id, worktreeReclaimedAt });
|
|
3292
3300
|
});
|
|
3293
3301
|
// ---- chained family: SSE streams (project-scoped) ----
|
|
@@ -3591,7 +3599,7 @@ export function createApp(deps) {
|
|
|
3591
3599
|
// ---- chained family: repo / git (project-scoped) ----
|
|
3592
3600
|
const repoRoutes = new Hono()
|
|
3593
3601
|
.get('/repo', async (c) => {
|
|
3594
|
-
const { root: repoRoot } = c.get('project');
|
|
3602
|
+
const { root: repoRoot, store } = c.get('project');
|
|
3595
3603
|
const info = await getRepoInfo(repoRoot);
|
|
3596
3604
|
if (!info)
|
|
3597
3605
|
return c.json({
|
|
@@ -3602,28 +3610,20 @@ export function createApp(deps) {
|
|
|
3602
3610
|
baseBranch: null,
|
|
3603
3611
|
tracking: null,
|
|
3604
3612
|
});
|
|
3605
|
-
|
|
3613
|
+
// Status stays fresh for edits made outside Squawk; only ref-derived reads are cached.
|
|
3614
|
+
const [status, config] = await Promise.all([
|
|
3606
3615
|
getStatus(info.root),
|
|
3607
|
-
getLogWithParents(info.root),
|
|
3608
|
-
getBranches(info.root),
|
|
3609
3616
|
loadConfig(repoRoot, deps.home),
|
|
3610
3617
|
]);
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
attributeLog(info.root, rawLog, c.get('project').store.queries.listBranchOwners()),
|
|
3614
|
-
]);
|
|
3615
|
-
// `source` is spread conditionally: absent, never `null`, when no task is known.
|
|
3616
|
-
const log = rawLog.map(({ parents: _parents, ...entry }, i) => {
|
|
3617
|
-
const source = sources[i];
|
|
3618
|
-
return source ? { ...entry, source } : entry;
|
|
3619
|
-
});
|
|
3618
|
+
// The helper validates refs and branch-owner evidence before reusing log attribution.
|
|
3619
|
+
const refs = await readRepoRefs(info, config.baseBranch, store.queries);
|
|
3620
3620
|
return c.json({
|
|
3621
3621
|
info,
|
|
3622
3622
|
status,
|
|
3623
|
-
log,
|
|
3624
|
-
branches,
|
|
3623
|
+
log: refs.log,
|
|
3624
|
+
branches: refs.branches,
|
|
3625
3625
|
baseBranch: config.baseBranch ?? null,
|
|
3626
|
-
tracking,
|
|
3626
|
+
tracking: refs.tracking,
|
|
3627
3627
|
});
|
|
3628
3628
|
})
|
|
3629
3629
|
// Every local branch, classified (issue 08 §A/§B2) — cached on the refs state, so the
|
|
@@ -3657,6 +3657,7 @@ export function createApp(deps) {
|
|
|
3657
3657
|
if (!release)
|
|
3658
3658
|
return c.json({ error: 'a branch switch or pull is running — try again when it finishes', refused: [] }, 409);
|
|
3659
3659
|
const result = await deleteBranches(input, body.names, body.confirm).finally(release);
|
|
3660
|
+
forgetRepoRead(input.root);
|
|
3660
3661
|
if (result.deleted.length === 0) {
|
|
3661
3662
|
return c.json({ error: result.refused[0]?.reason ?? 'nothing was deleted', refused: result.refused }, 409);
|
|
3662
3663
|
}
|
|
@@ -3737,6 +3738,7 @@ export function createApp(deps) {
|
|
|
3737
3738
|
// Every id, not the live set: the manager may still hold a run whose record already
|
|
3738
3739
|
// settled (a worker's execution winding down). Ids only, nothing decoded.
|
|
3739
3740
|
() => store.queries.listRunIds().some((id) => manager.isActive(id)));
|
|
3741
|
+
forgetRepoRead(info.root);
|
|
3740
3742
|
if (!result.ok)
|
|
3741
3743
|
return c.json(result.value, 409);
|
|
3742
3744
|
return c.json(result.value, 200);
|
|
@@ -3753,6 +3755,7 @@ export function createApp(deps) {
|
|
|
3753
3755
|
const input = c.req.valid('json');
|
|
3754
3756
|
const result = await createOrSwitchBranch(info.root, input.name, input.from);
|
|
3755
3757
|
forgetRepoBranches(info.root);
|
|
3758
|
+
forgetRepoRead(info.root);
|
|
3756
3759
|
if (!result.ok)
|
|
3757
3760
|
return c.json({ error: result.error }, 409);
|
|
3758
3761
|
return c.json({ branch: result.branch, created: result.created });
|