@twsxtd/hapi-openclaw 0.1.3 → 0.1.5

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 (2) hide show
  1. package/dist/index.js +24 -2
  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,19 @@ function createPluginApp(deps) {
2282
2293
  }
2283
2294
 
2284
2295
  // src/index.ts
2296
+ function resolveRegisteredPluginConfig(api) {
2297
+ const runtimeConfigured = resolvePluginConfigFromOpenClawConfig(api.runtime?.config?.loadConfig?.());
2298
+ if (runtimeConfigured) {
2299
+ return runtimeConfigured;
2300
+ }
2301
+ const configured = resolvePluginConfigFromOpenClawConfig(api.config);
2302
+ if (configured) {
2303
+ return configured;
2304
+ }
2305
+ return resolvePluginConfig(api.pluginConfig ?? {});
2306
+ }
2285
2307
  function registerPluginRoutes(api) {
2286
- const config = resolvePluginConfig(api.pluginConfig ?? {});
2308
+ const config = resolveRegisteredPluginConfig(api);
2287
2309
  const callbackClient = new HapiCallbackClient(config.hapiBaseUrl, config.sharedSecret);
2288
2310
  const runtime = new RealOpenClawAdapter(config.namespace, api.runtime, callbackClient);
2289
2311
  const app = createPluginApp({
@@ -2326,7 +2348,7 @@ var src_default = definePluginEntry({
2326
2348
  }
2327
2349
  runtimeStore.setRuntime(api.runtime);
2328
2350
  registerPluginRoutes(api);
2329
- const config = resolvePluginConfig(api.pluginConfig ?? {});
2351
+ const config = resolveRegisteredPluginConfig(api);
2330
2352
  api.registerService(createTranscriptBridgeService(config));
2331
2353
  api.registerService(createTranscriptCaptureService(config));
2332
2354
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twsxtd/hapi-openclaw",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Native OpenClaw plugin that bridges HAPI to the OpenClaw Gateway route surface.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",