@karmaniverous/jeeves-meta 0.15.1 → 0.15.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.
@@ -15,9 +15,9 @@ import * as commander from 'commander';
15
15
  import { execSync } from 'node:child_process';
16
16
  import { homedir, tmpdir } from 'node:os';
17
17
  import { fileURLToPath } from 'node:url';
18
+ import Handlebars from 'handlebars';
18
19
  import { readFile, unlink, mkdir, writeFile, copyFile } from 'node:fs/promises';
19
20
  import pino from 'pino';
20
- import Handlebars from 'handlebars';
21
21
  import process$1 from 'node:process';
22
22
  import { Cron } from 'croner';
23
23
  import Fastify from 'fastify';
@@ -7064,6 +7064,7 @@ function init(options) {
7064
7064
  workspacePath: options.workspacePath,
7065
7065
  configRoot: options.configRoot,
7066
7066
  coreConfigDir: join(options.configRoot, CORE_CONFIG_DIR),
7067
+ componentConfigPaths: new Map(),
7067
7068
  };
7068
7069
  }
7069
7070
  /**
@@ -7238,6 +7239,11 @@ const workspaceCoreConfigSchema = z
7238
7239
  configRoot: z.string().optional().describe('Platform config root path'),
7239
7240
  /** OpenClaw gateway URL. */
7240
7241
  gatewayUrl: z.string().optional().describe('OpenClaw gateway URL'),
7242
+ /** Dev repo paths keyed by component name. */
7243
+ devRepos: z
7244
+ .record(z.string(), z.string())
7245
+ .optional()
7246
+ .describe('Dev repo paths by component name'),
7241
7247
  })
7242
7248
  .partial();
7243
7249
  /** Memory shared config section. */
@@ -7252,13 +7258,6 @@ const workspaceMemoryConfigSchema = z
7252
7258
  .max(1)
7253
7259
  .optional()
7254
7260
  .describe('Memory warning threshold'),
7255
- /** Staleness threshold in days. */
7256
- staleDays: z
7257
- .number()
7258
- .int()
7259
- .positive()
7260
- .optional()
7261
- .describe('Memory staleness threshold in days'),
7262
7261
  })
7263
7262
  .partial();
7264
7263
  /** Workspace config Zod schema. */
@@ -8166,16 +8165,115 @@ function createServiceCli(descriptor) {
8166
8165
  });
8167
8166
  // Apply custom CLI commands if provided
8168
8167
  if (descriptor.customCliCommands) {
8169
- // Cast required: @commander-js/extra-typings Command has generic type
8170
- // parameters that don't align with the descriptor's base Command type.
8171
- // The descriptor can't know the parent Command's exact generic parameters
8172
- // at definition time. The cast is safe — customCliCommands only adds
8173
- // subcommands and doesn't depend on the parent's generic state.
8174
8168
  descriptor.customCliCommands(program);
8175
8169
  }
8176
8170
  return program;
8177
8171
  }
8178
8172
 
