@karmaniverous/jeeves-meta 0.15.3 → 0.15.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.
Files changed (89) hide show
  1. package/dist/archive/index.d.ts +10 -0
  2. package/dist/archive/listArchive.d.ts +12 -0
  3. package/dist/archive/prune.d.ts +14 -0
  4. package/dist/archive/readArchive.d.ts +30 -0
  5. package/dist/archive/readLatest.d.ts +13 -0
  6. package/dist/archive/snapshot.d.ts +17 -0
  7. package/dist/bootstrap.d.ts +15 -0
  8. package/dist/cache.d.ts +22 -0
  9. package/dist/cli/jeeves-meta/architect.md +17 -0
  10. package/dist/cli/jeeves-meta/index.js +811 -734
  11. package/dist/cli.d.ts +10 -0
  12. package/dist/configHotReload.d.ts +30 -0
  13. package/dist/configLoader.d.ts +37 -0
  14. package/dist/constants.d.ts +13 -0
  15. package/dist/customCliCommands.d.ts +13 -0
  16. package/dist/descriptor.d.ts +19 -0
  17. package/dist/discovery/buildMinimalNode.d.ts +22 -0
  18. package/dist/discovery/computeSummary.d.ts +17 -0
  19. package/dist/discovery/discoverMetas.d.ts +19 -0
  20. package/dist/discovery/index.d.ts +11 -0
  21. package/dist/discovery/listMetas.d.ts +63 -0
  22. package/dist/discovery/ownershipTree.d.ts +25 -0
  23. package/dist/discovery/scope.d.ts +47 -0
  24. package/dist/discovery/types.d.ts +25 -0
  25. package/dist/ema.d.ts +14 -0
  26. package/dist/errors.d.ts +15 -0
  27. package/dist/escapeGlob.d.ts +23 -0
  28. package/dist/executor/GatewayExecutor.d.ts +48 -0
  29. package/dist/executor/SpawnAbortedError.d.ts +9 -0
  30. package/dist/executor/SpawnTimeoutError.d.ts +13 -0
  31. package/dist/executor/index.d.ts +8 -0
  32. package/dist/index.d.ts +34 -1660
  33. package/dist/index.js +1434 -1767
  34. package/dist/interfaces/MetaContext.d.ts +36 -0
  35. package/dist/interfaces/MetaExecutor.d.ts +46 -0
  36. package/dist/interfaces/WatcherClient.d.ts +75 -0
  37. package/dist/interfaces/index.d.ts +8 -0
  38. package/dist/lock.d.ts +70 -0
  39. package/dist/logger/index.d.ts +27 -0
  40. package/dist/mtimeFilter.d.ts +26 -0
  41. package/dist/normalizePath.d.ts +6 -0
  42. package/dist/orchestrator/buildTask.d.ts +38 -0
  43. package/dist/orchestrator/contextPackage.d.ts +30 -0
  44. package/dist/orchestrator/index.d.ts +10 -0
  45. package/dist/orchestrator/orchestratePhase.d.ts +38 -0
  46. package/dist/orchestrator/parseOutput.d.ts +41 -0
  47. package/dist/orchestrator/runPhase.d.ts +40 -0
  48. package/dist/phaseState/derivePhaseState.d.ts +41 -0
  49. package/dist/phaseState/index.d.ts +9 -0
  50. package/dist/phaseState/invalidate.d.ts +41 -0
  51. package/dist/phaseState/phaseScheduler.d.ts +57 -0
  52. package/dist/phaseState/phaseTransitions.d.ts +83 -0
  53. package/dist/progress/index.d.ts +38 -0
  54. package/dist/prompts/architect.md +17 -0
  55. package/dist/prompts/index.d.ts +15 -0
  56. package/dist/queue/index.d.ts +131 -0
  57. package/dist/readMetaJson.d.ts +17 -0
  58. package/dist/routes/__testUtils.d.ts +37 -0
  59. package/dist/routes/config.d.ts +11 -0
  60. package/dist/routes/configApply.d.ts +13 -0
  61. package/dist/routes/index.d.ts +50 -0
  62. package/dist/routes/metas.d.ts +9 -0
  63. package/dist/routes/metasUpdate.d.ts +11 -0
  64. package/dist/routes/preview.d.ts +8 -0
  65. package/dist/routes/queue.d.ts +13 -0
  66. package/dist/routes/seed.d.ts +8 -0
  67. package/dist/routes/status.d.ts +13 -0
  68. package/dist/routes/synthesize.d.ts +12 -0
  69. package/dist/routes/unlock.d.ts +8 -0
  70. package/dist/rules/healthCheck.d.ts +36 -0
  71. package/dist/rules/index.d.ts +39 -0
  72. package/dist/rules/verify.d.ts +22 -0
  73. package/dist/scheduler/index.d.ts +66 -0
  74. package/dist/scheduling/index.d.ts +7 -0
  75. package/dist/scheduling/staleness.d.ts +68 -0
  76. package/dist/scheduling/weightedFormula.d.ts +38 -0
  77. package/dist/schema/config.d.ts +54 -0
  78. package/dist/schema/error.d.ts +6 -0
  79. package/dist/schema/index.d.ts +8 -0
  80. package/dist/schema/meta.d.ts +71 -0
  81. package/dist/seed/autoSeed.d.ts +30 -0
  82. package/dist/seed/createMeta.d.ts +38 -0
  83. package/dist/seed/index.d.ts +7 -0
  84. package/dist/server.d.ts +24 -0
  85. package/dist/shutdown/index.d.ts +33 -0
  86. package/dist/structureHash.d.ts +15 -0
  87. package/dist/watcher-client/HttpWatcherClient.d.ts +38 -0
  88. package/dist/watcher-client/index.d.ts +6 -0
  89. package/package.json +17 -27
