@hearsay-tools/squawk 0.18.0-pr4079.7802 → 0.18.0-pr4082.7810

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 (165) hide show
  1. package/dist/activity/read-model.js +1 -1
  2. package/dist/activity/read-model.js.map +1 -1
  3. package/dist/activity/requests.d.ts +3 -1
  4. package/dist/activity/requests.js +1 -1
  5. package/dist/activity/requests.js.map +1 -1
  6. package/dist/activity/tool-activity.d.ts +3 -2
  7. package/dist/activity/tool-activity.js +1 -1
  8. package/dist/activity/tool-activity.js.map +1 -1
  9. package/dist/built-in-run-slots.d.ts +4 -3
  10. package/dist/built-in-run-slots.js +7 -3
  11. package/dist/built-in-run-slots.js.map +1 -1
  12. package/dist/ci-wait/controller.d.ts +42 -42
  13. package/dist/delegation/conversation-send.js +1 -1
  14. package/dist/delegation/conversation-send.js.map +1 -1
  15. package/dist/delegation/conversations.js +4 -4
  16. package/dist/delegation/conversations.js.map +1 -1
  17. package/dist/delegation/execution-identity.d.ts +7 -2
  18. package/dist/delegation/execution-identity.js +34 -3
  19. package/dist/delegation/execution-identity.js.map +1 -1
  20. package/dist/delegation/family-end.d.ts +3 -1
  21. package/dist/delegation/park-notice.d.ts +3 -1
  22. package/dist/delegation/park-notice.js +2 -2
  23. package/dist/delegation/park-notice.js.map +1 -1
  24. package/dist/delegation/private-record-file.js.map +1 -0
  25. package/dist/delegation/provision.js +1 -1
  26. package/dist/delegation/provision.js.map +1 -1
  27. package/dist/delegation/results.js +3 -3
  28. package/dist/delegation/results.js.map +1 -1
  29. package/dist/delegation/scratch-cleanup.js +5 -5
  30. package/dist/delegation/scratch-cleanup.js.map +1 -1
  31. package/dist/delegation/service.js +10 -9
  32. package/dist/delegation/service.js.map +1 -1
  33. package/dist/delegation/worker-cleanup.js +13 -12
  34. package/dist/delegation/worker-cleanup.js.map +1 -1
  35. package/dist/{runs → delegation}/worker-deletion-proof.d.ts +1 -1
  36. package/dist/delegation/worker-deletion-proof.js.map +1 -0
  37. package/dist/delegation/worker-executions.d.ts +70 -0
  38. package/dist/delegation/worker-executions.js +248 -0
  39. package/dist/delegation/worker-executions.js.map +1 -0
  40. package/dist/{runs → delegation}/worker-resource-holders.d.ts +1 -1
  41. package/dist/delegation/worker-resource-holders.js.map +1 -0
  42. package/dist/preview/agent-marker.js +1 -1
  43. package/dist/preview/agent-marker.js.map +1 -1
  44. package/dist/preview/host.d.ts +5 -1
  45. package/dist/preview/host.js +2 -2
  46. package/dist/preview/host.js.map +1 -1
  47. package/dist/preview/run-tools.js +1 -1
  48. package/dist/preview/run-tools.js.map +1 -1
  49. package/dist/runs/event-log.d.ts +79 -0
  50. package/dist/runs/event-log.js +188 -0
  51. package/dist/runs/event-log.js.map +1 -0
  52. package/dist/runs/owned-run-create.d.ts +3 -3
  53. package/dist/runs/owned-run-create.js +1 -2
  54. package/dist/runs/owned-run-create.js.map +1 -1
  55. package/dist/runs/ports.d.ts +68 -22
  56. package/dist/runs/retention.d.ts +3 -1
  57. package/dist/runs/retention.js +3 -3
  58. package/dist/runs/retention.js.map +1 -1
  59. package/dist/runs/run-redaction.d.ts +19 -0
  60. package/dist/runs/run-redaction.js +36 -0
  61. package/dist/runs/run-redaction.js.map +1 -0
  62. package/dist/runs/run-retention.d.ts +1 -1
  63. package/dist/runs/store.d.ts +14 -117
  64. package/dist/runs/store.js +56 -462
  65. package/dist/runs/store.js.map +1 -1
  66. package/dist/runs/transcript-facts-fold.d.ts +1 -1
  67. package/dist/runs/transcript-facts-fold.js +1 -1
  68. package/dist/runs/transcript-facts-fold.js.map +1 -1
  69. package/dist/runs/webhook.d.ts +3 -1
  70. package/dist/runs/webhook.js +3 -3
  71. package/dist/runs/webhook.js.map +1 -1
  72. package/dist/runs/worker-executions-registry.d.ts +31 -0
  73. package/dist/runs/worker-executions-registry.js +20 -0
  74. package/dist/runs/worker-executions-registry.js.map +1 -0
  75. package/dist/server/activity-routes.d.ts +23 -23
  76. package/dist/server/models-routes.d.ts +13 -13
  77. package/dist/server/project-context.d.ts +3 -1
  78. package/dist/server/project-context.js.map +1 -1
  79. package/dist/server/provider-auth-runtime.js +2 -2
  80. package/dist/server/provider-auth-runtime.js.map +1 -1
  81. package/dist/server/reports-api.d.ts +2 -2
  82. package/dist/server/run-relationships.d.ts +3 -1
  83. package/dist/server/run-relationships.js +1 -1
  84. package/dist/server/run-relationships.js.map +1 -1
  85. package/dist/server/runners-routes.d.ts +10 -10
  86. package/dist/server/server.js +2 -2
  87. package/dist/server/server.js.map +1 -1
  88. package/dist/workflows/run/attachment-writer.js +1 -1
  89. package/dist/workflows/run/attachment-writer.js.map +1 -1
  90. package/dist/workflows/run/auto-resume.js +4 -4
  91. package/dist/workflows/run/auto-resume.js.map +1 -1
  92. package/dist/workflows/run/completion-gate.js +1 -1
  93. package/dist/workflows/run/completion-gate.js.map +1 -1
  94. package/dist/workflows/run/continuation-session.js +10 -10
  95. package/dist/workflows/run/continuation-session.js.map +1 -1
  96. package/dist/workflows/run/cut-off-work.d.ts +8 -6
  97. package/dist/workflows/run/cut-off-work.js +2 -2
  98. package/dist/workflows/run/cut-off-work.js.map +1 -1
  99. package/dist/workflows/run/family-reconciler.js +3 -3
  100. package/dist/workflows/run/family-reconciler.js.map +1 -1
  101. package/dist/workflows/run/human-waits.js +4 -4
  102. package/dist/workflows/run/human-waits.js.map +1 -1
  103. package/dist/workflows/run/input-delivery.js +11 -11
  104. package/dist/workflows/run/input-delivery.js.map +1 -1
  105. package/dist/workflows/run/input-receipts.js +3 -3
  106. package/dist/workflows/run/input-receipts.js.map +1 -1
  107. package/dist/workflows/run/launch-context.js +1 -1
  108. package/dist/workflows/run/launch-context.js.map +1 -1
  109. package/dist/workflows/run/launch-read-resolver.d.ts +3 -1
  110. package/dist/workflows/run/launch-read-resolver.js +7 -7
  111. package/dist/workflows/run/launch-read-resolver.js.map +1 -1
  112. package/dist/workflows/run/memory-guard.js +2 -2
  113. package/dist/workflows/run/memory-guard.js.map +1 -1
  114. package/dist/workflows/run/queued-revival.js +5 -5
  115. package/dist/workflows/run/queued-revival.js.map +1 -1
  116. package/dist/workflows/run/run-cancel.js +5 -5
  117. package/dist/workflows/run/run-cancel.js.map +1 -1
  118. package/dist/workflows/run/run-finish.js +5 -5
  119. package/dist/workflows/run/run-finish.js.map +1 -1
  120. package/dist/workflows/run/run-recovery.js +6 -6
  121. package/dist/workflows/run/run-recovery.js.map +1 -1
  122. package/dist/workflows/run/run-settlement.js +12 -12
  123. package/dist/workflows/run/run-settlement.js.map +1 -1
  124. package/dist/workflows/run/run-skills.js +1 -1
  125. package/dist/workflows/run/run-skills.js.map +1 -1
  126. package/dist/workflows/run/session-events.js +4 -4
  127. package/dist/workflows/run/session-events.js.map +1 -1
  128. package/dist/workflows/run/step-loop.js +3 -3
  129. package/dist/workflows/run/step-loop.js.map +1 -1
  130. package/dist/workflows/run/step-session.js +2 -2
  131. package/dist/workflows/run/step-session.js.map +1 -1
  132. package/dist/workflows/run/subagent-waits.js +2 -2
  133. package/dist/workflows/run/subagent-waits.js.map +1 -1
  134. package/dist/workflows/run/turn-bookkeeping.js +2 -2
  135. package/dist/workflows/run/turn-bookkeeping.js.map +1 -1
  136. package/dist/workflows/run/turn-nudges.js +6 -6
  137. package/dist/workflows/run/turn-nudges.js.map +1 -1
  138. package/dist/workflows/run/turn-settler.d.ts +3 -1
  139. package/dist/workflows/run/turn-settler.js +10 -10
  140. package/dist/workflows/run/turn-settler.js.map +1 -1
  141. package/dist/workflows/run/usage-accounting.js +1 -1
  142. package/dist/workflows/run/usage-accounting.js.map +1 -1
  143. package/dist/workflows/run/wake-admission.js +2 -2
  144. package/dist/workflows/run/wake-admission.js.map +1 -1
  145. package/dist/workflows/run/worker-executions.js +6 -6
  146. package/dist/workflows/run/worker-executions.js.map +1 -1
  147. package/dist/workflows/run/worker-orphans.js +10 -10
  148. package/dist/workflows/run/worker-orphans.js.map +1 -1
  149. package/dist/workflows/run/worker-questions.js +14 -14
  150. package/dist/workflows/run/worker-questions.js.map +1 -1
  151. package/dist/workflows/run/workflow-position.d.ts +3 -1
  152. package/dist/workflows/run/worktree-autosave.js +1 -1
  153. package/dist/workflows/run/worktree-autosave.js.map +1 -1
  154. package/dist/workflows/run.js +2 -2
  155. package/dist/workflows/run.js.map +1 -1
  156. package/package.json +4 -4
  157. package/scripts/benchmark-stuck-destroys.ts +2 -2
  158. package/scripts/benchmark-worker-lifecycle.ts +3 -2
  159. package/dist/runs/private-record-file.js.map +0 -1
  160. package/dist/runs/worker-deletion-proof.js.map +0 -1
  161. package/dist/runs/worker-resource-holders.js.map +0 -1
  162. /package/dist/{runs → delegation}/private-record-file.d.ts +0 -0
  163. /package/dist/{runs → delegation}/private-record-file.js +0 -0
  164. /package/dist/{runs → delegation}/worker-deletion-proof.js +0 -0
  165. /package/dist/{runs → delegation}/worker-resource-holders.js +0 -0
