pi2dsh 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -10
- package/README.zh.md +15 -10
- package/dist/all-Rt4K68QA.mjs +28512 -0
- package/dist/all-Rt4K68QA.mjs.map +1 -0
- package/dist/anthropic-messages-Beym0_aC.mjs +6438 -0
- package/dist/anthropic-messages-Beym0_aC.mjs.map +1 -0
- package/dist/azure-openai-responses-cHqZTgLD.mjs +209 -0
- package/dist/azure-openai-responses-cHqZTgLD.mjs.map +1 -0
- package/dist/{build-DsGYAgiT.mjs → build-BG7p2Lbr.mjs} +2 -2
- package/dist/{build-DsGYAgiT.mjs.map → build-BG7p2Lbr.mjs.map} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/compat/pi-ai.d.mts +16 -3
- package/dist/compat/pi-ai.d.mts.map +1 -1
- package/dist/compat/pi-ai.mjs +3 -3
- package/dist/compat/pi-coding-agent.d.mts +12 -1
- package/dist/compat/pi-coding-agent.d.mts.map +1 -1
- package/dist/compat/pi-coding-agent.mjs +2 -2
- package/dist/credentials-oauth.mjs +3 -3
- package/dist/deferred-tools-BD4g5QUx.mjs +32 -0
- package/dist/deferred-tools-BD4g5QUx.mjs.map +1 -0
- package/dist/diagnostics-CJye1UFh.mjs +99 -0
- package/dist/diagnostics-CJye1UFh.mjs.map +1 -0
- package/dist/dist-IQKOgQyt.mjs +10035 -0
- package/dist/dist-IQKOgQyt.mjs.map +1 -0
- package/dist/dist-QBBA-dL_.mjs +1246 -0
- package/dist/dist-QBBA-dL_.mjs.map +1 -0
- package/dist/error-body-DKA3lknR.mjs +104 -0
- package/dist/error-body-DKA3lknR.mjs.map +1 -0
- package/dist/github-copilot-headers-CZo2QHrt.mjs +25 -0
- package/dist/github-copilot-headers-CZo2QHrt.mjs.map +1 -0
- package/dist/google-generative-ai-B7OZs5lu.mjs +358 -0
- package/dist/google-generative-ai-B7OZs5lu.mjs.map +1 -0
- package/dist/google-shared-CRsAUItF.mjs +29042 -0
- package/dist/google-shared-CRsAUItF.mjs.map +1 -0
- package/dist/google-vertex-DmdaHQtB.mjs +402 -0
- package/dist/google-vertex-DmdaHQtB.mjs.map +1 -0
- package/dist/hash-Dbggamac.mjs +19 -0
- package/dist/hash-Dbggamac.mjs.map +1 -0
- package/dist/headers-CPzZhJQn.mjs +17 -0
- package/dist/headers-CPzZhJQn.mjs.map +1 -0
- package/dist/host.d.mts.map +1 -1
- package/dist/host.mjs +13 -3
- package/dist/host.mjs.map +1 -1
- package/dist/images-models-DJtHo9Rp.mjs +1068 -0
- package/dist/images-models-DJtHo9Rp.mjs.map +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/json-parse-CFyFZSLJ.mjs +384 -0
- package/dist/json-parse-CFyFZSLJ.mjs.map +1 -0
- package/dist/{mcp-config-gqg7GJEE.mjs → mcp-config-D2B3kv-Z.mjs} +34 -16
- package/dist/mcp-config-D2B3kv-Z.mjs.map +1 -0
- package/dist/mistral-conversations-HHZCcFv_.mjs +42007 -0
- package/dist/mistral-conversations-HHZCcFv_.mjs.map +1 -0
- package/dist/multipart-parser-CIa5BbwO.mjs +301 -0
- package/dist/multipart-parser-CIa5BbwO.mjs.map +1 -0
- package/dist/{oauth-bridge-BpPrppjR.mjs → oauth-bridge-C6fL1qSv.mjs} +20 -4
- package/dist/oauth-bridge-C6fL1qSv.mjs.map +1 -0
- package/dist/openai-DkzRh5_G.mjs +6732 -0
- package/dist/openai-DkzRh5_G.mjs.map +1 -0
- package/dist/openai-codex-responses-vmovNu-q.mjs +1169 -0
- package/dist/openai-codex-responses-vmovNu-q.mjs.map +1 -0
- package/dist/openai-completions-fXHhRolF.mjs +947 -0
- package/dist/openai-completions-fXHhRolF.mjs.map +1 -0
- package/dist/openai-prompt-cache-BDWtZRKh.mjs +11 -0
- package/dist/openai-prompt-cache-BDWtZRKh.mjs.map +1 -0
- package/dist/openai-responses-DKdCYf3h.mjs +247 -0
- package/dist/openai-responses-DKdCYf3h.mjs.map +1 -0
- package/dist/openai-responses-shared-D0Jq7yVP.mjs +572 -0
- package/dist/openai-responses-shared-D0Jq7yVP.mjs.map +1 -0
- package/dist/openrouter-images-fG3Aj6M4.mjs +127 -0
- package/dist/openrouter-images-fG3Aj6M4.mjs.map +1 -0
- package/dist/otel-BQSQRBLF.mjs +24935 -0
- package/dist/otel-BQSQRBLF.mjs.map +1 -0
- package/dist/{pi-ai-CWFlgigJ.mjs → pi-ai-DhYGgq4Y.mjs} +49 -12
- package/dist/{pi-ai-CWFlgigJ.mjs.map → pi-ai-DhYGgq4Y.mjs.map} +1 -1
- package/dist/{pi-coding-agent-Z1hTs61i.mjs → pi-coding-agent-fPHwKP4d.mjs} +27 -3
- package/dist/{pi-coding-agent-Z1hTs61i.mjs.map → pi-coding-agent-fPHwKP4d.mjs.map} +1 -1
- package/dist/pi-messages-CV-Ts8An.mjs +306 -0
- package/dist/pi-messages-CV-Ts8An.mjs.map +1 -0
- package/dist/provider-env-C72pF4vP.mjs +40 -0
- package/dist/provider-env-C72pF4vP.mjs.map +1 -0
- package/dist/provider-retry-Cw6YJ4cr.mjs +80 -0
- package/dist/provider-retry-Cw6YJ4cr.mjs.map +1 -0
- package/dist/rolldown-runtime-CTfmNlz1.mjs +44 -0
- package/dist/{runtime-6DefpI6h.mjs → runtime-B9R7bDWT.mjs} +874 -37
- package/dist/runtime-B9R7bDWT.mjs.map +1 -0
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/sanitize-unicode-wLA11KvZ.mjs +29 -0
- package/dist/sanitize-unicode-wLA11KvZ.mjs.map +1 -0
- package/dist/src-C3WBfOks.mjs +5031 -0
- package/dist/src-C3WBfOks.mjs.map +1 -0
- package/dist/transform-messages-DGq9mvhA.mjs +379 -0
- package/dist/transform-messages-DGq9mvhA.mjs.map +1 -0
- package/dist/uuid-DtFT7tOE.mjs +65 -0
- package/dist/uuid-DtFT7tOE.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/mcp-config-gqg7GJEE.mjs.map +0 -1
- package/dist/oauth-bridge-BpPrppjR.mjs.map +0 -1
- package/dist/rolldown-runtime-D-uZhY3_.mjs +0 -16
- package/dist/runtime-6DefpI6h.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import "./build-
|
|
2
|
+
import { i as __require } from "./rolldown-runtime-CTfmNlz1.mjs";
|
|
3
|
+
import "./build-BG7p2Lbr.mjs";
|
|
4
4
|
//#region src/compat/vendor/pi-ai-overflow.ts
|
|
5
5
|
/**
|
|
6
6
|
* Regex patterns to detect context overflow errors from different providers.
|
|
@@ -2866,19 +2866,46 @@ function getModels(_provider) {
|
|
|
2866
2866
|
return [];
|
|
2867
2867
|
}
|
|
2868
2868
|
function unbridgedTransport(api) {
|
|
2869
|
-
throw new Error(`pi2dsh: the ${api} protocol client is not bridged; model transports stay native to DSH llm/credentials`);
|
|
2869
|
+
throw new Error(`pi2dsh: the ${api} protocol client is not bridged in this composition (real pi-ai is not installed); model transports stay native to DSH llm/credentials`);
|
|
2870
|
+
}
|
|
2871
|
+
let realPiAiPromise;
|
|
2872
|
+
function loadRealPiAi() {
|
|
2873
|
+
realPiAiPromise ??= import("./dist-IQKOgQyt.mjs").then((module) => module, () => void 0);
|
|
2874
|
+
return realPiAiPromise;
|
|
2875
|
+
}
|
|
2876
|
+
async function realTransport(api, factoryName) {
|
|
2877
|
+
const factory = (await loadRealPiAi())?.[factoryName];
|
|
2878
|
+
if (typeof factory !== "function") unbridgedTransport(api);
|
|
2879
|
+
return factory();
|
|
2880
|
+
}
|
|
2881
|
+
/**
|
|
2882
|
+
* The REAL pi-ai's builtin provider definition for one id, when the host
|
|
2883
|
+
* bundle carries pi-ai. DSH's own llm adapter builds its directory from the
|
|
2884
|
+
* same builtinProviders(), so this is the DSH model layer's own source of
|
|
2885
|
+
* provider auth semantics (env-resolved API keys included).
|
|
2886
|
+
*/
|
|
2887
|
+
async function realBuiltinProvider(providerId) {
|
|
2888
|
+
const real = await loadRealPiAi();
|
|
2889
|
+
if (real === void 0) return void 0;
|
|
2890
|
+
try {
|
|
2891
|
+
const factory = (await import("./all-Rt4K68QA.mjs").catch(() => real)).builtinProviders ?? real.builtinProviders;
|
|
2892
|
+
if (typeof factory !== "function") return void 0;
|
|
2893
|
+
return factory().find((provider) => provider.id === providerId);
|
|
2894
|
+
} catch {
|
|
2895
|
+
return;
|
|
2896
|
+
}
|
|
2870
2897
|
}
|
|
2871
2898
|
function openAICompletionsApi() {
|
|
2872
|
-
return lazyApi(async () =>
|
|
2899
|
+
return lazyApi(async () => realTransport("openai-completions", "openAICompletionsApi"), void 0);
|
|
2873
2900
|
}
|
|
2874
2901
|
function openAIResponsesApi() {
|
|
2875
|
-
return lazyApi(async () =>
|
|
2902
|
+
return lazyApi(async () => realTransport("openai-responses", "openAIResponsesApi"), {
|
|
2876
2903
|
fetchDeferred: true,
|
|
2877
2904
|
cancelDeferred: true
|
|
2878
2905
|
});
|
|
2879
2906
|
}
|
|
2880
2907
|
function anthropicMessagesApi() {
|
|
2881
|
-
return lazyApi(async () =>
|
|
2908
|
+
return lazyApi(async () => realTransport("anthropic-messages", "anthropicMessagesApi"), void 0);
|
|
2882
2909
|
}
|
|
2883
2910
|
function builtinProviders() {
|
|
2884
2911
|
const entry = (id, name, baseUrl, oauth) => ({
|
|
@@ -2927,11 +2954,21 @@ function getApiProviders() {
|
|
|
2927
2954
|
function unregisterApiProviders(sourceId) {
|
|
2928
2955
|
for (const [api, entry] of apiProviderRegistry.entries()) if (entry.sourceId === sourceId) apiProviderRegistry.delete(api);
|
|
2929
2956
|
}
|
|
2930
|
-
|
|
2931
|
-
|
|
2957
|
+
let activeLlmBridge;
|
|
2958
|
+
function __setPiAiLlmBridge(bridge) {
|
|
2959
|
+
activeLlmBridge = bridge;
|
|
2960
|
+
}
|
|
2961
|
+
function requireLlmBridge(api) {
|
|
2962
|
+
if (activeLlmBridge === void 0) throw new Error(`pi2dsh: pi-ai ${api}() needs a DSH llm service; this composition mounts none, so model calls cannot be routed`);
|
|
2963
|
+
return activeLlmBridge;
|
|
2964
|
+
}
|
|
2965
|
+
async function complete(model, context, options) {
|
|
2966
|
+
const result = await requireLlmBridge("complete")(model, context, options).result();
|
|
2967
|
+
if (result instanceof Error) throw result;
|
|
2968
|
+
return result;
|
|
2932
2969
|
}
|
|
2933
|
-
function stream(
|
|
2934
|
-
|
|
2970
|
+
function stream(model, context, options) {
|
|
2971
|
+
return requireLlmBridge("stream")(model, context, options);
|
|
2935
2972
|
}
|
|
2936
2973
|
function StringEnum(values, options = {}) {
|
|
2937
2974
|
return {
|
|
@@ -2942,6 +2979,6 @@ function StringEnum(values, options = {}) {
|
|
|
2942
2979
|
};
|
|
2943
2980
|
}
|
|
2944
2981
|
//#endregion
|
|
2945
|
-
export {
|
|
2982
|
+
export { openaiCodexOAuth as A, isRecoverableLength as B, registerApiProvider as C, kimiCodingOAuth as D, unregisterApiProviders as E, lazyApi as F, lazyStream as I, AssistantMessageEventStream as L, pollOAuthDeviceCodeFlow as M, ModelsError as N, githubCopilotOAuth as O, createProvider as P, isRetryableAssistantError as R, realBuiltinProvider as S, stream as T, loadKimiCodingOAuth as _, clampThinkingLevel as a, openAICompletionsApi as b, getApiProvider as c, getModels as d, getProvider as f, loadGitHubCopilotOAuth as g, loadAnthropicOAuth as h, builtinProviders as i, generatePKCE as j, anthropicOAuth as k, getApiProviders as l, getSupportedThinkingLevels as m, __setPiAiLlmBridge as n, complete as o, getProviders as p, anthropicMessagesApi as r, contentText as s, StringEnum as t, getModel as u, loadOpenAICodexOAuth as v, registerProvider as w, openAIResponsesApi as x, modelsAreEqual as y, isContextOverflow as z };
|
|
2946
2983
|
|
|
2947
|
-
//# sourceMappingURL=pi-ai-
|
|
2984
|
+
//# sourceMappingURL=pi-ai-DhYGgq4Y.mjs.map
|