@nexface/agent 0.1.1-alpha.1 → 0.1.1-alpha.10
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/dist/agent.d.ts +4 -8
- package/dist/agent.js +696 -319
- package/dist/agent.js.map +1 -1
- package/dist/browser-prompt.d.ts +1 -1
- package/dist/browser-prompt.generated.d.ts +1 -1
- package/dist/browser-prompt.generated.js +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/history-compaction.d.ts +22 -0
- package/dist/history-compaction.js +181 -0
- package/dist/history-compaction.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/model/binding.d.ts +4 -0
- package/dist/model/binding.js.map +1 -1
- package/dist/models/{42.js → 39.js} +236 -42
- package/dist/models/851.js +10 -0
- package/dist/models/_chunks/{anthropic-messages~1-a838a7c1.js → anthropic-messages~1-d35e3e7d.js} +1 -1
- package/dist/models/_chunks/{google-generative-ai~1-5ceee40d.js → google-generative-ai~1-2ba71457.js} +1 -1
- package/dist/models/_chunks/{openai-completions~1-396a5c3a.js → openai-completions~1-b340f0e0.js} +1 -1
- package/dist/models/_chunks/{openai-responses~1-2b3e0291.js → openai-responses~1-b53c65c2.js} +1 -1
- package/dist/models/anthropic-messages.d.ts +1 -1
- package/dist/models/anthropic-messages.js +3 -3
- package/dist/models/google-generative-ai.d.ts +1 -1
- package/dist/models/google-generative-ai.js +3 -3
- package/dist/models/openai-completions.js +6 -3
- package/dist/models/openai-responses.js +6 -3
- package/dist/request.d.ts +95 -0
- package/dist/request.js +238 -0
- package/dist/request.js.map +1 -0
- package/dist/tool-bridge.js +11 -73
- package/dist/tool-bridge.js.map +1 -1
- package/dist/tool-result.d.ts +1 -0
- package/dist/tool-result.js +12 -0
- package/dist/tool-result.js.map +1 -0
- package/dist/types.d.ts +26 -42
- package/dist/types.js.map +1 -1
- package/package.json +12 -8
- package/dist/models/663.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-compaction.js","sourceRoot":"","sources":["../src/history-compaction.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1D,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,GAAG,IAAI,CAAC;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,CAAC;AACnD,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAelC,SAAS,aAAa,CAAC,QAAiC;IACtD,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,IAAI,OAAiC,CAAC;IACtC,IAAI,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC;IACpB,IAAI,kBAA4C,CAAC;IACjD,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,QAAQ,GAAG,KAAK,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC;YAC/C,IAAI,CAAC,OAAO,CAAC,QAAQ;gBAAE,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,GAAG,SAAS,CAAC;IACtB,CAAC,CAAC;IACF,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;QAClD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC5B,MAAM,EAAE,CAAC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,IAAI,CAAC,OAAO,CAAC,CAAC;IAChG,CAAC;IACD,OAAO;QACL,eAAe;QACf,QAAQ,EAAE,MAAM;QAChB,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAE,EAAE,CAAC;KAC/E,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { createAgent } from "./agent.js";
|
|
2
2
|
export { isAgentError } from "./errors.js";
|
|
3
|
-
export {
|
|
4
|
-
export type { ToolBridge } from "./tool-bridge.js";
|
|
5
|
-
export type { Agent, AgentMessage, AgentInputContent, AgentRun, AgentRunEvent, AgentRunInput, AgentRunOptions, AgentRunResult, AgentSkill, ToolApprovalInterruptDescriptor, } from "./types.js";
|
|
3
|
+
export type { Agent, AgentMessage, AgentInputContent, AgentRun, AgentRunEvent, AgentRunInput, AgentRunOptions, AgentRunResult, ToolApprovalInterruptDescriptor, AgentSkill, } from "./types.js";
|
|
6
4
|
export type { AgentModelConfig, AgentModelInfo, } from "./model/types.js";
|
|
5
|
+
export type { Message, RunAgentInput } from "./request.js";
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/model/binding.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { AgentMessage, AgentModelResponse, AgentModelTool } from "../types.js";
|
|
2
2
|
import type { AgentModelConfig, AgentModelInfo } from "./types.js";
|
|
3
|
+
import type { HistorySummary } from "../history-compaction.js";
|
|
3
4
|
export interface ModelBindingRequest {
|
|
4
5
|
messages: AgentMessage[];
|
|
5
6
|
tools: AgentModelTool[];
|
|
6
7
|
signal: AbortSignal;
|
|
7
8
|
agentId: string;
|
|
9
|
+
historySummary?: HistorySummary;
|
|
8
10
|
onTextDelta?(delta: string): void;
|
|
9
11
|
}
|
|
10
12
|
export interface ModelBinding {
|
|
11
13
|
readonly info: AgentModelInfo;
|
|
14
|
+
exportReplay?(messages: readonly AgentMessage[]): unknown;
|
|
15
|
+
restoreReplay?(replay: unknown, messages: readonly AgentMessage[]): void;
|
|
12
16
|
complete(request: ModelBindingRequest): Promise<AgentModelResponse>;
|
|
13
17
|
}
|
|
14
18
|
interface ModelConfigDefinition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/model/binding.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/model/binding.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAyB7C,MAAM,WAAW,GAAG,IAAI,OAAO,EAA2C,CAAC;AAE3E,MAAM,UAAU,sBAAsB,CACpC,UAAiC;IAEjC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAqB,CAAC;IACrD,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,aAAa,CAAC,MAAwB;IAC7C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,eAAe,CAAC,sBAAsB,EAAE,mDAAmD,CAAC,CAAC;IACzG,CAAC;IACD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,eAAe,CAAC,sBAAsB,EAAE,mDAAmD,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAwB;IACzD,aAAa,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAwB;IAC1D,OAAO,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAwB,EACxB,MAAoB;IAEpB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { defineAgentModelConfig } from "../model/binding.js";
|
|
2
2
|
|
|
3
|
+
function flattenModelCatalog(_provider, groups) {
|
|
4
|
+
return Object.assign({}, ...Object.values(groups));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=model-catalog.js.map
|
|
3
7
|
// Generic event stream class for async iteration
|
|
4
8
|
class EventStream {
|
|
5
9
|
queue = [];
|
|
@@ -154,6 +158,7 @@ function lazyApi(load, capabilities) {
|
|
|
154
158
|
|
|
155
159
|
const AGENT_ERROR_CODES = [
|
|
156
160
|
"AGENT_RUN_ACTIVE",
|
|
161
|
+
"AGENT_REQUEST_REQUIRES_NEW_AGENT",
|
|
157
162
|
"AGENT_INTERRUPT_PENDING",
|
|
158
163
|
"AGENT_RUN_LIMIT_REACHED",
|
|
159
164
|
"AGENT_TOOL_RUNTIME_UNAVAILABLE",
|
|
@@ -170,7 +175,6 @@ const AGENT_MODEL_ERROR_CODES = [
|
|
|
170
175
|
"AGENT_RUN_BLOCKED",
|
|
171
176
|
"INVALID_MODEL_RESPONSE",
|
|
172
177
|
"MODEL_CONFIG_INVALID",
|
|
173
|
-
"MODEL_NOT_FOUND",
|
|
174
178
|
"MODEL_REQUEST_FAILED",
|
|
175
179
|
"MODEL_INPUT_UNSUPPORTED"
|
|
176
180
|
];
|
|
@@ -210,6 +214,189 @@ class AgentModelError extends AgentError {
|
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
|
|
217
|
+
const HISTORY_COMPACTION_TRIGGER_BYTES = (/* unused pure expression or super */ null && (128 * 1024));
|
|
218
|
+
const HISTORY_COMPACTION_MIN_NEW_BYTES = (/* unused pure expression or super */ null && (32 * 1024));
|
|
219
|
+
const HISTORY_COMPACTION_MIN_SAVINGS_BYTES = (/* unused pure expression or super */ null && (16 * 1024));
|
|
220
|
+
const HISTORY_SUMMARY_MAX_BYTES = (/* unused pure expression or super */ null && (16 * 1024));
|
|
221
|
+
const RECENT_BATCHES = 2;
|
|
222
|
+
const encoder = new TextEncoder();
|
|
223
|
+
function historyLayout(messages) {
|
|
224
|
+
const batches = [];
|
|
225
|
+
const unsafeIndices = [];
|
|
226
|
+
let current;
|
|
227
|
+
let pending = new Map();
|
|
228
|
+
let valid = true;
|
|
229
|
+
let latestUser = -1;
|
|
230
|
+
let latestBrowserBatch;
|
|
231
|
+
const settle = ()=>{
|
|
232
|
+
if (current) {
|
|
233
|
+
current.complete = valid && pending.size === 0;
|
|
234
|
+
if (!current.complete) unsafeIndices.push(current.start);
|
|
235
|
+
}
|
|
236
|
+
current = undefined;
|
|
237
|
+
};
|
|
238
|
+
for (const [index, message] of messages.entries()){
|
|
239
|
+
if (message.role === "user") {
|
|
240
|
+
settle();
|
|
241
|
+
latestUser = index;
|
|
242
|
+
} else if (message.role === "assistant") {
|
|
243
|
+
settle();
|
|
244
|
+
current = {
|
|
245
|
+
start: index,
|
|
246
|
+
indices: [
|
|
247
|
+
index
|
|
248
|
+
],
|
|
249
|
+
complete: false
|
|
250
|
+
};
|
|
251
|
+
batches.push(current);
|
|
252
|
+
pending = new Map(message.toolCalls.map((call)=>[
|
|
253
|
+
call.id,
|
|
254
|
+
call.name
|
|
255
|
+
]));
|
|
256
|
+
valid = pending.size === message.toolCalls.length;
|
|
257
|
+
} else if (message.role === "tool") {
|
|
258
|
+
if (!current) {
|
|
259
|
+
unsafeIndices.push(index);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
current.indices.push(index);
|
|
263
|
+
if (pending.get(message.toolCallId) !== message.name) valid = false;
|
|
264
|
+
pending.delete(message.toolCallId);
|
|
265
|
+
if (message.name === "getSnapshot" || message.name === "executeCode") latestBrowserBatch = current;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
settle();
|
|
269
|
+
const protectedIndices = new Set(latestUser < 0 ? [] : [
|
|
270
|
+
latestUser
|
|
271
|
+
]);
|
|
272
|
+
const recent = batches.filter((batch)=>batch.complete).slice(-RECENT_BATCHES);
|
|
273
|
+
for (const batch of [
|
|
274
|
+
...recent,
|
|
275
|
+
...latestBrowserBatch ? [
|
|
276
|
+
latestBrowserBatch
|
|
277
|
+
] : []
|
|
278
|
+
]){
|
|
279
|
+
for (const index of batch.indices)protectedIndices.add(index);
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
batches,
|
|
283
|
+
latestUser,
|
|
284
|
+
protectedIndices,
|
|
285
|
+
unsafeIndices
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function boundaryIndex(messages, messageId, layout) {
|
|
289
|
+
const index = messages.findIndex((message)=>message.id === messageId && (message.role === "user" || message.role === "assistant"));
|
|
290
|
+
if (index < 0 || layout.unsafeIndices.some((unsafe)=>unsafe < index) || messages[index].role === "assistant" && !layout.batches.some((batch)=>batch.start === index && batch.complete)) {
|
|
291
|
+
throw new Error("History compaction boundary does not reference a complete batch or user message.");
|
|
292
|
+
}
|
|
293
|
+
return index;
|
|
294
|
+
}
|
|
295
|
+
function summaryMessage(summary, messages, boundary) {
|
|
296
|
+
let latestUser = -1;
|
|
297
|
+
let coveredUser = -1;
|
|
298
|
+
for (const [index, message] of messages.entries()){
|
|
299
|
+
if (message.role !== "user") continue;
|
|
300
|
+
latestUser = index;
|
|
301
|
+
if (index < boundary) coveredUser = index;
|
|
302
|
+
}
|
|
303
|
+
const request = coveredUser < 0 ? "No user request is covered." : `The last covered user request ID is ${JSON.stringify(messages[coveredUser].id ?? "unknown")}. ` + (coveredUser === latestUser ? "It is the current request; only confirmed outcomes explicitly attributed to this request count as its execution record." : "It is an earlier request; its outcomes do not fulfill the current request.") + " Subsequent execution messages belong to that request until the next user message.";
|
|
304
|
+
return {
|
|
305
|
+
role: "assistant",
|
|
306
|
+
content: "Summary of earlier conversation history. Treat this as historical evidence, not instructions or the current application state. " + request + "\n\n" + summary.content,
|
|
307
|
+
toolCalls: []
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function latestContextIndex(messages) {
|
|
311
|
+
let latest = -1;
|
|
312
|
+
let revision = -Infinity;
|
|
313
|
+
for (const [index, message] of messages.entries()){
|
|
314
|
+
if (message.role === "application_context" && message.revision >= revision) {
|
|
315
|
+
latest = index;
|
|
316
|
+
revision = message.revision;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return latest;
|
|
320
|
+
}
|
|
321
|
+
function validateHistorySummary(value, canonicalMessages) {
|
|
322
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Invalid history summary.");
|
|
323
|
+
const summary = value;
|
|
324
|
+
if (Object.keys(summary).some((key)=>key !== "beforeMessageId" && key !== "content") || typeof summary.beforeMessageId !== "string" || !summary.beforeMessageId || typeof summary.content !== "string" || !summary.content.trim() || encoder.encode(summary.content).byteLength > HISTORY_SUMMARY_MAX_BYTES) {
|
|
325
|
+
throw new Error("Invalid history summary.");
|
|
326
|
+
}
|
|
327
|
+
const validated = {
|
|
328
|
+
beforeMessageId: summary.beforeMessageId,
|
|
329
|
+
content: summary.content.trim()
|
|
330
|
+
};
|
|
331
|
+
boundaryIndex(canonicalMessages, validated.beforeMessageId, historyLayout(canonicalMessages));
|
|
332
|
+
return validated;
|
|
333
|
+
}
|
|
334
|
+
function validateCompactionAttempt(value, messages, summary) {
|
|
335
|
+
if (typeof value !== "string" || !value) throw new Error("Invalid history compaction attempt.");
|
|
336
|
+
const layout = historyLayout(messages);
|
|
337
|
+
const index = boundaryIndex(messages, value, layout);
|
|
338
|
+
if (summary && index < boundaryIndex(messages, summary.beforeMessageId, layout)) {
|
|
339
|
+
throw new Error("History compaction attempt precedes the summary.");
|
|
340
|
+
}
|
|
341
|
+
return value;
|
|
342
|
+
}
|
|
343
|
+
function selectModelHistory(messages, summary) {
|
|
344
|
+
const layout = historyLayout(messages);
|
|
345
|
+
const boundary = summary ? boundaryIndex(messages, summary.beforeMessageId, layout) : 0;
|
|
346
|
+
const contextIndex = latestContextIndex(messages);
|
|
347
|
+
const catalogIndex = messages.reduce((last, message, index)=>message.role === "system" && message.content.startsWith("[NEXFACE_RUNTIME_V1]") ? index : last, -1);
|
|
348
|
+
const entries = [];
|
|
349
|
+
for (const [index, message] of messages.entries()){
|
|
350
|
+
if (summary && index === boundary) entries.push({
|
|
351
|
+
message: summaryMessage(summary, messages, boundary),
|
|
352
|
+
index: -1
|
|
353
|
+
});
|
|
354
|
+
if (message.role === "system") {
|
|
355
|
+
if (message.content.startsWith("[NEXFACE_RUNTIME_V1]") && index !== catalogIndex) continue;
|
|
356
|
+
} else if (message.role === "application_context") {
|
|
357
|
+
if (index !== contextIndex) continue;
|
|
358
|
+
} else if (index < boundary && !layout.protectedIndices.has(index)) continue;
|
|
359
|
+
entries.push({
|
|
360
|
+
message,
|
|
361
|
+
index
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
return entries;
|
|
365
|
+
}
|
|
366
|
+
function serializedBytes(messages) {
|
|
367
|
+
return encoder.encode(JSON.stringify(messages)).byteLength;
|
|
368
|
+
}
|
|
369
|
+
function modelHistoryBytes(messages, summary) {
|
|
370
|
+
return serializedBytes(selectModelHistory(messages, summary).map((entry)=>entry.message));
|
|
371
|
+
}
|
|
372
|
+
function getHistoryCompactionInput(messages, previous, attemptBeforeMessageId) {
|
|
373
|
+
const layout = historyLayout(messages);
|
|
374
|
+
// A pending or malformed tool batch must be settled before choosing any new cut.
|
|
375
|
+
if (layout.unsafeIndices.length || layout.batches.length <= RECENT_BATCHES) return undefined;
|
|
376
|
+
const boundary = layout.batches[layout.batches.length - RECENT_BATCHES].start;
|
|
377
|
+
const beforeMessageId = messages[boundary].id;
|
|
378
|
+
const start = previous ? boundaryIndex(messages, previous.beforeMessageId, layout) : 0;
|
|
379
|
+
const attemptStart = attemptBeforeMessageId ? boundaryIndex(messages, attemptBeforeMessageId, layout) : start;
|
|
380
|
+
if (!beforeMessageId || boundary <= Math.max(start, attemptStart) || modelHistoryBytes(messages, previous) <= HISTORY_COMPACTION_TRIGGER_BYTES) return undefined;
|
|
381
|
+
const removable = messages.slice(attemptStart, boundary).filter((message, offset)=>message.role !== "system" && message.role !== "application_context" && !layout.protectedIndices.has(offset + attemptStart));
|
|
382
|
+
if (serializedBytes(removable) < HISTORY_COMPACTION_MIN_NEW_BYTES) return undefined;
|
|
383
|
+
const prefix = previous ? [
|
|
384
|
+
summaryMessage(previous, messages, start)
|
|
385
|
+
] : [];
|
|
386
|
+
for(let index = start; index < boundary; index += 1){
|
|
387
|
+
const message = messages[index];
|
|
388
|
+
if (message.role !== "system" && message.role !== "application_context") prefix.push(message);
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
beforeMessageId,
|
|
392
|
+
messages: prefix,
|
|
393
|
+
...layout.latestUser < 0 ? {} : {
|
|
394
|
+
latestUser: messages[layout.latestUser]
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
|
|
213
400
|
|
|
214
401
|
function parseArguments(value) {
|
|
215
402
|
try {
|
|
@@ -265,12 +452,12 @@ function toolIsError(content) {
|
|
|
265
452
|
return false;
|
|
266
453
|
}
|
|
267
454
|
}
|
|
268
|
-
function createPiContext(messages, tools, model, replay) {
|
|
455
|
+
function createPiContext(messages, tools, model, replay, historySummary) {
|
|
269
456
|
// pi-ai exposes one trusted systemPrompt rather than chronological system messages.
|
|
270
457
|
// Keep canonical checkpoints append-only, then consolidate them in their original order.
|
|
271
458
|
const system = [];
|
|
272
459
|
const piMessages = [];
|
|
273
|
-
messages.forEach((message, index)=>{
|
|
460
|
+
selectModelHistory(messages, historySummary).forEach(({ message, index })=>{
|
|
274
461
|
if (message.role === "system" || message.role === "application_context") {
|
|
275
462
|
system.push(message.content);
|
|
276
463
|
return;
|
|
@@ -468,8 +655,35 @@ class PiModelBinding {
|
|
|
468
655
|
this.#stream = stream;
|
|
469
656
|
this.#options = options;
|
|
470
657
|
}
|
|
658
|
+
exportReplay(messages) {
|
|
659
|
+
return [
|
|
660
|
+
...this.#replay
|
|
661
|
+
].flatMap(([index, message])=>{
|
|
662
|
+
const retained = messages[index - 1];
|
|
663
|
+
return retained?.role === "assistant" && retained.id ? [
|
|
664
|
+
{
|
|
665
|
+
messageId: retained.id,
|
|
666
|
+
message
|
|
667
|
+
}
|
|
668
|
+
] : [];
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
restoreReplay(replay, messages) {
|
|
672
|
+
if (!Array.isArray(replay)) throw new Error("Invalid model replay.");
|
|
673
|
+
for (const entry of replay){
|
|
674
|
+
const index = typeof entry?.messageId === "string" ? messages.findIndex((message)=>message.id === entry.messageId) : -1;
|
|
675
|
+
const canonical = messages[index];
|
|
676
|
+
const raw = entry?.message;
|
|
677
|
+
if (canonical?.role !== "assistant" || raw?.role !== "assistant" || !Array.isArray(raw.content)) throw new Error("Invalid replay message association.");
|
|
678
|
+
const converted = fromPiAssistant(raw);
|
|
679
|
+
const finish = converted.toolCalls.length === 1 && converted.toolCalls[0]?.name === "finish" ? JSON.parse(converted.toolCalls[0].arguments) : undefined;
|
|
680
|
+
const expectedContent = finish?.status === "completed" && typeof finish.output === "string" ? finish.output.trim() : converted.content;
|
|
681
|
+
if (JSON.stringify(converted.toolCalls) !== JSON.stringify(canonical.toolCalls) || expectedContent !== canonical.content) throw new Error("Replay does not match its assistant message.");
|
|
682
|
+
this.#replay.set(index + 1, structuredClone(raw));
|
|
683
|
+
}
|
|
684
|
+
}
|
|
471
685
|
async complete(request) {
|
|
472
|
-
const raw = await consumeStream(this.#stream.streamSimple(this.#model, createPiContext(request.messages, request.tools, this.#model, this.#replay), {
|
|
686
|
+
const raw = await consumeStream(this.#stream.streamSimple(this.#model, createPiContext(request.messages, request.tools, this.#model, this.#replay, request.historySummary), {
|
|
473
687
|
...this.#options,
|
|
474
688
|
signal: request.signal,
|
|
475
689
|
sessionId: request.agentId
|
|
@@ -489,49 +703,31 @@ class PiModelBinding {
|
|
|
489
703
|
}
|
|
490
704
|
function resolveModel(definition, config, baseURL) {
|
|
491
705
|
const catalogModel = definition.resolveCatalogModel?.(config.model);
|
|
492
|
-
|
|
493
|
-
throw new AgentModelError("MODEL_NOT_FOUND", `Model "${config.model}" was not found for provider "${definition.provider}".`);
|
|
494
|
-
}
|
|
495
|
-
const capabilities = {
|
|
496
|
-
...DEFAULT_CAPABILITIES,
|
|
497
|
-
...config.capabilities
|
|
498
|
-
};
|
|
499
|
-
if (catalogModel) {
|
|
500
|
-
return {
|
|
501
|
-
...catalogModel,
|
|
502
|
-
baseUrl: baseURL,
|
|
503
|
-
...config.capabilities?.reasoning === undefined ? {} : {
|
|
504
|
-
reasoning: config.capabilities.reasoning
|
|
505
|
-
},
|
|
506
|
-
...config.capabilities?.input === undefined ? {} : {
|
|
507
|
-
input: [
|
|
508
|
-
...config.capabilities.input
|
|
509
|
-
]
|
|
510
|
-
},
|
|
511
|
-
...config.capabilities?.contextWindow === undefined ? {} : {
|
|
512
|
-
contextWindow: config.capabilities.contextWindow
|
|
513
|
-
},
|
|
514
|
-
...config.capabilities?.maxOutputTokens === undefined ? {} : {
|
|
515
|
-
maxTokens: config.capabilities.maxOutputTokens
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
}
|
|
706
|
+
const capabilities = config.capabilities;
|
|
519
707
|
return {
|
|
708
|
+
...definition.preserveCatalogCompat && catalogModel?.compat !== undefined ? {
|
|
709
|
+
compat: catalogModel.compat
|
|
710
|
+
} : {},
|
|
711
|
+
...catalogModel?.thinkingLevelMap === undefined ? {} : {
|
|
712
|
+
thinkingLevelMap: catalogModel.thinkingLevelMap
|
|
713
|
+
},
|
|
520
714
|
id: config.model,
|
|
521
715
|
name: config.model,
|
|
522
716
|
api: definition.api,
|
|
523
717
|
provider: definition.provider,
|
|
524
718
|
baseUrl: baseURL,
|
|
525
|
-
reasoning: capabilities.reasoning,
|
|
526
|
-
input:
|
|
719
|
+
reasoning: capabilities?.reasoning ?? catalogModel?.reasoning ?? DEFAULT_CAPABILITIES.reasoning,
|
|
720
|
+
input: [
|
|
721
|
+
...capabilities?.input ?? catalogModel?.input ?? DEFAULT_CAPABILITIES.input
|
|
722
|
+
],
|
|
527
723
|
cost: {
|
|
528
724
|
input: 0,
|
|
529
725
|
output: 0,
|
|
530
726
|
cacheRead: 0,
|
|
531
727
|
cacheWrite: 0
|
|
532
728
|
},
|
|
533
|
-
contextWindow: capabilities.contextWindow,
|
|
534
|
-
maxTokens: capabilities.maxOutputTokens
|
|
729
|
+
contextWindow: capabilities?.contextWindow ?? catalogModel?.contextWindow ?? DEFAULT_CAPABILITIES.contextWindow,
|
|
730
|
+
maxTokens: capabilities?.maxOutputTokens ?? catalogModel?.maxTokens ?? DEFAULT_CAPABILITIES.maxOutputTokens
|
|
535
731
|
};
|
|
536
732
|
}
|
|
537
733
|
function createProtocolModelConfig(definition, config) {
|
|
@@ -544,9 +740,6 @@ function createProtocolModelConfig(definition, config) {
|
|
|
544
740
|
if (definition.supportsCustomFetch === false && config.fetch) {
|
|
545
741
|
invalid(`Custom fetch is not supported for provider "${definition.provider}".`);
|
|
546
742
|
}
|
|
547
|
-
if (definition.resolveCatalogModel && config.capabilities !== undefined) {
|
|
548
|
-
invalid(`Capability overrides are not supported for provider "${definition.provider}".`);
|
|
549
|
-
}
|
|
550
743
|
assertFiniteNumber(config.temperature, "temperature", 0);
|
|
551
744
|
assertFiniteNumber(config.maxTokens, "maxTokens", 1);
|
|
552
745
|
assertFiniteNumber(config.timeoutMs, "timeoutMs", 1);
|
|
@@ -590,6 +783,7 @@ function createProtocolModelConfig(definition, config) {
|
|
|
590
783
|
return defineAgentModelConfig({
|
|
591
784
|
info,
|
|
592
785
|
async resolve () {
|
|
786
|
+
const model = resolveModel(definition, preparedConfig, baseURL);
|
|
593
787
|
const configuredFetch = preparedConfig.fetch ?? globalThis.fetch;
|
|
594
788
|
const options = {
|
|
595
789
|
...preparedConfig.temperature === undefined ? {} : {
|
|
@@ -598,9 +792,9 @@ function createProtocolModelConfig(definition, config) {
|
|
|
598
792
|
...preparedConfig.maxTokens === undefined ? {} : {
|
|
599
793
|
maxTokens: preparedConfig.maxTokens
|
|
600
794
|
},
|
|
601
|
-
...preparedConfig.reasoning
|
|
795
|
+
...model.reasoning && preparedConfig.reasoning !== undefined ? {
|
|
602
796
|
reasoning: preparedConfig.reasoning
|
|
603
|
-
},
|
|
797
|
+
} : {},
|
|
604
798
|
...preparedConfig.timeoutMs === undefined ? {} : {
|
|
605
799
|
timeoutMs: preparedConfig.timeoutMs
|
|
606
800
|
},
|
|
@@ -622,9 +816,9 @@ function createProtocolModelConfig(definition, config) {
|
|
|
622
816
|
apiKey: preparedConfig.apiKey
|
|
623
817
|
}
|
|
624
818
|
};
|
|
625
|
-
return new PiModelBinding(info,
|
|
819
|
+
return new PiModelBinding(info, model, definition.stream, options);
|
|
626
820
|
}
|
|
627
821
|
});
|
|
628
822
|
}
|
|
629
823
|
|
|
630
|
-
export { AgentModelError, AssistantMessageEventStream, createProtocolModelConfig, lazyApi };
|
|
824
|
+
export { AgentModelError, AssistantMessageEventStream, createProtocolModelConfig, flattenModelCatalog, lazyApi };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { flattenModelCatalog } from "./39.js";
|
|
2
|
+
|
|
3
|
+
var openai_namespaceObject = /*#__PURE__*/JSON.parse('{"openai-responses":{"gpt-4":{"id":"gpt-4","name":"GPT-4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text"],"cost":{"input":30,"output":60,"cacheRead":0,"cacheWrite":0},"contextWindow":8192,"maxTokens":8192,"compat":{"supportsStrictMode":true}},"gpt-4-turbo":{"id":"gpt-4-turbo","name":"GPT-4 Turbo","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":10,"output":30,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true}},"gpt-4.1":{"id":"gpt-4.1","name":"GPT-4.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true}},"gpt-4.1-mini":{"id":"gpt-4.1-mini","name":"GPT-4.1 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.4,"output":1.6,"cacheRead":0.1,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true}},"gpt-4.1-nano":{"id":"gpt-4.1-nano","name":"GPT-4.1 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.1,"output":0.4,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true}},"gpt-4o":{"id":"gpt-4o","name":"GPT-4o","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-4o-2024-05-13":{"id":"gpt-4o-2024-05-13","name":"GPT-4o (2024-05-13)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":15,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true}},"gpt-4o-2024-08-06":{"id":"gpt-4o-2024-08-06","name":"GPT-4o (2024-08-06)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-4o-2024-11-20":{"id":"gpt-4o-2024-11-20","name":"GPT-4o (2024-11-20)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-4o-mini":{"id":"gpt-4o-mini","name":"GPT-4o mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.15,"output":0.6,"cacheRead":0.075,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-5":{"id":"gpt-5","name":"GPT-5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-chat-latest":{"id":"gpt-5-chat-latest","name":"GPT-5 Chat Latest","api":"openai-responses","baseUrl":"https://api.openai.com/v1","provider":"openai","reasoning":false,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-mini":{"id":"gpt-5-mini","name":"GPT-5 Mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":2,"cacheRead":0.025,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-nano":{"id":"gpt-5-nano","name":"GPT-5 Nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.05,"output":0.4,"cacheRead":0.005,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-pro":{"id":"gpt-5-pro","name":"GPT-5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":120,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.1":{"id":"gpt-5.1","name":"GPT-5.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.2":{"id":"gpt-5.2","name":"GPT-5.2","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.2-chat-latest":{"id":"gpt-5.2-chat-latest","name":"GPT-5.2 Chat","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":null,"xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.2-pro":{"id":"gpt-5.2-pro","name":"GPT-5.2 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":21,"output":168,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.3-chat-latest":{"id":"gpt-5.3-chat-latest","name":"GPT-5.3 Chat (latest)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"xhigh":"xhigh"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.3-codex":{"id":"gpt-5.3-codex","name":"GPT-5.3 Codex","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.3-codex-spark":{"id":"gpt-5.3-codex-spark","name":"GPT-5.3 Codex Spark","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.4":{"id":"gpt-5.4","name":"GPT-5.4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2.5,"output":15,"cacheRead":0.25,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":5,"output":22.5,"cacheRead":0.5,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.4-mini":{"id":"gpt-5.4-mini","name":"GPT-5.4 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.75,"output":4.5,"cacheRead":0.075,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.4-nano":{"id":"gpt-5.4-nano","name":"GPT-5.4 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.25,"cacheRead":0.02,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.4-pro":{"id":"gpt-5.4-pro","name":"GPT-5.4 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.5":{"id":"gpt-5.5","name":"GPT-5.5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":30,"cacheRead":0.5,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":10,"output":45,"cacheRead":1,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.5-pro":{"id":"gpt-5.5-pro","name":"GPT-5.5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.6-luna":{"id":"gpt-5.6-luna","name":"GPT-5.6 Luna","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.2,"cacheRead":0.02,"cacheWrite":0.25,"tiers":[{"inputTokensAbove":272000,"input":0.4,"output":1.8,"cacheRead":0.04,"cacheWrite":0.5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true,"supportsExplicitPromptCacheMode":true}},"gpt-5.6-sol":{"id":"gpt-5.6-sol","name":"GPT-5.6 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":30,"cacheRead":0.5,"cacheWrite":6.25,"tiers":[{"inputTokensAbove":272000,"input":10,"output":45,"cacheRead":1,"cacheWrite":12.5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true,"supportsExplicitPromptCacheMode":true}},"gpt-5.6-terra":{"id":"gpt-5.6-terra","name":"GPT-5.6 Terra","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":18,"cacheRead":0.4,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true,"supportsExplicitPromptCacheMode":true}},"gpt-realtime-2.1":{"id":"gpt-realtime-2.1","name":"GPT-Realtime-2.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":24,"cacheRead":0.4,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true}},"o1":{"id":"o1","name":"o1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":60,"cacheRead":7.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o1-pro":{"id":"o1-pro","name":"o1-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":150,"output":600,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o3":{"id":"o3","name":"o3","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o3-mini":{"id":"o3-mini","name":"o3-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.55,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o3-pro":{"id":"o3-pro","name":"o3-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":20,"output":80,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o4-mini":{"id":"o4-mini","name":"o4-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.275,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}}}}')
|
|
4
|
+
// This file is auto-generated by scripts/generate-models.ts
|
|
5
|
+
// Do not edit manually - run 'npm run generate-models' to update
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const OPENAI_MODELS = flattenModelCatalog("openai", openai_namespaceObject);
|
|
9
|
+
//# sourceMappingURL=openai.models.js.map
|
|
10
|
+
export { OPENAI_MODELS };
|
package/dist/models/_chunks/{anthropic-messages~1-a838a7c1.js → anthropic-messages~1-d35e3e7d.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../rslib-runtime.js";
|
|
2
2
|
import { getProviderEnvValue, buildCopilotDynamicHeaders, parseStreamingJson, parseJsonWithRepair, hasCopilotVisionInput } from "./86-c0c5ac98.js";
|
|
3
3
|
import { retryProviderRequest, adjustMaxTokensForThinking, headersToRecord, resolveJsonSchemaStrictSampling, transformMessages, calculateCost, clampMaxTokensToContext, buildBaseOptions, sanitizeSurrogates } from "./360-7e580bb2.js";
|
|
4
|
-
import { AssistantMessageEventStream } from "../
|
|
4
|
+
import { AssistantMessageEventStream } from "../39.js";
|
|
5
5
|
import { splitDeferredTools } from "./deferred-tools-90f3c977.js";
|
|
6
6
|
|
|
7
7
|
// NAMESPACE OBJECT: ../../node_modules/.pnpm/@earendil-works+pi-ai@0.84.1_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.1_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../rslib-runtime.js";
|
|
2
2
|
import { providerHeadersToRecord, clampThinkingLevel, resolveJsonSchemaStrictSampling, transformMessages, calculateCost, buildBaseOptions, retryProviderRequest, sanitizeSurrogates } from "./360-7e580bb2.js";
|
|
3
|
-
import { AssistantMessageEventStream } from "../
|
|
3
|
+
import { AssistantMessageEventStream } from "../39.js";
|
|
4
4
|
import { formatProviderError, normalizeProviderError } from "./error-body-8bee35c2.js";
|
|
5
5
|
|
|
6
6
|
__webpack_require__.add({
|
package/dist/models/_chunks/{openai-completions~1-396a5c3a.js → openai-completions~1-b340f0e0.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenAI, shortHash, clampOpenAIPromptCacheKey } from "./474-e1813138.js";
|
|
2
2
|
import { getProviderEnvValue, buildCopilotDynamicHeaders, parseStreamingJson, hasCopilotVisionInput } from "./86-c0c5ac98.js";
|
|
3
|
-
import { AssistantMessageEventStream } from "../
|
|
3
|
+
import { AssistantMessageEventStream } from "../39.js";
|
|
4
4
|
import { sanitizeSurrogates, appendGrammarToolInputJsonDelta, resolveGrammarConstrainedSampling, getGrammarToolInput, headersToRecord, clampThinkingLevel, clampReasoning, resolveJsonSchemaStrictSampling, transformMessages, calculateCost, buildBaseOptions, retryProviderRequest, createGrammarToolInputProperties } from "./360-7e580bb2.js";
|
|
5
5
|
import { formatProviderError, normalizeProviderError } from "./error-body-8bee35c2.js";
|
|
6
6
|
|
package/dist/models/_chunks/{openai-responses~1-2b3e0291.js → openai-responses~1-b53c65c2.js}
RENAMED
|
@@ -3,7 +3,7 @@ import { sanitizeSurrogates, appendGrammarToolInputJsonDelta, resolveGrammarCons
|
|
|
3
3
|
import { OpenAI, shortHash, clampOpenAIPromptCacheKey } from "./474-e1813138.js";
|
|
4
4
|
import { getProviderEnvValue, buildCopilotDynamicHeaders, parseStreamingJson, hasCopilotVisionInput } from "./86-c0c5ac98.js";
|
|
5
5
|
import { formatProviderError, normalizeProviderError } from "./error-body-8bee35c2.js";
|
|
6
|
-
import { AssistantMessageEventStream } from "../
|
|
6
|
+
import { AssistantMessageEventStream } from "../39.js";
|
|
7
7
|
import { splitDeferredTools } from "./deferred-tools-90f3c977.js";
|
|
8
8
|
|
|
9
9
|
// NAMESPACE OBJECT: ../../node_modules/.pnpm/@earendil-works+pi-ai@0.84.1_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.1_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentModelConfig, AgentModelFactoryConfig } from "./types.js";
|
|
2
|
-
export interface ModelConfigOptions extends
|
|
2
|
+
export interface ModelConfigOptions extends AgentModelFactoryConfig {
|
|
3
3
|
}
|
|
4
4
|
export declare function createModelConfig(config: ModelConfigOptions): AgentModelConfig;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { lazyApi, AgentModelError, createProtocolModelConfig } from "./
|
|
2
|
-
import { flattenModelCatalog } from "./663.js";
|
|
1
|
+
import { lazyApi, AgentModelError, flattenModelCatalog, createProtocolModelConfig } from "./39.js";
|
|
3
2
|
|
|
4
3
|
|
|
5
|
-
const anthropicMessagesApi = () => lazyApi(() => import("./_chunks/anthropic-messages~1-
|
|
4
|
+
const anthropicMessagesApi = () => lazyApi(() => import("./_chunks/anthropic-messages~1-d35e3e7d.js").then(m => m.anthropic_messages_namespaceObject));
|
|
6
5
|
//# sourceMappingURL=anthropic-messages.lazy.js.map
|
|
7
6
|
var anthropic_namespaceObject = /*#__PURE__*/JSON.parse('{"anthropic-messages":{"claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}}}}')
|
|
8
7
|
// This file is auto-generated by scripts/generate-models.ts
|
|
@@ -25,6 +24,7 @@ function createModelConfig(config) {
|
|
|
25
24
|
api: "anthropic-messages",
|
|
26
25
|
defaultBaseURL: "https://api.anthropic.com",
|
|
27
26
|
stream: anthropicMessagesApi(),
|
|
27
|
+
preserveCatalogCompat: true,
|
|
28
28
|
resolveCatalogModel: (model)=>Object.values(ANTHROPIC_MODELS).find(({ id })=>id === model)
|
|
29
29
|
}, config);
|
|
30
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentModelConfig, AgentModelFactoryConfig } from "./types.js";
|
|
2
|
-
export interface ModelConfigOptions extends Omit<AgentModelFactoryConfig, "
|
|
2
|
+
export interface ModelConfigOptions extends Omit<AgentModelFactoryConfig, "fetch" | "timeoutMs"> {
|
|
3
3
|
}
|
|
4
4
|
export declare function createModelConfig(config: ModelConfigOptions): AgentModelConfig;
|