@@ -1,17 +1,13 @@
1
1
  import { type RunLifecycleSource } from './lifecycle.ts';
2
2
  import { type PeerTaskPageOptions } from './run-summary-page.ts';
3
3
  export { parseStoredSummary } from './run-summary-page.ts';
4
- import { type WorkerExecution } from './worker-execution.ts';
4
+ import type { WorkerExecutionRecords, WorkerExecutions } from './ports.ts';
5
5
  import { z } from 'zod';
6
- import { type ScopeRecord, type SpawnScope } from '../worker-scope/scope.ts';
7
- import { WorkerScopes } from '../worker-scope/worker-scopes.ts';
8
6
  import { queuedMessageSchema } from '../contract/index.js';
9
7
  import { type WaitRegistrationReceipt } from '../contract/index.js';
10
8
  import type { ArchiveFinishedScope, ArchivedRunsResponse, ArchivePullRequestIdentity, ConversationState, AgentInput, InboxClaim, DelegationState, MergedPullRequest, RunSummary, Wait, WorkerDestroyRetry } from '../contract/index.js';
11
9
  import { type AutomationNames } from '../contract/index.js';
12
10
  import { RunTranscriptFacts } from './transcript-facts-topic.ts';
13
- import { type WorkerExecutionIdentity } from '../delegation/execution-identity.ts';
14
- import { type WorkerProcessRecord } from '../core/process-stat.ts';
15
11
  import { workflowDefSchema } from '../workflows/types.ts';
