@karmaniverous/jeeves 0.1.3 → 0.1.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
@@ -183,6 +183,48 @@ interface CreateComponentWriterOptions {
183
183
  */
184
184
  declare function createComponentWriter(component: JeevesComponent, options?: CreateComponentWriterOptions): ComponentWriter;
185
185
 
186
+ /**
187
+ * Resolve the OpenClaw workspace root from the plugin API.
188
+ *
189
+ * @remarks
190
+ * Tries three sources in order:
191
+ * 1. `api.resolvePath('.')` — the gateway-provided resolver (most authoritative)
192
+ * 2. `api.config.agents.defaults.workspace` — the OpenClaw config value
193
+ * 3. `process.cwd()` — last resort (unsafe when gateway runs from system32)
194
+ *
195
+ * Plugins should call this once at registration time and pass the result
196
+ * to `init({ workspacePath })`.
197
+ */
198
+ /**
199
+ * Minimal shape of the OpenClaw plugin API needed for workspace resolution.
200
+ *
201
+ * @remarks
202
+ * Intentionally loose — plugins define their own full `PluginApi` type.
203
+ * This captures only the fields `resolveWorkspacePath` inspects.
204
+ */
205
+ interface PluginApiLike {
206
+ /** Gateway-provided path resolver. May not exist in all gateway versions. */
207
+ resolvePath?: (input: string) => string;
208
+ /** OpenClaw configuration object. */
209
+ config?: {
210
+ /** Agent configuration block. */
211
+ agents?: {
212
+ /** Default agent settings. */
213
+ defaults?: {
214
+ /** Absolute path to the workspace root directory. */
215
+ workspace?: string;
216
+ };
217
+ };
218
+ };
219
+ }
220
+ /**
221
+ * Resolve the workspace root from the OpenClaw plugin API.
222
+ *
223
+ * @param api - The plugin API object provided by the gateway at registration.
224
+ * @returns Absolute path to the workspace root.
225
+ */
226
+ declare function resolveWorkspacePath(api: PluginApiLike): string;
227
+
186
228
  /**
187
229
  * Comment markers for managed content blocks.
188
230
  *
@@ -726,5 +768,5 @@ interface SeedContentOptions {
726
768
  */
727
769
  declare function seedContent(options: SeedContentOptions): Promise<void>;
728
770
 
729
- export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_PORTS, META_PORT, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SOUL_MARKERS, STALENESS_THRESHOLD_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_FILES, checkRegistryVersion, coreConfigSchema, createAsyncContentCache, createComponentWriter, formatBeginMarker, formatEndMarker, generateJsonSchema, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getServiceUrl, getWorkspacePath, init, jaccard, needsCleanup, parseManaged, probeAllServices, probeService, refreshPlatformContent, resetInit, seedContent, shingles, shouldWrite, updateManagedSection };
730
- export type { AsyncContentCacheOptions, CoreConfig, CreateComponentWriterOptions, InitOptions, JeevesComponent, ManagedSection, ParseManagedResult, PluginCommands, ProbeResult, RefreshPlatformContentOptions, SectionId, SeedContentOptions, ServiceCommands, ServiceStatus, UpdateManagedSectionOptions, VersionStamp };
771
+ export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_PORTS, META_PORT, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SOUL_MARKERS, STALENESS_THRESHOLD_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_FILES, checkRegistryVersion, coreConfigSchema, createAsyncContentCache, createComponentWriter, formatBeginMarker, formatEndMarker, generateJsonSchema, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getServiceUrl, getWorkspacePath, init, jaccard, needsCleanup, parseManaged, probeAllServices, probeService, refreshPlatformContent, resetInit, resolveWorkspacePath, seedContent, shingles, shouldWrite, updateManagedSection };
772
+ export type { AsyncContentCacheOptions, CoreConfig, CreateComponentWriterOptions, InitOptions, JeevesComponent, ManagedSection, ParseManagedResult, PluginApiLike, PluginCommands, ProbeResult, RefreshPlatformContentOptions, SectionId, SeedContentOptions, ServiceCommands, ServiceStatus, UpdateManagedSectionOptions, VersionStamp };
package/dist/index.js CHANGED
@@ -1606,6 +1606,38 @@ function createComponentWriter(component, options) {
1606
1606
  return new ComponentWriter(component, options?.probeTimeoutMs);
1607
1607
  }
