@hearsay-tools/squawk 0.18.0-dev.7808 → 0.18.0-dev.7816

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 (136) hide show
  1. package/dist/activity/tool-activity.d.ts +3 -2
  2. package/dist/activity/tool-activity.js +1 -1
  3. package/dist/activity/tool-activity.js.map +1 -1
  4. package/dist/ci-wait/controller.d.ts +42 -42
  5. package/dist/delegation/conversation-send.js +1 -1
  6. package/dist/delegation/conversation-send.js.map +1 -1
  7. package/dist/delegation/conversations.js +4 -4
  8. package/dist/delegation/conversations.js.map +1 -1
  9. package/dist/delegation/park-notice.d.ts +3 -1
  10. package/dist/delegation/park-notice.js +2 -2
  11. package/dist/delegation/park-notice.js.map +1 -1
  12. package/dist/delegation/provision.js +1 -1
  13. package/dist/delegation/provision.js.map +1 -1
  14. package/dist/delegation/results.js +1 -1
  15. package/dist/delegation/results.js.map +1 -1
  16. package/dist/delegation/service.js +5 -5
  17. package/dist/delegation/service.js.map +1 -1
  18. package/dist/delegation/transport.d.ts +65 -65
  19. package/dist/delegation/worker-cleanup.js +2 -2
  20. package/dist/delegation/worker-cleanup.js.map +1 -1
  21. package/dist/preview/agent-marker.js +1 -1
  22. package/dist/preview/agent-marker.js.map +1 -1
  23. package/dist/preview/host.d.ts +3 -1
  24. package/dist/preview/host.js +1 -1
  25. package/dist/preview/host.js.map +1 -1
  26. package/dist/preview/run-tools.js +1 -1
  27. package/dist/preview/run-tools.js.map +1 -1
  28. package/dist/runs/event-log.d.ts +79 -0
  29. package/dist/runs/event-log.js +188 -0
  30. package/dist/runs/event-log.js.map +1 -0
  31. package/dist/runs/ports.d.ts +68 -19
  32. package/dist/runs/run-archive.d.ts +1217 -0
  33. package/dist/runs/run-archive.js +332 -0
  34. package/dist/runs/run-archive.js.map +1 -0
  35. package/dist/runs/run-read-flags.d.ts +58 -0
  36. package/dist/runs/run-read-flags.js +87 -0
  37. package/dist/runs/run-read-flags.js.map +1 -0
  38. package/dist/runs/run-redaction.d.ts +19 -0
  39. package/dist/runs/run-redaction.js +36 -0
  40. package/dist/runs/run-redaction.js.map +1 -0
  41. package/dist/runs/store.d.ts +15 -164
  42. package/dist/runs/store.js +70 -613
  43. package/dist/runs/store.js.map +1 -1
  44. package/dist/runs/transcript-facts-fold.d.ts +1 -1
  45. package/dist/runs/transcript-facts-fold.js +1 -1
  46. package/dist/runs/transcript-facts-fold.js.map +1 -1
  47. package/dist/runs/webhook.d.ts +3 -1
  48. package/dist/runs/webhook.js +3 -3
  49. package/dist/runs/webhook.js.map +1 -1
  50. package/dist/serve-boot.js +1 -1
  51. package/dist/serve-boot.js.map +1 -1
  52. package/dist/server/activity-routes.d.ts +23 -23
  53. package/dist/server/archive-on-merge.js +10 -10
  54. package/dist/server/archive-on-merge.js.map +1 -1
  55. package/dist/server/completion-actions.js +6 -6
  56. package/dist/server/completion-actions.js.map +1 -1
  57. package/dist/server/models-routes.d.ts +13 -13
  58. package/dist/server/project-context.d.ts +3 -1
  59. package/dist/server/project-context.js +2 -2
  60. package/dist/server/project-context.js.map +1 -1
  61. package/dist/server/provider-auth-runtime.js +2 -2
  62. package/dist/server/provider-auth-runtime.js.map +1 -1
  63. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  64. package/dist/server/reports-api.d.ts +2 -2
  65. package/dist/server/runner-install-routes.d.ts +10 -10
  66. package/dist/server/runners-routes.d.ts +10 -10
  67. package/dist/server/server.d.ts +3760 -3760
  68. package/dist/server/server.js +8 -8
  69. package/dist/server/server.js.map +1 -1
  70. package/dist/workflows/run/attachment-writer.js +1 -1
  71. package/dist/workflows/run/attachment-writer.js.map +1 -1
  72. package/dist/workflows/run/auto-resume.js +4 -4
  73. package/dist/workflows/run/auto-resume.js.map +1 -1
  74. package/dist/workflows/run/continuation-acceptance.js +1 -1
  75. package/dist/workflows/run/continuation-acceptance.js.map +1 -1
  76. package/dist/workflows/run/continuation-session.js +9 -9
  77. package/dist/workflows/run/continuation-session.js.map +1 -1
  78. package/dist/workflows/run/cut-off-work.d.ts +8 -6
  79. package/dist/workflows/run/cut-off-work.js +2 -2
  80. package/dist/workflows/run/cut-off-work.js.map +1 -1
  81. package/dist/workflows/run/family-reconciler.js +1 -1
  82. package/dist/workflows/run/family-reconciler.js.map +1 -1
  83. package/dist/workflows/run/human-waits.js +4 -4
  84. package/dist/workflows/run/human-waits.js.map +1 -1
  85. package/dist/workflows/run/input-delivery.js +11 -11
  86. package/dist/workflows/run/input-delivery.js.map +1 -1
  87. package/dist/workflows/run/input-receipts.js +3 -3
  88. package/dist/workflows/run/input-receipts.js.map +1 -1
  89. package/dist/workflows/run/launch-context.js +1 -1
  90. package/dist/workflows/run/launch-context.js.map +1 -1
  91. package/dist/workflows/run/launch-read-resolver.d.ts +3 -1
  92. package/dist/workflows/run/launch-read-resolver.js +5 -5
  93. package/dist/workflows/run/launch-read-resolver.js.map +1 -1
  94. package/dist/workflows/run/memory-guard.js +2 -2
  95. package/dist/workflows/run/memory-guard.js.map +1 -1
  96. package/dist/workflows/run/queued-revival.js +5 -5
  97. package/dist/workflows/run/queued-revival.js.map +1 -1
  98. package/dist/workflows/run/run-cancel.js +1 -1
  99. package/dist/workflows/run/run-cancel.js.map +1 -1
  100. package/dist/workflows/run/run-finish.js +5 -5
  101. package/dist/workflows/run/run-finish.js.map +1 -1
  102. package/dist/workflows/run/run-recovery.js +4 -4
  103. package/dist/workflows/run/run-recovery.js.map +1 -1
  104. package/dist/workflows/run/run-settlement.js +12 -12
  105. package/dist/workflows/run/run-settlement.js.map +1 -1
  106. package/dist/workflows/run/run-skills.js +1 -1
  107. package/dist/workflows/run/run-skills.js.map +1 -1
  108. package/dist/workflows/run/session-events.js +4 -4
  109. package/dist/workflows/run/session-events.js.map +1 -1
  110. package/dist/workflows/run/step-loop.js +1 -1
  111. package/dist/workflows/run/step-loop.js.map +1 -1
  112. package/dist/workflows/run/step-session.js +1 -1
  113. package/dist/workflows/run/step-session.js.map +1 -1
  114. package/dist/workflows/run/subagent-waits.js +2 -2
  115. package/dist/workflows/run/subagent-waits.js.map +1 -1
  116. package/dist/workflows/run/turn-bookkeeping.js +2 -2
  117. package/dist/workflows/run/turn-bookkeeping.js.map +1 -1
  118. package/dist/workflows/run/turn-nudges.js +6 -6
  119. package/dist/workflows/run/turn-nudges.js.map +1 -1
  120. package/dist/workflows/run/turn-settler.d.ts +3 -1
  121. package/dist/workflows/run/turn-settler.js +10 -10
  122. package/dist/workflows/run/turn-settler.js.map +1 -1
  123. package/dist/workflows/run/usage-accounting.js +1 -1
  124. package/dist/workflows/run/usage-accounting.js.map +1 -1
  125. package/dist/workflows/run/wake-admission.js +2 -2
  126. package/dist/workflows/run/wake-admission.js.map +1 -1
  127. package/dist/workflows/run/worker-orphans.js +2 -2
  128. package/dist/workflows/run/worker-orphans.js.map +1 -1
  129. package/dist/workflows/run/worker-questions.js +14 -14
  130. package/dist/workflows/run/worker-questions.js.map +1 -1
  131. package/dist/workflows/run/workflow-position.d.ts +3 -1
  132. package/dist/workflows/run/worktree-autosave.js +1 -1
  133. package/dist/workflows/run/worktree-autosave.js.map +1 -1
  134. package/dist/workflows/run.js +2 -2
  135. package/dist/workflows/run.js.map +1 -1
  136. package/package.json +4 -4
