coding-agents-sdk 0.10.0 → 0.11.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.
Files changed (44) hide show
  1. package/README.md +8 -7
  2. package/dist/adapters/claude-code-cli/index.d.mts +1 -1
  3. package/dist/adapters/claude-code-cli-pty/index.d.mts +3 -0
  4. package/dist/adapters/claude-code-cli-pty/index.mjs +35 -0
  5. package/dist/adapters/claude-code-sdk/index.d.mts +1 -1
  6. package/dist/adapters/codex-cli/index.d.mts +1 -1
  7. package/dist/adapters/codex-sdk/index.d.mts +1 -1
  8. package/dist/adapters/cursor-cli/index.d.mts +1 -1
  9. package/dist/adapters/cursor-sdk/index.d.mts +1 -1
  10. package/dist/adapters/cursor-sdk/index.mjs +1 -1
  11. package/dist/adapters/gemini-cli/index.d.mts +1 -1
  12. package/dist/adapters/opencode-cli/index.d.mts +1 -1
  13. package/dist/adapters/pi-cli/index.d.mts +1 -1
  14. package/dist/container/index.d.mts +1 -1
  15. package/dist/{events-Dd9r9luo.d.mts → events-Bwfw__Q3.d.mts} +139 -0
  16. package/dist/index-B0x76PaA.d.mts +104 -0
  17. package/dist/{index-J7V9dJTb.d.mts → index-BQNj8DHq.d.mts} +46 -15
  18. package/dist/index-B_MIEnNS.d.mts +60 -0
  19. package/dist/index-BeejNCvc.d.mts +429 -0
  20. package/dist/index-C8wbKjj3.d.mts +188 -0
  21. package/dist/index-CEHYyi4k.d.mts +68 -0
  22. package/dist/{index-BNeL0BbU.d.mts → index-ClURbAqF.d.mts} +67 -1
  23. package/dist/index-CyxdNK5W.d.mts +58 -0
  24. package/dist/{index-DZDlHIep.d.mts → index-D5zrCo6s.d.mts} +43 -12
  25. package/dist/index-ILgtPW1P.d.mts +97 -0
  26. package/dist/index-dPV54_sZ.d.mts +69 -0
  27. package/dist/{index-B-rto_J2.d.mts → index-p8MJ49dZ.d.mts} +77 -1
  28. package/dist/index.d.mts +69 -19
  29. package/dist/index.mjs +1 -1
  30. package/dist/sandbox/index.d.mts +1 -1
  31. package/dist/schemas/index.d.mts +1 -1
  32. package/dist/types-Bk-YpdbX.d.mts +476 -0
  33. package/package.json +14 -14
  34. package/dist/adapters/claude-cli-pty/index.d.mts +0 -3
  35. package/dist/adapters/claude-cli-pty/index.mjs +0 -7
  36. package/dist/index-B4RAMnx_.d.mts +0 -46
  37. package/dist/index-BdDz7C4J.d.mts +0 -39
  38. package/dist/index-BiWkGgnz.d.mts +0 -46
  39. package/dist/index-BllemWbi.d.mts +0 -42
  40. package/dist/index-C7J_hmQs.d.mts +0 -67
  41. package/dist/index-CaUzD36R.d.mts +0 -42
  42. package/dist/index-D-8EmRnQ.d.mts +0 -85
  43. package/dist/index-lGZ1lQkG.d.mts +0 -246
  44. package/dist/types-D6kxBNzj.d.mts +0 -195
