@lumenflow/agent 1.3.4 → 1.3.6

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.
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'fs';
3
3
  import { join } from 'path';
4
4
  import { VALIDATION_LIMITS } from '@lumenflow/core/lib/wu-validation-constants.js';
5
- import { BEACON_PATHS, FILE_EXTENSIONS, STRING_LITERALS, } from '@lumenflow/core/lib/wu-constants.js';
5
+ import { LUMENFLOW_PATHS, FILE_EXTENSIONS, STRING_LITERALS, } from '@lumenflow/core/lib/wu-constants.js';
6
6
  /**
7
7
  * Incident severity values as a const tuple for z.enum
8
8
  */
@@ -13,7 +13,7 @@ const SEVERITY_VALUES = ['blocker', 'major', 'minor', 'info'];
13
13
  const CATEGORY_VALUES = ['workflow', 'tooling', 'confusion', 'violation', 'error'];
14
14
  /**
15
15
  * IncidentLog schema for structured issue tracking
16
- * Stored as NDJSON in .beacon/incidents/<category>.ndjson
16
+ * Stored as NDJSON in .lumenflow/incidents/<category>.ndjson
17
17
  */
18
18
  export const IncidentLogSchema = z.object({
19
19
  timestamp: z.string().datetime(), // ISO 8601 with timezone
@@ -44,7 +44,7 @@ export const IncidentLogSchema = z.object({
44
44
  * @param incidentsDir - Optional directory override (for testing)
45
45
  * @throws {z.ZodError} if incident data is invalid
46
46
  */
47
- export function appendIncident(incident, incidentsDir = BEACON_PATHS.INCIDENTS) {
47
+ export function appendIncident(incident, incidentsDir = LUMENFLOW_PATHS.INCIDENTS) {
48
48
  // Validate against schema
49
49
  const validated = IncidentLogSchema.parse(incident);
50
50
  // Ensure incidents directory exists
@@ -62,7 +62,7 @@ export function appendIncident(incident, incidentsDir = BEACON_PATHS.INCIDENTS)
62
62
  * @param incidentsDir - Optional directory override (for testing)
63
63
  * @returns Parsed and validated incidents
64
64
  */
65
- export function readIncidents(categories = null, since = null, incidentsDir = BEACON_PATHS.INCIDENTS) {
65
+ export function readIncidents(categories = null, since = null, incidentsDir = LUMENFLOW_PATHS.INCIDENTS) {
66
66
  if (!existsSync(incidentsDir))
67
67
  return [];
68
68
  const categoriesToRead = categories ?? CATEGORY_VALUES;
@@ -3,7 +3,7 @@ import { existsSync } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { createError, ErrorCodes } from '@lumenflow/core/lib/error-handler.js';
6
- import { PATTERNS, BRANCHES, STRING_LITERALS, EXIT_CODES, } from '@lumenflow/core/lib/wu-constants.js';
6
+ import { PATTERNS, BRANCHES, STRING_LITERALS, EXIT_CODES, LUMENFLOW_PATHS, } from '@lumenflow/core/lib/wu-constants.js';
7
7
  function run(cmd) {
8
8
  try {
9
9
  return execSync(cmd, { stdio: 'pipe', encoding: 'utf-8' }).trim();
@@ -30,12 +30,12 @@ function checkGitStatus(runFn = run) {
30
30
  return `Working tree dirty (stage or discard changes): ${lines.join('; ')}`;
31
31
  }
32
32
  function stampPath(wuId) {
33
- return path.join('.beacon', 'stamps', `${wuId}.done`);
33
+ return path.join(LUMENFLOW_PATHS.STAMPS_DIR, `${wuId}.done`);
34
34
  }
35
35
  function checkStamp(wuId, existsFn = existsSync) {
36
36
  if (existsFn(stampPath(wuId)))
37
37
  return null;
38
- return `Missing stamp .beacon/stamps/${wuId}.done`;
38
+ return `Missing stamp ${LUMENFLOW_PATHS.STAMPS_DIR}/${wuId}.done`;
39
39
  }
40
40
  function checkCommit(wuId, runFn = run) {
41
41
  const history = runFn(`git log --oneline ${BRANCHES.MAIN} -- docs/04-operations/tasks/wu/${wuId}.yaml | head -n 1`);
@@ -16,8 +16,7 @@ import { randomUUID } from 'crypto';
16
16
  import { readFileSync, writeFileSync, existsSync, unlinkSync, mkdirSync } from 'fs';
17
17
  import { join } from 'path';
18
18
  import { startSession as startMemorySession } from '@lumenflow/memory/start';
19
- // Default session directory (same as agent-session.mjs)
20
- const DEFAULT_SESSION_DIR = '.beacon/sessions';
19
+ import { LUMENFLOW_PATHS } from '@lumenflow/core/lib/wu-constants.js';
21
20
  const SESSION_FILENAME = 'current.json';
22
21
  // Default context tier for auto-started sessions
23
22
  const DEFAULT_TIER = 2;
@@ -53,7 +52,7 @@ function getSessionFilePath(sessionDir) {
53
52
  */
54
53
  export async function startSessionForWU(options) {
55
54
  const { wuId, tier = DEFAULT_TIER, agentType = DEFAULT_AGENT_TYPE, sessionDir, baseDir = process.cwd(), } = options;
56
- const sessDir = sessionDir ?? DEFAULT_SESSION_DIR;
55
+ const sessDir = sessionDir ?? LUMENFLOW_PATHS.SESSIONS;
57
56
  const sessionFile = getSessionFilePath(sessDir);
58
57
  // Check for existing session - return it instead of throwing
59
58
  if (existsSync(sessionFile)) {
@@ -114,7 +113,7 @@ export async function startSessionForWU(options) {
114
113
  */
115
114
  export function endSessionForWU(options = {}) {
116
115
  const { sessionDir } = options;
117
- const sessDir = sessionDir ?? DEFAULT_SESSION_DIR;
116
+ const sessDir = sessionDir ?? LUMENFLOW_PATHS.SESSIONS;
118
117
  const sessionFile = getSessionFilePath(sessDir);
119
118
  // Check for active session - return early if none
120
119
  if (!existsSync(sessionFile)) {
@@ -153,7 +152,7 @@ export function endSessionForWU(options = {}) {
153
152
  */
154
153
  export function getCurrentSessionForWU(options = {}) {
155
154
  const { sessionDir } = options;
156
- const sessDir = sessionDir ?? DEFAULT_SESSION_DIR;
155
+ const sessDir = sessionDir ?? LUMENFLOW_PATHS.SESSIONS;
157
156
  const sessionFile = getSessionFilePath(sessDir);
158
157
  if (!existsSync(sessionFile)) {
159
158
  return null;
@@ -10,14 +10,17 @@
10
10
  import fs from 'node:fs/promises';
11
11
  import path from 'node:path';
12
12
  import { stringifyYAML, parseYAML } from '@lumenflow/core/lib/wu-yaml.js';
13
+ import { LUMENFLOW_PATHS } from '@lumenflow/core/lib/wu-constants.js';
13
14
  /**
14
15
  * Directory for draft WU specs
16
+ * @deprecated Use LUMENFLOW_PATHS.FEEDBACK_DRAFTS instead
15
17
  */
16
- export const DRAFT_DIRECTORY = '.beacon/feedback-drafts';
18
+ export const DRAFT_DIRECTORY = LUMENFLOW_PATHS.FEEDBACK_DRAFTS;
17
19
  /**
18
20
  * Path to feedback index (incident-to-WU mappings)
21
+ * @deprecated Use LUMENFLOW_PATHS.FEEDBACK_INDEX instead
19
22
  */
20
- export const FEEDBACK_INDEX_PATH = '.beacon/feedback-index.ndjson';
23
+ export const FEEDBACK_INDEX_PATH = LUMENFLOW_PATHS.FEEDBACK_INDEX;
21
24
  /**
22
25
  * Feedback index entry status
23
26
  */
@@ -151,7 +154,7 @@ export async function generateDraft(baseDir, pattern, options = {}) {
151
154
  return draft;
152
155
  }
153
156
  /**
154
- * Load all draft files from .beacon/feedback-drafts/
157
+ * Load all draft files from .lumenflow/feedback-drafts/
155
158
  *
156
159
  * @param baseDir - Base directory
157
160
  * @returns Array of draft objects with filePath
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Feedback Review Core Logic (WU-1598)
3
3
  *
4
- * Aggregates .beacon/incidents/*.ndjson and .beacon/memory/memory.jsonl,
4
+ * Aggregates .lumenflow/incidents/*.ndjson and .lumenflow/memory/memory.jsonl,
5
5
  * clusters by title similarity, scores patterns (frequency x severity x recency),
6
6
  * and outputs prioritised patterns for human review.
7
7
  *
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import fs from 'node:fs/promises';
12
12
  import path from 'node:path';
13
- import { INCIDENT_SEVERITY } from '@lumenflow/core/lib/wu-constants.js';
13
+ import { INCIDENT_SEVERITY, LUMENFLOW_PATHS } from '@lumenflow/core/lib/wu-constants.js';
14
14
  /**
15
15
  * Severity weights for scoring
16
16
  *
@@ -94,13 +94,13 @@ async function loadNdjson(filePath) {
94
94
  }
95
95
  }
96
96
  /**
97
- * Load all incidents from .beacon/incidents/*.ndjson
97
+ * Load all incidents from .lumenflow/incidents/*.ndjson
98
98
  *
99
99
  * @param baseDir - Base directory
100
100
  * @returns All incident objects
101
101
  */
102
102
  async function loadIncidents(baseDir) {
103
- const incidentsDir = path.join(baseDir, '.beacon', 'incidents');
103
+ const incidentsDir = path.join(baseDir, LUMENFLOW_PATHS.INCIDENTS);
104
104
  let files;
105
105
  try {
106
106
  // eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI tool reads known paths
@@ -121,13 +121,13 @@ async function loadIncidents(baseDir) {
121
121
  return incidents;
122
122
  }
123
123
  /**
124
- * Load memory nodes from .beacon/memory/memory.jsonl
124
+ * Load memory nodes from .lumenflow/memory/memory.jsonl
125
125
  *
126
126
  * @param baseDir - Base directory
127
127
  * @returns Memory node objects
128
128
  */
129
129
  async function loadMemoryNodes(baseDir) {
130
- const memoryFile = path.join(baseDir, '.beacon', 'memory', 'memory.jsonl');
130
+ const memoryFile = path.join(baseDir, LUMENFLOW_PATHS.MEMORY_JSONL);
131
131
  return loadNdjson(memoryFile);
132
132
  }
133
133
  /**
@@ -261,7 +261,7 @@ export function scorePattern(cluster) {
261
261
  *
262
262
  * Main entry point for feedback review logic.
263
263
  *
264
- * @param baseDir - Base directory containing .beacon
264
+ * @param baseDir - Base directory containing .lumenflow
265
265
  * @param options - Review options
266
266
  * @returns Review result
267
267
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumenflow/agent",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Agent session management for LumenFlow workflow framework",
5
5
  "keywords": [
6
6
  "lumenflow",
@@ -40,8 +40,8 @@
40
40
  "dependencies": {
41
41
  "simple-git": "^3.30.0",
42
42
  "zod": "^4.3.5",
43
- "@lumenflow/memory": "1.3.4",
44
- "@lumenflow/core": "1.3.4"
43
+ "@lumenflow/core": "1.3.6",
44
+ "@lumenflow/memory": "1.3.6"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@vitest/coverage-v8": "^4.0.17",
@@ -1,55 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * IncidentLog schema for structured issue tracking
4
- * Stored as NDJSON in .beacon/incidents/<category>.ndjson
5
- */
6
- export declare const IncidentLogSchema: z.ZodObject<{
7
- timestamp: z.ZodString;
8
- session_id: z.ZodString;
9
- wu_id: z.ZodString;
10
- lane: z.ZodString;
11
- category: z.ZodEnum<{
12
- workflow: "workflow";
13
- tooling: "tooling";
14
- confusion: "confusion";
15
- violation: "violation";
16
- error: "error";
17
- }>;
18
- severity: z.ZodEnum<{
19
- blocker: "blocker";
20
- major: "major";
21
- minor: "minor";
22
- info: "info";
23
- }>;
24
- title: z.ZodString;
25
- description: z.ZodString;
26
- resolution: z.ZodOptional<z.ZodString>;
27
- tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
28
- context: z.ZodDefault<z.ZodOptional<z.ZodObject<{
29
- git_branch: z.ZodOptional<z.ZodString>;
30
- current_step: z.ZodOptional<z.ZodString>;
31
- related_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
- }, z.core.$strip>>>;
33
- }, z.core.$strip>;
34
- /**
35
- * @typedef {z.infer<typeof IncidentLogSchema>} IncidentLog
36
- */
37
- /**
38
- * Inferred type from IncidentLogSchema
39
- */
40
- export type IncidentLog = z.infer<typeof IncidentLogSchema>;
41
- /**
42
- * Append an incident to the appropriate NDJSON log file
43
- * @param incident - Incident data (will be validated)
44
- * @param incidentsDir - Optional directory override (for testing)
45
- * @throws {z.ZodError} if incident data is invalid
46
- */
47
- export declare function appendIncident(incident: unknown, incidentsDir?: string): void;
48
- /**
49
- * Read and parse incidents from NDJSON files
50
- * @param categories - Categories to read (default: all)
51
- * @param since - Filter incidents after this date
52
- * @param incidentsDir - Optional directory override (for testing)
53
- * @returns Parsed and validated incidents
54
- */
55
- export declare function readIncidents(categories?: readonly string[] | null, since?: Date | null, incidentsDir?: string): IncidentLog[];
@@ -1,66 +0,0 @@
1
- /**
2
- * Session data structure
3
- */
4
- interface SessionData {
5
- session_id: string;
6
- wu_id: string;
7
- lane: string;
8
- started: string;
9
- completed?: string;
10
- agent_type: string;
11
- context_tier: number;
12
- incidents_logged: number;
13
- incidents_major: number;
14
- }
15
- /**
16
- * Start a new agent session
17
- * @param wuId - WU ID (e.g., "WU-1234")
18
- * @param tier - Context tier from bootloader
19
- * @param agentType - Agent type (default: "claude-code")
20
- * @returns session_id
21
- * @throws {Error} if session already active or WU format invalid
22
- */
23
- export declare function startSession(wuId: string, tier: 1 | 2 | 3, agentType?: string): Promise<string>;
24
- /**
25
- * Get the current active session
26
- * @returns Session state or null if no active session
27
- */
28
- export declare function getCurrentSession(): Promise<SessionData | null>;
29
- /**
30
- * Incident data input type
31
- */
32
- interface IncidentDataInput {
33
- category: string;
34
- severity: string;
35
- title: string;
36
- description: string;
37
- context?: Record<string, unknown>;
38
- [key: string]: unknown;
39
- }
40
- /**
41
- * Log an incident and update session counters
42
- * @param incidentData - Incident data (category, severity, title, description, etc.)
43
- * @throws {Error} if no active session
44
- */
45
- export declare function logIncident(incidentData: IncidentDataInput): Promise<void>;
46
- /**
47
- * Session summary returned after ending a session
48
- */
49
- interface SessionSummary {
50
- wu_id: string;
51
- lane: string;
52
- session_id: string;
53
- started: string;
54
- completed: string;
55
- agent_type: string;
56
- context_tier: number;
57
- incidents_logged: number;
58
- incidents_major: number;
59
- }
60
- /**
61
- * End the current session and return summary
62
- * @returns Session summary for appending to WU YAML
63
- * @throws {Error} if no active session
64
- */
65
- export declare function endSession(): Promise<SessionSummary>;
66
- export {};
@@ -1,31 +0,0 @@
1
- type RunFn = (cmd: string) => string;
2
- type ExistsFn = (path: string) => boolean;
3
- /**
4
- * Verification result type
5
- */
6
- export interface VerificationResult {
7
- complete: boolean;
8
- failures: string[];
9
- }
10
- /**
11
- * Verification overrides for testing
12
- */
13
- interface VerificationOverrides {
14
- run?: RunFn;
15
- exists?: ExistsFn;
16
- }
17
- /**
18
- * Verify that a WU has been completed and merged to main.
19
- *
20
- * Checks:
21
- * 1. Working tree is clean
22
- * 2. Completion stamp exists
23
- * 3. Main history contains a commit updating the WU YAML
24
- *
25
- * @param wuId - Work Unit identifier (e.g., "WU-510")
26
- * @param overrides - Test overrides
27
- * @returns Verification result
28
- */
29
- export declare function verifyWUComplete(wuId: string, overrides?: VerificationOverrides): VerificationResult;
30
- export declare function debugSummary(result: VerificationResult | null | undefined): string;
31
- export {};
@@ -1,106 +0,0 @@
1
- /**
2
- * Session data stored in current.json
3
- */
4
- interface SessionFileData {
5
- session_id: string;
6
- wu_id: string;
7
- started: string;
8
- completed?: string;
9
- agent_type: string;
10
- context_tier: number;
11
- incidents_logged: number;
12
- incidents_major: number;
13
- auto_started?: boolean;
14
- }
15
- /**
16
- * Options for starting a session for a WU
17
- */
18
- interface StartSessionOptions {
19
- wuId: string;
20
- tier?: 1 | 2 | 3;
21
- agentType?: string;
22
- sessionDir?: string;
23
- baseDir?: string;
24
- }
25
- /**
26
- * Result of starting a session
27
- */
28
- interface StartSessionResult {
29
- sessionId: string;
30
- alreadyActive?: boolean;
31
- memoryNodeId?: string | null;
32
- }
33
- /**
34
- * Start a session for a WU (called by wu:claim)
35
- *
36
- * Unlike startSession in agent-session.mjs, this function:
37
- * - Does NOT throw if a session already exists (returns existing session)
38
- * - Uses default tier 2 if not specified
39
- * - Supports custom session directory for testing
40
- * - Creates memory layer session node for context restoration (WU-1466)
41
- *
42
- * @param options - Session options
43
- * @returns Session result
44
- */
45
- export declare function startSessionForWU(options: StartSessionOptions): Promise<StartSessionResult>;
46
- /**
47
- * Options for ending a session
48
- */
49
- interface EndSessionOptions {
50
- sessionDir?: string;
51
- }
52
- /**
53
- * Session summary
54
- */
55
- interface SessionSummary {
56
- wu_id: string;
57
- session_id: string;
58
- started: string;
59
- completed: string;
60
- agent_type: string;
61
- context_tier: number;
62
- incidents_logged: number;
63
- incidents_major: number;
64
- }
65
- /**
66
- * Result of ending a session
67
- */
68
- interface EndSessionResult {
69
- ended: boolean;
70
- summary?: SessionSummary;
71
- reason?: string;
72
- }
73
- /**
74
- * End the current session (called by wu:done)
75
- *
76
- * Unlike endSession in agent-session.mjs, this function:
77
- * - Does NOT throw if no active session (returns { ended: false })
78
- * - Returns structured result with summary
79
- * - Supports custom session directory for testing
80
- *
81
- * @param options - Session options
82
- * @returns Session end result
83
- */
84
- export declare function endSessionForWU(options?: EndSessionOptions): EndSessionResult;
85
- /**
86
- * Options for getting current session
87
- */
88
- interface GetSessionOptions {
89
- sessionDir?: string;
90
- }
91
- /**
92
- * Get the current active session
93
- *
94
- * @param options - Session options
95
- * @returns Session object or null if no active session
96
- */
97
- export declare function getCurrentSessionForWU(options?: GetSessionOptions): SessionFileData | null;
98
- /**
99
- * Check if there's an active session for a specific WU
100
- *
101
- * @param wuId - WU ID to check
102
- * @param options - Session options
103
- * @returns True if session exists and matches WU ID
104
- */
105
- export declare function hasActiveSessionForWU(wuId: string, options?: GetSessionOptions): boolean;
106
- export {};
@@ -1,137 +0,0 @@
1
- /**
2
- * Feedback Promote Core Logic (WU-1599)
3
- *
4
- * Generates draft WU specs from feedback patterns and promotes them to actual WUs.
5
- * Tracks incident-to-WU mappings in feedback-index.ndjson.
6
- *
7
- * @see {@link tools/__tests__/feedback-promote.test.mjs} - Tests
8
- * @see {@link tools/feedback-promote.mjs} - CLI entry point
9
- */
10
- /**
11
- * Directory for draft WU specs
12
- */
13
- export declare const DRAFT_DIRECTORY = ".beacon/feedback-drafts";
14
- /**
15
- * Path to feedback index (incident-to-WU mappings)
16
- */
17
- export declare const FEEDBACK_INDEX_PATH = ".beacon/feedback-index.ndjson";
18
- /**
19
- * Feedback index entry status
20
- */
21
- export declare const FEEDBACK_STATUS: {
22
- PENDING_RESOLUTION: string;
23
- RESOLVED: string;
24
- WONT_FIX: string;
25
- };
26
- /**
27
- * Pattern example structure
28
- */
29
- interface PatternExample {
30
- id: string;
31
- [key: string]: unknown;
32
- }
33
- /**
34
- * Pattern structure from feedback:review
35
- */
36
- interface Pattern {
37
- title: string;
38
- category?: string;
39
- frequency?: number;
40
- score?: number;
41
- firstSeen?: string;
42
- lastSeen?: string;
43
- examples?: PatternExample[];
44
- }
45
- /**
46
- * Draft WU spec structure
47
- */
48
- interface DraftSpec {
49
- title: string;
50
- lane: string;
51
- description: string;
52
- acceptance: string[];
53
- source_incidents: string[];
54
- pattern_metadata: {
55
- frequency: number | undefined;
56
- category: string | undefined;
57
- score: number | undefined;
58
- firstSeen: string | undefined;
59
- lastSeen: string | undefined;
60
- };
61
- filePath?: string;
62
- }
63
- /**
64
- * Options for generating a draft
65
- */
66
- interface GenerateDraftOptions {
67
- writeFile?: boolean;
68
- }
69
- /**
70
- * Generate draft WU spec from a pattern
71
- *
72
- * @param baseDir - Base directory
73
- * @param pattern - Pattern from feedback:review
74
- * @param options - Options
75
- * @returns Draft WU spec
76
- */
77
- export declare function generateDraft(baseDir: string, pattern: Pattern, options?: GenerateDraftOptions): Promise<DraftSpec>;
78
- /**
79
- * Load all draft files from .beacon/feedback-drafts/
80
- *
81
- * @param baseDir - Base directory
82
- * @returns Array of draft objects with filePath
83
- */
84
- export declare function loadDrafts(baseDir: string): Promise<DraftSpec[]>;
85
- /**
86
- * Options for promoting a draft
87
- */
88
- interface PromoteDraftOptions {
89
- dryRun?: boolean;
90
- wuIdOverride?: string;
91
- removeDraft?: boolean;
92
- }
93
- /**
94
- * Result of promoting a draft
95
- */
96
- interface PromoteDraftResult {
97
- success: boolean;
98
- wuId: string;
99
- command: string;
100
- draft?: DraftSpec;
101
- error?: string;
102
- draftRemoved?: boolean;
103
- }
104
- /**
105
- * Promote a draft to a WU via wu:create
106
- *
107
- * @param baseDir - Base directory
108
- * @param draft - Draft object
109
- * @param options - Options
110
- * @returns Result with success, wuId, command
111
- */
112
- export declare function promoteDraft(baseDir: string, draft: DraftSpec, options?: PromoteDraftOptions): Promise<PromoteDraftResult>;
113
- /**
114
- * Feedback index entry
115
- */
116
- interface FeedbackIndexEntry {
117
- incident_id: string;
118
- wu_id: string;
119
- status: string;
120
- timestamp: string;
121
- }
122
- /**
123
- * Update feedback index with incident-to-WU mappings
124
- *
125
- * @param baseDir - Base directory
126
- * @param wuId - WU ID
127
- * @param incidentIds - Array of incident IDs
128
- */
129
- export declare function updateFeedbackIndex(baseDir: string, wuId: string, incidentIds: string[]): Promise<void>;
130
- /**
131
- * Load feedback index entries
132
- *
133
- * @param baseDir - Base directory
134
- * @returns Array of index entries
135
- */
136
- export declare function loadFeedbackIndex(baseDir: string): Promise<FeedbackIndexEntry[]>;
137
- export {};
@@ -1,116 +0,0 @@
1
- /**
2
- * Feedback Review Core Logic (WU-1598)
3
- *
4
- * Aggregates .beacon/incidents/*.ndjson and .beacon/memory/memory.jsonl,
5
- * clusters by title similarity, scores patterns (frequency x severity x recency),
6
- * and outputs prioritised patterns for human review.
7
- *
8
- * @see {@link tools/__tests__/feedback-review.test.mjs} - Tests
9
- * @see {@link tools/feedback-review.mjs} - CLI entry point
10
- */
11
- import { INCIDENT_SEVERITY } from '@lumenflow/core/lib/wu-constants.js';
12
- /**
13
- * Severity weights for scoring
14
- *
15
- * Higher severity = higher weight in scoring formula
16
- */
17
- export declare const SEVERITY_WEIGHTS: {
18
- [INCIDENT_SEVERITY.BLOCKER]: number;
19
- [INCIDENT_SEVERITY.MAJOR]: number;
20
- [INCIDENT_SEVERITY.MINOR]: number;
21
- [INCIDENT_SEVERITY.INFO]: number;
22
- };
23
- /**
24
- * Node with ID and optional title/content
25
- */
26
- interface NodeWithTitle {
27
- id: string;
28
- title?: string;
29
- content?: string;
30
- category?: string;
31
- severity?: string;
32
- created_at?: string;
33
- source?: string;
34
- metadata?: Record<string, unknown>;
35
- type?: string;
36
- tags?: string[];
37
- }
38
- /**
39
- * Cluster of nodes grouped by title similarity
40
- */
41
- interface Cluster {
42
- title: string;
43
- nodes: NodeWithTitle[];
44
- category: string;
45
- }
46
- /**
47
- * Cluster nodes by title similarity
48
- *
49
- * Uses simple greedy clustering with Jaccard similarity.
50
- *
51
- * @param nodes - Nodes to cluster
52
- * @param threshold - Similarity threshold
53
- * @returns Array of cluster objects
54
- */
55
- export declare function clusterByTitle(nodes: NodeWithTitle[], threshold?: number): Cluster[];
56
- /**
57
- * Score a pattern cluster
58
- *
59
- * Formula: frequency x average_severity x recency_factor
60
- *
61
- * @param cluster - Cluster with nodes
62
- * @returns Score value
63
- */
64
- export declare function scorePattern(cluster: Cluster): number;
65
- /**
66
- * Options for reviewing feedback
67
- */
68
- interface ReviewOptions {
69
- since?: string;
70
- minFrequency?: number;
71
- category?: string;
72
- json?: boolean;
73
- }
74
- /**
75
- * Pattern example for output
76
- */
77
- interface PatternExample {
78
- id: string;
79
- severity: string | undefined;
80
- source: string | undefined;
81
- }
82
- /**
83
- * Pattern in review result
84
- */
85
- interface ReviewPattern {
86
- title: string;
87
- frequency: number;
88
- category: string;
89
- score: number;
90
- firstSeen: string | undefined;
91
- lastSeen: string | undefined;
92
- examples: PatternExample[];
93
- }
94
- /**
95
- * Review result
96
- */
97
- interface ReviewResult {
98
- success: boolean;
99
- patterns: ReviewPattern[];
100
- summary: {
101
- totalNodes: number;
102
- totalClusters: number;
103
- topCategory: string | null;
104
- };
105
- }
106
- /**
107
- * Review feedback from incidents and memory nodes
108
- *
109
- * Main entry point for feedback review logic.
110
- *
111
- * @param baseDir - Base directory containing .beacon
112
- * @param options - Review options
113
- * @returns Review result
114
- */
115
- export declare function reviewFeedback(baseDir: string, options?: ReviewOptions): Promise<ReviewResult>;
116
- export {};
package/dist/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * @lumenflow/agent - Agent session management
3
- * @module @lumenflow/agent
4
- */
5
- export * from './agent-incidents.js';
6
- export * from './agent-session.js';
7
- export * from './agent-verification.js';
8
- export * from './auto-session-integration.js';
9
- export * from './feedback-promote-core.js';
10
- export * from './feedback-review-core.js';