@hearsay-tools/squawk 0.18.0-dev.6636 → 0.18.0-dev.6683

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.
Files changed (123) hide show
  1. package/dist/ci-wait/tool-catalog.js +1 -1
  2. package/dist/ci-wait/tool-catalog.js.map +1 -1
  3. package/dist/contract/attention.d.ts +8 -0
  4. package/dist/contract/index.js +14 -0
  5. package/dist/contract/runs.d.ts +15 -0
  6. package/dist/delegation/conversations.d.ts +4 -2
  7. package/dist/delegation/park-notice.d.ts +5 -1
  8. package/dist/delegation/park-notice.js +7 -0
  9. package/dist/delegation/park-notice.js.map +1 -1
  10. package/dist/delegation/routes.d.ts +4 -4
  11. package/dist/delegation/scratch-cleanup.js +6 -3
  12. package/dist/delegation/scratch-cleanup.js.map +1 -1
  13. package/dist/delegation/transport.d.ts +16 -16
  14. package/dist/home/command.js +1 -1
  15. package/dist/home/command.js.map +1 -1
  16. package/dist/jobs/cli.js +4 -2
  17. package/dist/jobs/cli.js.map +1 -1
  18. package/dist/jobs/job.d.ts +7 -0
  19. package/dist/jobs/job.js +32 -3
  20. package/dist/jobs/job.js.map +1 -1
  21. package/dist/runs/agent-tmpdir.d.ts +3 -2
  22. package/dist/runs/agent-tmpdir.js +11 -4
  23. package/dist/runs/agent-tmpdir.js.map +1 -1
  24. package/dist/runs/automation-runs.js +4 -3
  25. package/dist/runs/automation-runs.js.map +1 -1
  26. package/dist/runs/conversation-members.js +3 -2
  27. package/dist/runs/conversation-members.js.map +1 -1
  28. package/dist/runs/guarded-json-sql.d.ts +8 -0
  29. package/dist/runs/guarded-json-sql.js +11 -0
  30. package/dist/runs/guarded-json-sql.js.map +1 -0
  31. package/dist/runs/run-database-peer-page.js +3 -4
  32. package/dist/runs/run-database-peer-page.js.map +1 -1
  33. package/dist/runs/run-database-version.d.ts +1 -1
  34. package/dist/runs/run-database-version.js +2 -1
  35. package/dist/runs/run-database-version.js.map +1 -1
  36. package/dist/runs/run-database.js +5 -4
  37. package/dist/runs/run-database.js.map +1 -1
  38. package/dist/runs/run-exits.d.ts +15 -6
  39. package/dist/runs/run-exits.js +13 -4
  40. package/dist/runs/run-exits.js.map +1 -1
  41. package/dist/runs/run-index.js +1 -2
  42. package/dist/runs/run-index.js.map +1 -1
  43. package/dist/runs/store.d.ts +11 -5
  44. package/dist/runs/store.js +21 -20
  45. package/dist/runs/store.js.map +1 -1
  46. package/dist/serve-boot.d.ts +1 -2
  47. package/dist/serve-command.js +25 -15
  48. package/dist/serve-command.js.map +1 -1
  49. package/dist/serve-stop.d.ts +41 -0
  50. package/dist/serve-stop.js +42 -0
  51. package/dist/serve-stop.js.map +1 -0
  52. package/dist/server/checkout.d.ts +1 -1
  53. package/dist/server/health-cache.d.ts +39 -0
  54. package/dist/server/health-cache.js +66 -0
  55. package/dist/server/health-cache.js.map +1 -0
  56. package/dist/server/server.d.ts +1825 -1807
  57. package/dist/server/server.js +17 -63
  58. package/dist/server/server.js.map +1 -1
  59. package/dist/server-install/platforms/macosx-migration.js +1 -1
  60. package/dist/server-install/platforms/macosx-migration.js.map +1 -1
  61. package/dist/server-install/platforms/ubuntu-vps-migration.js +1 -1
  62. package/dist/server-install/platforms/ubuntu-vps-migration.js.map +1 -1
  63. package/dist/workflows/continuation-admission.d.ts +2 -1
  64. package/dist/workflows/run/prompts.js +1 -1
  65. package/dist/workflows/run/prompts.js.map +1 -1
  66. package/dist/workflows/run/run-settlement.d.ts +10 -0
  67. package/dist/workflows/run/run-settlement.js +39 -5
  68. package/dist/workflows/run/run-settlement.js.map +1 -1
  69. package/dist/workflows/run/step-loop.js +1 -1
  70. package/dist/workflows/run/step-loop.js.map +1 -1
  71. package/dist/workflows/run/wait-engine.d.ts +2 -1
  72. package/dist/workflows/run/worker-questions.d.ts +3 -2
  73. package/dist/workflows/run/worker-questions.js +6 -5
  74. package/dist/workflows/run/worker-questions.js.map +1 -1
  75. package/dist/workflows/run-states.js +1 -1
  76. package/dist/workflows/run-states.js.map +1 -1
  77. package/package.json +4 -4
  78. package/scripts/measure-transcript-facts-health.mjs +13 -6
  79. package/web/dist/assets/activity-motion-DhLXb8Pt.js +2 -0
  80. package/web/dist/assets/{activity-route--Qj4NT9h.js → activity-route-CpwAMYLn.js} +1 -1
  81. package/web/dist/assets/{agent-accounts-BxpWcFS3.js → agent-accounts-Bc0LJ4SB.js} +1 -1
  82. package/web/dist/assets/attention-BF8NA1XM.js +1 -0
  83. package/web/dist/assets/{commit-diff-panel-DOgakNKv.js → commit-diff-panel-B1KZl0GP.js} +1 -1
  84. package/web/dist/assets/{diff-MoyKcT8Q.js → diff-Ci-qd1lU.js} +2 -2
  85. package/web/dist/assets/{diff-view-BFQcOCEf.js → diff-view-CWZElKoD.js} +1 -1
  86. package/web/dist/assets/{file-preview-BancpZHA.js → file-preview-CoWRr13R.js} +1 -1
  87. package/web/dist/assets/{git-toolbar-ClMasBRM.js → git-toolbar-BYIni94R.js} +1 -1
  88. package/web/dist/assets/{github-BVZ01nJq.js → github-CAPNq5vY.js} +1 -1
  89. package/web/dist/assets/{global-activity-route-DTgywy--.js → global-activity-route-DLEwsMA7.js} +1 -1
  90. package/web/dist/assets/index-CpwAOct4.js +17 -0
  91. package/web/dist/assets/{preview-pane-connected-B5PCWA9a.js → preview-pane-connected-CGw_9VuF.js} +2 -2
  92. package/web/dist/assets/{project-router-CiB1O_5A.js → project-router-oKsNlPN6.js} +1 -1
  93. package/web/dist/assets/{project-scope-context-CSPQyWoO.js → project-scope-context-BBVJVcJp.js} +1 -1
  94. package/web/dist/assets/{prompt-template-menu-VwBcsbqE.js → prompt-template-menu-BZTz2mIG.js} +1 -1
  95. package/web/dist/assets/queries-Be8VyHam.js +1 -0
  96. package/web/dist/assets/{reference-chip-DT-_ninM.js → reference-chip-Ht4xX9-k.js} +1 -1
  97. package/web/dist/assets/{repo-git-7KuJaDRk.js → repo-git-CzVLCWig.js} +1 -1
  98. package/web/dist/assets/{report-reader-CgY75QM2.js → report-reader-iTBkUgg-.js} +1 -1
  99. package/web/dist/assets/reports-BJF1Cl3C.js +1 -0
  100. package/web/dist/assets/run-header-BxB6gyt1.js +2 -0
  101. package/web/dist/assets/{skills-Dnrta_-m.js → skills-DvgHKWgK.js} +1 -1
  102. package/web/dist/assets/{tab-link-BPBiho7-.js → tab-link-Buy1fRFO.js} +1 -1
  103. package/web/dist/assets/{task-changes-C6sDd3Le.js → task-changes-CStxhLFG.js} +1 -1
  104. package/web/dist/assets/{task-commits-CQHxnFJ5.js → task-commits-DhpOAdOf.js} +1 -1
  105. package/web/dist/assets/{task-files-DK8Demuc.js → task-files-COmKUUfN.js} +1 -1
  106. package/web/dist/assets/{task-github-item-DgmmFFtN.js → task-github-item-BNLeAz58.js} +1 -1
  107. package/web/dist/assets/{task-thread-Dg9VWJq6.js → task-thread-DjSFvEQe.js} +6 -6
  108. package/web/dist/assets/{thread-state-DIMUAyFk.js → thread-state-B5tTsVNm.js} +1 -1
  109. package/web/dist/assets/use-desktop-BPWIJ0Kw.js +1 -0
  110. package/web/dist/assets/{use-hand-to-agent-state-D-yaVRRx.js → use-hand-to-agent-state-Ce6QW2j_.js} +1 -1
  111. package/web/dist/assets/{useInfiniteQuery-Q8eFXz-L.js → useInfiniteQuery-Yn58_Fkn.js} +1 -1
  112. package/web/dist/assets/useQuery-C1xFF0nd.js +1 -0
  113. package/web/dist/assets/{workflows-W_uriBcj.js → workflows-CN8uKYnY.js} +1 -1
  114. package/web/dist/assets/{ws-B-tB133E.js → ws-DbXGHAke.js} +1 -1
  115. package/web/dist/index.html +12 -12
  116. package/web/dist/assets/activity-motion-CEnf2rDh.js +0 -2
  117. package/web/dist/assets/attention-BDa7opY9.js +0 -1
  118. package/web/dist/assets/index-CsOa03VW.js +0 -17
  119. package/web/dist/assets/queries-pj368bmB.js +0 -1
  120. package/web/dist/assets/reports-CxTUchWh.js +0 -1
  121. package/web/dist/assets/run-header-BcX23gw7.js +0 -2
  122. package/web/dist/assets/use-desktop-Bq_Qh5ur.js +0 -1
  123. package/web/dist/assets/useQuery-BoLjCS2U.js +0 -1
