@vibe-lark/larkpal 0.1.84 → 0.1.86
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/account-id-BM1T6029-DYjVxojW.mjs +46 -0
- package/dist/activation-context--5yu1dPF-Bwsn3moT.mjs +172 -0
- package/dist/anthropic-TH8ERTXK.mjs +5962 -0
- package/dist/assistant-visible-text-DuFWokAt-CsbII5KS.mjs +596 -0
- package/dist/azure-openai-responses-Bt_Ag9Er.mjs +166 -0
- package/dist/boundary-file-read-BSd9MXPy--KThL5e6.mjs +594 -0
- package/dist/browser-lifecycle-cleanup-BdNsMhMD-O3tnAM4i.mjs +60 -0
- package/dist/build-DgTrEpge.mjs +3333 -0
- package/dist/bundled-compat-BpaDaAAu-D7oazKjD.mjs +5216 -0
- package/dist/bundled-dir-U738ay4K-DXK0q_TV.mjs +258 -0
- package/dist/call-DimWbpgJ-ColD4W-y.mjs +9993 -0
- package/dist/channel-bootstrap.runtime-BVclcGv1-DJv_Z-Kr.mjs +2 -0
- package/dist/channel-bootstrap.runtime-Cwcr38m2-VRfVCR-i.mjs +33 -0
- package/dist/chunk-D6SyT4dJ.mjs +36 -0
- package/dist/cli.mjs +6 -6
- package/dist/command-format-LSnUCVVF-BQ2SMKka.mjs +685 -0
- package/dist/config-Bim2pi8a-BQUdfiEi.mjs +9 -0
- package/dist/delivery-context.shared-j5hC5qb1-CI83RXXZ.mjs +72 -0
- package/dist/diagnostic-ClMwNnUA-D6nUtLnb.mjs +140 -0
- package/dist/dist-CEGw8-2W.mjs +429 -0
- package/dist/dist-DD2aJ2UL.mjs +125135 -0
- package/dist/env-api-keys-BVvSg7T2.mjs +68 -0
- package/dist/event-stream-xaQWmyas.mjs +15226 -0
- package/dist/facade-loader-DFzIYYt_-CIr4HKtE.mjs +194 -0
- package/dist/from-DF7cl2wz.mjs +3842 -0
- package/dist/gateway-method-policy-C7rf0SeV-CJQMEYIE.mjs +28 -0
- package/dist/github-copilot-headers-DjqWtUoP.mjs +22 -0
- package/dist/google-C2pVrgBZ.mjs +336 -0
- package/dist/google-gemini-cli-BBxgS5Ho.mjs +623 -0
- package/dist/google-shared-BsWgwEk1.mjs +22791 -0
- package/dist/google-vertex-BsVLJrrC.mjs +358 -0
- package/dist/hash-DAFtW_W7.mjs +16 -0
- package/dist/headers-R3HdCbAE.mjs +8 -0
- package/dist/home-dir-C44RaPME-CBRS4HLP.mjs +93 -0
- package/dist/ids-BPsM98Uu-CwuxvUai.mjs +77 -0
- package/dist/image-2w3cApg7-CxpHvoB5.mjs +207 -0
- package/dist/io-CH2g3vsv-BOGlLlB8.mjs +26218 -0
- package/dist/jiti-loader-cache-Bat69wam-D6hCxboy.mjs +5049 -0
- package/dist/json-file-BQRNuxmK-DhJM5NsG.mjs +108 -0
- package/dist/json-parse-v_HIJjjI.mjs +381 -0
- package/dist/jws-GFcTvvVT.mjs +2291 -0
- package/dist/{lark-cli-provider-7LvtOIF_.mjs → lark-cli-provider-BARgbbmo.mjs} +1 -1
- package/dist/{live-smoke-nvTUPtrv.mjs → live-smoke-BhkBOcH9.mjs} +3 -3
- package/dist/load-context-mb7uvLSn-B10MAi3I.mjs +29 -0
- package/dist/loader-708jrx4Y-BOswuvpe.mjs +5053 -0
- package/dist/main.mjs +56780 -476
- package/dist/manifest-registry-_hxKCS2K-CZdeyN0f.mjs +3512 -0
- package/dist/mcp-server.mjs +1 -1
- package/dist/message-channel-Bk_YHfQg-AeNrPPpp.mjs +50 -0
- package/dist/message-channel-core-DTA--Gjh-CY4Tkb7N.mjs +29 -0
- package/dist/message.config.runtime-K-k4XOyq-DZTmXomP.mjs +2 -0
- package/dist/message.gateway.runtime-DqHOHRTQ-DH4ml0YF.mjs +2 -0
- package/dist/mistral-CaR4DiLu.mjs +28657 -0
- package/dist/model-auth-env-oyg2Hexc-DU_rOUU5.mjs +1306 -0
- package/dist/models-config-BmpSQJQF-Gfvh1n3A.mjs +1282 -0
- package/dist/models-config.runtime-BsU_22xk.mjs +2 -0
- package/dist/multipart-parser-DedmaB5g.mjs +294 -0
- package/dist/oauth-DOJeGfcE.mjs +6392 -0
- package/dist/openai-BDtIh3Ja.mjs +6693 -0
- package/dist/openai-codex-responses-C5EORu31.mjs +664 -0
- package/dist/openai-completions-CR_cS6gX.mjs +669 -0
- package/dist/openai-responses-oGxwZyuC.mjs +184 -0
- package/dist/openai-responses-shared-BixMSDZE.mjs +398 -0
- package/dist/paths-D6msg0S1-C2lYuisN.mjs +189 -0
- package/dist/paths-D92DjaZ--CTOESW2b.mjs +192 -0
- package/dist/pi-model-discovery-Bd0TWzo8-BFsJmeMb.mjs +227 -0
- package/dist/pi-model-discovery-runtime-CCCZxkd8.mjs +2 -0
- package/dist/pi-tools.before-tool-call.runtime-Bn7uqKie-C5ewk8kK.mjs +399 -0
- package/dist/plugin-auto-enable-DdH3n9V8-DsA1isaF.mjs +1456 -0
- package/dist/process-scoped-map-B2cWkYET-CXwUZ8CZ.mjs +61 -0
- package/dist/provider-discovery.runtime-BPzz1PFj.mjs +58 -0
- package/dist/provider-model-compat-CFqcq0it-BDDuBI3A.mjs +118 -0
- package/dist/provider-runtime-C8rljsNs-CIT93zoy.mjs +2 -0
- package/dist/provider-runtime-CT50mNIX-BwEV6GyO.mjs +573 -0
- package/dist/provider-stream-COLujAAo-CbJPDngm.mjs +35449 -0
- package/dist/providers.runtime-Ba7tOlq7-CXkhkzU9.mjs +219 -0
- package/dist/public-surface-loader-BVl0NQAE-C0piXtsT.mjs +117 -0
- package/dist/resolve-C33B7eeu-BNvYTl6k.mjs +1041 -0
- package/dist/runtime-Cym-fqI8-DaSDMH-a.mjs +120 -0
- package/dist/runtime-channel-state-CohMybAh-hXR6y5Gx.mjs +19 -0
- package/dist/runtime-snapshot-C54O1-gI-40cbyi7P.mjs +677 -0
- package/dist/runtime-state-IBOIXKOx-Bf9tcLvc.mjs +10 -0
- package/dist/runtime-web-tools-fallback.runtime-Ca-qn1mj-BCVImm7a.mjs +39 -0
- package/dist/runtime-web-tools-manifest.runtime-BgxQTjmq-Cb4nJkRT.mjs +2 -0
- package/dist/runtime-web-tools-public-artifacts.runtime-D9qcoWIX-BrQdXzOQ.mjs +2 -0
- package/dist/session-archive.runtime-B52_5vs4-BG-_IwNJ.mjs +2 -0
- package/dist/session-key-Cn2QoOyX-CuHbJMgR.mjs +82 -0
- package/dist/session-transcript-files.fs-DEeFXruQ-B1PF6nLy.mjs +147 -0
- package/dist/src-BgCX0MLG.mjs +813 -0
- package/dist/src-DYbqlAqf.mjs +1177 -0
- package/dist/subagent-announce-L5WsQatW-CQWI9GMd.mjs +344 -0
- package/dist/subagent-announce.registry.runtime-DiqZyeTs-BKuniyi3.mjs +28 -0
- package/dist/subagent-registry-steer-runtime-DFgZFC0j-BhBz0roy.mjs +211 -0
- package/dist/subagent-system-prompt-C1qnN--K-DpnTFP47.mjs +3061 -0
- package/dist/target-parsing-loaded-DKkb6jJY-BMD4CkpS.mjs +1002 -0
- package/dist/task-registry-delivery-runtime-Dd1CUkZF-C8U40a3O.mjs +2950 -0
- package/dist/task-registry-delivery-runtime-ragbeVx5-CNbFAkjD.mjs +2 -0
- package/dist/thinking-Bh-7MqXz-D3woGbO7.mjs +2 -0
- package/dist/transcript-E_-ISOkD-DWCfZP2p.mjs +2019 -0
- package/dist/transcript.runtime-BqhvZZdl-BPy42vBP.mjs +2 -0
- package/dist/transform-messages-DbhIzTxq.mjs +207 -0
- package/dist/web-provider-public-artifacts-BlpRwIUS-CGPSV4W2.mjs +295 -0
- package/dist/web-search-providers.runtime--0aUtC3b-DyuhC95V.mjs +200 -0
- package/package.json +3 -3
- package/dist/rolldown-runtime-wcPFST8Q.mjs +0 -13
- /package/dist/{interactive-init-B6j8j_Ap.mjs → interactive-init-BXQBalNr.mjs} +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { t as getEnvApiKey } from "./env-api-keys-BVvSg7T2.mjs";
|
|
2
|
+
import { o as supportsXhigh, t as AssistantMessageEventStream } from "./event-stream-xaQWmyas.mjs";
|
|
3
|
+
import { t as AzureOpenAI } from "./openai-BDtIh3Ja.mjs";
|
|
4
|
+
import { t as headersToRecord } from "./headers-R3HdCbAE.mjs";
|
|
5
|
+
import { i as clampReasoning, r as buildBaseOptions } from "./transform-messages-DbhIzTxq.mjs";
|
|
6
|
+
import { n as convertResponsesTools, r as processResponsesStream, t as convertResponsesMessages } from "./openai-responses-shared-BixMSDZE.mjs";
|
|
7
|
+
//#region node_modules/.pnpm/@mariozechner+pi-ai@0.69.0_@modelcontextprotocol+sdk@1.29.0_zod@4.3.6__ws@8.21.0_zod@4.3.6/node_modules/@mariozechner/pi-ai/dist/providers/azure-openai-responses.js
|
|
8
|
+
const DEFAULT_AZURE_API_VERSION = "v1";
|
|
9
|
+
const AZURE_TOOL_CALL_PROVIDERS = new Set([
|
|
10
|
+
"openai",
|
|
11
|
+
"openai-codex",
|
|
12
|
+
"opencode",
|
|
13
|
+
"azure-openai-responses"
|
|
14
|
+
]);
|
|
15
|
+
function parseDeploymentNameMap(value) {
|
|
16
|
+
const map = /* @__PURE__ */ new Map();
|
|
17
|
+
if (!value) return map;
|
|
18
|
+
for (const entry of value.split(",")) {
|
|
19
|
+
const trimmed = entry.trim();
|
|
20
|
+
if (!trimmed) continue;
|
|
21
|
+
const [modelId, deploymentName] = trimmed.split("=", 2);
|
|
22
|
+
if (!modelId || !deploymentName) continue;
|
|
23
|
+
map.set(modelId.trim(), deploymentName.trim());
|
|
24
|
+
}
|
|
25
|
+
return map;
|
|
26
|
+
}
|
|
27
|
+
function resolveDeploymentName(model, options) {
|
|
28
|
+
if (options?.azureDeploymentName) return options.azureDeploymentName;
|
|
29
|
+
return parseDeploymentNameMap(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(model.id) || model.id;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate function for Azure OpenAI Responses API
|
|
33
|
+
*/
|
|
34
|
+
const streamAzureOpenAIResponses = (model, context, options) => {
|
|
35
|
+
const stream = new AssistantMessageEventStream();
|
|
36
|
+
(async () => {
|
|
37
|
+
const deploymentName = resolveDeploymentName(model, options);
|
|
38
|
+
const output = {
|
|
39
|
+
role: "assistant",
|
|
40
|
+
content: [],
|
|
41
|
+
api: "azure-openai-responses",
|
|
42
|
+
provider: model.provider,
|
|
43
|
+
model: model.id,
|
|
44
|
+
usage: {
|
|
45
|
+
input: 0,
|
|
46
|
+
output: 0,
|
|
47
|
+
cacheRead: 0,
|
|
48
|
+
cacheWrite: 0,
|
|
49
|
+
totalTokens: 0,
|
|
50
|
+
cost: {
|
|
51
|
+
input: 0,
|
|
52
|
+
output: 0,
|
|
53
|
+
cacheRead: 0,
|
|
54
|
+
cacheWrite: 0,
|
|
55
|
+
total: 0
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
stopReason: "stop",
|
|
59
|
+
timestamp: Date.now()
|
|
60
|
+
};
|
|
61
|
+
try {
|
|
62
|
+
const client = createClient(model, options?.apiKey || getEnvApiKey(model.provider) || "", options);
|
|
63
|
+
let params = buildParams(model, context, options, deploymentName);
|
|
64
|
+
const nextParams = await options?.onPayload?.(params, model);
|
|
65
|
+
if (nextParams !== void 0) params = nextParams;
|
|
66
|
+
const { data: openaiStream, response } = await client.responses.create(params, options?.signal ? { signal: options.signal } : void 0).withResponse();
|
|
67
|
+
await options?.onResponse?.({
|
|
68
|
+
status: response.status,
|
|
69
|
+
headers: headersToRecord(response.headers)
|
|
70
|
+
}, model);
|
|
71
|
+
stream.push({
|
|
72
|
+
type: "start",
|
|
73
|
+
partial: output
|
|
74
|
+
});
|
|
75
|
+
await processResponsesStream(openaiStream, output, stream, model);
|
|
76
|
+
if (options?.signal?.aborted) throw new Error("Request was aborted");
|
|
77
|
+
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error("An unknown error occurred");
|
|
78
|
+
stream.push({
|
|
79
|
+
type: "done",
|
|
80
|
+
reason: output.stopReason,
|
|
81
|
+
message: output
|
|
82
|
+
});
|
|
83
|
+
stream.end();
|
|
84
|
+
} catch (error) {
|
|
85
|
+
for (const block of output.content) {
|
|
86
|
+
delete block.index;
|
|
87
|
+
delete block.partialJson;
|
|
88
|
+
}
|
|
89
|
+
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
90
|
+
output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
|
|
91
|
+
stream.push({
|
|
92
|
+
type: "error",
|
|
93
|
+
reason: output.stopReason,
|
|
94
|
+
error: output
|
|
95
|
+
});
|
|
96
|
+
stream.end();
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
return stream;
|
|
100
|
+
};
|
|
101
|
+
const streamSimpleAzureOpenAIResponses = (model, context, options) => {
|
|
102
|
+
const apiKey = options?.apiKey || getEnvApiKey(model.provider);
|
|
103
|
+
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
104
|
+
const base = buildBaseOptions(model, options, apiKey);
|
|
105
|
+
const reasoningEffort = supportsXhigh(model) ? options?.reasoning : clampReasoning(options?.reasoning);
|
|
106
|
+
return streamAzureOpenAIResponses(model, context, {
|
|
107
|
+
...base,
|
|
108
|
+
reasoningEffort
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
function normalizeAzureBaseUrl(baseUrl) {
|
|
112
|
+
return baseUrl.replace(/\/+$/, "");
|
|
113
|
+
}
|
|
114
|
+
function buildDefaultBaseUrl(resourceName) {
|
|
115
|
+
return `https://${resourceName}.openai.azure.com/openai/v1`;
|
|
116
|
+
}
|
|
117
|
+
function resolveAzureConfig(model, options) {
|
|
118
|
+
const apiVersion = options?.azureApiVersion || process.env.AZURE_OPENAI_API_VERSION || DEFAULT_AZURE_API_VERSION;
|
|
119
|
+
const baseUrl = options?.azureBaseUrl?.trim() || process.env.AZURE_OPENAI_BASE_URL?.trim() || void 0;
|
|
120
|
+
const resourceName = options?.azureResourceName || process.env.AZURE_OPENAI_RESOURCE_NAME;
|
|
121
|
+
let resolvedBaseUrl = baseUrl;
|
|
122
|
+
if (!resolvedBaseUrl && resourceName) resolvedBaseUrl = buildDefaultBaseUrl(resourceName);
|
|
123
|
+
if (!resolvedBaseUrl && model.baseUrl) resolvedBaseUrl = model.baseUrl;
|
|
124
|
+
if (!resolvedBaseUrl) throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");
|
|
125
|
+
return {
|
|
126
|
+
baseUrl: normalizeAzureBaseUrl(resolvedBaseUrl),
|
|
127
|
+
apiVersion
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function createClient(model, apiKey, options) {
|
|
131
|
+
if (!apiKey) {
|
|
132
|
+
if (!process.env.AZURE_OPENAI_API_KEY) throw new Error("Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY environment variable or pass it as an argument.");
|
|
133
|
+
apiKey = process.env.AZURE_OPENAI_API_KEY;
|
|
134
|
+
}
|
|
135
|
+
const headers = { ...model.headers };
|
|
136
|
+
if (options?.headers) Object.assign(headers, options.headers);
|
|
137
|
+
const { baseUrl, apiVersion } = resolveAzureConfig(model, options);
|
|
138
|
+
return new AzureOpenAI({
|
|
139
|
+
apiKey,
|
|
140
|
+
apiVersion,
|
|
141
|
+
dangerouslyAllowBrowser: true,
|
|
142
|
+
defaultHeaders: headers,
|
|
143
|
+
baseURL: baseUrl
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function buildParams(model, context, options, deploymentName) {
|
|
147
|
+
const params = {
|
|
148
|
+
model: deploymentName,
|
|
149
|
+
input: convertResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS),
|
|
150
|
+
stream: true,
|
|
151
|
+
prompt_cache_key: options?.sessionId
|
|
152
|
+
};
|
|
153
|
+
if (options?.maxTokens) params.max_output_tokens = options?.maxTokens;
|
|
154
|
+
if (options?.temperature !== void 0) params.temperature = options?.temperature;
|
|
155
|
+
if (context.tools) params.tools = convertResponsesTools(context.tools);
|
|
156
|
+
if (model.reasoning) if (options?.reasoningEffort || options?.reasoningSummary) {
|
|
157
|
+
params.reasoning = {
|
|
158
|
+
effort: options?.reasoningEffort || "medium",
|
|
159
|
+
summary: options?.reasoningSummary || "auto"
|
|
160
|
+
};
|
|
161
|
+
params.include = ["reasoning.encrypted_content"];
|
|
162
|
+
} else params.reasoning = { effort: "none" };
|
|
163
|
+
return params;
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { streamAzureOpenAIResponses, streamSimpleAzureOpenAIResponses };
|