@titan-design/agent 0.2.0 → 0.4.0
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/README.md +53 -5
- package/dist/index.d.ts +139 -118
- package/dist/index.js +295 -98
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@ typed failure. A thin wrapper over the Claude Agent SDK's `query()` that adds th
|
|
|
5
5
|
three things a production caller always has to add itself: a scrubbed child
|
|
6
6
|
environment, mandatory circuit breakers, and a failure taxonomy you can branch on.
|
|
7
7
|
|
|
8
|
-
Tier 1 of the titan-platform DAG (TP-11). Depends on
|
|
9
|
-
`@anthropic-ai/claude-agent-sdk`; `zod` is a peer (v4).
|
|
8
|
+
Tier 1 of the titan-platform DAG (TP-11). Depends on `@titan-design/agent-protocol`,
|
|
9
|
+
`@titan-design/agent-lifecycle`, and `@anthropic-ai/claude-agent-sdk`; `zod` is a peer (v4).
|
|
10
10
|
|
|
11
11
|
## Run an agent
|
|
12
12
|
|
|
@@ -59,7 +59,9 @@ result to `options.env`. It never mutates its argument and never reads
|
|
|
59
59
|
|
|
60
60
|
Two guards sit either side of the run. `assertAuthEnvOk` is the pre-flight: it
|
|
61
61
|
refuses to start when the OAuth token is missing, or when a metered credential
|
|
62
|
-
survived the scrub. The
|
|
62
|
+
survived the scrub. The claude-print harness passes `requireOAuthToken: false`,
|
|
63
|
+
because the CLI's keychain login is its credential; the metered-credential check
|
|
64
|
+
still applies. The post-flight reads `apiKeySource` off the first
|
|
63
65
|
`system/init` message and ends the run as `auth_misconfigured` if it names the
|
|
64
66
|
env API-key path. That check is a **blacklist**, not a whitelist: the SDK's
|
|
65
67
|
`ApiKeySource` union grows over time, and an unknown new member is far more
|
|
@@ -104,8 +106,10 @@ with the total zeroed.
|
|
|
104
106
|
## Subagents and permissions
|
|
105
107
|
|
|
106
108
|
`agents`, `mcpServers`, `hooks`, `allowedTools`, `disallowedTools`, `model`,
|
|
107
|
-
`resumeSessionId` and `settingSources` pass straight through.
|
|
108
|
-
|
|
109
|
+
`resumeSessionId` and `settingSources` pass straight through. So do `tools`,
|
|
110
|
+
the built-in tool set (`[]` runs with no tools, for a pure judgement call), and
|
|
111
|
+
`systemPrompt`, which replaces the Claude Code default prompt. Leaving either
|
|
112
|
+
unset keeps the SDK default. Two defaults are chosen for headless safety:
|
|
109
113
|
|
|
110
114
|
- `permissionMode` defaults to `"dontAsk"`, so nothing runs that was not
|
|
111
115
|
pre-approved.
|
|
@@ -120,6 +124,50 @@ says. Prefer `allowedTools` wildcards over a permissive mode.
|
|
|
120
124
|
This package runs one session. It does not pool, schedule, or retry; that
|
|
121
125
|
belongs to the workflow tier.
|
|
122
126
|
|
|
127
|
+
## The claude-print harness
|
|
128
|
+
|
|
129
|
+
`harness: "claude-print"` makes `runAgent` spawn the `claude` CLI in print mode
|
|
130
|
+
instead of calling the SDK. Use it for one-turn structured answers, such as a
|
|
131
|
+
triage or judgement step, on a machine where the CLI is already logged in. The
|
|
132
|
+
CLI's own keychain login is the credential, so `CLAUDE_CODE_OAUTH_TOKEN` is not
|
|
133
|
+
required. `harness` defaults to `"claude-code"`, and the SDK path is unchanged.
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
const result = await runAgent({
|
|
137
|
+
harness: "claude-print",
|
|
138
|
+
model: "sonnet",
|
|
139
|
+
prompt: "Is this diff a refactor? Answer as JSON.",
|
|
140
|
+
outputSchema: z.object({ refactor: z.boolean() }),
|
|
141
|
+
cwd: process.cwd(),
|
|
142
|
+
maxTurns: 1,
|
|
143
|
+
maxBudgetUsd: 0.5,
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
| Aspect | claude-print behaviour |
|
|
148
|
+
|---|---|
|
|
149
|
+
| Binary | `CLAUDE_BIN`, else the first executable file named `claude` on the scrubbed env's `PATH`; never a shell function or alias |
|
|
150
|
+
| Fixed flags | `-p --output-format json --tools "" --strict-mcp-config --mcp-config '{"mcpServers":{}}' --setting-sources "" --max-turns 1 --max-budget-usd <maxBudgetUsd>` |
|
|
151
|
+
| Prompt | written to stdin, so large prompts avoid the argv size cap |
|
|
152
|
+
| `model` | `--model <model>` |
|
|
153
|
+
| `systemPrompt` | `--system-prompt <text>`, which replaces the default Claude Code prompt |
|
|
154
|
+
| `outputSchema` | `--json-schema <schema>` without the `$schema` header, which the CLI rejects; `structured_output` is then re-parsed with the zod schema and a mismatch is `schema_invalid` |
|
|
155
|
+
| `inactivityTimeoutMs` | a wall deadline, because JSON output arrives only at the end; SIGTERM to the process group, then SIGKILL after `CLAUDE_PRINT_KILL_GRACE_MS` |
|
|
156
|
+
| `signal` | kills the process group the same way and returns `aborted` |
|
|
157
|
+
| `allowApiKeyBilling` | same scrub as the SDK path: `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN` are stripped unless it is set |
|
|
158
|
+
| Result | the JSON result has the SDK result-message shape, so `classifyResult` and `usageFromResult` apply unchanged; `onMessage` receives that one message |
|
|
159
|
+
| `init` | only `model` is known, taken from `modelUsage`; the JSON output carries no init message, so there is no `apiKeySource` post-flight |
|
|
160
|
+
| Logged-out CLI | an error result that says to log in becomes `auth_misconfigured` |
|
|
161
|
+
| Rejected options | `tools` (other than `[]`), `allowedTools`, `disallowedTools`, `permissionMode`, `resumeSessionId`, `agents`, `mcpServers`, `hooks` and a non-empty `settingSources` throw a `TypeError` before anything spawns |
|
|
162
|
+
|
|
163
|
+
`claudePrintCapabilities()` reports the same limits in the shared capability
|
|
164
|
+
vocabulary: fresh runs, structured output, external cancellation and token
|
|
165
|
+
reporting are supported; resume, tools and every interactive capability are not.
|
|
166
|
+
There is no `HarnessAdapter<"claude-print">` yet, so `dispatchHarnessRun` and the
|
|
167
|
+
durable dispatcher cannot use it; claude-print is selectable only through `runAgent`.
|
|
168
|
+
Without `systemPrompt` the default Claude Code prompt costs about 7,600 input
|
|
169
|
+
tokens per call. A short `systemPrompt` brings that down to about 1,000.
|
|
170
|
+
|
|
123
171
|
## Explicit multi-harness contracts
|
|
124
172
|
|
|
125
173
|
`dispatchHarnessRun(request, adapter)` is the new, explicit contract for Claude
|
package/dist/index.d.ts
CHANGED
|
@@ -1,123 +1,13 @@
|
|
|
1
1
|
import { PermissionMode, AgentDefinition, McpServerConfig, HookEvent, HookCallbackMatcher, SettingSource, SDKMessage, ModelUsage, query, SDKResultMessage } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { ZodType, ZodError } from 'zod';
|
|
3
3
|
import { ConversationIdentity, ExecutionIdentity, UsageMeasurement, ExecutionRecord, ExecutionTerminal, AgentIdentity, ExecutionReconcileOutcome } from '@titan-design/agent-protocol';
|
|
4
4
|
import { ExecutionLedger } from '@titan-design/agent-lifecycle';
|
|
5
5
|
|
|
6
|
-
/** Why a run ended without a usable answer. One kind per recovery strategy. */
|
|
7
|
-
type AgentFailure = {
|
|
8
|
-
kind: "rate_limited";
|
|
9
|
-
reason: string;
|
|
10
|
-
retryAt?: Date;
|
|
11
|
-
raw?: unknown;
|
|
12
|
-
} | {
|
|
13
|
-
kind: "budget_exceeded";
|
|
14
|
-
reason: string;
|
|
15
|
-
raw?: unknown;
|
|
16
|
-
} | {
|
|
17
|
-
kind: "schema_invalid";
|
|
18
|
-
reason: string;
|
|
19
|
-
error?: ZodError;
|
|
20
|
-
raw?: unknown;
|
|
21
|
-
} | {
|
|
22
|
-
kind: "max_turns";
|
|
23
|
-
reason: string;
|
|
24
|
-
raw?: unknown;
|
|
25
|
-
} | {
|
|
26
|
-
kind: "refusal";
|
|
27
|
-
reason: string;
|
|
28
|
-
raw?: unknown;
|
|
29
|
-
} | {
|
|
30
|
-
kind: "auth_misconfigured";
|
|
31
|
-
reason: string;
|
|
32
|
-
hint?: string;
|
|
33
|
-
raw?: unknown;
|
|
34
|
-
} | {
|
|
35
|
-
kind: "runtime_error";
|
|
36
|
-
reason: string;
|
|
37
|
-
raw?: unknown;
|
|
38
|
-
} | {
|
|
39
|
-
kind: "aborted";
|
|
40
|
-
reason: string;
|
|
41
|
-
} | {
|
|
42
|
-
kind: "inactivity_timeout";
|
|
43
|
-
reason: string;
|
|
44
|
-
timeoutMs: number;
|
|
45
|
-
};
|
|
46
|
-
type AgentFailureKind = AgentFailure["kind"];
|
|
47
|
-
/** What the first `system/init` message told us about the session we actually got. */
|
|
48
|
-
interface AgentInit {
|
|
49
|
-
apiKeySource: string | undefined;
|
|
50
|
-
model: string | undefined;
|
|
51
|
-
tools: string[];
|
|
52
|
-
permissionMode: string | undefined;
|
|
53
|
-
claudeCodeVersion: string | undefined;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Client-side estimates. The SDK prices from a bundled table, so treat these as
|
|
57
|
-
* a budget signal and never as a billing statement.
|
|
58
|
-
*/
|
|
59
|
-
interface AgentUsage {
|
|
60
|
-
totalCostUsd: number;
|
|
61
|
-
modelUsage: Record<string, ModelUsage>;
|
|
62
|
-
turns: number;
|
|
63
|
-
durationMs: number;
|
|
64
|
-
}
|
|
65
|
-
interface AgentRunConfig<T = string> {
|
|
66
|
-
prompt: string;
|
|
67
|
-
cwd: string;
|
|
68
|
-
/** Required: the SDK's own default is unlimited. Must be positive. */
|
|
69
|
-
maxTurns: number;
|
|
70
|
-
/** Required: the SDK's own default is unlimited. Must be positive. */
|
|
71
|
-
maxBudgetUsd: number;
|
|
72
|
-
model?: string;
|
|
73
|
-
/** Turns on the SDK's `json_schema` output format, which retries on its own until the answer validates. */
|
|
74
|
-
outputSchema?: ZodType<T>;
|
|
75
|
-
allowedTools?: string[];
|
|
76
|
-
disallowedTools?: string[];
|
|
77
|
-
/** Defaults to `dontAsk`: nothing is pre-approved, so nothing runs unprompted. */
|
|
78
|
-
permissionMode?: PermissionMode;
|
|
79
|
-
resumeSessionId?: string;
|
|
80
|
-
agents?: Record<string, AgentDefinition>;
|
|
81
|
-
mcpServers?: Record<string, McpServerConfig>;
|
|
82
|
-
hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
|
|
83
|
-
signal?: AbortSignal;
|
|
84
|
-
/** Ends the run when no message arrives for this long. Defaults to 600_000. */
|
|
85
|
-
inactivityTimeoutMs?: number;
|
|
86
|
-
/** Keeps `ANTHROPIC_API_KEY` in the child env and bills the API account. */
|
|
87
|
-
allowApiKeyBilling?: boolean;
|
|
88
|
-
/** Defaults to `[]`: nothing is read off the filesystem unless asked for. */
|
|
89
|
-
settingSources?: SettingSource[];
|
|
90
|
-
onMessage?: (message: SDKMessage) => void;
|
|
91
|
-
}
|
|
92
|
-
type AgentRunResult<T = string> = {
|
|
93
|
-
ok: true;
|
|
94
|
-
output: T;
|
|
95
|
-
sessionId: string;
|
|
96
|
-
usage: AgentUsage;
|
|
97
|
-
init: AgentInit;
|
|
98
|
-
} | {
|
|
99
|
-
ok: false;
|
|
100
|
-
failure: AgentFailure;
|
|
101
|
-
sessionId?: string;
|
|
102
|
-
usage?: AgentUsage;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
declare const DEFAULT_INACTIVITY_MS = 600000;
|
|
106
|
-
interface AgentRunDeps {
|
|
107
|
-
/** Injection seam for tests; defaults to the SDK's own `query`. */
|
|
108
|
-
query?: typeof query;
|
|
109
|
-
/** Base environment to scrub; defaults to `process.env`. */
|
|
110
|
-
env?: NodeJS.ProcessEnv;
|
|
111
|
-
now?: () => number;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Run one headless Claude Code session to completion and return either its
|
|
115
|
-
* answer or a typed failure. Never throws for anything the agent does; the only
|
|
116
|
-
* throws are caller mistakes caught before the session starts.
|
|
117
|
-
*/
|
|
118
|
-
declare function runAgent<T = string>(config: AgentRunConfig<T>, deps?: AgentRunDeps): Promise<AgentRunResult<T>>;
|
|
119
|
-
|
|
120
6
|
type Harness = "claude-code" | "codex";
|
|
7
|
+
/** Harnesses `runAgent` can drive. `claude-print` is headless `claude -p` on the CLI's own login. */
|
|
8
|
+
type AgentRunHarness = "claude-code" | "claude-print";
|
|
9
|
+
/** `AgentRunConfig` fields claude-print cannot honour: it runs one turn with no tools, hooks, MCP or resume. */
|
|
10
|
+
declare const CLAUDE_PRINT_UNSUPPORTED_OPTIONS: readonly ["allowedTools", "disallowedTools", "permissionMode", "resumeSessionId", "agents", "mcpServers", "hooks"];
|
|
121
11
|
declare const CODEX_SANDBOXES: readonly ["read-only", "workspace-write", "danger-full-access"];
|
|
122
12
|
declare const CODEX_APPROVAL_POLICIES: readonly ["untrusted", "on-failure", "on-request", "never"];
|
|
123
13
|
type CodexSandbox = (typeof CODEX_SANDBOXES)[number];
|
|
@@ -148,7 +38,7 @@ interface LimitCapability {
|
|
|
148
38
|
assessment: CapabilityAssessment;
|
|
149
39
|
}
|
|
150
40
|
/** A factual report supplied by an adapter implementation, not a promise made by the core. */
|
|
151
|
-
interface HarnessCapabilityDescriptor<H extends
|
|
41
|
+
interface HarnessCapabilityDescriptor<H extends string = Harness> {
|
|
152
42
|
harness: H;
|
|
153
43
|
adapter: {
|
|
154
44
|
name: string;
|
|
@@ -318,6 +208,133 @@ interface HarnessAdapter<H extends Harness> {
|
|
|
318
208
|
run<T>(request: HarnessRunRequestFor<H, T>): Promise<HarnessRunResult<T, H>>;
|
|
319
209
|
}
|
|
320
210
|
|
|
211
|
+
/** Why a run ended without a usable answer. One kind per recovery strategy. */
|
|
212
|
+
type AgentFailure = {
|
|
213
|
+
kind: "rate_limited";
|
|
214
|
+
reason: string;
|
|
215
|
+
retryAt?: Date;
|
|
216
|
+
raw?: unknown;
|
|
217
|
+
} | {
|
|
218
|
+
kind: "budget_exceeded";
|
|
219
|
+
reason: string;
|
|
220
|
+
raw?: unknown;
|
|
221
|
+
} | {
|
|
222
|
+
kind: "schema_invalid";
|
|
223
|
+
reason: string;
|
|
224
|
+
error?: ZodError;
|
|
225
|
+
raw?: unknown;
|
|
226
|
+
} | {
|
|
227
|
+
kind: "max_turns";
|
|
228
|
+
reason: string;
|
|
229
|
+
raw?: unknown;
|
|
230
|
+
} | {
|
|
231
|
+
kind: "refusal";
|
|
232
|
+
reason: string;
|
|
233
|
+
raw?: unknown;
|
|
234
|
+
} | {
|
|
235
|
+
kind: "auth_misconfigured";
|
|
236
|
+
reason: string;
|
|
237
|
+
hint?: string;
|
|
238
|
+
raw?: unknown;
|
|
239
|
+
} | {
|
|
240
|
+
kind: "runtime_error";
|
|
241
|
+
reason: string;
|
|
242
|
+
raw?: unknown;
|
|
243
|
+
} | {
|
|
244
|
+
kind: "aborted";
|
|
245
|
+
reason: string;
|
|
246
|
+
} | {
|
|
247
|
+
kind: "inactivity_timeout";
|
|
248
|
+
reason: string;
|
|
249
|
+
timeoutMs: number;
|
|
250
|
+
};
|
|
251
|
+
type AgentFailureKind = AgentFailure["kind"];
|
|
252
|
+
/** What the first `system/init` message told us about the session we actually got. */
|
|
253
|
+
interface AgentInit {
|
|
254
|
+
apiKeySource: string | undefined;
|
|
255
|
+
model: string | undefined;
|
|
256
|
+
tools: string[];
|
|
257
|
+
permissionMode: string | undefined;
|
|
258
|
+
claudeCodeVersion: string | undefined;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Client-side estimates. The SDK prices from a bundled table, so treat these as
|
|
262
|
+
* a budget signal and never as a billing statement.
|
|
263
|
+
*/
|
|
264
|
+
interface AgentUsage {
|
|
265
|
+
totalCostUsd: number;
|
|
266
|
+
modelUsage: Record<string, ModelUsage>;
|
|
267
|
+
turns: number;
|
|
268
|
+
durationMs: number;
|
|
269
|
+
}
|
|
270
|
+
interface AgentRunConfig<T = string> {
|
|
271
|
+
/** Defaults to `claude-code` (the SDK). `claude-print` spawns `claude -p` and needs no `CLAUDE_CODE_OAUTH_TOKEN`. */
|
|
272
|
+
harness?: AgentRunHarness;
|
|
273
|
+
prompt: string;
|
|
274
|
+
cwd: string;
|
|
275
|
+
/** Required: the SDK's own default is unlimited. Must be positive. */
|
|
276
|
+
maxTurns: number;
|
|
277
|
+
/** Required: the SDK's own default is unlimited. Must be positive. */
|
|
278
|
+
maxBudgetUsd: number;
|
|
279
|
+
model?: string;
|
|
280
|
+
/** Turns on the SDK's `json_schema` output format, which retries on its own until the answer validates. */
|
|
281
|
+
outputSchema?: ZodType<T>;
|
|
282
|
+
/** The built-in tool set; `[]` runs with no tools at all. Omitted keeps the SDK default. */
|
|
283
|
+
tools?: string[];
|
|
284
|
+
allowedTools?: string[];
|
|
285
|
+
disallowedTools?: string[];
|
|
286
|
+
/** Replaces the SDK's default Claude Code system prompt. */
|
|
287
|
+
systemPrompt?: string;
|
|
288
|
+
/** Defaults to `dontAsk`: nothing is pre-approved, so nothing runs unprompted. */
|
|
289
|
+
permissionMode?: PermissionMode;
|
|
290
|
+
resumeSessionId?: string;
|
|
291
|
+
agents?: Record<string, AgentDefinition>;
|
|
292
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
293
|
+
hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
|
|
294
|
+
signal?: AbortSignal;
|
|
295
|
+
/** Ends the run when no message arrives for this long. Defaults to 600_000. */
|
|
296
|
+
inactivityTimeoutMs?: number;
|
|
297
|
+
/** Keeps `ANTHROPIC_API_KEY` in the child env and bills the API account. */
|
|
298
|
+
allowApiKeyBilling?: boolean;
|
|
299
|
+
/** Defaults to `[]`: nothing is read off the filesystem unless asked for. */
|
|
300
|
+
settingSources?: SettingSource[];
|
|
301
|
+
onMessage?: (message: SDKMessage) => void;
|
|
302
|
+
}
|
|
303
|
+
type AgentRunResult<T = string> = {
|
|
304
|
+
ok: true;
|
|
305
|
+
output: T;
|
|
306
|
+
sessionId: string;
|
|
307
|
+
usage: AgentUsage;
|
|
308
|
+
init: AgentInit;
|
|
309
|
+
} | {
|
|
310
|
+
ok: false;
|
|
311
|
+
failure: AgentFailure;
|
|
312
|
+
sessionId?: string;
|
|
313
|
+
usage?: AgentUsage;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
declare const DEFAULT_INACTIVITY_MS = 600000;
|
|
317
|
+
interface AgentRunDeps {
|
|
318
|
+
/** Injection seam for tests; defaults to the SDK's own `query`. */
|
|
319
|
+
query?: typeof query;
|
|
320
|
+
/** Base environment to scrub; defaults to `process.env`. */
|
|
321
|
+
env?: NodeJS.ProcessEnv;
|
|
322
|
+
now?: () => number;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Run one headless Claude Code session to completion and return either its
|
|
326
|
+
* answer or a typed failure. Never throws for anything the agent does; the only
|
|
327
|
+
* throws are caller mistakes caught before the session starts.
|
|
328
|
+
*/
|
|
329
|
+
declare function runAgent<T = string>(config: AgentRunConfig<T>, deps?: AgentRunDeps): Promise<AgentRunResult<T>>;
|
|
330
|
+
|
|
331
|
+
/** SIGTERM alone has been ignored by the CLI in the repo-review pipeline, so SIGKILL follows. */
|
|
332
|
+
declare const CLAUDE_PRINT_KILL_GRACE_MS = 5000;
|
|
333
|
+
declare function claudePrintCapabilities(): HarnessCapabilityDescriptor<"claude-print">;
|
|
334
|
+
/** The first executable file named `claude` on PATH, never a shell function or alias. `CLAUDE_BIN` wins. */
|
|
335
|
+
declare function resolveClaudeBin(env: Record<string, string>): string | undefined;
|
|
336
|
+
declare function buildClaudePrintArgs(config: AgentRunConfig<unknown>): string[];
|
|
337
|
+
|
|
321
338
|
declare function preflightHarnessRun<H extends Harness, T>(request: HarnessRunRequestFor<H, T>, descriptor: HarnessCapabilityDescriptor<H>): HarnessRunFailure | undefined;
|
|
322
339
|
declare function dispatchHarnessRun<H extends Harness, T>(request: HarnessRunRequestFor<H, T>, adapter: HarnessAdapter<H>): Promise<HarnessRunResult<T, H>>;
|
|
323
340
|
|
|
@@ -414,6 +431,10 @@ interface PrepareEnvOptions {
|
|
|
414
431
|
/** Leave `ANTHROPIC_API_KEY` / `ANTHROPIC_AUTH_TOKEN` in place and bill the API account. */
|
|
415
432
|
allowApiKeyBilling?: boolean;
|
|
416
433
|
}
|
|
434
|
+
interface AuthEnvCheckOptions extends PrepareEnvOptions {
|
|
435
|
+
/** Defaults to true. The claude-print harness sets it false: the CLI's own keychain login is its credential. */
|
|
436
|
+
requireOAuthToken?: boolean;
|
|
437
|
+
}
|
|
417
438
|
declare class AuthMisconfiguredError extends Error {
|
|
418
439
|
readonly hint: string | undefined;
|
|
419
440
|
constructor(message: string, hint?: string);
|
|
@@ -428,7 +449,7 @@ declare function prepareEnv(env?: NodeJS.ProcessEnv, options?: PrepareEnvOptions
|
|
|
428
449
|
* Pre-flight the scrubbed env so a misrouted run fails before it spends
|
|
429
450
|
* anything, rather than mid-stream with a surprise billing source.
|
|
430
451
|
*/
|
|
431
|
-
declare function assertAuthEnvOk(env: Record<string, string>, options?:
|
|
452
|
+
declare function assertAuthEnvOk(env: Record<string, string>, options?: AuthEnvCheckOptions): void;
|
|
432
453
|
/**
|
|
433
454
|
* Credential sources that mean the run went to metered API billing. A blacklist,
|
|
434
455
|
* not a whitelist: the SDK's `ApiKeySource` union grows, and an unrecognised new
|
|
@@ -521,4 +542,4 @@ interface ClaudeCodeAdapterOptions {
|
|
|
521
542
|
declare function createClaudeCodeAdapter(options: ClaudeCodeAdapterOptions): HarnessAdapter<"claude-code">;
|
|
522
543
|
declare function claudeCodeCapabilities(): HarnessCapabilityDescriptor<"claude-code">;
|
|
523
544
|
|
|
524
|
-
export { ANTI_NESTING_VARS, type AgentFailure, type AgentFailureKind, type AgentInit, type AgentRunConfig, type AgentRunDeps, type AgentRunResult, type AgentUsage, AuthMisconfiguredError, type BoundedRunBase, CLAUDE_CODE_PASSTHROUGH_VARS, CODEX_APPROVAL_POLICIES, CODEX_SANDBOXES, type CapabilityAssessment, type ClassifyOptions, type ClaudeCodeAdapterOptions, type ClaudeCodeNativeOptions, type ClaudeCodeRunRequest, type CodexApprovalPolicy, type CodexExecAdapterOptions, type CodexExecDeps, type CodexNativeOptions, type CodexOutputSchema, type CodexProcessExit, type CodexProcessInput, type CodexRunRequest, type CodexSandbox, type CodexSchemaFile, type CodexVersionInspectionOptions, DEFAULT_CODEX_EXECUTABLE, DEFAULT_CODEX_KILL_GRACE_MS, DEFAULT_INACTIVITY_MS, DEFAULT_MAX_RETRIES, type DurableCancelResult, type DurableDispatchAck, type DurableDispatchInput, type DurableHarnessDispatcher, type DurableHarnessDispatcherDeps, type DurableHarnessDispatcherOptions, type DurableHarnessRecord, type DurableHarnessSuccess, type DurableLiveHandle, type DurableReconcileOutcome, type DurableSettlement, EXECUTION_CAPABILITIES, type ExecutionCapability, type ExecutionLimit, FORBIDDEN_API_KEY_SOURCES, type Harness, type HarnessAdapter, type HarnessCapabilityDescriptor, type HarnessRunFailure, type HarnessRunOutput, type HarnessRunProgress, type HarnessRunRequest, type HarnessRunRequestFor, type HarnessRunResult, type LimitCapability, type LimitEnforcement, type LimitScope, type LimitUnit, type OptionalLimitUnit, type PrepareEnvOptions, type RunTarget, STRIPPED_AUTH_VARS, STRIPPED_CODEX_AUTH_VARS, STRIPPED_PROXY_VARS, SUPPORTED_CODEX_EXEC_VERSION, type SupervisedCodexProcess, type TranscriptSourceHint, assertApiKeySourceAllowed, assertAuthEnvOk, buildCodexExecArgs, classifyResult, claudeCodeCapabilities, codexExecCapabilities, createClaudeCodeAdapter, createCodexExecAdapter, createDurableHarnessDispatcher, dispatchHarnessRun, preflightHarnessRun, prepareCodexEnv, prepareEnv, runAgent, sumModelCost, usageFromResult };
|
|
545
|
+
export { ANTI_NESTING_VARS, type AgentFailure, type AgentFailureKind, type AgentInit, type AgentRunConfig, type AgentRunDeps, type AgentRunHarness, type AgentRunResult, type AgentUsage, type AuthEnvCheckOptions, AuthMisconfiguredError, type BoundedRunBase, CLAUDE_CODE_PASSTHROUGH_VARS, CLAUDE_PRINT_KILL_GRACE_MS, CLAUDE_PRINT_UNSUPPORTED_OPTIONS, CODEX_APPROVAL_POLICIES, CODEX_SANDBOXES, type CapabilityAssessment, type ClassifyOptions, type ClaudeCodeAdapterOptions, type ClaudeCodeNativeOptions, type ClaudeCodeRunRequest, type CodexApprovalPolicy, type CodexExecAdapterOptions, type CodexExecDeps, type CodexNativeOptions, type CodexOutputSchema, type CodexProcessExit, type CodexProcessInput, type CodexRunRequest, type CodexSandbox, type CodexSchemaFile, type CodexVersionInspectionOptions, DEFAULT_CODEX_EXECUTABLE, DEFAULT_CODEX_KILL_GRACE_MS, DEFAULT_INACTIVITY_MS, DEFAULT_MAX_RETRIES, type DurableCancelResult, type DurableDispatchAck, type DurableDispatchInput, type DurableHarnessDispatcher, type DurableHarnessDispatcherDeps, type DurableHarnessDispatcherOptions, type DurableHarnessRecord, type DurableHarnessSuccess, type DurableLiveHandle, type DurableReconcileOutcome, type DurableSettlement, EXECUTION_CAPABILITIES, type ExecutionCapability, type ExecutionLimit, FORBIDDEN_API_KEY_SOURCES, type Harness, type HarnessAdapter, type HarnessCapabilityDescriptor, type HarnessRunFailure, type HarnessRunOutput, type HarnessRunProgress, type HarnessRunRequest, type HarnessRunRequestFor, type HarnessRunResult, type LimitCapability, type LimitEnforcement, type LimitScope, type LimitUnit, type OptionalLimitUnit, type PrepareEnvOptions, type RunTarget, STRIPPED_AUTH_VARS, STRIPPED_CODEX_AUTH_VARS, STRIPPED_PROXY_VARS, SUPPORTED_CODEX_EXEC_VERSION, type SupervisedCodexProcess, type TranscriptSourceHint, assertApiKeySourceAllowed, assertAuthEnvOk, buildClaudePrintArgs, buildCodexExecArgs, classifyResult, claudeCodeCapabilities, claudePrintCapabilities, codexExecCapabilities, createClaudeCodeAdapter, createCodexExecAdapter, createDurableHarnessDispatcher, dispatchHarnessRun, preflightHarnessRun, prepareCodexEnv, prepareEnv, resolveClaudeBin, runAgent, sumModelCost, usageFromResult };
|