@@ -110,6 +110,7 @@ import { worktreeDiff, worktreeSizeBytes } from '../git-worktree.js';
110
110
  import { releaseThenRemoveWorktree } from '../git-worktree-release.js';
111
111
  import { isReclaimable, reclaimWorktree, reclaimWorktrees, selectReclaimableWorktrees } from '../runs/retention.js';
112
112
  import { getBranches, getCommit, getDiff, getLogWithParents, getRepoInfo, getStatus, getTracking } from './git.js';
113
+ import { createHealthCache, HEALTH_TTL_MS } from './health-cache.js';
113
114
  import { createGithubBranchForge } from './repo-branch-forge.js';
114
115
  import { attributeLog, classifyInputFor, deleteBranches, forgetRepoBranches, readRepoBranchCounts, readRepoBranches } from './repo-branches.js';
115
116
  import { claimRepoGitMutation, localPullBranches, pullRepoCheckout } from './repo-pull.js';
@@ -678,11 +679,9 @@ export function createApp(deps) {
678
679
  .then((changed) => {
679
680
  if (!changed)
680
681
  return;
681
- // Probe is settled; finish any cold snapshot, then refresh both transports separately.
682
- void (async () => {
683
- await healthInFlight?.catch(() => { });
684
- await refreshHealth();
685
- })().catch(() => { });
682
+ // Probe is settled; publish the new checks to both transports. Only availability changed:
683
+ // re-reading Git would spawn processes on this loop (hearsay-tools/squawk#3355).
684
+ void healthCache.patch((payload) => ({ ...payload, checks: backendChecks })).catch(() => { });
686
685
  });
687
686
  }
