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.
@@ -1,7 +1,17 @@
1
- import type { Options, Query, SDKMessage } from '@anthropic-ai/claude-agent-sdk';
1
+ import type { HookCallback, Options, Query, SDKMessage } from '@anthropic-ai/claude-agent-sdk';
2
2
  import { type GatePolicy } from './gatekeeper.ts';
3
3
  import type { ApprovalRequester } from './contract.ts';
4
- import type { AgentEvent, HarnessAdapter, HarnessSessionRef, StartArgs, StepPermissions } from './contract.ts';
4
+ import type { AgentEvent, DeliverArgs, HarnessAdapter, HarnessRecoveryPolicy, HarnessSessionRef, StartArgs, StepPermissions } from './contract.ts';
5
+ /** Host-only opt-in liveness controller. Never admitted to the child env. */
6
+ export declare const CLAUDE_IDLE_TIMEOUT_VAR = "OWENLOOP_CLAUDE_IDLE_TIMEOUT_MS";
7
+ /** Host-only opt-in for the exact snapshot-root Claude audit profile. */
8
+ export declare const CLAUDE_EXACT_WORKDIR_VAR = "OWENLOOP_CLAUDE_EXACT_WORKDIR";
9
+ /** Parse the one adapter-owned recovery setting without silently opting out. */
10
+ export declare function parseClaudeIdleTimeout(value: string | undefined): HarnessRecoveryPolicy | undefined;
11
+ export declare function claudeRecoveryPolicy(env?: Record<string, string | undefined>): HarnessRecoveryPolicy | undefined;
12
+ /** Parse the strict profile as a boolean rather than passing its host spelling onward. */
13
+ export declare function parseClaudeExactWorkdir(value: string | undefined): boolean;
14
+ export declare function claudeExactWorkdir(env?: Record<string, string | undefined>): boolean;
5
15
  /**
6
16
  * Build the environment the harness child runs under.
7
17
  *
@@ -90,6 +100,8 @@ export declare function resolveExecutable(source: Record<string, string | undefi
90
100
  * future SDK that does route it must not find it silently widened here.
91
101
  */
92
102
  export declare function gatePolicyFor(authoredMode: string | undefined): GatePolicy;
103
+ /** Programmatic PreToolUse guard for every path-bearing exposed built-in. */
104
+ export declare function buildExactWorkdirPreToolUse(cwd: string): HookCallback;
93
105
  /** Everything `buildClaudeOptions` reads for either cold start or resume. */
94
106
  export interface ClaudeOptionInputs {
95
107
  cwd: string;
@@ -105,6 +117,9 @@ export interface ClaudeOptionInputs {
105
117
  /** The human approval channel, when this deployment has one. Absent keeps the
106
118
  * refuse-and-route-to-`ask` behavior — see `buildCanUseTool`. */
107
119
  approvals?: ApprovalRequester;
120
+ recoveryPolicy?: HarnessRecoveryPolicy;
121
+ /** Host-parsed policy bit. Its environment spelling never enters Options. */
122
+ exactWorkdir?: boolean;
108
123
  }
109
124
  /** The non-declarative bits a caller supplies per invocation. */
110
125
  export interface ClaudeOptionExtras {
@@ -137,6 +152,12 @@ export interface ClaudeStartDependencies {
137
152
  createSessionId: () => string;
138
153
  loadQuery: () => Promise<ClaudeQueryFactory>;
139
154
  }
155
+ export interface ClaudeDeliverDependencies {
156
+ loadQuery: () => Promise<ClaudeQueryFactory>;
157
+ getSessionInfo: (token: string, opts: {
158
+ dir: string;
159
+ }) => Promise<unknown>;
160
+ }
140
161
  /** What one consumed turn tells the caller. */
141
162
  export interface TurnOutcome {
142
163
  /** The session id from the `system/init` message, if one arrived. */
@@ -144,6 +165,24 @@ export interface TurnOutcome {
144
165
  /** Whether the turn-end (`result`) message arrived. */
145
166
  sawResult: boolean;
146
167
  }
168
+ /** Per-turn liveness machinery. All callbacks are payload-free by contract. */
169
+ export interface ConsumeTurnControl {
170
+ idleTimeoutMs?: number;
171
+ /** Suppress provider-controlled payload telemetry while retaining liveness and
172
+ * structured failure categories for a recovery-enabled turn. */
173
+ sanitizeProviderTelemetry?: boolean;
174
+ abortController?: AbortController;
175
+ close?: () => void;
176
+ onActivity?: (activity: {
177
+ at: number;
178
+ deadlineAt: number;
179
+ }) => void;
180
+ now?: () => number;
181
+ setTimer?: (callback: () => void, ms: number) => ReturnType<typeof setTimeout>;
182
+ clearTimer?: (timer: ReturnType<typeof setTimeout>) => void;
183
+ /** Strict profile's literal provider identity check, never a public arg. */
184
+ expectedModel?: string;
185
+ }
147
186
  /**
148
187
  * Drive the SDK message stream to TURN END and map it onto `AgentEvent`s.
149
188
  *
@@ -163,6 +202,7 @@ export interface TurnOutcome {
163
202
  * what it uses is what lets a fixture drive it. A live `Query` still satisfies
164
203
  * the narrower type, so nothing at the call sites changes.
165
204
  */
166
- export declare function consumeTurn(q: AsyncIterable<SDKMessage>, onEvent: (e: AgentEvent) => void, onInit?: (sessionId: string) => void, expectedSessionId?: string): Promise<TurnOutcome>;
205
+ export declare function consumeTurn(q: AsyncIterable<SDKMessage>, onEvent: (e: AgentEvent) => void, onInit?: (sessionId: string) => void, expectedSessionId?: string, control?: ConsumeTurnControl): Promise<TurnOutcome>;
167
206
  export declare function startClaude(args: StartArgs, onEvent: (e: AgentEvent) => void, dependencies?: ClaudeStartDependencies): Promise<HarnessSessionRef>;
207
+ export declare function deliverClaude(ref: HarnessSessionRef, message: string, args: DeliverArgs, onEvent: (e: AgentEvent) => void, dependencies?: ClaudeDeliverDependencies): Promise<void>;
168
208
  export declare const claudeAdapter: HarnessAdapter;