owenloop 0.5.22 → 0.5.24

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/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ All notable changes to this project are documented here. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.5.24](https://github.com/typicalday/owenloop/compare/v0.5.23...v0.5.24) (2026-08-23)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **work:** enforce exact-root Claude tool gating ([#293](https://github.com/typicalday/owenloop/issues/293)) ([d79da0d](https://github.com/typicalday/owenloop/commit/d79da0dc6fac28e641695ab099f9f5f98b439b95))
13
+
14
+ ## [0.5.23](https://github.com/typicalday/owenloop/compare/v0.5.22...v0.5.23) (2026-08-23)
15
+
16
+
17
+ ### Features
18
+
19
+ * **work:** bound silent Claude turns with durable recovery ([#291](https://github.com/typicalday/owenloop/issues/291)) ([fc4db67](https://github.com/typicalday/owenloop/commit/fc4db67d3750f52bb6305208896abd75ce952f7e))
20
+
7
21
  ## [0.5.22](https://github.com/typicalday/owenloop/compare/v0.5.21...v0.5.22) (2026-08-22)
8
22
 
9
23
 
@@ -237,3 +237,19 @@ export declare function renderRejection(spec: RejectionSpec): RejectionDelta;
237
237
  * at all, which is strictly worse than losing old reasons.
238
238
  */
239
239
  export declare function renderReplayBrief(brief: string, spec: RejectionSpec): string;
240
+ /** Durable facts permitted to cross a recovery boundary. */
241
+ export interface RecoveryBriefFacts {
242
+ phase: 'primary' | 'wake' | 'cold-restart' | 'held';
243
+ wakeUsed: boolean;
244
+ coldRestartUsed: boolean;
245
+ lastFailure?: {
246
+ category: string;
247
+ at: number;
248
+ };
249
+ lastActivityAt?: number;
250
+ deadlineAt?: number;
251
+ }
252
+ /** A tiny same-session wake; it deliberately never repeats a brief or input. */
253
+ export declare function renderRecoveryWake(path: string, facts: RecoveryBriefFacts): string;
254
+ /** Safe appendix for a cold recovery replay; the original brief remains intact. */
255
+ export declare function renderColdRecoveryAppendix(facts: RecoveryBriefFacts): string;
@@ -499,3 +499,26 @@ export function renderReplayBrief(brief, spec) {
499
499
  // budget. Return the brief: an agent with a task and no reasons can still work.
500
500
  return brief;
501
501
  }
502
+ /** A tiny same-session wake; it deliberately never repeats a brief or input. */
503
+ export function renderRecoveryWake(path, facts) {
504
+ const state = JSON.stringify({
505
+ phase: facts.phase,
506
+ wakeUsed: facts.wakeUsed,
507
+ coldRestartUsed: facts.coldRestartUsed,
508
+ ...(facts.lastFailure !== undefined ? { lastFailure: facts.lastFailure } : {}),
509
+ ...(facts.lastActivityAt !== undefined ? { lastActivityAt: facts.lastActivityAt } : {}),
510
+ ...(facts.deadlineAt !== undefined ? { deadlineAt: facts.deadlineAt } : {}),
511
+ });
512
+ return `Your prior turn produced no accepted submission. Continue the same assignment and submit the one unfinished output path \`${path}\`. Durable recovery state: ${state}`;
513
+ }
514
+ /** Safe appendix for a cold recovery replay; the original brief remains intact. */
515
+ export function renderColdRecoveryAppendix(facts) {
516
+ return `Recovery appendix (durable facts only): ${JSON.stringify({
517
+ phase: facts.phase,
518
+ wakeUsed: facts.wakeUsed,
519
+ coldRestartUsed: facts.coldRestartUsed,
520
+ ...(facts.lastFailure !== undefined ? { lastFailure: facts.lastFailure } : {}),
521
+ ...(facts.lastActivityAt !== undefined ? { lastActivityAt: facts.lastActivityAt } : {}),
522
+ ...(facts.deadlineAt !== undefined ? { deadlineAt: facts.deadlineAt } : {}),
523
+ })}`;
524
+ }
@@ -1,3 +1,4 @@
1
+ import { type LeaseLoop, type LeaseLoopOptions } from '../lease/loop.ts';
1
2
  import type { HubClient } from '../hub/client.ts';
2
3
  import type { ContactHolder, OrderPacket } from '../hub/types.ts';
3
4
  import type { ConsumedVerifier } from '../consumed-verifier.ts';
@@ -7,7 +8,7 @@ import { type SessionRecord, type SessionTaskRef } from '../harness/session-stor
7
8
  import { type CapabilityMatch } from './capability-model.ts';
8
9
  import type { MergedRoster } from '../settings/roster.ts';
9
10
  /** Discriminated result of one worker life; the role maps these to exit codes. */
10
- export type AgentRunOutcome = 'submitted' | 'completed' | 'misroute' | 'workdir-denied' | 'no-template' | 'no-harness' | 'incompatible-harness-policy' | 'unstamped-order' | 'unresolvable-crew' | 'unresolvable-capability' | 'unverified-consumed' | 'session-store-failed' | 'no-submit' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'stopped';
11
+ export type AgentRunOutcome = 'submitted' | 'held' | 'completed' | 'misroute' | 'workdir-denied' | 'no-template' | 'no-harness' | 'incompatible-harness-policy' | 'unstamped-order' | 'unresolvable-crew' | 'unresolvable-capability' | 'unverified-consumed' | 'session-store-failed' | 'no-submit' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'stopped';
11
12
  /**
12
13
  * Locate the normalized step spec for an order. Injected because the lookup is
13
14
  * I/O (the verified workflow store) and because resolving the local definition
@@ -117,6 +118,8 @@ export interface AgentRunLoopOptions {
117
118
  * exactly the pre-Phase-4 behaviour.
118
119
  */
119
120
  latestSession?: (task: SessionTaskRef) => SessionRecord | null;
121
+ /** Latest record for this exact concrete firing, used only by durable recovery. */
122
+ latestRunSession?: (workflow: string, run: string, step: string) => SessionRecord | null;
120
123
  /**
121
124
  * Does this directory still exist? Injected for the same reason every other
122
125
  * side effect here is: a unit test drives the "the work dir was reaped, so the
@@ -136,6 +139,13 @@ export interface AgentRunLoopOptions {
136
139
  confirmIntervalMs?: number;
137
140
  /** Confirm-phase upper bound (default `DEFAULT_SUBMIT_GRACE_MS`). */
138
141
  submitGraceMs?: number;
142
+ /** Recovery-only adapter cleanup bound. Test seam; production defaults to 5s. */
143
+ recoveryStopGraceMs?: number;
144
+ /**
145
+ * Lease construction seam for lifecycle-order tests. Production always uses
146
+ * the shared lease loop; callers need not provide this.
147
+ */
148
+ leaseFactory?: (options: LeaseLoopOptions) => LeaseLoop;
139
149
  }
140
150
  export interface AgentRunLoop {
141
151
  run(): Promise<AgentRunOutcome>;