688
687
  return backendChecks;
@@ -730,69 +729,24 @@ export function createApp(deps) {
730
729
  bootProject: workspace.bootProject,
731
730
  };
732
731
  };
733
- // ---- server-side health cache (stale-while-revalidate) -------------------
734
- // The snapshot still reads git and workspace state. Agent-CLI availability
735
- // probes have their own nonblocking cache above. Paying that on the browser's FIRST `GET /api/health` is
736
- // exactly the few-seconds-blank the cockpit showed at load. So on the live
737
- // server the snapshot is computed at the server's OWN pace: both the GET and
738
- // the WS `health` topic serve the cached value immediately and revalidate
739
- // behind the response, and the cache is pre-warmed at boot so that first
740
- // request lands on a warm value instead of the cold compute.
741
- const HEALTH_TTL_MS = 5_000;
742
- // The staleness CEILING, which is a different job from the TTL above. The TTL
743
- // decides how often a revalidation is kicked off; on its own it bounds nothing,
744
- // because the revalidation is fire-and-forget. While a cockpit holds the
745
- // `health` topic the publisher's interval keeps the cache warm and the two are
746
- // the same number — but the normal state of a background `hsq serve` is NO
747
- // subscriber, and then nothing refreshes the cache at all: the next `GET
748
- // /api/health`, an hour later, would answer with the boot pre-warm's payload
749
- // and only the request AFTER it would see the truth. `repo.branch` going stale there is
750
- // literally #369, so past this age correctness beats the latency win and the
751
- // read waits for the compute. `refreshHealth` dedupes, so waiting costs one.
752
- const HEALTH_MAX_STALE_MS = 60_000;
753
- let healthCache;
754
- let healthInFlight;
755
- // Set while the topic has a subscriber; a change a refresh detects is pushed
756
- // here (a noop when nobody is listening).
732
+ // Stale-while-revalidate cache over the snapshot; see health-cache.ts.
733
+ // Set while the topic has a subscriber (a noop when nobody is listening).
757
734
  let publishHealth = () => { };
