@karmaniverous/jeeves 0.5.1 → 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.d.ts CHANGED
@@ -304,16 +304,30 @@ declare const workspaceConfigSchema: z.ZodObject<{
304
304
  }, z.core.$strip>;
305
305
  /** Workspace config type. */
306
306
  type WorkspaceConfig = z.infer<typeof workspaceConfigSchema>;
307
- /** Built-in workspace config defaults. */
307
+ /**
308
+ * Built-in workspace config defaults.
309
+ *
310
+ * @remarks
311
+ * These defaults are used as the lowest-priority tier in config resolution
312
+ * (below CLI flags, env vars, and `jeeves.config.json` values).
313
+ */
308
314
  declare const WORKSPACE_CONFIG_DEFAULTS: {
315
+ /** Core shared defaults. */
309
316
  readonly core: {
310
- readonly workspace: ".";
311
- readonly configRoot: "./config";
312
- readonly gatewayUrl: "http://127.0.0.1:3000";
317
+ /** Default workspace root path. */
318
+ readonly workspace: '.';
319
+ /** Default platform config root path. */
320
+ readonly configRoot: './config';
321
+ /** Default OpenClaw gateway URL. */
322
+ readonly gatewayUrl: 'http://127.0.0.1:3000';
313
323
  };
324
+ /** Memory hygiene shared defaults. */
314
325
  readonly memory: {
315
- readonly budget: 20000;
326
+ /** Default MEMORY.md character budget. */
327
+ readonly budget: 20_000;
328
+ /** Default warning threshold as a fraction of budget (80%). */
316
329
  readonly warningThreshold: 0.8;
330
+ /** Default staleness threshold in days. */
317
331
  readonly staleDays: 30;
318
332
  };
319
333
  };
