@karmaniverous/jeeves-meta-openclaw 0.13.1 → 0.13.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
@@ -1,5 +1,5 @@
1
1
  import { resolvePluginSetting, resolveOptionalPluginSetting, fetchJson, postJson, ok, connectionFail, createPluginToolset, resolveWorkspacePath, init, loadWorkspaceConfig, WORKSPACE_CONFIG_DEFAULTS, createAsyncContentCache, jeevesComponentDescriptorSchema, getPackageVersion, createComponentWriter } from '@karmaniverous/jeeves';
2
- import { phaseNames, getEndpoint, META_COMPONENT } from '@karmaniverous/jeeves-meta-core';
2
+ import { phaseStatuses, phaseNames, getEndpoint, META_COMPONENT } from '@karmaniverous/jeeves-meta-core';
3
3
 
4
4
  /**
5
5
  * Shared constants for the jeeves-meta OpenClaw plugin.
@@ -35,6 +35,33 @@ function getConfigRoot(api) {
35
35
  *
36
36
  * @module promptInjection
37
37
  */
38
+ /** Phase statuses that require per-phase breakdown (everything except fresh). */
39
+ const nonFreshStatuses = phaseStatuses.filter((s) => s !== 'fresh');
40
+ /**
41
+ * Format a duration in seconds as a compound human-readable interval.
42
+ *
43
+ * Produces at most two units: `2d 3h`, `1h 35m`, `45m`, etc.
44
+ * Returns `'never synthesized'` for non-finite input.
45
+ *
46
+ * @param seconds - Duration in seconds.
47
+ * @returns Formatted interval string.
48
+ */
49
+ function formatAge(seconds) {
50
+ if (!isFinite(seconds))
51
+ return 'never synthesized';
52
+ const d = Math.floor(seconds / 86400);
53
+ const h = Math.floor((seconds % 86400) / 3600);
54
+ const m = Math.floor((seconds % 3600) / 60);
55
+ if (d > 0 && h > 0)
56
+ return `${d.toString()}d ${h.toString()}h`;
57
+ if (d > 0)
58
+ return `${d.toString()}d`;
59
+ if (h > 0 && m > 0)
60
+ return `${h.toString()}h ${m.toString()}m`;
61
+ if (h > 0)
62
+ return `${h.toString()}h`;
63
+ return `${Math.max(m, 1).toString()}m`;
64
+ }
38
65
  /**
39
66
  * Generate the Meta menu Markdown for TOOLS.md.
40
67
  *
@@ -56,15 +83,6 @@ async function generateMetaMenu(client) {
56
83
  ].join('\n');
57
84
  }
58
85
  const { summary } = metas;
59
- const formatAge = (seconds) => {
60
- if (!isFinite(seconds))
61
- return 'never synthesized';
62
- if (seconds < 3600)
63
- return Math.round(seconds / 60).toString() + 'm';
64
- if (seconds < 86400)
65
- return Math.round(seconds / 3600).toString() + 'h';
66
- return Math.round(seconds / 86400).toString() + 'd';
67
- };
68
86
  // Find stalest age
69
87
  let stalestAge = 0;
70
88
  for (const item of metas.metas) {
@@ -103,20 +121,19 @@ async function generateMetaMenu(client) {
103
121
  const phaseLines = [];
104
122
  const phaseSummary = status.health.phaseStateSummary;
105
123
  if (phaseSummary) {
106
- // Aggregate counts across all phases
107
- const totals = {};
124
+ // Fresh counts are aggregated; non-fresh show <count> <state> <phase>
125
+ let freshTotal = 0;
108
126
  for (const phase of phaseNames) {
109
- const counts = phaseSummary[phase];
110
- for (const [state, count] of Object.entries(counts)) {
111
- if (count > 0) {
112
- totals[state] = (totals[state] ?? 0) + count;
113
- }
114
- }
127
+ freshTotal += phaseSummary[phase].fresh;
115
128
  }
116
129
  const parts = [];
117
- for (const state of ['fresh', 'pending', 'running', 'stale', 'failed']) {
118
- if (totals[state]) {
119
- parts.push(totals[state].toString() + ' ' + state);
130
+ if (freshTotal > 0)
131
+ parts.push(freshTotal.toString() + ' fresh');
132
+ for (const phase of phaseNames) {
133
+ for (const state of nonFreshStatuses) {
134
+ const count = phaseSummary[phase][state];
135
+ if (count > 0)
136
+ parts.push(`${count.toString()} ${state} ${phase}`);
120
137
  }
121
138
  }
122
139
  if (parts.length > 0) {
@@ -443,7 +460,7 @@ function buildMetaSeedTool(client, baseUrl) {
443
460
  },
444
461
  crossRefs: {
445
462
  type: 'string',
446
- description: 'JSON array of cross-ref owner paths (e.g. \'["j:/path/a","j:/path/b"]\').',
463
+ description: 'JSON array of cross-ref owner paths (e.g. \'["<drive label>:/path/a","<drive label>:/path/b"]\'). Use server_drives to discover available drive labels.',
447
464
  },
448
465
  steer: {
449
466
  type: 'string',
@@ -202,8 +202,8 @@ Key settings:
202
202
  | `watcherUrl` | (required) | Watcher service URL (e.g. `http://localhost:1936`) |
203
203
  | `gatewayUrl` | `http://127.0.0.1:18789` | OpenClaw gateway URL for subprocess spawning |
204
204
  | `gatewayApiKey` | (optional) | API key for gateway authentication |
205
- | `metaProperty` | `{ _meta: "current" }` | Watcher metadata properties applied to live `.meta/meta.json` files. `Record<string, unknown>` — any shape accepted. |
206
- | `metaArchiveProperty` | `{ _meta: "archive" }` | Watcher metadata properties applied to `.meta/archive/**` snapshots. Same shape flexibility. |
205
+ | `metaProperty` | (required) | Watcher metadata properties applied to live `.meta/meta.json` files. `Record<string, unknown>` — any shape accepted. Avoid underscore-prefixed keys (e.g. `_meta`) — they may conflict with watcher reserved fields and break rendering. |
206
+ | `metaArchiveProperty` | (required) | Watcher metadata properties applied to `.meta/archive/**` snapshots. Same shape flexibility and underscore-prefix caveat as `metaProperty`. |
207
207
  | `architectEvery` | 10 | Re-run architect every N cycles even if structure unchanged |
208
208
  | `depthWeight` | 0.5 | Exponent for depth-based scheduling (0 = pure staleness) |
209
209
  | `maxArchive` | 20 | Max archived snapshots per meta |
@@ -214,9 +214,14 @@ Key settings:
214
214
 
215
215
  | `schedule` | `*/30 * * * *` | Cron expression for automatic synthesis scheduling |
216
216
  | `serverBaseUrl` | (optional) | Public base URL of the service (e.g. `http://myhost:1938`). When set, progress reports include clickable entity links. |