8173
+ var toolsPlatformTemplate = `### Tool Hierarchy
8174
+
8175
+ When searching for information across indexed paths, **always use \`watcher_search\` before filesystem commands** (\`exec\`, \`grep\`, \`find\`). The semantic index covers the full indexed corpus and surfaces related files you may not have considered.
8176
+
8177
+ Use \`watcher_scan\` (no embeddings, no query string) for structural queries: file enumeration, staleness checks, domain listing, counts.
8178
+
8179
+ Direct filesystem access is for **acting on** search results, not bypassing them.
8180
+
8181
+ ### Shell Scripting
8182
+
8183
+ Default to \`node -e\` or \`.js\` scripts for \`exec\` calls. PowerShell corrupts multi-byte UTF-8 characters and mangles escaping. Use PowerShell only for Windows service management, registry operations, and similar platform-specific tasks.
8184
+
8185
+ ### File Bridge for External Repos
8186
+
8187
+ When editing files outside the workspace, use the bridge pattern: copy in → edit the workspace copy → bridge out. Never write temp patch scripts. The workspace is the authoritative working directory.
8188
+
8189
+ ### Gateway Self-Destruction Warning
8190
+
8191
+ ⚠️ Any command that stops the gateway **stops the assistant**. Never run \`openclaw gateway stop\` or \`openclaw gateway restart\` without explicit owner approval. When approved, it must be the **absolute last action** — all other work must be complete first, all messages sent, all files saved.
8192
+
8193
+ ### Messaging
8194
+
8195
+ **Same-channel replies:** Don't use the \`message\` tool. It fires immediately, jumping ahead of streaming narration. Just write text as your response.
8196
+
8197
+ **Cross-channel sends:** Use the \`message\` tool with an explicit \`target\` to send to a different channel or DM.
8198
+
8199
+ ### Plugin Lifecycle
8200
+
8201
+ \`\`\`bash
8202
+ # Platform bootstrap (content seeding)
8203
+ npx @karmaniverous/jeeves install
8204
+
8205
+ # Component plugin install
8206
+ npx @karmaniverous/jeeves-{component}-openclaw install
8207
+
8208
+ # Component plugin uninstall
8209
+ npx @karmaniverous/jeeves-{component}-openclaw uninstall
8210
+
8211
+ # Platform teardown (remove managed sections)
8212
+ npx @karmaniverous/jeeves uninstall
8213
+ \`\`\`
8214
+
8215
+ Never manually edit \`~/.openclaw/extensions/\`. Always use the CLI commands above.
8216
+
8217
+ ### Reference Templates
8218
+
8219
+ {{#if templatePath}}
8220
+ Reference templates are available at \`{{templatePath}}\`:
8221
+
8222
+ | Template | Purpose |
8223
+ |----------|---------|
8224
+ | \`spec.md\` | Skeleton for new product specifications — all section headers, decision format, dev plan format |
8225
+ | \`spec-to-code-guide.md\` | The spec-to-code development practice — 7-stage iterative process, convergence loops, release gates |
8226
+
8227
+ Read these templates when creating new specs, onboarding to new projects, or when asked about the development process.
8228
+ {{else}}
8229
+ > Reference templates not yet installed. Run \`npx @karmaniverous/jeeves install\` to seed templates.
8230
+ {{/if}}
8231
+
8232
+ ### Post-Upgrade Maintenance
8233
+
8234
+ After updating OpenClaw (\`npm install -g openclaw@latest\` or equivalent), reinstall all Jeeves component plugins to repair install state:
8235
+
8236
+ \`\`\`bash
8237
+ npx @karmaniverous/jeeves install
8238
+ npx @karmaniverous/jeeves-runner-openclaw install
8239
+ npx @karmaniverous/jeeves-watcher-openclaw install
8240
+ npx @karmaniverous/jeeves-server-openclaw install
8241
+ npx @karmaniverous/jeeves-meta-openclaw install
8242
+ \`\`\`
8243
+
8244
+ Then restart the gateway. Plugin installers copy dist files and patch config; reinstalling after an OpenClaw update ensures the extensions directory stays consistent.
8245
+
8246
+ ### Source Code Preference
8247
+
8248
+ {{#if devRepos}}
8249
+ When investigating, debugging, or analyzing Jeeves components, always read TypeScript source from dev repos — never compiled \`dist/\` from the global npm install. Dev repos:
8250
+
8251
+ | Component | Dev Repo |
8252
+ |-----------|----------|
8253
+ {{#each devRepos}}
8254
+ | {{@key}} | \`{{this}}\` |
8255
+ {{/each}}
8256
+
8257
+ Built code is minified, harder to reason about, and wastes context. Always \`git pull\` before analysis.
8258
+ {{else}}
8259
+ > Dev repo paths not configured. Add \`core.devRepos\` to \`jeeves.config.json\` to enable source code preference guidance.
8260
+ {{/if}}
8261
+ `;
8262
+
8263
+ /**
8264
+ * Internal function to maintain SOUL.md, AGENTS.md, and TOOLS.md Platform section.
8265
+ *
8266
+ * @remarks
8267
+ * Called by `ComponentWriter` on each cycle. Not directly exposed to components.
8268
+ * Reads content files from the package's `content/` directory, renders the
8269
+ * Platform template with live data, and writes managed sections using
8270
+ * `updateManagedSection`.
8271
+ */
8272
+ /** Compiled Handlebars template for the Platform section (cached at module level). */
8273
+ Handlebars.compile(toolsPlatformTemplate, {
8274
+ noEscape: true,
8275
+ });
8276
+
8179
8277
  /**
8180
8278
  * Core configuration schema and resolution.
8181
8279
  *
@@ -8272,10 +8370,10 @@ function getServiceUrl(serviceName, consumerName) {
8272
8370
  if (coreUrl)
8273
8371
  return coreUrl;
8274
8372
  // 3. Fall back to port constants
8275
- const port = DEFAULT_PORTS[serviceName];
8276
- {
8277
- return `http://127.0.0.1:${String(port)}`;
8373
+ if (serviceName in DEFAULT_PORTS) {
8374
+ return `http://127.0.0.1:${String(DEFAULT_PORTS[serviceName])}`;
8278
8375
  }
8376
+ throw new Error(`jeeves-core: unknown service "${serviceName}" and no config found`);
8279
8377
  }
8280
8378
 
8281
8379
  /**
@@ -9334,7 +9432,7 @@ class GatewayExecutor {
9334
9432
  'Write your complete output to a file using the Write tool at:\n' +
9335
9433
  outputPath +
9336
9434
  '\n\n' +
9337
- 'Reply with ONLY the file path you wrote to. No other text.';
9435
+ 'After writing the file, reply with ONLY: NO_REPLY';
9338
9436
  // Step 1: Spawn the sub-agent session (unique label per cycle to avoid
9339
9437
  // "label already in use" errors — gateway labels persist after session completion)
9340
9438
  const labelBase = options?.label ?? 'jeeves-meta-synthesis';
package/dist/index.js CHANGED
@@ -16,8 +16,8 @@ import { z } from 'zod';
16
16
  import * as commander from 'commander';
17
17
  import 'node:child_process';
18
18
  import { tmpdir } from 'node:os';
19
- import pino from 'pino';
20
19
  import Handlebars from 'handlebars';
20
+ import pino from 'pino';
21
21
  import { Cron } from 'croner';
22
22
  import Fastify from 'fastify';
23
23
 
@@ -7437,6 +7437,11 @@ const workspaceCoreConfigSchema = z
7437
7437
  configRoot: z.string().optional().describe('Platform config root path'),
7438
7438
  /** OpenClaw gateway URL. */
