@emabuild/ai 0.1.1 → 0.8.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 +122 -11
- package/dist/cli.js +24 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/loop.d.ts +26 -0
- package/dist/loop.d.ts.map +1 -0
- package/dist/loop.js +215 -0
- package/dist/loop.js.map +1 -0
- package/dist/providers/anthropic.d.ts +58 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +217 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/errors.d.ts +12 -0
- package/dist/providers/errors.d.ts.map +1 -0
- package/dist/providers/errors.js +39 -0
- package/dist/providers/errors.js.map +1 -0
- package/dist/providers/model-call.d.ts +17 -0
- package/dist/providers/model-call.d.ts.map +1 -0
- package/dist/providers/model-call.js +65 -0
- package/dist/providers/model-call.js.map +1 -0
- package/dist/providers/openai-format.d.ts +89 -0
- package/dist/providers/openai-format.d.ts.map +1 -0
- package/dist/providers/openai-format.js +107 -0
- package/dist/providers/openai-format.js.map +1 -0
- package/dist/providers/types.d.ts +168 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +22 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/run.d.ts +38 -37
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +44 -323
- package/dist/run.js.map +1 -1
- package/dist/usage.d.ts +7 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +35 -6
- package/dist/usage.js.map +1 -1
- package/package.json +15 -5
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module providers/openai-format
|
|
3
|
+
*
|
|
4
|
+
* Plain data conversions between the library's `callModel` contract and the
|
|
5
|
+
* OpenAI Chat Completions format, used by most providers (OpenAI, Azure
|
|
6
|
+
* OpenAI, Cerebras, Groq, local servers). No SDK involved:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* callModel: async (req) => {
|
|
10
|
+
* const completion = await openai.chat.completions.create({ model: 'gpt-4o', ...toOpenAIChat(req) }, { signal: req.signal });
|
|
11
|
+
* return fromOpenAIChat(completion);
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* {@link openAICompatibleModel} does the same with `fetch`, for servers you
|
|
16
|
+
* reach by URL and API key.
|
|
17
|
+
*/
|
|
18
|
+
import { ProviderSetupError } from './types.js';
|
|
19
|
+
/** Turn a model request into Chat Completions `messages` + `tools` */
|
|
20
|
+
export function toOpenAIChat(request) {
|
|
21
|
+
const messages = [{ role: 'system', content: request.system }];
|
|
22
|
+
for (const m of request.messages) {
|
|
23
|
+
if (m.role === 'user')
|
|
24
|
+
messages.push({ role: 'user', content: m.content });
|
|
25
|
+
else if (m.role === 'tool')
|
|
26
|
+
messages.push({ role: 'tool', tool_call_id: m.toolCallId, content: m.content });
|
|
27
|
+
else {
|
|
28
|
+
messages.push({
|
|
29
|
+
role: 'assistant',
|
|
30
|
+
content: m.content || null,
|
|
31
|
+
...(m.toolCalls?.length
|
|
32
|
+
? { tool_calls: m.toolCalls.map((c) => ({ id: c.id, type: 'function', function: { name: c.name, arguments: c.arguments } })) }
|
|
33
|
+
: {}),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
messages,
|
|
39
|
+
// Not "strict": the operation schema uses anyOf / const / open objects
|
|
40
|
+
tools: request.tools.map((t) => ({ type: 'function', function: { name: t.name, description: t.description, parameters: t.inputSchema } })),
|
|
41
|
+
tool_choice: 'auto',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const FINISH = { stop: 'end', tool_calls: 'tool_calls', function_call: 'tool_calls', length: 'max_tokens', content_filter: 'refusal' };
|
|
45
|
+
/** Turn a Chat Completions response into the model answer `callModel` returns */
|
|
46
|
+
export function fromOpenAIChat(completion) {
|
|
47
|
+
const choice = completion.choices?.[0];
|
|
48
|
+
const msg = choice?.message;
|
|
49
|
+
const toolCalls = (msg?.tool_calls ?? [])
|
|
50
|
+
.filter((c) => c.function?.name)
|
|
51
|
+
.map((c, i) => ({ id: c.id || `call_${i}`, name: c.function.name, arguments: c.function?.arguments ?? '{}' }));
|
|
52
|
+
const refused = !!msg?.refusal && !toolCalls.length;
|
|
53
|
+
const u = completion.usage;
|
|
54
|
+
const cached = u?.prompt_tokens_details?.cached_tokens ?? 0;
|
|
55
|
+
return {
|
|
56
|
+
...(msg?.content ? { text: msg.content } : {}),
|
|
57
|
+
toolCalls,
|
|
58
|
+
stop: refused ? 'refusal' : FINISH[choice?.finish_reason ?? ''] ?? (toolCalls.length ? 'tool_calls' : 'end'),
|
|
59
|
+
...(u ? { usage: { input: Math.max(0, (u.prompt_tokens ?? 0) - cached), output: u.completion_tokens ?? 0, cacheRead: cached } } : {}),
|
|
60
|
+
...(completion.model ? { model: completion.model } : {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** HTTP error from an OpenAI-compatible server (its `status` maps to the usual messages) */
|
|
64
|
+
export class OpenAICompatibleError extends Error {
|
|
65
|
+
constructor(status, message) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.status = status;
|
|
68
|
+
this.name = 'OpenAICompatibleError';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A `callModel` for any OpenAI-compatible Chat Completions endpoint, using
|
|
73
|
+
* `fetch` (no SDK). One request per turn, not streamed.
|
|
74
|
+
*/
|
|
75
|
+
export function openAICompatibleModel(options) {
|
|
76
|
+
const base = (options.baseURL ?? 'https://api.openai.com/v1').replace(/\/+$/, '');
|
|
77
|
+
const doFetch = options.fetch ?? globalThis.fetch;
|
|
78
|
+
if (!doFetch)
|
|
79
|
+
throw new ProviderSetupError('`fetch` is not available: use Node 18+ or pass `fetch`.');
|
|
80
|
+
return async (req) => {
|
|
81
|
+
const body = { model: options.model, ...toOpenAIChat(req), ...(options.body ?? {}) };
|
|
82
|
+
if (req.maxTokens !== undefined)
|
|
83
|
+
body[options.maxTokensParam ?? 'max_completion_tokens'] = req.maxTokens;
|
|
84
|
+
const res = await doFetch(`${base}/chat/completions`, {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
'content-type': 'application/json',
|
|
88
|
+
...(options.apiKey ? { authorization: `Bearer ${options.apiKey}` } : {}),
|
|
89
|
+
...(options.headers ?? {}),
|
|
90
|
+
},
|
|
91
|
+
body: JSON.stringify(body),
|
|
92
|
+
signal: req.signal,
|
|
93
|
+
});
|
|
94
|
+
if (!res.ok) {
|
|
95
|
+
// Only the provider's error message is kept (never request headers / keys)
|
|
96
|
+
let detail = res.statusText;
|
|
97
|
+
try {
|
|
98
|
+
const j = await res.json();
|
|
99
|
+
detail = typeof j.error === 'string' ? j.error : j.error?.message ?? detail;
|
|
100
|
+
}
|
|
101
|
+
catch { /* not JSON */ }
|
|
102
|
+
throw new OpenAICompatibleError(res.status, detail || `HTTP ${res.status}`);
|
|
103
|
+
}
|
|
104
|
+
return fromOpenAIChat(await res.json());
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=openai-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai-format.js","sourceRoot":"","sources":["../../src/providers/openai-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAShD,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAAC,OAAqB;IAChD,MAAM,QAAQ,GAAmC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/F,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,EAA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}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module providers/types
|
|
3
|
+
*
|
|
4
|
+
* How the agent loop talks to a model. The loop owns everything about the
|
|
5
|
+
* editor (prompts, tools, validation, retries, events); a model is only asked
|
|
6
|
+
* to answer one turn of a conversation.
|
|
7
|
+
*
|
|
8
|
+
* Two ways to plug a model in:
|
|
9
|
+
* - `callModel(request) => response`: the simplest. The library hands out the
|
|
10
|
+
* system prompt, the conversation (in a neutral, OpenAI-like format) and the
|
|
11
|
+
* tools; your code calls any model and returns its answer.
|
|
12
|
+
* - a {@link ModelAdapter}: full control over streaming and the provider's own
|
|
13
|
+
* conversation format (the built-in Anthropic adapter is one).
|
|
14
|
+
*/
|
|
15
|
+
import type { AIEffort } from '../run.js';
|
|
16
|
+
/** Why a model turn ended */
|
|
17
|
+
export type StopReason = 'end' | 'tool_calls' | 'max_tokens' | 'refusal' | 'pause';
|
|
18
|
+
/** Tokens of one model turn, normalized across providers */
|
|
19
|
+
export interface NormalizedUsage {
|
|
20
|
+
/** Uncached input tokens */
|
|
21
|
+
input: number;
|
|
22
|
+
output: number;
|
|
23
|
+
/** Input tokens read from a prompt cache */
|
|
24
|
+
cacheRead?: number;
|
|
25
|
+
/** Input tokens written to a prompt cache (5-minute TTL where the provider has TTLs) */
|
|
26
|
+
cacheWrite?: number;
|
|
27
|
+
/** Part of `cacheWrite` written with a 1-hour TTL */
|
|
28
|
+
cacheWrite1h?: number;
|
|
29
|
+
}
|
|
30
|
+
/** A tool, provider-neutral (JSON Schema input) */
|
|
31
|
+
export interface ToolSpec {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
/** JSON Schema of the arguments (uses anyOf / const / additionalProperties: do not send it as "strict") */
|
|
35
|
+
inputSchema: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/** A tool call made by the model */
|
|
38
|
+
export interface ToolCall {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
/** Arguments as a JSON string, exactly as the model produced them */
|
|
42
|
+
arguments: string;
|
|
43
|
+
}
|
|
44
|
+
/** The conversation, in a neutral format close to OpenAI Chat Completions */
|
|
45
|
+
export type ConversationMessage = {
|
|
46
|
+
role: 'user';
|
|
47
|
+
content: string;
|
|
48
|
+
} | {
|
|
49
|
+
role: 'assistant';
|
|
50
|
+
content: string;
|
|
51
|
+
toolCalls?: ToolCall[];
|
|
52
|
+
} | {
|
|
53
|
+
role: 'tool';
|
|
54
|
+
toolCallId: string;
|
|
55
|
+
content: string;
|
|
56
|
+
isError?: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** What `callModel` receives: everything needed to ask any model for the next turn */
|
|
59
|
+
export interface ModelRequest {
|
|
60
|
+
/** System prompt (stable parts first: good for providers that cache prefixes) */
|
|
61
|
+
system: string;
|
|
62
|
+
messages: ConversationMessage[];
|
|
63
|
+
tools: ToolSpec[];
|
|
64
|
+
/** Output cap requested by the caller, if any */
|
|
65
|
+
maxTokens?: number;
|
|
66
|
+
/** Reasoning effort requested by the caller; map it where your model supports it */
|
|
67
|
+
effort: AIEffort | null;
|
|
68
|
+
/** Aborted when the editor cancels the run */
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
}
|
|
71
|
+
/** What `callModel` returns: the model's answer for this turn */
|
|
72
|
+
export interface ModelResponse {
|
|
73
|
+
/** Assistant text, if any (shown to the user as a message) */
|
|
74
|
+
text?: string;
|
|
75
|
+
toolCalls?: ToolCall[];
|
|
76
|
+
/** Why the turn ended; inferred from `toolCalls` when omitted */
|
|
77
|
+
stop?: StopReason;
|
|
78
|
+
/** Token usage, for the `usage` event and cost estimate */
|
|
79
|
+
usage?: NormalizedUsage;
|
|
80
|
+
/** Model that served the turn (for pricing); defaults to the configured model name */
|
|
81
|
+
model?: string;
|
|
82
|
+
}
|
|
83
|
+
/** Ask a model for the next turn; called once per turn by the agent loop */
|
|
84
|
+
export type ModelCall = (request: ModelRequest) => Promise<ModelResponse>;
|
|
85
|
+
/** What a provider stream turns into */
|
|
86
|
+
export type AdapterEvent =
|
|
87
|
+
/** The complete text of one assistant text block */
|
|
88
|
+
{
|
|
89
|
+
type: 'text';
|
|
90
|
+
text: string;
|
|
91
|
+
}
|
|
92
|
+
/** A progress note / reasoning summary, when the provider streams them */
|
|
93
|
+
| {
|
|
94
|
+
type: 'status';
|
|
95
|
+
text: string;
|
|
96
|
+
}
|
|
97
|
+
/** A tool call started (its arguments are still streaming) */
|
|
98
|
+
| {
|
|
99
|
+
type: 'toolStart';
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
}
|
|
103
|
+
/** A complete tool call */
|
|
104
|
+
| {
|
|
105
|
+
type: 'toolCall';
|
|
106
|
+
call: ToolCall;
|
|
107
|
+
}
|
|
108
|
+
/** Token usage of the turn (absent when unknown), with the model that served it */
|
|
109
|
+
| {
|
|
110
|
+
type: 'usage';
|
|
111
|
+
model: string;
|
|
112
|
+
usage?: NormalizedUsage;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The turn ended. `toolCallIds` lists every tool call of the turn, including
|
|
116
|
+
* ones cut off before they completed (e.g. at max_tokens), in order.
|
|
117
|
+
*/
|
|
118
|
+
| {
|
|
119
|
+
type: 'stop';
|
|
120
|
+
reason: StopReason;
|
|
121
|
+
toolCallIds: string[];
|
|
122
|
+
};
|
|
123
|
+
/** One block of the system prompt; `cache` marks a stable prefix worth caching */
|
|
124
|
+
export interface SystemPart {
|
|
125
|
+
text: string;
|
|
126
|
+
cache?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/** Result of one tool call, sent back to the model */
|
|
129
|
+
export interface ToolResult {
|
|
130
|
+
id: string;
|
|
131
|
+
content: string;
|
|
132
|
+
isError?: boolean;
|
|
133
|
+
}
|
|
134
|
+
/** Per-run settings the loop hands to an adapter */
|
|
135
|
+
export interface TurnSettings {
|
|
136
|
+
system: SystemPart[];
|
|
137
|
+
tools: ToolSpec[];
|
|
138
|
+
maxTokens?: number;
|
|
139
|
+
effort: AIEffort | null;
|
|
140
|
+
signal?: AbortSignal;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A model provider with streaming and its own conversation format. One
|
|
144
|
+
* instance serves one run. The conversation object `C` is opaque to the loop.
|
|
145
|
+
*/
|
|
146
|
+
export interface ModelAdapter<C = unknown> {
|
|
147
|
+
/** Model id, used for pricing when the provider does not report one */
|
|
148
|
+
readonly model: string;
|
|
149
|
+
/** Start a conversation with the first user message */
|
|
150
|
+
createConversation(userPrompt: string, settings: TurnSettings): C | Promise<C>;
|
|
151
|
+
/** Run one model turn and stream normalized events */
|
|
152
|
+
streamTurn(conversation: C, settings: TurnSettings): AsyncIterable<AdapterEvent>;
|
|
153
|
+
/** Append the assistant turn that was just streamed */
|
|
154
|
+
commitAssistantTurn(conversation: C): void;
|
|
155
|
+
/** Append tool results for the last assistant turn */
|
|
156
|
+
addToolResults(conversation: C, results: ToolResult[]): void;
|
|
157
|
+
/** User-facing message for a provider error, or undefined if it is not one */
|
|
158
|
+
describeError(error: unknown): string | undefined;
|
|
159
|
+
/** The error comes from the provider API: report it, do not retry */
|
|
160
|
+
isProviderError(error: unknown): boolean;
|
|
161
|
+
/** The error means the request was aborted */
|
|
162
|
+
isAbortError(error: unknown): boolean;
|
|
163
|
+
}
|
|
164
|
+
/** Error that must not be retried (missing SDK, bad configuration) */
|
|
165
|
+
export declare class ProviderSetupError extends Error {
|
|
166
|
+
readonly fatal = true;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,6BAA6B;AAC7B,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS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KAAK,QAAQ;CACvB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module providers/types
|
|
3
|
+
*
|
|
4
|
+
* How the agent loop talks to a model. The loop owns everything about the
|
|
5
|
+
* editor (prompts, tools, validation, retries, events); a model is only asked
|
|
6
|
+
* to answer one turn of a conversation.
|
|
7
|
+
*
|
|
8
|
+
* Two ways to plug a model in:
|
|
9
|
+
* - `callModel(request) => response`: the simplest. The library hands out the
|
|
10
|
+
* system prompt, the conversation (in a neutral, OpenAI-like format) and the
|
|
11
|
+
* tools; your code calls any model and returns its answer.
|
|
12
|
+
* - a {@link ModelAdapter}: full control over streaming and the provider's own
|
|
13
|
+
* conversation format (the built-in Anthropic adapter is one).
|
|
14
|
+
*/
|
|
15
|
+
/** Error that must not be retried (missing SDK, bad configuration) */
|
|
16
|
+
export class ProviderSetupError extends Error {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.fatal = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAyIH,sEAAsE;AACtE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAA7C;;QACW,UAAK,GAAG,IAAI,CAAC;IACxB,CAAC;CAAA"}
|
package/dist/run.d.ts
CHANGED
|
@@ -1,26 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module run
|
|
3
|
+
*
|
|
4
|
+
* `runAI(request, options)`: turns an editor AI request into a stream of
|
|
5
|
+
* editor events. The flow (prompts, tools, validation, retries) lives in
|
|
6
|
+
* `loop.ts`; the model answering each turn is, in order of precedence:
|
|
7
|
+
*
|
|
8
|
+
* 1. `options.adapter` — a full {@link ModelAdapter};
|
|
9
|
+
* 2. `options.callModel` — your function: it gets the prompt, conversation and
|
|
10
|
+
* tools, calls any model, and returns the answer;
|
|
11
|
+
* 3. the built-in Claude adapter (default; needs `@anthropic-ai/sdk`).
|
|
12
|
+
*/
|
|
13
|
+
import type Anthropic from '@anthropic-ai/sdk';
|
|
2
14
|
import type { AIRequest, AIStreamEvent, FreeImage, FreeImageSearchOptions } from '@emabuild/types';
|
|
3
15
|
import { type ModelPricing } from './usage.js';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
export type RequestParams = Omit<StreamParams, 'messages' | 'stream'>;
|
|
7
|
-
/** Default model: Claude Opus 5.5 (the current Opus) */
|
|
8
|
-
export declare const DEFAULT_MODEL = "claude-opus-5-5";
|
|
9
|
-
/** Default per-response output cap (streamed, so large values are safe) */
|
|
10
|
-
export declare const DEFAULT_MAX_TOKENS = 64000;
|
|
16
|
+
import type { ModelAdapter, ModelCall } from './providers/types.js';
|
|
17
|
+
export { buildRequestParams, DEFAULT_MODEL, DEFAULT_MAX_TOKENS, type RequestParams } from './providers/anthropic.js';
|
|
11
18
|
/** Default cap on model round-trips per run */
|
|
12
19
|
export declare const DEFAULT_MAX_TURNS = 30;
|
|
13
|
-
/** Effort levels
|
|
20
|
+
/** Effort levels (Claude `output_config.effort`; map them for other models in `callModel`) */
|
|
14
21
|
export type AIEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
15
22
|
/** Options for {@link runAI} */
|
|
16
23
|
export interface RunAIOptions {
|
|
17
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Answer each model turn with your own code (any provider: OpenAI, Azure,
|
|
26
|
+
* Cerebras, a local model…). The library keeps the flow; you only call the model.
|
|
27
|
+
*/
|
|
28
|
+
callModel?: ModelCall;
|
|
29
|
+
/** Full adapter with streaming (takes precedence over `callModel`) */
|
|
30
|
+
adapter?: ModelAdapter;
|
|
31
|
+
/** Pre-configured Anthropic client (built-in Claude adapter; takes precedence over `apiKey`) */
|
|
18
32
|
client?: Anthropic;
|
|
19
|
-
/** API key; defaults to the SDK's credential resolution
|
|
33
|
+
/** API key of the built-in Claude adapter; defaults to the SDK's credential resolution */
|
|
20
34
|
apiKey?: string;
|
|
21
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Model id. Built-in adapter: the Claude model (default {@link DEFAULT_MODEL}).
|
|
37
|
+
* With `callModel`: the name used for pricing when the response does not report one.
|
|
38
|
+
*/
|
|
22
39
|
model?: string;
|
|
23
|
-
/** Max output tokens per model
|
|
40
|
+
/** Max output tokens per model turn (built-in adapter default: DEFAULT_MAX_TOKENS) */
|
|
24
41
|
maxTokens?: number;
|
|
25
42
|
/** Aborts the run and the in-flight model request */
|
|
26
43
|
signal?: AbortSignal;
|
|
@@ -29,48 +46,32 @@ export interface RunAIOptions {
|
|
|
29
46
|
/** Max model round-trips (default {@link DEFAULT_MAX_TURNS}) */
|
|
30
47
|
maxTurns?: number;
|
|
31
48
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
49
|
+
* Reasoning effort (default "medium"). Claude: `output_config.effort`; with
|
|
50
|
+
* `callModel` it is passed on for you to map. `null` omits it.
|
|
34
51
|
*/
|
|
35
52
|
effort?: AIEffort | null;
|
|
36
|
-
/**
|
|
37
|
-
* Server-side refusal fallbacks (`fallbacks: "default"`). Defaults to true on
|
|
38
|
-
* models that support it on the Claude API; set false on Bedrock/Vertex/Foundry
|
|
39
|
-
* or behind proxies that reject beta parameters.
|
|
40
|
-
*/
|
|
53
|
+
/** Claude only: server-side refusal fallbacks; on by default for supported models */
|
|
41
54
|
fallbacks?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Request progress-update thinking blocks (`thinking.display: "updates"`) and
|
|
44
|
-
* forward them as `status` events. Defaults to true on models that support it.
|
|
45
|
-
*/
|
|
55
|
+
/** Claude only: progress-update thinking blocks as `status` events; on by default for supported models */
|
|
46
56
|
progressUpdates?: boolean;
|
|
47
57
|
/**
|
|
48
58
|
* Free-image search behind the `search_images` tool. Defaults to Openverse
|
|
49
59
|
* (CC0 / public domain); pass a custom search, or `false` to disable the tool.
|
|
50
60
|
*/
|
|
51
61
|
imageSearch?: ((query: string, options: FreeImageSearchOptions) => Promise<FreeImage[]>) | false;
|
|
52
|
-
/**
|
|
53
|
-
* Send a `usage` event (tokens + estimated cost) before `done` / `error`.
|
|
54
|
-
* Default true; set false to keep usage server side.
|
|
55
|
-
*/
|
|
62
|
+
/** Send a `usage` event (tokens + estimated cost) before `done` / `error`. Default true */
|
|
56
63
|
reportUsage?: boolean;
|
|
57
|
-
/** Prices (USD / 1M tokens) merged over the built-in
|
|
64
|
+
/** Prices (USD / 1M tokens) merged over the built-in list prices, keyed by model id */
|
|
58
65
|
pricing?: Record<string, ModelPricing>;
|
|
59
66
|
}
|
|
60
67
|
/**
|
|
61
|
-
*
|
|
62
|
-
* callers that want to inspect what is sent.
|
|
63
|
-
*/
|
|
64
|
-
export declare function buildRequestParams(request: AIRequest, options?: RunAIOptions): RequestParams;
|
|
65
|
-
/**
|
|
66
|
-
* Runs an AI request against Claude and streams editor events.
|
|
68
|
+
* Runs an AI request and streams editor events.
|
|
67
69
|
*
|
|
68
70
|
* The model edits the design through an `apply_operations` tool; each
|
|
69
71
|
* completed tool call is validated and yielded immediately as an
|
|
70
72
|
* `operations` event, so the editor can apply it live. Invalid batches are
|
|
71
73
|
* returned to the model as error tool results so it can fix them. The
|
|
72
|
-
* generator never throws for
|
|
74
|
+
* generator never throws for model errors — it yields an `error` event instead.
|
|
73
75
|
*/
|
|
74
76
|
export declare function runAI(request: AIRequest, options?: RunAIOptions): AsyncGenerator<AIStreamEvent>;
|
|
75
|
-
export {};
|
|
76
77
|
//# sourceMappingURL=run.d.ts.map
|
package/dist/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRo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