217
+ | `serverDriveRoots` | (optional) | Drive label to absolute path mapping for Linux path resolution in progress links (e.g. `{ "content": "/opt/jeeves/content" }`). |
217
218
  | `reportChannel` | (optional) | Gateway channel name (e.g. `slack`). Legacy: also used as target if `reportTarget` is unset. |
218
219
  | `reportTarget` | (optional) | Channel/user ID to send progress messages to |
219
220
  | `tier2ScanLimit` | 50 | Max all-fresh candidates to scan per tick in Tier 2 invalidation |
221
+ | `workspaceDir` | OS tmpdir + `/jeeves-meta` | Directory for sub-agent output staging files |
222
+ | `stagingRetries` | 10 | Max retries when staging file not yet visible after session completion (min 0) |
223
+ | `stagingRetryDelayMs` | 250 | Delay between staging file retry attempts in ms (min 0) |
224
+ | `previewDeltaFilesCap` | 50 | Max delta files included in `/preview` response; excess sets `deltaFilesTruncated: true` (min 1) |
220
225
  | `logging.level` | `info` | Log level (trace/debug/info/warn/error) |
221
226
  | `logging.file` | (optional) | Log file path |
222
227
 
@@ -271,24 +276,13 @@ properties.
271
276
 
272
277
  ### Prompt System
273
278
 
