claude-flow 3.57.1 → 3.58.0
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/.claude/helpers/intelligence.cjs +3 -5
- package/.claude/proven-config.json +1 -1
- package/.claude-plugin/marketplace.json +11 -0
- package/README.md +1 -0
- package/node_modules/@claude-flow/codex/README.md +87 -9
- package/node_modules/@claude-flow/codex/dist/activity/cli.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/activity/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/cli.js +115 -0
- package/node_modules/@claude-flow/codex/dist/activity/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/files.d.ts +14 -0
- package/node_modules/@claude-flow/codex/dist/activity/files.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/files.js +142 -0
- package/node_modules/@claude-flow/codex/dist/activity/files.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/parser.d.ts +21 -0
- package/node_modules/@claude-flow/codex/dist/activity/parser.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/parser.js +179 -0
- package/node_modules/@claude-flow/codex/dist/activity/parser.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/reader.d.ts +20 -0
- package/node_modules/@claude-flow/codex/dist/activity/reader.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/reader.js +106 -0
- package/node_modules/@claude-flow/codex/dist/activity/reader.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/sanitize.d.ts +4 -0
- package/node_modules/@claude-flow/codex/dist/activity/sanitize.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/sanitize.js +27 -0
- package/node_modules/@claude-flow/codex/dist/activity/sanitize.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/types.d.ts +31 -0
- package/node_modules/@claude-flow/codex/dist/activity/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/types.js +5 -0
- package/node_modules/@claude-flow/codex/dist/activity/types.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/viewer.d.ts +21 -0
- package/node_modules/@claude-flow/codex/dist/activity/viewer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/activity/viewer.js +168 -0
- package/node_modules/@claude-flow/codex/dist/activity/viewer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/cli.js +3 -0
- package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -1
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +3 -3
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -1
- package/node_modules/@claude-flow/mcp/dist/server.d.ts.map +1 -1
- package/node_modules/@claude-flow/mcp/dist/server.js +5 -3
- package/node_modules/@claude-flow/mcp/dist/server.js.map +1 -1
- package/node_modules/@claude-flow/mcp/dist/types.d.ts +11 -0
- package/node_modules/@claude-flow/mcp/dist/types.d.ts.map +1 -1
- package/node_modules/@claude-flow/mcp/dist/types.js.map +1 -1
- package/package.json +3 -2
- package/v3/@claude-flow/cli/README.md +1 -0
- package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/agent.js +4 -1
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +20 -1
- package/v3/@claude-flow/cli/dist/src/commands/mcp.js +66 -6
- package/v3/@claude-flow/cli/dist/src/commands/memory.js +78 -3
- package/v3/@claude-flow/cli/dist/src/commands/workflow.js +55 -15
- package/v3/@claude-flow/cli/dist/src/init/executor.js +9 -5
- package/v3/@claude-flow/cli/dist/src/init/helper-companions.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/helper-companions.js +4 -3
- package/v3/@claude-flow/cli/dist/src/mcp-server.d.ts +5 -0
- package/v3/@claude-flow/cli/dist/src/mcp-server.js +39 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +28 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +25 -15
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +9 -3
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +58 -9
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +2 -1
- package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.d.ts +16 -4
- package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.js +19 -7
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +4 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +55 -9
- package/v3/@claude-flow/cli/dist/src/memory/memory-peek.d.ts +28 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-peek.js +222 -0
- package/v3/@claude-flow/cli/dist/src/memory/model-cache-dir.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/memory/model-cache-dir.js +17 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/task-embedder.js +38 -4
- package/v3/@claude-flow/cli/dist/src/services/memory-backup.d.ts +6 -0
- package/v3/@claude-flow/cli/dist/src/services/memory-backup.js +109 -81
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.d.ts +2 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.js +4 -4
- package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +54 -3
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +4 -0
- package/v3/@claude-flow/cli/package.json +5 -4
|
@@ -277,11 +277,9 @@ function sessionGet(key) {
|
|
|
277
277
|
|
|
278
278
|
function sessionSet(key, value) {
|
|
279
279
|
try {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
284
|
-
}
|
|
280
|
+
// Session creation belongs to session.cjs; recall may run before SessionStart.
|
|
281
|
+
if (!fs.existsSync(SESSION_FILE)) return;
|
|
282
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
285
283
|
if (!session.context) session.context = {};
|
|
286
284
|
session.context[key] = value;
|
|
287
285
|
session.updatedAt = new Date().toISOString();
|
|
@@ -51,6 +51,17 @@
|
|
|
51
51
|
"source": "./plugins/ruflo-testgen",
|
|
52
52
|
"description": "Test gap detection, coverage analysis, and automated test generation"
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"name": "agentic-qe-fleet",
|
|
56
|
+
"source": {
|
|
57
|
+
"source": "git-subdir",
|
|
58
|
+
"url": "https://github.com/proffesor-for-testing/agentic-qe.git",
|
|
59
|
+
"path": "plugins/agentic-qe-fleet",
|
|
60
|
+
"ref": "v3.15.10",
|
|
61
|
+
"sha": "e5814a2f4f3d7995b87ebda9ad30e8a3d92cd555"
|
|
62
|
+
},
|
|
63
|
+
"description": "Agentic QE (external: maintained in proffesor-for-testing/agentic-qe, pinned to v3.15.10): a quality-engineering fleet with 11 QE agents, 9 skills, 9 commands, the agentic-qe MCP server pinned to the plugin version, and the aqe-mod guard that refuses destructive operations on AQE learning data"
|
|
64
|
+
},
|
|
54
65
|
{
|
|
55
66
|
"name": "ruflo-docs",
|
|
56
67
|
"source": "./plugins/ruflo-docs",
|
package/README.md
CHANGED
|
@@ -240,6 +240,7 @@ This adds slash commands and agent definitions. `ruflo-core` (installed above) d
|
|
|
240
240
|
| [**ruflo-browser**](plugins/ruflo-browser/README.md) | Automate browser testing with Playwright |
|
|
241
241
|
| [**ruflo-jujutsu**](plugins/ruflo-jujutsu/README.md) | Analyze git diffs, score risk, suggest reviewers |
|
|
242
242
|
| [**ruflo-docs**](plugins/ruflo-docs/README.md) | Generate and maintain documentation automatically |
|
|
243
|
+
| [**agentic-qe-fleet**](https://github.com/proffesor-for-testing/agentic-qe/tree/v3.15.10/plugins/agentic-qe-fleet) | External, maintained by [Agentic QE](https://github.com/proffesor-for-testing/agentic-qe): 11 QE agents, test generation, coverage, chaos and TDD skills, the `agentic-qe` MCP server, and a guard for AQE learning data (`/plugin install agentic-qe-fleet@ruflo`). Install it from one marketplace only, `agentic-qe` or `ruflo`: enabled from both, its mod and commands load twice |
|
|
243
244
|
|
|
244
245
|
#### Security & Compliance
|
|
245
246
|
|
|
@@ -639,19 +639,19 @@ The `@claude-flow/codex` package now includes built-in dual-mode orchestration:
|
|
|
639
639
|
|
|
640
640
|
```bash
|
|
641
641
|
# List available collaboration templates
|
|
642
|
-
npx claude-flow
|
|
642
|
+
npx @claude-flow/codex dual templates
|
|
643
643
|
|
|
644
644
|
# Run a feature development swarm
|
|
645
|
-
npx claude-flow
|
|
645
|
+
npx @claude-flow/codex dual run --template feature --task "Add user authentication"
|
|
646
646
|
|
|
647
647
|
# Run a security audit swarm
|
|
648
|
-
npx claude-flow
|
|
648
|
+
npx @claude-flow/codex dual run --template security --task "src/auth/"
|
|
649
649
|
|
|
650
650
|
# Run a refactoring swarm
|
|
651
|
-
npx claude-flow
|
|
651
|
+
npx @claude-flow/codex dual run --template refactor --task "src/legacy/"
|
|
652
652
|
|
|
653
653
|
# Check collaboration status
|
|
654
|
-
npx claude-flow
|
|
654
|
+
npx @claude-flow/codex dual status
|
|
655
655
|
```
|
|
656
656
|
|
|
657
657
|
### Codex Loop Runner
|
|
@@ -660,15 +660,15 @@ Codex does not expose Claude Code's `ScheduleWakeup`, so `@claude-flow/codex` pr
|
|
|
660
660
|
|
|
661
661
|
```bash
|
|
662
662
|
# Run Codex repeatedly until it creates .codex/loop/default.complete or reaches 10 iterations
|
|
663
|
-
npx claude-flow
|
|
663
|
+
npx @claude-flow/codex loop run "Fix failing tests and create the completion marker when done"
|
|
664
664
|
|
|
665
665
|
# Use command mode for recurring Ruflo workers or custom scripts
|
|
666
|
-
npx claude-flow
|
|
666
|
+
npx @claude-flow/codex loop run --name testgaps --interval 270 --max-iterations 0 \
|
|
667
667
|
--command "npx claude-flow hooks worker dispatch --trigger testgaps"
|
|
668
668
|
|
|
669
669
|
# Inspect or stop a loop from another terminal
|
|
670
|
-
npx claude-flow
|
|
671
|
-
npx claude-flow
|
|
670
|
+
npx @claude-flow/codex loop status --name testgaps
|
|
671
|
+
npx @claude-flow/codex loop stop --name testgaps
|
|
672
672
|
```
|
|
673
673
|
|
|
674
674
|
Loop state is stored in `.codex/loop/<name>.json`; `loop stop` writes `.codex/loop/<name>.stop`, which the runner observes between iterations.
|
|
@@ -1042,6 +1042,84 @@ npx claude-flow memory optimize --rebuild-index
|
|
|
1042
1042
|
|
|
1043
1043
|
---
|
|
1044
1044
|
|
|
1045
|
+
## Inspect an existing Codex session
|
|
1046
|
+
|
|
1047
|
+
The `activity` command lets you pick a helper and read its assignment, recorded
|
|
1048
|
+
state, public progress messages, and tool calls/results. It reads local rollout
|
|
1049
|
+
files without starting model sessions or sending commands to agents.
|
|
1050
|
+
|
|
1051
|
+
From a checkout containing this change:
|
|
1052
|
+
|
|
1053
|
+
```bash
|
|
1054
|
+
npm install --prefix v3/@claude-flow/codex --workspaces=false --ignore-scripts --legacy-peer-deps --package-lock=false
|
|
1055
|
+
npm run build --prefix v3/@claude-flow/codex
|
|
1056
|
+
node v3/@claude-flow/codex/dist/cli.js activity \
|
|
1057
|
+
--session-file /path/to/sessions/parent-rollout.jsonl \
|
|
1058
|
+
--sessions-dir /path/to/sessions
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
Choose the parent rollout explicitly. Only helpers whose recorded parent chain
|
|
1062
|
+
leads back to that session appear. The selected directory must contain both the
|
|
1063
|
+
parent and helper files; use the smallest directory that contains them all.
|
|
1064
|
+
|
|
1065
|
+
Use **j/k** or the arrow keys to select a helper, then **Enter** to open it.
|
|
1066
|
+
In the detail view, **j/k** scroll, **Space** moves down a page, **g** goes to the
|
|
1067
|
+
top, **G** follows the latest activity, and **b** or **Escape** returns to the list.
|
|
1068
|
+
Press **q** to quit; the Codex session keeps running.
|
|
1069
|
+
|
|
1070
|
+
Use `--agent <thread-id>` to open a specific helper, `--once` to print a snapshot
|
|
1071
|
+
without an interactive terminal, or `--interval <seconds>` to change the refresh
|
|
1072
|
+
interval (default: 2 seconds; range: 0.2–60).
|
|
1073
|
+
|
|
1074
|
+
These screenshots use made-up session records:
|
|
1075
|
+
|
|
1076
|
+

|
|
1077
|
+
|
|
1078
|
+

|
|
1079
|
+
|
|
1080
|
+
### What the viewer can read
|
|
1081
|
+
|
|
1082
|
+
The parser supports CLI rollout files with a `session_meta` header, helper ancestry
|
|
1083
|
+
in `source.subagent.thread_spawn.parent_thread_id`, and an own-thread marker
|
|
1084
|
+
(`payload.thread_id`) before helper activity. Public message, function/custom tool
|
|
1085
|
+
call and result records, and supported task/item events are shown. Formats without
|
|
1086
|
+
these attribution fields may produce an empty list or unavailable activity.
|
|
1087
|
+
|
|
1088
|
+
Copied parent history, reasoning, and system/developer messages are excluded.
|
|
1089
|
+
Ambiguous identities and paths through symlinks are rejected. The viewer strips
|
|
1090
|
+
terminal controls and masks common credential patterns before shortening previews.
|
|
1091
|
+
Masking cannot catch every secret in arbitrary command output: check the visible
|
|
1092
|
+
content before sharing a screenshot.
|
|
1093
|
+
|
|
1094
|
+
State is the last **recorded** state, not a heartbeat. Discovery stops after 4,000
|
|
1095
|
+
entries or eight directory levels; ancestry is limited to 64 links. Each detail
|
|
1096
|
+
refresh reads at most 1 MiB, lines are limited to 64 KiB, previews to 2,400 characters,
|
|
1097
|
+
and history to 80 events. The metadata header must include its terminating newline
|
|
1098
|
+
within the first 64 KiB; an oversized or incomplete header excludes that file.
|
|
1099
|
+
The screen labels incomplete scans, omitted records and logs that are still being
|
|
1100
|
+
read. Missing data stays unavailable.
|
|
1101
|
+
|
|
1102
|
+
### Check the viewer locally
|
|
1103
|
+
|
|
1104
|
+
```bash
|
|
1105
|
+
cd v3/@claude-flow/codex
|
|
1106
|
+
npm test -- --run tests/activity-files.test.ts tests/activity-parser.test.ts tests/activity-viewer.test.ts
|
|
1107
|
+
cd ../../..
|
|
1108
|
+
node scripts/smoke-codex-activity.mjs
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
The Node smoke check runs the built CLI against synthetic files and checks the
|
|
1112
|
+
picker, detail output, history isolation, invalid input and read-only access.
|
|
1113
|
+
The screenshots above were captured from the interactive viewer using synthetic
|
|
1114
|
+
records; screenshot generation is not part of CI.
|
|
1115
|
+
|
|
1116
|
+
### Release integration
|
|
1117
|
+
|
|
1118
|
+
Ship the viewer in `@claude-flow/codex` with the next coordinated Ruflo release.
|
|
1119
|
+
At release, bump the package version and exported `VERSION` together, update the
|
|
1120
|
+
bundled dependency pins and lockfile, and include the built package in the release
|
|
1121
|
+
train.
|
|
1122
|
+
|
|
1045
1123
|
## Related Packages
|
|
1046
1124
|
|
|
1047
1125
|
| Package | Description |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/activity/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,WAAW,CAAC;AAO1D,wBAAgB,qBAAqB,IAAI,OAAO,CA6B/C"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Command, InvalidArgumentError } from 'commander';
|
|
2
|
+
import { realpath } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { emitKeypressEvents } from 'node:readline';
|
|
5
|
+
import { ActivityViewer } from './viewer.js';
|
|
6
|
+
import { sanitize } from './sanitize.js';
|
|
7
|
+
export function createActivityCommand() {
|
|
8
|
+
return new Command('activity')
|
|
9
|
+
.description('Inspect helpers from an existing Codex session (read-only)')
|
|
10
|
+
.requiredOption('--session-file <file>', 'Parent CLI rollout JSONL file')
|
|
11
|
+
.requiredOption('--sessions-dir <directory>', 'Directory containing parent and helper rollouts')
|
|
12
|
+
.option('--agent <id>', 'Open a particular helper thread ID')
|
|
13
|
+
.option('--once', 'Print one bounded snapshot and exit (no interactive terminal needed)')
|
|
14
|
+
.option('--interval <seconds>', 'Refresh interval, 0.2 to 60 seconds', interval, 2)
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
try {
|
|
17
|
+
const root = await realpath(path.resolve(options.sessionsDir));
|
|
18
|
+
// Canonicalize the directory only. A selected file through a symlink is rejected.
|
|
19
|
+
const file = path.resolve(root, path.relative(path.resolve(options.sessionsDir), path.resolve(options.sessionFile)));
|
|
20
|
+
const viewer = new ActivityViewer(root, file);
|
|
21
|
+
await viewer.refresh();
|
|
22
|
+
if (viewer.list.error)
|
|
23
|
+
throw new Error(viewer.list.error);
|
|
24
|
+
if (options.agent) {
|
|
25
|
+
if (!viewer.list.helpers.some(item => item.id === options.agent))
|
|
26
|
+
throw new Error('Agent is not an attributable helper of this session.');
|
|
27
|
+
viewer.selected = options.agent;
|
|
28
|
+
viewer.detail = true;
|
|
29
|
+
await viewer.refresh();
|
|
30
|
+
}
|
|
31
|
+
if (options.once)
|
|
32
|
+
console.log(viewer.render(100, 200));
|
|
33
|
+
else
|
|
34
|
+
await runTerminal(viewer, options.interval * 1000);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error(`Activity viewer: ${sanitize(error instanceof Error ? error.message : 'Unable to read session.', 300)}`);
|
|
38
|
+
process.exitCode = 1;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function interval(value) {
|
|
43
|
+
const parsed = Number(value);
|
|
44
|
+
if (!Number.isFinite(parsed) || parsed < 0.2 || parsed > 60)
|
|
45
|
+
throw new InvalidArgumentError('Choose 0.2 to 60 seconds.');
|
|
46
|
+
return parsed;
|
|
47
|
+
}
|
|
48
|
+
async function runTerminal(viewer, intervalMs) {
|
|
49
|
+
const input = process.stdin;
|
|
50
|
+
const output = process.stdout;
|
|
51
|
+
if (!input.isTTY || !output.isTTY)
|
|
52
|
+
throw new Error('Use --once when input or output is not a terminal.');
|
|
53
|
+
const wasRaw = input.isRaw;
|
|
54
|
+
let stopped = false;
|
|
55
|
+
let busy = false;
|
|
56
|
+
let finish = () => { };
|
|
57
|
+
const done = new Promise(resolve => { finish = resolve; });
|
|
58
|
+
const draw = () => {
|
|
59
|
+
if (!stopped)
|
|
60
|
+
output.write(`\x1b[H\x1b[2J${viewer.render(output.columns || 80, output.rows || 24)}`);
|
|
61
|
+
};
|
|
62
|
+
const close = () => { stopped = true; finish(); };
|
|
63
|
+
const update = async () => {
|
|
64
|
+
if (busy || stopped)
|
|
65
|
+
return;
|
|
66
|
+
busy = true;
|
|
67
|
+
try {
|
|
68
|
+
await viewer.refresh();
|
|
69
|
+
draw();
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
close();
|
|
73
|
+
process.exitCode = 1;
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
busy = false;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const keypress = (text, key) => {
|
|
80
|
+
if (key?.name === 'q' || key?.ctrl && key.name === 'c') {
|
|
81
|
+
close();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
viewer.key(text === 'G' ? 'G' : key?.name ?? text);
|
|
85
|
+
draw();
|
|
86
|
+
if (key?.name === 'return')
|
|
87
|
+
void update();
|
|
88
|
+
};
|
|
89
|
+
emitKeypressEvents(input);
|
|
90
|
+
const timer = setInterval(() => { void update(); }, intervalMs);
|
|
91
|
+
try {
|
|
92
|
+
input.setRawMode(true);
|
|
93
|
+
input.resume();
|
|
94
|
+
input.on('keypress', keypress);
|
|
95
|
+
output.on('resize', draw);
|
|
96
|
+
process.on('SIGINT', close);
|
|
97
|
+
process.on('SIGTERM', close);
|
|
98
|
+
output.write('\x1b[?1049h\x1b[?25l');
|
|
99
|
+
draw();
|
|
100
|
+
await done;
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
stopped = true;
|
|
104
|
+
clearInterval(timer);
|
|
105
|
+
input.off('keypress', keypress);
|
|
106
|
+
output.off('resize', draw);
|
|
107
|
+
process.off('SIGINT', close);
|
|
108
|
+
process.off('SIGTERM', close);
|
|
109
|
+
input.setRawMode(wasRaw);
|
|
110
|
+
// This command owns stdin. A resumed stream would keep Node alive after q.
|
|
111
|
+
input.pause();
|
|
112
|
+
output.write('\x1b[?25h\x1b[?1049l');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/activity/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAY,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;SAC3B,WAAW,CAAC,4DAA4D,CAAC;SACzE,cAAc,CAAC,uBAAuB,EAAE,+BAA+B,CAAC;SACxE,cAAc,CAAC,4BAA4B,EAAE,iDAAiD,CAAC;SAC/F,MAAM,CAAC,cAAc,EAAE,oCAAoC,CAAC;SAC5D,MAAM,CAAC,QAAQ,EAAE,sEAAsE,CAAC;SACxF,MAAM,CAAC,sBAAsB,EAAE,qCAAqC,EAAE,QAAQ,EAAE,CAAC,CAAC;SAClF,MAAM,CAAC,KAAK,EAAE,OAAuG,EAAE,EAAE;QACxH,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;YAC/D,kFAAkF;YAClF,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EA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AAS,EAAE,KAAK,CAAC,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACrC,IAAI,EAAE,CAAC;QACP,MAAM,IAAI,CAAC;IACb,CAAC;YAAS,CAAC;QACT,OAAO,GAAG,IAAI,CAAC;QACf,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9B,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzB,2EAA2E;QAC3E,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileHandle } from 'node:fs/promises';
|
|
2
|
+
import { type SessionIdentity } from './types.js';
|
|
3
|
+
export declare const MAX_LINE: number;
|
|
4
|
+
/** Only regular files whose resolved path stays inside the selected directory. */
|
|
5
|
+
export declare function openSession(root: string, file: string): Promise<FileHandle>;
|
|
6
|
+
export declare function readIdentity(root: string, file: string): Promise<SessionIdentity | null>;
|
|
7
|
+
export interface SessionList {
|
|
8
|
+
root: SessionIdentity | null;
|
|
9
|
+
helpers: SessionIdentity[];
|
|
10
|
+
partial: boolean;
|
|
11
|
+
error: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function listSessions(root: string, rootFile: string, expectedId?: string): Promise<SessionList>;
|
|
14
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/activity/files.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAU,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAG1D,eAAO,MAAM,QAAQ,QAAY,CAAC;AAGlC,kFAAkF;AAClF,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAmBjF;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAyB9F;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAsD5G"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { lstat, open, opendir, realpath } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { object } from './types.js';
|
|
5
|
+
import { sanitize } from './sanitize.js';
|
|
6
|
+
export const MAX_LINE = 64 * 1024;
|
|
7
|
+
const MAX_ENTRIES = 4000;
|
|
8
|
+
/** Only regular files whose resolved path stays inside the selected directory. */
|
|
9
|
+
export async function openSession(root, file) {
|
|
10
|
+
const absolute = path.resolve(file);
|
|
11
|
+
const relative = path.relative(root, absolute);
|
|
12
|
+
if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`)
|
|
13
|
+
|| path.isAbsolute(relative) || await realpath(absolute) !== absolute) {
|
|
14
|
+
throw new Error('Session file is outside the selected directory or uses a symlink.');
|
|
15
|
+
}
|
|
16
|
+
const before = await lstat(absolute);
|
|
17
|
+
if (!before.isFile())
|
|
18
|
+
throw new Error('Session is not a regular file.');
|
|
19
|
+
const handle = await open(absolute, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
20
|
+
try {
|
|
21
|
+
const after = await handle.stat();
|
|
22
|
+
if (!after.isFile() || after.ino !== before.ino || after.dev !== before.dev
|
|
23
|
+
|| await realpath(absolute) !== absolute)
|
|
24
|
+
throw new Error('Session changed while opening.');
|
|
25
|
+
return handle;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
await handle.close();
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export async function readIdentity(root, file) {
|
|
33
|
+
const handle = await openSession(root, file);
|
|
34
|
+
try {
|
|
35
|
+
const buffer = Buffer.alloc(MAX_LINE);
|
|
36
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
37
|
+
const newline = buffer.subarray(0, bytesRead).indexOf(10);
|
|
38
|
+
// A valid JSON prefix is not enough: require the complete metadata line.
|
|
39
|
+
if (newline < 0)
|
|
40
|
+
return null;
|
|
41
|
+
const record = object(JSON.parse(buffer.subarray(0, newline).toString('utf8')));
|
|
42
|
+
const meta = object(record.payload);
|
|
43
|
+
if (record.type !== 'session_meta' || typeof meta.id !== 'string' || !meta.id
|
|
44
|
+
|| meta.id.length > 300)
|
|
45
|
+
return null;
|
|
46
|
+
const spawn = object(object(object(meta.source).subagent).thread_spawn);
|
|
47
|
+
const parent = typeof spawn.parent_thread_id === 'string' ? spawn.parent_thread_id : null;
|
|
48
|
+
const rootSession = meta.source === 'cli' && !meta.forked_from_id
|
|
49
|
+
&& !meta.parent_thread_id && (!meta.thread_source || meta.thread_source === 'user');
|
|
50
|
+
if (!parent && !rootSession)
|
|
51
|
+
return null; // Excludes guardians and unknown sources.
|
|
52
|
+
return {
|
|
53
|
+
id: meta.id, parent, file,
|
|
54
|
+
name: sanitize(meta.agent_nickname ?? spawn.agent_nickname ?? '', 120),
|
|
55
|
+
path: sanitize(meta.agent_path ?? spawn.agent_path ?? meta.id, 200),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
await handle.close();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export async function listSessions(root, rootFile, expectedId) {
|
|
63
|
+
const empty = { root: null, helpers: [], partial: false, error: '' };
|
|
64
|
+
let selected;
|
|
65
|
+
try {
|
|
66
|
+
selected = await readIdentity(root, rootFile);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return { ...empty, error: 'The selected session file is unavailable.' };
|
|
70
|
+
}
|
|
71
|
+
if (!selected || selected.parent || (expectedId && selected.id !== expectedId)) {
|
|
72
|
+
return { ...empty, error: 'Select a root CLI session with an unchanged identity.' };
|
|
73
|
+
}
|
|
74
|
+
const sessions = new Map([[selected.id, selected]]);
|
|
75
|
+
const duplicates = new Set();
|
|
76
|
+
const queue = [{ directory: root, depth: 0 }];
|
|
77
|
+
let entries = 0;
|
|
78
|
+
let partial = false;
|
|
79
|
+
while (queue.length && entries < MAX_ENTRIES) {
|
|
80
|
+
const current = queue.shift();
|
|
81
|
+
try {
|
|
82
|
+
// Revalidate directories too; never recurse through a symlink.
|
|
83
|
+
if (await realpath(current.directory) !== current.directory) {
|
|
84
|
+
partial = true;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const directory = await opendir(current.directory);
|
|
88
|
+
for await (const entry of directory) {
|
|
89
|
+
if (++entries > MAX_ENTRIES) {
|
|
90
|
+
partial = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
const file = path.join(current.directory, entry.name);
|
|
94
|
+
if (entry.isDirectory()) {
|
|
95
|
+
if (current.depth < 8)
|
|
96
|
+
queue.push({ directory: file, depth: current.depth + 1 });
|
|
97
|
+
else
|
|
98
|
+
partial = true;
|
|
99
|
+
}
|
|
100
|
+
else if (entry.isFile() && entry.name.endsWith('.jsonl') && file !== rootFile) {
|
|
101
|
+
try {
|
|
102
|
+
const identity = await readIdentity(root, file);
|
|
103
|
+
if (!identity)
|
|
104
|
+
continue;
|
|
105
|
+
if (sessions.has(identity.id))
|
|
106
|
+
duplicates.add(identity.id);
|
|
107
|
+
else
|
|
108
|
+
sessions.set(identity.id, identity);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
partial = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
partial = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
partial ||= queue.length > 0;
|
|
121
|
+
if (duplicates.has(selected.id))
|
|
122
|
+
return { ...empty, partial: true, error: 'Root session identity is ambiguous.' };
|
|
123
|
+
const belongs = (identity) => {
|
|
124
|
+
const seen = new Set();
|
|
125
|
+
let node = identity;
|
|
126
|
+
while (node?.parent && seen.size < 64) {
|
|
127
|
+
if (seen.has(node.id) || duplicates.has(node.id))
|
|
128
|
+
return false;
|
|
129
|
+
seen.add(node.id);
|
|
130
|
+
if (node.parent === selected.id)
|
|
131
|
+
return true;
|
|
132
|
+
node = sessions.get(node.parent);
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
root: selected,
|
|
138
|
+
helpers: [...sessions.values()].filter(belongs).sort((a, b) => a.path.localeCompare(b.path)),
|
|
139
|
+
partial: partial || duplicates.size > 0, error: '',
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/activity/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAA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AAC,QAAyB,EAAW,EAAE;QACrD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,IAAI,IAAI,GAAgC,QAAQ,CAAC;QACjD,OAAO,IAAI,EAAE,MAAM,IAAI,IAAI,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;YACtC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC/D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAClB,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;YAC7C,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IACF,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5F,OAAO,EAAE,OAAO,IAAI,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ActivitySnapshot } from './types.js';
|
|
2
|
+
/** An allowlist parser. Helper logs may begin with a complete copy of parent history. */
|
|
3
|
+
export declare class ActivityParser {
|
|
4
|
+
private readonly identity;
|
|
5
|
+
private readonly agentPath;
|
|
6
|
+
readonly snapshot: ActivitySnapshot;
|
|
7
|
+
private first;
|
|
8
|
+
private verified;
|
|
9
|
+
private own;
|
|
10
|
+
private calls;
|
|
11
|
+
constructor(identity: string, agentPath: string);
|
|
12
|
+
invalidate(): void;
|
|
13
|
+
consume(value: unknown): void;
|
|
14
|
+
private append;
|
|
15
|
+
private message;
|
|
16
|
+
private tool;
|
|
17
|
+
private result;
|
|
18
|
+
private event;
|
|
19
|
+
private response;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/activity/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,gBAAgB,EAAqB,MAAM,YAAY,CAAC;AAMlG,yFAAyF;AACzF,qBAAa,cAAc;IAUb,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAU,OAAO,CAAC,QAAQ,CAAC,SAAS;IATzE,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAGjC;IACF,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAoC;gBAEpB,QAAQ,EAAE,MAAM,EAAmB,SAAS,EAAE,MAAM;IAEjF,UAAU,IAAI,IAAI;IAOlB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IA2B7B,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,KAAK;IA0Bb,OAAO,CAAC,QAAQ;CAiBjB"}
|