@parkgogogo/openclaw-reflection 0.1.4 → 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.
package/README.md CHANGED
@@ -112,7 +112,7 @@ Once the gateway restarts, Reflection will begin listening to `message_received`
112
112
  - Reflection now writes an independent write_guardian audit log to:
113
113
  - `<workspaceDir>/.openclaw-reflection/write-guardian.log.jsonl`
114
114
  - When `logLevel` is `debug`, Reflection also overwrites `logs/debug.json` with the latest raw `message_received` callback payload.
115
- - Register command: `/reflections`
115
+ - Register command: `reflections`
116
116
  - Returns the most recent 10 write_guardian behaviors (written/refused/failed/skipped), including decision, target file, and reason.
117
117
 
118
118
  ## What You Get
package/README.zh-CN.md CHANGED
@@ -107,7 +107,7 @@ Gateway 重启后,Reflection 就会开始监听 `message_received` 和 `before
107
107
  - Reflection 现在会给 write_guardian 单独写一份审计日志:
108
108
  - `<workspaceDir>/.openclaw-reflection/write-guardian.log.jsonl`
109
109
  - 当 `logLevel` 为 `debug` 时,Reflection 还会把最近一次 `message_received` callback 的原始 payload 覆盖写入 `logs/debug.json`。
110
- - 注册命令:`/reflections`
110
+ - 注册命令:`reflections`
111
111
  - 返回最近 10 条 write_guardian 行为(written/refused/failed/skipped),包含 decision、目标文件和原因。
112
112
 
113
113
  ## 你会得到什么
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parkgogogo/openclaw-reflection",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "OpenClaw plugin that enhances native Markdown memory with filtering, curation, and consolidation",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/index.ts CHANGED
@@ -52,8 +52,11 @@ export interface PluginAPI {
52
52
  options?: { priority?: number }
53
53
  ) => void;
54
54
  registerCommand?: (
55
- command: string,
56
- handler: (args?: string) => string | Promise<string>
55
+ command: {
56
+ name: string;
57
+ description: string;
58
+ handler: (args?: string) => { text: string } | Promise<{ text: string }>;
59
+ }
57
60
  ) => void;
58
61
  }
59
62
 
@@ -61,7 +64,7 @@ let bufferManager: SessionBufferManager | null = null;
61
64
  let gatewayLogger: PluginLogger | null = null;
62
65
  let fileLogger: FileLogger | null = null;
63
66
  let isRegistered = false;
64
- const REFLECTION_COMMAND = "/reflections";
67
+ const REFLECTION_COMMAND_NAME = "reflections";
65
68
 
66
69
  function formatWriteGuardianAudit(entries: WriteGuardianAuditEntry[]): string {
67
70
  if (entries.length === 0) {
@@ -92,22 +95,30 @@ function registerReflectionCommand(
92
95
  ): void {
93
96
  if (typeof api.registerCommand !== "function") {
94
97
  logger.info("PluginLifecycle", "registerCommand unavailable, skip command registration", {
95
- command: REFLECTION_COMMAND,
98
+ command: REFLECTION_COMMAND_NAME,
96
99
  });
97
100
  return;
98
101
  }
99
102
 
100
- api.registerCommand(REFLECTION_COMMAND, async () => {
101
- if (!auditLog) {
102
- return "write_guardian audit log unavailable: workspace is not configured.";
103
- }
103
+ api.registerCommand({
104
+ name: REFLECTION_COMMAND_NAME,
105
+ description: "Show recent write_guardian audit entries",
106
+ handler: async () => {
107
+ if (!auditLog) {
108
+ return {
109
+ text: "write_guardian audit log unavailable: workspace is not configured.",
110
+ };
111
+ }
104
112
 
105
- const entries = await auditLog.readRecent(10);
106
- return formatWriteGuardianAudit(entries);
113
+ const entries = await auditLog.readRecent(10);
114
+ return {
115
+ text: formatWriteGuardianAudit(entries),
116
+ };
117
+ },
107
118
  });
108
119
 
109
120
  logger.info("PluginLifecycle", "Registered plugin command", {
110
- command: REFLECTION_COMMAND,
121
+ command: REFLECTION_COMMAND_NAME,
111
122
  });
112
123
  }
113
124