@vibe-lark/larkpal 0.1.85 → 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.
Files changed (106) hide show
  1. package/dist/account-id-BM1T6029-DYjVxojW.mjs +46 -0
  2. package/dist/activation-context--5yu1dPF-Bwsn3moT.mjs +172 -0
  3. package/dist/anthropic-TH8ERTXK.mjs +5962 -0
  4. package/dist/assistant-visible-text-DuFWokAt-CsbII5KS.mjs +596 -0
  5. package/dist/azure-openai-responses-Bt_Ag9Er.mjs +166 -0
  6. package/dist/boundary-file-read-BSd9MXPy--KThL5e6.mjs +594 -0
  7. package/dist/browser-lifecycle-cleanup-BdNsMhMD-O3tnAM4i.mjs +60 -0
  8. package/dist/build-DgTrEpge.mjs +3333 -0
  9. package/dist/bundled-compat-BpaDaAAu-D7oazKjD.mjs +5216 -0
  10. package/dist/bundled-dir-U738ay4K-DXK0q_TV.mjs +258 -0
  11. package/dist/call-DimWbpgJ-ColD4W-y.mjs +9993 -0
  12. package/dist/channel-bootstrap.runtime-BVclcGv1-DJv_Z-Kr.mjs +2 -0
  13. package/dist/channel-bootstrap.runtime-Cwcr38m2-VRfVCR-i.mjs +33 -0
  14. package/dist/chunk-D6SyT4dJ.mjs +36 -0
  15. package/dist/cli.mjs +6 -6
  16. package/dist/command-format-LSnUCVVF-BQ2SMKka.mjs +685 -0
  17. package/dist/config-Bim2pi8a-BQUdfiEi.mjs +9 -0
  18. package/dist/delivery-context.shared-j5hC5qb1-CI83RXXZ.mjs +72 -0
  19. package/dist/diagnostic-ClMwNnUA-D6nUtLnb.mjs +140 -0
  20. package/dist/dist-CEGw8-2W.mjs +429 -0
  21. package/dist/dist-DD2aJ2UL.mjs +125135 -0
  22. package/dist/env-api-keys-BVvSg7T2.mjs +68 -0
  23. package/dist/event-stream-xaQWmyas.mjs +15226 -0
  24. package/dist/facade-loader-DFzIYYt_-CIr4HKtE.mjs +194 -0
  25. package/dist/from-DF7cl2wz.mjs +3842 -0
  26. package/dist/gateway-method-policy-C7rf0SeV-CJQMEYIE.mjs +28 -0
  27. package/dist/github-copilot-headers-DjqWtUoP.mjs +22 -0
  28. package/dist/google-C2pVrgBZ.mjs +336 -0
  29. package/dist/google-gemini-cli-BBxgS5Ho.mjs +623 -0
  30. package/dist/google-shared-BsWgwEk1.mjs +22791 -0
  31. package/dist/google-vertex-BsVLJrrC.mjs +358 -0
  32. package/dist/hash-DAFtW_W7.mjs +16 -0
  33. package/dist/headers-R3HdCbAE.mjs +8 -0
  34. package/dist/home-dir-C44RaPME-CBRS4HLP.mjs +93 -0
  35. package/dist/ids-BPsM98Uu-CwuxvUai.mjs +77 -0
  36. package/dist/image-2w3cApg7-CxpHvoB5.mjs +207 -0
  37. package/dist/io-CH2g3vsv-BOGlLlB8.mjs +26218 -0
  38. package/dist/jiti-loader-cache-Bat69wam-D6hCxboy.mjs +5049 -0
  39. package/dist/json-file-BQRNuxmK-DhJM5NsG.mjs +108 -0
  40. package/dist/json-parse-v_HIJjjI.mjs +381 -0
  41. package/dist/jws-GFcTvvVT.mjs +2291 -0
  42. package/dist/{lark-cli-provider-7LvtOIF_.mjs → lark-cli-provider-BARgbbmo.mjs} +1 -1
  43. package/dist/{live-smoke-nvTUPtrv.mjs → live-smoke-BhkBOcH9.mjs} +3 -3
  44. package/dist/load-context-mb7uvLSn-B10MAi3I.mjs +29 -0
  45. package/dist/loader-708jrx4Y-BOswuvpe.mjs +5053 -0
  46. package/dist/main.mjs +56550 -205
  47. package/dist/manifest-registry-_hxKCS2K-CZdeyN0f.mjs +3512 -0
  48. package/dist/mcp-server.mjs +1 -1
  49. package/dist/message-channel-Bk_YHfQg-AeNrPPpp.mjs +50 -0
  50. package/dist/message-channel-core-DTA--Gjh-CY4Tkb7N.mjs +29 -0
  51. package/dist/message.config.runtime-K-k4XOyq-DZTmXomP.mjs +2 -0
  52. package/dist/message.gateway.runtime-DqHOHRTQ-DH4ml0YF.mjs +2 -0
  53. package/dist/mistral-CaR4DiLu.mjs +28657 -0
  54. package/dist/model-auth-env-oyg2Hexc-DU_rOUU5.mjs +1306 -0
  55. package/dist/models-config-BmpSQJQF-Gfvh1n3A.mjs +1282 -0
  56. package/dist/models-config.runtime-BsU_22xk.mjs +2 -0
  57. package/dist/multipart-parser-DedmaB5g.mjs +294 -0
  58. package/dist/oauth-DOJeGfcE.mjs +6392 -0
  59. package/dist/openai-BDtIh3Ja.mjs +6693 -0
  60. package/dist/openai-codex-responses-C5EORu31.mjs +664 -0
  61. package/dist/openai-completions-CR_cS6gX.mjs +669 -0
  62. package/dist/openai-responses-oGxwZyuC.mjs +184 -0
  63. package/dist/openai-responses-shared-BixMSDZE.mjs +398 -0
  64. package/dist/paths-D6msg0S1-C2lYuisN.mjs +189 -0
  65. package/dist/paths-D92DjaZ--CTOESW2b.mjs +192 -0
  66. package/dist/pi-model-discovery-Bd0TWzo8-BFsJmeMb.mjs +227 -0
  67. package/dist/pi-model-discovery-runtime-CCCZxkd8.mjs +2 -0
  68. package/dist/pi-tools.before-tool-call.runtime-Bn7uqKie-C5ewk8kK.mjs +399 -0
  69. package/dist/plugin-auto-enable-DdH3n9V8-DsA1isaF.mjs +1456 -0
  70. package/dist/process-scoped-map-B2cWkYET-CXwUZ8CZ.mjs +61 -0
  71. package/dist/provider-discovery.runtime-BPzz1PFj.mjs +58 -0
  72. package/dist/provider-model-compat-CFqcq0it-BDDuBI3A.mjs +118 -0
  73. package/dist/provider-runtime-C8rljsNs-CIT93zoy.mjs +2 -0
  74. package/dist/provider-runtime-CT50mNIX-BwEV6GyO.mjs +573 -0
  75. package/dist/provider-stream-COLujAAo-CbJPDngm.mjs +35449 -0
  76. package/dist/providers.runtime-Ba7tOlq7-CXkhkzU9.mjs +219 -0
  77. package/dist/public-surface-loader-BVl0NQAE-C0piXtsT.mjs +117 -0
  78. package/dist/resolve-C33B7eeu-BNvYTl6k.mjs +1041 -0
  79. package/dist/runtime-Cym-fqI8-DaSDMH-a.mjs +120 -0
  80. package/dist/runtime-channel-state-CohMybAh-hXR6y5Gx.mjs +19 -0
  81. package/dist/runtime-snapshot-C54O1-gI-40cbyi7P.mjs +677 -0
  82. package/dist/runtime-state-IBOIXKOx-Bf9tcLvc.mjs +10 -0
  83. package/dist/runtime-web-tools-fallback.runtime-Ca-qn1mj-BCVImm7a.mjs +39 -0
  84. package/dist/runtime-web-tools-manifest.runtime-BgxQTjmq-Cb4nJkRT.mjs +2 -0
  85. package/dist/runtime-web-tools-public-artifacts.runtime-D9qcoWIX-BrQdXzOQ.mjs +2 -0
  86. package/dist/session-archive.runtime-B52_5vs4-BG-_IwNJ.mjs +2 -0
  87. package/dist/session-key-Cn2QoOyX-CuHbJMgR.mjs +82 -0
  88. package/dist/session-transcript-files.fs-DEeFXruQ-B1PF6nLy.mjs +147 -0
  89. package/dist/src-BgCX0MLG.mjs +813 -0
  90. package/dist/src-DYbqlAqf.mjs +1177 -0
  91. package/dist/subagent-announce-L5WsQatW-CQWI9GMd.mjs +344 -0
  92. package/dist/subagent-announce.registry.runtime-DiqZyeTs-BKuniyi3.mjs +28 -0
  93. package/dist/subagent-registry-steer-runtime-DFgZFC0j-BhBz0roy.mjs +211 -0
  94. package/dist/subagent-system-prompt-C1qnN--K-DpnTFP47.mjs +3061 -0
  95. package/dist/target-parsing-loaded-DKkb6jJY-BMD4CkpS.mjs +1002 -0
  96. package/dist/task-registry-delivery-runtime-Dd1CUkZF-C8U40a3O.mjs +2950 -0
  97. package/dist/task-registry-delivery-runtime-ragbeVx5-CNbFAkjD.mjs +2 -0
  98. package/dist/thinking-Bh-7MqXz-D3woGbO7.mjs +2 -0
  99. package/dist/transcript-E_-ISOkD-DWCfZP2p.mjs +2019 -0
  100. package/dist/transcript.runtime-BqhvZZdl-BPy42vBP.mjs +2 -0
  101. package/dist/transform-messages-DbhIzTxq.mjs +207 -0
  102. package/dist/web-provider-public-artifacts-BlpRwIUS-CGPSV4W2.mjs +295 -0
  103. package/dist/web-search-providers.runtime--0aUtC3b-DyuhC95V.mjs +200 -0
  104. package/package.json +3 -3
  105. package/dist/rolldown-runtime-wcPFST8Q.mjs +0 -13
  106. /package/dist/{interactive-init-B6j8j_Ap.mjs → interactive-init-BXQBalNr.mjs} +0 -0