16
12
  import { type OutcomeDependencies, type OutcomeReceipt, type RunOutcome } from './outcome-commit.ts';
17
13
  import { type ExitCall, type RunExitId, type RunPatch } from './run-exits.ts';
@@ -25,6 +21,8 @@ import { type RawExtras } from './raw-record.ts';
25
21
  import { RunStoreOpenError } from './store-open-error.ts';
26
22
  import { type SpawnCapacityRefusal } from './owned-run-create.ts';
27
23
  import { WorkerResultsTopic } from './worker-results.ts';
24
+ import { RunEventLogTopic } from './event-log.ts';
25
+ import { RunRedaction } from './run-redaction.ts';
28
26
  /** Per-store persistence adapter; the second argument is the normal fenced transaction. */
29
27
  export type RunStorePersistence = (changes: RunDatabaseChanges, transaction: RunDatabase['transaction']) => RunDatabaseCommit;
30
28
  export type RunStatus = 'queued' | 'running' | 'waiting' | 'review' | 'done' | 'failed' | 'cancelled';
@@ -3269,8 +3267,6 @@ export declare class RunStore {
3269
3267
  readonly lifecycle: RunLifecycleSource;
3270
3268
  /** The lifecycle events run exits write (B12). */
3271
3269
  private readonly exitEvents;
3272
- /** Every worker's process scope (ADR 0032): spawn sites, Continue and destroy reach it here. */
3273
- readonly scopes: WorkerScopes;
3274
3270
  /** Runs gone from memory whose rows the next save or commit deletes. */
3275
3271
  private readonly deleted;
3276
3272
  /** Deleted runs whose history files (events, handoff, images, artifacts) go once the delete of
@@ -3314,6 +3310,14 @@ export declare class RunStore {
3314
3310
  readonly retention: RunRetentionTopic;
3315
3311
  /** The saved snapshot of a worker's collected result (hearsay-tools/squawk#4038). */
3316
3312
  readonly workerResults: WorkerResultsTopic;
3313
+ /** The event log and reference markers (hearsay-tools/squawk#4040). */
3314
+ readonly eventLog: RunEventLogTopic;
3315
+ /** The scrub of events and free text (hearsay-tools/squawk#4040). */
3316
+ readonly redaction: RunRedaction;
3317
+ private executions;
3318
+ /** A worker's execution, process, identity and scope records (hearsay-tools/squawk#4039), built on
3319
+ * first use by the factory this process registered; throws when none is registered. */
3320
+ get workerExecutions(): WorkerExecutions & WorkerExecutionRecords;
3317
3321
  private readonly liveItems;
3318
3322
  /** Capture both sources on the same synchronous sequence boundary before history IO. */
3319
3323
  liveReadSnapshot(runId: string): {
@@ -3415,6 +3419,8 @@ export declare class RunStore {
3415
3419
  adoptFallbackFamily(id: string): boolean;
3416
3420
  private fallbackRefusal;
3417
3421
  /** Run files are written only for a family this store may write, never a fallback family. */
3422
+ /** The error `appendEvent` throws for a run this store cannot write or does not know. */
3423
+ private missingRunError;
3418
3424
  private writeDir;
3419
3425
  /** Every run whose family another process owns (`foreignClaimedRunIds`). */
3420
3426
  listForeignClaimedRunIds(): string[];
@@ -3749,7 +3755,7 @@ export declare class RunStore {
3749
3755
  input: AgentInput;
3750
3756
  }): void;
3751
3757
  /** Create an owned worker run and its parent receipt; `createStoreOwnedRun` holds the checks. */
3752
- createOwnedRun(input: Parameters<RunStore['createRun']>[0], parentId: string, requestId: string, worker: DelegationState, requestHash: string, spawnCapacityRefusal: SpawnCapacityRefusal, executionIdentity?: WorkerExecutionIdentity): RunRecord;
3758
+ createOwnedRun(input: Parameters<RunStore['createRun']>[0], parentId: string, requestId: string, worker: DelegationState, requestHash: string, spawnCapacityRefusal: SpawnCapacityRefusal, executionIdentity?: unknown): RunRecord;
3753
3759
  /**
3754
3760
  * Durably replace or delete staged rows together with pending dirty rows. Persist before
3755
3761
  * changing held objects or notifying subscribers. On failure retain all pending state; flush()
@@ -3873,120 +3879,11 @@ export declare class RunStore {
3873
3879
  * (hearsay-tools/cezarion#1616); absent stamps both.
3874
3880
  */
3875
3881
  markAllRead(automation?: boolean): number;
3876
- appendEvent(runId: string, event: {
3877
- type: string;
3878
- stepId?: string | undefined;
3879
- [key: string]: unknown;
3880
- }): RunEvent;
3881
- /**
3882
- * Apply agent-declared reference markers (spec 2026-07-18-task-ref-markers).
3883
- * Marker values are authoritative for the display tier: they overwrite the
3884
- * regex/namer numbers unless the prompt identifies the originating issue, and a declared PR re-resolves the referenced URL
3885
- * against the candidate working set — including down to `undefined` when no
3886
- * candidate matches (a wrong chip is worse than no chip). The created tier
3887
- * (`pullRequestUrl`) is deliberately untouched.
3888
- *
3889
- * One declaration is NOT a statement about the referenced tier: the number of the PR this run
3890
- * itself created. See `referencedPrDeclaration` — the marker contract asks the agent to
3891
- * re-declare after it opens a PR, and taking that literally cost the task the PR it was about.
3892
- */
3893
- applyMarkerRefs(runId: string, refs: {
3894
- pr?: number | undefined;
3895
- prs?: readonly number[] | undefined;
3896
- issue?: number | undefined;
3897
- }): RunRecord | undefined;
3898
- /** Authoritative creation keeps the first scalar for publishing, plus every created identity. */
3899
- recordCreatedPr(runId: string, url: string): RunRecord | undefined;
3900
- private accumulatePullRequests;
3901
- /**
3902
- * Fan an event out to live subscribers WITHOUT writing it to the NDJSON
3903
- * file — the channel for coalesced `item.delta` flushes (protocol-v2
3904
- * performance guardrail: raw deltas never hit disk; replay = the persisted
3905
- * snapshots). Stamped with `seq`/`ts` like persisted lines so the live
3906
- * wire keeps one ordering axis. Finite polling coalesces active item content
3907
- * into bounded in-memory snapshots on that clock; disk replay still has gaps
3908
- * (dedup compares with `>`).
3909
- */
3910
- emitEphemeral(runId: string, event: {
3911
- type: string;
3912
- stepId?: string;
3913
- [key: string]: unknown;
3914
- }): RunEvent;
3915
- /** Lazily-collected concrete secret values from the host env (#427). */
3916
- private secretValues;
3917
- /** Controller-issued tokens never persist, including when host-secret redaction is disabled. */
3918
- private readonly sessionSecrets;
3919
- registerSessionSecret(value: string): void;
3920
- containsSessionSecret(value: string): boolean;
3921
- /**
3922
- * Scrub known credential values / token shapes from an event before it is
3923
- * persisted or fanned out. On by default; `CEZ_REDACT_SECRETS=0` opts out.
3924
- */
3925
- private redact;
3926
- /** Best-effort scrub of one free-text string bound for `runs.json`. Honors
3927
- * the `CEZ_REDACT_SECRETS=0` opt-out itself so every caller inherits it. */
3928
- redactText(text: string): string;
3929
- private hostSecrets;
3930
- hasProjection(runId: string, projectionId: string): boolean;
3931
3882
  /** Indexed family enumeration, including members not yet flushed to SQLite. */
3932
3883
  listFamilyRunIds(rootId: string): string[];
3933
- /** `readEvents` off the event loop (async read and async brotli), for collection paths. */
3934
- readEventsAsync(runId: string): Promise<RunEvent[]>;
3935
- readEvents(runId: string): RunEvent[];
3936
- /** Private process-generation evidence; never part of run JSON or SSE. */
3937
- private identityPath;
3938
- readWorkerIdentity(id: string): WorkerExecutionIdentity | undefined;
3939
- private writeWorkerIdentity;
3940
- private executionPath;
3941
- readWorkerExecution(id: string): WorkerExecution | undefined;
3942
- private writeWorkerExecution;
3943
- /** Complete execution is not permission to reuse/delete persistent resources (#738).
3944
- * Synchronous, fresh and generation/resource fenced; callers hold admission off across awaits. */
3945
- workerResourcesSafe(id: string, generation: string, resourceId: string): boolean;
3946
- /** `workerResourcesSafe` with the refusal's live PIDs (empty when no PID explains it). */
3947
- workerResourceHolders(id: string, generation: string, resourceId: string, opts?: {
3948
- admittingQueued?: boolean;
3949
- }): 'safe' | number[];
3950
- /** Upgrade a legacy completed checkpoint while terminal task ownership is still known.
3951
- * No holder scan here: settlement and scheduling must never wait on cleanup proof. */
3952
- retainWorkerScratchCleanup(id: string): void;
3953
- /** Cleanup can outlive its index row, but never its generation or terminal task intent. */
3954
- workerScratchResourcesSafe(id: string, generation: string, resourceId: string): boolean;
3955
- commitWorkerExecutionStart(id: string): string;
3956
- /** Private process record (#469): which processes a generation spawned, never part of run JSON or SSE. */
3957
- private processesPath;
3958
- /** Tri-state: only ENOENT is `absent` (legacy, scan-only). A present record that is unreadable,
3959
- * wrongly permissioned, malformed or of another generation is `unknown`: never finalized or reaped. */
3960
- readWorkerProcesses(id: string, generation: string): WorkerProcessRecord | 'absent' | 'unknown';
3961
- private writeWorkerProcesses;
3962
- /** Private scope record: the cgroups and process groups the worker owns (ADR 0032). */
3963
- private scopePath;
3964
- /** Tri-state like the process record: only ENOENT is `absent`. */
3965
- readWorkerScope(id: string): ScopeRecord | 'absent' | 'unknown';
3966
- /** Durable before the caller acts on it. */
3967
- writeWorkerScope(id: string, record: ScopeRecord): void;
3968
- /** The scope a run's processes start in: a worker's own, none for any other run (ADR 0032). */
3969
- spawnScope(id: string): SpawnScope | undefined;
3970
- /** Bound to the current generation. Past the cap the record never drops an entry: the
3971
- * working-directory scan is the remaining evidence. */
3972
- appendWorkerProcess(id: string, generation: string, pid: number, pgid?: number): boolean;
3973
- commitWorkerExecutionComplete(id: string, generation: string, opts?: {
3974
- interrupted?: boolean;
3975
- }): boolean;
3976
- /** A deleted child's receipt replaces the private proof only after the deletion checkpoint. */
3977
- private workerDeletionEvidence;
3978
- private workerDeletionResult;
3979
3884
  /** Write the pending rows out now (used on shutdown). */
3980
3885
  flush(): void;
3981
3886
  private seqs;
3982
- private nextSeq;
3983
- /** After a restart the in-memory counter is empty while the run's NDJSON file
3984
- * keeps the history. Restarting from 1 would collide with the seqs a client
3985
- * already replayed — its `seq > maxSeq` dedup then silently drops every
3986
- * resumed event, even across a reload (the frozen-transcript symptom class
3987
- * of #424). One file read on the first post-restart append per run. */
3988
- private rehydrateSeq;
3989
- private eventsPath;
3990
3887
  /** Same location `handoffPath()` in handoff.ts produces — inlined to keep
3991
3888
  * the store free of upward imports. */
3992
3889
  private handoffPath;