@karmaniverous/jeeves 0.2.0 → 0.3.1

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
@@ -48,8 +48,6 @@ declare function createConfigQueryHandler(getConfig: () => unknown): ConfigQuery
48
48
  */
49
49
  /** Version entry for a single component. */
50
50
  interface ComponentVersionEntry {
51
- /** Service version from health probe. */
52
- serviceVersion?: string;
53
51
  /** Plugin version (the OpenClaw plugin package version). */
54
52
  pluginVersion?: string;
55
53
  /** npm package name for the service. */
@@ -72,8 +70,6 @@ declare function readComponentVersions(coreConfigDir: string): ComponentVersions
72
70
  interface WriteComponentVersionOptions {
73
71
  /** Component name. */
74
72
  componentName: string;
75
- /** Service version from probe, if available. */
76
- serviceVersion?: string;
77
73
  /** Plugin version. */
78
74
  pluginVersion?: string;
79
75
  /** Service npm package name. */
@@ -92,89 +88,6 @@ interface WriteComponentVersionOptions {
92
88
  */
93
89
  declare function writeComponentVersion(coreConfigDir: string, options: WriteComponentVersionOptions): void;
94
90
 
95
- /**
96
- * Core types for the OpenClaw plugin SDK.
97
- *
98
- * @remarks
99
- * These types define the contract between plugins and the OpenClaw gateway.
100
- * They unify the various `PluginApi` definitions previously duplicated
101
- * across component plugins into a single canonical source.
102
- */
103
- /** Result shape returned by tool executions. */
104
- interface ToolResult {
105
- /** Content blocks — typically a single text block. */
106
- content: Array<{
107
- type: string;
108
- text: string;
109
- }>;
110
- /** Whether this result represents an error. */
111
- isError?: boolean;
112
- }
113
- /** Tool descriptor for registration with the OpenClaw gateway. */
114
- interface ToolDescriptor {
115
- /** Unique tool name. */
116
- name: string;
117
- /** Human-readable description. */
118
- description: string;
119
- /** JSON Schema for the tool's parameters. */
120
- parameters: Record<string, unknown>;
121
- /** Execute the tool with the given parameters. */
122
- execute: (id: string, params: Record<string, unknown>) => Promise<ToolResult>;
123
- }
124
- /** Options for tool registration. */
125
- interface ToolRegistrationOptions {
126
- /** Whether the tool is optional (non-fatal if registration fails). */
127
- optional?: boolean;
128
- }
129
- /**
130
- * Canonical OpenClaw plugin API interface.
131
- *
132
- * @remarks
133
- * This is the shape of the `api` object passed to plugins by the
134
- * OpenClaw gateway at registration time. Fields are optional where
135
- * the gateway may not provide them in all versions.
136
- */
137
- interface PluginApi {
138
- /** OpenClaw configuration object. */
139
- config?: {
140
- /** Agent configuration block. */
141
- agents?: {
142
- /** Default agent settings. */
143
- defaults?: {
144
- /** Absolute path to the workspace root directory. */
145
- workspace?: string;
146
- };
147
- };
148
- /** Installed plugin configuration. */
149
- plugins?: {
150
- /** Plugin entries keyed by plugin ID. */
151
- entries?: Record<string, {
152
- config?: Record<string, unknown>;
153
- }>;
154
- };
155
- };
156
- /**
157
- * Resolve a path relative to the OpenClaw workspace.
158
- *
159
- * @remarks
160
- * Present on newer OpenClaw builds; optional for backwards compatibility.
161
- */
162
- resolvePath?: (input: string) => string;
163
- /**
164
- * Register a tool with the OpenClaw gateway.
165
- *
166
- * @param tool - Tool descriptor.
167
- * @param options - Registration options.
168
- */
169
- registerTool(tool: ToolDescriptor, options?: ToolRegistrationOptions): void;
170
- }
171
- /**
172
- * Alias for `PluginApi`, retained for backward compatibility.
173
- *
174
- * Prefer `PluginApi` for new code. This alias will be removed in v0.3.0.
175
- */
176
- type PluginApiLike = PluginApi;
177
-
178
91
  /**
179
92
  * Component interface types for the Jeeves platform.
180
93
  *
@@ -183,7 +96,6 @@ type PluginApiLike = PluginApi;
183
96
  * to participate in the platform. The `JeevesComponent` interface is
184
97
  * the primary integration point.
185
98
  */
186
-
187
99
  /** Service health status. */
188
100
  interface ServiceStatus {
189
101
  /** Whether the service is running. */
@@ -253,9 +165,8 @@ declare class ComponentWriter {
253
165
  private timer;
254
166
  private readonly component;
255
167
  private readonly configDir;
256
- private readonly probeTimeoutMs;
257
168
  /** @internal */
258
- constructor(component: JeevesComponent, probeTimeoutMs?: number);
169
+ constructor(component: JeevesComponent);
259
170
  /** The component's config directory path. */
260
171
  get componentConfigDir(): string;
261
172
  /** Whether the writer timer is currently running. */
@@ -348,55 +259,14 @@ declare function createAsyncContentCache(options: AsyncContentCacheOptions): ()
348
259
  * - `generateToolsContent` must be a function
349
260
  */
350
261
 
351
- /** Options for creating a ComponentWriter. */
352
- interface CreateComponentWriterOptions {
353
- /** Timeout for health probes in ms (default 3000). */
354
- probeTimeoutMs?: number;
355
- }
356
262
  /**
357
263
  * Create a ComponentWriter for a validated component descriptor.
358
264
  *
359
265
  * @param component - The component descriptor to validate and wrap.
360
- * @param options - Optional configuration.
361
266
  * @returns A new `ComponentWriter` instance.
362
267
  * @throws Error if the component descriptor is invalid.
363
268
  */
364
- declare function createComponentWriter(component: JeevesComponent, options?: CreateComponentWriterOptions): ComponentWriter;
365
-
366
- /**
367
- * Plugin resolution helpers for the OpenClaw plugin SDK.
368
- *
369
- * @remarks
370
- * Provides workspace path resolution and plugin setting resolution
371
- * with a standard three-step fallback chain:
372
- * plugin config → environment variable → default value.
373
- */
374
-
375
- /**
376
- * Resolve the workspace root from the OpenClaw plugin API.
377
- *
378
- * @remarks
379
- * Tries three sources in order:
380
- * 1. `api.config.agents.defaults.workspace` — explicit config
381
- * 2. `api.resolvePath('.')` — gateway-provided path resolver
382
- * 3. `process.cwd()` — last resort
383
- *
384
- * @param api - The plugin API object provided by the gateway.
385
- * @returns Absolute path to the workspace root.
386
- */
387
- declare function resolveWorkspacePath(api: PluginApi): string;
388
- /**
389
- * Resolve a plugin setting via the standard three-step fallback chain:
390
- * plugin config → environment variable → fallback value.
391
- *
392
- * @param api - Plugin API object.
393
- * @param pluginId - Plugin identifier (e.g., 'jeeves-watcher-openclaw').
394
- * @param key - Config key within the plugin's config object.
395
- * @param envVar - Environment variable name.
396
- * @param fallback - Default value if neither source provides one.
397
- * @returns The resolved setting value.
398
- */
399
- declare function resolvePluginSetting(api: PluginApi, pluginId: string, key: string, envVar: string, fallback: string): string;
269
+ declare function createComponentWriter(component: JeevesComponent): ComponentWriter;
400
270
 
401
271
  /**
402
272
  * Comment markers for managed content blocks.
@@ -605,44 +475,6 @@ declare function generateJsonSchema(): Record<string, unknown>;
605
475
  */
606
476
  declare function getServiceUrl(serviceName: string, consumerName?: string): string;
607
477
 
608
- /**
609
- * HTTP health probing for Jeeves platform services.
610
- *
611
- * @remarks
612
- * Probes service ports for health endpoints (HTTP GET to /status or /health).
613
- * Returns structured health data for rendering into TOOLS.md Platform section.
614
- */
615
- /** Health probe result for a single service. */
616
- interface ProbeResult {
617
- /** Service name (e.g., 'server', 'watcher'). */
618
- name: string;
619
- /** Port number. */
620
- port: number;
621
- /** Whether the service responded successfully. */
622
- healthy: boolean;
623
- /** Service version from the health response, if available. */
624
- version?: string;
625
- /** Error message if the probe failed. */
626
- error?: string;
627
- }
628
- /**
629
- * Probe a single service for health.
630
- *
631
- * @param serviceName - The service name (e.g., 'server', 'watcher').
632
- * @param consumerName - Optional consumer name for URL resolution.
633
- * @param timeoutMs - Request timeout in milliseconds (default 3000).
634
- * @returns Probe result.
635
- */
636
- declare function probeService(serviceName: string, consumerName?: string, timeoutMs?: number): Promise<ProbeResult>;
637
- /**
638
- * Probe all known Jeeves services for health.
639
- *
640
- * @param consumerName - Optional consumer name for URL resolution.
641
- * @param timeoutMs - Request timeout in milliseconds (default 3000).
642
- * @returns Array of probe results for all services.
643
- */
644
- declare function probeAllServices(consumerName?: string, timeoutMs?: number): Promise<ProbeResult[]>;
645
-
646
478
  /**
647
479
  * Registry version cache for npm package update awareness.
648
480
  *
@@ -764,7 +596,7 @@ declare function needsCleanup(managedContent: string, userContent: string, thres
764
596
  /** Stale lock threshold in ms (2 minutes). */
765
597
  declare const STALE_LOCK_MS = 120000;
766
598
  /** Default core version when none provided. */
767
- declare const DEFAULT_CORE_VERSION = "0.0.0";
599
+ declare const DEFAULT_CORE_VERSION: string;
768
600
  /**
769
601
  * Write content to a file atomically via a temp file + rename.
770
602
  *
@@ -936,9 +768,9 @@ declare function shouldWrite(myVersion: string, existing: VersionStamp | undefin
936
768
  *
937
769
  * @remarks
938
770
  * Called by `ComponentWriter` on each cycle. Not directly exposed to components.
939
- * Probes service ports for health, reads content files from the package's
940
- * `content/` directory, renders the Platform template with live service data,
941
- * and writes managed sections using `updateManagedSection`.
771
+ * Reads content files from the package's `content/` directory, renders the
772
+ * Platform template with live data, and writes managed sections using
773
+ * `updateManagedSection`.
942
774
  */
943
775
  /** Options for refreshPlatformContent. */
944
776
  interface RefreshPlatformContentOptions {
@@ -954,10 +786,6 @@ interface RefreshPlatformContentOptions {
954
786
  pluginPackage?: string;
955
787
  /** Staleness threshold override in ms. */
956
788
  stalenessThresholdMs?: number;
957
- /** Timeout for health probes in ms. */
958
- probeTimeoutMs?: number;
959
- /** Skip registry version check (useful for testing). */
960
- skipRegistryCheck?: boolean;
961
789
  }
962
790
  /**
963
791
  * Refresh platform content: SOUL.md, AGENTS.md, and TOOLS.md Platform section.
@@ -978,10 +806,6 @@ declare function refreshPlatformContent(options: RefreshPlatformContentOptions):
978
806
  interface SeedContentOptions {
979
807
  /** Core library version for version-stamp convergence. */
980
808
  coreVersion: string;
981
- /** Timeout for health probes in ms. */
982
- probeTimeoutMs?: number;
983
- /** Skip registry version check. */
984
- skipRegistryCheck?: boolean;
985
809
  }
986
810
  /**
987
811
  * Seed all platform content into the workspace.
@@ -1002,6 +826,15 @@ declare function seedContent(options: SeedContentOptions): Promise<void>;
1002
826
  * Thin wrappers around `fetch` that throw on non-OK responses
1003
827
  * and handle JSON serialisation/deserialisation.
1004
828
  */
829
+ /**
830
+ * Fetch a URL with an automatic abort timeout.
831
+ *
832
+ * @param url - URL to fetch.
833
+ * @param timeoutMs - Timeout in milliseconds before aborting.
834
+ * @param init - Optional `fetch` init options.
835
+ * @returns The fetch Response object.
836
+ */
837
+ declare function fetchWithTimeout(url: string, timeoutMs: number, init?: RequestInit): Promise<Response>;
1005
838
  /**
1006
839
  * Fetch JSON from a URL, throwing on non-OK responses.
1007
840
  *
@@ -1065,6 +898,133 @@ declare function resolveConfigPath(home: string): string;
1065
898
  */
1066
899
  declare function patchConfig(config: Record<string, unknown>, pluginId: string, mode: 'add' | 'remove'): string[];
1067
900
 
901
+ /**
902
+ * Core types for the OpenClaw plugin SDK.
903
+ *
904
+ * @remarks
905
+ * These types define the contract between plugins and the OpenClaw gateway.
906
+ * They unify the various `PluginApi` definitions previously duplicated
907
+ * across component plugins into a single canonical source.
908
+ */
909
+ /** Result shape returned by tool executions. */
910
+ interface ToolResult {
911
+ /** Content blocks — typically a single text block. */
912
+ content: Array<{
913
+ /** MIME type identifier (e.g. `"text"`). */
914
+ type: string;
915
+ /** Text content of the block. */
916
+ text: string;
917
+ }>;
918
+ /** Whether this result represents an error. */
919
+ isError?: boolean;
920
+ }
921
+ /** Tool descriptor for registration with the OpenClaw gateway. */
922
+ interface ToolDescriptor {
923
+ /** Unique tool name. */
924
+ name: string;
925
+ /** Human-readable description. */
926
+ description: string;
927
+ /** JSON Schema for the tool's parameters. */
928
+ parameters: Record<string, unknown>;
929
+ /** Execute the tool with the given parameters. */
930
+ execute: (id: string, params: Record<string, unknown>) => Promise<ToolResult>;
931
+ }
932
+ /** Options for tool registration. */
933
+ interface ToolRegistrationOptions {
934
+ /** Whether the tool is optional (non-fatal if registration fails). */
935
+ optional?: boolean;
936
+ }
937
+ /**
938
+ * Canonical OpenClaw plugin API interface.
939
+ *
940
+ * @remarks
941
+ * This is the shape of the `api` object passed to plugins by the
942
+ * OpenClaw gateway at registration time. Fields are optional where
943
+ * the gateway may not provide them in all versions.
944
+ */
945
+ interface PluginApi {
946
+ /** OpenClaw configuration object. */
947
+ config?: {
948
+ /** Agent configuration block. */
949
+ agents?: {
950
+ /** Default agent settings. */
951
+ defaults?: {
952
+ /** Absolute path to the workspace root directory. */
953
+ workspace?: string;
954
+ };
955
+ };
956
+ /** Installed plugin configuration. */
957
+ plugins?: {
958
+ /** Plugin entries keyed by plugin ID. */
959
+ entries?: Record<string, {
960
+ /** Plugin-specific configuration key-value pairs. */
961
+ config?: Record<string, unknown>;
962
+ }>;
963
+ };
964
+ };
965
+ /**
966
+ * Resolve a path relative to the OpenClaw workspace.
967
+ *
968
+ * @remarks
969
+ * Present on newer OpenClaw builds; optional for backwards compatibility.
970
+ */
971
+ resolvePath?: (input: string) => string;
972
+ /**
973
+ * Register a tool with the OpenClaw gateway.
974
+ *
975
+ * @param tool - Tool descriptor.
976
+ * @param options - Registration options.
977
+ */
978
+ registerTool(tool: ToolDescriptor, options?: ToolRegistrationOptions): void;
979
+ }
980
+
981
+ /**
982
+ * Plugin resolution helpers for the OpenClaw plugin SDK.
983
+ *
984
+ * @remarks
985
+ * Provides workspace path resolution and plugin setting resolution
986
+ * with a standard three-step fallback chain:
987
+ * plugin config → environment variable → default value.
988
+ */
989
+
990
+ /**
991
+ * Resolve the workspace root from the OpenClaw plugin API.
992
+ *
993
+ * @remarks
994
+ * Tries three sources in order:
995
+ * 1. `api.config.agents.defaults.workspace` — explicit config
996
+ * 2. `api.resolvePath('.')` — gateway-provided path resolver
997
+ * 3. `process.cwd()` — last resort
998
+ *
999
+ * @param api - The plugin API object provided by the gateway.
1000
+ * @returns Absolute path to the workspace root.
1001
+ */
1002
+ declare function resolveWorkspacePath(api: PluginApi): string;
1003
+ /**
1004
+ * Resolve a plugin setting via the standard three-step fallback chain:
1005
+ * plugin config → environment variable → fallback value.
1006
+ *
1007
+ * @param api - Plugin API object.
1008
+ * @param pluginId - Plugin identifier (e.g., 'jeeves-watcher-openclaw').
1009
+ * @param key - Config key within the plugin's config object.
1010
+ * @param envVar - Environment variable name.
1011
+ * @param fallback - Default value if neither source provides one.
1012
+ * @returns The resolved setting value.
1013
+ */
1014
+ declare function resolvePluginSetting(api: PluginApi, pluginId: string, key: string, envVar: string, fallback: string): string;
1015
+ /**
1016
+ * Resolve an optional plugin setting via the two-step fallback chain:
1017
+ * plugin config → environment variable. Returns `undefined` if neither
1018
+ * source provides a value.
1019
+ *
1020
+ * @param api - Plugin API object.
1021
+ * @param pluginId - Plugin identifier (e.g., 'jeeves-watcher-openclaw').
1022
+ * @param key - Config key within the plugin's config object.
1023
+ * @param envVar - Environment variable name.
1024
+ * @returns The resolved setting value, or `undefined`.
1025
+ */
1026
+ declare function resolveOptionalPluginSetting(api: PluginApi, pluginId: string, key: string, envVar: string): string | undefined;
1027
+
1068
1028
  /**
1069
1029
  * Tool result formatters for the OpenClaw plugin SDK.
1070
1030
  *
@@ -1103,5 +1063,5 @@ declare function fail(error: unknown): ToolResult;
1103
1063
  */
1104
1064
  declare function connectionFail(error: unknown, baseUrl: string, pluginId: string): ToolResult;
1105
1065
 
1106
- export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, COMPONENT_VERSIONS_FILE, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_CORE_VERSION, DEFAULT_PORTS, META_PORT, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SOUL_MARKERS, STALENESS_THRESHOLD_MS, STALE_LOCK_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_FILES, atomicWrite, checkRegistryVersion, connectionFail, coreConfigSchema, createAsyncContentCache, createComponentWriter, createConfigQueryHandler, fail, fetchJson, formatBeginMarker, formatEndMarker, generateJsonSchema, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getServiceUrl, getWorkspacePath, init, jaccard, needsCleanup, ok, parseManaged, patchConfig, postJson, probeAllServices, probeService, readComponentVersions, refreshPlatformContent, removeManagedSection, resetInit, resolveConfigPath, resolveOpenClawHome, resolvePluginSetting, resolveWorkspacePath, seedContent, shingles, shouldWrite, updateManagedSection, withFileLock, writeComponentVersion };
1107
- export type { AsyncContentCacheOptions, ComponentVersionEntry, ComponentVersionsState, ConfigQueryHandler, ConfigQueryResponse, CoreConfig, CreateComponentWriterOptions, InitOptions, JeevesComponent, ManagedMarkers, ManagedSection, ParseManagedResult, PluginApi, PluginApiLike, PluginCommands, ProbeResult, RefreshPlatformContentOptions, RemoveManagedSectionOptions, SectionId, SeedContentOptions, ServiceCommands, ServiceStatus, ToolDescriptor, ToolRegistrationOptions, ToolResult, UpdateManagedSectionOptions, VersionStamp, WriteComponentVersionOptions };
1066
+ export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, COMPONENT_VERSIONS_FILE, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_CORE_VERSION, DEFAULT_PORTS, META_PORT, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SOUL_MARKERS, STALENESS_THRESHOLD_MS, STALE_LOCK_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_FILES, atomicWrite, checkRegistryVersion, connectionFail, coreConfigSchema, createAsyncContentCache, createComponentWriter, createConfigQueryHandler, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getServiceUrl, getWorkspacePath, init, jaccard, needsCleanup, ok, parseManaged, patchConfig, postJson, readComponentVersions, refreshPlatformContent, removeManagedSection, resetInit, resolveConfigPath, resolveOpenClawHome, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, seedContent, shingles, shouldWrite, updateManagedSection, withFileLock, writeComponentVersion };
1067
+ export type { AsyncContentCacheOptions, ComponentVersionEntry, ComponentVersionsState, ConfigQueryHandler, ConfigQueryResponse, CoreConfig, InitOptions, JeevesComponent, ManagedMarkers, ManagedSection, ParseManagedResult, PluginApi, PluginCommands, RefreshPlatformContentOptions, RemoveManagedSectionOptions, SectionId, SeedContentOptions, ServiceCommands, ServiceStatus, ToolDescriptor, ToolRegistrationOptions, ToolResult, UpdateManagedSectionOptions, VersionStamp, WriteComponentVersionOptions };