@openher/openclaw-plugin 1.0.1 → 1.0.2
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/index.ts +32 -10
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenHer Persona Engine — OpenClaw Extension
|
|
3
3
|
*
|
|
4
|
-
* Registers 2 tools + 1 hook
|
|
4
|
+
* Registers 2 tools + 1 hook:
|
|
5
5
|
* - openher_chat: Full 13-step persona engine conversation
|
|
6
6
|
* - openher_status: Query personality state (zero LLM cost)
|
|
7
7
|
* - before_prompt_build hook: Inject persona proxy mode + state
|
|
@@ -15,11 +15,29 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { Type } from "@sinclair/typebox";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
18
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
19
|
+
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
|
20
|
+
|
|
21
|
+
// ── Inline helpers (replacing SDK-internal functions) ──
|
|
22
|
+
|
|
23
|
+
function readStringParam(
|
|
24
|
+
params: Record<string, unknown>,
|
|
25
|
+
key: string,
|
|
26
|
+
opts?: { required?: boolean },
|
|
27
|
+
): string {
|
|
28
|
+
const val = params[key];
|
|
29
|
+
if (val === undefined || val === null || val === "") {
|
|
30
|
+
if (opts?.required) throw new Error(`Missing required parameter: ${key}`);
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
return String(val);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function jsonResult(data: unknown): { type: "json"; value: unknown } {
|
|
37
|
+
return { type: "json", value: data };
|
|
38
|
+
}
|
|
21
39
|
|
|
22
|
-
// ──
|
|
40
|
+
// ── Config ──
|
|
23
41
|
|
|
24
42
|
function resolveConfig(api: OpenClawPluginApi) {
|
|
25
43
|
return {
|
|
@@ -265,18 +283,20 @@ function registerPersonaHook(api: OpenClawPluginApi) {
|
|
|
265
283
|
|
|
266
284
|
// ── Plugin Entry ──
|
|
267
285
|
|
|
268
|
-
|
|
286
|
+
const plugin = {
|
|
269
287
|
id: "openher-persona-engine",
|
|
270
288
|
name: "OpenHer Persona Engine",
|
|
271
289
|
description:
|
|
272
290
|
"AI Being engine — personality computed from neural networks, " +
|
|
273
291
|
"drive metabolism, and Hebbian learning. Adds openher_chat and " +
|
|
274
292
|
"openher_status tools.",
|
|
275
|
-
|
|
293
|
+
configSchema: emptyPluginConfigSchema(),
|
|
294
|
+
|
|
295
|
+
register(api: OpenClawPluginApi) {
|
|
276
296
|
const { apiUrl, defaultPersona, mode } = resolveConfig(api);
|
|
277
297
|
|
|
278
|
-
api.registerTool(createChatTool(api) as
|
|
279
|
-
api.registerTool(createStatusTool(api) as
|
|
298
|
+
api.registerTool(createChatTool(api) as any);
|
|
299
|
+
api.registerTool(createStatusTool(api) as any);
|
|
280
300
|
registerPersonaHook(api);
|
|
281
301
|
|
|
282
302
|
// Non-blocking health check
|
|
@@ -287,4 +307,6 @@ export default definePluginEntry({
|
|
|
287
307
|
`API: ${apiUrl}, persona: ${defaultPersona}, mode: ${mode}`,
|
|
288
308
|
);
|
|
289
309
|
},
|
|
290
|
-
}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export default plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openher/openclaw-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "OpenHer Persona Engine plugin for OpenClaw — personality computed from neural networks, drive metabolism, and Hebbian learning",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|