@@ -5,7 +5,7 @@ import type { WorkerExecutionRecords, WorkerExecutions } from './ports.ts';
5
5
  import { z } from 'zod';
6
6
  import { queuedMessageSchema } from '../contract/index.js';
7
7
  import { type WaitRegistrationReceipt } from '../contract/index.js';
8
- import type { ArchiveFinishedScope, ArchivedRunsResponse, ArchivePullRequestIdentity, ConversationState, AgentInput, InboxClaim, DelegationState, MergedPullRequest, RunSummary, Wait, WorkerDestroyRetry } from '../contract/index.js';
8
+ import type { ArchivedRunsResponse, ConversationState, AgentInput, InboxClaim, DelegationState, RunSummary, Wait, WorkerDestroyRetry } from '../contract/index.js';
9
9
  import { type AutomationNames } from '../contract/index.js';
10
10
  import { RunTranscriptFacts } from './transcript-facts-topic.ts';
11
11
  import { workflowDefSchema } from '../workflows/types.ts';
@@ -21,6 +21,10 @@ import { type RawExtras } from './raw-record.ts';
21
21
  import { RunStoreOpenError } from './store-open-error.ts';
22
22
  import { type SpawnCapacityRefusal } from './owned-run-create.ts';
23
23
  import { WorkerResultsTopic } from './worker-results.ts';
