@zpi-dev/agent-sdk 0.0.0-stage → 0.1.60
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/NOTICE +1206 -0
- package/README.md +54 -2
- package/dist/chunk-4WFFCN2C.js +29607 -0
- package/dist/chunk-4WFFCN2C.js.map +1 -0
- package/dist/chunk-AR5RMMMN.js +24353 -0
- package/dist/chunk-AR5RMMMN.js.map +1 -0
- package/dist/chunk-RAZL7ZAW.js +13451 -0
- package/dist/chunk-RAZL7ZAW.js.map +1 -0
- package/dist/chunk-TUOZKHGN.js +21 -0
- package/dist/chunk-TUOZKHGN.js.map +1 -0
- package/dist/chunk-YBW5XDR7.js +48 -0
- package/dist/chunk-YBW5XDR7.js.map +1 -0
- package/dist/host.d.ts +1 -0
- package/dist/host.js +34 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/node-WXHENNL2.js +21 -0
- package/dist/node-WXHENNL2.js.map +1 -0
- package/dist/node-XSTAMDFW.js +2225 -0
- package/dist/node-XSTAMDFW.js.map +1 -0
- package/dist/src-7WDJXP5P.js +128 -0
- package/dist/src-7WDJXP5P.js.map +1 -0
- package/dist/types/agent/src/agent-loop.d.ts +3 -0
- package/dist/types/agent/src/agent.d.ts +21 -0
- package/dist/types/agent/src/index.d.ts +3 -0
- package/dist/types/agent/src/streaming-tool-coordinator.d.ts +10 -0
- package/dist/types/agent/src/tool-execution.d.ts +9 -0
- package/dist/types/agent/src/types.d.ts +144 -0
- package/dist/types/agent-sdk/src/hooks.d.ts +12 -0
- package/dist/types/agent-sdk/src/host.d.ts +4 -0
- package/dist/types/agent-sdk/src/index.d.ts +4 -0
- package/dist/types/agent-sdk/src/messages.d.ts +12 -0
- package/dist/types/agent-sdk/src/permissions.d.ts +10 -0
- package/dist/types/agent-sdk/src/query-result.d.ts +7 -0
- package/dist/types/agent-sdk/src/query.d.ts +6 -0
- package/dist/types/agent-sdk/src/resources.d.ts +16 -0
- package/dist/types/agent-sdk/src/runtime.d.ts +7 -0
- package/dist/types/agent-sdk/src/sessions.d.ts +48 -0
- package/dist/types/agent-sdk/src/tasks.d.ts +8 -0
- package/dist/types/agent-sdk/src/tools.d.ts +5 -0
- package/dist/types/agent-sdk/src/types.d.ts +428 -0
- package/dist/types/ai/src/api/anthropic-messages.d.ts +70 -0
- package/dist/types/ai/src/api/constrained-sampling.d.ts +5 -0
- package/dist/types/ai/src/api/github-copilot-headers.d.ts +7 -0
- package/dist/types/ai/src/api/openai-completions.d.ts +10 -0
- package/dist/types/ai/src/api/openai-responses.d.ts +5 -0
- package/dist/types/ai/src/api/responses-cache.d.ts +6 -0
- package/dist/types/ai/src/api/responses-events.d.ts +3 -0
- package/dist/types/ai/src/api/responses-session.d.ts +56 -0
- package/dist/types/ai/src/api/simple-options.d.ts +14 -0
- package/dist/types/ai/src/api/transform-messages.d.ts +3 -0
- package/dist/types/ai/src/auth/openai-chatgpt.d.ts +32 -0
- package/dist/types/ai/src/index.d.ts +20 -0
- package/dist/types/ai/src/providers/discovery.d.ts +14 -0
- package/dist/types/ai/src/providers/registry.d.ts +155 -0
- package/dist/types/ai/src/stream.d.ts +5 -0
- package/dist/types/ai/src/types.d.ts +394 -0
- package/dist/types/ai/src/utils/abort.d.ts +2 -0
- package/dist/types/ai/src/utils/context-breakdown.d.ts +3 -0
- package/dist/types/ai/src/utils/cost.d.ts +2 -0
- package/dist/types/ai/src/utils/diagnostics.d.ts +16 -0
- package/dist/types/ai/src/utils/error-body.d.ts +24 -0
- package/dist/types/ai/src/utils/estimate.d.ts +16 -0
- package/dist/types/ai/src/utils/event-stream.d.ts +15 -0
- package/dist/types/ai/src/utils/guard-model-stream.d.ts +3 -0
- package/dist/types/ai/src/utils/headers.d.ts +1 -0
- package/dist/types/ai/src/utils/json-parse.d.ts +7 -0
- package/dist/types/ai/src/utils/media-policy.d.ts +68 -0
- package/dist/types/ai/src/utils/model-performance.d.ts +23 -0
- package/dist/types/ai/src/utils/model-retry.d.ts +3 -0
- package/dist/types/ai/src/utils/option-map/compiler.d.ts +2 -0
- package/dist/types/ai/src/utils/option-map/evaluator.d.ts +3 -0
- package/dist/types/ai/src/utils/option-map/parser.d.ts +40 -0
- package/dist/types/ai/src/utils/option-map/tokenizer.d.ts +8 -0
- package/dist/types/ai/src/utils/option-map/types.d.ts +15 -0
- package/dist/types/ai/src/utils/overflow.d.ts +68 -0
- package/dist/types/ai/src/utils/provider-cache.d.ts +11 -0
- package/dist/types/ai/src/utils/provider-env.d.ts +2 -0
- package/dist/types/ai/src/utils/provider-retry.d.ts +17 -0
- package/dist/types/ai/src/utils/reasoning.d.ts +14 -0
- package/dist/types/ai/src/utils/redact-error.d.ts +2 -0
- package/dist/types/ai/src/utils/retry.d.ts +62 -0
- package/dist/types/ai/src/utils/sanitize-unicode.d.ts +21 -0
- package/dist/types/ai/src/utils/stream-idle-timeout.d.ts +36 -0
- package/dist/types/ai/src/utils/text.d.ts +9 -0
- package/dist/types/ai/src/utils/transcript.d.ts +41 -0
- package/dist/types/coding-agent/src/core/agent-session.d.ts +174 -0
- package/dist/types/coding-agent/src/core/commands.d.ts +19 -0
- package/dist/types/coding-agent/src/core/compaction-utils.d.ts +37 -0
- package/dist/types/coding-agent/src/core/compaction.d.ts +139 -0
- package/dist/types/coding-agent/src/core/file-rewind.d.ts +24 -0
- package/dist/types/coding-agent/src/core/fs.d.ts +1 -0
- package/dist/types/coding-agent/src/core/http-idle-timeout.d.ts +2 -0
- package/dist/types/coding-agent/src/core/image-limits.d.ts +19 -0
- package/dist/types/coding-agent/src/core/images.d.ts +18 -0
- package/dist/types/coding-agent/src/core/input.d.ts +3 -0
- package/dist/types/coding-agent/src/core/markdown-code.d.ts +7 -0
- package/dist/types/coding-agent/src/core/markdown.d.ts +13 -0
- package/dist/types/coding-agent/src/core/mentions.d.ts +12 -0
- package/dist/types/coding-agent/src/core/microcompact.d.ts +40 -0
- package/dist/types/coding-agent/src/core/model-performance.d.ts +57 -0
- package/dist/types/coding-agent/src/core/model-runtime.d.ts +51 -0
- package/dist/types/coding-agent/src/core/read-file-bounded.d.ts +2 -0
- package/dist/types/coding-agent/src/core/record-validation.d.ts +6 -0
- package/dist/types/coding-agent/src/core/resources.d.ts +51 -0
- package/dist/types/coding-agent/src/core/sdk.d.ts +50 -0
- package/dist/types/coding-agent/src/core/session-manager.d.ts +137 -0
- package/dist/types/coding-agent/src/core/session-state.d.ts +14 -0
- package/dist/types/coding-agent/src/core/settings-manager.d.ts +41 -0
- package/dist/types/coding-agent/src/core/streaming-tool-journal.d.ts +17 -0
- package/dist/types/coding-agent/src/core/system-prompt.d.ts +25 -0
- package/dist/types/coding-agent/src/core/tools/file-change.d.ts +21 -0
- package/dist/types/coding-agent/src/core/tools/index.d.ts +20 -0
- package/dist/types/coding-agent/src/core/tools/pi/bash.d.ts +185 -0
- package/dist/types/coding-agent/src/core/tools/pi/edit-diff.d.ts +84 -0
- package/dist/types/coding-agent/src/core/tools/pi/edit.d.ts +69 -0
- package/dist/types/coding-agent/src/core/tools/pi/file-mutation-queue.d.ts +5 -0
- package/dist/types/coding-agent/src/core/tools/pi/file-read-state.d.ts +12 -0
- package/dist/types/coding-agent/src/core/tools/pi/output-accumulator.d.ts +68 -0
- package/dist/types/coding-agent/src/core/tools/pi/path-utils.d.ts +7 -0
- package/dist/types/coding-agent/src/core/tools/pi/read.d.ts +63 -0
- package/dist/types/coding-agent/src/core/tools/pi/text-range-reader.d.ts +22 -0
- package/dist/types/coding-agent/src/core/tools/pi/tool-definition-wrapper.d.ts +4 -0
- package/dist/types/coding-agent/src/core/tools/pi/truncate.d.ts +60 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/bmp-source.d.ts +2 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/child-process.d.ts +13 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-budget.d.ts +16 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-process.d.ts +18 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-resize-core.d.ts +26 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-resize.d.ts +3 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-source.d.ts +11 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/mime.d.ts +3 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/paths.d.ts +16 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/read-file.d.ts +2 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/shell.d.ts +18 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/text.d.ts +5 -0
- package/dist/types/coding-agent/src/core/tools/pi/write.d.ts +44 -0
- package/dist/types/coding-agent/src/core/transcript-store.d.ts +71 -0
- package/dist/types/coding-agent/src/core/types.d.ts +60 -0
- package/dist/types/coding-agent/src/index.d.ts +42 -0
- package/dist/types/coding-agent/src/plugins/assembly.d.ts +37 -0
- package/dist/types/coding-agent/src/plugins/hooks.d.ts +82 -0
- package/dist/types/coding-agent/src/plugins/resources.d.ts +4 -0
- package/dist/types/coding-agent/src/plugins/session-hooks.d.ts +26 -0
- package/dist/types/coding-agent/src/plugins/types.d.ts +40 -0
- package/dist/types/plugin-compat/src/command-hooks.d.ts +184 -0
- package/dist/types/plugin-compat/src/index.d.ts +11 -0
- package/package.json +53 -4
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import type { AgentSession, InputContext, ModelRuntime, ParsedInput, ProviderConfigInput, ResourceLoader, SessionManager, SessionPlugin, ToolDefinition } from "../../coding-agent/src/index.js";
|
|
2
|
+
export type UUID = string;
|
|
3
|
+
export type Effort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
4
|
+
export type ThinkingConfig = {
|
|
5
|
+
type: "disabled";
|
|
6
|
+
} | {
|
|
7
|
+
type: "adaptive";
|
|
8
|
+
} | {
|
|
9
|
+
type: "enabled";
|
|
10
|
+
budgetTokens?: number;
|
|
11
|
+
};
|
|
12
|
+
export type TextBlock = {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
export type ThinkingBlock = {
|
|
17
|
+
type: "thinking";
|
|
18
|
+
thinking: string;
|
|
19
|
+
signature: string;
|
|
20
|
+
};
|
|
21
|
+
export type ToolUseBlock = {
|
|
22
|
+
type: "tool_use";
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
input: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
export type ImageBlock = {
|
|
28
|
+
type: "image";
|
|
29
|
+
source: {
|
|
30
|
+
type: "base64";
|
|
31
|
+
media_type: string;
|
|
32
|
+
data: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type ToolResultBlock = {
|
|
36
|
+
type: "tool_result";
|
|
37
|
+
tool_use_id: string;
|
|
38
|
+
content: string | (TextBlock | ImageBlock)[];
|
|
39
|
+
is_error?: boolean;
|
|
40
|
+
};
|
|
41
|
+
export type ContentBlock = TextBlock | ThinkingBlock | ToolUseBlock | ToolResultBlock | ImageBlock;
|
|
42
|
+
export interface Usage {
|
|
43
|
+
input_tokens: number;
|
|
44
|
+
output_tokens: number;
|
|
45
|
+
cache_creation_input_tokens: number;
|
|
46
|
+
cache_read_input_tokens: number;
|
|
47
|
+
server_tool_use: {
|
|
48
|
+
web_search_requests: number;
|
|
49
|
+
web_fetch_requests: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface ModelUsage {
|
|
53
|
+
inputTokens: number;
|
|
54
|
+
outputTokens: number;
|
|
55
|
+
cacheReadInputTokens: number;
|
|
56
|
+
cacheCreationInputTokens: number;
|
|
57
|
+
webSearchRequests: number;
|
|
58
|
+
costUSD: number;
|
|
59
|
+
contextWindow: number;
|
|
60
|
+
maxOutputTokens: number;
|
|
61
|
+
}
|
|
62
|
+
export interface SDKUserMessage {
|
|
63
|
+
type: "user";
|
|
64
|
+
uuid?: UUID;
|
|
65
|
+
session_id?: string;
|
|
66
|
+
parent_tool_use_id: string | null;
|
|
67
|
+
message: {
|
|
68
|
+
role: "user";
|
|
69
|
+
content: string | (TextBlock | ImageBlock | ToolResultBlock)[];
|
|
70
|
+
};
|
|
71
|
+
isSynthetic?: boolean;
|
|
72
|
+
tool_use_result?: unknown;
|
|
73
|
+
}
|
|
74
|
+
export interface SDKAssistantMessage {
|
|
75
|
+
type: "assistant";
|
|
76
|
+
uuid: UUID;
|
|
77
|
+
session_id: string;
|
|
78
|
+
parent_tool_use_id: string | null;
|
|
79
|
+
message: {
|
|
80
|
+
id: string;
|
|
81
|
+
type: "message";
|
|
82
|
+
role: "assistant";
|
|
83
|
+
model: string;
|
|
84
|
+
content: (TextBlock | ThinkingBlock | ToolUseBlock)[];
|
|
85
|
+
stop_reason: "end_turn" | "tool_use" | "max_tokens" | null;
|
|
86
|
+
stop_sequence: string | null;
|
|
87
|
+
usage: Usage;
|
|
88
|
+
};
|
|
89
|
+
error?: "unknown" | "authentication_failed" | "rate_limit" | "server_error";
|
|
90
|
+
aborted?: true;
|
|
91
|
+
}
|
|
92
|
+
export interface SDKSystemMessage {
|
|
93
|
+
type: "system";
|
|
94
|
+
subtype: "init";
|
|
95
|
+
uuid: UUID;
|
|
96
|
+
session_id: string;
|
|
97
|
+
cwd: string;
|
|
98
|
+
tools: string[];
|
|
99
|
+
model: string;
|
|
100
|
+
apiKeySource: "user" | "env";
|
|
101
|
+
claude_code_version: string;
|
|
102
|
+
mcp_servers: never[];
|
|
103
|
+
slash_commands: string[];
|
|
104
|
+
output_style: string;
|
|
105
|
+
skills: string[];
|
|
106
|
+
plugins: {
|
|
107
|
+
name: string;
|
|
108
|
+
path: string;
|
|
109
|
+
}[];
|
|
110
|
+
agents?: string[];
|
|
111
|
+
capabilities?: string[];
|
|
112
|
+
}
|
|
113
|
+
export type RawStreamEvent = {
|
|
114
|
+
type: "message_start";
|
|
115
|
+
message: SDKAssistantMessage["message"];
|
|
116
|
+
} | {
|
|
117
|
+
type: "content_block_start";
|
|
118
|
+
index: number;
|
|
119
|
+
content_block: TextBlock | ThinkingBlock | ToolUseBlock;
|
|
120
|
+
} | {
|
|
121
|
+
type: "content_block_delta";
|
|
122
|
+
index: number;
|
|
123
|
+
delta: {
|
|
124
|
+
type: "text_delta";
|
|
125
|
+
text: string;
|
|
126
|
+
} | {
|
|
127
|
+
type: "thinking_delta";
|
|
128
|
+
thinking: string;
|
|
129
|
+
} | {
|
|
130
|
+
type: "input_json_delta";
|
|
131
|
+
partial_json: string;
|
|
132
|
+
};
|
|
133
|
+
} | {
|
|
134
|
+
type: "content_block_stop";
|
|
135
|
+
index: number;
|
|
136
|
+
} | {
|
|
137
|
+
type: "message_delta";
|
|
138
|
+
delta: {
|
|
139
|
+
stop_reason: SDKAssistantMessage["message"]["stop_reason"];
|
|
140
|
+
stop_sequence: null;
|
|
141
|
+
};
|
|
142
|
+
usage: Usage;
|
|
143
|
+
} | {
|
|
144
|
+
type: "message_stop";
|
|
145
|
+
};
|
|
146
|
+
export interface SDKPartialAssistantMessage {
|
|
147
|
+
type: "stream_event";
|
|
148
|
+
event: RawStreamEvent;
|
|
149
|
+
uuid: UUID;
|
|
150
|
+
session_id: string;
|
|
151
|
+
parent_tool_use_id: string | null;
|
|
152
|
+
}
|
|
153
|
+
export interface SDKPermissionDenial {
|
|
154
|
+
tool_name: string;
|
|
155
|
+
tool_use_id: string;
|
|
156
|
+
tool_input: Record<string, unknown>;
|
|
157
|
+
}
|
|
158
|
+
interface ResultBase {
|
|
159
|
+
type: "result";
|
|
160
|
+
uuid: UUID;
|
|
161
|
+
session_id: string;
|
|
162
|
+
duration_ms: number;
|
|
163
|
+
duration_api_ms: number;
|
|
164
|
+
num_turns: number;
|
|
165
|
+
is_error: boolean;
|
|
166
|
+
stop_reason: string | null;
|
|
167
|
+
total_cost_usd: number;
|
|
168
|
+
usage: Usage;
|
|
169
|
+
modelUsage: Record<string, ModelUsage>;
|
|
170
|
+
permission_denials: SDKPermissionDenial[];
|
|
171
|
+
}
|
|
172
|
+
export type SDKResultMessage = ResultBase & ({
|
|
173
|
+
subtype: "success";
|
|
174
|
+
result: string;
|
|
175
|
+
structured_output?: unknown;
|
|
176
|
+
} | {
|
|
177
|
+
subtype: "error_max_turns" | "error_during_execution" | "error_max_budget_usd" | "error_max_structured_output_retries";
|
|
178
|
+
errors: string[];
|
|
179
|
+
});
|
|
180
|
+
export type HookEvent = "SessionStart" | "SessionEnd" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact";
|
|
181
|
+
export interface BaseHookInput {
|
|
182
|
+
session_id: string;
|
|
183
|
+
transcript_path: string;
|
|
184
|
+
cwd: string;
|
|
185
|
+
}
|
|
186
|
+
export interface SessionStartHookInput extends BaseHookInput {
|
|
187
|
+
hook_event_name: "SessionStart";
|
|
188
|
+
source: string;
|
|
189
|
+
}
|
|
190
|
+
export interface SessionEndHookInput extends BaseHookInput {
|
|
191
|
+
hook_event_name: "SessionEnd";
|
|
192
|
+
reason: string;
|
|
193
|
+
}
|
|
194
|
+
export interface UserPromptSubmitHookInput extends BaseHookInput {
|
|
195
|
+
hook_event_name: "UserPromptSubmit";
|
|
196
|
+
prompt: string;
|
|
197
|
+
}
|
|
198
|
+
export interface PreToolUseHookInput extends BaseHookInput {
|
|
199
|
+
hook_event_name: "PreToolUse";
|
|
200
|
+
tool_name: string;
|
|
201
|
+
tool_input: Record<string, unknown>;
|
|
202
|
+
tool_use_id: string;
|
|
203
|
+
}
|
|
204
|
+
export interface PostToolUseHookInput extends Omit<PreToolUseHookInput, "hook_event_name"> {
|
|
205
|
+
hook_event_name: "PostToolUse";
|
|
206
|
+
tool_response: unknown;
|
|
207
|
+
}
|
|
208
|
+
export interface PostToolUseFailureHookInput extends Omit<PreToolUseHookInput, "hook_event_name"> {
|
|
209
|
+
hook_event_name: "PostToolUseFailure";
|
|
210
|
+
error: string;
|
|
211
|
+
}
|
|
212
|
+
export interface StopHookInput extends BaseHookInput {
|
|
213
|
+
hook_event_name: "Stop";
|
|
214
|
+
stop_hook_active: boolean;
|
|
215
|
+
last_assistant_message?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface SubagentStartHookInput extends BaseHookInput {
|
|
218
|
+
hook_event_name: "SubagentStart";
|
|
219
|
+
agent_id: string;
|
|
220
|
+
agent_type: string;
|
|
221
|
+
}
|
|
222
|
+
export interface SubagentStopHookInput extends Omit<SubagentStartHookInput, "hook_event_name"> {
|
|
223
|
+
hook_event_name: "SubagentStop";
|
|
224
|
+
stop_hook_active: boolean;
|
|
225
|
+
last_assistant_message?: string;
|
|
226
|
+
}
|
|
227
|
+
export interface PreCompactHookInput extends BaseHookInput {
|
|
228
|
+
hook_event_name: "PreCompact";
|
|
229
|
+
trigger: "manual" | "auto";
|
|
230
|
+
custom_instructions: string;
|
|
231
|
+
}
|
|
232
|
+
export interface PostCompactHookInput extends Omit<PreCompactHookInput, "hook_event_name"> {
|
|
233
|
+
hook_event_name: "PostCompact";
|
|
234
|
+
}
|
|
235
|
+
export type HookInput = SessionStartHookInput | SessionEndHookInput | UserPromptSubmitHookInput | PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | StopHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput;
|
|
236
|
+
export interface SyncHookJSONOutput {
|
|
237
|
+
continue?: boolean;
|
|
238
|
+
stopReason?: string;
|
|
239
|
+
decision?: "approve" | "block";
|
|
240
|
+
reason?: string;
|
|
241
|
+
suppressOutput?: boolean;
|
|
242
|
+
systemMessage?: string;
|
|
243
|
+
hookSpecificOutput?: {
|
|
244
|
+
hookEventName: HookEvent;
|
|
245
|
+
additionalContext?: string;
|
|
246
|
+
updatedInput?: Record<string, unknown>;
|
|
247
|
+
permissionDecision?: "allow" | "deny" | "ask";
|
|
248
|
+
permissionDecisionReason?: string;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
export type HookJSONOutput = SyncHookJSONOutput;
|
|
252
|
+
export type HookCallback = (input: HookInput, toolUseID: string | undefined, options: {
|
|
253
|
+
signal: AbortSignal;
|
|
254
|
+
}) => Promise<HookJSONOutput>;
|
|
255
|
+
export interface HookCallbackMatcher {
|
|
256
|
+
matcher?: string;
|
|
257
|
+
hooks: HookCallback[];
|
|
258
|
+
timeout?: number;
|
|
259
|
+
onFailure?: "continue" | "block";
|
|
260
|
+
}
|
|
261
|
+
export type PermissionResult = {
|
|
262
|
+
behavior: "allow";
|
|
263
|
+
updatedInput?: Record<string, unknown>;
|
|
264
|
+
} | {
|
|
265
|
+
behavior: "deny";
|
|
266
|
+
message: string;
|
|
267
|
+
interrupt?: boolean;
|
|
268
|
+
};
|
|
269
|
+
export type CanUseTool = (toolName: string, input: Record<string, unknown>, options: {
|
|
270
|
+
signal: AbortSignal;
|
|
271
|
+
toolUseID: string;
|
|
272
|
+
requestId: string;
|
|
273
|
+
agentID?: string;
|
|
274
|
+
}) => Promise<PermissionResult | null>;
|
|
275
|
+
export interface AgentDefinition {
|
|
276
|
+
description: string;
|
|
277
|
+
prompt: string;
|
|
278
|
+
tools?: string[];
|
|
279
|
+
disallowedTools?: string[];
|
|
280
|
+
model?: string;
|
|
281
|
+
maxTurns?: number;
|
|
282
|
+
effort?: Effort;
|
|
283
|
+
skills?: string[];
|
|
284
|
+
}
|
|
285
|
+
export interface SdkPluginConfig {
|
|
286
|
+
type: "local";
|
|
287
|
+
path: string;
|
|
288
|
+
}
|
|
289
|
+
export interface ZpiOptions {
|
|
290
|
+
requestOptions?: import("../../ai/src/index.js").SimpleStreamOptions | (() => import("../../ai/src/index.js").SimpleStreamOptions);
|
|
291
|
+
modelRuntime?: ModelRuntime;
|
|
292
|
+
providers?: Record<string, ProviderConfigInput>;
|
|
293
|
+
fetch?: typeof fetch;
|
|
294
|
+
agentDir?: string;
|
|
295
|
+
plugins?: readonly SessionPlugin[];
|
|
296
|
+
customTools?: readonly ToolDefinition[];
|
|
297
|
+
resourceLoader?: ResourceLoader;
|
|
298
|
+
/** Advanced host-owned session; preserves indexed history and native tool/plugin contracts. */
|
|
299
|
+
session?: AgentSession;
|
|
300
|
+
sessionManager?: SessionManager;
|
|
301
|
+
input?: {
|
|
302
|
+
parsed: ParsedInput;
|
|
303
|
+
context: InputContext;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
export interface Options {
|
|
307
|
+
cwd?: string;
|
|
308
|
+
model?: string;
|
|
309
|
+
abortController?: AbortController;
|
|
310
|
+
env?: Record<string, string | undefined>;
|
|
311
|
+
tools?: string[] | {
|
|
312
|
+
type: "preset";
|
|
313
|
+
preset: "claude_code";
|
|
314
|
+
};
|
|
315
|
+
allowedTools?: string[];
|
|
316
|
+
disallowedTools?: string[];
|
|
317
|
+
canUseTool?: CanUseTool;
|
|
318
|
+
systemPrompt?: string | string[] | {
|
|
319
|
+
type: "custom";
|
|
320
|
+
prompt: string | string[];
|
|
321
|
+
} | {
|
|
322
|
+
type: "preset";
|
|
323
|
+
preset: "claude_code";
|
|
324
|
+
append?: string;
|
|
325
|
+
};
|
|
326
|
+
thinking?: ThinkingConfig;
|
|
327
|
+
effort?: Effort;
|
|
328
|
+
maxThinkingTokens?: number;
|
|
329
|
+
maxTurns?: number;
|
|
330
|
+
maxBudgetUsd?: number;
|
|
331
|
+
includePartialMessages?: boolean;
|
|
332
|
+
forwardSubagentText?: boolean;
|
|
333
|
+
includeHookEvents?: boolean;
|
|
334
|
+
hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
|
|
335
|
+
persistSession?: boolean;
|
|
336
|
+
resume?: string;
|
|
337
|
+
continue?: boolean;
|
|
338
|
+
forkSession?: boolean;
|
|
339
|
+
resumeSessionAt?: string;
|
|
340
|
+
sessionId?: string;
|
|
341
|
+
title?: string;
|
|
342
|
+
outputFormat?: {
|
|
343
|
+
type: "json_schema";
|
|
344
|
+
schema: Record<string, unknown>;
|
|
345
|
+
};
|
|
346
|
+
agents?: Record<string, AgentDefinition>;
|
|
347
|
+
agent?: string;
|
|
348
|
+
plugins?: SdkPluginConfig[];
|
|
349
|
+
skills?: string[] | "all";
|
|
350
|
+
settingSources?: ("user" | "project" | "local")[];
|
|
351
|
+
enableFileCheckpointing?: boolean;
|
|
352
|
+
zpi?: ZpiOptions;
|
|
353
|
+
}
|
|
354
|
+
export interface SDKHookResponseMessage {
|
|
355
|
+
type: "system";
|
|
356
|
+
subtype: "hook_response";
|
|
357
|
+
uuid: string;
|
|
358
|
+
session_id: string;
|
|
359
|
+
hook_id: string;
|
|
360
|
+
hook_name: string;
|
|
361
|
+
hook_event: string;
|
|
362
|
+
output: string;
|
|
363
|
+
stdout: string;
|
|
364
|
+
stderr: string;
|
|
365
|
+
exit_code: number;
|
|
366
|
+
outcome: "success" | "error" | "cancelled";
|
|
367
|
+
}
|
|
368
|
+
export interface SDKCompactBoundaryMessage {
|
|
369
|
+
type: "system";
|
|
370
|
+
subtype: "compact_boundary";
|
|
371
|
+
uuid: string;
|
|
372
|
+
session_id: string;
|
|
373
|
+
compact_metadata: {
|
|
374
|
+
trigger: "manual" | "auto";
|
|
375
|
+
pre_tokens: number;
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
export type SDKMessage = SDKUserMessage | SDKAssistantMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKResultMessage | SDKHookResponseMessage | SDKCompactBoundaryMessage;
|
|
379
|
+
export interface SlashCommand {
|
|
380
|
+
name: string;
|
|
381
|
+
description: string;
|
|
382
|
+
argumentHint: string;
|
|
383
|
+
}
|
|
384
|
+
export interface ModelInfo {
|
|
385
|
+
value: string;
|
|
386
|
+
displayName: string;
|
|
387
|
+
description: string;
|
|
388
|
+
supportsEffort?: boolean;
|
|
389
|
+
supportedEffortLevels?: Effort[];
|
|
390
|
+
}
|
|
391
|
+
export interface AgentInfo {
|
|
392
|
+
name: string;
|
|
393
|
+
description: string;
|
|
394
|
+
model?: string;
|
|
395
|
+
}
|
|
396
|
+
export interface SDKControlInitializeResponse {
|
|
397
|
+
commands: SlashCommand[];
|
|
398
|
+
models: ModelInfo[];
|
|
399
|
+
agents: AgentInfo[];
|
|
400
|
+
account: {
|
|
401
|
+
apiKeySource: string;
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
export interface RewindFilesResult {
|
|
405
|
+
canRewind: boolean;
|
|
406
|
+
error?: string;
|
|
407
|
+
filesChanged?: string[];
|
|
408
|
+
insertions?: number;
|
|
409
|
+
deletions?: number;
|
|
410
|
+
}
|
|
411
|
+
export interface SDKControlInterruptResponse {
|
|
412
|
+
still_queued: string[];
|
|
413
|
+
cancelled?: string[];
|
|
414
|
+
}
|
|
415
|
+
export interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
416
|
+
interrupt(): Promise<SDKControlInterruptResponse | undefined>;
|
|
417
|
+
setModel(model?: string): Promise<void>;
|
|
418
|
+
setMaxThinkingTokens(maxThinkingTokens: number | null): Promise<void>;
|
|
419
|
+
supportedCommands(): Promise<SlashCommand[]>;
|
|
420
|
+
supportedModels(): Promise<ModelInfo[]>;
|
|
421
|
+
supportedAgents(): Promise<AgentInfo[]>;
|
|
422
|
+
initializationResult(): Promise<SDKControlInitializeResponse>;
|
|
423
|
+
rewindFiles(userMessageId: string, options?: {
|
|
424
|
+
dryRun?: boolean;
|
|
425
|
+
}): Promise<RewindFilesResult>;
|
|
426
|
+
close(): void;
|
|
427
|
+
}
|
|
428
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
2
|
+
import type { SimpleStreamOptions, StreamFunction, StreamOptions } from "../types.js";
|
|
3
|
+
export type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
4
|
+
export type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
5
|
+
export interface AnthropicOptions extends StreamOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Enable extended thinking.
|
|
8
|
+
* For adaptive thinking models: the model decides when/how much to think.
|
|
9
|
+
* For older models: uses budget-based thinking with thinkingBudgetTokens.
|
|
10
|
+
* Default: undefined (thinking is omitted unless `streamSimple()` maps
|
|
11
|
+
* a simple reasoning level to this option, or callers set it explicitly).
|
|
12
|
+
*/
|
|
13
|
+
thinkingEnabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Token budget for extended thinking (older models only).
|
|
16
|
+
* Ignored for adaptive thinking models.
|
|
17
|
+
* Default: 1024 when `thinkingEnabled` is true and no budget is provided.
|
|
18
|
+
*/
|
|
19
|
+
thinkingBudgetTokens?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Effort level for adaptive thinking models.
|
|
22
|
+
* Controls how much thinking Claude allocates:
|
|
23
|
+
* - "max": Always thinks with no constraints (Opus 4.6 only)
|
|
24
|
+
* - "xhigh": Highest reasoning level (Opus 4.7+, Fable 5)
|
|
25
|
+
* - "high": Always thinks, deep reasoning
|
|
26
|
+
* - "medium": Moderate thinking, may skip for simple queries
|
|
27
|
+
* - "low": Minimal thinking, skips for simple tasks
|
|
28
|
+
* Ignored for older models.
|
|
29
|
+
* Default: omitted unless `streamSimple()` maps a simple reasoning
|
|
30
|
+
* level to this option.
|
|
31
|
+
*/
|
|
32
|
+
effort?: AnthropicEffort;
|
|
33
|
+
/**
|
|
34
|
+
* Controls how thinking content is returned in API responses.
|
|
35
|
+
* - "summarized": Thinking blocks contain summarized thinking text.
|
|
36
|
+
* - "omitted": Thinking blocks return an empty thinking field; the encrypted
|
|
37
|
+
* signature still travels back for multi-turn continuity. Use for faster
|
|
38
|
+
* time-to-first-text-token when your UI does not surface thinking.
|
|
39
|
+
*
|
|
40
|
+
* Note: Anthropic's API default for Claude Opus 4.7 and Claude Mythos Preview
|
|
41
|
+
* is "omitted". We default to "summarized" here to keep behavior consistent
|
|
42
|
+
* with older Claude 4 models. Set this explicitly to "omitted" to opt in.
|
|
43
|
+
* Default: "summarized" when thinking is enabled.
|
|
44
|
+
*/
|
|
45
|
+
thinkingDisplay?: AnthropicThinkingDisplay;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to request the interleaved thinking beta header for non-adaptive
|
|
48
|
+
* thinking models. Adaptive thinking models have interleaved thinking built in,
|
|
49
|
+
* so the header is skipped for them regardless of this setting.
|
|
50
|
+
* Default: true.
|
|
51
|
+
*/
|
|
52
|
+
interleavedThinking?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Anthropic tool choice behavior. String values map to Anthropic's built-in
|
|
55
|
+
* choices; `{ type: "tool", name }` forces a specific tool.
|
|
56
|
+
* Default: omitted (Anthropic default behavior, currently equivalent to auto).
|
|
57
|
+
*/
|
|
58
|
+
toolChoice?: "auto" | "any" | "none" | {
|
|
59
|
+
type: "tool";
|
|
60
|
+
name: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Pre-built Anthropic client instance. When provided, skips internal client
|
|
64
|
+
* construction entirely. Use this to inject alternative SDK clients such as
|
|
65
|
+
* `AnthropicVertex` that shares the same messaging API.
|
|
66
|
+
*/
|
|
67
|
+
client?: Anthropic;
|
|
68
|
+
}
|
|
69
|
+
export declare const stream: StreamFunction<"anthropic-messages", AnthropicOptions>;
|
|
70
|
+
export declare const streamSimple: StreamFunction<"anthropic-messages", SimpleStreamOptions>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from "../types.js";
|
|
2
|
+
/** Convert a tool schema to the strict subset expected by provider constrained sampling. */
|
|
3
|
+
export declare function makeStrictJsonSchema(schema: Tool["parameters"]): Record<string, unknown>;
|
|
4
|
+
export declare function getJsonSchemaToolParameters(tool: Tool, strict: boolean | undefined): Tool["parameters"];
|
|
5
|
+
export declare function resolveJsonSchemaStrictSampling(tool: Tool, supportsStrictMode: boolean): boolean | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Message } from "../types.js";
|
|
2
|
+
export declare function inferCopilotInitiator(messages: Message[]): "user" | "agent";
|
|
3
|
+
export declare function hasCopilotVisionInput(messages: Message[]): boolean;
|
|
4
|
+
export declare function buildCopilotDynamicHeaders(params: {
|
|
5
|
+
messages: Message[];
|
|
6
|
+
hasImages: boolean;
|
|
7
|
+
}): Record<string, string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatCompletionCreateParamsStreaming } from "openai/resources/chat/completions";
|
|
2
|
+
import type { Model, SimpleStreamOptions, StreamOptions, TranscriptContext } from "../types.js";
|
|
3
|
+
import { MeasuredAssistantStream } from "../utils/model-performance.js";
|
|
4
|
+
export interface OpenAICompletionsOptions extends StreamOptions {
|
|
5
|
+
reasoningEffort?: string;
|
|
6
|
+
reasoning?: SimpleStreamOptions["reasoning"];
|
|
7
|
+
toolChoice?: ChatCompletionCreateParamsStreaming["tool_choice"];
|
|
8
|
+
}
|
|
9
|
+
export declare function streamSimple(model: Model, context: TranscriptContext, options?: SimpleStreamOptions): MeasuredAssistantStream;
|
|
10
|
+
export declare function stream(model: Model, context: TranscriptContext, options?: OpenAICompletionsOptions): MeasuredAssistantStream;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ResponseInput } from "openai/resources/responses/responses";
|
|
2
|
+
import type { Model, SimpleStreamOptions, TranscriptContext } from "../types.js";
|
|
3
|
+
import { MeasuredAssistantStream } from "../utils/model-performance.js";
|
|
4
|
+
export declare function responsesInput(model: Model, context: TranscriptContext): ResponseInput;
|
|
5
|
+
export declare function streamSimple(model: Model, context: TranscriptContext, options?: SimpleStreamOptions): MeasuredAssistantStream;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ResponseCreateParamsStreaming, ResponseInput } from "openai/resources/responses/responses";
|
|
2
|
+
import type { Model, StreamOptions } from "../types.js";
|
|
3
|
+
/** OpenAI's cache controls differ before and after GPT-5.6; unknown gateway aliases keep their defaults. */
|
|
4
|
+
export declare function responsesCache(model: Model, options: StreamOptions, input: ResponseInput): {
|
|
5
|
+
input: ResponseInput;
|
|
6
|
+
} & Pick<ResponseCreateParamsStreaming, "prompt_cache_key" | "prompt_cache_options" | "prompt_cache_retention">;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ResponseStreamEvent } from "openai/resources/responses/responses";
|
|
2
|
+
/** Some Responses-compatible gateways ignore stream:true and return a complete JSON response. */
|
|
3
|
+
export declare function responsesEvents(stream: AsyncIterable<ResponseStreamEvent>, response: Response): AsyncIterable<ResponseStreamEvent>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type OpenAI from "openai";
|
|
2
|
+
import type { ResponseStreamEvent } from "openai/resources/responses/responses";
|
|
3
|
+
import type { Model, StreamOptions } from "../types.js";
|
|
4
|
+
type Payload = Record<string, unknown> & {
|
|
5
|
+
input: unknown[];
|
|
6
|
+
};
|
|
7
|
+
type FailureReason = "connection_limit" | "previous_response_not_found" | "invalid_previous_response" | "closed_connection" | "transport" | "request_error" | "observer_error" | "aborted" | "disposed";
|
|
8
|
+
export interface ResponsesSessionStats {
|
|
9
|
+
connectionsCreated: number;
|
|
10
|
+
connectionsReused: number;
|
|
11
|
+
websocketRequests: number;
|
|
12
|
+
warmupRequests: number;
|
|
13
|
+
fullContextRequests: number;
|
|
14
|
+
deltaRequests: number;
|
|
15
|
+
reconnects: number;
|
|
16
|
+
websocketFailures: number;
|
|
17
|
+
httpRequests: number;
|
|
18
|
+
httpFallbacks: number;
|
|
19
|
+
lastInputItems: number;
|
|
20
|
+
lastFullInputItems: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ResponsesSessionDiagnostic {
|
|
23
|
+
event: "request" | "reconnect" | "fallback" | "complete" | "error";
|
|
24
|
+
transport: "websocket" | "http";
|
|
25
|
+
warmup: boolean;
|
|
26
|
+
reason?: FailureReason;
|
|
27
|
+
stats: ResponsesSessionStats;
|
|
28
|
+
}
|
|
29
|
+
export interface ResponsesSessionOptions {
|
|
30
|
+
/** Resolve a proxy URL, or undefined for a direct connection. Hosts can supply their system/PAC resolver. */
|
|
31
|
+
resolveProxy?: (url: string) => Promise<string | undefined>;
|
|
32
|
+
/** Local counters only: no credentials, prompts, response IDs, or server error bodies. */
|
|
33
|
+
onDiagnostic?: (diagnostic: ResponsesSessionDiagnostic) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare function supportsResponsesWebSocket(model: Model): boolean;
|
|
36
|
+
/** One conversation, one authenticated socket. Nothing here is persisted in the transcript. */
|
|
37
|
+
export declare class ResponsesSession {
|
|
38
|
+
private socket?;
|
|
39
|
+
private identity?;
|
|
40
|
+
private previous?;
|
|
41
|
+
private idle?;
|
|
42
|
+
private openedAt;
|
|
43
|
+
private httpUntil;
|
|
44
|
+
private lifecycle;
|
|
45
|
+
private tail;
|
|
46
|
+
private options;
|
|
47
|
+
private stats;
|
|
48
|
+
constructor(options?: ResponsesSessionOptions);
|
|
49
|
+
get diagnostics(): ResponsesSessionStats;
|
|
50
|
+
private get disposed();
|
|
51
|
+
private report;
|
|
52
|
+
dispose(): void;
|
|
53
|
+
private disconnect;
|
|
54
|
+
events(client: OpenAI, model: Model, payload: Payload, options: StreamOptions, http: () => Promise<AsyncIterable<ResponseStreamEvent>>, start: () => void): AsyncGenerator<ResponseStreamEvent>;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Api, Model, SimpleStreamOptions, StreamOptions, ThinkingBudgets, ThinkingLevel, TranscriptContext } from "../types.js";
|
|
2
|
+
export declare function clampMaxTokensToContext(model: Model<Api>, context: TranscriptContext, maxTokens: number): number;
|
|
3
|
+
export declare function buildBaseOptions(model: Model<Api>, context: TranscriptContext, options?: SimpleStreamOptions, apiKey?: string): StreamOptions;
|
|
4
|
+
/** Tokens always left for the answer when a thinking budget shares the response ceiling. */
|
|
5
|
+
export declare const MIN_ANSWER_TOKENS = 1024;
|
|
6
|
+
export declare const DEFAULT_THINKING_BUDGETS: ThinkingBudgets;
|
|
7
|
+
export declare function clampReasoning(effort: ThinkingLevel | undefined): Exclude<ThinkingLevel, "xhigh" | "max"> | undefined;
|
|
8
|
+
export declare function thinkingBudgetForLevel(reasoningLevel: ThinkingLevel, customBudgets?: ThinkingBudgets): number;
|
|
9
|
+
/** Cap a thinking budget so at least MIN_ANSWER_TOKENS remain under a shared response ceiling. */
|
|
10
|
+
export declare function clampThinkingBudgetToAnswerRoom(thinkingBudget: number, ceiling: number): number;
|
|
11
|
+
export declare function adjustMaxTokensForThinking(baseMaxTokens: number | undefined, modelMaxTokens: number, reasoningLevel: ThinkingLevel, customBudgets?: ThinkingBudgets): {
|
|
12
|
+
maxTokens: number;
|
|
13
|
+
thinkingBudget: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Message, Model } from "../types.js";
|
|
2
|
+
/** Replay a portable local transcript; provider signatures only belong to their original model. */
|
|
3
|
+
export declare function transformMessages(messages: readonly Message[], model: Model, normalizeId?: (id: string) => string): Message[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ChatGPTCredential {
|
|
2
|
+
access: string;
|
|
3
|
+
refresh: string;
|
|
4
|
+
expires: number;
|
|
5
|
+
clientId: string;
|
|
6
|
+
subject: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
idToken: string;
|
|
9
|
+
/** Rotated tokens are durable but cannot be used until this identity is verified. */
|
|
10
|
+
identityPending?: boolean;
|
|
11
|
+
scopes: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function isChatGPTCredential(value: unknown): value is ChatGPTCredential;
|
|
14
|
+
export declare function verifyChatGPTIdentity(idToken: string, clientId: string, nonce: string | undefined, fetcher: typeof fetch): Promise<{
|
|
15
|
+
subject: string;
|
|
16
|
+
email?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function refreshChatGPTCredential(credential: ChatGPTCredential, fetcher?: typeof fetch, saveRotation?: (credential: ChatGPTCredential) => void): Promise<ChatGPTCredential>;
|
|
19
|
+
export declare function verifyRefreshedChatGPTCredential(credential: ChatGPTCredential, fetcher?: typeof fetch): Promise<ChatGPTCredential>;
|
|
20
|
+
export declare function revokeChatGPTCredential(credential: ChatGPTCredential, fetcher?: typeof fetch): Promise<void>;
|
|
21
|
+
export interface ChatGPTLogin {
|
|
22
|
+
url: string;
|
|
23
|
+
wait(): Promise<ChatGPTCredential>;
|
|
24
|
+
submitCallback(url: string): void;
|
|
25
|
+
cancel(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function beginChatGPTLogin(options: {
|
|
28
|
+
hostId: string;
|
|
29
|
+
credential?: ChatGPTCredential;
|
|
30
|
+
fetch?: typeof fetch;
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
}): Promise<ChatGPTLogin>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay, } from "./api/anthropic-messages.js";
|
|
2
|
+
export type { ResponsesSessionDiagnostic, ResponsesSessionOptions, ResponsesSessionStats, } from "./api/responses-session.js";
|
|
3
|
+
export type { ModelDiscoveryInput, ModelDiscoveryResult } from "./providers/discovery.js";
|
|
4
|
+
export { fetchProviderModels } from "./providers/discovery.js";
|
|
5
|
+
export type { DiscoveredModel, ProviderPresetId } from "./providers/registry.js";
|
|
6
|
+
export { discoverProviderCredentials, getProviderPreset, isLegacyOpenAIModel, presetModels, providerApi, providerApis, providerBaseUrl, providerPresets, usesChatGPTAuth, } from "./providers/registry.js";
|
|
7
|
+
export { streamSimple } from "./stream.js";
|
|
8
|
+
export type * from "./types.js";
|
|
9
|
+
export { anthropicMessagesCompatKeys, openAICompletionsCompatKeys } from "./types.js";
|
|
10
|
+
export { abortable } from "./utils/abort.js";
|
|
11
|
+
export { calculateContextTokens, estimateMessageTokens } from "./utils/estimate.js";
|
|
12
|
+
export { AssistantMessageEventStream, createAssistantMessageEventStream } from "./utils/event-stream.js";
|
|
13
|
+
export { guardModelStream } from "./utils/guard-model-stream.js";
|
|
14
|
+
export * from "./utils/media-policy.js";
|
|
15
|
+
export { modelFailure } from "./utils/model-retry.js";
|
|
16
|
+
export { isContextOverflow as isContextOverflowMessage, isModelContextExceededError, isModelContextExceededMessage, isModelMediaTooLargeError, isModelMediaTooLargeMessage, isRecoverableLength, } from "./utils/overflow.js";
|
|
17
|
+
export { canControlThinking, clampThinkingLevel, defaultThinkingLevel, editableReasoningConfig, reasoningParameters, thinkingChoices, validateReasoningConfig, validateThinkingMap, } from "./utils/reasoning.js";
|
|
18
|
+
export * from "./utils/retry.js";
|
|
19
|
+
export { DEFAULT_MODEL_FIRST_RESPONSE_TIMEOUT_MS, DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS, ModelRequestRetryError, } from "./utils/stream-idle-timeout.js";
|
|
20
|
+
export { assertSupportedOptions, contentText, emptyAssistant, getCurrentSystemPrompt, getCurrentTools, isJsonObject, isJsonValue, normalizeContext, toToolDeclaration, } from "./utils/transcript.js";
|