@lumenflow/agent 2.2.2 → 2.3.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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { execSync } from 'node:child_process';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
3
|
import { fileURLToPath } from 'node:url';
|
|
5
4
|
import { createError, ErrorCodes } from '@lumenflow/core/lib/error-handler.js';
|
|
6
|
-
import { PATTERNS, BRANCHES, STRING_LITERALS, EXIT_CODES,
|
|
5
|
+
import { PATTERNS, BRANCHES, STRING_LITERALS, EXIT_CODES, } from '@lumenflow/core/lib/wu-constants.js';
|
|
6
|
+
import { createWuPaths } from '@lumenflow/core/lib/wu-paths.js';
|
|
7
7
|
function run(cmd) {
|
|
8
8
|
try {
|
|
9
9
|
return execSync(cmd, { stdio: 'pipe', encoding: 'utf-8' }).trim();
|
|
@@ -29,19 +29,19 @@ function checkGitStatus(runFn = run) {
|
|
|
29
29
|
const lines = status.split(STRING_LITERALS.NEWLINE).filter(Boolean).slice(0, 10);
|
|
30
30
|
return `Working tree dirty (stage or discard changes): ${lines.join('; ')}`;
|
|
31
31
|
}
|
|
32
|
-
function stampPath(wuId) {
|
|
33
|
-
return
|
|
32
|
+
function stampPath(wuId, paths) {
|
|
33
|
+
return paths.STAMP(wuId);
|
|
34
34
|
}
|
|
35
|
-
function checkStamp(wuId, existsFn = existsSync) {
|
|
36
|
-
if (existsFn(stampPath(wuId)))
|
|
35
|
+
function checkStamp(wuId, paths, existsFn = existsSync) {
|
|
36
|
+
if (existsFn(stampPath(wuId, paths)))
|
|
37
37
|
return null;
|
|
38
|
-
return `Missing stamp ${
|
|
38
|
+
return `Missing stamp ${paths.STAMPS_DIR()}/${wuId}.done`;
|
|
39
39
|
}
|
|
40
|
-
function checkCommit(wuId, runFn = run) {
|
|
41
|
-
const history = runFn(`git log --oneline ${BRANCHES.MAIN} --
|
|
40
|
+
function checkCommit(wuId, paths, runFn = run) {
|
|
41
|
+
const history = runFn(`git log --oneline ${BRANCHES.MAIN} -- ${paths.WU(wuId)} | head -n 1`);
|
|
42
42
|
if (history)
|
|
43
43
|
return null;
|
|
44
|
-
return `No commit on ${BRANCHES.MAIN} touching
|
|
44
|
+
return `No commit on ${BRANCHES.MAIN} touching ${paths.WU(wuId)}`;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Verify that a WU has been completed and merged to main.
|
|
@@ -62,13 +62,14 @@ export function verifyWUComplete(wuId, overrides = {}) {
|
|
|
62
62
|
const existsFn = typeof overrides.exists === 'function'
|
|
63
63
|
? overrides.exists
|
|
64
64
|
: (filePath) => existsSync(filePath);
|
|
65
|
+
const paths = createWuPaths({ projectRoot: overrides.projectRoot });
|
|
65
66
|
const gitStatusFailure = checkGitStatus(runFn);
|
|
66
67
|
if (gitStatusFailure)
|
|
67
68
|
failures.push(gitStatusFailure);
|
|
68
|
-
const stampFailure = checkStamp(normalized, existsFn);
|
|
69
|
+
const stampFailure = checkStamp(normalized, paths, existsFn);
|
|
69
70
|
if (stampFailure)
|
|
70
71
|
failures.push(stampFailure);
|
|
71
|
-
const commitFailure = checkCommit(normalized, runFn);
|
|
72
|
+
const commitFailure = checkCommit(normalized, paths, runFn);
|
|
72
73
|
if (commitFailure)
|
|
73
74
|
failures.push(commitFailure);
|
|
74
75
|
return {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-Session Integration for wu:claim and wu:done lifecycle (WU-1438, WU-1466)
|
|
3
3
|
*
|
|
4
|
-
* Provides wrapper functions around agent-session.
|
|
4
|
+
* Provides wrapper functions around agent-session.ts that:
|
|
5
5
|
* 1. Auto-start sessions on wu:claim with silent no-op if already active
|
|
6
6
|
* 2. Auto-end sessions on wu:done with silent no-op if not active
|
|
7
7
|
* 3. Store session_id in WU YAML for tracking
|
|
8
8
|
* 4. Create memory layer session nodes for context restoration (WU-1466)
|
|
9
9
|
*
|
|
10
10
|
* Design principles:
|
|
11
|
-
* - Composition over modification (wraps existing agent-session.
|
|
11
|
+
* - Composition over modification (wraps existing agent-session.ts)
|
|
12
12
|
* - Silent failures for idempotent operations (no throw on duplicate start/end)
|
|
13
13
|
* - Configurable session directory for testing
|
|
14
14
|
*/
|
|
@@ -41,7 +41,7 @@ function getSessionFilePath(sessionDir) {
|
|
|
41
41
|
/**
|
|
42
42
|
* Start a session for a WU (called by wu:claim)
|
|
43
43
|
*
|
|
44
|
-
* Unlike startSession in agent-session.
|
|
44
|
+
* Unlike startSession in agent-session.ts, this function:
|
|
45
45
|
* - Does NOT throw if a session already exists (returns existing session)
|
|
46
46
|
* - Uses default tier 2 if not specified
|
|
47
47
|
* - Supports custom session directory for testing
|
|
@@ -103,7 +103,7 @@ export async function startSessionForWU(options) {
|
|
|
103
103
|
/**
|
|
104
104
|
* End the current session (called by wu:done)
|
|
105
105
|
*
|
|
106
|
-
* Unlike endSession in agent-session.
|
|
106
|
+
* Unlike endSession in agent-session.ts, this function:
|
|
107
107
|
* - Does NOT throw if no active session (returns { ended: false })
|
|
108
108
|
* - Returns structured result with summary
|
|
109
109
|
* - Supports custom session directory for testing
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Generates draft WU specs from feedback patterns and promotes them to actual WUs.
|
|
5
5
|
* Tracks incident-to-WU mappings in feedback-index.ndjson.
|
|
6
6
|
*
|
|
7
|
-
* @see {@link
|
|
8
|
-
* @see {@link
|
|
7
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/feedback-promote.test.ts} - Tests
|
|
8
|
+
* @see {@link packages/@lumenflow/cli/src/feedback-promote.ts} - CLI entry point
|
|
9
9
|
*/
|
|
10
10
|
import fs from 'node:fs/promises';
|
|
11
11
|
import path from 'node:path';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* clusters by title similarity, scores patterns (frequency x severity x recency),
|
|
6
6
|
* and outputs prioritised patterns for human review.
|
|
7
7
|
*
|
|
8
|
-
* @see {@link
|
|
9
|
-
* @see {@link
|
|
8
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/feedback-review.test.ts} - Tests
|
|
9
|
+
* @see {@link packages/@lumenflow/cli/src/feedback-review.ts} - CLI entry point
|
|
10
10
|
*/
|
|
11
11
|
import fs from 'node:fs/promises';
|
|
12
12
|
import path from 'node:path';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumenflow/agent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
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/
|
|
44
|
-
"@lumenflow/
|
|
43
|
+
"@lumenflow/core": "2.3.1",
|
|
44
|
+
"@lumenflow/memory": "2.3.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@vitest/coverage-v8": "^4.0.17",
|