1608
1608
 
1609
+ /**
1610
+ * Resolve the OpenClaw workspace root from the plugin API.
1611
+ *
1612
+ * @remarks
1613
+ * Tries three sources in order:
1614
+ * 1. `api.resolvePath('.')` — the gateway-provided resolver (most authoritative)
1615
+ * 2. `api.config.agents.defaults.workspace` — the OpenClaw config value
1616
+ * 3. `process.cwd()` — last resort (unsafe when gateway runs from system32)
1617
+ *
1618
+ * Plugins should call this once at registration time and pass the result
1619
+ * to `init({ workspacePath })`.
1620
+ */
1621
+ /**
1622
+ * Resolve the workspace root from the OpenClaw plugin API.
1623
+ *
1624
+ * @param api - The plugin API object provided by the gateway at registration.
1625
+ * @returns Absolute path to the workspace root.
1626
+ */
1627
+ function resolveWorkspacePath(api) {
1628
+ // 1. Gateway-provided resolver (most authoritative)
1629
+ if (typeof api.resolvePath === 'function') {
1630
+ return api.resolvePath('.');
1631
+ }
1632
+ // 2. OpenClaw config value
1633
+ const configured = api.config?.agents?.defaults?.workspace;
1634
+ if (typeof configured === 'string' && configured.trim()) {
1635
+ return configured;
1636
+ }
1637
+ // 3. Last resort — unsafe when gateway runs from system32
1638
+ return process.cwd();
1639
+ }
1640
+
1609
1641
  /**
1610
1642
  * One-shot content seeding used by the CLI install command.
1611
1643
  *
@@ -1659,4 +1691,4 @@ async function seedContent(options) {
1659
1691
  });
1660
1692
  }
1661
1693
 
1662
- export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_PORTS, META_PORT, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SOUL_MARKERS, STALENESS_THRESHOLD_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_FILES, checkRegistryVersion, coreConfigSchema, createAsyncContentCache, createComponentWriter, formatBeginMarker, formatEndMarker, generateJsonSchema, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getServiceUrl, getWorkspacePath, init, jaccard, needsCleanup, parseManaged, probeAllServices, probeService, refreshPlatformContent, resetInit, seedContent, shingles, shouldWrite, updateManagedSection };
1694
+ export { AGENTS_MARKERS, CLEANUP_FLAG, COMPONENT_CONFIG_PREFIX, CONFIG_FILE, CORE_CONFIG_DIR, CORE_VERSION, ComponentWriter, DEFAULT_PORTS, META_PORT, REGISTRY_CACHE_FILE, RUNNER_PORT, SECTION_IDS, SECTION_ORDER, SERVER_PORT, SOUL_MARKERS, STALENESS_THRESHOLD_MS, TEMPLATES_DIR, TOOLS_MARKERS, VERSION_STAMP_PATTERN, WATCHER_PORT, WORKSPACE_FILES, checkRegistryVersion, coreConfigSchema, createAsyncContentCache, createComponentWriter, formatBeginMarker, formatEndMarker, generateJsonSchema, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getServiceUrl, getWorkspacePath, init, jaccard, needsCleanup, parseManaged, probeAllServices, probeService, refreshPlatformContent, resetInit, resolveWorkspacePath, seedContent, shingles, shouldWrite, updateManagedSection };
package/package.json CHANGED
@@ -138,5 +138,5 @@
138
138
  },
139
139
  "type": "module",
140
140
  "types": "dist/index.d.ts",
141
- "version": "0.1.3"
141
+ "version": "0.1.4"
142
142
  }