@twsxtd/hapi-openclaw 0.1.2 → 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 -3
- package/openclaw.plugin.json +0 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -72,7 +72,6 @@ var OPENCLAW_PLUGIN_VERSION = "0.1.0";
|
|
|
72
72
|
var PLUGIN_CONFIG_JSON_SCHEMA = {
|
|
73
73
|
type: "object",
|
|
74
74
|
additionalProperties: false,
|
|
75
|
-
required: ["hapiBaseUrl", "sharedSecret"],
|
|
76
75
|
properties: {
|
|
77
76
|
hapiBaseUrl: { type: "string", minLength: 1 },
|
|
78
77
|
sharedSecret: { type: "string", minLength: 1 },
|
|
@@ -106,6 +105,17 @@ function resolvePluginConfig(value) {
|
|
|
106
105
|
prototypeCaptureFileName: readOptionalNonEmptyString(value.prototypeCaptureFileName) ?? "transcript-capture.jsonl"
|
|
107
106
|
};
|
|
108
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
|
+
}
|
|
109
119
|
|
|
110
120
|
// src/nativeRoute.ts
|
|
111
121
|
import { Readable } from "node:stream";
|
|
@@ -2283,8 +2293,15 @@ function createPluginApp(deps) {
|
|
|
2283
2293
|
}
|
|
2284
2294
|
|
|
2285
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
|
+
}
|
|
2286
2303
|
function registerPluginRoutes(api) {
|
|
2287
|
-
const config =
|
|
2304
|
+
const config = resolveRegisteredPluginConfig(api);
|
|
2288
2305
|
const callbackClient = new HapiCallbackClient(config.hapiBaseUrl, config.sharedSecret);
|
|
2289
2306
|
const runtime = new RealOpenClawAdapter(config.namespace, api.runtime, callbackClient);
|
|
2290
2307
|
const app = createPluginApp({
|
|
@@ -2327,7 +2344,7 @@ var src_default = definePluginEntry({
|
|
|
2327
2344
|
}
|
|
2328
2345
|
runtimeStore.setRuntime(api.runtime);
|
|
2329
2346
|
registerPluginRoutes(api);
|
|
2330
|
-
const config =
|
|
2347
|
+
const config = resolveRegisteredPluginConfig(api);
|
|
2331
2348
|
api.registerService(createTranscriptBridgeService(config));
|
|
2332
2349
|
api.registerService(createTranscriptCaptureService(config));
|
|
2333
2350
|
}
|
package/openclaw.plugin.json
CHANGED