@@ -369,14 +383,20 @@ interface WorkspaceOptions {
369
383
  interface ResolvedCliConfig {
370
384
  /** Core shared config. */
371
385
  core: {
386
+ /** Resolved workspace root path. */
372
387
  workspace: ResolvedValue<string>;
388
+ /** Resolved platform config root path. */
373
389
  configRoot: ResolvedValue<string>;
390
+ /** Resolved OpenClaw gateway URL. */
374
391
  gatewayUrl: ResolvedValue<string>;
375
392
  };
376
393
  /** Memory shared config. */
377
394
  memory: {
395
+ /** Resolved MEMORY.md character budget. */
378
396
  budget: ResolvedValue<number>;
397
+ /** Resolved warning threshold as a fraction of budget. */
379
398
  warningThreshold: ResolvedValue<number>;
399
+ /** Resolved staleness threshold in days. */
380
400
  staleDays: ResolvedValue<number>;
381
401
  };
382
402
  }
@@ -407,8 +427,8 @@ declare function buildEffectiveConfig(opts: WorkspaceOptions): ResolvedCliConfig
407
427
  interface CreatePluginCliOptions {
408
428
  /** Plugin identifier (e.g., 'jeeves-watcher-openclaw'). */
409
429
  pluginId: string;
410
- /** Absolute path to the dist directory to copy. */
411
- distDir: string;
430
+ /** `import.meta.url` for the calling plugin CLI module. */
431
+ importMetaUrl: string;
412
432
  /** npm package name for the plugin. */
413
433
  pluginPackage: string;
414
434
  /** Component name (e.g., 'watcher'). Derived from pluginId if omitted. */
@@ -530,14 +550,6 @@ declare function removeComponentVersion(coreConfigDir: string, componentName: st
530
550
  * on a configurable prime-interval timer cycle.
531
551
  */
532
552
 
533
- /**
534
- * Orchestrates managed content writing for a single Jeeves component.
535
- *
536
- * @remarks
537
- * Created via `createComponentWriter()`. Manages a timer that fires
538
- * at the component's prime-interval, calling `generateToolsContent()`
539
- * and `refreshPlatformContent()` on each cycle.
540
- */
541
553
  /** Options for ComponentWriter construction. */
542
554
  interface ComponentWriterOptions {
543
555
  /**
@@ -548,8 +560,17 @@ interface ComponentWriterOptions {
548
560
  */
549
561
  gatewayUrl?: string;
550
562
  }
563
+ /**
564
+ * Orchestrates managed content writing for a single Jeeves component.
565
+ *
566
+ * @remarks
567
+ * Created via {@link createComponentWriter}. Manages a timer that fires
568
+ * at the component's prime-interval, calling `generateToolsContent()`
569
+ * and `refreshPlatformContent()` on each cycle.
570
+ */
551
571
  declare class ComponentWriter {
552
572
  private timer;
573
+ private jitterTimeout;
553
574
  private readonly component;
554
575
  private readonly configDir;
555
576
  private readonly gatewayUrl;
@@ -558,13 +579,15 @@ declare class ComponentWriter {
558
579
  constructor(component: JeevesComponentDescriptor, options?: ComponentWriterOptions);
559
580
  /** The component's config directory path. */
560
581
  get componentConfigDir(): string;
561
- /** Whether the writer timer is currently running. */
582
+ /** Whether the writer timer is currently running or pending its first cycle. */
562
583
  get isRunning(): boolean;
563
584
  /**
564
585
  * Start the writer timer.
565
586
  *
566
587
  * @remarks
567
- * Performs an immediate first write, then sets up the interval.
588
+ * Delays the first cycle by a random jitter (0 to one full interval) to
589
+ * spread initial writes across all component plugins and reduce EPERM
590
+ * contention on startup.
568
591
  */
569
592
  start(): void;
570
593
  /** Stop the writer timer. */
@@ -1138,6 +1161,10 @@ declare const DEFAULT_CORE_VERSION: string;
1138
1161
  /**
1139
1162
  * Write content to a file atomically via a temp file + rename.
1140
1163
  *
1164
+ * @remarks
1165
+ * Retries the rename up to three times on EPERM (Windows file-handle
1166
+ * contention) with a 100 ms synchronous delay between attempts.
1167
+ *
1141
1168
  * @param filePath - Absolute path to the target file.
1142
1169
  * @param content - Content to write.
1143
1170
  */
@@ -1470,6 +1497,19 @@ declare function seedSkill(workspacePath: string): void;
1470
1497
  */
1471
1498
  declare function createPluginToolset(descriptor: JeevesComponentDescriptor): ToolDescriptor[];
1472
1499
 
1500
+ /**
1501
+ * Resolve the package root directory from a module's `import.meta.url`.
1502
+ *
1503
+ * @module
1504
+ */
1505
+ /**
1506
+ * Get the nearest package root directory relative to the calling module URL.
1507
+ *
1508
+ * @param importMetaUrl - The `import.meta.url` of the calling module.
1509
+ * @returns The absolute package root path, or `undefined` on any error.
1510
+ */
1511
+ declare function getPackageRoot(importMetaUrl: string): string | undefined;
1512
+
1473
1513
  /**
1474
1514
  * Resolve the version of a package from its `import.meta.url`.
1475
1515
  *
@@ -1548,20 +1588,34 @@ declare function resolveOpenClawHome(): string;
1548
1588
  * @returns Absolute path to the config file.
1549
1589
  */
1550
1590
  declare function resolveConfigPath(home: string): string;
1591
+ /** Options for writing a plugin install provenance record. */
1592
+ interface PluginInstallRecord {
1593
+ /** Absolute path to the extensions directory where the plugin was installed. */
1594
+ installPath: string;
1595
+ /** Plugin version string from package.json, if known. */
1596
+ version?: string;
1597
+ /** ISO timestamp of installation. Defaults to `new Date().toISOString()`. */
1598
+ installedAt?: string;
1599
+ }
1551
1600
  /**
1552
- * Patch an OpenClaw config for plugin install or uninstall.
1601
+ * Patch an OpenClaw config for plugin install.
1553
1602
  *
1554
- * @remarks
1555
- * Manages `plugins.entries.{pluginId}` and `tools.alsoAllow`.
1556
- * Idempotent: adding twice produces no duplicates; removing when absent
1557
- * produces no errors.
1603
+ * @param config - The parsed OpenClaw config object (mutated in place).
1604
+ * @param pluginId - The plugin identifier.
1605
+ * @param mode - Install mode.
1606
+ * @param installRecord - Install provenance record.
1607
+ * @returns Array of log messages describing changes made.
1608
+ */
1609
+ declare function patchConfig(config: Record<string, unknown>, pluginId: string, mode: 'add', installRecord: PluginInstallRecord): string[];
1610
+ /**
1611
+ * Patch an OpenClaw config for plugin uninstall.
1558
1612
  *
1559
1613
  * @param config - The parsed OpenClaw config object (mutated in place).
1560
1614
  * @param pluginId - The plugin identifier.
1561
- * @param mode - Whether to add or remove the plugin.
1615
+ * @param mode - Uninstall mode.
1562
1616
  * @returns Array of log messages describing changes made.
1563
1617
  */
1564
- declare function patchConfig(config: Record<string, unknown>, pluginId: string, mode: 'add' | 'remove'): string[];
1618
+ declare function patchConfig(config: Record<string, unknown>, pluginId: string, mode: 'remove'): string[];
1565
1619
 
1566
1620
  /**
1567
1621
  * Plugin resolution helpers for the OpenClaw plugin SDK.
@@ -1838,5 +1892,5 @@ interface ServiceManager {
1838
1892
  */
1839
1893
  declare function createServiceManager(descriptor: JeevesComponentDescriptor): ServiceManager;
1840
1894
 
1841
- export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, COMPONENT_VERSIONS_FILE, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_BIND_ADDRESS, DEFAULT_CORE_VERSION, DEFAULT_PORTS, HEARTBEAT_HEADING, JEEVES_SKILL_DIR, MEMORY_HEARTBEAT_NAME, META_PORT, PLATFORM_COMPONENTS, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SKILLS_DIR, SOUL_MARKERS, STALENESS_THRESHOLD_MS, STALE_LOCK_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_CONFIG_DEFAULTS, WORKSPACE_CONFIG_FILE, WORKSPACE_FILES, analyzeMemory, appendJsonl, atomicWrite, buildEffectiveConfig, buildHeartbeatSection, checkMemoryHealth, checkNodeVersion, checkRegistryVersion, connectionFail, coreConfigSchema, createAsyncContentCache, createComponentWriter, createConfigApplyHandler, createConfigQueryHandler, createGoogleAuth, createPluginCli, createPluginToolset, createServiceCli, createServiceManager, createStatusHandler, ensureDir, extractMostRecentDate, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, generateWorkspaceJsonSchema, getArg, getBindAddress, getChannelWorkspace, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getEffectiveServiceName, getPackageVersion, getServiceState, getServiceUrl, getWorkspacePath, init, isPrime, jaccard, jeevesComponentDescriptorSchema, loadEnvFile, loadWorkspaceConfig, needsCleanup, nowIso, ok, orchestrateHeartbeat, parseArgs, parseHeartbeat, parseManaged, patchConfig, postJson, readComponentVersions, readJson, readJsonl, refreshPlatformContent, removeComponentVersion, removeManagedSection, resetInit, resolveConfigPath, resolveConfigValue, resolveOpenClawHome, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, run, runScript, runWithRetry, saveCache, seedContent, seedSkill, shingles, shouldWrite, sleepAsync, sleepMs, updateManagedSection, uuid, withFileLock, workspaceConfigSchema, writeComponentVersion, writeHeartbeatSection, writeJsonAtomic, writeJsonl };
1842
- export type { AccountConfig, AsyncContentCacheOptions, ComponentDependencies, ComponentState, ComponentVersionEntry, ComponentVersionsState, ComponentWriterOptions, ConfigApplyHandler, ConfigApplyRequest, ConfigApplyResult, ConfigProvenance, ConfigQueryHandler, ConfigQueryResponse, CoreConfig, CreatePluginCliOptions, CreateStatusHandlerOptions, GoogleAuthOptions, HeartbeatEntry, InitOptions, JeevesComponentDescriptor, ManagedMarkers, ManagedSection, MemoryHygieneOptions, MemoryHygieneResult, OrchestrateHeartbeatOptions, ParseManagedResult, ParsedHeartbeat, PlatformComponent, PluginApi, RefreshPlatformContentOptions, RemoveManagedSectionOptions, ResolvedValue, RetryOptions, RunOptions, SectionId, SeedContentOptions, ServiceAccountFileConfig, ServiceManager, ServiceManagerOptions, ServiceState, SlackWorkspaceOptions, StatusHandler, StatusHandlerResult, StatusResponse, ToolDescriptor, ToolRegistrationOptions, ToolResult, UpdateManagedSectionOptions, VersionStamp, WorkspaceConfig, WriteComponentVersionOptions };
1895
+ export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, COMPONENT_VERSIONS_FILE, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_BIND_ADDRESS, DEFAULT_CORE_VERSION, DEFAULT_PORTS, HEARTBEAT_HEADING, JEEVES_SKILL_DIR, MEMORY_HEARTBEAT_NAME, META_PORT, PLATFORM_COMPONENTS, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SKILLS_DIR, SOUL_MARKERS, STALENESS_THRESHOLD_MS, STALE_LOCK_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_CONFIG_DEFAULTS, WORKSPACE_CONFIG_FILE, WORKSPACE_FILES, analyzeMemory, appendJsonl, atomicWrite, buildEffectiveConfig, buildHeartbeatSection, checkMemoryHealth, checkNodeVersion, checkRegistryVersion, connectionFail, coreConfigSchema, createAsyncContentCache, createComponentWriter, createConfigApplyHandler, createConfigQueryHandler, createGoogleAuth, createPluginCli, createPluginToolset, createServiceCli, createServiceManager, createStatusHandler, ensureDir, extractMostRecentDate, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, generateWorkspaceJsonSchema, getArg, getBindAddress, getChannelWorkspace, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getEffectiveServiceName, getPackageRoot, getPackageVersion, getServiceState, getServiceUrl, getWorkspacePath, init, isPrime, jaccard, jeevesComponentDescriptorSchema, loadEnvFile, loadWorkspaceConfig, needsCleanup, nowIso, ok, orchestrateHeartbeat, parseArgs, parseHeartbeat, parseManaged, patchConfig, postJson, readComponentVersions, readJson, readJsonl, refreshPlatformContent, removeComponentVersion, removeManagedSection, resetInit, resolveConfigPath, resolveConfigValue, resolveOpenClawHome, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, run, runScript, runWithRetry, saveCache, seedContent, seedSkill, shingles, shouldWrite, sleepAsync, sleepMs, updateManagedSection, uuid, withFileLock, workspaceConfigSchema, writeComponentVersion, writeHeartbeatSection, writeJsonAtomic, writeJsonl };
1896
+ export type { AccountConfig, AsyncContentCacheOptions, ComponentDependencies, ComponentState, ComponentVersionEntry, ComponentVersionsState, ComponentWriterOptions, ConfigApplyHandler, ConfigApplyRequest, ConfigApplyResult, ConfigProvenance, ConfigQueryHandler, ConfigQueryResponse, CoreConfig, CreatePluginCliOptions, CreateStatusHandlerOptions, GoogleAuthOptions, HeartbeatEntry, InitOptions, JeevesComponentDescriptor, ManagedMarkers, ManagedSection, MemoryHygieneOptions, MemoryHygieneResult, OrchestrateHeartbeatOptions, ParseManagedResult, ParsedHeartbeat, PlatformComponent, PluginApi, PluginInstallRecord, RefreshPlatformContentOptions, RemoveManagedSectionOptions, ResolvedCliConfig, ResolvedValue, RetryOptions, RunOptions, SectionId, SeedContentOptions, ServiceAccountFileConfig, ServiceManager, ServiceManagerOptions, ServiceState, SlackWorkspaceOptions, StatusHandler, StatusHandlerResult, StatusResponse, ToolDescriptor, ToolRegistrationOptions, ToolResult, UpdateManagedSectionOptions, VersionStamp, WorkspaceConfig, WorkspaceOptions, WriteComponentVersionOptions };