create-agentfs 0.1.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/LICENSE +21 -0
- package/README.md +238 -0
- package/dist/cli.d.ts +51 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +246 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/compile.d.ts +48 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +228 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/cron.d.ts +18 -0
- package/dist/commands/cron.d.ts.map +1 -0
- package/dist/commands/cron.js +95 -0
- package/dist/commands/cron.js.map +1 -0
- package/dist/commands/doctor.d.ts +11 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +199 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/memory.d.ts +19 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +213 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/onboard.d.ts +31 -0
- package/dist/commands/onboard.d.ts.map +1 -0
- package/dist/commands/onboard.js +362 -0
- package/dist/commands/onboard.js.map +1 -0
- package/dist/commands/secret.d.ts +13 -0
- package/dist/commands/secret.d.ts.map +1 -0
- package/dist/commands/secret.js +109 -0
- package/dist/commands/secret.js.map +1 -0
- package/dist/commands/security.d.ts +16 -0
- package/dist/commands/security.d.ts.map +1 -0
- package/dist/commands/security.js +203 -0
- package/dist/commands/security.js.map +1 -0
- package/dist/commands/sync.d.ts +14 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +84 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/compilers/agent-map.d.ts +34 -0
- package/dist/compilers/agent-map.d.ts.map +1 -0
- package/dist/compilers/agent-map.js +66 -0
- package/dist/compilers/agent-map.js.map +1 -0
- package/dist/compilers/base.d.ts +67 -0
- package/dist/compilers/base.d.ts.map +1 -0
- package/dist/compilers/base.js +183 -0
- package/dist/compilers/base.js.map +1 -0
- package/dist/compilers/claude.d.ts +26 -0
- package/dist/compilers/claude.d.ts.map +1 -0
- package/dist/compilers/claude.js +151 -0
- package/dist/compilers/claude.js.map +1 -0
- package/dist/compilers/cursor.d.ts +11 -0
- package/dist/compilers/cursor.d.ts.map +1 -0
- package/dist/compilers/cursor.js +52 -0
- package/dist/compilers/cursor.js.map +1 -0
- package/dist/compilers/index.d.ts +14 -0
- package/dist/compilers/index.d.ts.map +1 -0
- package/dist/compilers/index.js +14 -0
- package/dist/compilers/index.js.map +1 -0
- package/dist/compilers/openclaw.d.ts +12 -0
- package/dist/compilers/openclaw.d.ts.map +1 -0
- package/dist/compilers/openclaw.js +51 -0
- package/dist/compilers/openclaw.js.map +1 -0
- package/dist/cron/index.d.ts +10 -0
- package/dist/cron/index.d.ts.map +1 -0
- package/dist/cron/index.js +9 -0
- package/dist/cron/index.js.map +1 -0
- package/dist/cron/jobs/consolidate.d.ts +16 -0
- package/dist/cron/jobs/consolidate.d.ts.map +1 -0
- package/dist/cron/jobs/consolidate.js +61 -0
- package/dist/cron/jobs/consolidate.js.map +1 -0
- package/dist/cron/jobs/heartbeat.d.ts +11 -0
- package/dist/cron/jobs/heartbeat.d.ts.map +1 -0
- package/dist/cron/jobs/heartbeat.js +66 -0
- package/dist/cron/jobs/heartbeat.js.map +1 -0
- package/dist/cron/jobs/inbox-triage.d.ts +11 -0
- package/dist/cron/jobs/inbox-triage.d.ts.map +1 -0
- package/dist/cron/jobs/inbox-triage.js +85 -0
- package/dist/cron/jobs/inbox-triage.js.map +1 -0
- package/dist/cron/runner.d.ts +32 -0
- package/dist/cron/runner.d.ts.map +1 -0
- package/dist/cron/runner.js +69 -0
- package/dist/cron/runner.js.map +1 -0
- package/dist/cron/types.d.ts +21 -0
- package/dist/cron/types.d.ts.map +1 -0
- package/dist/cron/types.js +6 -0
- package/dist/cron/types.js.map +1 -0
- package/dist/generators/filesystem.d.ts +52 -0
- package/dist/generators/filesystem.d.ts.map +1 -0
- package/dist/generators/filesystem.js +155 -0
- package/dist/generators/filesystem.js.map +1 -0
- package/dist/generators/ignore.d.ts +38 -0
- package/dist/generators/ignore.d.ts.map +1 -0
- package/dist/generators/ignore.js +154 -0
- package/dist/generators/ignore.js.map +1 -0
- package/dist/generators/index.d.ts +14 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +14 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/init.d.ts +37 -0
- package/dist/generators/init.d.ts.map +1 -0
- package/dist/generators/init.js +169 -0
- package/dist/generators/init.js.map +1 -0
- package/dist/generators/manifest.d.ts +31 -0
- package/dist/generators/manifest.d.ts.map +1 -0
- package/dist/generators/manifest.js +123 -0
- package/dist/generators/manifest.js.map +1 -0
- package/dist/generators/memory.d.ts +36 -0
- package/dist/generators/memory.d.ts.map +1 -0
- package/dist/generators/memory.js +106 -0
- package/dist/generators/memory.js.map +1 -0
- package/dist/generators/profiles.d.ts +22 -0
- package/dist/generators/profiles.d.ts.map +1 -0
- package/dist/generators/profiles.js +92 -0
- package/dist/generators/profiles.js.map +1 -0
- package/dist/generators/prompts.d.ts +24 -0
- package/dist/generators/prompts.d.ts.map +1 -0
- package/dist/generators/prompts.js +122 -0
- package/dist/generators/prompts.js.map +1 -0
- package/dist/generators/scaffold.d.ts +29 -0
- package/dist/generators/scaffold.d.ts.map +1 -0
- package/dist/generators/scaffold.js +90 -0
- package/dist/generators/scaffold.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/confidence.d.ts +69 -0
- package/dist/memory/confidence.d.ts.map +1 -0
- package/dist/memory/confidence.js +125 -0
- package/dist/memory/confidence.js.map +1 -0
- package/dist/memory/episodic.d.ts +40 -0
- package/dist/memory/episodic.d.ts.map +1 -0
- package/dist/memory/episodic.js +139 -0
- package/dist/memory/episodic.js.map +1 -0
- package/dist/memory/index.d.ts +17 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +17 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/parser.d.ts +73 -0
- package/dist/memory/parser.d.ts.map +1 -0
- package/dist/memory/parser.js +156 -0
- package/dist/memory/parser.js.map +1 -0
- package/dist/memory/procedural.d.ts +43 -0
- package/dist/memory/procedural.d.ts.map +1 -0
- package/dist/memory/procedural.js +126 -0
- package/dist/memory/procedural.js.map +1 -0
- package/dist/secrets/exfil-guard.d.ts +31 -0
- package/dist/secrets/exfil-guard.d.ts.map +1 -0
- package/dist/secrets/exfil-guard.js +51 -0
- package/dist/secrets/exfil-guard.js.map +1 -0
- package/dist/secrets/index.d.ts +8 -0
- package/dist/secrets/index.d.ts.map +1 -0
- package/dist/secrets/index.js +7 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/vault.d.ts +63 -0
- package/dist/secrets/vault.d.ts.map +1 -0
- package/dist/secrets/vault.js +163 -0
- package/dist/secrets/vault.js.map +1 -0
- package/dist/security/claude-compiler.d.ts +28 -0
- package/dist/security/claude-compiler.d.ts.map +1 -0
- package/dist/security/claude-compiler.js +66 -0
- package/dist/security/claude-compiler.js.map +1 -0
- package/dist/security/index.d.ts +7 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +7 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/parser.d.ts +47 -0
- package/dist/security/parser.d.ts.map +1 -0
- package/dist/security/parser.js +136 -0
- package/dist/security/parser.js.map +1 -0
- package/dist/sync/index.d.ts +7 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +6 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/sync.d.ts +46 -0
- package/dist/sync/sync.d.ts.map +1 -0
- package/dist/sync/sync.js +174 -0
- package/dist/sync/sync.js.map +1 -0
- package/dist/types/compiler.d.ts +81 -0
- package/dist/types/compiler.d.ts.map +1 -0
- package/dist/types/compiler.js +10 -0
- package/dist/types/compiler.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/manifest.d.ts +112 -0
- package/dist/types/manifest.d.ts.map +1 -0
- package/dist/types/manifest.js +10 -0
- package/dist/types/manifest.js.map +1 -0
- package/dist/types/memory.d.ts +85 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/memory.js +20 -0
- package/dist/types/memory.js.map +1 -0
- package/dist/types/security.d.ts +67 -0
- package/dist/types/security.d.ts.map +1 -0
- package/dist/types/security.js +10 -0
- package/dist/types/security.js.map +1 -0
- package/dist/types/setup.d.ts +54 -0
- package/dist/types/setup.d.ts.map +1 -0
- package/dist/types/setup.js +9 -0
- package/dist/types/setup.js.map +1 -0
- package/dist/utils/fhs-mapping.d.ts +76 -0
- package/dist/utils/fhs-mapping.d.ts.map +1 -0
- package/dist/utils/fhs-mapping.js +189 -0
- package/dist/utils/fhs-mapping.js.map +1 -0
- package/package.json +58 -0
- package/templates/compilers/agent-map.md.hbs +36 -0
- package/templates/compilers/claude.md.hbs +95 -0
- package/templates/procedural/code-review.md +54 -0
- package/templates/procedural/debugging.md +52 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base compiler utilities — shared by all agent drivers.
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to read manifest, load init.d scripts,
|
|
5
|
+
* read memory files, register Handlebars helpers, and write outputs.
|
|
6
|
+
*
|
|
7
|
+
* @module compilers/base
|
|
8
|
+
*/
|
|
9
|
+
import fs from 'node:fs/promises';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import yaml from 'js-yaml';
|
|
12
|
+
import Handlebars from 'handlebars';
|
|
13
|
+
/**
|
|
14
|
+
* Read and parse `.agentos/manifest.yaml`.
|
|
15
|
+
*
|
|
16
|
+
* @param vaultRoot - Root directory of the vault
|
|
17
|
+
* @returns Parsed Manifest object
|
|
18
|
+
* @throws If manifest.yaml doesn't exist or is invalid YAML
|
|
19
|
+
*/
|
|
20
|
+
export async function readManifest(vaultRoot) {
|
|
21
|
+
const manifestPath = path.join(vaultRoot, '.agentos', 'manifest.yaml');
|
|
22
|
+
const content = await fs.readFile(manifestPath, 'utf-8');
|
|
23
|
+
return yaml.load(content);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Read all init.d/ scripts, keyed by filename.
|
|
27
|
+
*
|
|
28
|
+
* @param vaultRoot - Root directory of the vault
|
|
29
|
+
* @returns Map of filename → content
|
|
30
|
+
*/
|
|
31
|
+
export async function readInitScripts(vaultRoot) {
|
|
32
|
+
const initDir = path.join(vaultRoot, '.agentos', 'init.d');
|
|
33
|
+
const scripts = {};
|
|
34
|
+
try {
|
|
35
|
+
const entries = await fs.readdir(initDir);
|
|
36
|
+
const mdFiles = entries.filter((f) => f.endsWith('.md')).sort();
|
|
37
|
+
for (const filename of mdFiles) {
|
|
38
|
+
scripts[filename] = await fs.readFile(path.join(initDir, filename), 'utf-8');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// init.d/ doesn't exist — return empty
|
|
43
|
+
}
|
|
44
|
+
return scripts;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Read semantic memory content.
|
|
48
|
+
*
|
|
49
|
+
* @param vaultRoot - Root directory of the vault
|
|
50
|
+
* @returns File content or null if not found
|
|
51
|
+
*/
|
|
52
|
+
export async function readSemanticMemory(vaultRoot) {
|
|
53
|
+
try {
|
|
54
|
+
return await fs.readFile(path.join(vaultRoot, '.agentos', 'memory', 'semantic.md'), 'utf-8');
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Read corrections memory content.
|
|
62
|
+
*
|
|
63
|
+
* @param vaultRoot - Root directory of the vault
|
|
64
|
+
* @returns File content or null if not found
|
|
65
|
+
*/
|
|
66
|
+
export async function readCorrections(vaultRoot) {
|
|
67
|
+
try {
|
|
68
|
+
return await fs.readFile(path.join(vaultRoot, '.agentos', 'memory', 'corrections.md'), 'utf-8');
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build a complete CompileContext from a vault root.
|
|
76
|
+
*
|
|
77
|
+
* Reads manifest, init scripts, and memory in parallel.
|
|
78
|
+
*
|
|
79
|
+
* @param vaultRoot - Root directory of the vault
|
|
80
|
+
* @param dryRun - Whether to preview without writing
|
|
81
|
+
* @returns Complete context for compiler drivers
|
|
82
|
+
*/
|
|
83
|
+
export async function buildCompileContext(vaultRoot, dryRun = false) {
|
|
84
|
+
const [manifest, initScripts, semanticMemory, corrections] = await Promise.all([
|
|
85
|
+
readManifest(vaultRoot),
|
|
86
|
+
readInitScripts(vaultRoot),
|
|
87
|
+
readSemanticMemory(vaultRoot),
|
|
88
|
+
readCorrections(vaultRoot),
|
|
89
|
+
]);
|
|
90
|
+
return { manifest, initScripts, semanticMemory, corrections, vaultRoot, dryRun };
|
|
91
|
+
}
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// Handlebars helpers
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
/** Register custom Handlebars helpers used by all templates. */
|
|
96
|
+
export function registerHelpers() {
|
|
97
|
+
/** Format current date as ISO string (YYYY-MM-DD). */
|
|
98
|
+
Handlebars.registerHelper('today', () => new Date().toISOString().split('T')[0]);
|
|
99
|
+
/** Join array items with a separator. */
|
|
100
|
+
Handlebars.registerHelper('join', (arr, sep) => {
|
|
101
|
+
if (!Array.isArray(arr))
|
|
102
|
+
return '';
|
|
103
|
+
return arr.join(typeof sep === 'string' ? sep : ', ');
|
|
104
|
+
});
|
|
105
|
+
/** Render a block if two values are equal. */
|
|
106
|
+
Handlebars.registerHelper('eq', function (a, b, options) {
|
|
107
|
+
return a === b ? options.fn(this) : options.inverse(this);
|
|
108
|
+
});
|
|
109
|
+
/** Increment a number (for 1-based indexing in templates). */
|
|
110
|
+
Handlebars.registerHelper('inc', (val) => val + 1);
|
|
111
|
+
/** Uppercase first letter. */
|
|
112
|
+
Handlebars.registerHelper('capitalize', (str) => {
|
|
113
|
+
if (typeof str !== 'string' || str.length === 0)
|
|
114
|
+
return str;
|
|
115
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
116
|
+
});
|
|
117
|
+
/** Convert FHS paths object to markdown table rows with descriptions. */
|
|
118
|
+
Handlebars.registerHelper('pathTable', (paths) => {
|
|
119
|
+
if (!paths || typeof paths !== 'object')
|
|
120
|
+
return '';
|
|
121
|
+
// Inline descriptions keyed by FHS path name — matches FHS_DESCRIPTIONS from fhs-mapping.ts
|
|
122
|
+
const desc = {
|
|
123
|
+
tmp: 'Единственная точка входа для новых заметок',
|
|
124
|
+
log: 'Ежедневные журналы',
|
|
125
|
+
spool: 'Очереди задач, приоритеты',
|
|
126
|
+
home: 'Активные проекты',
|
|
127
|
+
srv: 'Контент для публикации',
|
|
128
|
+
usr_share: 'Знания вне проектов',
|
|
129
|
+
proc_people: 'Активные контакты',
|
|
130
|
+
etc: 'Системная конфигурация',
|
|
131
|
+
archive: 'Завершённое',
|
|
132
|
+
home_contracts: 'Клиентские проекты',
|
|
133
|
+
usr_local_career: 'Job search pipeline',
|
|
134
|
+
home_user: 'Профессиональная база знаний',
|
|
135
|
+
usr_share_media: 'Медиафайлы',
|
|
136
|
+
};
|
|
137
|
+
return Object.entries(paths)
|
|
138
|
+
.filter(([, v]) => v !== undefined)
|
|
139
|
+
.map(([key, val]) => `| \`${val}/\` | \`${key}\` | ${desc[key] ?? ''} |`)
|
|
140
|
+
.join('\n');
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// Register helpers on module load
|
|
144
|
+
registerHelpers();
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
// Template compilation
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
/**
|
|
149
|
+
* Compile a Handlebars template string.
|
|
150
|
+
*
|
|
151
|
+
* @param source - Handlebars template source
|
|
152
|
+
* @returns Compiled template function
|
|
153
|
+
*/
|
|
154
|
+
export function compileTemplate(source) {
|
|
155
|
+
return Handlebars.compile(source);
|
|
156
|
+
}
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
// Output writing
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
/**
|
|
161
|
+
* Write compile outputs to disk (or skip in dry-run mode).
|
|
162
|
+
*
|
|
163
|
+
* @param outputs - Files to write
|
|
164
|
+
* @param vaultRoot - Root directory
|
|
165
|
+
* @param dryRun - If true, don't write anything
|
|
166
|
+
* @returns List of paths that were written (or would be written)
|
|
167
|
+
*/
|
|
168
|
+
export async function writeOutputs(outputs, vaultRoot, dryRun) {
|
|
169
|
+
const written = [];
|
|
170
|
+
for (const output of outputs) {
|
|
171
|
+
const fullPath = path.join(vaultRoot, output.path);
|
|
172
|
+
if (dryRun) {
|
|
173
|
+
written.push(output.path);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
// Ensure parent directory exists
|
|
177
|
+
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
178
|
+
await fs.writeFile(fullPath, output.content, 'utf-8');
|
|
179
|
+
written.push(output.path);
|
|
180
|
+
}
|
|
181
|
+
return written;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/compilers/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC;;;;;;GAMG;A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AC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code compiler driver.
|
|
3
|
+
*
|
|
4
|
+
* Compiles the AgentFS kernel manifest into a `CLAUDE.md` file
|
|
5
|
+
* at the vault root — the native config format for Claude Code.
|
|
6
|
+
*
|
|
7
|
+
* @see docs/architecture.md Section 9 "Compile Pipeline"
|
|
8
|
+
* @module compilers/claude
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentCompiler } from '../types/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Claude Code compiler driver.
|
|
13
|
+
*
|
|
14
|
+
* Implements {@link AgentCompiler} for the `claude` runtime.
|
|
15
|
+
* Reads `templates/compilers/claude.md.hbs`, fills it with data
|
|
16
|
+
* from the {@link CompileContext}, and outputs a single `CLAUDE.md`
|
|
17
|
+
* file at the vault root.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { claudeCompiler } from './compilers/claude.js';
|
|
22
|
+
* const result = await claudeCompiler.compile(ctx);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const claudeCompiler: AgentCompiler;
|
|
26
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/compilers/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAiD,MAAM,mBAAmB,CAAC;AAsCtG;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,EAAE,aAuG5B,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code compiler driver.
|
|
3
|
+
*
|
|
4
|
+
* Compiles the AgentFS kernel manifest into a `CLAUDE.md` file
|
|
5
|
+
* at the vault root — the native config format for Claude Code.
|
|
6
|
+
*
|
|
7
|
+
* @see docs/architecture.md Section 9 "Compile Pipeline"
|
|
8
|
+
* @module compilers/claude
|
|
9
|
+
*/
|
|
10
|
+
import fs from 'node:fs/promises';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import yaml from 'js-yaml';
|
|
14
|
+
import { compileTemplate } from './base.js';
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Supported features
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
/**
|
|
19
|
+
* Features natively supported by Claude Code.
|
|
20
|
+
*
|
|
21
|
+
* 'security-enforce' is supported because Claude Code implements real
|
|
22
|
+
* `permissions.deny` enforcement, unlike agents that only read guidelines.
|
|
23
|
+
*/
|
|
24
|
+
const SUPPORTED_FEATURES = new Set(['security-enforce']);
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Template path
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the Handlebars template path relative to this module's location.
|
|
30
|
+
*
|
|
31
|
+
* Using `import.meta.url` ensures correctness whether the package is
|
|
32
|
+
* installed globally, locally, or run via `npx`.
|
|
33
|
+
*
|
|
34
|
+
* Layout assumption:
|
|
35
|
+
* src/compilers/claude.ts ← this file (2 levels down from root)
|
|
36
|
+
* templates/compilers/claude.md.hbs ← target (2 levels up, then down)
|
|
37
|
+
*/
|
|
38
|
+
const TEMPLATE_URL = new URL('../../templates/compilers/claude.md.hbs', import.meta.url);
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Compiler implementation
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
/**
|
|
43
|
+
* Claude Code compiler driver.
|
|
44
|
+
*
|
|
45
|
+
* Implements {@link AgentCompiler} for the `claude` runtime.
|
|
46
|
+
* Reads `templates/compilers/claude.md.hbs`, fills it with data
|
|
47
|
+
* from the {@link CompileContext}, and outputs a single `CLAUDE.md`
|
|
48
|
+
* file at the vault root.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { claudeCompiler } from './compilers/claude.js';
|
|
53
|
+
* const result = await claudeCompiler.compile(ctx);
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export const claudeCompiler = {
|
|
57
|
+
/** Agent runtime identifier. */
|
|
58
|
+
name: 'claude',
|
|
59
|
+
/**
|
|
60
|
+
* Compile manifest + context into a `CLAUDE.md` file.
|
|
61
|
+
*
|
|
62
|
+
* Template data exposed to Handlebars:
|
|
63
|
+
* - `vault` — `manifest.vault` (name, owner, created)
|
|
64
|
+
* - `agentos` — `manifest.agentos` (version, profile)
|
|
65
|
+
* - `paths` — `manifest.paths` (FHS directory mapping)
|
|
66
|
+
* - `frontmatter` — `manifest.frontmatter` (required / standard fields)
|
|
67
|
+
* - `boot` — `manifest.boot` (sequence, variables)
|
|
68
|
+
* - `modules` — `manifest.modules` (optional active modules list)
|
|
69
|
+
* - `identity` — content of `init.d/00-identity.md`, or `null`
|
|
70
|
+
* - `corrections` — content of `.agentos/memory/corrections.md`, or `null`
|
|
71
|
+
*
|
|
72
|
+
* @param context - Full compile context (manifest, init scripts, memory, etc.)
|
|
73
|
+
* @returns CompileResult with one managed output: `CLAUDE.md`
|
|
74
|
+
*/
|
|
75
|
+
async compile(context) {
|
|
76
|
+
const { manifest, initScripts, corrections } = context;
|
|
77
|
+
// Read template from the filesystem (async, so hot-reload works in dev)
|
|
78
|
+
const templateSource = await fs.readFile(fileURLToPath(TEMPLATE_URL), 'utf-8');
|
|
79
|
+
// Clean identity: strip the file header and <!-- custom --> marker
|
|
80
|
+
const rawIdentity = initScripts['00-identity.md'] ?? '';
|
|
81
|
+
const identityClean = rawIdentity
|
|
82
|
+
.replace(/^# Agent Identity\s*\n*/m, '')
|
|
83
|
+
.replace(/<!--\s*custom\s*-->\s*$/m, '')
|
|
84
|
+
.trim() || null;
|
|
85
|
+
// Parse corrections: extract only actual entries (lines that aren't headers/comments)
|
|
86
|
+
const correctionsEntries = corrections
|
|
87
|
+
? corrections
|
|
88
|
+
.split('\n')
|
|
89
|
+
.filter((line) => line.trim().length > 0)
|
|
90
|
+
.filter((line) => !line.startsWith('#') && !line.startsWith('>'))
|
|
91
|
+
.map((line) => line.replace(/^-\s*/, '').trim())
|
|
92
|
+
.filter((line) => line.length > 0)
|
|
93
|
+
: null;
|
|
94
|
+
// Read security policy if it exists
|
|
95
|
+
let securityPolicy = null;
|
|
96
|
+
try {
|
|
97
|
+
const policyPath = path.join(context.vaultRoot, '.agentos', 'security', 'policy.yaml');
|
|
98
|
+
const policyContent = await fs.readFile(policyPath, 'utf-8');
|
|
99
|
+
securityPolicy = yaml.load(policyContent);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// No policy file — security section will be skipped in template
|
|
103
|
+
}
|
|
104
|
+
const hasSecurityRules = securityPolicy !== null;
|
|
105
|
+
const denyRead = securityPolicy?.file_access?.deny_read ?? [];
|
|
106
|
+
const denyWrite = securityPolicy?.file_access?.deny_write ?? [];
|
|
107
|
+
const askWrite = securityPolicy?.file_access?.ask_write ?? [];
|
|
108
|
+
// Build template data from context
|
|
109
|
+
const templateData = {
|
|
110
|
+
vault: manifest.vault,
|
|
111
|
+
agentos: manifest.agentos,
|
|
112
|
+
paths: manifest.paths,
|
|
113
|
+
frontmatter: manifest.frontmatter,
|
|
114
|
+
boot: manifest.boot,
|
|
115
|
+
modules: manifest.modules ?? null,
|
|
116
|
+
identityClean,
|
|
117
|
+
correctionsEntries,
|
|
118
|
+
hasSecurityRules,
|
|
119
|
+
denyRead,
|
|
120
|
+
denyWrite,
|
|
121
|
+
askWrite,
|
|
122
|
+
};
|
|
123
|
+
// Compile template and render
|
|
124
|
+
const render = compileTemplate(templateSource);
|
|
125
|
+
const content = render(templateData);
|
|
126
|
+
return {
|
|
127
|
+
agent: 'claude',
|
|
128
|
+
outputs: [
|
|
129
|
+
{
|
|
130
|
+
path: 'CLAUDE.md',
|
|
131
|
+
content,
|
|
132
|
+
managed: true,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
summary: `Compiled CLAUDE.md for vault "${manifest.vault.name}" (profile: ${manifest.agentos.profile})`,
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Check whether Claude Code natively supports a given feature.
|
|
140
|
+
*
|
|
141
|
+
* Claude Code supports `'security-enforce'` because it implements
|
|
142
|
+
* real `permissions.deny` blocking — not just advisory guidelines.
|
|
143
|
+
*
|
|
144
|
+
* @param feature - Feature identifier to query
|
|
145
|
+
* @returns `true` if Claude Code can enforce the feature
|
|
146
|
+
*/
|
|
147
|
+
supports(feature) {
|
|
148
|
+
return SUPPORTED_FEATURES.has(feature);
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/compilers/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,kBAAkB,G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SACT,CAAC;QAEF,8BAA8B;QAC9B,MAAM,MAAM,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QAErC,OAAO;YACL,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO;oBACP,OAAO,EAAE,IAAI;iBACd;aACF;YACD,OAAO,EAAE,iCAAiC,QAAQ,CAAC,KAAK,CAAC,IAAI,eAAe,QAAQ,CAAC,OAAO,CAAC,OAAO,GAAG;SACxG,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAe;QACtB,OAAO,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor compiler driver — Story 10.2.
|
|
3
|
+
*
|
|
4
|
+
* Compiles the AgentFS kernel into Cursor-native formats:
|
|
5
|
+
* - .cursorrules at vault root
|
|
6
|
+
*
|
|
7
|
+
* @module compilers/cursor
|
|
8
|
+
*/
|
|
9
|
+
import type { AgentCompiler } from '../types/index.js';
|
|
10
|
+
export declare const cursorCompiler: AgentCompiler;
|
|
11
|
+
//# sourceMappingURL=cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/compilers/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,mBAAmB,CAAC;AAEtF,eAAO,MAAM,cAAc,EAAE,aAiD5B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor compiler driver — Story 10.2.
|
|
3
|
+
*
|
|
4
|
+
* Compiles the AgentFS kernel into Cursor-native formats:
|
|
5
|
+
* - .cursorrules at vault root
|
|
6
|
+
*
|
|
7
|
+
* @module compilers/cursor
|
|
8
|
+
*/
|
|
9
|
+
export const cursorCompiler = {
|
|
10
|
+
name: 'cursor',
|
|
11
|
+
async compile(context) {
|
|
12
|
+
const { manifest, initScripts } = context;
|
|
13
|
+
const lines = [];
|
|
14
|
+
lines.push('# Cursor Rules — Generated by AgentFS');
|
|
15
|
+
lines.push('');
|
|
16
|
+
lines.push(`# Vault: ${manifest.vault?.name ?? 'AgentFS Vault'}`);
|
|
17
|
+
lines.push(`# Profile: ${manifest.agentos?.profile ?? 'personal'}`);
|
|
18
|
+
lines.push('');
|
|
19
|
+
if (initScripts['00-identity.md']) {
|
|
20
|
+
lines.push('## Identity');
|
|
21
|
+
lines.push(initScripts['00-identity.md']);
|
|
22
|
+
lines.push('');
|
|
23
|
+
}
|
|
24
|
+
if (manifest.paths) {
|
|
25
|
+
lines.push('## Directory Structure');
|
|
26
|
+
for (const [key, val] of Object.entries(manifest.paths)) {
|
|
27
|
+
if (val)
|
|
28
|
+
lines.push(`- ${key}: ${val}/`);
|
|
29
|
+
}
|
|
30
|
+
lines.push('');
|
|
31
|
+
}
|
|
32
|
+
if (manifest.boot?.sequence) {
|
|
33
|
+
lines.push('## Boot Sequence');
|
|
34
|
+
for (const script of manifest.boot.sequence) {
|
|
35
|
+
lines.push(`- ${script}`);
|
|
36
|
+
}
|
|
37
|
+
lines.push('');
|
|
38
|
+
}
|
|
39
|
+
const content = lines.join('\n');
|
|
40
|
+
return {
|
|
41
|
+
agent: 'cursor',
|
|
42
|
+
outputs: [
|
|
43
|
+
{ path: '.cursorrules', content, managed: true },
|
|
44
|
+
],
|
|
45
|
+
summary: `Compiled .cursorrules for Cursor (vault: "${manifest.vault?.name ?? 'unknown'}")`,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
supports(_feature) {
|
|
49
|
+
return false;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0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CAAC,CAAC;QACjB,CAAC;QAED,IAAI,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC/B,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC5C,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;YAC5B,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjC,OAAO;YACL,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;aACjD;YACD,OAAO,EAAE,6CAA6C,QAAQ,CAAC,KAAK,EAAE,IAAI,IAAI,SAAS,IAAI;SAC5F,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,QAAgB;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compilers barrel — re-exports all public compiler symbols.
|
|
3
|
+
*
|
|
4
|
+
* Import from here to avoid deep relative paths across the codebase:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { claudeCompiler, generateAgentsFile, buildCompileContext } from './compilers/index.js';
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* @module compilers/index
|
|
10
|
+
*/
|
|
11
|
+
export { claudeCompiler } from './claude.js';
|
|
12
|
+
export { generateAgentsFile } from './agent-map.js';
|
|
13
|
+
export { buildCompileContext, writeOutputs, readManifest } from './base.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compilers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compilers barrel — re-exports all public compiler symbols.
|
|
3
|
+
*
|
|
4
|
+
* Import from here to avoid deep relative paths across the codebase:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { claudeCompiler, generateAgentsFile, buildCompileContext } from './compilers/index.js';
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* @module compilers/index
|
|
10
|
+
*/
|
|
11
|
+
export { claudeCompiler } from './claude.js';
|
|
12
|
+
export { generateAgentsFile } from './agent-map.js';
|
|
13
|
+
export { buildCompileContext, writeOutputs, readManifest } from './base.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compilers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw compiler driver — Story 10.1.
|
|
3
|
+
*
|
|
4
|
+
* Compiles the AgentFS kernel into OpenClaw-native formats:
|
|
5
|
+
* - SOUL.md at vault root
|
|
6
|
+
* - Merges memory into .omc/project-memory.json
|
|
7
|
+
*
|
|
8
|
+
* @module compilers/openclaw
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentCompiler } from '../types/index.js';
|
|
11
|
+
export declare const openclawCompiler: AgentCompiler;
|
|
12
|
+
//# sourceMappingURL=openclaw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw.d.ts","sourceRoot":"","sources":["../../src/compilers/openclaw.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,mBAAmB,CAAC;AAEtF,eAAO,MAAM,gBAAgB,EAAE,aAgD9B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw compiler driver — Story 10.1.
|
|
3
|
+
*
|
|
4
|
+
* Compiles the AgentFS kernel into OpenClaw-native formats:
|
|
5
|
+
* - SOUL.md at vault root
|
|
6
|
+
* - Merges memory into .omc/project-memory.json
|
|
7
|
+
*
|
|
8
|
+
* @module compilers/openclaw
|
|
9
|
+
*/
|
|
10
|
+
export const openclawCompiler = {
|
|
11
|
+
name: 'openclaw',
|
|
12
|
+
async compile(context) {
|
|
13
|
+
const { manifest, initScripts, semanticMemory } = context;
|
|
14
|
+
const lines = [];
|
|
15
|
+
lines.push(`# ${manifest.vault?.name ?? 'AgentFS Vault'} — SOUL`);
|
|
16
|
+
lines.push('');
|
|
17
|
+
lines.push(`> Profile: ${manifest.agentos?.profile ?? 'personal'}`);
|
|
18
|
+
lines.push(`> Owner: ${manifest.vault?.owner ?? 'unknown'}`);
|
|
19
|
+
lines.push('');
|
|
20
|
+
if (initScripts['00-identity.md']) {
|
|
21
|
+
lines.push('## Identity');
|
|
22
|
+
lines.push(initScripts['00-identity.md']);
|
|
23
|
+
lines.push('');
|
|
24
|
+
}
|
|
25
|
+
if (semanticMemory) {
|
|
26
|
+
lines.push('## Memory');
|
|
27
|
+
lines.push(semanticMemory);
|
|
28
|
+
lines.push('');
|
|
29
|
+
}
|
|
30
|
+
if (manifest.boot?.sequence) {
|
|
31
|
+
lines.push('## Boot Sequence');
|
|
32
|
+
for (const script of manifest.boot.sequence) {
|
|
33
|
+
lines.push(`- ${script}`);
|
|
34
|
+
}
|
|
35
|
+
lines.push('');
|
|
36
|
+
}
|
|
37
|
+
const soulContent = lines.join('\n');
|
|
38
|
+
return {
|
|
39
|
+
agent: 'openclaw',
|
|
40
|
+
outputs: [
|
|
41
|
+
{ path: 'SOUL.md', content: soulContent, managed: true },
|
|
42
|
+
],
|
|
43
|
+
summary: `Compiled SOUL.md for OpenClaw (vault: "${manifest.vault?.name ?? 'unknown'}")`,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
supports(_feature) {
|
|
47
|
+
// OpenClaw doesn't support native security enforcement
|
|
48
|
+
return false;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=openclaw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw.js","sourceRoot":"","sources":["../../src/compilers/openclaw.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAkB;IAC7C,IAAI,EAAE,UAAU;IAEhB,KAAK,CAAC,OAAO,CAAC,OAAuB;QACnC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;QAE1D,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,KAAK,EAAE,IAAI,IAAI,eAAe,SAAS,CAAC,CAAC;QAClE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,cAAc,QAAQ,CAAC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,CAAC,CAAC;QACpE,KAAK,CAAC,IAAI,CAAC,YAAY,QAAQ,CAAC,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC,CAAC;QAC7D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;Q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
|
5
|
+
export type { CronJob, CronResult } from './types.js';
|
|
6
|
+
export { CRON_REGISTRY, runCronJob, runAllCronJobs } from './runner.js';
|
|
7
|
+
export { consolidateJob } from './jobs/consolidate.js';
|
|
8
|
+
export { heartbeatJob } from './jobs/heartbeat.js';
|
|
9
|
+
export { inboxTriageJob } from './jobs/inbox-triage.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cron/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cron module — barrel export.
|
|
3
|
+
* @module cron
|
|
4
|
+
*/
|
|
5
|
+
export { CRON_REGISTRY, runCronJob, runAllCronJobs } from './runner.js';
|
|
6
|
+
export { consolidateJob } from './jobs/consolidate.js';
|
|
7
|
+
export { heartbeatJob } from './jobs/heartbeat.js';
|
|
8
|
+
export { inboxTriageJob } from './jobs/inbox-triage.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cron/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consolidation cron job — Story 6.1.
|
|
3
|
+
*
|
|
4
|
+
* Runs at session end to snapshot memory state:
|
|
5
|
+
* - Reads semantic.md and reports active/superseded counts
|
|
6
|
+
* - Lists episodic entries
|
|
7
|
+
* - Lists procedural skills
|
|
8
|
+
*
|
|
9
|
+
* Future enhancement: auto-extract new facts from session transcript,
|
|
10
|
+
* detect contradictions, and trigger decay on stale patterns.
|
|
11
|
+
*
|
|
12
|
+
* @module cron/jobs/consolidate
|
|
13
|
+
*/
|
|
14
|
+
import type { CronJob } from '../types.js';
|
|
15
|
+
export declare const consolidateJob: CronJob;
|
|
16
|
+
//# sourceMappingURL=consolidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consolidate.d.ts","sourceRoot":"","sources":["../../../src/cron/jobs/consolidate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAMvD,eAAO,MAAM,cAAc,EAAE,OA6C5B,CAAC"}
|