7439
7439
  gatewayUrl: z.string().optional().describe('OpenClaw gateway URL'),
7440
+ /** Dev repo paths keyed by component name. */
7441
+ devRepos: z
7442
+ .record(z.string(), z.string())
7443
+ .optional()
7444
+ .describe('Dev repo paths by component name'),
7440
7445
  })
7441
7446
  .partial();
7442
7447
  /** Memory shared config section. */
@@ -7451,13 +7456,6 @@ const workspaceMemoryConfigSchema = z
7451
7456
  .max(1)
7452
7457
  .optional()
7453
7458
  .describe('Memory warning threshold'),
7454
- /** Staleness threshold in days. */
7455
- staleDays: z
7456
- .number()
7457
- .int()
7458
- .positive()
7459
- .optional()
7460
- .describe('Memory staleness threshold in days'),
7461
7459
  })
7462
7460
  .partial();
7463
7461
  /** Workspace config Zod schema. */
@@ -7716,6 +7714,110 @@ async function postJson(url, body) {
7716
7714
  });
7717
7715
  }
7718
7716
 
7717
+ var toolsPlatformTemplate = `### Tool Hierarchy
7718
+
7719
+ When searching for information across indexed paths, **always use \`watcher_search\` before filesystem commands** (\`exec\`, \`grep\`, \`find\`). The semantic index covers the full indexed corpus and surfaces related files you may not have considered.
7720
+
7721
+ Use \`watcher_scan\` (no embeddings, no query string) for structural queries: file enumeration, staleness checks, domain listing, counts.
7722
+
7723
+ Direct filesystem access is for **acting on** search results, not bypassing them.
7724
+
7725
+ ### Shell Scripting
7726
+
7727
+ Default to \`node -e\` or \`.js\` scripts for \`exec\` calls. PowerShell corrupts multi-byte UTF-8 characters and mangles escaping. Use PowerShell only for Windows service management, registry operations, and similar platform-specific tasks.
7728
+
7729
+ ### File Bridge for External Repos
7730
+
7731
+ When editing files outside the workspace, use the bridge pattern: copy in → edit the workspace copy → bridge out. Never write temp patch scripts. The workspace is the authoritative working directory.
7732
+
7733
+ ### Gateway Self-Destruction Warning
7734
+
7735
+ ⚠️ Any command that stops the gateway **stops the assistant**. Never run \`openclaw gateway stop\` or \`openclaw gateway restart\` without explicit owner approval. When approved, it must be the **absolute last action** — all other work must be complete first, all messages sent, all files saved.
7736
+
7737
+ ### Messaging
7738
+
7739
+ **Same-channel replies:** Don't use the \`message\` tool. It fires immediately, jumping ahead of streaming narration. Just write text as your response.
7740
+
7741
+ **Cross-channel sends:** Use the \`message\` tool with an explicit \`target\` to send to a different channel or DM.
7742
+
7743
+ ### Plugin Lifecycle
7744
+
7745
+ \`\`\`bash
7746
+ # Platform bootstrap (content seeding)
7747
+ npx @karmaniverous/jeeves install
7748
+
7749
+ # Component plugin install
7750
+ npx @karmaniverous/jeeves-{component}-openclaw install
7751
+
7752
+ # Component plugin uninstall
7753
+ npx @karmaniverous/jeeves-{component}-openclaw uninstall
7754
+
7755
+ # Platform teardown (remove managed sections)
7756
+ npx @karmaniverous/jeeves uninstall
7757
+ \`\`\`
7758
+
7759
+ Never manually edit \`~/.openclaw/extensions/\`. Always use the CLI commands above.
7760
+
7761
+ ### Reference Templates
7762
+
7763
+ {{#if templatePath}}
7764
+ Reference templates are available at \`{{templatePath}}\`:
7765
+
7766
+ | Template | Purpose |
7767
+ |----------|---------|
7768
+ | \`spec.md\` | Skeleton for new product specifications — all section headers, decision format, dev plan format |
7769
+ | \`spec-to-code-guide.md\` | The spec-to-code development practice — 7-stage iterative process, convergence loops, release gates |
7770
+
7771
+ Read these templates when creating new specs, onboarding to new projects, or when asked about the development process.
7772
+ {{else}}
7773
+ > Reference templates not yet installed. Run \`npx @karmaniverous/jeeves install\` to seed templates.
7774
+ {{/if}}
7775
+
7776
+ ### Post-Upgrade Maintenance
7777
+
7778
+ After updating OpenClaw (\`npm install -g openclaw@latest\` or equivalent), reinstall all Jeeves component plugins to repair install state:
7779
+
7780
+ \`\`\`bash
7781
+ npx @karmaniverous/jeeves install
7782
+ npx @karmaniverous/jeeves-runner-openclaw install
7783
+ npx @karmaniverous/jeeves-watcher-openclaw install
7784
+ npx @karmaniverous/jeeves-server-openclaw install
7785
+ npx @karmaniverous/jeeves-meta-openclaw install
7786
+ \`\`\`
7787
+
7788
+ Then restart the gateway. Plugin installers copy dist files and patch config; reinstalling after an OpenClaw update ensures the extensions directory stays consistent.
7789
+
7790
+ ### Source Code Preference
7791
+
7792
+ {{#if devRepos}}
7793
+ When investigating, debugging, or analyzing Jeeves components, always read TypeScript source from dev repos — never compiled \`dist/\` from the global npm install. Dev repos:
7794
+
7795
+ | Component | Dev Repo |
7796
+ |-----------|----------|
7797
+ {{#each devRepos}}
7798
+ | {{@key}} | \`{{this}}\` |
7799
+ {{/each}}
7800
+
7801
+ Built code is minified, harder to reason about, and wastes context. Always \`git pull\` before analysis.
7802
+ {{else}}
7803
+ > Dev repo paths not configured. Add \`core.devRepos\` to \`jeeves.config.json\` to enable source code preference guidance.
7804
+ {{/if}}
7805
+ `;
7806
+
7807
+ /**
7808
+ * Internal function to maintain SOUL.md, AGENTS.md, and TOOLS.md Platform section.
7809
+ *
7810
+ * @remarks
7811
+ * Called by `ComponentWriter` on each cycle. Not directly exposed to components.
7812
+ * Reads content files from the package's `content/` directory, renders the
7813
+ * Platform template with live data, and writes managed sections using
7814
+ * `updateManagedSection`.
7815
+ */
7816
+ /** Compiled Handlebars template for the Platform section (cached at module level). */
7817
+ Handlebars.compile(toolsPlatformTemplate, {
7818
+ noEscape: true,
7819
+ });
7820
+
7719
7821
  /**
7720
7822
  * Core configuration schema and resolution.
7721
7823
  *
@@ -7812,10 +7914,10 @@ function getServiceUrl(serviceName, consumerName) {
7812
7914
  if (coreUrl)
7813
7915
  return coreUrl;
7814
7916
  // 3. Fall back to port constants
7815
- const port = DEFAULT_PORTS[serviceName];
7816
- {
7817
- return `http://127.0.0.1:${String(port)}`;
7917
+ if (serviceName in DEFAULT_PORTS) {
7918
+ return `http://127.0.0.1:${String(DEFAULT_PORTS[serviceName])}`;
7818
7919
  }
7920
+ throw new Error(`jeeves-core: unknown service "${serviceName}" and no config found`);
7819
7921
  }
7820
7922
 
7821
7923
  /**
@@ -9069,7 +9171,7 @@ class GatewayExecutor {
9069
9171
  'Write your complete output to a file using the Write tool at:\n' +
9070
9172
  outputPath +
9071
9173
  '\n\n' +
9072
- 'Reply with ONLY the file path you wrote to. No other text.';
9174
+ 'After writing the file, reply with ONLY: NO_REPLY';
9073
9175
  // Step 1: Spawn the sub-agent session (unique label per cycle to avoid
9074
9176
  // "label already in use" errors — gateway labels persist after session completion)
9075
9177
  const labelBase = options?.label ?? 'jeeves-meta-synthesis';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karmaniverous/jeeves-meta",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "author": "Jason Williscroft",
5
5
  "description": "Fastify HTTP service for the Jeeves Meta synthesis engine",
6
6
  "license": "BSD-3-Clause",
@@ -41,7 +41,7 @@
41
41
  "node": ">=22"
42
42
  },
43
43
  "dependencies": {
44
- "@karmaniverous/jeeves": "^0.5.7",
44
+ "@karmaniverous/jeeves": "^0.5.9",
45
45
  "commander": "^14",
46
46
  "croner": "^10",
47
47
  "fastify": "^5.8",