package/dist/cli.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Commander CLI for jeeves-meta service.
3
+ *
4
+ * Uses `createServiceCli` from the core SDK for standard commands
5
+ * (start, status, config, init, service). Custom domain-specific
6
+ * commands are registered via `descriptor.customCliCommands`.
7
+ *
8
+ * @module cli
9
+ */
10
+ export {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Shared live config hot-reload support.
3
+ *
4
+ * Used by both file-watch reloads in bootstrap and POST /config/apply
5
+ * via the component descriptor's onConfigApply callback.
6
+ *
7
+ * @module configHotReload
8
+ */
9
+ import type { Logger } from 'pino';
10
+ import type { Scheduler } from './scheduler/index.js';
11
+ import type { ServiceConfig } from './schema/config.js';
12
+ /**
13
+ * Fields that require a service restart to take effect.
14
+ *
15
+ * Shared between the descriptor's `onConfigApply` and the file-watcher
16
+ * hot-reload in `bootstrap.ts`.
17
+ */
18
+ export declare const RESTART_REQUIRED_FIELDS: readonly ["port", "watcherUrl", "gatewayUrl", "gatewayApiKey", "defaultArchitect", "defaultCritic"];
19
+ interface ConfigHotReloadRuntime {
20
+ config: ServiceConfig;
21
+ logger: Logger;
22
+ scheduler: Scheduler | null;
23
+ }
24
+ /** Register the active service runtime for config-apply hot reload. */
25
+ export declare function registerConfigHotReloadRuntime(nextRuntime: ConfigHotReloadRuntime): void;
26
+ /** Clear the registered runtime. Primarily for tests. */
27
+ export declare function clearConfigHotReloadRuntime(): void;
28
+ /** Apply hot-reloadable config changes to the live shared config object. */
29
+ export declare function applyHotReloadedConfig(newConfig: ServiceConfig): void;
30
+ export {};
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Load and resolve jeeves-meta service config.
3
+ *
4
+ * Supports \@file: indirection and environment-variable substitution (dollar-brace pattern).
5
+ *
6
+ * @module configLoader
7
+ */
8
+ import { type ServiceConfig } from './schema/config.js';
9
+ /**
10
+ * Migrate legacy config path to the new canonical location.
11
+ *
12
+ * If the old path `{configRoot}/jeeves-meta.config.json` exists and the new
13
+ * path `{configRoot}/jeeves-meta/config.json` does NOT exist, copies the file
14
+ * to the new location and logs a warning.
15
+ *
16
+ * @param configRoot - Root directory for configuration files.
17
+ * @param warn - Optional callback for logging the migration warning.
18
+ */
19
+ export declare function migrateConfigPath(configRoot: string, warn?: (msg: string) => void): void;
20
+ /**
21
+ * Resolve config path from --config flag or JEEVES_META_CONFIG env var.
22
+ *
23
+ * @param args - CLI arguments (process.argv.slice(2)).
24
+ * @returns Resolved config path.
25
+ * @throws If no config path found.
26
+ */
27
+ export declare function resolveConfigPath(args: string[]): string;
28
+ /**
29
+ * Load service config from a JSON file.
30
+ *
31
+ * Resolves \@file: references for defaultArchitect and defaultCritic,
32
+ * and substitutes environment-variable placeholders throughout.
33
+ *
34
+ * @param configPath - Path to config JSON file.
35
+ * @returns Validated ServiceConfig.
36
+ */
37
+ export declare function loadServiceConfig(configPath: string): ServiceConfig;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Shared constants for the jeeves-meta service package.
3
+ *
4
+ * @module constants
5
+ */
6
+ /** Default HTTP port for the jeeves-meta service. */
7
+ export declare const DEFAULT_PORT: 1938;
8
+ /** Default port as a string (for Commander CLI defaults). */
9
+ export declare const DEFAULT_PORT_STR: string;
10
+ /** Service name identifier. */
11
+ export declare const SERVICE_NAME = "jeeves-meta";
12
+ /** Service version, read from package.json at startup. */
13
+ export declare const SERVICE_VERSION: string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Custom CLI commands for the jeeves-meta service.
3
+ *
4
+ * Registered via `descriptor.customCliCommands` and added to the
5
+ * standard service CLI produced by `createServiceCli`.
6
+ *
7
+ * @module customCliCommands
8
+ */
9
+ import { type Command } from 'commander';
10
+ /** Build the full API URL for a given port string and path. */
11
+ export declare function apiUrl(port: string, apiPath: string): string;
12
+ /** Register all custom meta commands on the parent program. */
13
+ export declare function registerCustomCliCommands(program: Command): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Jeeves component descriptor for jeeves-meta.
3
+ *
4
+ * Single source of truth consumed by the service CLI, plugin writer, and
5
+ * config-apply pipeline.
6
+ *
7
+ * @module descriptor
8
+ */
9
+ import { type JeevesComponentDescriptor } from '@karmaniverous/jeeves';
10
+ import { RESTART_REQUIRED_FIELDS } from './configHotReload.js';
11
+ import { loadServiceConfig } from './configLoader.js';
12
+ import { type ServiceConfig } from './schema/config.js';
13
+ export { RESTART_REQUIRED_FIELDS };
14
+ /**
15
+ * Parsed jeeves-meta component descriptor.
16
+ */
17
+ export declare const metaDescriptor: JeevesComponentDescriptor;
18
+ export type { ServiceConfig };
19
+ export { loadServiceConfig };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Build a minimal MetaNode from a known meta path using watcher walk.
3
+ *
4
+ * Used for targeted synthesis (when a specific path is requested) to avoid
5
+ * the full discovery + ownership tree build. Discovers only immediate child
6
+ * `.meta/` directories.
7
+ *
8
+ * @module discovery/buildMinimalNode
9
+ */
10
+ import type { WatcherClient } from '../interfaces/index.js';
11
+ import type { MetaNode } from './types.js';
12
+ /**
13
+ * Build a minimal MetaNode for a known meta path.
14
+ *
15
+ * Walks the owner directory for child `.meta/meta.json` files and constructs
16
+ * a shallow ownership tree (self + direct children only).
17
+ *
18
+ * @param metaPath - Absolute path to the `.meta/` directory.
19
+ * @param watcher - WatcherClient for filesystem enumeration.
20
+ * @returns MetaNode with direct children wired.
21
+ */
22
+ export declare function buildMinimalNode(metaPath: string, watcher: WatcherClient): Promise<MetaNode>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Compute summary statistics from an array of MetaEntry objects.
3
+ *
4
+ * Shared between listMetas() (full list) and route handlers (filtered lists).
5
+ *
6
+ * @module discovery/computeSummary
7
+ */
8
+ import type { MetaListSummary } from '@karmaniverous/jeeves-meta-core';
9
+ import type { MetaEntry } from './listMetas.js';
10
+ /**
11
+ * Compute summary statistics from a list of meta entries.
12
+ *
13
+ * @param entries - Enriched meta entries (full or filtered).
14
+ * @param depthWeight - Config depth weight for effective staleness calculation.
15
+ * @returns Aggregated summary statistics.
16
+ */
17
+ export declare function computeSummary(entries: MetaEntry[], depthWeight: number): MetaListSummary;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Discover .meta/ directories via watcher `/walk` endpoint.
3
+ *
4
+ * Uses filesystem enumeration through the watcher (not Qdrant) to find
5
+ * all `.meta/meta.json` files and returns deduplicated meta directory paths.
6
+ *
7
+ * @module discovery/discoverMetas
8
+ */
9
+ import type { WatcherClient } from '../interfaces/index.js';
10
+ /**
11
+ * Discover all .meta/ directories via watcher walk.
12
+ *
13
+ * Uses the watcher's `/walk` endpoint to find all `.meta/meta.json` files
14
+ * and returns deduplicated meta directory paths.
15
+ *
16
+ * @param watcher - WatcherClient for walk queries.
17
+ * @returns Array of normalized .meta/ directory paths.
18
+ */
19
+ export declare function discoverMetas(watcher: WatcherClient): Promise<string[]>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Discovery module — glob .meta/ directories and build ownership tree.
3
+ *
4
+ * @module discovery
5
+ */
6
+ export { computeSummary } from './computeSummary.js';
7
+ export { discoverMetas } from './discoverMetas.js';
8
+ export { listMetas, type MetaEntry, type MetaListResult, type MetaListSummary, } from './listMetas.js';
9
+ export { buildOwnershipTree, findNode } from './ownershipTree.js';
10
+ export { filterInScope, getDeltaFiles, getScopeFiles, getScopePrefix, } from './scope.js';
11
+ export type { MetaNode, OwnershipTree } from './types.js';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Unified meta listing: scan, dedup, enrich.
3
+ *
4
+ * Single source of truth for all consumers that need a list of metas
5
+ * with enriched metadata. Replaces duplicated scan+dedup logic in
6
+ * plugin tools, CLI, and prompt injection.
7
+ *
8
+ * @module discovery/listMetas
9
+ */
10
+ import type { MetaListSummary } from '@karmaniverous/jeeves-meta-core';
11
+ import type { WatcherClient } from '../interfaces/index.js';
12
+ import type { MetaConfig, MetaJson } from '../schema/index.js';
13
+ import type { MetaNode, OwnershipTree } from './types.js';
14
+ /** Enriched meta entry returned by listMetas(). */
15
+ export interface MetaEntry {
16
+ /** Normalized .meta/ directory path. */
17
+ path: string;
18
+ /** Tree depth (0 = leaf, higher = more abstract). */
19
+ depth: number;
20
+ /** Scheduling emphasis multiplier. */
21
+ emphasis: number;
22
+ /** Seconds since last synthesis, or Infinity if never synthesized. */
23
+ stalenessSeconds: number;
24
+ /** ISO timestamp of last synthesis, or null. */
25
+ lastSynthesized: string | null;
26
+ /** Whether the last synthesis had an error. */
27
+ hasError: boolean;
28
+ /** Whether this meta is currently locked. */
29
+ locked: boolean;
30
+ /** Whether this meta is disabled (skipped during staleness scheduling). */
31
+ disabled: boolean;
32
+ /** Cumulative architect tokens, or null if never run. */
33
+ architectTokens: number | null;
34
+ /** Cumulative builder tokens, or null if never run. */
35
+ builderTokens: number | null;
36
+ /** Cumulative critic tokens, or null if never run. */
37
+ criticTokens: number | null;
38
+ /** Number of direct children in the ownership tree. */
39
+ children: number;
40
+ /** The underlying MetaNode from the ownership tree. */
41
+ node: MetaNode;
42
+ /** The parsed meta.json content. */
43
+ meta: MetaJson;
44
+ }
45
+ export type { MetaListSummary };
46
+ /** Full result from listMetas(). */
47
+ export interface MetaListResult {
48
+ summary: MetaListSummary;
49
+ entries: MetaEntry[];
50
+ tree: OwnershipTree;
51
+ }
52
+ /**
53
+ * Discover, deduplicate, and enrich all metas.
54
+ *
55
+ * This is the single consolidated function that replaces all duplicated
56
+ * scan+dedup+enrich logic across the codebase. All enrichment comes from
57
+ * reading meta.json on disk (the canonical source).
58
+ *
59
+ * @param config - Validated synthesis config.
60
+ * @param watcher - Watcher HTTP client for discovery.
61
+ * @returns Enriched meta list with summary statistics and ownership tree.
62
+ */
63
+ export declare function listMetas(config: MetaConfig, watcher: WatcherClient): Promise<MetaListResult>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Build the ownership tree from discovered .meta/ paths.
3
+ *
4
+ * Each .meta/ directory owns its parent directory and all descendants,
5
+ * except subtrees that contain their own .meta/. For those subtrees,
6
+ * the parent meta consumes the child meta's synthesis output.
7
+ *
8
+ * @module discovery/ownershipTree
9
+ */
10
+ import type { MetaNode, OwnershipTree } from './types.js';
11
+ /**
12
+ * Build an ownership tree from an array of .meta/ directory paths.
13
+ *
14
+ * @param metaPaths - Absolute paths to .meta/ directories.
15
+ * @returns The ownership tree with parent/child relationships.
16
+ */
17
+ export declare function buildOwnershipTree(metaPaths: string[]): OwnershipTree;
18
+ /**
19
+ * Find a node in the ownership tree by meta path or owner path.
20
+ *
21
+ * @param tree - The ownership tree to search.
22
+ * @param targetPath - Path to search for (meta path or owner path).
23
+ * @returns The matching node, or undefined if not found.
24
+ */
25
+ export declare function findNode(tree: OwnershipTree, targetPath: string): MetaNode | undefined;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Compute the file scope owned by a meta node.
3
+ *
4
+ * A meta owns: parent dir + all descendants, minus:
5
+ * - Its own .meta/ subtree (outputs, not inputs)
6
+ * - Child meta ownerPath subtrees (except their .meta/meta.json for rollups)
7
+ *
8
+ * All filesystem enumeration delegated to the watcher's `/walk` endpoint.
9
+ *
10
+ * @module discovery/scope
11
+ */
12
+ import type { WatcherClient } from '../interfaces/index.js';
13
+ import type { MinimalLogger } from '../logger/index.js';
14
+ import type { MetaNode } from './types.js';
15
+ /**
16
+ * Get the scope path prefix for a meta node.
17
+ */
18
+ export declare function getScopePrefix(node: MetaNode): string;
19
+ /**
20
+ * Filter a list of file paths to only those in scope for a meta node.
21
+ *
22
+ * Excludes:
23
+ * - The node's own .meta/ subtree (synthesis outputs are not scope inputs)
24
+ * - Child meta ownerPath subtrees (except child .meta/meta.json for rollups)
25
+ *
26
+ * Watcher walk returns normalized forward-slash paths.
27
+ */
28
+ export declare function filterInScope(node: MetaNode, files: string[]): string[];
29
+ /** Result of getScopeFiles. */
30
+ interface ScopeFilesResult {
31
+ /** Files directly owned by this meta (excluding child subtrees and own .meta/). */
32
+ scopeFiles: string[];
33
+ /** All files under the owner path (including child subtrees). */
34
+ allFiles: string[];
35
+ }
36
+ /**
37
+ * Get all files in scope for a meta node via watcher walk.
38
+ */
39
+ export declare function getScopeFiles(node: MetaNode, watcher: WatcherClient, logger?: MinimalLogger): Promise<ScopeFilesResult>;
40
+ /**
41
+ * Get files modified since a given timestamp within a meta node's scope.
42
+ *
43
+ * If no generatedAt is provided (first run), returns all scope files.
44
+ * Reuses scope files from getScopeFiles() and filters locally by mtime.
45
+ */
46
+ export declare function getDeltaFiles(generatedAt: string | undefined, scopeFiles: string[]): string[];
47
+ export {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Types for meta discovery and ownership tree.
3
+ *
4
+ * @module discovery/types
5
+ */
6
+ /** A discovered meta node in the ownership tree. */
7
+ export interface MetaNode {
8
+ /** Absolute path to the .meta directory. */
9
+ metaPath: string;
10
+ /** Absolute path to the parent directory that this meta owns. */
11
+ ownerPath: string;
12
+ /** Depth in the ownership tree (root = 0). */
13
+ treeDepth: number;
14
+ /** Child meta nodes (subtrees with their own .meta/). */
15
+ children: MetaNode[];
16
+ /** Parent meta node, or null for roots. */
17
+ parent: MetaNode | null;
18
+ }
19
+ /** The full ownership tree discovered from watchPaths. */
20
+ export interface OwnershipTree {
21
+ /** All discovered meta nodes, keyed by metaPath. */
22
+ nodes: Map<string, MetaNode>;
23
+ /** Root nodes (metas with no parent meta). */
24
+ roots: MetaNode[];
25
+ }
package/dist/ema.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Exponential moving average helper for token tracking.
3
+ *
4
+ * @module ema
5
+ */
6
+ /**
7
+ * Compute exponential moving average.
8
+ *
9
+ * @param current - New observation.
10
+ * @param previous - Previous EMA value, or undefined for first observation.
11
+ * @param decay - Decay factor (0-1). Higher = more weight on new value. Default 0.3.
12
+ * @returns Updated EMA.
13
+ */
14
+ export declare function computeEma(current: number, previous: number | undefined, decay?: number): number;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Shared error utilities.
3
+ *
4
+ * @module errors
5
+ */
6
+ import type { MetaError } from './schema/index.js';
7
+ /**
8
+ * Wrap an unknown caught value into a MetaError.
9
+ *
10
+ * @param step - Which synthesis step failed.
11
+ * @param err - The caught error value.
12
+ * @param code - Error classification code.
13
+ * @returns A structured MetaError.
14
+ */
15
+ export declare function toMetaError(step: MetaError['step'], err: unknown, code?: string): MetaError;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Escape special glob characters in a path so it can be used as a literal
3
+ * prefix in glob patterns.
4
+ *
5
+ * Glob metacharacters `* ? [ ] { } ( ) !` are escaped with a backslash so
6
+ * that paths containing parentheses (e.g. Slack channel IDs) or other
7
+ * special characters are matched literally by the watcher's walk endpoint.
8
+ *
9
+ * @module escapeGlob
10
+ */
11
+ /**
12
+ * Escape glob metacharacters in a string using character-class wrapping.
13
+ *
14
+ * Backslash escaping (`\(`) does not work reliably on Windows where `\` is
15
+ * the path separator. Instead, each metacharacter is wrapped in a character
16
+ * class (e.g. `(` → `[(]`) which is universally supported by glob libraries.
17
+ *
18
+ * Square brackets themselves are escaped as `[[]` and `[]]`.
19
+ *
20
+ * @param s - Raw path string.
21
+ * @returns String with glob metacharacters wrapped in character classes.
22
+ */
23
+ export declare function escapeGlob(s: string): string;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * MetaExecutor implementation using the OpenClaw gateway HTTP API.
3
+ *
4
+ * Lives in the library package so both plugin and runner can import it.
5
+ * Spawns sub-agent sessions via the gateway's `/tools/invoke` endpoint,
6
+ * polls for completion, and extracts output text.
7
+ *
8
+ * @module executor/GatewayExecutor
9
+ */
10
+ import type { MetaExecutor, MetaSpawnOptions, MetaSpawnResult } from '../interfaces/index.js';
11
+ /** Options for the GatewayExecutor. */
12
+ export interface GatewayExecutorOptions {
13
+ /** OpenClaw gateway base URL. Default: http://127.0.0.1:18789 */
14
+ gatewayUrl?: string;
15
+ /** Bearer token for gateway authentication. */
16
+ apiKey?: string;
17
+ /** Polling interval in ms. Default: 5000. */
18
+ pollIntervalMs?: number;
19
+ /** Workspace directory for output staging. Default: OS temp dir + /jeeves-meta. */
20
+ workspaceDir?: string;
21
+ }
22
+ /**
23
+ * MetaExecutor that spawns OpenClaw sessions via the gateway's
24
+ * `/tools/invoke` endpoint.
25
+ *
26
+ * Used by both the OpenClaw plugin (in-process tool calls) and the
27
+ * runner/CLI (external invocation). Constructs from `gatewayUrl` and
28
+ * optional `apiKey` — typically sourced from `MetaConfig`.
29
+ */
30
+ export declare class GatewayExecutor implements MetaExecutor {
31
+ private readonly gatewayUrl;
32
+ private readonly apiKey;
33
+ private readonly pollIntervalMs;
34
+ private readonly workspaceDir;
35
+ private controller;
36
+ constructor(options?: GatewayExecutorOptions);
37
+ /** Remove a temp output file if it exists. */
38
+ private cleanupOutputFile;
39
+ /** Invoke a gateway tool via the /tools/invoke HTTP endpoint. */
40
+ private invoke;
41
+ /** Look up session metadata (tokens, completion status) via sessions_list. */
42
+ private getSessionInfo;
43
+ /** Whether this executor has been aborted by the operator. */
44
+ get aborted(): boolean;
45
+ /** Abort the currently running spawn, if any. */
46
+ abort(): void;
47
+ spawn(task: string, options?: MetaSpawnOptions): Promise<MetaSpawnResult>;
48
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Error thrown when a spawned subprocess is aborted via AbortController.
3
+ *
4
+ * @module executor/SpawnAbortedError
5
+ */
6
+ /** Error indicating a spawn was deliberately aborted. */
7
+ export declare class SpawnAbortedError extends Error {
8
+ constructor(message?: string);
9
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Error thrown when a spawned subprocess times out.
3
+ *
4
+ * Carries the output file path so callers can attempt partial output recovery.
5
+ *
6
+ * @module executor/SpawnTimeoutError
7
+ */
8
+ /** Error indicating a spawn timeout with a recoverable output path. */
9
+ export declare class SpawnTimeoutError extends Error {
10
+ /** Path to the (possibly partial) output file written before timeout. */
11
+ readonly outputPath: string;
12
+ constructor(message: string, outputPath: string);
13
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Re-exports for the executor module.
3
+ *
4
+ * @module executor
5
+ */
6
+ export { GatewayExecutor, type GatewayExecutorOptions, } from './GatewayExecutor.js';
7
+ export { SpawnAbortedError } from './SpawnAbortedError.js';
8
+ export { SpawnTimeoutError } from './SpawnTimeoutError.js';