owenloop 0.5.22 → 0.5.23
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 +7 -0
- package/dist/packages/work/src/agent/brief.d.ts +16 -0
- package/dist/packages/work/src/agent/brief.js +23 -0
- package/dist/packages/work/src/agent/loop.d.ts +11 -1
- package/dist/packages/work/src/agent/loop.js +520 -8
- package/dist/packages/work/src/harness/claude.d.ts +31 -2
- package/dist/packages/work/src/harness/claude.js +362 -95
- package/dist/packages/work/src/harness/contract.d.ts +36 -1
- package/dist/packages/work/src/harness/contract.js +34 -0
- package/dist/packages/work/src/harness/session-store.d.ts +18 -0
- package/dist/packages/work/src/harness/session-store.js +30 -1
- package/dist/packages/work/src/roles/agent-run.js +5 -1
- package/dist/packages/work/src/roles/sessions.d.ts +7 -0
- package/dist/packages/work/src/roles/sessions.js +56 -5
- package/docs/agent-runner.md +8 -0
- package/docs/cli.md +4 -0
- package/package.json +1 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { 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
|
+
/** Parse the one adapter-owned recovery setting without silently opting out. */
|
|
8
|
+
export declare function parseClaudeIdleTimeout(value: string | undefined): HarnessRecoveryPolicy | undefined;
|
|
9
|
+
export declare function claudeRecoveryPolicy(env?: Record<string, string | undefined>): HarnessRecoveryPolicy | undefined;
|
|
5
10
|
/**
|
|
6
11
|
* Build the environment the harness child runs under.
|
|
7
12
|
*
|
|
@@ -105,6 +110,7 @@ export interface ClaudeOptionInputs {
|
|
|
105
110
|
/** The human approval channel, when this deployment has one. Absent keeps the
|
|
106
111
|
* refuse-and-route-to-`ask` behavior — see `buildCanUseTool`. */
|
|
107
112
|
approvals?: ApprovalRequester;
|
|
113
|
+
recoveryPolicy?: HarnessRecoveryPolicy;
|
|
108
114
|
}
|
|
109
115
|
/** The non-declarative bits a caller supplies per invocation. */
|
|
110
116
|
export interface ClaudeOptionExtras {
|
|
@@ -137,6 +143,12 @@ export interface ClaudeStartDependencies {
|
|
|
137
143
|
createSessionId: () => string;
|
|
138
144
|
loadQuery: () => Promise<ClaudeQueryFactory>;
|
|
139
145
|
}
|
|
146
|
+
export interface ClaudeDeliverDependencies {
|
|
147
|
+
loadQuery: () => Promise<ClaudeQueryFactory>;
|
|
148
|
+
getSessionInfo: (token: string, opts: {
|
|
149
|
+
dir: string;
|
|
150
|
+
}) => Promise<unknown>;
|
|
151
|
+
}
|
|
140
152
|
/** What one consumed turn tells the caller. */
|
|
141
153
|
export interface TurnOutcome {
|
|
142
154
|
/** The session id from the `system/init` message, if one arrived. */
|
|
@@ -144,6 +156,22 @@ export interface TurnOutcome {
|
|
|
144
156
|
/** Whether the turn-end (`result`) message arrived. */
|
|
145
157
|
sawResult: boolean;
|
|
146
158
|
}
|
|
159
|
+
/** Per-turn liveness machinery. All callbacks are payload-free by contract. */
|
|
160
|
+
export interface ConsumeTurnControl {
|
|
161
|
+
idleTimeoutMs?: number;
|
|
162
|
+
/** Suppress provider-controlled payload telemetry while retaining liveness and
|
|
163
|
+
* structured failure categories for a recovery-enabled turn. */
|
|
164
|
+
sanitizeProviderTelemetry?: boolean;
|
|
165
|
+
abortController?: AbortController;
|
|
166
|
+
close?: () => void;
|
|
167
|
+
onActivity?: (activity: {
|
|
168
|
+
at: number;
|
|
169
|
+
deadlineAt: number;
|
|
170
|
+
}) => void;
|
|
171
|
+
now?: () => number;
|
|
172
|
+
setTimer?: (callback: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
173
|
+
clearTimer?: (timer: ReturnType<typeof setTimeout>) => void;
|
|
174
|
+
}
|
|
147
175
|
/**
|
|
148
176
|
* Drive the SDK message stream to TURN END and map it onto `AgentEvent`s.
|
|
149
177
|
*
|
|
@@ -163,6 +191,7 @@ export interface TurnOutcome {
|
|
|
163
191
|
* what it uses is what lets a fixture drive it. A live `Query` still satisfies
|
|
164
192
|
* the narrower type, so nothing at the call sites changes.
|
|
165
193
|
*/
|
|
166
|
-
export declare function consumeTurn(q: AsyncIterable<SDKMessage>, onEvent: (e: AgentEvent) => void, onInit?: (sessionId: string) => void, expectedSessionId?: string): Promise<TurnOutcome>;
|
|
194
|
+
export declare function consumeTurn(q: AsyncIterable<SDKMessage>, onEvent: (e: AgentEvent) => void, onInit?: (sessionId: string) => void, expectedSessionId?: string, control?: ConsumeTurnControl): Promise<TurnOutcome>;
|
|
167
195
|
export declare function startClaude(args: StartArgs, onEvent: (e: AgentEvent) => void, dependencies?: ClaudeStartDependencies): Promise<HarnessSessionRef>;
|
|
196
|
+
export declare function deliverClaude(ref: HarnessSessionRef, message: string, args: DeliverArgs, onEvent: (e: AgentEvent) => void, dependencies?: ClaudeDeliverDependencies): Promise<void>;
|
|
168
197
|
export declare const claudeAdapter: HarnessAdapter;
|