@deslop/workbench 0.0.401 → 0.0.410
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/{anthropic-DcE0yHBZ.mjs → anthropic-messages--JAnb97W.mjs} +38 -51
- package/dist/{azure-openai-responses-ecGypQVA.mjs → azure-openai-responses-g-awH_uA.mjs} +9 -16
- package/dist/client/assets/{-workbench-terminal-Af-sz4R6.js → -workbench-terminal-Ne3Ca_Zm.js} +8 -8
- package/dist/client/assets/agent-YDhqENQr.js +1 -0
- package/dist/client/assets/agent-YvOEbSL4.js +2 -0
- package/dist/client/assets/{dialog-CTIcy8Vy.js → dialog-O3wBc7X2.js} +2 -2
- package/dist/client/assets/diff-BcPEyFnc.js +223 -0
- package/dist/client/assets/diff-CZdOESVK.js +2 -0
- package/dist/client/assets/{external-link-BxixiKaa.js → external-link-D8TqDHgo.js} +1 -1
- package/dist/client/assets/fallbacks-BYPj1x-T.js +16 -0
- package/dist/client/assets/index-DFD32fIK.css +2 -0
- package/dist/client/assets/index-k88N8viu.js +10 -0
- package/dist/client/assets/{input-DW9ssWUO.js → input-BHj016ES.js} +1 -1
- package/dist/client/assets/portless-DbuqdEMA.js +2 -0
- package/dist/client/assets/portless-rPZ2tatn.js +1 -0
- package/dist/client/assets/{resizable-CZjAW7-J.js → resizable-BlkgaK6V.js} +1 -1
- package/dist/client/assets/route-DKK79z62.js +2 -0
- package/dist/client/assets/route-DOc4X-Ya.js +45 -0
- package/dist/client/assets/{run-CeqkWWtZ.js → run-DVOYYIUX.js} +1 -1
- package/dist/client/assets/run-gggwaxnT.js +2 -0
- package/dist/client/assets/{sonner-BKURESHO.js → sonner-Bnl1Iat_.js} +1 -1
- package/dist/client/assets/state-Cxz4BVk7.js +2 -0
- package/dist/client/assets/terminal-Brvez29s.js +2 -0
- package/dist/client/assets/{terminal-CcfbU9tU.js → terminal-CYX_Ixg-.js} +1 -1
- package/dist/client/assets/{triangle-alert-DLHVemGQ.js → triangle-alert-Ceg_3GX9.js} +1 -1
- package/dist/client/index.html +11 -11
- package/dist/github-copilot-headers-BB6z1RAk.mjs +23 -0
- package/dist/{google-Jzn1v4-q.mjs → google-generative-ai-r4Wb8Eaq.mjs} +15 -20
- package/dist/{google-shared-DNNqX1gf.mjs → google-shared-DN1OvwJM.mjs} +4 -4
- package/dist/{google-vertex-z0Cbw7eq.mjs → google-vertex-Clcq7cAd.mjs} +15 -20
- package/dist/{hash-CScAQ-b_.mjs → hash-wSEYO-QF.mjs} +1 -1
- package/dist/headers-SFoLwUHv.mjs +15 -0
- package/dist/{mistral-CxEIkz4y.mjs → mistral-conversations-Bnpuiv3e.mjs} +12 -19
- package/dist/{openai-codex-responses-7ZUsVcbT.mjs → openai-codex-responses-4Te8RbRb.mjs} +62 -46
- package/dist/{openai-completions-CaGFVr3X.mjs → openai-completions-B4nInzTS.mjs} +69 -96
- package/dist/{openai-responses-Vjw8-3qm.mjs → openai-responses-GeDULmTh.mjs} +28 -31
- package/dist/{openai-responses-shared-DtEshy-7.mjs → openai-responses-shared-CG93Thoy.mjs} +37 -32
- package/dist/{openrouter-CZ-H_QwG.mjs → openrouter-images-CgbIytYQ.mjs} +7 -14
- package/dist/{sanitize-unicode-BbVojtka.mjs → sanitize-unicode-Ga8nHda1.mjs} +1 -1
- package/dist/server.js +32269 -28959
- package/dist/{transform-messages-CLmkH5Gu.mjs → transform-messages-D9fZ7fnU.mjs} +2 -2
- package/package.json +3 -2
- package/dist/client/assets/agent-BnkD1Glf.js +0 -2
- package/dist/client/assets/agent-DQPX2IZb.js +0 -1
- package/dist/client/assets/diff-MiGOu0DY.js +0 -2
- package/dist/client/assets/diff-_Gk9o1mg.js +0 -223
- package/dist/client/assets/fallbacks-D21cBTdH.js +0 -16
- package/dist/client/assets/index-B2S_w1d1.css +0 -2
- package/dist/client/assets/index-DW7dKhgZ.js +0 -10
- package/dist/client/assets/portless-3KC81g42.js +0 -2
- package/dist/client/assets/portless-CxovsEbp.js +0 -1
- package/dist/client/assets/route-DwWgYFyk.js +0 -2
- package/dist/client/assets/route-te6-VkZE.js +0 -45
- package/dist/client/assets/run-B-qmimXV.js +0 -2
- package/dist/client/assets/state-a4d_PikB.js +0 -2
- package/dist/client/assets/terminal-BHNxWKc6.js +0 -2
- package/dist/github-copilot-headers-P0xZolzq.mjs +0 -39
- package/dist/headers-oksLmLNC.mjs +0 -9
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { Ar as parseJsonWithRepair, Ir as calculateCost, Rr as getProviderEnvValue,
|
|
3
|
-
import { t as headersToRecord } from "./headers-
|
|
4
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
5
|
-
import {
|
|
6
|
-
import { n as adjustMaxTokensForThinking, r as buildBaseOptions, t as transformMessages } from "./transform-messages-
|
|
2
|
+
import { Ar as parseJsonWithRepair, Ir as calculateCost, Rr as getProviderEnvValue, jr as parseStreamingJson, zr as AssistantMessageEventStream } from "./server.js";
|
|
3
|
+
import { t as headersToRecord } from "./headers-SFoLwUHv.mjs";
|
|
4
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-Ga8nHda1.mjs";
|
|
5
|
+
import { n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-BB6z1RAk.mjs";
|
|
6
|
+
import { n as adjustMaxTokensForThinking, r as buildBaseOptions, t as transformMessages } from "./transform-messages-D9fZ7fnU.mjs";
|
|
7
7
|
//#region ../../node_modules/.pnpm/@anthropic-ai+sdk@0.91.1_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/tslib.mjs
|
|
8
8
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
9
9
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
@@ -5534,7 +5534,7 @@ Anthropic.Messages = Messages;
|
|
|
5534
5534
|
Anthropic.Models = Models;
|
|
5535
5535
|
Anthropic.Beta = Beta;
|
|
5536
5536
|
//#endregion
|
|
5537
|
-
//#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.
|
|
5537
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.80.1_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js
|
|
5538
5538
|
/**
|
|
5539
5539
|
* Resolve cache retention preference.
|
|
5540
5540
|
* Defaults to "short" and uses PI_CACHE_RETENTION for backward compatibility.
|
|
@@ -5618,7 +5618,7 @@ function getAnthropicCompat(model) {
|
|
|
5618
5618
|
return {
|
|
5619
5619
|
supportsEagerToolInputStreaming: model.compat?.supportsEagerToolInputStreaming ?? !isFireworks,
|
|
5620
5620
|
supportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? !isFireworks,
|
|
5621
|
-
sendSessionAffinityHeaders: model.compat?.sendSessionAffinityHeaders ??
|
|
5621
|
+
sendSessionAffinityHeaders: model.compat?.sendSessionAffinityHeaders ?? (isFireworks || isCloudflareAiGatewayAnthropic),
|
|
5622
5622
|
supportsCacheControlOnTools: model.compat?.supportsCacheControlOnTools ?? !isFireworks,
|
|
5623
5623
|
supportsTemperature: model.compat?.supportsTemperature ?? true,
|
|
5624
5624
|
allowEmptySignature: model.compat?.allowEmptySignature ?? false
|
|
@@ -5629,6 +5629,17 @@ function mergeHeaders(...headerSources) {
|
|
|
5629
5629
|
for (const headers of headerSources) if (headers) Object.assign(merged, headers);
|
|
5630
5630
|
return merged;
|
|
5631
5631
|
}
|
|
5632
|
+
function hasHeader(headers, name) {
|
|
5633
|
+
if (!headers) return false;
|
|
5634
|
+
const expected = name.toLowerCase();
|
|
5635
|
+
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === expected && value !== null && value.trim().length > 0) return true;
|
|
5636
|
+
return false;
|
|
5637
|
+
}
|
|
5638
|
+
function assertRequestAuth(provider, apiKey, headers) {
|
|
5639
|
+
if (apiKey) return;
|
|
5640
|
+
if (hasHeader(headers, "authorization") || hasHeader(headers, "x-api-key") || hasHeader(headers, "cf-aig-authorization")) return;
|
|
5641
|
+
throw new Error(`No API key for provider: ${provider}`);
|
|
5642
|
+
}
|
|
5632
5643
|
const ANTHROPIC_MESSAGE_EVENTS = new Set([
|
|
5633
5644
|
"message_start",
|
|
5634
5645
|
"message_delta",
|
|
@@ -5738,7 +5749,7 @@ async function* iterateAnthropicEvents(response, signal) {
|
|
|
5738
5749
|
}
|
|
5739
5750
|
if (sawMessageStart && !sawMessageEnd) throw new Error("Anthropic stream ended before message_stop");
|
|
5740
5751
|
}
|
|
5741
|
-
const
|
|
5752
|
+
const stream = (model, context, options) => {
|
|
5742
5753
|
const stream = new AssistantMessageEventStream();
|
|
5743
5754
|
(async () => {
|
|
5744
5755
|
const output = {
|
|
@@ -5772,7 +5783,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
5772
5783
|
isOAuth = false;
|
|
5773
5784
|
} else {
|
|
5774
5785
|
const apiKey = options?.apiKey;
|
|
5775
|
-
|
|
5786
|
+
assertRequestAuth(model.provider, apiKey, options?.headers);
|
|
5776
5787
|
let copilotDynamicHeaders;
|
|
5777
5788
|
if (model.provider === "github-copilot") {
|
|
5778
5789
|
const hasImages = hasCopilotVisionInput(context.messages);
|
|
@@ -5782,7 +5793,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
5782
5793
|
});
|
|
5783
5794
|
}
|
|
5784
5795
|
const cacheSessionId = resolveCacheRetention(options?.cacheRetention, options?.env) === "none" ? void 0 : options?.sessionId;
|
|
5785
|
-
const created = createClient(model, apiKey, options?.interleavedThinking ?? true, shouldUseFineGrainedToolStreamingBeta(model, context), options?.headers, copilotDynamicHeaders, cacheSessionId
|
|
5796
|
+
const created = createClient(model, apiKey, options?.interleavedThinking ?? true, shouldUseFineGrainedToolStreamingBeta(model, context), options?.headers, copilotDynamicHeaders, cacheSessionId);
|
|
5786
5797
|
client = created.client;
|
|
5787
5798
|
isOAuth = created.isOAuthToken;
|
|
5788
5799
|
}
|
|
@@ -5998,66 +6009,41 @@ function mapThinkingLevelToEffort(model, level) {
|
|
|
5998
6009
|
default: return "high";
|
|
5999
6010
|
}
|
|
6000
6011
|
}
|
|
6001
|
-
const
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
if (!options?.reasoning) return streamAnthropic(model, context, {
|
|
6012
|
+
const streamSimple = (model, context, options) => {
|
|
6013
|
+
assertRequestAuth(model.provider, options?.apiKey, options?.headers);
|
|
6014
|
+
const base = buildBaseOptions(model, options, options?.apiKey);
|
|
6015
|
+
if (!options?.reasoning) return stream(model, context, {
|
|
6006
6016
|
...base,
|
|
6007
6017
|
thinkingEnabled: false
|
|
6008
6018
|
});
|
|
6009
6019
|
if (model.compat?.forceAdaptiveThinking === true) {
|
|
6010
6020
|
const effort = mapThinkingLevelToEffort(model, options.reasoning);
|
|
6011
|
-
return
|
|
6021
|
+
return stream(model, context, {
|
|
6012
6022
|
...base,
|
|
6013
6023
|
thinkingEnabled: true,
|
|
6014
6024
|
effort
|
|
6015
6025
|
});
|
|
6016
6026
|
}
|
|
6017
6027
|
const adjusted = adjustMaxTokensForThinking(base.maxTokens, model.maxTokens, options.reasoning, options.thinkingBudgets);
|
|
6018
|
-
return
|
|
6028
|
+
return stream(model, context, {
|
|
6019
6029
|
...base,
|
|
6020
6030
|
maxTokens: adjusted.maxTokens,
|
|
6021
6031
|
thinkingEnabled: true,
|
|
6022
6032
|
thinkingBudgetTokens: adjusted.thinkingBudget
|
|
6023
6033
|
});
|
|
6024
6034
|
};
|
|
6025
|
-
function register() {
|
|
6026
|
-
registerApiProvider({
|
|
6027
|
-
api: "anthropic-messages",
|
|
6028
|
-
stream: streamAnthropic,
|
|
6029
|
-
streamSimple: streamSimpleAnthropic
|
|
6030
|
-
});
|
|
6031
|
-
}
|
|
6032
6035
|
function isOAuthToken(apiKey) {
|
|
6033
6036
|
return apiKey.includes("sk-ant-oat");
|
|
6034
6037
|
}
|
|
6035
|
-
function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStreamingBeta, optionsHeaders, dynamicHeaders, sessionId
|
|
6038
|
+
function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStreamingBeta, optionsHeaders, dynamicHeaders, sessionId) {
|
|
6036
6039
|
const needsInterleavedBeta = interleavedThinking && model.compat?.forceAdaptiveThinking !== true;
|
|
6037
6040
|
const betaFeatures = [];
|
|
6038
6041
|
if (useFineGrainedToolStreamingBeta) betaFeatures.push(FINE_GRAINED_TOOL_STREAMING_BETA);
|
|
6039
6042
|
if (needsInterleavedBeta) betaFeatures.push(INTERLEAVED_THINKING_BETA);
|
|
6040
|
-
if (model.provider === "cloudflare-ai-gateway") return {
|
|
6041
|
-
client: new Anthropic({
|
|
6042
|
-
apiKey: null,
|
|
6043
|
-
authToken: null,
|
|
6044
|
-
baseURL: resolveCloudflareBaseUrl(model, env),
|
|
6045
|
-
dangerouslyAllowBrowser: true,
|
|
6046
|
-
defaultHeaders: mergeHeaders({
|
|
6047
|
-
accept: "application/json",
|
|
6048
|
-
"anthropic-dangerous-direct-browser-access": "true",
|
|
6049
|
-
"cf-aig-authorization": `Bearer ${apiKey}`,
|
|
6050
|
-
"x-api-key": null,
|
|
6051
|
-
Authorization: null,
|
|
6052
|
-
...betaFeatures.length > 0 ? { "anthropic-beta": betaFeatures.join(",") } : {}
|
|
6053
|
-
}, model.headers, optionsHeaders)
|
|
6054
|
-
}),
|
|
6055
|
-
isOAuthToken: false
|
|
6056
|
-
};
|
|
6057
6043
|
if (model.provider === "github-copilot") return {
|
|
6058
6044
|
client: new Anthropic({
|
|
6059
6045
|
apiKey: null,
|
|
6060
|
-
authToken: apiKey,
|
|
6046
|
+
authToken: apiKey ?? null,
|
|
6061
6047
|
baseURL: model.baseUrl,
|
|
6062
6048
|
dangerouslyAllowBrowser: true,
|
|
6063
6049
|
defaultHeaders: mergeHeaders({
|
|
@@ -6068,7 +6054,7 @@ function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStre
|
|
|
6068
6054
|
}),
|
|
6069
6055
|
isOAuthToken: false
|
|
6070
6056
|
};
|
|
6071
|
-
if (isOAuthToken(apiKey)) return {
|
|
6057
|
+
if (apiKey && isOAuthToken(apiKey)) return {
|
|
6072
6058
|
client: new Anthropic({
|
|
6073
6059
|
apiKey: null,
|
|
6074
6060
|
authToken: apiKey,
|
|
@@ -6089,17 +6075,18 @@ function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStre
|
|
|
6089
6075
|
isOAuthToken: true
|
|
6090
6076
|
};
|
|
6091
6077
|
const sessionAffinityHeaders = sessionId && getAnthropicCompat(model).sendSessionAffinityHeaders ? { "x-session-affinity": sessionId } : {};
|
|
6078
|
+
const defaultHeaders = mergeHeaders({
|
|
6079
|
+
accept: "application/json",
|
|
6080
|
+
"anthropic-dangerous-direct-browser-access": "true",
|
|
6081
|
+
...betaFeatures.length > 0 ? { "anthropic-beta": betaFeatures.join(",") } : {}
|
|
6082
|
+
}, sessionAffinityHeaders, model.headers, optionsHeaders);
|
|
6092
6083
|
return {
|
|
6093
6084
|
client: new Anthropic({
|
|
6094
|
-
apiKey,
|
|
6085
|
+
apiKey: apiKey ?? null,
|
|
6095
6086
|
authToken: null,
|
|
6096
6087
|
baseURL: model.baseUrl,
|
|
6097
6088
|
dangerouslyAllowBrowser: true,
|
|
6098
|
-
defaultHeaders
|
|
6099
|
-
accept: "application/json",
|
|
6100
|
-
"anthropic-dangerous-direct-browser-access": "true",
|
|
6101
|
-
...betaFeatures.length > 0 ? { "anthropic-beta": betaFeatures.join(",") } : {}
|
|
6102
|
-
}, sessionAffinityHeaders, model.headers, optionsHeaders)
|
|
6089
|
+
defaultHeaders
|
|
6103
6090
|
}),
|
|
6104
6091
|
isOAuthToken: false
|
|
6105
6092
|
};
|
|
@@ -6310,4 +6297,4 @@ function mapStopReason(reason, stopDetails) {
|
|
|
6310
6297
|
}
|
|
6311
6298
|
}
|
|
6312
6299
|
//#endregion
|
|
6313
|
-
export {
|
|
6300
|
+
export { stream, streamSimple };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { Lr as clampThinkingLevel, Rr as getProviderEnvValue,
|
|
3
|
-
import { t as headersToRecord } from "./headers-
|
|
4
|
-
import { r as buildBaseOptions } from "./transform-messages-
|
|
2
|
+
import { Lr as clampThinkingLevel, Rr as getProviderEnvValue, zr as AssistantMessageEventStream } from "./server.js";
|
|
3
|
+
import { t as headersToRecord } from "./headers-SFoLwUHv.mjs";
|
|
4
|
+
import { r as buildBaseOptions } from "./transform-messages-D9fZ7fnU.mjs";
|
|
5
5
|
import { t as AzureOpenAI } from "./openai-CUH8rb7p.mjs";
|
|
6
6
|
import { t as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-6hf3xB_x.mjs";
|
|
7
|
-
import { n as convertResponsesTools, r as processResponsesStream, t as convertResponsesMessages } from "./openai-responses-shared-
|
|
8
|
-
//#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.
|
|
7
|
+
import { n as convertResponsesTools, r as processResponsesStream, t as convertResponsesMessages } from "./openai-responses-shared-CG93Thoy.mjs";
|
|
8
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.80.1_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js
|
|
9
9
|
const DEFAULT_AZURE_API_VERSION = "v1";
|
|
10
10
|
const AZURE_TOOL_CALL_PROVIDERS = new Set([
|
|
11
11
|
"openai",
|
|
@@ -45,7 +45,7 @@ function formatAzureOpenAIError(error) {
|
|
|
45
45
|
/**
|
|
46
46
|
* Generate function for Azure OpenAI Responses API
|
|
47
47
|
*/
|
|
48
|
-
const
|
|
48
|
+
const stream = (model, context, options) => {
|
|
49
49
|
const stream = new AssistantMessageEventStream();
|
|
50
50
|
(async () => {
|
|
51
51
|
const deploymentName = resolveDeploymentName(model, options);
|
|
@@ -119,24 +119,17 @@ const streamAzureOpenAIResponses = (model, context, options) => {
|
|
|
119
119
|
})();
|
|
120
120
|
return stream;
|
|
121
121
|
};
|
|
122
|
-
const
|
|
122
|
+
const streamSimple = (model, context, options) => {
|
|
123
123
|
const apiKey = options?.apiKey;
|
|
124
124
|
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
125
125
|
const base = buildBaseOptions(model, options, apiKey);
|
|
126
126
|
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : void 0;
|
|
127
127
|
const reasoningEffort = clampedReasoning === "off" ? void 0 : clampedReasoning;
|
|
128
|
-
return
|
|
128
|
+
return stream(model, context, {
|
|
129
129
|
...base,
|
|
130
130
|
reasoningEffort
|
|
131
131
|
});
|
|
132
132
|
};
|
|
133
|
-
function register() {
|
|
134
|
-
registerApiProvider({
|
|
135
|
-
api: "azure-openai-responses",
|
|
136
|
-
stream: streamAzureOpenAIResponses,
|
|
137
|
-
streamSimple: streamSimpleAzureOpenAIResponses
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
133
|
function normalizeAzureBaseUrl(baseUrl) {
|
|
141
134
|
const trimmed = baseUrl.trim().replace(/\/+$/, "");
|
|
142
135
|
let url;
|
|
@@ -204,4 +197,4 @@ function buildParams(model, context, options, deploymentName) {
|
|
|
204
197
|
return params;
|
|
205
198
|
}
|
|
206
199
|
//#endregion
|
|
207
|
-
export {
|
|
200
|
+
export { stream, streamSimple };
|