@twsxtd/hapi-openclaw 0.1.1 → 0.1.3

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 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,17 +105,6 @@ function resolvePluginConfig(value) {
106
105
  prototypeCaptureFileName: readOptionalNonEmptyString(value.prototypeCaptureFileName) ?? "transcript-capture.jsonl"
107
106
  };
108
107
  }
109
- function resolvePluginConfigFromOpenClawConfig(config) {
110
- const pluginConfig = config.plugins?.entries?.[OPENCLAW_PLUGIN_ID]?.config;
111
- if (!pluginConfig) {
112
- return null;
113
- }
114
- try {
115
- return resolvePluginConfig(pluginConfig);
116
- } catch {
117
- return null;
118
- }
119
- }
120
108
 
121
109
  // src/nativeRoute.ts
122
110
  import { Readable } from "node:stream";
@@ -537,16 +525,11 @@ async function handleTranscriptUpdate(ctx, callbackClient, update) {
537
525
  });
538
526
  }
539
527
  }
540
- function createTranscriptBridgeService() {
528
+ function createTranscriptBridgeService(config) {
541
529
  let stopListening = null;
542
530
  return {
543
531
  id: `${OPENCLAW_PLUGIN_ID}:transcript-bridge`,
544
532
  async start(ctx) {
545
- const config = resolvePluginConfigFromOpenClawConfig(ctx.config);
546
- if (!config) {
547
- ctx.logger.warn(`Skipping ${OPENCLAW_PLUGIN_ID} transcript bridge because plugin config is unavailable`);
548
- return;
549
- }
550
533
  const callbackClient = new HapiCallbackClient(config.hapiBaseUrl, config.sharedSecret);
551
534
  const runtime = runtimeStore.getRuntime();
552
535
  stopListening = runtime.events.onSessionTranscriptUpdate((update) => {
@@ -569,7 +552,7 @@ import { appendFile, mkdir } from "node:fs/promises";
569
552
  import { join } from "node:path";
570
553
  var CAPTURE_DIRECTORY = "hapi-openclaw";
571
554
  function resolveCaptureFilePath(ctx, config) {
572
- const fileName = config?.prototypeCaptureFileName ?? "transcript-capture.jsonl";
555
+ const fileName = config.prototypeCaptureFileName;
573
556
  return join(ctx.stateDir, CAPTURE_DIRECTORY, fileName);
574
557
  }
575
558
  async function writeCaptureRecord(ctx, config, record) {
@@ -579,18 +562,17 @@ async function writeCaptureRecord(ctx, config, record) {
579
562
  `, "utf8");
580
563
  }
581
564
  function shouldCapture(config, sessionKey) {
582
- if (!config?.prototypeCaptureSessionKey) {
565
+ if (!config.prototypeCaptureSessionKey) {
583
566
  return false;
584
567
  }
585
568
  return sessionKey === config.prototypeCaptureSessionKey;
586
569
  }
587
- function createTranscriptCaptureService() {
570
+ function createTranscriptCaptureService(config) {
588
571
  let stopListening = null;
589
572
  return {
590
573
  id: `${OPENCLAW_PLUGIN_ID}:transcript-capture`,
591
574
  async start(ctx) {
592
575
  const runtime = runtimeStore.getRuntime();
593
- const config = resolvePluginConfigFromOpenClawConfig(ctx.config);
594
576
  stopListening = runtime.events.onSessionTranscriptUpdate((update) => {
595
577
  if (!shouldCapture(config, update.sessionKey)) {
596
578
  return;
@@ -2344,8 +2326,9 @@ var src_default = definePluginEntry({
2344
2326
  }
2345
2327
  runtimeStore.setRuntime(api.runtime);
2346
2328
  registerPluginRoutes(api);
2347
- api.registerService(createTranscriptBridgeService());
2348
- api.registerService(createTranscriptCaptureService());
2329
+ const config = resolvePluginConfig(api.pluginConfig ?? {});
2330
+ api.registerService(createTranscriptBridgeService(config));
2331
+ api.registerService(createTranscriptCaptureService(config));
2349
2332
  }
2350
2333
  });
2351
2334
  export {
@@ -30,10 +30,6 @@
30
30
  "configSchema": {
31
31
  "type": "object",
32
32
  "additionalProperties": false,
33
- "required": [
34
- "hapiBaseUrl",
35
- "sharedSecret"
36
- ],
37
33
  "properties": {
38
34
  "hapiBaseUrl": {
39
35
  "type": "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twsxtd/hapi-openclaw",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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",