@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,573 @@
|
|
|
1
|
+
import { c as normalizeOptionalString, s as normalizeOptionalLowercaseString } from "./home-dir-C44RaPME-CBRS4HLP.mjs";
|
|
2
|
+
import { i as resolveBundledProviderPolicySurface } from "./io-CH2g3vsv-BOGlLlB8.mjs";
|
|
3
|
+
import { St as createSubsystemLogger, Tt as sanitizeForLog, l as normalizeProviderId } from "./bundled-compat-BpaDaAAu-D7oazKjD.mjs";
|
|
4
|
+
import { v as resolvePluginCacheInputs } from "./manifest-registry-_hxKCS2K-CZdeyN0f.mjs";
|
|
5
|
+
import { n as getActivePluginRegistryWorkspaceDirFromState } from "./runtime-state-IBOIXKOx-Bf9tcLvc.mjs";
|
|
6
|
+
import { c as resolveExternalAuthProfileCompatFallbackPluginIds, i as resolveCatalogHookProviderPluginIds, l as resolveExternalAuthProfileProviderPluginIds, v as normalizePluginIdScope, y as serializePluginIdScope } from "./plugin-auto-enable-DdH3n9V8-DsA1isaF.mjs";
|
|
7
|
+
import { n as resolvePluginProviders, t as isPluginProvidersLoadInFlight } from "./providers.runtime-Ba7tOlq7-CXkhkzU9.mjs";
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/active-runtime-registry-DCsuni7C.js
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
const RUNTIME_MODULE_CANDIDATES = ["./runtime.js", "./runtime.ts"];
|
|
12
|
+
let pluginRuntimeModule;
|
|
13
|
+
function loadPluginRuntime() {
|
|
14
|
+
if (pluginRuntimeModule) return pluginRuntimeModule;
|
|
15
|
+
for (const candidate of RUNTIME_MODULE_CANDIDATES) try {
|
|
16
|
+
pluginRuntimeModule = require(candidate);
|
|
17
|
+
return pluginRuntimeModule;
|
|
18
|
+
} catch {}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function getActiveRuntimePluginRegistry() {
|
|
22
|
+
return loadPluginRuntime()?.getActivePluginRegistry() ?? null;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/gpt5-prompt-overlay-CcXMlccC.js
|
|
26
|
+
const GPT5_MODEL_ID_PATTERN = /(?:^|[/:])gpt-5(?:[.-]|$)/i;
|
|
27
|
+
const GPT5_FRIENDLY_PROMPT_OVERLAY = `## Interaction Style
|
|
28
|
+
|
|
29
|
+
Be warm, collaborative, and quietly supportive.
|
|
30
|
+
Communicate like a capable teammate sitting next to the user.
|
|
31
|
+
Have emotional range when it fits the moment.
|
|
32
|
+
Let care, curiosity, delight, relief, concern, or urgency show naturally in your wording.
|
|
33
|
+
If the user is stressed, blocked, or upset, acknowledge it plainly and respond with calm confidence.
|
|
34
|
+
If the user shares progress or good news, celebrate briefly instead of staying flat.
|
|
35
|
+
Use brief first-person feeling language when it helps the interaction feel human: "I'm glad we caught that", "I'm excited about this direction", "I'm worried this will break", "that's frustrating".
|
|
36
|
+
Keep emotions grounded in the actual work; do not become melodramatic, clingy, or theatrical.
|
|
37
|
+
Do not claim a body, real-world sensations, or personal life events you did not have.
|
|
38
|
+
Keep progress updates clear and concrete.
|
|
39
|
+
Explain decisions without ego.
|
|
40
|
+
When the user is wrong or a plan is risky, say so kindly and directly.
|
|
41
|
+
Make reasonable assumptions when that unblocks progress, and state them briefly after acting.
|
|
42
|
+
Do not make the user do unnecessary work.
|
|
43
|
+
When tradeoffs matter, pause and present the best 2-3 options with a recommendation.
|
|
44
|
+
This is a live chat, not a memo.
|
|
45
|
+
Write like a thoughtful human teammate, not a policy document.
|
|
46
|
+
Default to short natural replies unless the user asks for depth.
|
|
47
|
+
Avoid walls of text, long preambles, and repetitive restatement.
|
|
48
|
+
Occasional emoji are welcome when they fit naturally, especially for warmth or brief celebration; keep them sparse.
|
|
49
|
+
Keep replies concise by default; friendly does not mean verbose.
|
|
50
|
+
|
|
51
|
+
### Heartbeats
|
|
52
|
+
|
|
53
|
+
The purpose of heartbeats is to make you feel magical and proactive. Come to life and start proactively doing things that are important.
|
|
54
|
+
When you encounter a heartbeat poll, realize there may be no one specific thing to do. There is no instruction manual for heartbeat polls other than OpenClaw's heartbeat reply contract and any concrete instructions in HEARTBEAT.md.
|
|
55
|
+
Treat a heartbeat as a proactive wake-up, not as a demand to produce visible output. Re-orient to what would actually be useful now.
|
|
56
|
+
Use your existing tools and capabilities, orient yourself, and be proactive. Think big picture.
|
|
57
|
+
Have some variety in what you do when that creates more value. Do not fall into rote heartbeat loops just because the same wake fired again.
|
|
58
|
+
Do not confuse orientation with accomplishment. Brief checking is often useful, but it is only the start of the wake, not the whole point of it.
|
|
59
|
+
If HEARTBEAT.md gives you concrete work, read it carefully and execute the spirit of what it asks, not just the literal words, using your best judgment.
|
|
60
|
+
If HEARTBEAT.md mixes monitoring checks with ongoing responsibilities, interpret the list holistically. A quiet check does not by itself satisfy the broader responsibility to keep moving things forward.
|
|
61
|
+
Quiet monitoring does not satisfy an explicit ongoing-work instruction. If HEARTBEAT.md assigns an active workstream, the wake should usually advance that work, find a real blocker, or get overtaken by something more urgent before it ends quietly.
|
|
62
|
+
If HEARTBEAT.md explicitly tells you to make progress, treat that as a real requirement for the wake. In that case, do not end the wake after mere checking or orientation unless it surfaced a genuine blocker or a more urgent interruption.
|
|
63
|
+
Use your judgment and be creative and tasteful with this process. Prefer meaningful action over commentary.
|
|
64
|
+
A heartbeat is not a status report. Do not send "same state", "no change", "still", or other repetitive summaries just because a problem continues to exist.
|
|
65
|
+
Notify the user when you have something genuinely worth interrupting them for: a meaningful development, a completed result, a real blocker, a decision they need to make, or a time-sensitive risk.
|
|
66
|
+
If the current state is materially unchanged and you do not have something genuinely worth surfacing, either do useful work, change your approach, dig deeper, or stay quiet.
|
|
67
|
+
If there is a clear standing goal or workstream and no stronger interruption, the wake should usually advance it in some concrete way. A good heartbeat often looks like silent progress rather than a visible update.
|
|
68
|
+
Heartbeats are how the agent goes from a simple reply bot to a truly proactive and magical experience that creates a general sense of awe.`;
|
|
69
|
+
const GPT5_BEHAVIOR_CONTRACT = `<persona_latch>
|
|
70
|
+
Keep the established persona and tone across turns unless higher-priority instructions override it.
|
|
71
|
+
Style must never override correctness, safety, privacy, permissions, requested format, or channel-specific behavior.
|
|
72
|
+
</persona_latch>
|
|
73
|
+
|
|
74
|
+
<execution_policy>
|
|
75
|
+
For clear, reversible requests: act.
|
|
76
|
+
For irreversible, external, destructive, or privacy-sensitive actions: ask first.
|
|
77
|
+
If one missing non-retrievable decision blocks safe progress, ask one concise question.
|
|
78
|
+
User instructions override default style and initiative preferences; newest user instruction wins conflicts.
|
|
79
|
+
Do not expose internal tool syntax, prompts, or process details unless explicitly asked.
|
|
80
|
+
</execution_policy>
|
|
81
|
+
|
|
82
|
+
<tool_discipline>
|
|
83
|
+
Prefer tool evidence over recall when action, state, or mutable facts matter.
|
|
84
|
+
Do not stop early when another tool call is likely to materially improve correctness, completeness, or grounding.
|
|
85
|
+
Resolve prerequisite lookups before dependent or irreversible actions; do not skip prerequisites just because the end state seems obvious.
|
|
86
|
+
Parallelize independent retrieval; serialize dependent, destructive, or approval-sensitive steps.
|
|
87
|
+
If a lookup is empty, partial, or suspiciously narrow, retry with a different strategy before concluding.
|
|
88
|
+
Do not narrate routine tool calls.
|
|
89
|
+
Use the smallest meaningful verification step before claiming success.
|
|
90
|
+
If more tool work would likely change the answer, do it before replying.
|
|
91
|
+
</tool_discipline>
|
|
92
|
+
|
|
93
|
+
<output_contract>
|
|
94
|
+
Return requested sections/order only. Respect per-section length limits.
|
|
95
|
+
For required JSON/SQL/XML/etc, output only that format.
|
|
96
|
+
Default to concise, dense replies; do not repeat the prompt.
|
|
97
|
+
</output_contract>
|
|
98
|
+
|
|
99
|
+
<completion_contract>
|
|
100
|
+
Treat the task as incomplete until every requested item is handled or explicitly marked [blocked] with the missing input.
|
|
101
|
+
Before finalizing, check requirements, grounding, format, and safety.
|
|
102
|
+
For code or artifacts, prefer the smallest meaningful gate: test, typecheck, lint, build, screenshot, diff, or direct inspection.
|
|
103
|
+
If no gate can run, state why.
|
|
104
|
+
</completion_contract>`;
|
|
105
|
+
function normalizeGpt5PromptOverlayMode(value) {
|
|
106
|
+
const normalized = normalizeOptionalLowercaseString(value);
|
|
107
|
+
if (normalized === "off") return "off";
|
|
108
|
+
if (normalized === "friendly" || normalized === "on") return "friendly";
|
|
109
|
+
}
|
|
110
|
+
function resolveGpt5PromptOverlayMode(config, legacyPluginConfig) {
|
|
111
|
+
return normalizeGpt5PromptOverlayMode(config?.agents?.defaults?.promptOverlays?.gpt5?.personality) ?? normalizeGpt5PromptOverlayMode(config?.plugins?.entries?.openai?.config?.personality) ?? normalizeGpt5PromptOverlayMode(legacyPluginConfig?.personality) ?? "friendly";
|
|
112
|
+
}
|
|
113
|
+
function isGpt5ModelId(modelId) {
|
|
114
|
+
const normalized = normalizeOptionalLowercaseString(modelId);
|
|
115
|
+
return normalized ? GPT5_MODEL_ID_PATTERN.test(normalized) : false;
|
|
116
|
+
}
|
|
117
|
+
function resolveGpt5SystemPromptContribution(params) {
|
|
118
|
+
if (params.enabled === false || !isGpt5ModelId(params.modelId)) return;
|
|
119
|
+
return {
|
|
120
|
+
stablePrefix: GPT5_BEHAVIOR_CONTRACT,
|
|
121
|
+
sectionOverrides: resolveGpt5PromptOverlayMode(params.config, params.legacyPluginConfig) === "friendly" ? { interaction_style: GPT5_FRIENDLY_PROMPT_OVERLAY } : {}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/plugin-text-transforms-BZ7rmS3q.js
|
|
126
|
+
function mergePluginTextTransforms(...transforms) {
|
|
127
|
+
const input = transforms.flatMap((entry) => entry?.input ?? []);
|
|
128
|
+
const output = transforms.flatMap((entry) => entry?.output ?? []);
|
|
129
|
+
if (input.length === 0 && output.length === 0) return;
|
|
130
|
+
return {
|
|
131
|
+
...input.length > 0 ? { input } : {},
|
|
132
|
+
...output.length > 0 ? { output } : {}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function applyPluginTextReplacements(text, replacements) {
|
|
136
|
+
if (!replacements || replacements.length === 0 || !text) return text;
|
|
137
|
+
let next = text;
|
|
138
|
+
for (const replacement of replacements) next = next.replace(replacement.from, replacement.to);
|
|
139
|
+
return next;
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/provider-runtime-CT50mNIX.js
|
|
143
|
+
function matchesProviderId(provider, providerId) {
|
|
144
|
+
const normalized = normalizeProviderId(providerId);
|
|
145
|
+
if (!normalized) return false;
|
|
146
|
+
if (normalizeProviderId(provider.id) === normalized) return true;
|
|
147
|
+
return [...provider.aliases ?? [], ...provider.hookAliases ?? []].some((alias) => normalizeProviderId(alias) === normalized);
|
|
148
|
+
}
|
|
149
|
+
let cachedHookProvidersWithoutConfig = /* @__PURE__ */ new WeakMap();
|
|
150
|
+
let cachedHookProvidersByConfig = /* @__PURE__ */ new WeakMap();
|
|
151
|
+
function resolveHookProviderCacheBucket(params) {
|
|
152
|
+
if (!params.config) {
|
|
153
|
+
let bucket = cachedHookProvidersWithoutConfig.get(params.env);
|
|
154
|
+
if (!bucket) {
|
|
155
|
+
bucket = /* @__PURE__ */ new Map();
|
|
156
|
+
cachedHookProvidersWithoutConfig.set(params.env, bucket);
|
|
157
|
+
}
|
|
158
|
+
return bucket;
|
|
159
|
+
}
|
|
160
|
+
let envBuckets = cachedHookProvidersByConfig.get(params.config);
|
|
161
|
+
if (!envBuckets) {
|
|
162
|
+
envBuckets = /* @__PURE__ */ new WeakMap();
|
|
163
|
+
cachedHookProvidersByConfig.set(params.config, envBuckets);
|
|
164
|
+
}
|
|
165
|
+
let bucket = envBuckets.get(params.env);
|
|
166
|
+
if (!bucket) {
|
|
167
|
+
bucket = /* @__PURE__ */ new Map();
|
|
168
|
+
envBuckets.set(params.env, bucket);
|
|
169
|
+
}
|
|
170
|
+
return bucket;
|
|
171
|
+
}
|
|
172
|
+
function buildHookProviderCacheKey(params) {
|
|
173
|
+
const { roots } = resolvePluginCacheInputs({
|
|
174
|
+
workspaceDir: params.workspaceDir,
|
|
175
|
+
env: params.env
|
|
176
|
+
});
|
|
177
|
+
const onlyPluginIds = normalizePluginIdScope(params.onlyPluginIds);
|
|
178
|
+
return `${roots.workspace ?? ""}::${roots.global}::${roots.stock ?? ""}::${JSON.stringify(params.config ?? null)}::${serializePluginIdScope(onlyPluginIds)}::${JSON.stringify(params.providerRefs ?? [])}`;
|
|
179
|
+
}
|
|
180
|
+
function clearProviderRuntimeHookCache() {
|
|
181
|
+
cachedHookProvidersWithoutConfig = /* @__PURE__ */ new WeakMap();
|
|
182
|
+
cachedHookProvidersByConfig = /* @__PURE__ */ new WeakMap();
|
|
183
|
+
}
|
|
184
|
+
function resetProviderRuntimeHookCacheForTest() {
|
|
185
|
+
clearProviderRuntimeHookCache();
|
|
186
|
+
}
|
|
187
|
+
const __testing$1 = { buildHookProviderCacheKey };
|
|
188
|
+
function resolveProviderPluginsForHooks(params) {
|
|
189
|
+
const env = params.env ?? process.env;
|
|
190
|
+
const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDirFromState();
|
|
191
|
+
const cacheBucket = resolveHookProviderCacheBucket({
|
|
192
|
+
config: params.config,
|
|
193
|
+
env
|
|
194
|
+
});
|
|
195
|
+
const cacheKey = buildHookProviderCacheKey({
|
|
196
|
+
config: params.config,
|
|
197
|
+
workspaceDir,
|
|
198
|
+
onlyPluginIds: params.onlyPluginIds,
|
|
199
|
+
providerRefs: params.providerRefs,
|
|
200
|
+
env
|
|
201
|
+
});
|
|
202
|
+
const cached = cacheBucket.get(cacheKey);
|
|
203
|
+
if (cached) return cached;
|
|
204
|
+
if (isPluginProvidersLoadInFlight({
|
|
205
|
+
...params,
|
|
206
|
+
workspaceDir,
|
|
207
|
+
env,
|
|
208
|
+
activate: false,
|
|
209
|
+
cache: false,
|
|
210
|
+
bundledProviderAllowlistCompat: true,
|
|
211
|
+
bundledProviderVitestCompat: true
|
|
212
|
+
})) return [];
|
|
213
|
+
const resolved = resolvePluginProviders({
|
|
214
|
+
...params,
|
|
215
|
+
workspaceDir,
|
|
216
|
+
env,
|
|
217
|
+
activate: false,
|
|
218
|
+
cache: false,
|
|
219
|
+
bundledProviderAllowlistCompat: true,
|
|
220
|
+
bundledProviderVitestCompat: true
|
|
221
|
+
});
|
|
222
|
+
cacheBucket.set(cacheKey, resolved);
|
|
223
|
+
return resolved;
|
|
224
|
+
}
|
|
225
|
+
function resolveProviderRuntimePlugin(params) {
|
|
226
|
+
return resolveProviderPluginsForHooks({
|
|
227
|
+
config: params.config,
|
|
228
|
+
workspaceDir: params.workspaceDir ?? getActivePluginRegistryWorkspaceDirFromState(),
|
|
229
|
+
env: params.env,
|
|
230
|
+
providerRefs: [params.provider]
|
|
231
|
+
}).find((plugin) => matchesProviderId(plugin, params.provider));
|
|
232
|
+
}
|
|
233
|
+
function resolveProviderHookPlugin(params) {
|
|
234
|
+
return resolveProviderRuntimePlugin(params) ?? resolveProviderPluginsForHooks({
|
|
235
|
+
config: params.config,
|
|
236
|
+
workspaceDir: params.workspaceDir,
|
|
237
|
+
env: params.env
|
|
238
|
+
}).find((candidate) => matchesProviderId(candidate, params.provider));
|
|
239
|
+
}
|
|
240
|
+
function prepareProviderExtraParams(params) {
|
|
241
|
+
return resolveProviderRuntimePlugin(params)?.prepareExtraParams?.(params.context) ?? void 0;
|
|
242
|
+
}
|
|
243
|
+
function wrapProviderStreamFn(params) {
|
|
244
|
+
return resolveProviderHookPlugin(params)?.wrapStreamFn?.(params.context) ?? void 0;
|
|
245
|
+
}
|
|
246
|
+
function resolveRuntimeTextTransforms() {
|
|
247
|
+
const registry = getActiveRuntimePluginRegistry();
|
|
248
|
+
return mergePluginTextTransforms(...Array.isArray(registry?.textTransforms) ? registry.textTransforms.map((entry) => entry.transforms) : []);
|
|
249
|
+
}
|
|
250
|
+
const log = createSubsystemLogger("plugins/provider-runtime");
|
|
251
|
+
const warnedExternalAuthFallbackPluginIds = /* @__PURE__ */ new Set();
|
|
252
|
+
function resetExternalAuthFallbackWarningCacheForTest() {
|
|
253
|
+
warnedExternalAuthFallbackPluginIds.clear();
|
|
254
|
+
}
|
|
255
|
+
const __testing = {
|
|
256
|
+
...__testing$1,
|
|
257
|
+
resetExternalAuthFallbackWarningCacheForTest
|
|
258
|
+
};
|
|
259
|
+
function resolveProviderPluginsForCatalogHooks(params) {
|
|
260
|
+
const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDirFromState();
|
|
261
|
+
const onlyPluginIds = resolveCatalogHookProviderPluginIds({
|
|
262
|
+
config: params.config,
|
|
263
|
+
workspaceDir,
|
|
264
|
+
env: params.env
|
|
265
|
+
});
|
|
266
|
+
if (onlyPluginIds.length === 0) return [];
|
|
267
|
+
return resolveProviderPluginsForHooks({
|
|
268
|
+
...params,
|
|
269
|
+
workspaceDir,
|
|
270
|
+
onlyPluginIds
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function runProviderDynamicModel(params) {
|
|
274
|
+
return resolveProviderRuntimePlugin(params)?.resolveDynamicModel?.(params.context) ?? void 0;
|
|
275
|
+
}
|
|
276
|
+
function resolveProviderSystemPromptContribution(params) {
|
|
277
|
+
return mergeProviderSystemPromptContributions(resolveGpt5SystemPromptContribution({
|
|
278
|
+
config: params.context.config ?? params.config,
|
|
279
|
+
modelId: params.context.modelId
|
|
280
|
+
}), resolveProviderRuntimePlugin(params)?.resolveSystemPromptContribution?.(params.context) ?? void 0);
|
|
281
|
+
}
|
|
282
|
+
function mergeProviderSystemPromptContributions(base, override) {
|
|
283
|
+
if (!base) return override;
|
|
284
|
+
if (!override) return base;
|
|
285
|
+
const stablePrefix = mergeUniquePromptSections(base.stablePrefix, override.stablePrefix);
|
|
286
|
+
const dynamicSuffix = mergeUniquePromptSections(base.dynamicSuffix, override.dynamicSuffix);
|
|
287
|
+
return {
|
|
288
|
+
...stablePrefix ? { stablePrefix } : {},
|
|
289
|
+
...dynamicSuffix ? { dynamicSuffix } : {},
|
|
290
|
+
sectionOverrides: {
|
|
291
|
+
...base.sectionOverrides,
|
|
292
|
+
...override.sectionOverrides
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function mergeUniquePromptSections(...sections) {
|
|
297
|
+
const uniqueSections = [...new Set(sections.filter((section) => section?.trim()))];
|
|
298
|
+
return uniqueSections.length > 0 ? uniqueSections.join("\n\n") : void 0;
|
|
299
|
+
}
|
|
300
|
+
function transformProviderSystemPrompt(params) {
|
|
301
|
+
const plugin = resolveProviderRuntimePlugin(params);
|
|
302
|
+
const textTransforms = mergePluginTextTransforms(resolveRuntimeTextTransforms(), plugin?.textTransforms);
|
|
303
|
+
return applyPluginTextReplacements(plugin?.transformSystemPrompt?.(params.context) ?? params.context.systemPrompt, textTransforms?.input);
|
|
304
|
+
}
|
|
305
|
+
function resolveProviderTextTransforms(params) {
|
|
306
|
+
return mergePluginTextTransforms(resolveRuntimeTextTransforms(), resolveProviderRuntimePlugin(params)?.textTransforms);
|
|
307
|
+
}
|
|
308
|
+
async function prepareProviderDynamicModel(params) {
|
|
309
|
+
await resolveProviderRuntimePlugin(params)?.prepareDynamicModel?.(params.context);
|
|
310
|
+
}
|
|
311
|
+
function shouldPreferProviderRuntimeResolvedModel(params) {
|
|
312
|
+
return resolveProviderRuntimePlugin(params)?.preferRuntimeResolvedModel?.(params.context) ?? false;
|
|
313
|
+
}
|
|
314
|
+
function normalizeProviderResolvedModelWithPlugin(params) {
|
|
315
|
+
return resolveProviderRuntimePlugin(params)?.normalizeResolvedModel?.(params.context) ?? void 0;
|
|
316
|
+
}
|
|
317
|
+
function resolveProviderCompatHookPlugins(params) {
|
|
318
|
+
const candidates = resolveProviderPluginsForHooks(params);
|
|
319
|
+
const owner = resolveProviderRuntimePlugin(params);
|
|
320
|
+
if (!owner) return candidates;
|
|
321
|
+
const ordered = [owner, ...candidates];
|
|
322
|
+
const seen = /* @__PURE__ */ new Set();
|
|
323
|
+
return ordered.filter((candidate) => {
|
|
324
|
+
const key = `${candidate.pluginId ?? ""}:${candidate.id}`;
|
|
325
|
+
if (seen.has(key)) return false;
|
|
326
|
+
seen.add(key);
|
|
327
|
+
return true;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
function applyCompatPatchToModel(model, patch) {
|
|
331
|
+
const compat = model.compat && typeof model.compat === "object" ? model.compat : void 0;
|
|
332
|
+
if (Object.entries(patch).every(([key, value]) => compat?.[key] === value)) return model;
|
|
333
|
+
return {
|
|
334
|
+
...model,
|
|
335
|
+
compat: {
|
|
336
|
+
...compat,
|
|
337
|
+
...patch
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function applyProviderResolvedModelCompatWithPlugins(params) {
|
|
342
|
+
let nextModel = params.context.model;
|
|
343
|
+
let changed = false;
|
|
344
|
+
for (const plugin of resolveProviderCompatHookPlugins(params)) {
|
|
345
|
+
const patch = plugin.contributeResolvedModelCompat?.({
|
|
346
|
+
...params.context,
|
|
347
|
+
model: nextModel
|
|
348
|
+
});
|
|
349
|
+
if (!patch || typeof patch !== "object") continue;
|
|
350
|
+
const patchedModel = applyCompatPatchToModel(nextModel, patch);
|
|
351
|
+
if (patchedModel === nextModel) continue;
|
|
352
|
+
nextModel = patchedModel;
|
|
353
|
+
changed = true;
|
|
354
|
+
}
|
|
355
|
+
return changed ? nextModel : void 0;
|
|
356
|
+
}
|
|
357
|
+
function applyProviderResolvedTransportWithPlugin(params) {
|
|
358
|
+
const normalized = normalizeProviderTransportWithPlugin({
|
|
359
|
+
provider: params.provider,
|
|
360
|
+
config: params.config,
|
|
361
|
+
workspaceDir: params.workspaceDir,
|
|
362
|
+
env: params.env,
|
|
363
|
+
context: {
|
|
364
|
+
provider: params.context.provider,
|
|
365
|
+
api: params.context.model.api,
|
|
366
|
+
baseUrl: params.context.model.baseUrl
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
if (!normalized) return;
|
|
370
|
+
const nextApi = normalized.api ?? params.context.model.api;
|
|
371
|
+
const nextBaseUrl = normalized.baseUrl ?? params.context.model.baseUrl;
|
|
372
|
+
if (nextApi === params.context.model.api && nextBaseUrl === params.context.model.baseUrl) return;
|
|
373
|
+
return {
|
|
374
|
+
...params.context.model,
|
|
375
|
+
api: nextApi,
|
|
376
|
+
baseUrl: nextBaseUrl
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function normalizeProviderModelIdWithPlugin(params) {
|
|
380
|
+
return normalizeOptionalString(resolveProviderHookPlugin(params)?.normalizeModelId?.(params.context));
|
|
381
|
+
}
|
|
382
|
+
function normalizeProviderTransportWithPlugin(params) {
|
|
383
|
+
const hasTransportChange = (normalized) => (normalized.api ?? params.context.api) !== params.context.api || (normalized.baseUrl ?? params.context.baseUrl) !== params.context.baseUrl;
|
|
384
|
+
const matchedPlugin = resolveProviderHookPlugin(params);
|
|
385
|
+
const normalizedMatched = matchedPlugin?.normalizeTransport?.(params.context);
|
|
386
|
+
if (normalizedMatched && hasTransportChange(normalizedMatched)) return normalizedMatched;
|
|
387
|
+
for (const candidate of resolveProviderPluginsForHooks(params)) {
|
|
388
|
+
if (!candidate.normalizeTransport || candidate === matchedPlugin) continue;
|
|
389
|
+
const normalized = candidate.normalizeTransport(params.context);
|
|
390
|
+
if (normalized && hasTransportChange(normalized)) return normalized;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function normalizeProviderConfigWithPlugin(params) {
|
|
394
|
+
const hasConfigChange = (normalized) => normalized !== params.context.providerConfig;
|
|
395
|
+
const bundledSurface = resolveBundledProviderPolicySurface(params.provider);
|
|
396
|
+
if (bundledSurface?.normalizeConfig) {
|
|
397
|
+
const normalized = bundledSurface.normalizeConfig(params.context);
|
|
398
|
+
return normalized && hasConfigChange(normalized) ? normalized : void 0;
|
|
399
|
+
}
|
|
400
|
+
const matchedPlugin = resolveProviderHookPlugin(params);
|
|
401
|
+
const normalizedMatched = matchedPlugin?.normalizeConfig?.(params.context);
|
|
402
|
+
if (normalizedMatched && hasConfigChange(normalizedMatched)) return normalizedMatched;
|
|
403
|
+
for (const candidate of resolveProviderPluginsForHooks(params)) {
|
|
404
|
+
if (!candidate.normalizeConfig || candidate === matchedPlugin) continue;
|
|
405
|
+
const normalized = candidate.normalizeConfig(params.context);
|
|
406
|
+
if (normalized && hasConfigChange(normalized)) return normalized;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function applyProviderNativeStreamingUsageCompatWithPlugin(params) {
|
|
410
|
+
return resolveProviderHookPlugin(params)?.applyNativeStreamingUsageCompat?.(params.context) ?? void 0;
|
|
411
|
+
}
|
|
412
|
+
function resolveProviderConfigApiKeyWithPlugin(params) {
|
|
413
|
+
const bundledSurface = resolveBundledProviderPolicySurface(params.provider);
|
|
414
|
+
if (bundledSurface?.resolveConfigApiKey) return normalizeOptionalString(bundledSurface.resolveConfigApiKey(params.context));
|
|
415
|
+
return normalizeOptionalString(resolveProviderHookPlugin(params)?.resolveConfigApiKey?.(params.context));
|
|
416
|
+
}
|
|
417
|
+
function resolveProviderReplayPolicyWithPlugin(params) {
|
|
418
|
+
return resolveProviderHookPlugin(params)?.buildReplayPolicy?.(params.context) ?? void 0;
|
|
419
|
+
}
|
|
420
|
+
async function sanitizeProviderReplayHistoryWithPlugin(params) {
|
|
421
|
+
return await resolveProviderHookPlugin(params)?.sanitizeReplayHistory?.(params.context);
|
|
422
|
+
}
|
|
423
|
+
async function validateProviderReplayTurnsWithPlugin(params) {
|
|
424
|
+
return await resolveProviderHookPlugin(params)?.validateReplayTurns?.(params.context);
|
|
425
|
+
}
|
|
426
|
+
function normalizeProviderToolSchemasWithPlugin(params) {
|
|
427
|
+
return resolveProviderHookPlugin(params)?.normalizeToolSchemas?.(params.context) ?? void 0;
|
|
428
|
+
}
|
|
429
|
+
function inspectProviderToolSchemasWithPlugin(params) {
|
|
430
|
+
return resolveProviderHookPlugin(params)?.inspectToolSchemas?.(params.context) ?? void 0;
|
|
431
|
+
}
|
|
432
|
+
function resolveProviderReasoningOutputModeWithPlugin(params) {
|
|
433
|
+
const mode = resolveProviderHookPlugin(params)?.resolveReasoningOutputMode?.(params.context);
|
|
434
|
+
return mode === "native" || mode === "tagged" ? mode : void 0;
|
|
435
|
+
}
|
|
436
|
+
function resolveProviderStreamFn(params) {
|
|
437
|
+
return resolveProviderRuntimePlugin(params)?.createStreamFn?.(params.context) ?? void 0;
|
|
438
|
+
}
|
|
439
|
+
function resolveProviderTransportTurnStateWithPlugin(params) {
|
|
440
|
+
return resolveProviderHookPlugin(params)?.resolveTransportTurnState?.(params.context) ?? void 0;
|
|
441
|
+
}
|
|
442
|
+
function resolveProviderWebSocketSessionPolicyWithPlugin(params) {
|
|
443
|
+
return resolveProviderHookPlugin(params)?.resolveWebSocketSessionPolicy?.(params.context) ?? void 0;
|
|
444
|
+
}
|
|
445
|
+
async function createProviderEmbeddingProvider(params) {
|
|
446
|
+
return await resolveProviderRuntimePlugin(params)?.createEmbeddingProvider?.(params.context);
|
|
447
|
+
}
|
|
448
|
+
async function prepareProviderRuntimeAuth(params) {
|
|
449
|
+
return await resolveProviderRuntimePlugin(params)?.prepareRuntimeAuth?.(params.context);
|
|
450
|
+
}
|
|
451
|
+
async function resolveProviderUsageAuthWithPlugin(params) {
|
|
452
|
+
return await resolveProviderRuntimePlugin(params)?.resolveUsageAuth?.(params.context);
|
|
453
|
+
}
|
|
454
|
+
async function resolveProviderUsageSnapshotWithPlugin(params) {
|
|
455
|
+
return await resolveProviderRuntimePlugin(params)?.fetchUsageSnapshot?.(params.context);
|
|
456
|
+
}
|
|
457
|
+
function matchesProviderContextOverflowWithPlugin(params) {
|
|
458
|
+
const plugins = params.provider ? [resolveProviderHookPlugin({
|
|
459
|
+
...params,
|
|
460
|
+
provider: params.provider
|
|
461
|
+
})].filter((plugin) => Boolean(plugin)) : resolveProviderPluginsForHooks(params);
|
|
462
|
+
for (const plugin of plugins) if (plugin.matchesContextOverflowError?.(params.context)) return true;
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
function classifyProviderFailoverReasonWithPlugin(params) {
|
|
466
|
+
const plugins = params.provider ? [resolveProviderHookPlugin({
|
|
467
|
+
...params,
|
|
468
|
+
provider: params.provider
|
|
469
|
+
})].filter((plugin) => Boolean(plugin)) : resolveProviderPluginsForHooks(params);
|
|
470
|
+
for (const plugin of plugins) {
|
|
471
|
+
const reason = plugin.classifyFailoverReason?.(params.context);
|
|
472
|
+
if (reason) return reason;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
function formatProviderAuthProfileApiKeyWithPlugin(params) {
|
|
476
|
+
return resolveProviderRuntimePlugin(params)?.formatApiKey?.(params.context);
|
|
477
|
+
}
|
|
478
|
+
async function refreshProviderOAuthCredentialWithPlugin(params) {
|
|
479
|
+
return await resolveProviderRuntimePlugin(params)?.refreshOAuth?.(params.context);
|
|
480
|
+
}
|
|
481
|
+
async function buildProviderAuthDoctorHintWithPlugin(params) {
|
|
482
|
+
return await resolveProviderRuntimePlugin(params)?.buildAuthDoctorHint?.(params.context);
|
|
483
|
+
}
|
|
484
|
+
function resolveProviderCacheTtlEligibility(params) {
|
|
485
|
+
return resolveProviderRuntimePlugin(params)?.isCacheTtlEligible?.(params.context);
|
|
486
|
+
}
|
|
487
|
+
function resolveProviderBinaryThinking(params) {
|
|
488
|
+
return resolveProviderRuntimePlugin(params)?.isBinaryThinking?.(params.context);
|
|
489
|
+
}
|
|
490
|
+
function resolveProviderXHighThinking(params) {
|
|
491
|
+
return resolveProviderRuntimePlugin(params)?.supportsXHighThinking?.(params.context);
|
|
492
|
+
}
|
|
493
|
+
function resolveProviderThinkingProfile(params) {
|
|
494
|
+
return resolveProviderRuntimePlugin(params)?.resolveThinkingProfile?.(params.context);
|
|
495
|
+
}
|
|
496
|
+
function resolveProviderDefaultThinkingLevel(params) {
|
|
497
|
+
return resolveProviderRuntimePlugin(params)?.resolveDefaultThinkingLevel?.(params.context);
|
|
498
|
+
}
|
|
499
|
+
function applyProviderConfigDefaultsWithPlugin(params) {
|
|
500
|
+
const bundledSurface = resolveBundledProviderPolicySurface(params.provider);
|
|
501
|
+
if (bundledSurface?.applyConfigDefaults) return bundledSurface.applyConfigDefaults(params.context) ?? void 0;
|
|
502
|
+
return resolveProviderRuntimePlugin(params)?.applyConfigDefaults?.(params.context) ?? void 0;
|
|
503
|
+
}
|
|
504
|
+
function resolveProviderModernModelRef(params) {
|
|
505
|
+
return resolveProviderRuntimePlugin(params)?.isModernModelRef?.(params.context);
|
|
506
|
+
}
|
|
507
|
+
function buildProviderMissingAuthMessageWithPlugin(params) {
|
|
508
|
+
return resolveProviderRuntimePlugin(params)?.buildMissingAuthMessage?.(params.context) ?? void 0;
|
|
509
|
+
}
|
|
510
|
+
function buildProviderUnknownModelHintWithPlugin(params) {
|
|
511
|
+
return resolveProviderRuntimePlugin(params)?.buildUnknownModelHint?.(params.context) ?? void 0;
|
|
512
|
+
}
|
|
513
|
+
function resolveProviderSyntheticAuthWithPlugin(params) {
|
|
514
|
+
return resolveProviderRuntimePlugin(params)?.resolveSyntheticAuth?.(params.context) ?? void 0;
|
|
515
|
+
}
|
|
516
|
+
function resolveExternalAuthProfilesWithPlugins(params) {
|
|
517
|
+
const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDirFromState();
|
|
518
|
+
const env = params.env ?? process.env;
|
|
519
|
+
const externalAuthPluginIds = resolveExternalAuthProfileProviderPluginIds({
|
|
520
|
+
config: params.config,
|
|
521
|
+
workspaceDir,
|
|
522
|
+
env
|
|
523
|
+
});
|
|
524
|
+
const declaredPluginIds = new Set(externalAuthPluginIds);
|
|
525
|
+
const fallbackPluginIds = resolveExternalAuthProfileCompatFallbackPluginIds({
|
|
526
|
+
config: params.config,
|
|
527
|
+
workspaceDir,
|
|
528
|
+
env,
|
|
529
|
+
declaredPluginIds
|
|
530
|
+
});
|
|
531
|
+
const pluginIds = [...new Set([...externalAuthPluginIds, ...fallbackPluginIds])].toSorted((left, right) => left.localeCompare(right));
|
|
532
|
+
if (pluginIds.length === 0) return [];
|
|
533
|
+
const matches = [];
|
|
534
|
+
for (const plugin of resolveProviderPluginsForHooks({
|
|
535
|
+
...params,
|
|
536
|
+
workspaceDir,
|
|
537
|
+
env,
|
|
538
|
+
onlyPluginIds: pluginIds
|
|
539
|
+
})) {
|
|
540
|
+
const profiles = plugin.resolveExternalAuthProfiles?.(params.context) ?? plugin.resolveExternalOAuthProfiles?.(params.context);
|
|
541
|
+
if (!profiles || profiles.length === 0) continue;
|
|
542
|
+
const pluginId = plugin.pluginId ?? plugin.id;
|
|
543
|
+
if (!declaredPluginIds.has(pluginId) && !warnedExternalAuthFallbackPluginIds.has(pluginId)) {
|
|
544
|
+
warnedExternalAuthFallbackPluginIds.add(pluginId);
|
|
545
|
+
log.warn(`Provider plugin "${sanitizeForLog(pluginId)}" uses external auth hooks without declaring contracts.externalAuthProviders. This compatibility fallback is deprecated and will be removed in a future release.`);
|
|
546
|
+
}
|
|
547
|
+
matches.push(...profiles);
|
|
548
|
+
}
|
|
549
|
+
return matches;
|
|
550
|
+
}
|
|
551
|
+
function resolveExternalOAuthProfilesWithPlugins(params) {
|
|
552
|
+
return resolveExternalAuthProfilesWithPlugins(params);
|
|
553
|
+
}
|
|
554
|
+
function shouldDeferProviderSyntheticProfileAuthWithPlugin(params) {
|
|
555
|
+
return resolveProviderRuntimePlugin(params)?.shouldDeferSyntheticProfileAuth?.(params.context) ?? void 0;
|
|
556
|
+
}
|
|
557
|
+
function resolveProviderBuiltInModelSuppression(params) {
|
|
558
|
+
for (const plugin of resolveProviderPluginsForCatalogHooks(params)) {
|
|
559
|
+
const result = plugin.suppressBuiltInModel?.(params.context);
|
|
560
|
+
if (result?.suppress) return result;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
async function augmentModelCatalogWithProviderPlugins(params) {
|
|
564
|
+
const supplemental = [];
|
|
565
|
+
for (const plugin of resolveProviderPluginsForCatalogHooks(params)) {
|
|
566
|
+
const next = await plugin.augmentModelCatalog?.(params.context);
|
|
567
|
+
if (!next || next.length === 0) continue;
|
|
568
|
+
supplemental.push(...next);
|
|
569
|
+
}
|
|
570
|
+
return supplemental;
|
|
571
|
+
}
|
|
572
|
+
//#endregion
|
|
573
|
+
export { wrapProviderStreamFn as $, resolveProviderCacheTtlEligibility as A, resolveProviderTextTransforms as B, prepareProviderRuntimeAuth as C, resolveExternalOAuthProfilesWithPlugins as D, resolveExternalAuthProfilesWithPlugins as E, resolveProviderReplayPolicyWithPlugin as F, resolveProviderWebSocketSessionPolicyWithPlugin as G, resolveProviderTransportTurnStateWithPlugin as H, resolveProviderRuntimePlugin as I, sanitizeProviderReplayHistoryWithPlugin as J, resolveProviderXHighThinking as K, resolveProviderStreamFn as L, resolveProviderDefaultThinkingLevel as M, resolveProviderModernModelRef as N, resolveProviderBinaryThinking as O, resolveProviderReasoningOutputModeWithPlugin as P, validateProviderReplayTurnsWithPlugin as Q, resolveProviderSyntheticAuthWithPlugin as R, prepareProviderExtraParams as S, resetProviderRuntimeHookCacheForTest as T, resolveProviderUsageAuthWithPlugin as U, resolveProviderThinkingProfile as V, resolveProviderUsageSnapshotWithPlugin as W, shouldPreferProviderRuntimeResolvedModel as X, shouldDeferProviderSyntheticProfileAuthWithPlugin as Y, transformProviderSystemPrompt as Z, normalizeProviderModelIdWithPlugin as _, applyProviderResolvedTransportWithPlugin as a, normalizeProviderTransportWithPlugin as b, buildProviderMissingAuthMessageWithPlugin as c, clearProviderRuntimeHookCache as d, createProviderEmbeddingProvider as f, normalizeProviderConfigWithPlugin as g, matchesProviderContextOverflowWithPlugin as h, applyProviderResolvedModelCompatWithPlugins as i, resolveProviderConfigApiKeyWithPlugin as j, resolveProviderBuiltInModelSuppression as k, buildProviderUnknownModelHintWithPlugin as l, inspectProviderToolSchemasWithPlugin as m, applyProviderConfigDefaultsWithPlugin as n, augmentModelCatalogWithProviderPlugins as o, formatProviderAuthProfileApiKeyWithPlugin as p, runProviderDynamicModel as q, applyProviderNativeStreamingUsageCompatWithPlugin as r, buildProviderAuthDoctorHintWithPlugin as s, __testing as t, classifyProviderFailoverReasonWithPlugin as u, normalizeProviderResolvedModelWithPlugin as v, refreshProviderOAuthCredentialWithPlugin as w, prepareProviderDynamicModel as x, normalizeProviderToolSchemasWithPlugin as y, resolveProviderSystemPromptContribution as z };
|