@lumenflow/core 1.3.3 → 1.3.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.
- package/dist/adapters/filesystem-metrics.adapter.d.ts +1 -1
- package/dist/adapters/filesystem-metrics.adapter.js +1 -1
- package/dist/beacon-migration.d.ts +56 -0
- package/dist/beacon-migration.js +101 -0
- package/dist/cleanup-lock.js +3 -3
- package/dist/commands-logger.d.ts +2 -2
- package/dist/commands-logger.js +5 -5
- package/dist/core/tool-runner.d.ts +1 -1
- package/dist/core/tool-runner.js +2 -2
- package/dist/docs-path-validator.d.ts +2 -2
- package/dist/docs-path-validator.js +4 -4
- package/dist/domain/orchestration.constants.js +3 -3
- package/dist/force-bypass-audit.d.ts +2 -2
- package/dist/force-bypass-audit.js +8 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/lane-lock.d.ts +1 -1
- package/dist/lane-lock.js +3 -4
- package/dist/logs-lib.d.ts +2 -2
- package/dist/logs-lib.js +5 -4
- package/dist/lumenflow-config-schema.d.ts +1 -1
- package/dist/lumenflow-config-schema.js +19 -19
- package/dist/lumenflow-config.js +1 -1
- package/dist/merge-lock.js +7 -7
- package/dist/prompt-linter.js +3 -3
- package/dist/prompt-monitor.d.ts +1 -1
- package/dist/prompt-monitor.js +5 -5
- package/dist/rebase-artifact-cleanup.d.ts +1 -1
- package/dist/rebase-artifact-cleanup.js +1 -1
- package/dist/spawn-recovery.d.ts +2 -2
- package/dist/spawn-recovery.js +6 -6
- package/dist/spawn-registry-store.d.ts +2 -2
- package/dist/spawn-registry-store.js +2 -2
- package/dist/spawn-tree.d.ts +2 -2
- package/dist/spawn-tree.js +2 -2
- package/dist/stamp-utils.d.ts +1 -1
- package/dist/stamp-utils.js +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.js +1 -1
- package/dist/wu-checkpoint.js +4 -4
- package/dist/wu-constants.d.ts +67 -4
- package/dist/wu-constants.js +41 -15
- package/dist/wu-done-branch-only.js +2 -2
- package/dist/wu-done-inputs.js +1 -1
- package/dist/wu-done-validation.js +2 -2
- package/dist/wu-done-worktree.js +4 -4
- package/dist/wu-paths.js +1 -1
- package/dist/wu-recovery.d.ts +4 -4
- package/dist/wu-recovery.js +8 -8
- package/dist/wu-repair-core.js +4 -4
- package/dist/wu-spawn-helpers.d.ts +1 -1
- package/dist/wu-spawn-helpers.js +3 -2
- package/dist/wu-spawn.js +7 -7
- package/dist/wu-state-store.d.ts +2 -2
- package/dist/wu-state-store.js +2 -2
- package/package.json +11 -11
- package/dist/spec-branch-helpers.d.ts +0 -118
- package/dist/spec-branch-helpers.js +0 -199
package/dist/prompt-monitor.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Monitors all prompts for token budget drift and hash changes.
|
|
5
5
|
* Designed to run as a GitHub Actions cron job (nightly at 2 AM).
|
|
6
6
|
*
|
|
7
|
-
* Logs to .
|
|
7
|
+
* Logs to .lumenflow/telemetry/prompt-nightly.ndjson and Axiom.
|
|
8
8
|
* Alerts if:
|
|
9
9
|
* - Any prompt ≥400 tokens (approaching cap)
|
|
10
10
|
* - Any delta >50 tokens since yesterday
|
|
@@ -17,14 +17,14 @@ import { readFile, writeFile, mkdir, appendFile, access } from 'node:fs/promises
|
|
|
17
17
|
import { resolve, dirname } from 'path';
|
|
18
18
|
import { fileURLToPath } from 'url';
|
|
19
19
|
import { glob } from 'glob';
|
|
20
|
-
import { EXIT_CODES, STRING_LITERALS } from './wu-constants.js';
|
|
20
|
+
import { EXIT_CODES, STRING_LITERALS, LUMENFLOW_PATHS } from './wu-constants.js';
|
|
21
21
|
const __filename = fileURLToPath(import.meta.url);
|
|
22
22
|
const __dirname = dirname(__filename);
|
|
23
23
|
const ROOT_DIR = resolve(__dirname, '../..');
|
|
24
24
|
// Paths
|
|
25
|
-
const YESTERDAY_METRICS_PATH = resolve(ROOT_DIR, '
|
|
26
|
-
const TODAY_METRICS_PATH = resolve(ROOT_DIR, '
|
|
27
|
-
const NDJSON_LOG_PATH = resolve(ROOT_DIR, '
|
|
25
|
+
const YESTERDAY_METRICS_PATH = resolve(ROOT_DIR, LUMENFLOW_PATHS.TELEMETRY, 'prompt-metrics-yesterday.json');
|
|
26
|
+
const TODAY_METRICS_PATH = resolve(ROOT_DIR, LUMENFLOW_PATHS.TELEMETRY, 'prompt-metrics.json');
|
|
27
|
+
const NDJSON_LOG_PATH = resolve(ROOT_DIR, LUMENFLOW_PATHS.TELEMETRY, 'prompt-nightly.ndjson');
|
|
28
28
|
// Alert thresholds
|
|
29
29
|
const WARN_THRESHOLD = 400;
|
|
30
30
|
const DELTA_THRESHOLD = 50;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* lane branch itself) should NOT be cleaned - this was the WU-1816 bug.
|
|
24
24
|
*
|
|
25
25
|
* Checks for:
|
|
26
|
-
* 1. Stamp files (.
|
|
26
|
+
* 1. Stamp files (.lumenflow/stamps/WU-{id}.done) that exist on origin/main
|
|
27
27
|
* 2. WU YAML with status=done that also has status=done on origin/main
|
|
28
28
|
*
|
|
29
29
|
* @param {string} worktreePath - Path to the worktree directory
|
|
@@ -134,7 +134,7 @@ function writeMarkdownFile(filePath, frontmatter, lines) {
|
|
|
134
134
|
* lane branch itself) should NOT be cleaned - this was the WU-1816 bug.
|
|
135
135
|
*
|
|
136
136
|
* Checks for:
|
|
137
|
-
* 1. Stamp files (.
|
|
137
|
+
* 1. Stamp files (.lumenflow/stamps/WU-{id}.done) that exist on origin/main
|
|
138
138
|
* 2. WU YAML with status=done that also has status=done on origin/main
|
|
139
139
|
*
|
|
140
140
|
* @param {string} worktreePath - Path to the worktree directory
|
package/dist/spawn-recovery.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 2. Stale lock (>2h) -> auto-release, mark spawn timeout
|
|
10
10
|
* 3. Active lock + no checkpoint in 1h -> mark stuck, escalate
|
|
11
11
|
*
|
|
12
|
-
* All recovery actions are logged to .
|
|
12
|
+
* All recovery actions are logged to .lumenflow/recovery/ for audit.
|
|
13
13
|
*
|
|
14
14
|
* Library-First Note: This is project-specific spawn recovery code for
|
|
15
15
|
* PatientPath's custom spawn-registry.jsonl, lane-lock, and memory-store.
|
|
@@ -60,7 +60,7 @@ export declare const NO_CHECKPOINT_THRESHOLD_MS: number;
|
|
|
60
60
|
* }
|
|
61
61
|
*/
|
|
62
62
|
export interface RecoverStuckSpawnOptions {
|
|
63
|
-
/** Base directory for .
|
|
63
|
+
/** Base directory for .lumenflow/ */
|
|
64
64
|
baseDir?: string;
|
|
65
65
|
}
|
|
66
66
|
export declare function recoverStuckSpawn(spawnId: any, options?: RecoverStuckSpawnOptions): Promise<{
|
package/dist/spawn-recovery.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 2. Stale lock (>2h) -> auto-release, mark spawn timeout
|
|
10
10
|
* 3. Active lock + no checkpoint in 1h -> mark stuck, escalate
|
|
11
11
|
*
|
|
12
|
-
* All recovery actions are logged to .
|
|
12
|
+
* All recovery actions are logged to .lumenflow/recovery/ for audit.
|
|
13
13
|
*
|
|
14
14
|
* Library-First Note: This is project-specific spawn recovery code for
|
|
15
15
|
* PatientPath's custom spawn-registry.jsonl, lane-lock, and memory-store.
|
|
@@ -24,7 +24,7 @@ import path from 'node:path';
|
|
|
24
24
|
import { SpawnRegistryStore } from './spawn-registry-store.js';
|
|
25
25
|
import { SpawnStatus } from './spawn-registry-schema.js';
|
|
26
26
|
import { isZombieLock, isLockStale, readLockMetadata, getLockFilePath, releaseLaneLock, } from './lane-lock.js';
|
|
27
|
-
import { toKebab } from './wu-constants.js';
|
|
27
|
+
import { toKebab, LUMENFLOW_PATHS } from './wu-constants.js';
|
|
28
28
|
// Optional import from @lumenflow/memory
|
|
29
29
|
let loadMemory = null;
|
|
30
30
|
try {
|
|
@@ -90,10 +90,10 @@ function laneToKebab(lane) {
|
|
|
90
90
|
* Gets the recovery directory path
|
|
91
91
|
*
|
|
92
92
|
* @param {string} baseDir - Base directory
|
|
93
|
-
* @returns {string} Path to .
|
|
93
|
+
* @returns {string} Path to .lumenflow/recovery/
|
|
94
94
|
*/
|
|
95
95
|
function getRecoveryDir(baseDir) {
|
|
96
|
-
return path.join(baseDir,
|
|
96
|
+
return path.join(baseDir, LUMENFLOW_PATHS.BASE, RECOVERY_DIR_NAME);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Creates an audit log entry
|
|
@@ -123,7 +123,7 @@ async function getLastCheckpoint(baseDir, wuId) {
|
|
|
123
123
|
if (!loadMemory) {
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
|
-
const memoryDir = path.join(baseDir,
|
|
126
|
+
const memoryDir = path.join(baseDir, LUMENFLOW_PATHS.STATE_DIR);
|
|
127
127
|
try {
|
|
128
128
|
const memory = await loadMemory(memoryDir, wuId);
|
|
129
129
|
if (!memory) {
|
|
@@ -162,7 +162,7 @@ function isCheckpointRecent(checkpointTimestamp) {
|
|
|
162
162
|
}
|
|
163
163
|
export async function recoverStuckSpawn(spawnId, options = {}) {
|
|
164
164
|
const { baseDir = process.cwd() } = options;
|
|
165
|
-
const registryDir = path.join(baseDir,
|
|
165
|
+
const registryDir = path.join(baseDir, LUMENFLOW_PATHS.STATE_DIR);
|
|
166
166
|
// Load spawn registry
|
|
167
167
|
const store = new SpawnRegistryStore(registryDir);
|
|
168
168
|
try {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Spawn Registry Store (WU-1944)
|
|
3
3
|
*
|
|
4
4
|
* Event-sourced state store for tracking sub-agent spawns.
|
|
5
|
-
* Stores events in .
|
|
5
|
+
* Stores events in .lumenflow/state/spawn-registry.jsonl (append-only, git-friendly).
|
|
6
6
|
*
|
|
7
7
|
* Features:
|
|
8
8
|
* - Event sourcing with replay for current state
|
|
@@ -30,7 +30,7 @@ export declare class SpawnRegistryStore {
|
|
|
30
30
|
private readonly byParent;
|
|
31
31
|
private readonly byTarget;
|
|
32
32
|
/**
|
|
33
|
-
* @param {string} baseDir - Directory containing .
|
|
33
|
+
* @param {string} baseDir - Directory containing .lumenflow/state/
|
|
34
34
|
*/
|
|
35
35
|
constructor(baseDir: string);
|
|
36
36
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Spawn Registry Store (WU-1944)
|
|
3
3
|
*
|
|
4
4
|
* Event-sourced state store for tracking sub-agent spawns.
|
|
5
|
-
* Stores events in .
|
|
5
|
+
* Stores events in .lumenflow/state/spawn-registry.jsonl (append-only, git-friendly).
|
|
6
6
|
*
|
|
7
7
|
* Features:
|
|
8
8
|
* - Event sourcing with replay for current state
|
|
@@ -32,7 +32,7 @@ export class SpawnRegistryStore {
|
|
|
32
32
|
byParent;
|
|
33
33
|
byTarget;
|
|
34
34
|
/**
|
|
35
|
-
* @param {string} baseDir - Directory containing .
|
|
35
|
+
* @param {string} baseDir - Directory containing .lumenflow/state/
|
|
36
36
|
*/
|
|
37
37
|
constructor(baseDir) {
|
|
38
38
|
this.baseDir = baseDir;
|
package/dist/spawn-tree.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare function formatSpawnTree(tree: any): string;
|
|
|
75
75
|
* @returns {Promise<import('./spawn-registry-schema.js').SpawnEvent[]>} Array of spawn events
|
|
76
76
|
*
|
|
77
77
|
* @example
|
|
78
|
-
* const spawns = await getSpawnsByWU('WU-1000', '.
|
|
78
|
+
* const spawns = await getSpawnsByWU('WU-1000', '.lumenflow/state');
|
|
79
79
|
*/
|
|
80
80
|
export declare function getSpawnsByWU(wuId: any, baseDir: any): Promise<any[]>;
|
|
81
81
|
/**
|
|
@@ -90,7 +90,7 @@ export declare function getSpawnsByWU(wuId: any, baseDir: any): Promise<any[]>;
|
|
|
90
90
|
* @returns {Promise<import('./spawn-registry-schema.js').SpawnEvent[]>} Array of spawn events
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
|
-
* const spawns = await getSpawnsByInitiative('INIT-001', '.
|
|
93
|
+
* const spawns = await getSpawnsByInitiative('INIT-001', '.lumenflow/state', 'docs/04-operations/tasks/wu');
|
|
94
94
|
*/
|
|
95
95
|
export declare function getSpawnsByInitiative(initiativeId: any, registryDir: any, wuDir: any): Promise<{
|
|
96
96
|
id: string;
|
package/dist/spawn-tree.js
CHANGED
|
@@ -153,7 +153,7 @@ export function formatSpawnTree(tree) {
|
|
|
153
153
|
* @returns {Promise<import('./spawn-registry-schema.js').SpawnEvent[]>} Array of spawn events
|
|
154
154
|
*
|
|
155
155
|
* @example
|
|
156
|
-
* const spawns = await getSpawnsByWU('WU-1000', '.
|
|
156
|
+
* const spawns = await getSpawnsByWU('WU-1000', '.lumenflow/state');
|
|
157
157
|
*/
|
|
158
158
|
export async function getSpawnsByWU(wuId, baseDir) {
|
|
159
159
|
const store = new SpawnRegistryStore(baseDir);
|
|
@@ -205,7 +205,7 @@ export async function getSpawnsByWU(wuId, baseDir) {
|
|
|
205
205
|
* @returns {Promise<import('./spawn-registry-schema.js').SpawnEvent[]>} Array of spawn events
|
|
206
206
|
*
|
|
207
207
|
* @example
|
|
208
|
-
* const spawns = await getSpawnsByInitiative('INIT-001', '.
|
|
208
|
+
* const spawns = await getSpawnsByInitiative('INIT-001', '.lumenflow/state', 'docs/04-operations/tasks/wu');
|
|
209
209
|
*/
|
|
210
210
|
export async function getSpawnsByInitiative(initiativeId, registryDir, wuDir) {
|
|
211
211
|
// Get all WUs belonging to initiative
|
package/dist/stamp-utils.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* WU-2242: Added format validation for corrupted stamp detection
|
|
8
8
|
*
|
|
9
|
-
* Stamp files (.
|
|
9
|
+
* Stamp files (.lumenflow/stamps/WU-{id}.done) serve as completion markers
|
|
10
10
|
* Used by wu:done, wu:recovery, and validation tools
|
|
11
11
|
*/
|
|
12
12
|
/**
|
package/dist/stamp-utils.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* WU-2242: Added format validation for corrupted stamp detection
|
|
8
8
|
*
|
|
9
|
-
* Stamp files (.
|
|
9
|
+
* Stamp files (.lumenflow/stamps/WU-{id}.done) serve as completion markers
|
|
10
10
|
* Used by wu:done, wu:recovery, and validation tools
|
|
11
11
|
*/
|
|
12
12
|
/* eslint-disable security/detect-non-literal-fs-filename */
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare function emitLLMClassificationComplete(data: any, logPath?: strin
|
|
|
69
69
|
*/
|
|
70
70
|
export declare function emitLLMClassificationError(data: any, logPath?: string): void;
|
|
71
71
|
/**
|
|
72
|
-
* Emit WU flow telemetry event to .
|
|
72
|
+
* Emit WU flow telemetry event to .lumenflow/flow.log
|
|
73
73
|
*
|
|
74
74
|
* Used by wu-claim, wu-done, wu-unblock for workflow tracking.
|
|
75
75
|
* Centralized from duplicated emitTelemetry() functions (WU-1256).
|
package/dist/telemetry.js
CHANGED
|
@@ -188,7 +188,7 @@ export function emitLLMClassificationError(data, logPath = LLM_CLASSIFICATION_LO
|
|
|
188
188
|
emit(logPath, event);
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
* Emit WU flow telemetry event to .
|
|
191
|
+
* Emit WU flow telemetry event to .lumenflow/flow.log
|
|
192
192
|
*
|
|
193
193
|
* Used by wu-claim, wu-done, wu-unblock for workflow tracking.
|
|
194
194
|
* Centralized from duplicated emitTelemetry() functions (WU-1256).
|
package/dist/wu-checkpoint.js
CHANGED
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
import { existsSync, readFileSync, writeFileSync, unlinkSync, mkdirSync } from 'node:fs';
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import crypto from 'node:crypto';
|
|
19
|
-
import { LOG_PREFIX, EMOJI } from './wu-constants.js';
|
|
19
|
+
import { LOG_PREFIX, EMOJI, LUMENFLOW_PATHS } from './wu-constants.js';
|
|
20
20
|
/**
|
|
21
21
|
* Schema version for checkpoint files
|
|
22
22
|
* Increment when checkpoint format changes
|
|
23
23
|
*/
|
|
24
24
|
export const CHECKPOINT_SCHEMA_VERSION = 1;
|
|
25
25
|
/**
|
|
26
|
-
* Checkpoint directory within .
|
|
26
|
+
* Checkpoint directory within .lumenflow
|
|
27
27
|
*/
|
|
28
28
|
const CHECKPOINT_DIR = 'checkpoints';
|
|
29
29
|
/**
|
|
@@ -39,7 +39,7 @@ const CHECKPOINT_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
|
39
39
|
*/
|
|
40
40
|
function getCheckpointPath(wuId, options = {}) {
|
|
41
41
|
const baseDir = options.baseDir || process.cwd();
|
|
42
|
-
return path.join(baseDir,
|
|
42
|
+
return path.join(baseDir, LUMENFLOW_PATHS.BASE, CHECKPOINT_DIR, `${wuId}.checkpoint.json`);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Ensure checkpoint directory exists
|
|
@@ -48,7 +48,7 @@ function getCheckpointPath(wuId, options = {}) {
|
|
|
48
48
|
*/
|
|
49
49
|
function ensureCheckpointDir(options = {}) {
|
|
50
50
|
const baseDir = options.baseDir || process.cwd();
|
|
51
|
-
const checkpointDir = path.join(baseDir,
|
|
51
|
+
const checkpointDir = path.join(baseDir, LUMENFLOW_PATHS.BASE, CHECKPOINT_DIR);
|
|
52
52
|
if (!existsSync(checkpointDir)) {
|
|
53
53
|
mkdirSync(checkpointDir, { recursive: true });
|
|
54
54
|
}
|
package/dist/wu-constants.d.ts
CHANGED
|
@@ -1102,7 +1102,7 @@ export declare const GIT_COMMAND_STRINGS: {
|
|
|
1102
1102
|
export declare const PATH_PATTERNS: {
|
|
1103
1103
|
/** Matches WU YAML paths in both legacy and current locations */
|
|
1104
1104
|
WU_YAML: RegExp;
|
|
1105
|
-
/** Matches stamp file paths */
|
|
1105
|
+
/** Matches stamp file paths (supports both .beacon and .lumenflow for migration) */
|
|
1106
1106
|
STAMP: RegExp;
|
|
1107
1107
|
};
|
|
1108
1108
|
/**
|
|
@@ -1208,12 +1208,57 @@ export declare const ERROR_CODES: {
|
|
|
1208
1208
|
ETIMEDOUT: string;
|
|
1209
1209
|
};
|
|
1210
1210
|
/**
|
|
1211
|
-
*
|
|
1211
|
+
* LumenFlow directory paths
|
|
1212
1212
|
*
|
|
1213
|
-
* Centralized paths for .
|
|
1214
|
-
* Used by telemetry, agent-session, agent-incidents, and commands-logger modules.
|
|
1213
|
+
* Centralized paths for .lumenflow directory structure to eliminate hardcoded strings.
|
|
1214
|
+
* Used by telemetry, agent-session, agent-incidents, memory, and commands-logger modules.
|
|
1215
|
+
*
|
|
1216
|
+
* @since 1.4.0 Renamed from BEACON_PATHS (WU-1075)
|
|
1217
|
+
*/
|
|
1218
|
+
export declare const LUMENFLOW_PATHS: {
|
|
1219
|
+
/** Base directory for all LumenFlow runtime data */
|
|
1220
|
+
BASE: string;
|
|
1221
|
+
/** WU state store directory */
|
|
1222
|
+
STATE_DIR: string;
|
|
1223
|
+
/** Stamp directory (WU completion markers) */
|
|
1224
|
+
STAMPS_DIR: string;
|
|
1225
|
+
/** Merge lock file (runtime coordination, WU-1747) */
|
|
1226
|
+
MERGE_LOCK: string;
|
|
1227
|
+
/** Base telemetry directory */
|
|
1228
|
+
TELEMETRY: string;
|
|
1229
|
+
/** Flow log file (WU flow events) */
|
|
1230
|
+
FLOW_LOG: string;
|
|
1231
|
+
/** Agent sessions directory */
|
|
1232
|
+
SESSIONS: string;
|
|
1233
|
+
/** Agent incidents directory */
|
|
1234
|
+
INCIDENTS: string;
|
|
1235
|
+
/** Git commands log file */
|
|
1236
|
+
COMMANDS_LOG: string;
|
|
1237
|
+
/** Memory layer directory */
|
|
1238
|
+
MEMORY_DIR: string;
|
|
1239
|
+
/** Memory layer JSONL file */
|
|
1240
|
+
MEMORY_JSONL: string;
|
|
1241
|
+
/** Audit log for tool calls */
|
|
1242
|
+
AUDIT_LOG: string;
|
|
1243
|
+
/** Feedback drafts directory */
|
|
1244
|
+
FEEDBACK_DRAFTS: string;
|
|
1245
|
+
/** Feedback index file */
|
|
1246
|
+
FEEDBACK_INDEX: string;
|
|
1247
|
+
/** Current session file */
|
|
1248
|
+
SESSION_CURRENT: string;
|
|
1249
|
+
/** WU events log */
|
|
1250
|
+
WU_EVENTS: string;
|
|
1251
|
+
/** Lock files directory */
|
|
1252
|
+
LOCKS_DIR: string;
|
|
1253
|
+
/** Force bypass audit log */
|
|
1254
|
+
FORCE_BYPASSES: string;
|
|
1255
|
+
};
|
|
1256
|
+
/**
|
|
1257
|
+
* @deprecated Use LUMENFLOW_PATHS instead. Will be removed in v2.0.
|
|
1215
1258
|
*/
|
|
1216
1259
|
export declare const BEACON_PATHS: {
|
|
1260
|
+
/** Base directory for all LumenFlow runtime data */
|
|
1261
|
+
BASE: string;
|
|
1217
1262
|
/** WU state store directory */
|
|
1218
1263
|
STATE_DIR: string;
|
|
1219
1264
|
/** Stamp directory (WU completion markers) */
|
|
@@ -1230,6 +1275,24 @@ export declare const BEACON_PATHS: {
|
|
|
1230
1275
|
INCIDENTS: string;
|
|
1231
1276
|
/** Git commands log file */
|
|
1232
1277
|
COMMANDS_LOG: string;
|
|
1278
|
+
/** Memory layer directory */
|
|
1279
|
+
MEMORY_DIR: string;
|
|
1280
|
+
/** Memory layer JSONL file */
|
|
1281
|
+
MEMORY_JSONL: string;
|
|
1282
|
+
/** Audit log for tool calls */
|
|
1283
|
+
AUDIT_LOG: string;
|
|
1284
|
+
/** Feedback drafts directory */
|
|
1285
|
+
FEEDBACK_DRAFTS: string;
|
|
1286
|
+
/** Feedback index file */
|
|
1287
|
+
FEEDBACK_INDEX: string;
|
|
1288
|
+
/** Current session file */
|
|
1289
|
+
SESSION_CURRENT: string;
|
|
1290
|
+
/** WU events log */
|
|
1291
|
+
WU_EVENTS: string;
|
|
1292
|
+
/** Lock files directory */
|
|
1293
|
+
LOCKS_DIR: string;
|
|
1294
|
+
/** Force bypass audit log */
|
|
1295
|
+
FORCE_BYPASSES: string;
|
|
1233
1296
|
};
|
|
1234
1297
|
/**
|
|
1235
1298
|
* File extensions
|
package/dist/wu-constants.js
CHANGED
|
@@ -1145,8 +1145,8 @@ export const GIT_COMMAND_STRINGS = {
|
|
|
1145
1145
|
export const PATH_PATTERNS = {
|
|
1146
1146
|
/** Matches WU YAML paths in both legacy and current locations */
|
|
1147
1147
|
WU_YAML: /(?:memory-bank|docs\/04-operations)\/tasks\/wu\/(WU-\d+)\.ya?ml$/i,
|
|
1148
|
-
/** Matches stamp file paths */
|
|
1149
|
-
STAMP: /\.beacon\/stamps\/(WU-\d+)\.done$/i,
|
|
1148
|
+
/** Matches stamp file paths (supports both .beacon and .lumenflow for migration) */
|
|
1149
|
+
STAMP: /\.(?:beacon|lumenflow)\/stamps\/(WU-\d+)\.done$/i,
|
|
1150
1150
|
};
|
|
1151
1151
|
/**
|
|
1152
1152
|
* Common shell commands
|
|
@@ -1251,29 +1251,55 @@ export const ERROR_CODES = {
|
|
|
1251
1251
|
ETIMEDOUT: 'ETIMEDOUT',
|
|
1252
1252
|
};
|
|
1253
1253
|
/**
|
|
1254
|
-
*
|
|
1254
|
+
* LumenFlow directory paths
|
|
1255
1255
|
*
|
|
1256
|
-
* Centralized paths for .
|
|
1257
|
-
* Used by telemetry, agent-session, agent-incidents, and commands-logger modules.
|
|
1256
|
+
* Centralized paths for .lumenflow directory structure to eliminate hardcoded strings.
|
|
1257
|
+
* Used by telemetry, agent-session, agent-incidents, memory, and commands-logger modules.
|
|
1258
|
+
*
|
|
1259
|
+
* @since 1.4.0 Renamed from BEACON_PATHS (WU-1075)
|
|
1258
1260
|
*/
|
|
1259
|
-
export const
|
|
1261
|
+
export const LUMENFLOW_PATHS = {
|
|
1262
|
+
/** Base directory for all LumenFlow runtime data */
|
|
1263
|
+
BASE: '.lumenflow',
|
|
1260
1264
|
/** WU state store directory */
|
|
1261
|
-
STATE_DIR: '.
|
|
1265
|
+
STATE_DIR: '.lumenflow/state',
|
|
1262
1266
|
/** Stamp directory (WU completion markers) */
|
|
1263
|
-
STAMPS_DIR: '.
|
|
1267
|
+
STAMPS_DIR: '.lumenflow/stamps',
|
|
1264
1268
|
/** Merge lock file (runtime coordination, WU-1747) */
|
|
1265
|
-
MERGE_LOCK: '.
|
|
1269
|
+
MERGE_LOCK: '.lumenflow/merge.lock',
|
|
1266
1270
|
/** Base telemetry directory */
|
|
1267
|
-
TELEMETRY: '.
|
|
1271
|
+
TELEMETRY: '.lumenflow/telemetry',
|
|
1268
1272
|
/** Flow log file (WU flow events) */
|
|
1269
|
-
FLOW_LOG: '.
|
|
1273
|
+
FLOW_LOG: '.lumenflow/flow.log',
|
|
1270
1274
|
/** Agent sessions directory */
|
|
1271
|
-
SESSIONS: '.
|
|
1275
|
+
SESSIONS: '.lumenflow/sessions',
|
|
1272
1276
|
/** Agent incidents directory */
|
|
1273
|
-
INCIDENTS: '.
|
|
1277
|
+
INCIDENTS: '.lumenflow/incidents',
|
|
1274
1278
|
/** Git commands log file */
|
|
1275
|
-
COMMANDS_LOG: '.
|
|
1276
|
-
|
|
1279
|
+
COMMANDS_LOG: '.lumenflow/commands.log',
|
|
1280
|
+
/** Memory layer directory */
|
|
1281
|
+
MEMORY_DIR: '.lumenflow/memory',
|
|
1282
|
+
/** Memory layer JSONL file */
|
|
1283
|
+
MEMORY_JSONL: '.lumenflow/memory/memory.jsonl',
|
|
1284
|
+
/** Audit log for tool calls */
|
|
1285
|
+
AUDIT_LOG: '.lumenflow/telemetry/tools.ndjson',
|
|
1286
|
+
/** Feedback drafts directory */
|
|
1287
|
+
FEEDBACK_DRAFTS: '.lumenflow/feedback-drafts',
|
|
1288
|
+
/** Feedback index file */
|
|
1289
|
+
FEEDBACK_INDEX: '.lumenflow/feedback-index.ndjson',
|
|
1290
|
+
/** Current session file */
|
|
1291
|
+
SESSION_CURRENT: '.lumenflow/sessions/current.json',
|
|
1292
|
+
/** WU events log */
|
|
1293
|
+
WU_EVENTS: '.lumenflow/state/wu-events.jsonl',
|
|
1294
|
+
/** Lock files directory */
|
|
1295
|
+
LOCKS_DIR: '.lumenflow/locks',
|
|
1296
|
+
/** Force bypass audit log */
|
|
1297
|
+
FORCE_BYPASSES: '.lumenflow/force-bypasses.log',
|
|
1298
|
+
};
|
|
1299
|
+
/**
|
|
1300
|
+
* @deprecated Use LUMENFLOW_PATHS instead. Will be removed in v2.0.
|
|
1301
|
+
*/
|
|
1302
|
+
export const BEACON_PATHS = LUMENFLOW_PATHS;
|
|
1277
1303
|
/**
|
|
1278
1304
|
* File extensions
|
|
1279
1305
|
*
|
|
@@ -17,7 +17,7 @@ import path from 'node:path';
|
|
|
17
17
|
import { defaultBranchFrom, branchExists, generateCommitMessage, updateMetadataFiles, stageAndFormatMetadata, } from './wu-done-validators.js';
|
|
18
18
|
import { getGitForCwd } from './git-adapter.js';
|
|
19
19
|
import { readWU } from './wu-yaml.js';
|
|
20
|
-
import { BRANCHES, REMOTES, LOG_PREFIX, EMOJI, STRING_LITERALS } from './wu-constants.js';
|
|
20
|
+
import { BRANCHES, REMOTES, LOG_PREFIX, EMOJI, STRING_LITERALS, LUMENFLOW_PATHS, } from './wu-constants.js';
|
|
21
21
|
import { RECOVERY } from './wu-done-messages.js';
|
|
22
22
|
import { die, createError, ErrorCodes } from './error-handler.js';
|
|
23
23
|
import { validateWU, validateDoneWU } from './wu-schema.js';
|
|
@@ -78,7 +78,7 @@ export async function executeBranchOnlyCompletion(context) {
|
|
|
78
78
|
const metadataWUPath = path.join(metadataBasePath, 'docs', '04-operations', 'tasks', 'wu', `${id}.yaml`);
|
|
79
79
|
const metadataStatusPath = path.join(metadataBasePath, 'docs', '04-operations', 'tasks', 'status.md');
|
|
80
80
|
const metadataBacklogPath = path.join(metadataBasePath, 'docs', '04-operations', 'tasks', 'backlog.md');
|
|
81
|
-
const metadataStampsDir = path.join(metadataBasePath,
|
|
81
|
+
const metadataStampsDir = path.join(metadataBasePath, LUMENFLOW_PATHS.STAMPS_DIR);
|
|
82
82
|
const metadataStampPath = path.join(metadataStampsDir, `${id}.done`);
|
|
83
83
|
// Step 3: Read WU YAML and validate current state
|
|
84
84
|
const docForUpdate = readWU(metadataWUPath, id);
|
package/dist/wu-done-inputs.js
CHANGED
|
@@ -36,7 +36,7 @@ export function validateInputs(argv) {
|
|
|
36
36
|
' • A separate WU exists to fix those failures (specify with --fix-wu)\n' +
|
|
37
37
|
' • Your WU work is genuinely complete\n\n' +
|
|
38
38
|
' NEVER use --skip-gates for failures introduced by your WU!\n' +
|
|
39
|
-
' All skip-gates events are logged to .
|
|
39
|
+
' All skip-gates events are logged to .lumenflow/skip-gates-audit.log\n\n' +
|
|
40
40
|
'📝 WU VALIDATOR:\n' +
|
|
41
41
|
' Automatically scans code_paths for:\n' +
|
|
42
42
|
' • TODO/FIXME/HACK/XXX comments (fails validation unless --allow-todo)\n' +
|
|
@@ -260,7 +260,7 @@ const DOCS_ONLY_ALLOWED_PATTERNS = [
|
|
|
260
260
|
/^memory-bank\//i,
|
|
261
261
|
/^docs\//i,
|
|
262
262
|
/\.md$/i,
|
|
263
|
-
/^\.beacon\/stamps\//i,
|
|
263
|
+
/^\.(?:beacon|lumenflow)\/stamps\//i, // Support both legacy .beacon and .lumenflow
|
|
264
264
|
/^\.claude\//i,
|
|
265
265
|
/^ai\//i,
|
|
266
266
|
/^README\.md$/i,
|
|
@@ -332,7 +332,7 @@ Allowed paths for documentation WUs:
|
|
|
332
332
|
- ai/
|
|
333
333
|
- .claude/
|
|
334
334
|
- memory-bank/
|
|
335
|
-
- .beacon/stamps/
|
|
335
|
+
- .lumenflow/stamps/ (or legacy .beacon/stamps/)
|
|
336
336
|
- *.md files
|
|
337
337
|
|
|
338
338
|
After fixing, retry: pnpm wu:done --id ${id}
|
package/dist/wu-done-worktree.js
CHANGED
|
@@ -115,7 +115,7 @@ export async function executeWorktreeCompletion(context) {
|
|
|
115
115
|
console.log(`${BOX.SIDE} 4. Return to main and retry wu:done`);
|
|
116
116
|
console.log(BOX.SIDE);
|
|
117
117
|
console.log(`${BOX.SIDE} Or reset the recovery counter:`);
|
|
118
|
-
console.log(`${BOX.SIDE} rm .
|
|
118
|
+
console.log(`${BOX.SIDE} rm .lumenflow/recovery/${id}.recovery`);
|
|
119
119
|
console.log(BOX.BOT);
|
|
120
120
|
throw createRecoveryError(`Recovery loop detected for ${id} after ${attemptCount} attempts. Manual intervention required.`, { wuId: id, attemptCount, maxAttempts: MAX_RECOVERY_ATTEMPTS });
|
|
121
121
|
}
|
|
@@ -232,7 +232,7 @@ export async function executeWorktreeCompletion(context) {
|
|
|
232
232
|
// WU-2310: Capture file state before transaction commit
|
|
233
233
|
// This allows rollback if git commit fails AFTER files are written
|
|
234
234
|
// Note: We use the relative paths since we're already chdir'd into the worktree
|
|
235
|
-
const workingEventsPath = path.join('.
|
|
235
|
+
const workingEventsPath = path.join('.lumenflow', 'state', WU_EVENTS_FILE_NAME);
|
|
236
236
|
const pathsToSnapshot = [
|
|
237
237
|
workingWUPath,
|
|
238
238
|
workingStatusPath,
|
|
@@ -571,12 +571,12 @@ export async function checkBranchDrift(branch) {
|
|
|
571
571
|
*/
|
|
572
572
|
const APPEND_ONLY_FILES = [
|
|
573
573
|
// State store events file (append-only by design)
|
|
574
|
-
path.join('.
|
|
574
|
+
path.join('.lumenflow', 'state', WU_EVENTS_FILE_NAME),
|
|
575
575
|
// Status and backlog are generated from state store but may conflict during rebase
|
|
576
576
|
WU_PATHS.STATUS(),
|
|
577
577
|
WU_PATHS.BACKLOG(),
|
|
578
578
|
];
|
|
579
|
-
const WU_EVENTS_PATH = path.join('.
|
|
579
|
+
const WU_EVENTS_PATH = path.join('.lumenflow', 'state', WU_EVENTS_FILE_NAME);
|
|
580
580
|
function normalizeEventForKey(event) {
|
|
581
581
|
const normalized = {};
|
|
582
582
|
for (const key of Object.keys(event).sort()) {
|
package/dist/wu-paths.js
CHANGED
|
@@ -19,7 +19,7 @@ const PATH_DEPTHS = {
|
|
|
19
19
|
STATUS: 4,
|
|
20
20
|
/** WU YAML files are 5 levels deep: docs/04-operations/tasks/wu/{id}.yaml */
|
|
21
21
|
WU_YAML: 5,
|
|
22
|
-
/** State store is 3 levels deep: .
|
|
22
|
+
/** State store is 3 levels deep: .lumenflow/state/wu-events.jsonl */
|
|
23
23
|
STATE_STORE: 3,
|
|
24
24
|
};
|
|
25
25
|
/**
|
package/dist/wu-recovery.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare const MAX_RECOVERY_ATTEMPTS: 4;
|
|
|
23
23
|
* WU-1335: Get the path to the recovery marker file for a WU
|
|
24
24
|
*
|
|
25
25
|
* @param {string} id - WU ID
|
|
26
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
26
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
27
27
|
* @returns {string} Path to recovery marker file
|
|
28
28
|
*/
|
|
29
29
|
export declare function getRecoveryMarkerPath(id: any, baseDir?: string): string;
|
|
@@ -31,7 +31,7 @@ export declare function getRecoveryMarkerPath(id: any, baseDir?: string): string
|
|
|
31
31
|
* WU-1335: Get the current recovery attempt count for a WU
|
|
32
32
|
*
|
|
33
33
|
* @param {string} id - WU ID
|
|
34
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
34
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
35
35
|
* @returns {number} Current attempt count (0 if no marker exists)
|
|
36
36
|
*/
|
|
37
37
|
export declare function getRecoveryAttemptCount(id: any, baseDir?: string): any;
|
|
@@ -39,7 +39,7 @@ export declare function getRecoveryAttemptCount(id: any, baseDir?: string): any;
|
|
|
39
39
|
* WU-1335: Increment recovery attempt count for a WU
|
|
40
40
|
*
|
|
41
41
|
* @param {string} id - WU ID
|
|
42
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
42
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
43
43
|
* @returns {number} New attempt count
|
|
44
44
|
*/
|
|
45
45
|
export declare function incrementRecoveryAttempt(id: any, baseDir?: string): any;
|
|
@@ -47,7 +47,7 @@ export declare function incrementRecoveryAttempt(id: any, baseDir?: string): any
|
|
|
47
47
|
* WU-1335: Clear recovery attempts for a WU (called on successful recovery)
|
|
48
48
|
*
|
|
49
49
|
* @param {string} id - WU ID
|
|
50
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
50
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
51
51
|
*/
|
|
52
52
|
export declare function clearRecoveryAttempts(id: any, baseDir?: string): void;
|
|
53
53
|
/**
|
package/dist/wu-recovery.js
CHANGED
|
@@ -25,7 +25,7 @@ import { moveWUToDoneBacklog } from './wu-backlog-updater.js';
|
|
|
25
25
|
import { getGitForCwd } from './git-adapter.js';
|
|
26
26
|
import { createError, ErrorCodes } from './error-handler.js';
|
|
27
27
|
import { rollbackFiles } from './rollback-utils.js';
|
|
28
|
-
import { LOG_PREFIX, EMOJI, WU_STATUS, getProjectRoot } from './wu-constants.js';
|
|
28
|
+
import { LOG_PREFIX, EMOJI, WU_STATUS, getProjectRoot, LUMENFLOW_PATHS, } from './wu-constants.js';
|
|
29
29
|
import { RETRY_PRESETS } from './retry-strategy.js';
|
|
30
30
|
/**
|
|
31
31
|
* WU-1335: Maximum number of recovery attempts before escalating to manual intervention
|
|
@@ -33,24 +33,24 @@ import { RETRY_PRESETS } from './retry-strategy.js';
|
|
|
33
33
|
*/
|
|
34
34
|
export const MAX_RECOVERY_ATTEMPTS = RETRY_PRESETS.recovery.maxAttempts;
|
|
35
35
|
/**
|
|
36
|
-
* WU-1335: Recovery marker subdirectory within .
|
|
36
|
+
* WU-1335: Recovery marker subdirectory within .lumenflow
|
|
37
37
|
*/
|
|
38
38
|
const RECOVERY_MARKER_DIR = 'recovery';
|
|
39
39
|
/**
|
|
40
40
|
* WU-1335: Get the path to the recovery marker file for a WU
|
|
41
41
|
*
|
|
42
42
|
* @param {string} id - WU ID
|
|
43
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
43
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
44
44
|
* @returns {string} Path to recovery marker file
|
|
45
45
|
*/
|
|
46
46
|
export function getRecoveryMarkerPath(id, baseDir = process.cwd()) {
|
|
47
|
-
return join(baseDir,
|
|
47
|
+
return join(baseDir, LUMENFLOW_PATHS.BASE, RECOVERY_MARKER_DIR, `${id}.recovery`);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* WU-1335: Get the current recovery attempt count for a WU
|
|
51
51
|
*
|
|
52
52
|
* @param {string} id - WU ID
|
|
53
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
53
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
54
54
|
* @returns {number} Current attempt count (0 if no marker exists)
|
|
55
55
|
*/
|
|
56
56
|
export function getRecoveryAttemptCount(id, baseDir = process.cwd()) {
|
|
@@ -71,12 +71,12 @@ export function getRecoveryAttemptCount(id, baseDir = process.cwd()) {
|
|
|
71
71
|
* WU-1335: Increment recovery attempt count for a WU
|
|
72
72
|
*
|
|
73
73
|
* @param {string} id - WU ID
|
|
74
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
74
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
75
75
|
* @returns {number} New attempt count
|
|
76
76
|
*/
|
|
77
77
|
export function incrementRecoveryAttempt(id, baseDir = process.cwd()) {
|
|
78
78
|
const markerPath = getRecoveryMarkerPath(id, baseDir);
|
|
79
|
-
const markerDir = join(baseDir,
|
|
79
|
+
const markerDir = join(baseDir, LUMENFLOW_PATHS.BASE, RECOVERY_MARKER_DIR);
|
|
80
80
|
// Ensure directory exists
|
|
81
81
|
if (!existsSync(markerDir)) {
|
|
82
82
|
mkdirSync(markerDir, { recursive: true });
|
|
@@ -95,7 +95,7 @@ export function incrementRecoveryAttempt(id, baseDir = process.cwd()) {
|
|
|
95
95
|
* WU-1335: Clear recovery attempts for a WU (called on successful recovery)
|
|
96
96
|
*
|
|
97
97
|
* @param {string} id - WU ID
|
|
98
|
-
* @param {string} [baseDir=process.cwd()] - Base directory for .
|
|
98
|
+
* @param {string} [baseDir=process.cwd()] - Base directory for .lumenflow
|
|
99
99
|
*/
|
|
100
100
|
export function clearRecoveryAttempts(id, baseDir = process.cwd()) {
|
|
101
101
|
const markerPath = getRecoveryMarkerPath(id, baseDir);
|