@karmaniverous/jeeves 0.5.11 → 0.5.12
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/cli/jeeves/index.js +2 -2
- package/dist/cli/plugin/index.js +22 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.js +30 -14
- package/package.json +1 -1
package/dist/cli/jeeves/index.js
CHANGED
|
@@ -268,14 +268,14 @@ const PLATFORM_COMPONENTS = [
|
|
|
268
268
|
* Core library version, inlined at build time.
|
|
269
269
|
*
|
|
270
270
|
* @remarks
|
|
271
|
-
* The `0.5.
|
|
271
|
+
* The `0.5.11` placeholder is replaced by
|
|
272
272
|
* `@rollup/plugin-replace` during the build with the actual version
|
|
273
273
|
* from `package.json`. This ensures the correct version survives
|
|
274
274
|
* when consumers bundle core into their own dist (where runtime
|
|
275
275
|
* `import.meta.url`-based resolution would find the wrong package.json).
|
|
276
276
|
*/
|
|
277
277
|
/** The core library version from package.json (inlined at build time). */
|
|
278
|
-
const CORE_VERSION = '0.5.
|
|
278
|
+
const CORE_VERSION = '0.5.11';
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
281
|
* Runtime Node.js version floor check.
|
package/dist/cli/plugin/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
2
3
|
import { writeFileSync, renameSync, unlinkSync, existsSync, mkdirSync, readFileSync, readdirSync, copyFileSync, rmSync } from 'node:fs';
|
|
3
4
|
import { dirname, basename, join, resolve } from 'node:path';
|
|
4
5
|
import * as commander from 'commander';
|
|
5
6
|
import { randomUUID } from 'node:crypto';
|
|
6
7
|
import { lock } from 'proper-lockfile';
|
|
7
8
|
import 'semver';
|
|
8
|
-
import 'node:child_process';
|
|
9
9
|
import { homedir } from 'node:os';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
@@ -128,14 +128,14 @@ const COMPONENT_VERSIONS_FILE = 'component-versions.json';
|
|
|
128
128
|
* Core library version, inlined at build time.
|
|
129
129
|
*
|
|
130
130
|
* @remarks
|
|
131
|
-
* The `0.5.
|
|
131
|
+
* The `0.5.11` placeholder is replaced by
|
|
132
132
|
* `@rollup/plugin-replace` during the build with the actual version
|
|
133
133
|
* from `package.json`. This ensures the correct version survives
|
|
134
134
|
* when consumers bundle core into their own dist (where runtime
|
|
135
135
|
* `import.meta.url`-based resolution would find the wrong package.json).
|
|
136
136
|
*/
|
|
137
137
|
/** The core library version from package.json (inlined at build time). */
|
|
138
|
-
const CORE_VERSION = '0.5.
|
|
138
|
+
const CORE_VERSION = '0.5.11';
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* Shared file I/O helpers for managed section operations.
|
|
@@ -1709,9 +1709,8 @@ function createPluginCli(options) {
|
|
|
1709
1709
|
const configPath = resolveConfigPath(openClawHome);
|
|
1710
1710
|
// 1. Copy dist to extensions
|
|
1711
1711
|
const extensionsDir = join(openClawHome, 'extensions', pluginId);
|
|
1712
|
-
if (!existsSync(distDir))
|
|
1713
|
-
throw new Error(`Plugin dist directory not found: ${distDir}
|
|
1714
|
-
}
|
|
1712
|
+
if (!existsSync(distDir))
|
|
1713
|
+
throw new Error(`Plugin dist directory not found: ${distDir}`);
|
|
1715
1714
|
console.log(`Copying dist to ${extensionsDir}...`);
|
|
1716
1715
|
copyDistFiles(distDir, join(extensionsDir, 'dist'));
|
|
1717
1716
|
// Copy package.json and openclaw.plugin.json from package root
|
|
@@ -1722,6 +1721,20 @@ function createPluginCli(options) {
|
|
|
1722
1721
|
}
|
|
1723
1722
|
}
|
|
1724
1723
|
console.log(' ✓ Dist files copied');
|
|
1724
|
+
// 1b. Install production dependencies
|
|
1725
|
+
console.log('Installing dependencies...');
|
|
1726
|
+
try {
|
|
1727
|
+
execSync('npm install --omit=dev', {
|
|
1728
|
+
cwd: extensionsDir,
|
|
1729
|
+
stdio: 'pipe',
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
catch (err) {
|
|
1733
|
+
throw new Error(`npm install failed in ${extensionsDir}`, {
|
|
1734
|
+
cause: err,
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
console.log(' ✓ Dependencies installed');
|
|
1725
1738
|
// 2. Patch openclaw.json
|
|
1726
1739
|
console.log('Patching OpenClaw config...');
|
|
1727
1740
|
const config = readJsonFile(configPath);
|
|
@@ -1767,9 +1780,9 @@ function createPluginCli(options) {
|
|
|
1767
1780
|
// 4. Write initial HEARTBEAT entry and seed jeeves skill
|
|
1768
1781
|
try {
|
|
1769
1782
|
const cfgRoot = opts.configRoot;
|
|
1770
|
-
const
|
|
1771
|
-
const
|
|
1772
|
-
const ws = opts.workspace ??
|
|
1783
|
+
const ag = config.agents;
|
|
1784
|
+
const defs = ag?.defaults;
|
|
1785
|
+
const ws = opts.workspace ?? defs?.workspace;
|
|
1773
1786
|
if (ws) {
|
|
1774
1787
|
init({ workspacePath: ws, configRoot: cfgRoot });
|
|
1775
1788
|
const heartbeatPath = join(ws, WORKSPACE_FILES.heartbeat);
|
package/dist/index.d.ts
CHANGED
|
@@ -176,9 +176,11 @@ type ConfigApplyHandler = (request: ConfigApplyRequest) => Promise<ConfigApplyRe
|
|
|
176
176
|
* 5. Calls `descriptor.onConfigApply` with the merged config (if defined)
|
|
177
177
|
*
|
|
178
178
|
* @param descriptor - The component descriptor.
|
|
179
|
+
* @param configPath - Optional explicit config file path. When provided, takes
|
|
180
|
+
* precedence over registered and derived paths.
|
|
179
181
|
* @returns An async handler returning `{ status, body }`.
|
|
180
182
|
*/
|
|
181
|
-
declare function createConfigApplyHandler(descriptor: JeevesComponentDescriptor): ConfigApplyHandler;
|
|
183
|
+
declare function createConfigApplyHandler(descriptor: JeevesComponentDescriptor, configPath?: string): ConfigApplyHandler;
|
|
182
184
|
|
|
183
185
|
/**
|
|
184
186
|
* Generic config query handler with JSONPath support.
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { lock } from 'proper-lockfile';
|
|
|
5
5
|
import { JSONPath } from 'jsonpath-plus';
|
|
6
6
|
import { major, valid, gte, gt } from 'semver';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import * as commander from 'commander';
|
|
9
8
|
import cp, { execSync } from 'node:child_process';
|
|
9
|
+
import * as commander from 'commander';
|
|
10
10
|
import { homedir } from 'node:os';
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
12
12
|
import { packageDirectorySync } from 'package-directory';
|
|
@@ -184,14 +184,14 @@ const PLATFORM_COMPONENTS = [
|
|
|
184
184
|
* Core library version, inlined at build time.
|
|
185
185
|
*
|
|
186
186
|
* @remarks
|
|
187
|
-
* The `0.5.
|
|
187
|
+
* The `0.5.11` placeholder is replaced by
|
|
188
188
|
* `@rollup/plugin-replace` during the build with the actual version
|
|
189
189
|
* from `package.json`. This ensures the correct version survives
|
|
190
190
|
* when consumers bundle core into their own dist (where runtime
|
|
191
191
|
* `import.meta.url`-based resolution would find the wrong package.json).
|
|
192
192
|
*/
|
|
193
193
|
/** The core library version from package.json (inlined at build time). */
|
|
194
|
-
const CORE_VERSION = '0.5.
|
|
194
|
+
const CORE_VERSION = '0.5.11';
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
197
|
* Workspace and config root initialization.
|
|
@@ -551,16 +551,19 @@ function readConfigFile(filePath) {
|
|
|
551
551
|
* 5. Calls `descriptor.onConfigApply` with the merged config (if defined)
|
|
552
552
|
*
|
|
553
553
|
* @param descriptor - The component descriptor.
|
|
554
|
+
* @param configPath - Optional explicit config file path. When provided, takes
|
|
555
|
+
* precedence over registered and derived paths.
|
|
554
556
|
* @returns An async handler returning `{ status, body }`.
|
|
555
557
|
*/
|
|
556
|
-
function createConfigApplyHandler(descriptor) {
|
|
558
|
+
function createConfigApplyHandler(descriptor, configPath) {
|
|
557
559
|
return async (request) => {
|
|
558
560
|
const { patch, replace } = request;
|
|
559
|
-
//
|
|
560
|
-
const
|
|
561
|
+
// Prefer explicit > registered > derived config path
|
|
562
|
+
const resolvedConfigPath = configPath ??
|
|
563
|
+
getComponentConfigPath(descriptor.name) ??
|
|
561
564
|
join(getComponentConfigDir(descriptor.name), descriptor.configFileName);
|
|
562
565
|
// Read existing config
|
|
563
|
-
const existing = readConfigFile(
|
|
566
|
+
const existing = readConfigFile(resolvedConfigPath);
|
|
564
567
|
// Merge or replace
|
|
565
568
|
const mergeFn = descriptor.customMerge ?? deepMerge;
|
|
566
569
|
const merged = replace ? { ...patch } : mergeFn(existing, patch);
|
|
@@ -581,7 +584,7 @@ function createConfigApplyHandler(descriptor) {
|
|
|
581
584
|
// Write atomically
|
|
582
585
|
try {
|
|
583
586
|
const json = JSON.stringify(validatedConfig, null, 2) + '\n';
|
|
584
|
-
atomicWrite(
|
|
587
|
+
atomicWrite(resolvedConfigPath, json);
|
|
585
588
|
}
|
|
586
589
|
catch (err) {
|
|
587
590
|
return {
|
|
@@ -3283,9 +3286,8 @@ function createPluginCli(options) {
|
|
|
3283
3286
|
const configPath = resolveConfigPath(openClawHome);
|
|
3284
3287
|
// 1. Copy dist to extensions
|
|
3285
3288
|
const extensionsDir = join(openClawHome, 'extensions', pluginId);
|
|
3286
|
-
if (!existsSync(distDir))
|
|
3287
|
-
throw new Error(`Plugin dist directory not found: ${distDir}
|
|
3288
|
-
}
|
|
3289
|
+
if (!existsSync(distDir))
|
|
3290
|
+
throw new Error(`Plugin dist directory not found: ${distDir}`);
|
|
3289
3291
|
console.log(`Copying dist to ${extensionsDir}...`);
|
|
3290
3292
|
copyDistFiles(distDir, join(extensionsDir, 'dist'));
|
|
3291
3293
|
// Copy package.json and openclaw.plugin.json from package root
|
|
@@ -3296,6 +3298,20 @@ function createPluginCli(options) {
|
|
|
3296
3298
|
}
|
|
3297
3299
|
}
|
|
3298
3300
|
console.log(' ✓ Dist files copied');
|
|
3301
|
+
// 1b. Install production dependencies
|
|
3302
|
+
console.log('Installing dependencies...');
|
|
3303
|
+
try {
|
|
3304
|
+
execSync('npm install --omit=dev', {
|
|
3305
|
+
cwd: extensionsDir,
|
|
3306
|
+
stdio: 'pipe',
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
catch (err) {
|
|
3310
|
+
throw new Error(`npm install failed in ${extensionsDir}`, {
|
|
3311
|
+
cause: err,
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
console.log(' ✓ Dependencies installed');
|
|
3299
3315
|
// 2. Patch openclaw.json
|
|
3300
3316
|
console.log('Patching OpenClaw config...');
|
|
3301
3317
|
const config = readJsonFile(configPath);
|
|
@@ -3341,9 +3357,9 @@ function createPluginCli(options) {
|
|
|
3341
3357
|
// 4. Write initial HEARTBEAT entry and seed jeeves skill
|
|
3342
3358
|
try {
|
|
3343
3359
|
const cfgRoot = opts.configRoot;
|
|
3344
|
-
const
|
|
3345
|
-
const
|
|
3346
|
-
const ws = opts.workspace ??
|
|
3360
|
+
const ag = config.agents;
|
|
3361
|
+
const defs = ag?.defaults;
|
|
3362
|
+
const ws = opts.workspace ?? defs?.workspace;
|
|
3347
3363
|
if (ws) {
|
|
3348
3364
|
init({ workspacePath: ws, configRoot: cfgRoot });
|
|
3349
3365
|
const heartbeatPath = join(ws, WORKSPACE_FILES.heartbeat);
|
package/package.json
CHANGED