24
+ import { RunEventLogTopic } from './event-log.ts';
25
+ import { RunRedaction } from './run-redaction.ts';
26
+ import { RunArchiveTopic } from './run-archive.ts';
27
+ import { RunReadFlagsTopic } from './run-read-flags.ts';
24
28
  /** Per-store persistence adapter; the second argument is the normal fenced transaction. */
25
29
  export type RunStorePersistence = (changes: RunDatabaseChanges, transaction: RunDatabase['transaction']) => RunDatabaseCommit;
26
30
  export type RunStatus = 'queued' | 'running' | 'waiting' | 'review' | 'done' | 'failed' | 'cancelled';
@@ -3300,14 +3304,20 @@ export declare class RunStore {
3300
3304
  /** Rows whose `data` this store tried to decode and could not: left in the database untouched,
3301
3305
  * and left out of the list rows from then on, as the cold reader leaves them out (run-index.ts). */
3302
3306
  private readonly unreadable;
3303
- /** Background one-at-a-time compressor for archived transcripts (#818). */
3304
- private readonly compressor;
3307
+ /** The archive flag, archive on merge, completion actions and the transcript compressor (hearsay-tools/squawk#4041). */
3308
+ readonly archive: RunArchiveTopic;
3309
+ /** The pinned and read flags (hearsay-tools/squawk#4041). */
3310
+ readonly readFlags: RunReadFlagsTopic;
3305
3311
  /** What the transcript says about a run (hearsay-tools/squawk#4036). */
3306
3312
  readonly transcriptFacts: RunTranscriptFacts;
3307
3313
  /** Whether a run may go, and its deletion; the count-based archive (hearsay-tools/squawk#4037). */
3308
3314
  readonly retention: RunRetentionTopic;
3309
3315
  /** The saved snapshot of a worker's collected result (hearsay-tools/squawk#4038). */
3310
3316
  readonly workerResults: WorkerResultsTopic;
3317
+ /** The event log and reference markers (hearsay-tools/squawk#4040). */
3318
+ readonly eventLog: RunEventLogTopic;
3319
+ /** The scrub of events and free text (hearsay-tools/squawk#4040). */
3320
+ readonly redaction: RunRedaction;
3311
3321
  private executions;
3312
3322
  /** A worker's execution, process, identity and scope records (hearsay-tools/squawk#4039), built on
3313
3323
  * first use by the factory this process registered; throws when none is registered. */
@@ -3413,6 +3423,8 @@ export declare class RunStore {
3413
3423
  adoptFallbackFamily(id: string): boolean;
3414
3424
  private fallbackRefusal;
3415
3425
  /** Run files are written only for a family this store may write, never a fallback family. */
3426
+ /** The error `appendEvent` throws for a run this store cannot write or does not know. */
3427
+ private missingRunError;
3416
3428
  private writeDir;
3417
3429
  /** Every run whose family another process owns (`foreignClaimedRunIds`). */
3418
3430
  listForeignClaimedRunIds(): string[];
@@ -3754,18 +3766,6 @@ export declare class RunStore {
3754
3766
  * remains best-effort.
3755
3767
  */
3756
3768
  private commitIndex;
3757
- private completionArchiveBlocker;
3758
- /** One archive write for manual actions, merge observations, completion, and sweeps.
3759
- * Archiving files history away; it never stops a process or removes a worktree. */
3760
- private stageArchive;
3761
- /** A bounded persisted queue also covers projects without a live RunManager. */
3762
- listCompletionCandidates(afterSeq?: number, limit?: number): Array<{
3763
- id: string;
3764
- seq: number;
3765
- }>;
3766
- canCompleteAction(id: string, token: string): boolean;
3767
- claimCompletionAction(id: string, token: string): boolean;
3768
- completeAction(id: string, token: string, phase: 'blocked' | 'complete', message?: string): boolean;
3769
3769
  /**
3770
3770
  * Refuse (throwing, with nothing changed) a commit that stages a quarantined run, or a run whose
3771
3771
  * family this store does not claim and cannot take: another process owns it, or a dead process
@@ -3794,154 +3794,13 @@ export declare class RunStore {
3794
3794
  /** Append a step to an existing run (used by "Continue" — spec 003). */
3795
3795
  addStep(runId: string, step: Pick<StepState, 'id' | 'name' | 'kind' | 'synthetic' | 'continuesStepId'>): void;
3796
3796
  updateStep(runId: string, stepId: string, patch: Partial<Omit<StepState, 'id'>>): void;
3797
- listArchiveOnMergeCandidates(afterSeq?: number, limit?: number): Array<{
3798
- id: string;
3799
- seq: number;
3800
- }>;
3801
- /** Use unnormalized persisted evidence: cold reads must not turn interrupted work into safety. */
3802
- private archiveFamily;
3803
- /** Blockers are feedback, never archive authority or cleanup permission. */
3804
- setArchiveBlocker(id: string, blocker: RunRecord['archiveBlocker']): void;
3805
- archiveMergeBlocker(snapshot: ArchiveOnMergeSnapshot, missing: ArchivePullRequestIdentity, repoBase?: string): void;
3806
- hasArchiveOnMergeAssociations(id: string): boolean;
3807
- prepareArchiveOnMerge(id: string): Promise<void>;
3808
- archiveOnMergeSnapshot(id: string, repoBase?: string, isActive?: (id: string) => boolean): ArchiveOnMergeSnapshot | undefined;
3809
- private archiveSnapshot;
3810
- /** No await between final revalidation and the fenced, all-or-nothing cascade. */
3811
- archiveAfterMerge(snapshot: ArchiveOnMergeSnapshot, observations: readonly MergedPullRequest[], repoBase?: string, isActive?: (id: string) => boolean): boolean;
3812
- setArchived(id: string, archived: boolean): RunRecord | undefined;
3813
- /** Parent + owned workers; returns how many records flipped `archived`. */
3814
- private applyArchivedCascade;
3815
- private applyArchived;
3816
- /** Transcript form follows `archived`: enqueue compression, or restore the plain file now. */
3817
- private syncTranscriptForm;
3818
- /**
3819
- * Whether this store may compress `id`'s transcript: the run exists, is archived, is not in a
3820
- * live status (queued/running/waiting), and this process holds the family's claim in `claimed`
3821
- * (not merely `pendingClaims`). Two processes never both write a run (#779, #818 B1).
3822
- */
3823
- private isHistoryCompressEligible;
3824
- /** Take the family claim if free and require it to be in `this.claimed`, not only pending. */
3825
- private holdsCompressClaim;
3826
- /** Startup sweep: enqueue every archived non-live run that still has a plain transcript. */
3827
- compressArchivedHistory(): void;
3828
- /** Resolves when the transcript compressor is idle (tests, shutdown). */
3829
- historyIdle(): Promise<void>;
3830
- /** Pin one run to the top of this project's task list, or unpin it (#935). Mirrors
3831
- * `setArchived`: sets the fields, then persists + broadcasts via `touch`, so the updated
3832
- * record rides the existing `run` SSE with no new event. Idempotent — re-pinning a pinned
3833
- * run just re-stamps `pinnedAt`.
3834
- *
3835
- * Every active status is pinnable. Archived requests clear stale metadata instead, so a
3836
- * late click racing archive cannot leave a hidden pin that reappears on unarchive. */
3837
- setPinned(id: string, pinned: boolean): RunRecord | undefined;
3838
- /** Bulk-archive finished runs (#780). `isSweepable` decides which; `archived` counts every
3839
- * record that flipped (cascaded workers included), `ids` lists the top-level runs picked and
3840
- * `pinnedIds` the subset that carried a pin before `clearPin` dropped it. */
3841
- archiveFinished(scope?: ArchiveFinishedScope, automation?: boolean): {
3842
- archived: number;
3843
- ids: string[];
3844
- pinnedIds: string[];
3845
- };
3846
- /** Mark one run as read (#unread-done-items): stamp the read receipt now. Mirrors
3847
- * `setArchived` — sets the field then persists + broadcasts via `touch`, so the
3848
- * updated record rides the existing `run` SSE with no new event. Idempotent by
3849
- * design: opening an already-read thread just re-stamps a later `seenAt`. */
3850
- setRead(id: string): RunRecord | undefined;
3851
- /** Mark one run as UNread (#775): drop the read receipt so the run rejoins the unread
3852
- * list. The inverse of `setRead` and, like it, `touch`es so the updated record rides the
3853
- * existing `run` SSE.
3854
- *
3855
- * Deleting the field rather than adding a "manually unread" flag is the whole point:
3856
- * absent `seenAt` is ALREADY what every reader treats as unread (`isUnread` in the
3857
- * cockpit's read-state.ts, and `markAllRead`'s clause-for-clause copy of it below), so
3858
- * clearing needs no new state and writes a shape any older Squawk already parses.
3859
- *
3860
- * Deliberately unconditional: clearing a receipt is always a legal write, so this
3861
- * succeeds for an already-unread run (idempotent) and for statuses that can never wear
3862
- * the marker. WHETHER the action means anything for a given run is UI policy, and lives
3863
- * in the cockpit's `runActionFlags` — the same split the rest of the store keeps. */
3864
- setUnread(id: string): RunRecord | undefined;
3865
3797
  /** A debounced write of the held record `id`: `apply` changes it in place, then `touch` saves it. */
3866
3798
  private change;
3867
- /**
3868
- * Stamp unread finished runs in bulk and return the count. Keep the rule aligned with cockpit
3869
- * isUnread: done/failed, finished since seen, not archived; cancelled and usage-limit waiting
3870
- * runs are excluded. `automation` narrows it to one origin, as in `archiveFinished`
3871
- * (hearsay-tools/cezarion#1616); absent stamps both.
3872
- */
3873
- markAllRead(automation?: boolean): number;
3874
- appendEvent(runId: string, event: {
3875
- type: string;
3876
- stepId?: string | undefined;
3877
- [key: string]: unknown;
3878
- }): RunEvent;
3879
- /**
3880
- * Apply agent-declared reference markers (spec 2026-07-18-task-ref-markers).
3881
- * Marker values are authoritative for the display tier: they overwrite the
3882
- * regex/namer numbers unless the prompt identifies the originating issue, and a declared PR re-resolves the referenced URL
3883
- * against the candidate working set — including down to `undefined` when no
3884
- * candidate matches (a wrong chip is worse than no chip). The created tier
3885
- * (`pullRequestUrl`) is deliberately untouched.
3886
- *
3887
- * One declaration is NOT a statement about the referenced tier: the number of the PR this run
3888
- * itself created. See `referencedPrDeclaration` — the marker contract asks the agent to
3889
- * re-declare after it opens a PR, and taking that literally cost the task the PR it was about.
3890
- */
3891
- applyMarkerRefs(runId: string, refs: {
3892
- pr?: number | undefined;
3893
- prs?: readonly number[] | undefined;
3894
- issue?: number | undefined;
3895
- }): RunRecord | undefined;
3896
- /** Authoritative creation keeps the first scalar for publishing, plus every created identity. */
3897
- recordCreatedPr(runId: string, url: string): RunRecord | undefined;
3898
- private accumulatePullRequests;
3899
- /**
3900
- * Fan an event out to live subscribers WITHOUT writing it to the NDJSON
3901
- * file — the channel for coalesced `item.delta` flushes (protocol-v2
3902
- * performance guardrail: raw deltas never hit disk; replay = the persisted
3903
- * snapshots). Stamped with `seq`/`ts` like persisted lines so the live
3904
- * wire keeps one ordering axis. Finite polling coalesces active item content
3905
- * into bounded in-memory snapshots on that clock; disk replay still has gaps
3906
- * (dedup compares with `>`).
3907
- */
3908
- emitEphemeral(runId: string, event: {
3909
- type: string;
3910
- stepId?: string;
3911
- [key: string]: unknown;
3912
- }): RunEvent;
3913
- /** Lazily-collected concrete secret values from the host env (#427). */
3914
- private secretValues;
3915
- /** Controller-issued tokens never persist, including when host-secret redaction is disabled. */
3916
- private readonly sessionSecrets;
3917
- registerSessionSecret(value: string): void;
3918
- containsSessionSecret(value: string): boolean;
3919
- /**
3920
- * Scrub known credential values / token shapes from an event before it is
3921
- * persisted or fanned out. On by default; `CEZ_REDACT_SECRETS=0` opts out.
3922
- */
3923
- private redact;
3924
- /** Best-effort scrub of one free-text string bound for `runs.json`. Honors
3925
- * the `CEZ_REDACT_SECRETS=0` opt-out itself so every caller inherits it. */
3926
- redactText(text: string): string;
3927
- private hostSecrets;
3928
- hasProjection(runId: string, projectionId: string): boolean;
3929
3799
  /** Indexed family enumeration, including members not yet flushed to SQLite. */
3930
3800
  listFamilyRunIds(rootId: string): string[];
3931
- /** `readEvents` off the event loop (async read and async brotli), for collection paths. */
3932
- readEventsAsync(runId: string): Promise<RunEvent[]>;
3933
- readEvents(runId: string): RunEvent[];
3934
3801
  /** Write the pending rows out now (used on shutdown). */
3935
3802
  flush(): void;
3936
3803
  private seqs;
3937
- private nextSeq;
3938
- /** After a restart the in-memory counter is empty while the run's NDJSON file
3939
- * keeps the history. Restarting from 1 would collide with the seqs a client
3940
- * already replayed — its `seq > maxSeq` dedup then silently drops every
3941
- * resumed event, even across a reload (the frozen-transcript symptom class
3942
- * of #424). One file read on the first post-restart append per run. */
3943
- private rehydrateSeq;
3944
- private eventsPath;
3945
3804
  /** Same location `handoffPath()` in handoff.ts produces — inlined to keep
3946
3805
  * the store free of upward imports. */
3947
3806
  private handoffPath;
@@ -3949,8 +3808,6 @@ export declare class RunStore {
3949
3808
  private imagesDir;
3950
3809
  /** Save `run` debounced and publish it; `before` is the record at the write's entry (none: created). */
3951
3810
  private touch;
3952
- /** Form follows archived: a terminal archived run with a plain transcript is queued again. */
3953
- private maybeEnqueueHistoryCompress;
3954
3811
  /** The held record is gone; the next save or commit deletes its row, fenced by `family`'s claim
3955
3812
  * and by the revision this store last saw (kept in `base` until the delete is written). */
3956
3813
  private markDeleted;
@@ -3988,9 +3845,3 @@ export declare class RunStore {
3988
3845
  */
3989
3846
  close(): void;
3990
3847
  }
3991
- export interface ArchiveOnMergeSnapshot {
3992
- rootId: string;
3993
- fingerprint: string;
3994
- pullRequests: ArchivePullRequestIdentity[];
3995
- token: string;
3996
- }