@@ -0,0 +1,219 @@
1
+ import { s as normalizeOptionalLowercaseString } from "./home-dir-C44RaPME-CBRS4HLP.mjs";
2
+ import { l as normalizeProviderId } from "./bundled-compat-BpaDaAAu-D7oazKjD.mjs";
3
+ import { o as loadPluginManifestRegistry } from "./manifest-registry-_hxKCS2K-CZdeyN0f.mjs";
4
+ import { a as getActivePluginRegistryWorkspaceDir } from "./runtime-Cym-fqI8-DaSDMH-a.mjs";
5
+ import { i as resolveRuntimePluginRegistry, n as loadOpenClawPlugins, t as isPluginRegistryLoadInFlight } from "./loader-708jrx4Y-BOswuvpe.mjs";
6
+ import { _ as hasExplicitPluginIdScope, a as resolveDiscoverableProviderOwnerPluginIds, d as resolveOwningPluginIdsForProvider, f as withBundledProviderVitestCompat, g as createPluginIdScopeSet, n as resolveActivatableProviderOwnerPluginIds, o as resolveDiscoveredProviderPluginIds, r as resolveBundledProviderCompatPluginIds, s as resolveEnabledProviderPluginIds, u as resolveOwningPluginIdsForModelRefs, v as normalizePluginIdScope } from "./plugin-auto-enable-DdH3n9V8-DsA1isaF.mjs";
7
+ import { r as withActivatedPluginIds, t as resolveBundledPluginCompatibleActivationInputs } from "./activation-context--5yu1dPF-Bwsn3moT.mjs";
8
+ import { n as createPluginRuntimeLoaderLogger, t as buildPluginRuntimeLoadOptionsFromValues } from "./load-context-mb7uvLSn-B10MAi3I.mjs";
9
+ //#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/activation-planner-BA-I8zhZ.js
10
+ function resolveManifestActivationPluginIds(params) {
11
+ const onlyPluginIdSet = createPluginIdScopeSet(normalizePluginIdScope(params.onlyPluginIds));
12
+ return [...new Set(loadPluginManifestRegistry({
13
+ config: params.config,
14
+ workspaceDir: params.workspaceDir,
15
+ env: params.env,
16
+ cache: params.cache
17
+ }).plugins.filter((plugin) => (!params.origin || plugin.origin === params.origin) && (!onlyPluginIdSet || onlyPluginIdSet.has(plugin.id)) && matchesManifestActivationTrigger(plugin, params.trigger)).map((plugin) => plugin.id))].toSorted((left, right) => left.localeCompare(right));
18
+ }
19
+ function matchesManifestActivationTrigger(plugin, trigger) {
20
+ switch (trigger.kind) {
21
+ case "command": return listActivationCommandIds(plugin).includes(normalizeCommandId(trigger.command));
22
+ case "provider": return listActivationProviderIds(plugin).includes(normalizeProviderId(trigger.provider));
23
+ case "agentHarness": return listActivationAgentHarnessIds(plugin).includes(normalizeCommandId(trigger.runtime));
24
+ case "channel": return listActivationChannelIds(plugin).includes(normalizeCommandId(trigger.channel));
25
+ case "route": return listActivationRouteIds(plugin).includes(normalizeCommandId(trigger.route));
26
+ case "capability": return hasActivationCapability(plugin, trigger.capability);
27
+ }
28
+ return trigger;
29
+ }
30
+ function listActivationAgentHarnessIds(plugin) {
31
+ return [...plugin.activation?.onAgentHarnesses ?? []].map(normalizeCommandId).filter(Boolean);
32
+ }
33
+ function listActivationCommandIds(plugin) {
34
+ return [...plugin.activation?.onCommands ?? [], ...(plugin.commandAliases ?? []).flatMap((alias) => alias.cliCommand ?? alias.name)].map(normalizeCommandId).filter(Boolean);
35
+ }
36
+ function listActivationProviderIds(plugin) {
37
+ return [
38
+ ...plugin.activation?.onProviders ?? [],
39
+ ...plugin.providers,
40
+ ...plugin.setup?.providers?.map((provider) => provider.id) ?? []
41
+ ].map((value) => normalizeProviderId(value)).filter(Boolean);
42
+ }
43
+ function listActivationChannelIds(plugin) {
44
+ return [...plugin.activation?.onChannels ?? [], ...plugin.channels].map(normalizeCommandId).filter(Boolean);
45
+ }
46
+ function listActivationRouteIds(plugin) {
47
+ return (plugin.activation?.onRoutes ?? []).map(normalizeCommandId).filter(Boolean);
48
+ }
49
+ function hasActivationCapability(plugin, capability) {
50
+ if (plugin.activation?.onCapabilities?.includes(capability)) return true;
51
+ switch (capability) {
52
+ case "provider": return listActivationProviderIds(plugin).length > 0;
53
+ case "channel": return listActivationChannelIds(plugin).length > 0;
54
+ case "tool": return (plugin.contracts?.tools?.length ?? 0) > 0;
55
+ case "hook": return plugin.hooks.length > 0;
56
+ }
57
+ return capability;
58
+ }
59
+ function normalizeCommandId(value) {
60
+ return normalizeOptionalLowercaseString(value) ?? "";
61
+ }
62
+ //#endregion
63
+ //#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/providers.runtime-Ba7tOlq7.js
64
+ function dedupeSortedPluginIds(values) {
65
+ return [...new Set(values)].toSorted((left, right) => left.localeCompare(right));
66
+ }
67
+ function resolveExplicitProviderOwnerPluginIds(params) {
68
+ return dedupeSortedPluginIds(params.providerRefs.flatMap((provider) => {
69
+ const plannedPluginIds = resolveManifestActivationPluginIds({
70
+ trigger: {
71
+ kind: "provider",
72
+ provider
73
+ },
74
+ config: params.config,
75
+ workspaceDir: params.workspaceDir,
76
+ env: params.env
77
+ });
78
+ if (plannedPluginIds.length > 0) return plannedPluginIds;
79
+ return resolveOwningPluginIdsForProvider({
80
+ provider,
81
+ config: params.config,
82
+ workspaceDir: params.workspaceDir,
83
+ env: params.env
84
+ }) ?? [];
85
+ }));
86
+ }
87
+ function mergeExplicitOwnerPluginIds(providerPluginIds, explicitOwnerPluginIds) {
88
+ if (explicitOwnerPluginIds.length === 0) return [...providerPluginIds];
89
+ return dedupeSortedPluginIds([...providerPluginIds, ...explicitOwnerPluginIds]);
90
+ }
91
+ function resolvePluginProviderLoadBase(params) {
92
+ const env = params.env ?? process.env;
93
+ const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDir();
94
+ const providerOwnedPluginIds = params.providerRefs?.length ? resolveExplicitProviderOwnerPluginIds({
95
+ providerRefs: params.providerRefs,
96
+ config: params.config,
97
+ workspaceDir,
98
+ env
99
+ }) : [];
100
+ const modelOwnedPluginIds = params.modelRefs?.length ? resolveOwningPluginIdsForModelRefs({
101
+ models: params.modelRefs,
102
+ config: params.config,
103
+ workspaceDir,
104
+ env
105
+ }) : [];
106
+ return {
107
+ env,
108
+ workspaceDir,
109
+ requestedPluginIds: hasExplicitPluginIdScope(params.onlyPluginIds) || params.providerRefs?.length || params.modelRefs?.length || providerOwnedPluginIds.length > 0 || modelOwnedPluginIds.length > 0 ? [...new Set([
110
+ ...params.onlyPluginIds ?? [],
111
+ ...providerOwnedPluginIds,
112
+ ...modelOwnedPluginIds
113
+ ])].toSorted((left, right) => left.localeCompare(right)) : void 0,
114
+ explicitOwnerPluginIds: dedupeSortedPluginIds([...providerOwnedPluginIds, ...modelOwnedPluginIds]),
115
+ rawConfig: params.config
116
+ };
117
+ }
118
+ function resolveSetupProviderPluginLoadState(params, base) {
119
+ const setupPluginIds = mergeExplicitOwnerPluginIds(resolveDiscoveredProviderPluginIds({
120
+ config: params.config,
121
+ workspaceDir: base.workspaceDir,
122
+ env: base.env,
123
+ onlyPluginIds: base.requestedPluginIds,
124
+ includeUntrustedWorkspacePlugins: params.includeUntrustedWorkspacePlugins
125
+ }), resolveDiscoverableProviderOwnerPluginIds({
126
+ pluginIds: base.explicitOwnerPluginIds,
127
+ config: params.config,
128
+ workspaceDir: base.workspaceDir,
129
+ env: base.env,
130
+ includeUntrustedWorkspacePlugins: params.includeUntrustedWorkspacePlugins
131
+ }));
132
+ if (setupPluginIds.length === 0) return;
133
+ const setupConfig = withActivatedPluginIds({
134
+ config: base.rawConfig,
135
+ pluginIds: setupPluginIds
136
+ });
137
+ return { loadOptions: buildPluginRuntimeLoadOptionsFromValues({
138
+ config: setupConfig,
139
+ activationSourceConfig: setupConfig,
140
+ autoEnabledReasons: {},
141
+ workspaceDir: base.workspaceDir,
142
+ env: base.env,
143
+ logger: createPluginRuntimeLoaderLogger()
144
+ }, {
145
+ onlyPluginIds: setupPluginIds,
146
+ pluginSdkResolution: params.pluginSdkResolution,
147
+ cache: params.cache ?? false,
148
+ activate: params.activate ?? false
149
+ }) };
150
+ }
151
+ function resolveRuntimeProviderPluginLoadState(params, base) {
152
+ const explicitOwnerPluginIds = resolveActivatableProviderOwnerPluginIds({
153
+ pluginIds: base.explicitOwnerPluginIds,
154
+ config: base.rawConfig,
155
+ workspaceDir: base.workspaceDir,
156
+ env: base.env,
157
+ includeUntrustedWorkspacePlugins: params.includeUntrustedWorkspacePlugins
158
+ });
159
+ const runtimeRequestedPluginIds = base.requestedPluginIds !== void 0 ? dedupeSortedPluginIds([...params.onlyPluginIds ?? [], ...explicitOwnerPluginIds]) : void 0;
160
+ const activation = resolveBundledPluginCompatibleActivationInputs({
161
+ rawConfig: withActivatedPluginIds({
162
+ config: base.rawConfig,
163
+ pluginIds: explicitOwnerPluginIds
164
+ }),
165
+ env: base.env,
166
+ workspaceDir: base.workspaceDir,
167
+ onlyPluginIds: runtimeRequestedPluginIds,
168
+ applyAutoEnable: true,
169
+ compatMode: {
170
+ allowlist: params.bundledProviderAllowlistCompat,
171
+ enablement: "allowlist",
172
+ vitest: params.bundledProviderVitestCompat
173
+ },
174
+ resolveCompatPluginIds: resolveBundledProviderCompatPluginIds
175
+ });
176
+ const config = params.bundledProviderVitestCompat ? withBundledProviderVitestCompat({
177
+ config: activation.config,
178
+ pluginIds: activation.compatPluginIds,
179
+ env: base.env
180
+ }) : activation.config;
181
+ const providerPluginIds = mergeExplicitOwnerPluginIds(resolveEnabledProviderPluginIds({
182
+ config,
183
+ workspaceDir: base.workspaceDir,
184
+ env: base.env,
185
+ onlyPluginIds: runtimeRequestedPluginIds
186
+ }), explicitOwnerPluginIds);
187
+ return { loadOptions: buildPluginRuntimeLoadOptionsFromValues({
188
+ config,
189
+ activationSourceConfig: activation.activationSourceConfig,
190
+ autoEnabledReasons: activation.autoEnabledReasons,
191
+ workspaceDir: base.workspaceDir,
192
+ env: base.env,
193
+ logger: createPluginRuntimeLoaderLogger()
194
+ }, {
195
+ onlyPluginIds: providerPluginIds,
196
+ pluginSdkResolution: params.pluginSdkResolution,
197
+ cache: params.cache ?? false,
198
+ activate: params.activate ?? false
199
+ }) };
200
+ }
201
+ function isPluginProvidersLoadInFlight(params) {
202
+ const base = resolvePluginProviderLoadBase(params);
203
+ const loadState = params.mode === "setup" ? resolveSetupProviderPluginLoadState(params, base) : resolveRuntimeProviderPluginLoadState(params, base);
204
+ if (!loadState) return false;
205
+ return isPluginRegistryLoadInFlight(loadState.loadOptions);
206
+ }
207
+ function resolvePluginProviders(params) {
208
+ const base = resolvePluginProviderLoadBase(params);
209
+ if (params.mode === "setup") {
210
+ const loadState = resolveSetupProviderPluginLoadState(params, base);
211
+ if (!loadState) return [];
212
+ return loadOpenClawPlugins(loadState.loadOptions).providers.map((entry) => Object.assign({}, entry.provider, { pluginId: entry.pluginId }));
213
+ }
214
+ const registry = resolveRuntimePluginRegistry(resolveRuntimeProviderPluginLoadState(params, base).loadOptions);
215
+ if (!registry) return [];
216
+ return registry.providers.map((entry) => Object.assign({}, entry.provider, { pluginId: entry.pluginId }));
217
+ }
218
+ //#endregion
219
+ export { resolvePluginProviders as n, isPluginProvidersLoadInFlight as t };
@@ -0,0 +1,117 @@
1
+ import { t as resolveBundledPluginsDir } from "./bundled-dir-U738ay4K-DXK0q_TV.mjs";
2
+ import { r as openBoundaryFileSync } from "./boundary-file-read-BSd9MXPy--KThL5e6.mjs";
3
+ import { c as resolveBundledPluginPublicSurfacePath, i as resolvePluginLoaderJitiTryNative, n as isBundledPluginExtensionPath, r as resolveLoaderPackageRoot, t as getCachedPluginJitiLoader } from "./jiti-loader-cache-Bat69wam-D6hCxboy.mjs";
4
+ import { createRequire } from "node:module";
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ //#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/public-surface-loader-BVl0NQAE.js
9
+ const OPENCLAW_PACKAGE_ROOT = resolveLoaderPackageRoot({
10
+ modulePath: fileURLToPath(import.meta.url),
11
+ moduleUrl: import.meta.url
12
+ }) ?? fileURLToPath(new URL("../..", import.meta.url));
13
+ const loadedPublicSurfaceModules = /* @__PURE__ */ new Map();
14
+ const sourceArtifactRequire = createRequire(import.meta.url);
15
+ const publicSurfaceLocations = /* @__PURE__ */ new Map();
16
+ const jitiLoaders = /* @__PURE__ */ new Map();
17
+ const sharedBundledPublicSurfaceJitiLoaders = /* @__PURE__ */ new Map();
18
+ function isSourceArtifactPath(modulePath) {
19
+ switch (path.extname(modulePath).toLowerCase()) {
20
+ case ".ts":
21
+ case ".tsx":
22
+ case ".mts":
23
+ case ".cts":
24
+ case ".mtsx":
25
+ case ".ctsx": return true;
26
+ default: return false;
27
+ }
28
+ }
29
+ function canUseSourceArtifactRequire(params) {
30
+ return !params.tryNative && isSourceArtifactPath(params.modulePath) && typeof sourceArtifactRequire.extensions?.[".ts"] === "function";
31
+ }
32
+ function createResolutionKey(params) {
33
+ const bundledPluginsDir = resolveBundledPluginsDir();
34
+ return `${params.dirName}::${params.artifactBasename}::${bundledPluginsDir ? path.resolve(bundledPluginsDir) : "<default>"}`;
35
+ }
36
+ function resolvePublicSurfaceLocationUncached(params) {
37
+ const bundledPluginsDir = resolveBundledPluginsDir();
38
+ const modulePath = resolveBundledPluginPublicSurfacePath({
39
+ rootDir: OPENCLAW_PACKAGE_ROOT,
40
+ ...bundledPluginsDir ? { bundledPluginsDir } : {},
41
+ dirName: params.dirName,
42
+ artifactBasename: params.artifactBasename
43
+ });
44
+ if (!modulePath) return null;
45
+ return {
46
+ modulePath,
47
+ boundaryRoot: bundledPluginsDir && modulePath.startsWith(path.resolve(bundledPluginsDir) + path.sep) ? path.resolve(bundledPluginsDir) : OPENCLAW_PACKAGE_ROOT
48
+ };
49
+ }
50
+ function resolvePublicSurfaceLocation(params) {
51
+ const key = createResolutionKey(params);
52
+ if (publicSurfaceLocations.has(key)) return publicSurfaceLocations.get(key) ?? null;
53
+ const resolved = resolvePublicSurfaceLocationUncached(params);
54
+ publicSurfaceLocations.set(key, resolved);
55
+ return resolved;
56
+ }
57
+ function getJiti(modulePath) {
58
+ const sharedLoader = getSharedBundledPublicSurfaceJiti(modulePath, resolvePluginLoaderJitiTryNative(modulePath, { preferBuiltDist: true }));
59
+ if (sharedLoader) return sharedLoader;
60
+ return getCachedPluginJitiLoader({
61
+ cache: jitiLoaders,
62
+ modulePath,
63
+ importerUrl: import.meta.url,
64
+ preferBuiltDist: true,
65
+ jitiFilename: import.meta.url
66
+ });
67
+ }
68
+ function loadPublicSurfaceModule(modulePath) {
69
+ if (canUseSourceArtifactRequire({
70
+ modulePath,
71
+ tryNative: resolvePluginLoaderJitiTryNative(modulePath, { preferBuiltDist: true })
72
+ })) return sourceArtifactRequire(modulePath);
73
+ return getJiti(modulePath)(modulePath);
74
+ }
75
+ function getSharedBundledPublicSurfaceJiti(modulePath, tryNative) {
76
+ const bundledPluginsDir = resolveBundledPluginsDir();
77
+ if (!isBundledPluginExtensionPath({
78
+ modulePath,
79
+ openClawPackageRoot: OPENCLAW_PACKAGE_ROOT,
80
+ ...bundledPluginsDir ? { bundledPluginsDir } : {}
81
+ })) return null;
82
+ const cacheKey = tryNative ? "bundled:native" : "bundled:source";
83
+ return getCachedPluginJitiLoader({
84
+ cache: sharedBundledPublicSurfaceJitiLoaders,
85
+ modulePath,
86
+ importerUrl: import.meta.url,
87
+ jitiFilename: import.meta.url,
88
+ cacheScopeKey: cacheKey,
89
+ tryNative
90
+ });
91
+ }
92
+ function loadBundledPluginPublicArtifactModuleSync(params) {
93
+ const location = resolvePublicSurfaceLocation(params);
94
+ if (!location) throw new Error(`Unable to resolve bundled plugin public surface ${params.dirName}/${params.artifactBasename}`);
95
+ const cached = loadedPublicSurfaceModules.get(location.modulePath);
96
+ if (cached) return cached;
97
+ const opened = openBoundaryFileSync({
98
+ absolutePath: location.modulePath,
99
+ rootPath: location.boundaryRoot,
100
+ boundaryLabel: location.boundaryRoot === OPENCLAW_PACKAGE_ROOT ? "OpenClaw package root" : "bundled plugin directory",
101
+ rejectHardlinks: false
102
+ });
103
+ if (!opened.ok) throw new Error(`Unable to open bundled plugin public surface ${params.dirName}/${params.artifactBasename}`, { cause: opened.error });
104
+ fs.closeSync(opened.fd);
105
+ const sentinel = {};
106
+ loadedPublicSurfaceModules.set(location.modulePath, sentinel);
107
+ try {
108
+ const loaded = loadPublicSurfaceModule(location.modulePath);
109
+ Object.assign(sentinel, loaded);
110
+ return sentinel;
111
+ } catch (error) {
112
+ loadedPublicSurfaceModules.delete(location.modulePath);
113
+ throw error;
114
+ }
115
+ }
116
+ //#endregion
117
+ export { loadBundledPluginPublicArtifactModuleSync as t };