@@ -1,195 +0,0 @@
1
- import { t as AgentEvent, v as AgentCapabilities, x as JsonSchema, y as ContentPart } from "./events-Dd9r9luo.mjs";
2
- import { ZodType } from "zod/v4";
3
-
4
- //#region src/core/process/types.d.ts
5
- type StdioOption = "ignore" | "inherit" | "pipe" | number;
6
- type ProcessSignal = NodeJS.Signals;
7
- interface SpawnOptions {
8
- cwd?: string;
9
- env?: Record<string, string>;
10
- stdio?: [StdioOption, StdioOption, StdioOption];
11
- }
12
- interface ProcessResult {
13
- exitCode: number | null;
14
- signal: ProcessSignal | null;
15
- }
16
- interface AgentProcess {
17
- stdout: AsyncIterable<Uint8Array> | null;
18
- stderr: AsyncIterable<Uint8Array> | null;
19
- stdin: {
20
- write?: (chunk: Uint8Array | string) => void;
21
- end: () => void;
22
- } | null;
23
- kill: (signal?: ProcessSignal | number) => void;
24
- wait: () => Promise<ProcessResult>;
25
- }
26
- interface ProcessSpawner {
27
- spawn: (command: string, args: string[], options?: SpawnOptions) => AgentProcess;
28
- }
29
- //#endregion
30
- //#region src/core/agent/permissions.d.ts
31
- interface PermissionRequest {
32
- toolName: string;
33
- input: Record<string, unknown>;
34
- toolUseId: string;
35
- signal: AbortSignal;
36
- reason?: string;
37
- blockedPath?: string;
38
- title?: string;
39
- description?: string;
40
- }
41
- /**
42
- * Allow lets the call proceed; pass `updatedInput` to rewrite arguments before execution.
43
- * Deny blocks the call; `message` is sent back to the model as the rejection reason.
44
- */
45
- type PermissionDecision = {
46
- decision: "allow";
47
- updatedInput?: Record<string, unknown>;
48
- } | {
49
- decision: "deny";
50
- message?: string;
51
- };
52
- type PermissionHandler = (request: PermissionRequest) => PermissionDecision | Promise<PermissionDecision>;
53
- //#endregion
54
- //#region src/core/agent/types.d.ts
55
- type AgentType = "claude-cli-pty" | "claude-code-cli" | "claude-code-sdk" | "codex-cli" | "codex-sdk" | "cursor-cli" | "cursor-sdk" | "gemini-cli" | "opencode-cli" | "pi-cli";
56
- type RunStatus = "cancelled" | "completed" | "failed";
57
- type StopReason = "abort" | "timeout" | "user";
58
- interface RunStats {
59
- durationMs?: number;
60
- apiDurationMs?: number;
61
- turns: number;
62
- costUsd: number;
63
- inputTokens?: number;
64
- cacheCreationInputTokens?: number;
65
- cacheReadInputTokens?: number;
66
- outputTokens?: number;
67
- totalTokens?: number;
68
- }
69
- interface RunError {
70
- kind: "abort" | "parse" | "process" | "provider" | "spawn";
71
- message: string;
72
- }
73
- interface RunRequest {
74
- input: ContentPart[] | string;
75
- cwd?: string;
76
- model?: string;
77
- systemPrompt?: string;
78
- timeoutMs?: number;
79
- signal?: AbortSignal;
80
- }
81
- interface JsonSchemaRunRequest extends RunRequest {
82
- schema: JsonSchema;
83
- }
84
- interface ZodRunRequest<TOutput = unknown> extends RunRequest {
85
- schema: ZodType<TOutput>;
86
- }
87
- type StructuredRunRequest<TOutput = unknown> = JsonSchemaRunRequest | ZodRunRequest<TOutput>;
88
- type AnyRunRequest = RunRequest | StructuredRunRequest;
89
- interface RunTiming {
90
- startedAt: Date;
91
- endedAt: Date;
92
- durationMs: number;
93
- }
94
- interface RunProcessInfo {
95
- exitCode: number | null;
96
- signal: ProcessSignal | null;
97
- stderr: string;
98
- }
99
- interface RunResultBase {
100
- type: AgentType;
101
- runId: string;
102
- sessionId?: string;
103
- text: string;
104
- events: readonly AgentEvent[];
105
- stats?: RunStats;
106
- timing: RunTiming;
107
- process?: RunProcessInfo;
108
- }
109
- interface CancelledRunResult extends RunResultBase {
110
- status: "cancelled";
111
- output?: undefined;
112
- error: RunError;
113
- cancelReason: StopReason;
114
- }
115
- interface FailedRunResult extends RunResultBase {
116
- status: "failed";
117
- output?: undefined;
118
- error: RunError;
119
- cancelReason?: undefined;
120
- }
121
- type CompletedRunResult<TOutput = never> = RunResultBase & ([TOutput] extends [never] ? {} : {
122
- output: TOutput;
123
- }) & {
124
- status: "completed";
125
- error?: undefined;
126
- cancelReason?: undefined;
127
- };
128
- type RunResult<TOutput = never> = CancelledRunResult | CompletedRunResult<TOutput> | FailedRunResult;
129
- type AnyRunResult = RunResult | RunResult<unknown>;
130
- type AnyCompletedRunResult = CompletedRunResult | CompletedRunResult<unknown>;
131
- type AgentRun<TRunOptions extends object = {}> = {
132
- <TOutput>(request: TRunOptions & ZodRunRequest<TOutput>): Promise<RunResult<TOutput>>;
133
- (request: JsonSchemaRunRequest & TRunOptions): Promise<RunResult<unknown>>;
134
- (request: RunRequest & TRunOptions): Promise<RunResult>;
135
- };
136
- type AgentRunOrThrow<TRunOptions extends object = {}> = {
137
- <TOutput>(request: TRunOptions & ZodRunRequest<TOutput>): Promise<CompletedRunResult<TOutput>>;
138
- (request: JsonSchemaRunRequest & TRunOptions): Promise<CompletedRunResult<unknown>>;
139
- (request: RunRequest & TRunOptions): Promise<CompletedRunResult>;
140
- };
141
- declare class AgentRunError<TOutput = never> extends Error {
142
- readonly result: RunResult<TOutput> & {
143
- status: "cancelled" | "failed";
144
- };
145
- constructor(result: RunResult<TOutput> & {
146
- status: "cancelled" | "failed";
147
- });
148
- }
149
- declare class AgentValidationError extends Error {
150
- constructor(message: string);
151
- }
152
- type AgentEventHandler = (event: AgentEvent) => void;
153
- interface AgentMetrics {
154
- runCount: number;
155
- messagesReceived: number;
156
- toolCalls: number;
157
- errors: number;
158
- startedAt: Date;
159
- lastActivityAt: Date;
160
- }
161
- type EffectiveKeys<T> = keyof { [K in keyof T as Required<T>[K] extends never ? never : K]: unknown };
162
- type EnsureDisjoint<T extends object> = EffectiveKeys<T> & keyof RunRequest extends never ? T : never;
163
- type ExclusiveExecutionTargetOptions<TContainer, TSandbox> = {
164
- container?: never;
165
- sandbox?: TSandbox;
166
- } | {
167
- container?: TContainer;
168
- sandbox?: never;
169
- };
170
- interface BaseAgent<TRunOptions extends object = {}> {
171
- readonly type: AgentType;
172
- readonly capabilities: Readonly<AgentCapabilities>;
173
- readonly sessionId?: string;
174
- readonly isRunning: boolean;
175
- readonly metrics: Readonly<AgentMetrics>;
176
- run: AgentRun<TRunOptions>;
177
- runOrThrow: AgentRunOrThrow<TRunOptions>;
178
- stop: () => Promise<AnyRunResult | undefined>;
179
- reset: () => void;
180
- wait: () => Promise<AnyRunResult>;
181
- dispose: () => Promise<void>;
182
- [Symbol.asyncDispose]: () => Promise<void>;
183
- onEvent: (handler: AgentEventHandler) => () => void;
184
- /**
185
- * Register a single permission handler. The handler returns the decision directly —
186
- * no separate respond call is needed. Calling again replaces the previous handler.
187
- * Returns an unsubscribe function.
188
- *
189
- * Only effective when `capabilities.permissionRequests === true`. On adapters
190
- * without permission support the handler is stored but never invoked.
191
- */
192
- onPermissionRequest: (handler: PermissionHandler) => () => void;
193
- }
194
- //#endregion
195
- export { ProcessSpawner as A, RunTiming as C, PermissionDecision as D, ZodRunRequest as E, PermissionHandler as O, RunStatus as S, StructuredRunRequest as T, RunProcessInfo as _, AgentValidationError as a, RunResultBase as b, AnyRunResult as c, CompletedRunResult as d, EnsureDisjoint as f, RunError as g, JsonSchemaRunRequest as h, AgentType as i, PermissionRequest as k, BaseAgent as l, FailedRunResult as m, AgentMetrics as n, AnyCompletedRunResult as o, ExclusiveExecutionTargetOptions as p, AgentRunError as r, AnyRunRequest as s, AgentEventHandler as t, CancelledRunResult as u, RunRequest as v, StopReason as w, RunStats as x, RunResult as y };