@karmaniverous/jeeves 0.4.7 → 0.5.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/README.md +56 -3
- package/content/skill.md +105 -0
- package/dist/cli/jeeves/index.js +667 -159
- package/dist/cli/plugin/index.js +147 -5
- package/dist/cli/service/index.js +63 -7
- package/dist/index.d.ts +253 -9
- package/dist/index.js +779 -89
- package/package.json +2 -2
package/dist/cli/plugin/index.js
CHANGED
|
@@ -112,7 +112,13 @@ const WORKSPACE_FILES = {
|
|
|
112
112
|
agents: 'AGENTS.md',
|
|
113
113
|
/** HEARTBEAT.md — platform status and health alerts. */
|
|
114
114
|
heartbeat: 'HEARTBEAT.md',
|
|
115
|
+
/** MEMORY.md — curated long-term memory. */
|
|
116
|
+
memory: 'MEMORY.md',
|
|
115
117
|
};
|
|
118
|
+
/** Skill directory name within workspace. */
|
|
119
|
+
const SKILLS_DIR = 'skills';
|
|
120
|
+
/** Jeeves skill directory name. */
|
|
121
|
+
const JEEVES_SKILL_DIR = 'jeeves';
|
|
116
122
|
/** Component versions state file name. */
|
|
117
123
|
const COMPONENT_VERSIONS_FILE = 'component-versions.json';
|
|
118
124
|
|
|
@@ -120,14 +126,14 @@ const COMPONENT_VERSIONS_FILE = 'component-versions.json';
|
|
|
120
126
|
* Core library version, inlined at build time.
|
|
121
127
|
*
|
|
122
128
|
* @remarks
|
|
123
|
-
* The `0.
|
|
129
|
+
* The `0.5.0` placeholder is replaced by
|
|
124
130
|
* `@rollup/plugin-replace` during the build with the actual version
|
|
125
131
|
* from `package.json`. This ensures the correct version survives
|
|
126
132
|
* when consumers bundle core into their own dist (where runtime
|
|
127
133
|
* `import.meta.url`-based resolution would find the wrong package.json).
|
|
128
134
|
*/
|
|
129
135
|
/** The core library version from package.json (inlined at build time). */
|
|
130
|
-
const CORE_VERSION = '0.
|
|
136
|
+
const CORE_VERSION = '0.5.0';
|
|
131
137
|
|
|
132
138
|
/**
|
|
133
139
|
* Shared file I/O helpers for managed section operations.
|
|
@@ -396,7 +402,7 @@ function parseHeartbeat(fileContent) {
|
|
|
396
402
|
const userContent = fileContent.slice(0, headingIndex).trim();
|
|
397
403
|
const sectionContent = fileContent.slice(headingIndex + HEARTBEAT_HEADING.length);
|
|
398
404
|
const entries = [];
|
|
399
|
-
const h2Re = /^## (jeeves-\S
|
|
405
|
+
const h2Re = /^## (jeeves-\S+?|MEMORY\.md)(?:: declined)?$/gm;
|
|
400
406
|
let match;
|
|
401
407
|
const h2Positions = [];
|
|
402
408
|
while ((match = h2Re.exec(sectionContent)) !== null) {
|
|
@@ -708,6 +714,135 @@ function buildWithSections(beforeContent, userContent, sections, markers, coreVe
|
|
|
708
714
|
return parts.join('\n');
|
|
709
715
|
}
|
|
710
716
|
|
|
717
|
+
var skillContent = `---
|
|
718
|
+
name: jeeves
|
|
719
|
+
description: Jeeves platform architecture, data flow, component interaction, scripts repo, and coordination knowledge. Use when making architectural decisions, coordinating across components, checking platform health, managing service lifecycle, or working with the scripts repo.
|
|
720
|
+
---
|
|
721
|
+
|
|
722
|
+
# Jeeves Platform Skill
|
|
723
|
+
|
|
724
|
+
## Platform Architecture
|
|
725
|
+
|
|
726
|
+
Jeeves is a four-component platform coordinated by a shared library (\`@karmaniverous/jeeves\`):
|
|
727
|
+
|
|
728
|
+
| Component | Role | Port |
|
|
729
|
+
|-----------|------|------|
|
|
730
|
+
| **jeeves-runner** | Execute: scheduled jobs, SQLite state, HTTP API | 1937 |
|
|
731
|
+
| **jeeves-watcher** | Index: file→Qdrant semantic indexing, inference rules | 1936 |
|
|
732
|
+
| **jeeves-server** | Present: web UI, file browser, doc render, export | 1934 |
|
|
733
|
+
| **jeeves-meta** | Distill: LLM synthesis, .meta/ directories, scheduling | 1938 |
|
|
734
|
+
|
|
735
|
+
Core (\`@karmaniverous/jeeves\`) is a **library + CLI**, not a service. No port.
|
|
736
|
+
|
|
737
|
+
## Data Flow
|
|
738
|
+
|
|
739
|
+
\`\`\`
|
|
740
|
+
Files → Watcher (index) → Qdrant → Meta (synthesize) → .meta/ → Watcher (re-index)
|
|
741
|
+
↓
|
|
742
|
+
Runner (schedule) → Scripts → Services ← Server (present) ← Browser
|
|
743
|
+
\`\`\`
|
|
744
|
+
|
|
745
|
+
## Component Interaction
|
|
746
|
+
|
|
747
|
+
- **Watcher** indexes files into Qdrant with inference rules and enrichments.
|
|
748
|
+
- **Meta** reads from Qdrant, synthesizes \`.meta/\` directories, which watcher re-indexes.
|
|
749
|
+
- **Runner** executes scheduled scripts that may call any service's HTTP API.
|
|
750
|
+
- **Server** presents files, renders documents, and provides the event gateway.
|
|
751
|
+
- **Core** provides shared content management (TOOLS.md, SOUL.md, AGENTS.md), service discovery, config resolution, and the component SDK.
|
|
752
|
+
|
|
753
|
+
## Service Discovery
|
|
754
|
+
|
|
755
|
+
Services find each other via config resolution:
|
|
756
|
+
1. Component's own config file (\`{configRoot}/jeeves-{name}/config.json\`)
|
|
757
|
+
2. Core config file (\`{configRoot}/jeeves-core/config.json\`)
|
|
758
|
+
3. Default port constants
|
|
759
|
+
|
|
760
|
+
## Scripts Repo
|
|
761
|
+
|
|
762
|
+
Location: \`{configRoot}/jeeves-core/scripts/\`
|
|
763
|
+
Template: \`@karmaniverous/jeeves-scripts-template\`
|
|
764
|
+
|
|
765
|
+
Scripts use utilities from \`@karmaniverous/jeeves\` (general) and \`@karmaniverous/jeeves-runner\` (runner-specific). Any script that could be useful outside runner scheduling belongs in core.
|
|
766
|
+
|
|
767
|
+
## Managed Content System
|
|
768
|
+
|
|
769
|
+
Core maintains managed sections in workspace files using comment markers:
|
|
770
|
+
- **TOOLS.md** — Component sections (section mode) + Platform section
|
|
771
|
+
- **SOUL.md** — Professional discipline and behavioral foundations (block mode)
|
|
772
|
+
- **AGENTS.md** — Operational protocols and memory architecture (block mode)
|
|
773
|
+
- **HEARTBEAT.md** — Platform health status (heading-based)
|
|
774
|
+
|
|
775
|
+
Managed blocks are stationary after initial insertion. Cleanup detection uses Jaccard similarity on 3-word shingles. Cleanup escalation spawns a gateway session when orphaned content is detected.
|
|
776
|
+
|
|
777
|
+
## Workspace Configuration
|
|
778
|
+
|
|
779
|
+
\`jeeves.config.json\` at workspace root provides shared defaults:
|
|
780
|
+
- Precedence: CLI flags → env vars → file → defaults
|
|
781
|
+
- Namespaced: \`core.*\` (workspace, configRoot, gatewayUrl) and \`memory.*\` (budget, warningThreshold, staleDays)
|
|
782
|
+
- Inspect with \`jeeves config [jsonpath]\`
|
|
783
|
+
|
|
784
|
+
## HEARTBEAT Protocol
|
|
785
|
+
|
|
786
|
+
The HEARTBEAT system uses a state machine per component:
|
|
787
|
+
\`not_installed → deps_missing → config_missing → service_not_installed → service_stopped → healthy\`
|
|
788
|
+
|
|
789
|
+
Dependency-aware: hard deps block alerts, soft deps add informational notes. Declined components are tracked via heading suffix.
|
|
790
|
+
|
|
791
|
+
## Plugin Lifecycle
|
|
792
|
+
|
|
793
|
+
\`\`\`bash
|
|
794
|
+
# Core install (seed workspace content)
|
|
795
|
+
npx @karmaniverous/jeeves install
|
|
796
|
+
|
|
797
|
+
# Component plugin install
|
|
798
|
+
npx @karmaniverous/jeeves-{component}-openclaw install
|
|
799
|
+
|
|
800
|
+
# Component plugin uninstall
|
|
801
|
+
npx @karmaniverous/jeeves-{component}-openclaw uninstall
|
|
802
|
+
|
|
803
|
+
# Core uninstall (remove managed sections)
|
|
804
|
+
npx @karmaniverous/jeeves uninstall
|
|
805
|
+
\`\`\`
|
|
806
|
+
|
|
807
|
+
## Memory Hygiene
|
|
808
|
+
|
|
809
|
+
MEMORY.md has a character budget (default 20,000). Core tracks:
|
|
810
|
+
- Character count and usage percentage
|
|
811
|
+
- Warning at 80% of budget
|
|
812
|
+
- Stale section candidates (H2 sections whose most recent ISO date exceeds the staleness threshold)
|
|
813
|
+
- Evergreen sections (no dates) are never flagged
|
|
814
|
+
|
|
815
|
+
Review is human/agent-mediated — core does not auto-delete.
|
|
816
|
+
|
|
817
|
+
### HEARTBEAT Integration
|
|
818
|
+
|
|
819
|
+
Memory hygiene is checked on every \`ComponentWriter\` cycle alongside component health. When budget or staleness thresholds are breached, a \`## MEMORY.md\` alert appears in HEARTBEAT.md under \`# Jeeves Platform Status\`. The alert includes character count, budget usage percentage, and any stale section names. When memory is healthy, the heading is absent — no alert content, no LLM cost on heartbeat polls.
|
|
820
|
+
|
|
821
|
+
The \`## MEMORY.md\` heading follows the same declined/active lifecycle as component headings (\`## jeeves-{name}\`). Users can decline memory alerts by changing the heading to \`## MEMORY.md: declined\`.
|
|
822
|
+
`;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Skill seeding: write the `jeeves` workspace skill unconditionally.
|
|
826
|
+
*
|
|
827
|
+
* @remarks
|
|
828
|
+
* The skill file is entirely generated — no user-authored content (Decision 48).
|
|
829
|
+
* Every installer (core CLI and component plugins) writes it unconditionally.
|
|
830
|
+
* Content is inlined at build time via `rollup-plugin-md.ts`.
|
|
831
|
+
*/
|
|
832
|
+
/**
|
|
833
|
+
* Seed the jeeves workspace skill file.
|
|
834
|
+
*
|
|
835
|
+
* @param workspacePath - Workspace root directory.
|
|
836
|
+
*/
|
|
837
|
+
function seedSkill(workspacePath) {
|
|
838
|
+
const skillDir = join(workspacePath, SKILLS_DIR, JEEVES_SKILL_DIR);
|
|
839
|
+
if (!existsSync(skillDir)) {
|
|
840
|
+
mkdirSync(skillDir, { recursive: true });
|
|
841
|
+
}
|
|
842
|
+
const skillPath = join(skillDir, 'SKILL.md');
|
|
843
|
+
writeFileSync(skillPath, skillContent, 'utf-8');
|
|
844
|
+
}
|
|
845
|
+
|
|
711
846
|
/**
|
|
712
847
|
* OpenClaw configuration helpers for plugin CLI installers.
|
|
713
848
|
*
|
|
@@ -947,7 +1082,7 @@ function createPluginCli(options) {
|
|
|
947
1082
|
for (const msg of messages) {
|
|
948
1083
|
console.log(` ✓ ${msg}`);
|
|
949
1084
|
}
|
|
950
|
-
// 4. Write initial HEARTBEAT entry
|
|
1085
|
+
// 4. Write initial HEARTBEAT entry and seed jeeves skill
|
|
951
1086
|
try {
|
|
952
1087
|
const cfgRoot = opts.configRoot;
|
|
953
1088
|
const agents = config.agents;
|
|
@@ -977,10 +1112,17 @@ function createPluginCli(options) {
|
|
|
977
1112
|
catch {
|
|
978
1113
|
console.log(' ⚠ Could not write HEARTBEAT entry');
|
|
979
1114
|
}
|
|
1115
|
+
try {
|
|
1116
|
+
seedSkill(ws);
|
|
1117
|
+
console.log(' ✓ Jeeves skill seeded');
|
|
1118
|
+
}
|
|
1119
|
+
catch {
|
|
1120
|
+
console.log(' ⚠ Could not seed Jeeves skill');
|
|
1121
|
+
}
|
|
980
1122
|
}
|
|
981
1123
|
}
|
|
982
1124
|
catch {
|
|
983
|
-
// HEARTBEAT
|
|
1125
|
+
// HEARTBEAT + skill seeding are best-effort during install
|
|
984
1126
|
}
|
|
985
1127
|
// 5. Write component version
|
|
986
1128
|
try {
|
|
@@ -697,17 +697,73 @@ function createServiceManager(descriptor) {
|
|
|
697
697
|
}
|
|
698
698
|
|
|
699
699
|
/**
|
|
700
|
-
*
|
|
700
|
+
* Workspace-level shared configuration: `jeeves.config.json`.
|
|
701
701
|
*
|
|
702
702
|
* @remarks
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
703
|
+
* Lives at the OpenClaw workspace root alongside TOOLS.md and SOUL.md.
|
|
704
|
+
* Provides namespaced shared defaults consumed by the root Jeeves CLI.
|
|
705
|
+
* Resolution precedence: CLI flags → env vars → jeeves.config.json → defaults.
|
|
706
|
+
*
|
|
707
|
+
* This does not replace component-owned config schemas (Decision 41).
|
|
708
|
+
*/
|
|
709
|
+
/** Core shared config section. */
|
|
710
|
+
const workspaceCoreConfigSchema = z
|
|
711
|
+
.object({
|
|
712
|
+
/** Workspace root path. */
|
|
713
|
+
workspace: z.string().optional().describe('Workspace root path'),
|
|
714
|
+
/** Platform config root path. */
|
|
715
|
+
configRoot: z.string().optional().describe('Platform config root path'),
|
|
716
|
+
/** OpenClaw gateway URL. */
|
|
717
|
+
gatewayUrl: z.string().optional().describe('OpenClaw gateway URL'),
|
|
718
|
+
})
|
|
719
|
+
.partial();
|
|
720
|
+
/** Memory shared config section. */
|
|
721
|
+
const workspaceMemoryConfigSchema = z
|
|
722
|
+
.object({
|
|
723
|
+
/** MEMORY.md character budget. */
|
|
724
|
+
budget: z.number().int().positive().optional().describe('Memory budget'),
|
|
725
|
+
/** Warning threshold as a fraction of budget. */
|
|
726
|
+
warningThreshold: z
|
|
727
|
+
.number()
|
|
728
|
+
.min(0)
|
|
729
|
+
.max(1)
|
|
730
|
+
.optional()
|
|
731
|
+
.describe('Memory warning threshold'),
|
|
732
|
+
/** Staleness threshold in days. */
|
|
733
|
+
staleDays: z
|
|
734
|
+
.number()
|
|
735
|
+
.int()
|
|
736
|
+
.positive()
|
|
737
|
+
.optional()
|
|
738
|
+
.describe('Memory staleness threshold in days'),
|
|
739
|
+
})
|
|
740
|
+
.partial();
|
|
741
|
+
/** Workspace config Zod schema. */
|
|
742
|
+
z.object({
|
|
743
|
+
/** JSON Schema pointer for IDE autocomplete. */
|
|
744
|
+
$schema: z.string().optional().describe('JSON Schema pointer'),
|
|
745
|
+
/** Core shared defaults. */
|
|
746
|
+
core: workspaceCoreConfigSchema.optional(),
|
|
747
|
+
/** Memory hygiene shared defaults. */
|
|
748
|
+
memory: workspaceMemoryConfigSchema.optional(),
|
|
749
|
+
});
|
|
750
|
+
/** Built-in workspace config defaults. */
|
|
751
|
+
const WORKSPACE_CONFIG_DEFAULTS = {
|
|
752
|
+
core: {
|
|
753
|
+
workspace: '.',
|
|
754
|
+
configRoot: './config'}};
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Shared CLI defaults and resolution for Jeeves CLI commands.
|
|
758
|
+
*
|
|
759
|
+
* @remarks
|
|
760
|
+
* All root CLI commands share workspace/config-root resolution. Values follow
|
|
761
|
+
* the shared precedence model: flags → env → jeeves.config.json → defaults.
|
|
706
762
|
*/
|
|
707
|
-
/** Default workspace path
|
|
708
|
-
const DEFAULT_WORKSPACE =
|
|
763
|
+
/** Default workspace path. */
|
|
764
|
+
const DEFAULT_WORKSPACE = WORKSPACE_CONFIG_DEFAULTS.core.workspace;
|
|
709
765
|
/** Default config root path. */
|
|
710
|
-
const DEFAULT_CONFIG_ROOT =
|
|
766
|
+
const DEFAULT_CONFIG_ROOT = WORKSPACE_CONFIG_DEFAULTS.core.configRoot;
|
|
711
767
|
|
|
712
768
|
/**
|
|
713
769
|
* Factory for the standard Jeeves service CLI.
|
package/dist/index.d.ts
CHANGED
|
@@ -264,6 +264,139 @@ type StatusHandler = () => Promise<StatusHandlerResult>;
|
|
|
264
264
|
*/
|
|
265
265
|
declare function createStatusHandler(options: CreateStatusHandlerOptions): StatusHandler;
|
|
266
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Runtime Node.js version floor check.
|
|
269
|
+
*
|
|
270
|
+
* @module
|
|
271
|
+
*/
|
|
272
|
+
/**
|
|
273
|
+
* Check that the running Node.js version meets the minimum requirement.
|
|
274
|
+
* Prints an error and exits with code 1 if the check fails.
|
|
275
|
+
*/
|
|
276
|
+
declare function checkNodeVersion(): void;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Workspace-level shared configuration: `jeeves.config.json`.
|
|
280
|
+
*
|
|
281
|
+
* @remarks
|
|
282
|
+
* Lives at the OpenClaw workspace root alongside TOOLS.md and SOUL.md.
|
|
283
|
+
* Provides namespaced shared defaults consumed by the root Jeeves CLI.
|
|
284
|
+
* Resolution precedence: CLI flags → env vars → jeeves.config.json → defaults.
|
|
285
|
+
*
|
|
286
|
+
* This does not replace component-owned config schemas (Decision 41).
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
/** Workspace config file name. */
|
|
290
|
+
declare const WORKSPACE_CONFIG_FILE = "jeeves.config.json";
|
|
291
|
+
/** Workspace config Zod schema. */
|
|
292
|
+
declare const workspaceConfigSchema: z.ZodObject<{
|
|
293
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
294
|
+
core: z.ZodOptional<z.ZodObject<{
|
|
295
|
+
workspace: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
296
|
+
configRoot: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
297
|
+
gatewayUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
298
|
+
}, z.core.$strip>>;
|
|
299
|
+
memory: z.ZodOptional<z.ZodObject<{
|
|
300
|
+
budget: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
301
|
+
warningThreshold: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
302
|
+
staleDays: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
303
|
+
}, z.core.$strip>>;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
/** Workspace config type. */
|
|
306
|
+
type WorkspaceConfig = z.infer<typeof workspaceConfigSchema>;
|
|
307
|
+
/** Built-in workspace config defaults. */
|
|
308
|
+
declare const WORKSPACE_CONFIG_DEFAULTS: {
|
|
309
|
+
readonly core: {
|
|
310
|
+
readonly workspace: ".";
|
|
311
|
+
readonly configRoot: "./config";
|
|
312
|
+
readonly gatewayUrl: "http://127.0.0.1:3000";
|
|
313
|
+
};
|
|
314
|
+
readonly memory: {
|
|
315
|
+
readonly budget: 20000;
|
|
316
|
+
readonly warningThreshold: 0.8;
|
|
317
|
+
readonly staleDays: 30;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
/** Provenance source for a resolved config value. */
|
|
321
|
+
type ConfigProvenance = 'flag' | 'env' | 'file' | 'default';
|
|
322
|
+
/** A resolved config value with provenance. */
|
|
323
|
+
interface ResolvedValue<T> {
|
|
324
|
+
/** The resolved value. */
|
|
325
|
+
value: T;
|
|
326
|
+
/** Where the value came from. */
|
|
327
|
+
provenance: ConfigProvenance;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Load workspace config from `jeeves.config.json` at a given path.
|
|
331
|
+
*
|
|
332
|
+
* @param workspacePath - Workspace root directory.
|
|
333
|
+
* @returns Parsed config or undefined if missing or invalid.
|
|
334
|
+
*/
|
|
335
|
+
declare function loadWorkspaceConfig(workspacePath: string): WorkspaceConfig | undefined;
|
|
336
|
+
/**
|
|
337
|
+
* Resolve a config value with four-tier precedence.
|
|
338
|
+
*
|
|
339
|
+
* @param flagValue - CLI flag value (highest priority).
|
|
340
|
+
* @param envValue - Environment variable value.
|
|
341
|
+
* @param fileValue - Value from jeeves.config.json.
|
|
342
|
+
* @param defaultValue - Built-in default (lowest priority).
|
|
343
|
+
* @returns The resolved value with provenance annotation.
|
|
344
|
+
*/
|
|
345
|
+
declare function resolveConfigValue<T>(flagValue: T | undefined, envValue: T | undefined, fileValue: T | undefined, defaultValue: T): ResolvedValue<T>;
|
|
346
|
+
/**
|
|
347
|
+
* Generate a JSON Schema for the workspace config.
|
|
348
|
+
*
|
|
349
|
+
* @returns A JSON Schema object.
|
|
350
|
+
*/
|
|
351
|
+
declare function generateWorkspaceJsonSchema(): Record<string, unknown>;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Shared CLI defaults and resolution for Jeeves CLI commands.
|
|
355
|
+
*
|
|
356
|
+
* @remarks
|
|
357
|
+
* All root CLI commands share workspace/config-root resolution. Values follow
|
|
358
|
+
* the shared precedence model: flags → env → jeeves.config.json → defaults.
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
/** Standard workspace options parsed from CLI. */
|
|
362
|
+
interface WorkspaceOptions {
|
|
363
|
+
/** Workspace root path. */
|
|
364
|
+
workspace?: string;
|
|
365
|
+
/** Platform config root path. */
|
|
366
|
+
configRoot?: string;
|
|
367
|
+
}
|
|
368
|
+
/** Resolved shared CLI config with provenance. */
|
|
369
|
+
interface ResolvedCliConfig {
|
|
370
|
+
/** Core shared config. */
|
|
371
|
+
core: {
|
|
372
|
+
workspace: ResolvedValue<string>;
|
|
373
|
+
configRoot: ResolvedValue<string>;
|
|
374
|
+
gatewayUrl: ResolvedValue<string>;
|
|
375
|
+
};
|
|
376
|
+
/** Memory shared config. */
|
|
377
|
+
memory: {
|
|
378
|
+
budget: ResolvedValue<number>;
|
|
379
|
+
warningThreshold: ResolvedValue<number>;
|
|
380
|
+
staleDays: ResolvedValue<number>;
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* `jeeves config [jsonpath]` — inspect effective shared CLI configuration.
|
|
386
|
+
*
|
|
387
|
+
* @remarks
|
|
388
|
+
* Shows effective values and provenance using the shared precedence model.
|
|
389
|
+
* Optional JSONPath filters the resolved config tree.
|
|
390
|
+
*/
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Build the effective shared CLI config tree.
|
|
394
|
+
*
|
|
395
|
+
* @param opts - Parsed CLI workspace/config-root options.
|
|
396
|
+
* @returns Effective config tree with provenance on each leaf.
|
|
397
|
+
*/
|
|
398
|
+
declare function buildEffectiveConfig(opts: WorkspaceOptions): ResolvedCliConfig;
|
|
399
|
+
|
|
267
400
|
/**
|
|
268
401
|
* Factory for the standard `-openclaw` plugin installer CLI.
|
|
269
402
|
*
|
|
@@ -405,12 +538,24 @@ declare function removeComponentVersion(coreConfigDir: string, componentName: st
|
|
|
405
538
|
* at the component's prime-interval, calling `generateToolsContent()`
|
|
406
539
|
* and `refreshPlatformContent()` on each cycle.
|
|
407
540
|
*/
|
|
541
|
+
/** Options for ComponentWriter construction. */
|
|
542
|
+
interface ComponentWriterOptions {
|
|
543
|
+
/**
|
|
544
|
+
* Gateway URL for cleanup escalation (e.g., 'http://localhost:3000').
|
|
545
|
+
* When provided, the writer will attempt to spawn a cleanup session
|
|
546
|
+
* via the gateway when orphaned content is detected.
|
|
547
|
+
* When omitted, cleanup escalation is silently skipped.
|
|
548
|
+
*/
|
|
549
|
+
gatewayUrl?: string;
|
|
550
|
+
}
|
|
408
551
|
declare class ComponentWriter {
|
|
409
552
|
private timer;
|
|
410
553
|
private readonly component;
|
|
411
554
|
private readonly configDir;
|
|
555
|
+
private readonly gatewayUrl;
|
|
556
|
+
private readonly pendingCleanups;
|
|
412
557
|
/** @internal */
|
|
413
|
-
constructor(component: JeevesComponentDescriptor);
|
|
558
|
+
constructor(component: JeevesComponentDescriptor, options?: ComponentWriterOptions);
|
|
414
559
|
/** The component's config directory path. */
|
|
415
560
|
get componentConfigDir(): string;
|
|
416
561
|
/** Whether the writer timer is currently running. */
|
|
@@ -428,9 +573,10 @@ declare class ComponentWriter {
|
|
|
428
573
|
* Execute a single write cycle.
|
|
429
574
|
*
|
|
430
575
|
* @remarks
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
576
|
+
* 1. Write the component's TOOLS.md section.
|
|
577
|
+
* 2. Refresh shared platform content (SOUL.md, AGENTS.md, Platform section).
|
|
578
|
+
* 3. Scan for cleanup flags and escalate if a gateway URL is configured.
|
|
579
|
+
* 4. Run HEARTBEAT health orchestration.
|
|
434
580
|
*/
|
|
435
581
|
cycle(): Promise<void>;
|
|
436
582
|
}
|
|
@@ -509,10 +655,11 @@ declare function createAsyncContentCache(options: AsyncContentCacheOptions): ()
|
|
|
509
655
|
* This replaces the v0.4.0 `createComponentWriter(JeevesComponent)`.
|
|
510
656
|
*
|
|
511
657
|
* @param descriptor - The component descriptor to validate and wrap.
|
|
658
|
+
* @param options - Optional writer configuration (e.g., gatewayUrl for cleanup escalation).
|
|
512
659
|
* @returns A new `ComponentWriter` instance.
|
|
513
660
|
* @throws ZodError if the descriptor is invalid.
|
|
514
661
|
*/
|
|
515
|
-
declare function createComponentWriter(descriptor: JeevesComponentDescriptor): ComponentWriter;
|
|
662
|
+
declare function createComponentWriter(descriptor: JeevesComponentDescriptor, options?: ComponentWriterOptions): ComponentWriter;
|
|
516
663
|
|
|
517
664
|
/**
|
|
518
665
|
* Heading-based HEARTBEAT section writer.
|
|
@@ -666,8 +813,8 @@ declare const AGENTS_MARKERS: ManagedMarkers;
|
|
|
666
813
|
declare const VERSION_STAMP_PATTERN: RegExp;
|
|
667
814
|
/** Staleness threshold for version-stamp convergence in milliseconds. */
|
|
668
815
|
declare const STALENESS_THRESHOLD_MS: number;
|
|
669
|
-
/** Warning text
|
|
670
|
-
declare const CLEANUP_FLAG = "> \u26A0\uFE0F CLEANUP NEEDED: Orphaned Jeeves content
|
|
816
|
+
/** Warning text injected inside managed block when cleanup is needed. */
|
|
817
|
+
declare const CLEANUP_FLAG = "> \u26A0\uFE0F CLEANUP NEEDED: Orphaned Jeeves content detected outside this managed block. Review the file and remove any content outside the BEGIN/END markers that duplicates what appears inside them.";
|
|
671
818
|
|
|
672
819
|
/**
|
|
673
820
|
* Directory and file path conventions for the Jeeves platform.
|
|
@@ -686,7 +833,13 @@ declare const WORKSPACE_FILES: {
|
|
|
686
833
|
readonly agents: "AGENTS.md";
|
|
687
834
|
/** HEARTBEAT.md — platform status and health alerts. */
|
|
688
835
|
readonly heartbeat: "HEARTBEAT.md";
|
|
836
|
+
/** MEMORY.md — curated long-term memory. */
|
|
837
|
+
readonly memory: "MEMORY.md";
|
|
689
838
|
};
|
|
839
|
+
/** Skill directory name within workspace. */
|
|
840
|
+
declare const SKILLS_DIR = "skills";
|
|
841
|
+
/** Jeeves skill directory name. */
|
|
842
|
+
declare const JEEVES_SKILL_DIR = "jeeves";
|
|
690
843
|
/** Templates directory name within core config. */
|
|
691
844
|
declare const TEMPLATES_DIR = "templates";
|
|
692
845
|
/** Registry cache file name. */
|
|
@@ -1148,6 +1301,82 @@ declare function formatEndMarker(markerText: string): string;
|
|
|
1148
1301
|
*/
|
|
1149
1302
|
declare function shouldWrite(myVersion: string, existing: VersionStamp | undefined, stalenessThresholdMs?: number): boolean;
|
|
1150
1303
|
|
|
1304
|
+
/**
|
|
1305
|
+
* Memory budget accounting and staleness detection for MEMORY.md.
|
|
1306
|
+
*
|
|
1307
|
+
* @remarks
|
|
1308
|
+
* Scans MEMORY.md for ISO date patterns in H2/H3 headings and bullet items.
|
|
1309
|
+
* Reports character count against a configured budget, warning threshold state,
|
|
1310
|
+
* and stale section candidates. Does not auto-delete: review remains
|
|
1311
|
+
* human- or agent-mediated (Decision 42).
|
|
1312
|
+
*/
|
|
1313
|
+
/** Result of memory hygiene analysis. */
|
|
1314
|
+
interface MemoryHygieneResult {
|
|
1315
|
+
/** Whether MEMORY.md exists. */
|
|
1316
|
+
exists: boolean;
|
|
1317
|
+
/** Total character count. */
|
|
1318
|
+
charCount: number;
|
|
1319
|
+
/** Configured budget in characters. */
|
|
1320
|
+
budget: number;
|
|
1321
|
+
/** Usage as a fraction of budget (0–1+). */
|
|
1322
|
+
usage: number;
|
|
1323
|
+
/** Whether usage exceeds the warning threshold. */
|
|
1324
|
+
warning: boolean;
|
|
1325
|
+
/** Whether usage exceeds the budget. */
|
|
1326
|
+
overBudget: boolean;
|
|
1327
|
+
/** Number of H2 sections flagged as stale candidates. */
|
|
1328
|
+
staleCandidates: number;
|
|
1329
|
+
/** Names of stale sections. */
|
|
1330
|
+
staleSectionNames: string[];
|
|
1331
|
+
}
|
|
1332
|
+
/** Options for memory hygiene analysis. */
|
|
1333
|
+
interface MemoryHygieneOptions {
|
|
1334
|
+
/** Workspace root path. */
|
|
1335
|
+
workspacePath: string;
|
|
1336
|
+
/** Character budget. */
|
|
1337
|
+
budget: number;
|
|
1338
|
+
/** Warning threshold as a fraction of budget (0–1). */
|
|
1339
|
+
warningThreshold: number;
|
|
1340
|
+
/** Staleness threshold in days. */
|
|
1341
|
+
staleDays: number;
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Extract the most recent ISO date from a string.
|
|
1345
|
+
*
|
|
1346
|
+
* @param text - Text to scan for dates.
|
|
1347
|
+
* @returns The most recent date found, or undefined.
|
|
1348
|
+
*/
|
|
1349
|
+
declare function extractMostRecentDate(text: string): Date | undefined;
|
|
1350
|
+
/**
|
|
1351
|
+
* Analyze MEMORY.md for budget and staleness.
|
|
1352
|
+
*
|
|
1353
|
+
* @param options - Analysis configuration.
|
|
1354
|
+
* @returns Memory hygiene result.
|
|
1355
|
+
*/
|
|
1356
|
+
declare function analyzeMemory(options: MemoryHygieneOptions): MemoryHygieneResult;
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* HEARTBEAT integration for memory hygiene.
|
|
1360
|
+
*
|
|
1361
|
+
* @remarks
|
|
1362
|
+
* Calls `analyzeMemory()` and converts the result into a `HeartbeatEntry`
|
|
1363
|
+
* suitable for inclusion in the HEARTBEAT.md platform status section.
|
|
1364
|
+
* Returns `undefined` when MEMORY.md is healthy (no alert needed).
|
|
1365
|
+
*
|
|
1366
|
+
* Uses the `## MEMORY.md` heading (Decision 50) to distinguish memory
|
|
1367
|
+
* alerts from component alerts (`## jeeves-{name}`).
|
|
1368
|
+
*/
|
|
1369
|
+
|
|
1370
|
+
/** The HEARTBEAT heading name for memory alerts. */
|
|
1371
|
+
declare const MEMORY_HEARTBEAT_NAME = "MEMORY.md";
|
|
1372
|
+
/**
|
|
1373
|
+
* Check memory health and return a HEARTBEAT entry if unhealthy.
|
|
1374
|
+
*
|
|
1375
|
+
* @param options - Memory hygiene options (workspacePath, budget, etc.).
|
|
1376
|
+
* @returns A `HeartbeatEntry` when memory needs attention, `undefined` when healthy.
|
|
1377
|
+
*/
|
|
1378
|
+
declare function checkMemoryHealth(options: MemoryHygieneOptions): HeartbeatEntry | undefined;
|
|
1379
|
+
|
|
1151
1380
|
/**
|
|
1152
1381
|
* Internal function to maintain SOUL.md, AGENTS.md, and TOOLS.md Platform section.
|
|
1153
1382
|
*
|
|
@@ -1205,6 +1434,21 @@ interface SeedContentOptions {
|
|
|
1205
1434
|
*/
|
|
1206
1435
|
declare function seedContent(options: SeedContentOptions): Promise<void>;
|
|
1207
1436
|
|
|
1437
|
+
/**
|
|
1438
|
+
* Skill seeding: write the `jeeves` workspace skill unconditionally.
|
|
1439
|
+
*
|
|
1440
|
+
* @remarks
|
|
1441
|
+
* The skill file is entirely generated — no user-authored content (Decision 48).
|
|
1442
|
+
* Every installer (core CLI and component plugins) writes it unconditionally.
|
|
1443
|
+
* Content is inlined at build time via `rollup-plugin-md.ts`.
|
|
1444
|
+
*/
|
|
1445
|
+
/**
|
|
1446
|
+
* Seed the jeeves workspace skill file.
|
|
1447
|
+
*
|
|
1448
|
+
* @param workspacePath - Workspace root directory.
|
|
1449
|
+
*/
|
|
1450
|
+
declare function seedSkill(workspacePath: string): void;
|
|
1451
|
+
|
|
1208
1452
|
/**
|
|
1209
1453
|
* Factory for the standard plugin tool set.
|
|
1210
1454
|
*
|
|
@@ -1594,5 +1838,5 @@ interface ServiceManager {
|
|
|
1594
1838
|
*/
|
|
1595
1839
|
declare function createServiceManager(descriptor: JeevesComponentDescriptor): ServiceManager;
|
|
1596
1840
|
|
|
1597
|
-
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, META_PORT, PLATFORM_COMPONENTS, 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, appendJsonl, atomicWrite, buildHeartbeatSection, checkRegistryVersion, connectionFail, coreConfigSchema, createAsyncContentCache, createComponentWriter, createConfigApplyHandler, createConfigQueryHandler, createGoogleAuth, createPluginCli, createPluginToolset, createServiceCli, createServiceManager, createStatusHandler, ensureDir, fail, fetchJson, fetchWithTimeout, formatBeginMarker, formatEndMarker, generateJsonSchema, getArg, getBindAddress, getChannelWorkspace, getComponentConfigDir, getConfigRoot, getCoreConfigDir, getCoreConfigFile, getEffectiveServiceName, getPackageVersion, getServiceState, getServiceUrl, getWorkspacePath, init, isPrime, jaccard, jeevesComponentDescriptorSchema, loadEnvFile, needsCleanup, nowIso, ok, orchestrateHeartbeat, parseArgs, parseHeartbeat, parseManaged, patchConfig, postJson, readComponentVersions, readJson, readJsonl, refreshPlatformContent, removeComponentVersion, removeManagedSection, resetInit, resolveConfigPath, resolveOpenClawHome, resolveOptionalPluginSetting, resolvePluginSetting, resolveWorkspacePath, run, runScript, runWithRetry, saveCache, seedContent, shingles, shouldWrite, sleepAsync, sleepMs, updateManagedSection, uuid, withFileLock, writeComponentVersion, writeHeartbeatSection, writeJsonAtomic, writeJsonl };
|
|
1598
|
-
export type { AccountConfig, AsyncContentCacheOptions, ComponentDependencies, ComponentState, ComponentVersionEntry, ComponentVersionsState, ConfigApplyHandler, ConfigApplyRequest, ConfigApplyResult, ConfigQueryHandler, ConfigQueryResponse, CoreConfig, CreatePluginCliOptions, CreateStatusHandlerOptions, GoogleAuthOptions, HeartbeatEntry, InitOptions, JeevesComponentDescriptor, ManagedMarkers, ManagedSection, OrchestrateHeartbeatOptions, ParseManagedResult, ParsedHeartbeat, PlatformComponent, PluginApi, RefreshPlatformContentOptions, RemoveManagedSectionOptions, RetryOptions, RunOptions, SectionId, SeedContentOptions, ServiceAccountFileConfig, ServiceManager, ServiceManagerOptions, ServiceState, SlackWorkspaceOptions, StatusHandler, StatusHandlerResult, StatusResponse, ToolDescriptor, ToolRegistrationOptions, ToolResult, UpdateManagedSectionOptions, VersionStamp, WriteComponentVersionOptions };
|
|
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 };
|