274
- The service ships with built-in default architect and critic prompts. Most
275
- installations need no prompt configuration at all.
276
-
277
- **Overriding defaults:** Set `defaultArchitect` and/or `defaultCritic` in the
278
- config to replace the built-in prompts. Supports `@file:` references resolved
279
- relative to the config file's directory:
280
-
281
- ```json
282
- {
283
- "defaultArchitect": "@file:jeeves-meta/prompts/architect.md",
284
- "defaultCritic": "@file:jeeves-meta/prompts/critic.md"
285
- }
286
- ```
279
+ The service ships with built-in default architect and critic prompts. Prompts
280
+ ship with the package and cannot be overridden via config.
287
281
 
288
282
  **Per-meta overrides:** Set `_architect` or `_critic` directly in a `meta.json`
289
283
  to override the defaults for that specific entity.
290
284
 
291
- **Template variables:** All prompts (default, config-overridden, and per-meta)
285
+ **Template variables:** All prompts (built-in and per-meta)
292
286
  are compiled as Handlebars templates at synthesis time with access to:
293
287
 
294
288
  - `{{config.maxLines}}`, `{{config.architectEvery}}`, etc.
@@ -302,19 +296,20 @@ prompt is compiled.
302
296
 
303
297
  ### Minimal Config Example
304
298
 
305
- A minimum viable config file requires only `watcherUrl`:
299
+ A minimum viable config file requires `watcherUrl`, `metaProperty`, and `metaArchiveProperty`:
306
300
 
307
301
  ```json
308
302
  {
309
303
  "watcherUrl": "http://localhost:1936",
310
304
  "gatewayUrl": "http://127.0.0.1:18789",
311
- "gatewayApiKey": "your-api-key"
305
+ "gatewayApiKey": "your-api-key",
306
+ "metaProperty": { "_meta": "current" },
307
+ "metaArchiveProperty": { "_meta": "archive" }
312
308
  }
313
309
  ```
314
310
 
315
311
  All other fields use sensible defaults (port 1938, schedule every 30 min,
316
- depth weight 0.5, built-in prompts, etc). Add `reportChannel`, `metaProperty`,
317
- `logging`, etc. as needed.
312
+ depth weight 0.5, built-in prompts, etc). Add `reportChannel`, `logging`, etc. as needed.
318
313
 
319
314
  ### Adding New Metas
320
315
 
@@ -410,8 +405,6 @@ restart-required fields:
410
405
  - `watcherUrl` — watcher service URL
411
406
  - `gatewayUrl` — OpenClaw gateway URL
412
407
  - `gatewayApiKey` — gateway authentication key
413
- - `defaultArchitect` — architect system prompt
414
- - `defaultCritic` — critic system prompt
415
408
 
416
409
  Edit the config file and save; the service detects changes via `fs.watchFile`.
417
410
  When a restart-required field changes, the service logs a warning but the
@@ -457,14 +450,11 @@ Before the synthesis engine can operate:
457
450
  - Verify: `curl http://localhost:6333/healthz`
458
451
 
459
452
  4. **Config file** must exist at the path specified by `JEEVES_META_CONFIG`
460
- - Must contain valid `watcherUrl`
461
- - `defaultArchitect` and `defaultCritic` are optional (built-in defaults
462
- ship with the package). Set them only to override the defaults.
463
-
464
- 5. **Prompt files** must exist only if using `@file:` references in config
465
- - Not needed if using the built-in defaults (most installations)
453
+ - Must contain valid `watcherUrl`, `metaProperty`, and `metaArchiveProperty`
454
+ - Built-in architect and critic prompts ship with the package; no prompt
455
+ configuration is required
466
456
 
467
- 6. **`.meta/` directories** must exist and be within paths the watcher indexes
457
+ 5. **`.meta/` directories** must exist and be within paths the watcher indexes
468
458
  - Seed new metas: `jeeves-meta seed <path>`
469
459
 
470
460
  ### Installation
@@ -696,12 +686,11 @@ not yet indexed new files
696
686
  - First-run quality is lower — the feedback loop needs 2-3 cycles to calibrate.
697
687
  - Changing `metaProperty` requires both a meta service restart AND a watcher reindex.
698
688
  The service restart re-registers virtual rules; the reindex retags existing points.
