@nyte-ai/ai 0.0.23 → 0.0.25-beta.1
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/THIRD-PARTY-NOTICES.md +2 -38
- package/dist/chunks/{account-limits-cache-8qzk56vj.js → account-limits-cache-4qpef10z.js} +14 -1
- package/dist/chunks/{account-limits-cache-xds88kxd.js → account-limits-cache-525841fw.js} +12 -2
- package/dist/chunks/{account-limits-cache-me1x57bs.js → account-limits-cache-5ya94ve1.js} +42 -12
- package/dist/chunks/{account-limits-cache-ezvbhjym.js → account-limits-cache-5zw0zvpy.js} +4 -4
- package/dist/chunks/{account-limits-cache-pfa86y8e.js → account-limits-cache-9twrnvar.js} +1 -1
- package/dist/chunks/{account-limits-cache-vwgfz727.js → account-limits-cache-b25batbp.js} +2 -2
- package/dist/chunks/{account-limits-cache-vbw7n959.js → account-limits-cache-c8r9ga7d.js} +8 -8
- package/dist/chunks/{account-limits-cache-tq0ddhww.js → account-limits-cache-eq2sae8w.js} +3 -3
- package/dist/chunks/{account-limits-cache-zn01kscn.js → account-limits-cache-gtv32njs.js} +1 -1
- package/dist/chunks/{account-limits-cache-nxkprk3g.js → account-limits-cache-gvscpb51.js} +1 -1
- package/dist/chunks/{account-limits-cache-925zgz25.js → account-limits-cache-jt8g1rn2.js} +4 -4
- package/dist/chunks/{account-limits-cache-hndeb95d.js → account-limits-cache-k4zewdqs.js} +1 -1
- package/dist/chunks/{account-limits-cache-8yq9e32s.js → account-limits-cache-kn9pwsba.js} +3 -3
- package/dist/chunks/{account-limits-cache-0jdep92d.js → account-limits-cache-n916ac1t.js} +1 -1
- package/dist/chunks/{account-limits-cache-fdwad56n.js → account-limits-cache-qnrhx8gg.js} +1 -1
- package/dist/chunks/{account-limits-cache-w8ya0xct.js → account-limits-cache-rp9ht95p.js} +1 -1
- package/dist/chunks/{account-limits-cache-n3yk6g5c.js → account-limits-cache-s77e2bgc.js} +1 -1
- package/dist/chunks/{account-limits-cache-bsknrh6t.js → account-limits-cache-sk1m9fsp.js} +1 -1
- package/dist/chunks/{account-limits-cache-aazmkcnq.js → account-limits-cache-w0abqhna.js} +2 -2
- package/dist/chunks/{account-limits-cache-j8c5ra3q.js → account-limits-cache-wawwj02k.js} +16 -5
- package/dist/chunks/{account-limits-cache-6r6bqm7g.js → account-limits-cache-ygydb22m.js} +1 -1
- package/dist/chunks/{account-limits-cache-fbkaq46e.js → account-limits-cache-z9mfzg68.js} +1 -1
- package/dist/src/api/anthropic-convert.d.ts +9 -3
- package/dist/src/api/anthropic-convert.js +5 -2
- package/dist/src/api/anthropic-messages.js +48 -17
- package/dist/src/api/anthropic-messages.lazy.js +1 -1
- package/dist/src/api/deferred.js +1 -1
- package/dist/src/api/google-generative-ai.js +1 -1
- package/dist/src/api/google-generative-ai.lazy.js +1 -1
- package/dist/src/api/openai-codex-compact.js +7 -7
- package/dist/src/api/openai-codex-protocol.js +4 -4
- package/dist/src/api/openai-codex-responses.js +8 -8
- package/dist/src/api/openai-codex-responses.lazy.js +1 -1
- package/dist/src/api/openai-codex-websocket.js +7 -7
- package/dist/src/api/openai-completions-convert.js +2 -2
- package/dist/src/api/openai-completions-params.js +3 -3
- package/dist/src/api/openai-completions-reasoning.d.ts +5 -5
- package/dist/src/api/openai-completions.js +4 -4
- package/dist/src/api/openai-completions.lazy.js +1 -1
- package/dist/src/api/openai-responses-convert.js +2 -2
- package/dist/src/api/openai-responses-events.d.ts +98 -98
- package/dist/src/api/openai-responses-stream.js +4 -4
- package/dist/src/api/openai-responses.js +4 -4
- package/dist/src/api/openai-responses.lazy.js +1 -1
- package/dist/src/api/transform-messages.d.ts +11 -1
- package/dist/src/api/transform-messages.js +3 -1
- package/dist/src/auth/oauth/authorization-input.d.ts +2 -2
- package/dist/src/index.js +19 -19
- package/dist/src/providers/anthropic.js +2 -2
- package/dist/src/providers/github-copilot.d.ts +1 -1
- package/dist/src/providers/github-copilot.js +4 -4
- package/dist/src/providers/nyte-catalog.js +14 -14
- package/dist/src/providers/openai-codex.js +2 -2
- package/dist/src/providers/openai.js +2 -2
- package/dist/src/providers/opencode-go.js +6 -6
- package/dist/src/providers/opencode.js +5 -5
- package/dist/src/providers/openrouter.js +2 -2
- package/dist/src/providers/vercel-ai-gateway.js +2 -2
- package/dist/src/utils/failure.js +1 -1
- package/dist/src/utils/json-parse.js +1 -1
- package/dist/src/utils/overflow.js +2 -2
- package/dist/src/utils/retry.js +2 -2
- package/dist/src/utils/sse.js +1 -1
- package/package.json +3 -4
- /package/dist/chunks/{account-limits-cache-eyx1jcxc.js → account-limits-cache-20ttssmw.js} +0 -0
- /package/dist/chunks/{account-limits-cache-3dpd8f8k.js → account-limits-cache-3as87r3h.js} +0 -0
- /package/dist/chunks/{account-limits-cache-hxy4942k.js → account-limits-cache-khyz4r1r.js} +0 -0
- /package/dist/chunks/{account-limits-cache-k8z39pe7.js → account-limits-cache-s4xgnvwg.js} +0 -0
- /package/dist/chunks/{account-limits-cache-cknzwbq2.js → account-limits-cache-yck8f1w5.js} +0 -0
- /package/dist/chunks/{account-limits-cache-s9b5ecy4.js → account-limits-cache-z4y0mmpy.js} +0 -0
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -45,39 +45,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
45
45
|
SOFTWARE.
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
## pi-claude-code (`earendil-works/pi-claude-code`)
|
|
49
|
-
|
|
50
|
-
- Repository: https://github.com/earendil-works/pi-claude-code
|
|
51
|
-
- What: the Claude Code CLI provider, single-turn relay, transcript replay,
|
|
52
|
-
process reuse, and billing guards in `packages/plugin/examples/claude-code`
|
|
53
|
-
are adapted from commit `70abb65186592ca788b29b3db22c3160d629c41f`.
|
|
54
|
-
|
|
55
|
-
License: MIT, with the following notice:
|
|
56
|
-
|
|
57
|
-
```text
|
|
58
|
-
MIT License
|
|
59
|
-
|
|
60
|
-
Copyright (c) 2026 Armin Ronacher
|
|
61
|
-
|
|
62
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
63
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
64
|
-
in the Software without restriction, including without limitation the rights
|
|
65
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
66
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
67
|
-
furnished to do so, subject to the following conditions:
|
|
68
|
-
|
|
69
|
-
The above copyright notice and this permission notice shall be included in all
|
|
70
|
-
copies or substantial portions of the Software.
|
|
71
|
-
|
|
72
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
73
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
74
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
75
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
76
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
77
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
78
|
-
SOFTWARE.
|
|
79
|
-
```
|
|
80
|
-
|
|
81
48
|
## pi (`earendil-works/pi`)
|
|
82
49
|
|
|
83
50
|
- Repository: https://github.com/earendil-works/pi
|
|
@@ -345,8 +312,8 @@ Copyright 2025 OpenAI
|
|
|
345
312
|
front of the queue (`packages/tui/src/model/interactions.ts`) is its
|
|
346
313
|
`onEmptySubmit`. The rename
|
|
347
314
|
plugin's context construction, prompt, model fallback, and output cleanup
|
|
348
|
-
(`packages/plugin/
|
|
349
|
-
plugin set (`packages/plugin/
|
|
315
|
+
(`packages/plugin/src/rename.ts`) port OpenCode v2. The web-search
|
|
316
|
+
plugin set (`packages/plugin/src/web-search.ts`) ports its Exa, Firecrawl,
|
|
350
317
|
Parallel, and Tavily adapters, its stateless MCP `tools/call` transport and
|
|
351
318
|
response bounds, its result and error vocabulary, and its arrangement of one
|
|
352
319
|
plugin per provider from OpenCode v2.
|
|
@@ -429,9 +396,6 @@ SOFTWARE.
|
|
|
429
396
|
bypass, and connection tuning in `packages/host/src/sqlite*.ts` are adapted
|
|
430
397
|
from `bf8ffe81a63c82d3de5fbaa9991fd5f30034a452`.
|
|
431
398
|
- Homepage: https://t3.codes
|
|
432
|
-
- What: the demo desktop app (`packages/demo/desktop`) follows T3 Code's
|
|
433
|
-
control-surface shape — agents in a sidebar, a conversation workspace, a
|
|
434
|
-
shared composer, and settings behind a dialog.
|
|
435
399
|
|
|
436
400
|
License: MIT, with the following notice:
|
|
437
401
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/api/transform-messages.ts
|
|
2
2
|
var NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
|
3
3
|
var NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
|
|
4
|
+
var ERROR_TOOL_IMAGE_PLACEHOLDER = "(image attached after the tool results)";
|
|
4
5
|
function replaceImagesWithPlaceholder(content, placeholder) {
|
|
5
6
|
const result = [];
|
|
6
7
|
let previousWasPlaceholder = false;
|
|
@@ -17,6 +18,18 @@ function replaceImagesWithPlaceholder(content, placeholder) {
|
|
|
17
18
|
}
|
|
18
19
|
return result;
|
|
19
20
|
}
|
|
21
|
+
function splitErrorToolResultImages2(msg) {
|
|
22
|
+
if (!msg.isError)
|
|
23
|
+
return;
|
|
24
|
+
const images = msg.content.filter((block) => block.type === "image");
|
|
25
|
+
if (images.length === 0)
|
|
26
|
+
return;
|
|
27
|
+
return {
|
|
28
|
+
content: replaceImagesWithPlaceholder(msg.content, ERROR_TOOL_IMAGE_PLACEHOLDER),
|
|
29
|
+
caption: `Images from the error result of tool call ${msg.toolCallId} (${msg.toolName}):`,
|
|
30
|
+
images
|
|
31
|
+
};
|
|
32
|
+
}
|
|
20
33
|
function downgradeUnsupportedImages(messages, model) {
|
|
21
34
|
if (model.input.includes("image")) {
|
|
22
35
|
return messages;
|
|
@@ -157,4 +170,4 @@ function transformMessages2(messages, model, normalizeToolCallId) {
|
|
|
157
170
|
return result;
|
|
158
171
|
}
|
|
159
172
|
|
|
160
|
-
export { transformMessages2 };
|
|
173
|
+
export { splitErrorToolResultImages2, transformMessages2 };
|
|
@@ -62,13 +62,15 @@ var OVERLOADED_PATTERN = pattern([
|
|
|
62
62
|
"\\b529\\b",
|
|
63
63
|
"\\b5(?:00|02|03|04|20|24)\\b",
|
|
64
64
|
"overload",
|
|
65
|
+
"server_busy",
|
|
66
|
+
"servers are currently busy",
|
|
65
67
|
"currently experiencing high demand",
|
|
66
68
|
"model is at capacity",
|
|
67
69
|
"service.?unavailable",
|
|
68
70
|
"temporarily unavailable",
|
|
69
71
|
"server.?error",
|
|
70
72
|
"internal.?error",
|
|
71
|
-
"provider.?returned.?error",
|
|
73
|
+
"provider.?returned.?(?:an.?)?error",
|
|
72
74
|
"exceeded request buffer limit while retrying upstream",
|
|
73
75
|
"you can retry your request",
|
|
74
76
|
"try your request again",
|
|
@@ -84,6 +86,12 @@ var NETWORK_PATTERN = pattern([
|
|
|
84
86
|
"ENOTFOUND",
|
|
85
87
|
"EAI_AGAIN",
|
|
86
88
|
"upstream.?connect",
|
|
89
|
+
"unable to forward upstream",
|
|
90
|
+
"upstream.?request.?failed",
|
|
91
|
+
"upstream_stream_read_error",
|
|
92
|
+
"stream was interrupted",
|
|
93
|
+
"http/?2 stream failed",
|
|
94
|
+
"request to \\S+ failed, reason:",
|
|
87
95
|
"reset before headers",
|
|
88
96
|
"socket hang up",
|
|
89
97
|
"socket connection was closed",
|
|
@@ -94,7 +102,9 @@ var NETWORK_PATTERN = pattern([
|
|
|
94
102
|
"ended without",
|
|
95
103
|
"stream ended before message_stop",
|
|
96
104
|
"stream ended before a terminal response event",
|
|
97
|
-
"http2 request did not get a response"
|
|
105
|
+
"http2 request did not get a response",
|
|
106
|
+
"stream disconnected before completion",
|
|
107
|
+
"pending stream has been canceled"
|
|
98
108
|
]);
|
|
99
109
|
var RETRY_DELAY_PATTERN = /server requested ([0-9]+(?:\.[0-9]+)?)s retry delay(?: \(max: ([0-9]+(?:\.[0-9]+)?)s\))?/i;
|
|
100
110
|
function classForStatus(status) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
// src/utils/sse.ts
|
|
2
|
-
var LINE_BREAK = /\r\n|\r|\n/;
|
|
3
|
-
var FIELD = /^([^:]*):? ?(.*)$/s;
|
|
4
2
|
function flushEvent(state) {
|
|
5
3
|
if (state.event === null && state.data.length === 0)
|
|
6
4
|
return;
|
|
@@ -21,20 +19,51 @@ function decodeLine(line, state) {
|
|
|
21
19
|
state.raw.push(line);
|
|
22
20
|
if (line.startsWith(":"))
|
|
23
21
|
return;
|
|
24
|
-
const
|
|
22
|
+
const colon = line.indexOf(":");
|
|
23
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
24
|
+
const value = colon === -1 ? "" : line.slice(colon + (line[colon + 1] === " " ? 2 : 1));
|
|
25
25
|
if (field === "event")
|
|
26
26
|
state.event = value;
|
|
27
27
|
else if (field === "data")
|
|
28
28
|
state.data.push(value);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
function* takeLines(buffer, final) {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
function* takeLines(buffer, chunk, final) {
|
|
32
|
+
let start = 0;
|
|
33
|
+
if (buffer.pendingCr) {
|
|
34
|
+
if (chunk.length === 0 && !final)
|
|
34
35
|
return;
|
|
35
|
-
yield buffer.
|
|
36
|
-
buffer.
|
|
36
|
+
yield buffer.fragments.join("");
|
|
37
|
+
buffer.fragments = [];
|
|
38
|
+
buffer.pendingCr = false;
|
|
39
|
+
if (chunk.startsWith(`
|
|
40
|
+
`))
|
|
41
|
+
start = 1;
|
|
37
42
|
}
|
|
43
|
+
let cr = chunk.indexOf("\r", start);
|
|
44
|
+
let lf = chunk.indexOf(`
|
|
45
|
+
`, start);
|
|
46
|
+
while (cr !== -1 || lf !== -1) {
|
|
47
|
+
const index = cr === -1 ? lf : lf === -1 ? cr : Math.min(cr, lf);
|
|
48
|
+
const isCr = index === cr;
|
|
49
|
+
buffer.fragments.push(chunk.slice(start, index));
|
|
50
|
+
if (!final && isCr && index === chunk.length - 1) {
|
|
51
|
+
buffer.pendingCr = true;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
yield buffer.fragments.join("");
|
|
55
|
+
buffer.fragments = [];
|
|
56
|
+
start = index + 1;
|
|
57
|
+
if (isCr && lf === start)
|
|
58
|
+
start += 1;
|
|
59
|
+
if (cr !== -1 && cr < start)
|
|
60
|
+
cr = chunk.indexOf("\r", start);
|
|
61
|
+
if (lf !== -1 && lf < start)
|
|
62
|
+
lf = chunk.indexOf(`
|
|
63
|
+
`, start);
|
|
64
|
+
}
|
|
65
|
+
if (start < chunk.length)
|
|
66
|
+
buffer.fragments.push(chunk.slice(start));
|
|
38
67
|
}
|
|
39
68
|
async function* iterateServerSentEvents2(body, signal, idleTimeoutMs) {
|
|
40
69
|
const reader = body.getReader();
|
|
@@ -44,7 +73,7 @@ async function* iterateServerSentEvents2(body, signal, idleTimeoutMs) {
|
|
|
44
73
|
signal?.addEventListener("abort", cancel, { once: true });
|
|
45
74
|
const decoder = new TextDecoder;
|
|
46
75
|
const state = { event: null, data: [], raw: [] };
|
|
47
|
-
const buffer = {
|
|
76
|
+
const buffer = { fragments: [], pendingCr: false };
|
|
48
77
|
let idleTimer;
|
|
49
78
|
let idleTimedOut = false;
|
|
50
79
|
try {
|
|
@@ -63,8 +92,8 @@ async function* iterateServerSentEvents2(body, signal, idleTimeoutMs) {
|
|
|
63
92
|
throw new Error("Request was aborted");
|
|
64
93
|
if (idleTimedOut)
|
|
65
94
|
throw new DOMException("SSE idle timeout", "TimeoutError");
|
|
66
|
-
|
|
67
|
-
for (const line of takeLines(buffer, done)) {
|
|
95
|
+
const chunk = done ? decoder.decode() : decoder.decode(value, { stream: true });
|
|
96
|
+
for (const line of takeLines(buffer, chunk, done)) {
|
|
68
97
|
const event = decodeLine(line, state);
|
|
69
98
|
if (event)
|
|
70
99
|
yield event;
|
|
@@ -72,7 +101,8 @@ async function* iterateServerSentEvents2(body, signal, idleTimeoutMs) {
|
|
|
72
101
|
if (done)
|
|
73
102
|
break;
|
|
74
103
|
}
|
|
75
|
-
const
|
|
104
|
+
const text = buffer.fragments.join("");
|
|
105
|
+
const trailing = text.length > 0 ? decodeLine(text, state) : undefined;
|
|
76
106
|
if (trailing)
|
|
77
107
|
yield trailing;
|
|
78
108
|
const last = flushEvent(state);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
anthropicMessagesApi2
|
|
3
|
-
} from "./account-limits-cache-
|
|
3
|
+
} from "./account-limits-cache-3as87r3h.js";
|
|
4
4
|
import {
|
|
5
5
|
openAICompletionsApi2
|
|
6
|
-
} from "./account-limits-cache-
|
|
6
|
+
} from "./account-limits-cache-20ttssmw.js";
|
|
7
7
|
import {
|
|
8
8
|
openAIResponsesApi2
|
|
9
|
-
} from "./account-limits-cache-
|
|
9
|
+
} from "./account-limits-cache-s4xgnvwg.js";
|
|
10
10
|
import {
|
|
11
11
|
envApiKeyAuth2
|
|
12
12
|
} from "./account-limits-cache-6x05n06z.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./account-limits-cache-fht68jp2.js";
|
|
19
19
|
import {
|
|
20
20
|
OPENCODE_PROMPT_CACHE2
|
|
21
|
-
} from "./account-limits-cache-
|
|
21
|
+
} from "./account-limits-cache-jt8g1rn2.js";
|
|
22
22
|
|
|
23
23
|
// src/providers/opencode-go.ts
|
|
24
24
|
function opencodeGoProvider2() {
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./account-limits-cache-9wqk28n5.js";
|
|
21
21
|
import {
|
|
22
22
|
iterateServerSentEvents2
|
|
23
|
-
} from "./account-limits-cache-
|
|
23
|
+
} from "./account-limits-cache-5ya94ve1.js";
|
|
24
24
|
import {
|
|
25
25
|
getSystemMessageText2
|
|
26
26
|
} from "./account-limits-cache-b4edaybk.js";
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
import {
|
|
36
36
|
convertResponsesMessages2,
|
|
37
37
|
convertResponsesTools2
|
|
38
|
-
} from "./account-limits-cache-
|
|
38
|
+
} from "./account-limits-cache-s77e2bgc.js";
|
|
39
39
|
|
|
40
40
|
// src/api/openai-codex-protocol.ts
|
|
41
41
|
import { Type } from "typebox";
|
|
@@ -12,28 +12,28 @@ import {
|
|
|
12
12
|
} from "./account-limits-cache-5jdhn0e1.js";
|
|
13
13
|
import {
|
|
14
14
|
anthropicProvider2
|
|
15
|
-
} from "./account-limits-cache-
|
|
15
|
+
} from "./account-limits-cache-k4zewdqs.js";
|
|
16
16
|
import {
|
|
17
17
|
githubCopilotProvider2
|
|
18
|
-
} from "./account-limits-cache-
|
|
18
|
+
} from "./account-limits-cache-kn9pwsba.js";
|
|
19
19
|
import {
|
|
20
20
|
openaiCodexProvider2
|
|
21
|
-
} from "./account-limits-cache-
|
|
21
|
+
} from "./account-limits-cache-n916ac1t.js";
|
|
22
22
|
import {
|
|
23
23
|
openaiProvider2
|
|
24
|
-
} from "./account-limits-cache-
|
|
24
|
+
} from "./account-limits-cache-ygydb22m.js";
|
|
25
25
|
import {
|
|
26
26
|
opencodeProvider2
|
|
27
|
-
} from "./account-limits-cache-
|
|
27
|
+
} from "./account-limits-cache-jt8g1rn2.js";
|
|
28
28
|
import {
|
|
29
29
|
opencodeGoProvider2
|
|
30
|
-
} from "./account-limits-cache-
|
|
30
|
+
} from "./account-limits-cache-5zw0zvpy.js";
|
|
31
31
|
import {
|
|
32
32
|
openrouterProvider2
|
|
33
|
-
} from "./account-limits-cache-
|
|
33
|
+
} from "./account-limits-cache-9twrnvar.js";
|
|
34
34
|
import {
|
|
35
35
|
vercelAiGatewayProvider2
|
|
36
|
-
} from "./account-limits-cache-
|
|
36
|
+
} from "./account-limits-cache-rp9ht95p.js";
|
|
37
37
|
|
|
38
38
|
// src/providers/nyte-catalog.ts
|
|
39
39
|
var NYTE_PROVIDERS = [
|
|
@@ -29,18 +29,18 @@ import {
|
|
|
29
29
|
} from "./account-limits-cache-fvadc36m.js";
|
|
30
30
|
import {
|
|
31
31
|
convertResponsesMessages2
|
|
32
|
-
} from "./account-limits-cache-
|
|
32
|
+
} from "./account-limits-cache-s77e2bgc.js";
|
|
33
33
|
import {
|
|
34
34
|
CODEX_TOOL_CALL_PROVIDERS2,
|
|
35
35
|
codexStreamOptions2,
|
|
36
36
|
CodexApiError2,
|
|
37
37
|
CodexProtocolError2,
|
|
38
38
|
mapCodexEvents2
|
|
39
|
-
} from "./account-limits-cache-
|
|
39
|
+
} from "./account-limits-cache-b25batbp.js";
|
|
40
40
|
import {
|
|
41
41
|
ResponsesUsageError2,
|
|
42
42
|
processResponsesStream2
|
|
43
|
-
} from "./account-limits-cache-
|
|
43
|
+
} from "./account-limits-cache-w0abqhna.js";
|
|
44
44
|
|
|
45
45
|
// src/api/openai-codex-websocket.ts
|
|
46
46
|
import { Value } from "typebox/value";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
anthropicMessagesApi2
|
|
3
|
-
} from "./account-limits-cache-
|
|
3
|
+
} from "./account-limits-cache-3as87r3h.js";
|
|
4
4
|
import {
|
|
5
5
|
googleGenerativeAIApi2
|
|
6
|
-
} from "./account-limits-cache-
|
|
6
|
+
} from "./account-limits-cache-khyz4r1r.js";
|
|
7
7
|
import {
|
|
8
8
|
openAICompletionsApi2
|
|
9
|
-
} from "./account-limits-cache-
|
|
9
|
+
} from "./account-limits-cache-20ttssmw.js";
|
|
10
10
|
import {
|
|
11
11
|
openAIResponsesApi2
|
|
12
|
-
} from "./account-limits-cache-
|
|
12
|
+
} from "./account-limits-cache-s4xgnvwg.js";
|
|
13
13
|
import {
|
|
14
14
|
envApiKeyAuth2
|
|
15
15
|
} from "./account-limits-cache-6x05n06z.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
anthropicMessagesApi2
|
|
3
|
-
} from "./account-limits-cache-
|
|
3
|
+
} from "./account-limits-cache-3as87r3h.js";
|
|
4
4
|
import {
|
|
5
5
|
openAICompletionsApi2
|
|
6
|
-
} from "./account-limits-cache-
|
|
6
|
+
} from "./account-limits-cache-20ttssmw.js";
|
|
7
7
|
import {
|
|
8
8
|
openAIResponsesApi2
|
|
9
|
-
} from "./account-limits-cache-
|
|
9
|
+
} from "./account-limits-cache-s4xgnvwg.js";
|
|
10
10
|
import {
|
|
11
11
|
envApiKeyAuth2
|
|
12
12
|
} from "./account-limits-cache-6x05n06z.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./account-limits-cache-h92bzz1j.js";
|
|
21
21
|
import {
|
|
22
22
|
transformMessages2
|
|
23
|
-
} from "./account-limits-cache-
|
|
23
|
+
} from "./account-limits-cache-4qpef10z.js";
|
|
24
24
|
import {
|
|
25
25
|
parseOpenAIReasoningDetails2,
|
|
26
26
|
parseLegacyEncryptedReasoningDetail2,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./account-limits-cache-h92bzz1j.js";
|
|
21
21
|
import {
|
|
22
22
|
transformMessages2
|
|
23
|
-
} from "./account-limits-cache-
|
|
23
|
+
} from "./account-limits-cache-4qpef10z.js";
|
|
24
24
|
|
|
25
25
|
// src/api/openai-responses-convert.ts
|
|
26
26
|
import { Type } from "typebox";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
parseStreamingJson2,
|
|
6
6
|
parseToolCallArguments2,
|
|
7
7
|
unfinishedToolCallArguments2
|
|
8
|
-
} from "./account-limits-cache-
|
|
8
|
+
} from "./account-limits-cache-z9mfzg68.js";
|
|
9
9
|
import {
|
|
10
10
|
appendGrammarToolInputJsonDelta2
|
|
11
11
|
} from "./account-limits-cache-h92bzz1j.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./account-limits-cache-736tdyme.js";
|
|
19
19
|
import {
|
|
20
20
|
encodeTextSignatureV12
|
|
21
|
-
} from "./account-limits-cache-
|
|
21
|
+
} from "./account-limits-cache-s77e2bgc.js";
|
|
22
22
|
import {
|
|
23
23
|
TerminalReasoningItemSchema2,
|
|
24
24
|
StoredReasoningItemSchema2,
|
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
toClaudeCodeName2
|
|
13
13
|
} from "./account-limits-cache-ks1sjym9.js";
|
|
14
|
+
import {
|
|
15
|
+
splitErrorToolResultImages2
|
|
16
|
+
} from "./account-limits-cache-4qpef10z.js";
|
|
14
17
|
|
|
15
18
|
// src/api/anthropic-convert.ts
|
|
16
19
|
import { IsProperties, IsRequired } from "typebox/schema";
|
|
@@ -134,7 +137,6 @@ function convertMessages3(transformedMessages, isOAuthToken, cacheControl, allow
|
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
139
|
} else if (msg.role === "assistant") {
|
|
137
|
-
flushPendingSystemMessages();
|
|
138
140
|
const blocks = [];
|
|
139
141
|
for (const block of msg.content) {
|
|
140
142
|
if (block.type === "text") {
|
|
@@ -183,6 +185,7 @@ function convertMessages3(transformedMessages, isOAuthToken, cacheControl, allow
|
|
|
183
185
|
}
|
|
184
186
|
if (blocks.length === 0)
|
|
185
187
|
continue;
|
|
188
|
+
flushPendingSystemMessages();
|
|
186
189
|
params.push({
|
|
187
190
|
role: "assistant",
|
|
188
191
|
content: blocks
|
|
@@ -195,9 +198,13 @@ function convertMessages3(transformedMessages, isOAuthToken, cacheControl, allow
|
|
|
195
198
|
const next = transformedMessages[j];
|
|
196
199
|
if (next.role !== "toolResult")
|
|
197
200
|
break;
|
|
198
|
-
const
|
|
201
|
+
const split = splitErrorToolResultImages2(next);
|
|
202
|
+
const converted = convertToolResult(split ? { ...next, content: split.content } : next, isOAuthToken, deferredToolNames, loadedToolNames, normalizeToolName);
|
|
199
203
|
toolResults.push(converted.toolResult);
|
|
200
204
|
siblingContent.push(...converted.siblingContent);
|
|
205
|
+
if (split) {
|
|
206
|
+
siblingContent.push({ type: "text", text: split.caption }, ...split.images.map(convertImageBlock));
|
|
207
|
+
}
|
|
201
208
|
}
|
|
202
209
|
i = j - 1;
|
|
203
210
|
params.push({
|
|
@@ -262,11 +269,15 @@ var rejectedByAnthropicStrictTools = (key, value) => {
|
|
|
262
269
|
return typeof value !== "string" || !ANTHROPIC_STRICT_STRING_FORMATS.has(value);
|
|
263
270
|
return false;
|
|
264
271
|
};
|
|
265
|
-
function
|
|
272
|
+
function prefersStrictSampling2(tool) {
|
|
273
|
+
const config = tool.constrainedSampling;
|
|
274
|
+
return config !== undefined && config !== false && config.type === "json_schema" && config.strict === "prefer";
|
|
275
|
+
}
|
|
276
|
+
function convertTools3(tools, isOAuthToken, supportsEagerToolInputStreaming, supportsStrictTools, cacheControl, deferLoading = false, disablePreferredStrictTools = false) {
|
|
266
277
|
if (!tools)
|
|
267
278
|
return [];
|
|
268
279
|
return tools.map((tool, index) => {
|
|
269
|
-
const strict = resolveJsonSchemaStrictSampling2(tool, supportsStrictTools, rejectedByAnthropicStrictTools);
|
|
280
|
+
const strict = disablePreferredStrictTools && prefersStrictSampling2(tool) ? undefined : resolveJsonSchemaStrictSampling2(tool, supportsStrictTools, rejectedByAnthropicStrictTools);
|
|
270
281
|
const parameters = getJsonSchemaToolParameters2(tool, strict);
|
|
271
282
|
const legacyInputSchema = {
|
|
272
283
|
type: "object",
|
|
@@ -290,4 +301,4 @@ function convertTools3(tools, isOAuthToken, supportsEagerToolInputStreaming, sup
|
|
|
290
301
|
});
|
|
291
302
|
}
|
|
292
303
|
|
|
293
|
-
export { normalizeToolCallId2, convertMessages3, convertTools3 };
|
|
304
|
+
export { normalizeToolCallId2, convertMessages3, prefersStrictSampling2, convertTools3 };
|
|
@@ -3,7 +3,7 @@ import { parse as partialParse } from "partial-json";
|
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { Value } from "typebox/value";
|
|
5
5
|
var ToolArgumentsSchema = Type.Record(Type.String(), Type.Unknown());
|
|
6
|
-
var VALID_JSON_ESCAPES = new Set(['"', "\\", "/", "b", "f", "n", "r", "t"
|
|
6
|
+
var VALID_JSON_ESCAPES = new Set(['"', "\\", "/", "b", "f", "n", "r", "t"]);
|
|
7
7
|
function escapeControlCharacter(char) {
|
|
8
8
|
switch (char) {
|
|
9
9
|
case "\b":
|
|
@@ -5,13 +5,19 @@ export declare function normalizeToolCallId(id: string): string;
|
|
|
5
5
|
* The transcript as Anthropic messages.
|
|
6
6
|
*
|
|
7
7
|
* - Anthropic requires `tool_result` immediately after `tool_use`, so system updates are held
|
|
8
|
-
* until the next assistant message or the end of the transcript.
|
|
8
|
+
* until the next assistant message that is sent, or the end of the transcript. Holding past an
|
|
9
|
+
* assistant message that converts to no blocks keeps the update from landing before a user
|
|
10
|
+
* message, which Anthropic rejects.
|
|
9
11
|
* - A thinking block whose signature is missing or empty, e.g. from an aborted stream, becomes
|
|
10
12
|
* plain text; models marked `allowEmptySignature` emit and accept empty signatures, so they
|
|
11
13
|
* keep the block.
|
|
12
14
|
* - Consecutive tool results go into one user message, which the z.ai Anthropic endpoint needs;
|
|
13
|
-
* content displaced by tool references
|
|
15
|
+
* content displaced by tool references, and the images of error results (which Anthropic
|
|
16
|
+
* rejects inside them), follow every `tool_result` block.
|
|
14
17
|
* - The last user or system message carries `cache_control`, caching the conversation history.
|
|
15
18
|
*/
|
|
16
19
|
export declare function convertMessages(transformedMessages: Message[], isOAuthToken: boolean, cacheControl?: BetaCacheControlEphemeral, allowEmptySignature?: boolean, deferredToolNames?: ReadonlySet<string>, normalizeToolName?: (name: string) => string, nativeToolChanges?: boolean): BetaMessageParam[];
|
|
17
|
-
|
|
20
|
+
/** Whether the tool asks for strict sampling only where the provider can honor it. */
|
|
21
|
+
export declare function prefersStrictSampling(tool: Tool): boolean;
|
|
22
|
+
/** `disablePreferredStrictTools` sends `prefer` tools non-strict; `require` tools stay strict. */
|
|
23
|
+
export declare function convertTools(tools: Tool[], isOAuthToken: boolean, supportsEagerToolInputStreaming: boolean, supportsStrictTools: boolean, cacheControl?: BetaCacheControlEphemeral, deferLoading?: boolean, disablePreferredStrictTools?: boolean): BetaTool[];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeToolCallId2,
|
|
3
3
|
convertMessages3,
|
|
4
|
+
prefersStrictSampling2,
|
|
4
5
|
convertTools3
|
|
5
|
-
} from "../../chunks/account-limits-cache-
|
|
6
|
+
} from "../../chunks/account-limits-cache-wawwj02k.js";
|
|
7
|
+
import"../../chunks/account-limits-cache-4qpef10z.js";
|
|
6
8
|
import"../../chunks/account-limits-cache-h92bzz1j.js";
|
|
7
9
|
import"../../chunks/account-limits-cache-eqwweapz.js";
|
|
8
10
|
import"../../chunks/account-limits-cache-ks1sjym9.js";
|
|
@@ -10,5 +12,6 @@ import"../../chunks/account-limits-cache-b4edaybk.js";
|
|
|
10
12
|
export {
|
|
11
13
|
convertMessages3 as convertMessages,
|
|
12
14
|
convertTools3 as convertTools,
|
|
13
|
-
normalizeToolCallId2 as normalizeToolCallId
|
|
15
|
+
normalizeToolCallId2 as normalizeToolCallId,
|
|
16
|
+
prefersStrictSampling2 as prefersStrictSampling
|
|
14
17
|
};
|