758
- const refreshHealth = () => {
759
- // Dedupe: a GET's background revalidation and the topic's interval tick
760
- // share ONE repository/workspace compute rather than racing two.
761
- if (healthInFlight)
762
- return healthInFlight;
763
- healthInFlight = (async () => {
764
- try {
765
- const payload = await healthSnapshot();
766
- const body = JSON.stringify(payload);
767
- const changed = body !== healthCache?.body;
768
- healthCache = { at: Date.now(), payload, body };
769
- if (changed) {
770
- publishHealth(payload);
771
- workspaceEvents.emit('health', payload);
772
- } // only a real change reaches either transport
773
- return payload;
774
- }
775
- finally {
776
- healthInFlight = undefined;
777
- }
778
- })();
779
- return healthInFlight;
780
- };
735
+ const healthCache = createHealthCache({
736
+ snapshot: healthSnapshot,
737
+ publish: (payload) => {
738
+ publishHealth(payload);
739
+ workspaceEvents.emit('health', payload);
740
+ },
741
+ });
742
+ const refreshHealth = () => healthCache.refresh();
781
743
  // The read the GET and the topic snapshot share. On the live server (a hub is
782
- // injected) it answers from cache instantly and revalidates behind the
783
- // response; without a hub — a bare app in tests — there is no refresher
784
- // keeping a cache coherent, so it computes fresh, exactly as before.
744
+ // injected) it answers from cache; without a hub — a bare app in tests — there is
745
+ // no refresher keeping a cache coherent, so it computes fresh, exactly as before.
785
746
  const readHealth = async () => {
786
747
  if (!deps.socketHub)
787
748
  return healthSnapshot();
788
- if (!healthCache)
789
- return refreshHealth(); // first ever: nothing to serve yet
790
- const age = Date.now() - healthCache.at;
791
- if (age > HEALTH_MAX_STALE_MS)
792
- return refreshHealth(); // too old to serve — wait for the truth
793
- if (age > HEALTH_TTL_MS)
794
- void refreshHealth(); // stale: refresh, don't wait on it
795
- return { ...healthCache.payload, capabilities: capabilities() }; // per request, like the gates (ADR 0055)
749
+ return healthCache.read((payload) => ({ ...payload, capabilities: capabilities() })); // per request, like the gates (ADR 0055)
796
750
  };
797
751
  // ---- chained family: health (workspace-level) ----------------------------
798
752
  // Written as ONE chained expression rather than a loose `app.get(...)`