@twsxtd/hapi-openclaw 0.1.3 → 0.1.4
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/index.js +20 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -105,6 +105,17 @@ function resolvePluginConfig(value) {
|
|
|
105
105
|
prototypeCaptureFileName: readOptionalNonEmptyString(value.prototypeCaptureFileName) ?? "transcript-capture.jsonl"
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
+
function resolvePluginConfigFromOpenClawConfig(config) {
|
|
109
|
+
const pluginConfig = config?.plugins?.entries?.[OPENCLAW_PLUGIN_ID]?.config;
|
|
110
|
+
if (!pluginConfig) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
return resolvePluginConfig(pluginConfig);
|
|
115
|
+
} catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
108
119
|
|
|
109
120
|
// src/nativeRoute.ts
|
|
110
121
|
import { Readable } from "node:stream";
|
|
@@ -2282,8 +2293,15 @@ function createPluginApp(deps) {
|
|
|
2282
2293
|
}
|
|
2283
2294
|
|
|
2284
2295
|
// src/index.ts
|
|
2296
|
+
function resolveRegisteredPluginConfig(api) {
|
|
2297
|
+
const configured = resolvePluginConfigFromOpenClawConfig(api.config);
|
|
2298
|
+
if (configured) {
|
|
2299
|
+
return configured;
|
|
2300
|
+
}
|
|
2301
|
+
return resolvePluginConfig(api.pluginConfig ?? {});
|
|
2302
|
+
}
|
|
2285
2303
|
function registerPluginRoutes(api) {
|
|
2286
|
-
const config =
|
|
2304
|
+
const config = resolveRegisteredPluginConfig(api);
|
|
2287
2305
|
const callbackClient = new HapiCallbackClient(config.hapiBaseUrl, config.sharedSecret);
|
|
2288
2306
|
const runtime = new RealOpenClawAdapter(config.namespace, api.runtime, callbackClient);
|
|
2289
2307
|
const app = createPluginApp({
|
|
@@ -2326,7 +2344,7 @@ var src_default = definePluginEntry({
|
|
|
2326
2344
|
}
|
|
2327
2345
|
runtimeStore.setRuntime(api.runtime);
|
|
2328
2346
|
registerPluginRoutes(api);
|
|
2329
|
-
const config =
|
|
2347
|
+
const config = resolveRegisteredPluginConfig(api);
|
|
2330
2348
|
api.registerService(createTranscriptBridgeService(config));
|
|
2331
2349
|
api.registerService(createTranscriptCaptureService(config));
|
|
2332
2350
|
}
|