@karmaniverous/jeeves-watcher-openclaw 0.5.2 → 0.5.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 CHANGED
@@ -195,7 +195,10 @@ function ensurePlatformToolsSection(toolsMd) {
195
195
  function upsertWatcherSection(toolsMd, watcherMenu) {
196
196
  const section = `## Watcher\n\n${watcherMenu}\n`;
197
197
  // If we already injected a Watcher section, replace it.
198
- const re = /^## Watcher\n[\s\S]*?(?=^##\s|$)/m;
198
+ // The `m` flag is needed so `^` matches line starts, but it also makes
199
+ // `$` match end-of-line instead of end-of-string. Use a negative
200
+ // lookahead `$(?![\s\S])` to anchor at true end-of-string.
201
+ const re = /^## Watcher\n[\s\S]*?(?=\n## |\n# |$(?![\s\S]))/m;
199
202
  if (re.test(toolsMd)) {
200
203
  return toolsMd.replace(re, section);
201
204
  }
@@ -226,6 +229,13 @@ async function handleAgentBootstrap(event, api) {
226
229
  context.bootstrapFiles.push(toolsFile);
227
230
  }
228
231
  const current = toolsFile.content ?? '';
232
+ // Guard: the bootstrap hook fires on every message turn because OpenClaw
233
+ // caches bootstrapFiles per session and returns the same mutable objects.
234
+ // If we already injected the watcher menu into this content, skip to
235
+ // avoid accumulating duplicate sections.
236
+ if (current.includes('## Watcher') && current.includes(watcherMenu)) {
237
+ return;
238
+ }
229
239
  const withH1 = ensurePlatformToolsSection(current);
230
240
  const updated = upsertWatcherSection(withH1, watcherMenu);
231
241
  toolsFile.content = updated;
@@ -422,7 +432,7 @@ function register(api) {
422
432
  if (typeof registerHook === 'function') {
423
433
  registerHook('agent:bootstrap', async (event) => {
424
434
  await handleAgentBootstrap(event, api);
425
- });
435
+ }, { name: 'jeeves-watcher-openclaw' });
426
436
  }
427
437
  }
428
438
 
@@ -23,7 +23,11 @@ export interface PluginApi {
23
23
  * Optional internal hook registration (available on newer OpenClaw builds).
24
24
  * We keep this optional to preserve compatibility.
25
25
  */
26
- registerHook?: (event: string | string[], handler: (event: unknown) => Promise<void> | void) => void;
26
+ registerHook?: (event: string | string[], handler: (event: unknown) => Promise<void> | void, opts?: {
27
+ name?: string;
28
+ description?: string;
29
+ register?: boolean;
30
+ }) => void;
27
31
  }
28
32
  /** Result shape returned by each tool execution. */
29
33
  export interface ToolResult {
@@ -2,7 +2,7 @@
2
2
  "id": "jeeves-watcher-openclaw",
3
3
  "name": "Jeeves Watcher",
4
4
  "description": "Semantic search, metadata enrichment, and instance administration for a jeeves-watcher deployment.",
5
- "version": "0.5.2",
5
+ "version": "0.5.4",
6
6
  "skills": [
7
7
  "dist/skills/jeeves-watcher"
8
8
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karmaniverous/jeeves-watcher-openclaw",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "author": "Jason Williscroft",
5
5
  "description": "OpenClaw plugin for jeeves-watcher — semantic search and metadata enrichment tools",
6
6
  "license": "BSD-3-Clause",