@karmaniverous/jeeves 0.6.0-3 → 0.6.0-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/dist/cli/jeeves/index.js +2 -2
- package/dist/index.d.ts +32 -3
- package/dist/index.js +54 -5
- package/package.json +1 -1
package/dist/cli/jeeves/index.js
CHANGED
|
@@ -140,14 +140,14 @@ const DEFAULT_PORTS = {
|
|
|
140
140
|
* Core library version, inlined at build time.
|
|
141
141
|
*
|
|
142
142
|
* @remarks
|
|
143
|
-
* The `0.6.0-
|
|
143
|
+
* The `0.6.0-4` placeholder is replaced by
|
|
144
144
|
* `@rollup/plugin-replace` during the build with the actual version
|
|
145
145
|
* from `package.json`. This ensures the correct version survives
|
|
146
146
|
* when consumers bundle core into their own dist (where runtime
|
|
147
147
|
* `import.meta.url`-based resolution would find the wrong package.json).
|
|
148
148
|
*/
|
|
149
149
|
/** The core library version from package.json (inlined at build time). */
|
|
150
|
-
const CORE_VERSION = '0.6.0-
|
|
150
|
+
const CORE_VERSION = '0.6.0-4';
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Shared internal utility functions.
|
package/dist/index.d.ts
CHANGED
|
@@ -1132,6 +1132,27 @@ declare function recordRegisteredHooks(register: (api: PluginApi) => unknown, ap
|
|
|
1132
1132
|
*/
|
|
1133
1133
|
declare function validateConversationHooks(packageJson: unknown, registeredHooks: readonly string[]): string[];
|
|
1134
1134
|
|
|
1135
|
+
/**
|
|
1136
|
+
* Service base URL resolution for plugin tools.
|
|
1137
|
+
*
|
|
1138
|
+
* @remarks
|
|
1139
|
+
* Plugin tools must call the service at the plugin's configured `apiUrl`
|
|
1140
|
+
* (`plugins.entries.<id>.config.apiUrl`). The descriptor's `defaultPort`
|
|
1141
|
+
* is only the fallback when no `apiUrl` is set.
|
|
1142
|
+
*/
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Lazy `apiUrl` resolver, evaluated on every tool call (so a plugin can
|
|
1146
|
+
* read its config at call time, like `configRoot`).
|
|
1147
|
+
*/
|
|
1148
|
+
type PluginApiUrlResolver = () => string | undefined;
|
|
1149
|
+
/** Options for {@link createPluginToolset}. */
|
|
1150
|
+
declare const pluginToolsetOptionsSchema: z.ZodObject<{
|
|
1151
|
+
apiUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<PluginApiUrlResolver, PluginApiUrlResolver>]>>;
|
|
1152
|
+
}, z.core.$strip>;
|
|
1153
|
+
/** Options for {@link createPluginToolset}. */
|
|
1154
|
+
type PluginToolsetOptions = z.infer<typeof pluginToolsetOptionsSchema>;
|
|
1155
|
+
|
|
1135
1156
|
/**
|
|
1136
1157
|
* Factory for the standard plugin tool set.
|
|
1137
1158
|
*
|
|
@@ -1142,6 +1163,10 @@ declare function validateConversationHooks(packageJson: unknown, registeredHooks
|
|
|
1142
1163
|
* - `{name}_config_apply` - Push config patch to running service
|
|
1143
1164
|
* - `{name}_service` - Service lifecycle management
|
|
1144
1165
|
*
|
|
1166
|
+
* The HTTP tools call the plugin's configured `apiUrl` (see
|
|
1167
|
+
* {@link PluginToolsetOptions}); the descriptor's `defaultPort` is only the
|
|
1168
|
+
* fallback when `apiUrl` is unset.
|
|
1169
|
+
*
|
|
1145
1170
|
* Components add domain-specific tools separately.
|
|
1146
1171
|
*/
|
|
1147
1172
|
|
|
@@ -1149,9 +1174,13 @@ declare function validateConversationHooks(packageJson: unknown, registeredHooks
|
|
|
1149
1174
|
* Create the standard plugin tool set from a component descriptor.
|
|
1150
1175
|
*
|
|
1151
1176
|
* @param descriptor - The component descriptor.
|
|
1177
|
+
* @param options - Tool options (required, so each plugin consciously
|
|
1178
|
+
* chooses its service URL). Pass the plugin's `apiUrl` (string or lazy
|
|
1179
|
+
* resolver); with `apiUrl` unset, the tools call
|
|
1180
|
+
* `http://127.0.0.1:<defaultPort>`.
|
|
1152
1181
|
* @returns Array of tool descriptors to register.
|
|
1153
1182
|
*/
|
|
1154
|
-
declare function createPluginToolset(descriptor: JeevesComponentDescriptor): ToolDescriptor[];
|
|
1183
|
+
declare function createPluginToolset(descriptor: JeevesComponentDescriptor, options: PluginToolsetOptions): ToolDescriptor[];
|
|
1155
1184
|
|
|
1156
1185
|
/**
|
|
1157
1186
|
* Resolve the package root directory from a module's `import.meta.url`.
|
|
@@ -1616,5 +1645,5 @@ declare function getErrorMessage(err: unknown): string;
|
|
|
1616
1645
|
*/
|
|
1617
1646
|
declare function isTransientError(err: unknown): boolean;
|
|
1618
1647
|
|
|
1619
|
-
export { AGENTS_MARKERS, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CONVERSATION_HOOK_NAMES, CORE_CONFIG_DIR, CORE_VERSION, DEFAULT_BIND_ADDRESS, DEFAULT_PORTS, LEGACY_TOOLS_MARKERS, META_PORT, PLATFORM_COMPONENTS, RUNNER_PORT, SERVER_PORT, SOUL_MARKERS, STALE_LOCK_MS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_CONFIG_DEFAULTS, WORKSPACE_CONFIG_FILE, WORKSPACE_FILES, analyzeMemory, appendJsonl, atomicWrite, buildEffectiveConfig, checkNodeVersion, connectionFail, coreConfigSchema, createConfigApplyHandler, createConfigQueryHandler, createGoogleAuth, createPluginToolset, createServiceCli, createServiceManager, createStatusHandler, ensureDir, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, generateWorkspaceJsonSchema, getArg, getBindAddress, getChannelWorkspace, getComponentConfigDir, getComponentConfigPath, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getEffectiveServiceName, getErrorMessage, getPackageRoot, getPackageVersion, getServiceState, getServiceUrl, getWorkspacePath, init, isTransientError, jeevesComponentDescriptorSchema, loadEnvFile, loadWorkspaceConfig, nowIso, ok, onPluginDispose, parseArgs, parseManaged, postJson, promptContextOptionsSchema, readJson, readJsonl, recordRegisteredHooks, registerComponentConfigPath, registerPromptContext, rejectWindowsDrivePath, removeManagedBlock, renderManagedBlock, resetInit, resolveConfigValue, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, run, runScript, runWithRetry, saveCache, sleepAsync, sleepMs, substituteEnvVars, upsertManagedBlock, uuid, validateConversationHooks, validateSkillFrontmatter, withFileLock, workspaceConfigSchema, writeJsonAtomic, writeJsonl };
|
|
1620
|
-
export type { AccountConfig, ConfigApplyHandler, ConfigApplyRequest, ConfigApplyResult, ConfigProvenance, ConfigQueryHandler, ConfigQueryResponse, CoreConfig, CreateStatusHandlerOptions, GoogleAuthOptions, HookRegistrationOptions, InitOptions, JeevesComponentDescriptor, ManagedBlockStampOptions, ManagedMarkers, MemoryHygieneOptions, MemoryHygieneResult, ParseManagedResult, PlatformComponent, PluginApi, PluginLifecycleApi, PromptBuildContext, PromptBuildEvent, PromptBuildHandler, PromptBuildResult, PromptContextOptions, PromptContextProvider, ResolvedCliConfig, ResolvedValue, RetryOptions, RunOptions, ServiceAccountFileConfig, ServiceManager, ServiceManagerOptions, ServiceState, SkillFrontmatter, SlackWorkspaceOptions, StatusHandler, StatusHandlerResult, StatusResponse, ToolDescriptor, ToolRegistrationOptions, ToolResult, VersionStamp, WorkspaceConfig, WorkspaceOptions };
|
|
1648
|
+
export { AGENTS_MARKERS, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CONVERSATION_HOOK_NAMES, CORE_CONFIG_DIR, CORE_VERSION, DEFAULT_BIND_ADDRESS, DEFAULT_PORTS, LEGACY_TOOLS_MARKERS, META_PORT, PLATFORM_COMPONENTS, RUNNER_PORT, SERVER_PORT, SOUL_MARKERS, STALE_LOCK_MS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_CONFIG_DEFAULTS, WORKSPACE_CONFIG_FILE, WORKSPACE_FILES, analyzeMemory, appendJsonl, atomicWrite, buildEffectiveConfig, checkNodeVersion, connectionFail, coreConfigSchema, createConfigApplyHandler, createConfigQueryHandler, createGoogleAuth, createPluginToolset, createServiceCli, createServiceManager, createStatusHandler, ensureDir, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, generateWorkspaceJsonSchema, getArg, getBindAddress, getChannelWorkspace, getComponentConfigDir, getComponentConfigPath, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getEffectiveServiceName, getErrorMessage, getPackageRoot, getPackageVersion, getServiceState, getServiceUrl, getWorkspacePath, init, isTransientError, jeevesComponentDescriptorSchema, loadEnvFile, loadWorkspaceConfig, nowIso, ok, onPluginDispose, parseArgs, parseManaged, pluginToolsetOptionsSchema, postJson, promptContextOptionsSchema, readJson, readJsonl, recordRegisteredHooks, registerComponentConfigPath, registerPromptContext, rejectWindowsDrivePath, removeManagedBlock, renderManagedBlock, resetInit, resolveConfigValue, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, run, runScript, runWithRetry, saveCache, sleepAsync, sleepMs, substituteEnvVars, upsertManagedBlock, uuid, validateConversationHooks, validateSkillFrontmatter, withFileLock, workspaceConfigSchema, writeJsonAtomic, writeJsonl };
|
|
1649
|
+
export type { AccountConfig, ConfigApplyHandler, ConfigApplyRequest, ConfigApplyResult, ConfigProvenance, ConfigQueryHandler, ConfigQueryResponse, CoreConfig, CreateStatusHandlerOptions, GoogleAuthOptions, HookRegistrationOptions, InitOptions, JeevesComponentDescriptor, ManagedBlockStampOptions, ManagedMarkers, MemoryHygieneOptions, MemoryHygieneResult, ParseManagedResult, PlatformComponent, PluginApi, PluginApiUrlResolver, PluginLifecycleApi, PluginToolsetOptions, PromptBuildContext, PromptBuildEvent, PromptBuildHandler, PromptBuildResult, PromptContextOptions, PromptContextProvider, ResolvedCliConfig, ResolvedValue, RetryOptions, RunOptions, ServiceAccountFileConfig, ServiceManager, ServiceManagerOptions, ServiceState, SkillFrontmatter, SlackWorkspaceOptions, StatusHandler, StatusHandlerResult, StatusResponse, ToolDescriptor, ToolRegistrationOptions, ToolResult, VersionStamp, WorkspaceConfig, WorkspaceOptions };
|
package/dist/index.js
CHANGED
|
@@ -142,14 +142,14 @@ const DEFAULT_PORTS = {
|
|
|
142
142
|
* Core library version, inlined at build time.
|
|
143
143
|
*
|
|
144
144
|
* @remarks
|
|
145
|
-
* The `0.6.0-
|
|
145
|
+
* The `0.6.0-4` placeholder is replaced by
|
|
146
146
|
* `@rollup/plugin-replace` during the build with the actual version
|
|
147
147
|
* from `package.json`. This ensures the correct version survives
|
|
148
148
|
* when consumers bundle core into their own dist (where runtime
|
|
149
149
|
* `import.meta.url`-based resolution would find the wrong package.json).
|
|
150
150
|
*/
|
|
151
151
|
/** The core library version from package.json (inlined at build time). */
|
|
152
|
-
const CORE_VERSION = '0.6.0-
|
|
152
|
+
const CORE_VERSION = '0.6.0-4';
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* Workspace and config root initialization.
|
|
@@ -2347,6 +2347,43 @@ function validateConversationHooks(packageJson, registeredHooks) {
|
|
|
2347
2347
|
return declared;
|
|
2348
2348
|
}
|
|
2349
2349
|
|
|
2350
|
+
/**
|
|
2351
|
+
* Service base URL resolution for plugin tools.
|
|
2352
|
+
*
|
|
2353
|
+
* @remarks
|
|
2354
|
+
* Plugin tools must call the service at the plugin's configured `apiUrl`
|
|
2355
|
+
* (`plugins.entries.<id>.config.apiUrl`). The descriptor's `defaultPort`
|
|
2356
|
+
* is only the fallback when no `apiUrl` is set.
|
|
2357
|
+
*/
|
|
2358
|
+
/** Options for {@link createPluginToolset}. */
|
|
2359
|
+
const pluginToolsetOptionsSchema = z.object({
|
|
2360
|
+
/**
|
|
2361
|
+
* Service base URL (e.g. `http://127.0.0.1:1936`), or a resolver
|
|
2362
|
+
* evaluated per tool call. Unset, empty, or a resolver returning
|
|
2363
|
+
* `undefined` falls back to `http://127.0.0.1:<defaultPort>`.
|
|
2364
|
+
*/
|
|
2365
|
+
apiUrl: z
|
|
2366
|
+
.union([
|
|
2367
|
+
z.string(),
|
|
2368
|
+
z.custom((v) => typeof v === 'function', {
|
|
2369
|
+
message: 'apiUrl must be a string or a function',
|
|
2370
|
+
}),
|
|
2371
|
+
])
|
|
2372
|
+
.optional(),
|
|
2373
|
+
});
|
|
2374
|
+
/**
|
|
2375
|
+
* Resolve the service base URL for a plugin tool call.
|
|
2376
|
+
*
|
|
2377
|
+
* @param apiUrl - Configured URL or lazy resolver (optional).
|
|
2378
|
+
* @param defaultPort - Descriptor default port, used when `apiUrl` is unset.
|
|
2379
|
+
* @returns Base URL without a trailing slash.
|
|
2380
|
+
*/
|
|
2381
|
+
function resolvePluginApiUrl(apiUrl, defaultPort) {
|
|
2382
|
+
const value = (typeof apiUrl === 'function' ? apiUrl() : apiUrl)?.trim();
|
|
2383
|
+
const url = value ? value : `http://127.0.0.1:${String(defaultPort)}`;
|
|
2384
|
+
return url.replace(/\/+$/, '');
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2350
2387
|
/**
|
|
2351
2388
|
* Tool result formatters for the OpenClaw plugin SDK.
|
|
2352
2389
|
*
|
|
@@ -2426,6 +2463,10 @@ function connectionFail(error, baseUrl, pluginId) {
|
|
|
2426
2463
|
* - `{name}_config_apply` - Push config patch to running service
|
|
2427
2464
|
* - `{name}_service` - Service lifecycle management
|
|
2428
2465
|
*
|
|
2466
|
+
* The HTTP tools call the plugin's configured `apiUrl` (see
|
|
2467
|
+
* {@link PluginToolsetOptions}); the descriptor's `defaultPort` is only the
|
|
2468
|
+
* fallback when `apiUrl` is unset.
|
|
2469
|
+
*
|
|
2429
2470
|
* Components add domain-specific tools separately.
|
|
2430
2471
|
*/
|
|
2431
2472
|
/** Timeout for HTTP probes in milliseconds. */
|
|
@@ -2434,11 +2475,16 @@ const PROBE_TIMEOUT_MS = 5000;
|
|
|
2434
2475
|
* Create the standard plugin tool set from a component descriptor.
|
|
2435
2476
|
*
|
|
2436
2477
|
* @param descriptor - The component descriptor.
|
|
2478
|
+
* @param options - Tool options (required, so each plugin consciously
|
|
2479
|
+
* chooses its service URL). Pass the plugin's `apiUrl` (string or lazy
|
|
2480
|
+
* resolver); with `apiUrl` unset, the tools call
|
|
2481
|
+
* `http://127.0.0.1:<defaultPort>`.
|
|
2437
2482
|
* @returns Array of tool descriptors to register.
|
|
2438
2483
|
*/
|
|
2439
|
-
function createPluginToolset(descriptor) {
|
|
2484
|
+
function createPluginToolset(descriptor, options) {
|
|
2440
2485
|
const { name, defaultPort } = descriptor;
|
|
2441
|
-
const
|
|
2486
|
+
const { apiUrl } = pluginToolsetOptionsSchema.parse(options);
|
|
2487
|
+
const resolveBaseUrl = () => resolvePluginApiUrl(apiUrl, defaultPort);
|
|
2442
2488
|
const svcManager = createServiceManager(descriptor);
|
|
2443
2489
|
const statusTool = {
|
|
2444
2490
|
name: `${name}_status`,
|
|
@@ -2448,6 +2494,7 @@ function createPluginToolset(descriptor) {
|
|
|
2448
2494
|
properties: {},
|
|
2449
2495
|
},
|
|
2450
2496
|
execute: async () => {
|
|
2497
|
+
const baseUrl = resolveBaseUrl();
|
|
2451
2498
|
try {
|
|
2452
2499
|
const res = await fetchWithTimeout(`${baseUrl}/status`, PROBE_TIMEOUT_MS);
|
|
2453
2500
|
if (!res.ok) {
|
|
@@ -2476,6 +2523,7 @@ function createPluginToolset(descriptor) {
|
|
|
2476
2523
|
execute: async (_id, params) => {
|
|
2477
2524
|
const path = params.path;
|
|
2478
2525
|
const qs = path ? `?path=${encodeURIComponent(path)}` : '';
|
|
2526
|
+
const baseUrl = resolveBaseUrl();
|
|
2479
2527
|
try {
|
|
2480
2528
|
const result = await fetchJson(`${baseUrl}/config${qs}`);
|
|
2481
2529
|
return ok(result);
|
|
@@ -2503,6 +2551,7 @@ function createPluginToolset(descriptor) {
|
|
|
2503
2551
|
if (!config) {
|
|
2504
2552
|
return fail('Missing required parameter: config');
|
|
2505
2553
|
}
|
|
2554
|
+
const baseUrl = resolveBaseUrl();
|
|
2506
2555
|
try {
|
|
2507
2556
|
const result = await postJson(`${baseUrl}/config/apply`, {
|
|
2508
2557
|
patch: config,
|
|
@@ -3242,4 +3291,4 @@ async function getChannelWorkspace(channelId, token, options) {
|
|
|
3242
3291
|
return teamId;
|
|
3243
3292
|
}
|
|
3244
3293
|
|
|
3245
|
-
export { AGENTS_MARKERS, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CONVERSATION_HOOK_NAMES, CORE_CONFIG_DIR, CORE_VERSION, DEFAULT_BIND_ADDRESS, DEFAULT_PORTS, LEGACY_TOOLS_MARKERS, META_PORT, PLATFORM_COMPONENTS, RUNNER_PORT, SERVER_PORT, SOUL_MARKERS, STALE_LOCK_MS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_CONFIG_DEFAULTS, WORKSPACE_CONFIG_FILE, WORKSPACE_FILES, analyzeMemory, appendJsonl, atomicWrite, buildEffectiveConfig, checkNodeVersion, connectionFail, coreConfigSchema, createConfigApplyHandler, createConfigQueryHandler, createGoogleAuth, createPluginToolset, createServiceCli, createServiceManager, createStatusHandler, ensureDir, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, generateWorkspaceJsonSchema, getArg, getBindAddress, getChannelWorkspace, getComponentConfigDir, getComponentConfigPath, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getEffectiveServiceName, getErrorMessage, getPackageRoot, getPackageVersion, getServiceState, getServiceUrl, getWorkspacePath, init, isTransientError, jeevesComponentDescriptorSchema, loadEnvFile, loadWorkspaceConfig, nowIso, ok, onPluginDispose, parseArgs, parseManaged, postJson, promptContextOptionsSchema, readJson, readJsonl, recordRegisteredHooks, registerComponentConfigPath, registerPromptContext, rejectWindowsDrivePath, removeManagedBlock, renderManagedBlock, resetInit, resolveConfigValue, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, run, runScript, runWithRetry, saveCache, sleepAsync, sleepMs, substituteEnvVars, upsertManagedBlock, uuid, validateConversationHooks, validateSkillFrontmatter, withFileLock, workspaceConfigSchema, writeJsonAtomic, writeJsonl };
|
|
3294
|
+
export { AGENTS_MARKERS, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CONVERSATION_HOOK_NAMES, CORE_CONFIG_DIR, CORE_VERSION, DEFAULT_BIND_ADDRESS, DEFAULT_PORTS, LEGACY_TOOLS_MARKERS, META_PORT, PLATFORM_COMPONENTS, RUNNER_PORT, SERVER_PORT, SOUL_MARKERS, STALE_LOCK_MS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_CONFIG_DEFAULTS, WORKSPACE_CONFIG_FILE, WORKSPACE_FILES, analyzeMemory, appendJsonl, atomicWrite, buildEffectiveConfig, checkNodeVersion, connectionFail, coreConfigSchema, createConfigApplyHandler, createConfigQueryHandler, createGoogleAuth, createPluginToolset, createServiceCli, createServiceManager, createStatusHandler, ensureDir, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, generateWorkspaceJsonSchema, getArg, getBindAddress, getChannelWorkspace, getComponentConfigDir, getComponentConfigPath, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getEffectiveServiceName, getErrorMessage, getPackageRoot, getPackageVersion, getServiceState, getServiceUrl, getWorkspacePath, init, isTransientError, jeevesComponentDescriptorSchema, loadEnvFile, loadWorkspaceConfig, nowIso, ok, onPluginDispose, parseArgs, parseManaged, pluginToolsetOptionsSchema, postJson, promptContextOptionsSchema, readJson, readJsonl, recordRegisteredHooks, registerComponentConfigPath, registerPromptContext, rejectWindowsDrivePath, removeManagedBlock, renderManagedBlock, resetInit, resolveConfigValue, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, run, runScript, runWithRetry, saveCache, sleepAsync, sleepMs, substituteEnvVars, upsertManagedBlock, uuid, validateConversationHooks, validateSkillFrontmatter, withFileLock, workspaceConfigSchema, writeJsonAtomic, writeJsonl };
|