699
- - `defaultArchitect`/`defaultCritic` are optional built-in defaults ship with
700
- the package. The `@file:` prefix (when used) is resolved relative to the config
701
- file's directory, not the working directory.
702
- - All prompts are compiled as Handlebars templates. Avoid using `{{` in prompt
703
- overrides unless you intend template variable resolution. Escape with `\{{`
704
- for literal double-braces.
689
+ - Built-in architect and critic prompts ship with the package and cannot be
690
+ overridden via config.
691
+ - All prompts (built-in and per-meta `_architect`/`_critic`) are compiled as
692
+ Handlebars templates. Avoid using `{{` in prompt text unless you intend
693
+ template variable resolution. Escape with `\{{` for literal double-braces.
705
694
  - The synthesis queue is single-threaded with three layers: `current` (the
706
695
  running phase), `overrides` (explicitly triggered entries, highest priority),
707
696
  and `automatic` (scheduler-computed candidates). Override entries are
@@ -7,6 +7,16 @@
7
7
  * @module promptInjection
8
8
  */
9
9
  import type { MetaServiceClient } from './serviceClient.js';
10
+ /**
11
+ * Format a duration in seconds as a compound human-readable interval.
12
+ *
13
+ * Produces at most two units: `2d 3h`, `1h 35m`, `45m`, etc.
14
+ * Returns `'never synthesized'` for non-finite input.
15
+ *
16
+ * @param seconds - Duration in seconds.
17
+ * @returns Formatted interval string.
18
+ */
19
+ export declare function formatAge(seconds: number): string;
10
20
  /**
11
21
  * Generate the Meta menu Markdown for TOOLS.md.
12
22
  *
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * @module serviceClient
8
8
  */
9
- import { type DepHealth, type GatewayDepHealth, type MetaListSummary, type MetasItem, type MetasResponse, type ServiceState, type WatcherDepHealth } from '@karmaniverous/jeeves-meta-core';
10
- export type { DepHealth, GatewayDepHealth, MetaListSummary, MetasItem, MetasResponse, ServiceState, WatcherDepHealth, };
9
+ import { type DepHealth, type GatewayDepHealth, type MetaListSummary, type MetasItem, type MetasResponse, type NextPhaseCandidate, type PhaseStateSummary, type ServiceState, type WatcherDepHealth } from '@karmaniverous/jeeves-meta-core';
10
+ export type { DepHealth, GatewayDepHealth, MetaListSummary, MetasItem, MetasResponse, NextPhaseCandidate, PhaseStateSummary, ServiceState, WatcherDepHealth, };
11
11
  /**
12
12
  * Service status response from GET /status.
13
13
  *
@@ -31,6 +31,10 @@ export interface StatusResponse {
31
31
  watcher: WatcherDepHealth;
32
32
  gateway: GatewayDepHealth;
33
33
  };
34
+ /** Per-phase counts of each status, from the scheduler. */
35
+ phaseStateSummary?: PhaseStateSummary;
36
+ /** Next phase candidate from the scheduler. */
37
+ nextPhase?: NextPhaseCandidate | null;
34
38
  [key: string]: unknown;
35
39
  };
36
40
  }
@@ -2,7 +2,7 @@
2
2
  "id": "jeeves-meta-openclaw",
3
3
  "name": "Jeeves Meta",
4
4
  "description": "Knowledge synthesis tools — trigger synthesis, view status, manage entities.",
5
- "version": "0.13.1",
5
+ "version": "0.13.3",
6
6
  "skills": [
7
7
  "dist/skills/jeeves-meta"
8
8
  ],
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@karmaniverous/jeeves": "^0.5.12",
11
- "@karmaniverous/jeeves-meta-core": "^0.2.0"
11
+ "@karmaniverous/jeeves-meta-core": "^0.2.2"
12
12
  },
13
13
  "description": "OpenClaw plugin for jeeves-meta — synthesis tools and virtual rule registration",
14
14
  "devDependencies": {
@@ -112,5 +112,5 @@
112
112
  },
113
113
  "type": "module",
114
114
  "types": "dist/index.d.ts",
115
- "version": "0.13.1"
115
+ "version": "0.13.3"
116
116
  }