@crewx/dreaming 0.1.0-rc.9 → 0.1.0-rc.90
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/SKILL.md +93 -47
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +217 -26
- package/dist/cli.js.map +1 -1
- package/dist/src/analyzer.d.ts +9 -2
- package/dist/src/analyzer.d.ts.map +1 -1
- package/dist/src/analyzer.js +182 -15
- package/dist/src/analyzer.js.map +1 -1
- package/dist/src/renderer.d.ts +12 -2
- package/dist/src/renderer.d.ts.map +1 -1
- package/dist/src/renderer.js +172 -29
- package/dist/src/renderer.js.map +1 -1
- package/dist/src/scrub.d.ts +4 -0
- package/dist/src/scrub.d.ts.map +1 -0
- package/dist/src/scrub.js +58 -0
- package/dist/src/scrub.js.map +1 -0
- package/dist/src/types.d.ts +44 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +3 -3
package/SKILL.md
CHANGED
|
@@ -1,97 +1,143 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: crewx/dreaming
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
Essential retrospective skill invoked selectively. A first-class self-reflection
|
|
5
|
+
tool for reviewing agent behavior at the task/conversation level. On par with
|
|
6
|
+
memory/doc/search — the agent judges the situation and calls it proactively.
|
|
6
7
|
metadata:
|
|
7
8
|
version: 0.1.0
|
|
8
9
|
built-in: true
|
|
9
10
|
---
|
|
10
11
|
|
|
11
|
-
# Dreaming —
|
|
12
|
+
# Dreaming — Essential Retrospective Skill
|
|
12
13
|
|
|
13
|
-
**dreaming
|
|
14
|
-
memory(
|
|
15
|
-
|
|
14
|
+
**dreaming is the agent's first-class self-reflection tool.**
|
|
15
|
+
On par with memory (store/search memories), doc (explore design docs), and search (search code),
|
|
16
|
+
the agent judges the situation and **calls it on its own** — it doesn't wait for a manual request.
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## Two Views
|
|
18
19
|
|
|
19
|
-
|
|
|
20
|
+
| Command | View | When to use |
|
|
20
21
|
|--------|------|---------|
|
|
21
|
-
| `crewx dreaming --task=tsk_xxx` |
|
|
22
|
-
| `crewx dreaming --thread=thd_xxx --recent=N` |
|
|
22
|
+
| `crewx dreaming --task=tsk_xxx` | Magnifier | Deep dive into one task — action timeline, struggle patterns, efficiency patterns, skill usage |
|
|
23
|
+
| `crewx dreaming --thread=thd_xxx --recent=N` | Map | List of the last N tasks in the conversation + each one's end status |
|
|
24
|
+
| `crewx dreaming --thread=thd_xxx --agent=self --continue` | Continue | Detail on my most recent task + rule-based summary of the N before it |
|
|
23
25
|
|
|
24
|
-
##
|
|
26
|
+
## When To Call It (Agent Judgment Criteria)
|
|
25
27
|
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
28
|
+
- **Before starting work**: Check whether a task was just interrupted → check the `--thread` list
|
|
29
|
+
- **Retrying a failed task**: See where it stopped last time → check the timeline with `--task`
|
|
30
|
+
- **Understanding conversation context**: Get a list of what was asked in this conversation → `--thread --recent=5`
|
|
31
|
+
- **Self-check after a task**: Check for struggle patterns / efficiency patterns → retrospect with `--task`
|
|
30
32
|
|
|
31
|
-
##
|
|
33
|
+
## Usage
|
|
32
34
|
|
|
33
35
|
```bash
|
|
34
|
-
#
|
|
36
|
+
# Deep retrospective on one task
|
|
35
37
|
crewx dreaming --task=tsk_abc123
|
|
36
38
|
|
|
37
|
-
#
|
|
39
|
+
# List of the last 5 in the conversation (default)
|
|
38
40
|
crewx dreaming --thread=thd_xyz789
|
|
39
41
|
|
|
40
|
-
#
|
|
42
|
+
# See more
|
|
41
43
|
crewx dreaming --thread=thd_xyz789 --recent=20
|
|
42
44
|
|
|
43
|
-
#
|
|
45
|
+
# Drill down into a specific task
|
|
44
46
|
crewx dreaming --task=tsk_abc123 --json
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
##
|
|
49
|
+
## Output Example — --task Mode
|
|
48
50
|
|
|
49
51
|
```
|
|
50
52
|
━━━ Dreaming: task tsk_abc123 ━━━
|
|
51
53
|
Agent: core_dev (acp/claude) | Status: success | Duration: 312s | Tools: 47 calls
|
|
52
|
-
📋
|
|
53
|
-
📝
|
|
54
|
+
📋 Instruction: promote dreaming to a built-in skill
|
|
55
|
+
📝 Conclusion: packages/built-in/dreaming/ created successfully
|
|
54
56
|
|
|
55
|
-
[
|
|
57
|
+
[Timeline]
|
|
56
58
|
1. Read packages/built-in/memory/package.json
|
|
57
59
|
2. Read packages/built-in/doc/tsconfig.json
|
|
58
60
|
3. Edit packages/built-in/dreaming/package.json
|
|
59
61
|
...
|
|
60
62
|
41. Bash npx tsc --noEmit → ❌ error TS2345
|
|
61
|
-
42. Edit packages/built-in/dreaming/src/analyzer.ts ←
|
|
63
|
+
42. Edit packages/built-in/dreaming/src/analyzer.ts ← re-edited the same file
|
|
62
64
|
43. Bash npx tsc --noEmit → ✅ pass
|
|
63
|
-
💡
|
|
65
|
+
💡 Struggle: edited analyzer.ts twice (41→43) — type mismatch
|
|
64
66
|
|
|
65
|
-
[
|
|
66
|
-
crewx/memory
|
|
67
|
-
crewx/doc
|
|
67
|
+
[Skill Usage]
|
|
68
|
+
crewx/memory 3x (index, find, save)
|
|
69
|
+
crewx/doc 2x (toc, section)
|
|
68
70
|
|
|
69
|
-
[
|
|
70
|
-
⚠️
|
|
71
|
-
💡
|
|
72
|
-
🔍
|
|
71
|
+
[Retrospective Summary]
|
|
72
|
+
⚠️ Struggle pattern: repeated edits to the same file, 1 case (analyzer.ts x2)
|
|
73
|
+
💡 Insight: most errors were type mismatches (1 case)
|
|
74
|
+
🔍 Used code analysis — tsserver called 5x
|
|
73
75
|
```
|
|
74
76
|
|
|
75
|
-
##
|
|
77
|
+
## Output Example — --thread Mode
|
|
76
78
|
|
|
77
79
|
```
|
|
78
|
-
━━━ Dreaming: thread thd_xyz789 —
|
|
79
|
-
|
|
80
|
+
━━━ Dreaming: thread thd_xyz789 — last 5 ━━━
|
|
81
|
+
Task list: 5
|
|
80
82
|
|
|
81
|
-
1. ✅ tsk_abc123 | core_dev | success | 312s | dreaming
|
|
82
|
-
2. ❌ tsk_def456 | core_dev | failed | 45s | tsc
|
|
83
|
-
3. ✅ tsk_ghi789 | ui_lead | completed | 180s | UI
|
|
84
|
-
4. ✅ tsk_jkl012 | core_dev | success | 240s | SDK
|
|
85
|
-
5. ✅ tsk_mno345 | core_dev | success | 90s | CLI registry
|
|
83
|
+
1. ✅ tsk_abc123 | core_dev | success | 312s | promote dreaming to a built-in skill
|
|
84
|
+
2. ❌ tsk_def456 | core_dev | failed | 45s | tsc build verification
|
|
85
|
+
3. ✅ tsk_ghi789 | ui_lead | completed | 180s | UI component review
|
|
86
|
+
4. ✅ tsk_jkl012 | core_dev | success | 240s | apply SDK repository pattern
|
|
87
|
+
5. ✅ tsk_mno345 | core_dev | success | 90s | register CLI registry
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
Drill down: crewx dreaming --task=<id>
|
|
88
90
|
```
|
|
89
91
|
|
|
92
|
+
## Output Example — --continue Mode (Continue My Previous Work)
|
|
93
|
+
|
|
94
|
+
Within the same thread, this picks out only the **current agent's own** previous work, showing the most recent one in detail plus rule-based one-line summaries of the ones before it. The summaries are based on tool count / status / duration / files, not an LLM.
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
━━━ Continue My Previous Work ━━━
|
|
98
|
+
Thread: thd_xyz789 | Agent: core_lead
|
|
99
|
+
|
|
100
|
+
[Most Recent Task]
|
|
101
|
+
|
|
102
|
+
━━━ Dreaming: task tsk_123 ━━━
|
|
103
|
+
... detailed activity log (timeline capped at 30, remove with --full) ...
|
|
104
|
+
|
|
105
|
+
[Previous Task Summary]
|
|
106
|
+
- tsk_122 | ✅ success | 120s | Bash 3x, Read 4x, Edit 0x
|
|
107
|
+
- tsk_121 | ❌ failed | 45s | Bash 2x | ⚠️ struggle
|
|
108
|
+
|
|
109
|
+
━━━ Next Actions ━━━
|
|
110
|
+
Full activity log:
|
|
111
|
+
crewx dreaming --task=tsk_122 --full
|
|
112
|
+
Detailed task log JSON:
|
|
113
|
+
crewx dreaming --task=tsk_122 --json
|
|
114
|
+
Task list for this conversation:
|
|
115
|
+
crewx dreaming --thread=thd_xyz789 --agent=core_lead
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Continue the current agent's own previous work
|
|
120
|
+
crewx dreaming --thread=thd_xyz789 --agent=self --continue
|
|
121
|
+
|
|
122
|
+
# Explicit agent + last 3 (most recent 1 detailed + previous 2 summarized)
|
|
123
|
+
crewx dreaming --thread=thd_xyz789 --agent=core_lead --continue --recent=3
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> `--agent=self` resolves the current agent via the `CREWX_AGENT_ID` environment variable. If the variable isn't set, you must specify an explicit agent id.
|
|
127
|
+
|
|
90
128
|
## Options
|
|
91
129
|
|
|
92
|
-
|
|
|
130
|
+
| Option | Default | Description |
|
|
93
131
|
|------|--------|------|
|
|
94
|
-
| `--task=ID` | — |
|
|
95
|
-
| `--thread=ID` | — |
|
|
96
|
-
| `--
|
|
97
|
-
| `--
|
|
132
|
+
| `--task=ID` | — | Task ID (tsk_xxx) |
|
|
133
|
+
| `--thread=ID` | — | Thread ID (thd_xxx) |
|
|
134
|
+
| `--agent=ID` | — | Only this agent within the thread (`self` → current agent) |
|
|
135
|
+
| `--continue` | false | Continue my previous work (most recent 1 detailed + previous N rule-based summary) |
|
|
136
|
+
| `--recent=N` | list 5 / continue 3 | Last N items |
|
|
137
|
+
| `--full` | false | Remove the timeline cap + include raw fields in JSON |
|
|
138
|
+
| `--json` | false | Pure JSON output (no CAL footer) |
|
|
139
|
+
|
|
140
|
+
## CAL "Next Actions"
|
|
141
|
+
|
|
142
|
+
A CAL footer guiding the next action is appended to the bottom of human-readable output (`--full`, `--json`, thread drill-down).
|
|
143
|
+
**The `--json` output has no footer and can be parsed as a single JSON value.** Without `--full`, the raw input/result fields are excluded from the JSON.
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AA2BA,eAAO,MAAM,2BAA2B,OAAO,CAAC;AA8IhD,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyK9D"}
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.DEFAULT_ACTIVITY_LOG_BUDGET = void 0;
|
|
4
38
|
exports.main = main;
|
|
5
39
|
const sdk_1 = require("@crewx/sdk");
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
6
42
|
const analyzer_js_1 = require("./src/analyzer.js");
|
|
43
|
+
const scrub_js_1 = require("./src/scrub.js");
|
|
7
44
|
const renderer_js_1 = require("./src/renderer.js");
|
|
45
|
+
exports.DEFAULT_ACTIVITY_LOG_BUDGET = 8000;
|
|
46
|
+
const DEFAULT_TASK_TIMELINE = 60;
|
|
47
|
+
const CONTINUE_LATEST_TIMELINE = 30;
|
|
8
48
|
function parseFlags(argv) {
|
|
9
49
|
const flags = {
|
|
10
50
|
task: null,
|
|
@@ -14,12 +54,22 @@ function parseFlags(argv) {
|
|
|
14
54
|
recent: null,
|
|
15
55
|
json: false,
|
|
16
56
|
all: false,
|
|
57
|
+
continue: false,
|
|
58
|
+
full: false,
|
|
59
|
+
lookback: 3,
|
|
60
|
+
activityLog: false,
|
|
17
61
|
};
|
|
18
62
|
for (const a of argv) {
|
|
19
63
|
if (a === '--json')
|
|
20
64
|
flags.json = true;
|
|
21
65
|
else if (a === '--all')
|
|
22
66
|
flags.all = true;
|
|
67
|
+
else if (a === '--full')
|
|
68
|
+
flags.full = true;
|
|
69
|
+
else if (a === '--continue')
|
|
70
|
+
flags.continue = true;
|
|
71
|
+
else if (a === '--activity-log')
|
|
72
|
+
flags.activityLog = true;
|
|
23
73
|
else if (a.startsWith('--task='))
|
|
24
74
|
flags.task = a.slice('--task='.length);
|
|
25
75
|
else if (a.startsWith('--thread='))
|
|
@@ -30,6 +80,8 @@ function parseFlags(argv) {
|
|
|
30
80
|
flags.days = parseInt(a.slice('--days='.length), 10);
|
|
31
81
|
else if (a.startsWith('--recent='))
|
|
32
82
|
flags.recent = parseInt(a.slice('--recent='.length), 10);
|
|
83
|
+
else if (a.startsWith('--lookback='))
|
|
84
|
+
flags.lookback = parseInt(a.slice('--lookback='.length), 10);
|
|
33
85
|
else if (a === '--help' || a === '-h') {
|
|
34
86
|
printUsage();
|
|
35
87
|
process.exit(0);
|
|
@@ -42,41 +94,95 @@ function parseFlags(argv) {
|
|
|
42
94
|
return flags;
|
|
43
95
|
}
|
|
44
96
|
function printUsage() {
|
|
45
|
-
console.log(`crewx dreaming —
|
|
97
|
+
console.log(`crewx dreaming — Selective reflection skill
|
|
46
98
|
|
|
47
|
-
|
|
48
|
-
memory/doc/search
|
|
99
|
+
A first-class reflection tool agents call before/after work or during retries to recover context.
|
|
100
|
+
Use it proactively alongside memory/doc/search when the situation calls for it.
|
|
49
101
|
|
|
50
102
|
Usage:
|
|
51
|
-
crewx dreaming --task=TASK_ID
|
|
52
|
-
crewx dreaming --thread=THREAD_ID [--recent=N]
|
|
103
|
+
crewx dreaming --task=TASK_ID [--full] [--json]
|
|
104
|
+
crewx dreaming --thread=THREAD_ID [--agent=AGENT_ID] [--recent=N]
|
|
105
|
+
crewx dreaming --thread=THREAD_ID --agent=AGENT_ID --continue [--recent=N] [--full] [--json]
|
|
106
|
+
crewx dreaming --thread=THREAD_ID --agent=AGENT_ID --activity-log [--lookback=N] [--json]
|
|
53
107
|
|
|
54
108
|
Options:
|
|
55
|
-
--task=ID
|
|
56
|
-
--thread=ID
|
|
57
|
-
--
|
|
58
|
-
--
|
|
59
|
-
--
|
|
109
|
+
--task=ID Deep reflection for one task (timeline + skill usage + struggle/efficiency summary)
|
|
110
|
+
--thread=ID List the last N tasks in a conversation with each end status
|
|
111
|
+
--agent=ID Restrict thread view to one agent (--agent=self means current agent)
|
|
112
|
+
--continue Continue previous work: latest task details plus rule-based summary of prior tasks
|
|
113
|
+
--activity-log Output precomputed <activity_log> XML of read-only results from previous N tasks
|
|
114
|
+
--lookback=N N-back depth for --activity-log (default: 3, 0 = disabled, max recommended: 5)
|
|
115
|
+
--recent=N Last N items (list default: 5 / continue default: 3)
|
|
116
|
+
--full Show the full timeline and include raw fields in JSON
|
|
117
|
+
--json Pure JSON output without a CAL footer
|
|
118
|
+
--help, -h Show help
|
|
60
119
|
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
120
|
+
When to call:
|
|
121
|
+
- Before starting: check whether there is an interrupted task
|
|
122
|
+
- Before retrying after failure: recover where the previous attempt stopped
|
|
123
|
+
- To understand conversation context: use --thread to list tasks in this conversation
|
|
124
|
+
- Continue previous work: --thread --agent --continue
|
|
125
|
+
- SDK prompt assembly: --activity-log to inject precomputed read-only results
|
|
66
126
|
|
|
67
127
|
Examples:
|
|
68
|
-
crewx dreaming --task=tsk_abc123
|
|
128
|
+
crewx dreaming --task=tsk_abc123 --full
|
|
69
129
|
crewx dreaming --thread=thd_xyz789 --recent=5
|
|
70
|
-
crewx dreaming --thread=thd_xyz789 --
|
|
130
|
+
crewx dreaming --thread=thd_xyz789 --agent=core_lead --continue
|
|
131
|
+
crewx dreaming --thread=thd_xyz789 --agent=core_lead --activity-log --lookback=2
|
|
71
132
|
`);
|
|
72
133
|
}
|
|
134
|
+
function showDetailedUsage() {
|
|
135
|
+
const skillMd = path.join(__dirname, '..', 'SKILL.md');
|
|
136
|
+
if (fs.existsSync(skillMd)) {
|
|
137
|
+
process.stdout.write(fs.readFileSync(skillMd, 'utf-8'));
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
printUsage();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function resolveAgent(agent) {
|
|
144
|
+
if (agent !== 'self')
|
|
145
|
+
return agent;
|
|
146
|
+
const envAgent = process.env.CREWX_AGENT_ID;
|
|
147
|
+
if (!envAgent) {
|
|
148
|
+
console.error('Error: --agent=self requires CREWX_AGENT_ID in the environment.\n' +
|
|
149
|
+
'Pass an explicit agent id instead, e.g. --agent=core_lead.');
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
return envAgent;
|
|
153
|
+
}
|
|
154
|
+
function jsonSafeAnalysis(a, full) {
|
|
155
|
+
if (full)
|
|
156
|
+
return a;
|
|
157
|
+
return {
|
|
158
|
+
...a,
|
|
159
|
+
timeline: a.timeline.map((e) => {
|
|
160
|
+
const { input: _input, resultPreview: _resultPreview, ...rest } = e;
|
|
161
|
+
return rest;
|
|
162
|
+
}),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function writeJson(obj) {
|
|
166
|
+
process.stdout.write(JSON.stringify((0, scrub_js_1.scrubSecrets)(obj), null, 2) + '\n');
|
|
167
|
+
}
|
|
168
|
+
function topLevelByThread(taskRepo, threadId) {
|
|
169
|
+
return taskRepo
|
|
170
|
+
.findTasksByThread(threadId)
|
|
171
|
+
.filter((t) => !t.parent_task_id)
|
|
172
|
+
.sort((a, b) => (b.started_at > a.started_at ? 1 : -1));
|
|
173
|
+
}
|
|
73
174
|
async function main(inputArgs) {
|
|
74
175
|
const args = inputArgs ?? process.argv.slice(2);
|
|
176
|
+
if (args[0] === 'usage') {
|
|
177
|
+
showDetailedUsage();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
75
180
|
if (!args.length || args[0] === '--help' || args[0] === '-h') {
|
|
76
181
|
printUsage();
|
|
77
182
|
return;
|
|
78
183
|
}
|
|
79
184
|
const flags = parseFlags(args);
|
|
185
|
+
const agent = resolveAgent(flags.agent);
|
|
80
186
|
if (!flags.task && !flags.thread) {
|
|
81
187
|
console.error('Error: --task=<id> or --thread=<id> is required.\nRun crewx dreaming --help for usage.');
|
|
82
188
|
process.exit(1);
|
|
@@ -92,19 +198,93 @@ async function main(inputArgs) {
|
|
|
92
198
|
const spans = spanRepo.findByTaskId(flags.task);
|
|
93
199
|
const result = (0, analyzer_js_1.analyzeTask)(row, spans);
|
|
94
200
|
if (flags.json) {
|
|
95
|
-
|
|
201
|
+
writeJson(jsonSafeAnalysis(result, flags.full));
|
|
96
202
|
return;
|
|
97
203
|
}
|
|
98
|
-
|
|
204
|
+
const detail = (0, renderer_js_1.renderTaskFull)(result, {
|
|
205
|
+
maxTimeline: flags.full ? null : DEFAULT_TASK_TIMELINE,
|
|
206
|
+
});
|
|
207
|
+
const actions = [];
|
|
208
|
+
if (!flags.full) {
|
|
209
|
+
actions.push({ label: 'Full activity log', cmd: `crewx dreaming --task=${result.taskId} --full` });
|
|
210
|
+
}
|
|
211
|
+
actions.push({ label: 'Detailed task log JSON', cmd: `crewx dreaming --task=${result.taskId} --json` });
|
|
212
|
+
console.log(detail + '\n' + (0, renderer_js_1.buildCalFooter)(actions));
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (flags.thread && flags.activityLog) {
|
|
216
|
+
if (!agent) {
|
|
217
|
+
console.error('Error: --activity-log requires --agent=<id> (or --agent=self).');
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
const lookback = flags.lookback;
|
|
221
|
+
if (lookback === 0) {
|
|
222
|
+
if (flags.json) {
|
|
223
|
+
writeJson({ mode: 'activity-log', lookback: 0, entries: [], truncated: false, xml: '' });
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
process.stdout.write('');
|
|
227
|
+
}
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const rows = topLevelByThread(taskRepo, flags.thread)
|
|
231
|
+
.filter((t) => t.agent_id === agent)
|
|
232
|
+
.slice(0, Math.min(lookback, 5));
|
|
233
|
+
const analyses = rows.map((t) => (0, analyzer_js_1.analyzeTask)(t, spanRepo.findByTaskId(t.id)));
|
|
234
|
+
const log = (0, analyzer_js_1.buildActivityLog)(analyses, flags.thread, agent, lookback, exports.DEFAULT_ACTIVITY_LOG_BUDGET);
|
|
235
|
+
if (flags.json) {
|
|
236
|
+
writeJson({ mode: 'activity-log', ...log, xml: (0, renderer_js_1.renderActivityLogXml)(log) });
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
process.stdout.write((0, renderer_js_1.renderActivityLogXml)(log) + '\n');
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (flags.thread && flags.continue) {
|
|
243
|
+
if (!agent) {
|
|
244
|
+
console.error('Error: --continue requires --agent=<id> (or --agent=self).');
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
const recent = flags.recent ?? 3;
|
|
248
|
+
const rows = topLevelByThread(taskRepo, flags.thread).filter((t) => t.agent_id === agent).slice(0, recent + 1);
|
|
249
|
+
const analyses = rows.map((t) => (0, analyzer_js_1.analyzeTask)(t, spanRepo.findByTaskId(t.id)));
|
|
250
|
+
const latest = analyses[0] ?? null;
|
|
251
|
+
const previous = analyses.slice(1).map(analyzer_js_1.summarizeAnalysis);
|
|
252
|
+
const result = {
|
|
253
|
+
mode: 'continue',
|
|
254
|
+
thread: flags.thread,
|
|
255
|
+
agent,
|
|
256
|
+
latest,
|
|
257
|
+
previous,
|
|
258
|
+
};
|
|
259
|
+
if (flags.json) {
|
|
260
|
+
writeJson({
|
|
261
|
+
...result,
|
|
262
|
+
latest: latest ? jsonSafeAnalysis(latest, flags.full) : null,
|
|
263
|
+
});
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const body = (0, renderer_js_1.renderContinue)(result, {
|
|
267
|
+
maxTimeline: flags.full ? null : CONTINUE_LATEST_TIMELINE,
|
|
268
|
+
});
|
|
269
|
+
const actions = [];
|
|
270
|
+
const drill = previous[0]?.taskId ?? latest?.taskId;
|
|
271
|
+
if (drill) {
|
|
272
|
+
actions.push({ label: 'Full activity log', cmd: `crewx dreaming --task=${drill} --full` });
|
|
273
|
+
actions.push({ label: 'Detailed task log JSON', cmd: `crewx dreaming --task=${drill} --json` });
|
|
274
|
+
}
|
|
275
|
+
actions.push({
|
|
276
|
+
label: 'Task list for this conversation',
|
|
277
|
+
cmd: `crewx dreaming --thread=${flags.thread} --agent=${agent}`,
|
|
278
|
+
});
|
|
279
|
+
console.log(body + (actions.length ? '\n' + (0, renderer_js_1.buildCalFooter)(actions) : ''));
|
|
99
280
|
return;
|
|
100
281
|
}
|
|
101
282
|
if (flags.thread) {
|
|
102
283
|
const recent = flags.recent ?? 5;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.filter((t) =>
|
|
106
|
-
|
|
107
|
-
.slice(0, recent);
|
|
284
|
+
let topLevel = topLevelByThread(taskRepo, flags.thread);
|
|
285
|
+
if (agent)
|
|
286
|
+
topLevel = topLevel.filter((t) => t.agent_id === agent);
|
|
287
|
+
topLevel = topLevel.slice(0, recent);
|
|
108
288
|
const summaryRows = topLevel.map((t) => ({
|
|
109
289
|
taskId: t.id,
|
|
110
290
|
agentId: t.agent_id,
|
|
@@ -114,10 +294,21 @@ async function main(inputArgs) {
|
|
|
114
294
|
duration: t.duration_ms != null ? Math.round(t.duration_ms / 1000) : null,
|
|
115
295
|
}));
|
|
116
296
|
if (flags.json) {
|
|
117
|
-
|
|
297
|
+
writeJson(summaryRows);
|
|
118
298
|
return;
|
|
119
299
|
}
|
|
120
|
-
|
|
300
|
+
const list = (0, renderer_js_1.renderThreadTaskList)(summaryRows, flags.thread, recent);
|
|
301
|
+
const actions = [];
|
|
302
|
+
const first = summaryRows[0];
|
|
303
|
+
if (first) {
|
|
304
|
+
const agentArg = agent ?? first.agentId;
|
|
305
|
+
actions.push({
|
|
306
|
+
label: 'Continue previous work',
|
|
307
|
+
cmd: `crewx dreaming --thread=${flags.thread} --agent=${agentArg} --continue`,
|
|
308
|
+
});
|
|
309
|
+
actions.push({ label: 'Task drilldown', cmd: `crewx dreaming --task=${first.taskId} --full` });
|
|
310
|
+
}
|
|
311
|
+
console.log(list + (actions.length ? '\n' + (0, renderer_js_1.buildCalFooter)(actions) : ''));
|
|
121
312
|
return;
|
|
122
313
|
}
|
|
123
314
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKb,oBAyKC;AA/UD,oCAA4D;AAE5D,uCAAyB;AACzB,2CAA6B;AAC7B,mDAAqF;AACrF,6CAA8C;AAC9C,mDAO2B;AAWd,QAAA,2BAA2B,GAAG,IAAI,CAAC;AAGhD,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC,SAAS,UAAU,CAAC,IAAc;IAChC,MAAM,KAAK,GAAkB;QAC3B,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,KAAK;QACV,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,KAAK;KACnB,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;aACjC,IAAI,CAAC,KAAK,OAAO;YAAE,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;aACpC,IAAI,CAAC,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;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;QAED,MAAM,IAAI,GAAG,IAAA,kCAAoB,EAAC,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrE,MAAM,OAAO,GAAgB,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,QAAQ,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK,EAAE,wBAAwB;gBAC/B,GAAG,EAAE,2BAA2B,KAAK,CAAC,MAAM,YAAY,QAAQ,aAAa;aAC9E,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,yBAAyB,KAAK,CAAC,MAAM,SAAS,EAAE,CAAC,CAAC;QACjG,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,IAAA,4BAAc,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3E,OAAO;IACT,CAAC;AACH,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/src/analyzer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SpanRow, TaskRow } from '@crewx/sdk';
|
|
2
|
-
import type { TaskAnalysis } from './types.js';
|
|
2
|
+
import type { TaskAnalysis, TaskActivitySummary, ActivityLogEntry, ActivityLog } from './types.js';
|
|
3
3
|
export declare function normalizeToolName(name: string | null | undefined): string;
|
|
4
4
|
interface RawToolCall {
|
|
5
5
|
toolUseId: string | null;
|
|
@@ -8,7 +8,14 @@ interface RawToolCall {
|
|
|
8
8
|
isError: boolean | null;
|
|
9
9
|
resultPreview: string | null;
|
|
10
10
|
}
|
|
11
|
-
export declare function extractToolCallsFromLogs(logs: unknown[]): RawToolCall[];
|
|
11
|
+
export declare function extractToolCallsFromLogs(logs: unknown[], metaProvider?: string): RawToolCall[];
|
|
12
12
|
export declare function analyzeTask(row: TaskRow, spans: SpanRow[]): TaskAnalysis;
|
|
13
|
+
export declare const READ_ONLY_TOOLS: Set<string>;
|
|
14
|
+
export declare const READ_ONLY_BASH_PREFIXES: string[];
|
|
15
|
+
export declare function isReadOnlyToolCall(name: string, input: string | null): boolean;
|
|
16
|
+
export declare function checkFileStaleness(filePath: string, taskCompletedAt?: string | null): 'ok' | 'stale' | 'unknown';
|
|
17
|
+
export declare function extractActivityLogEntries(analyses: TaskAnalysis[]): ActivityLogEntry[];
|
|
18
|
+
export declare function buildActivityLog(analyses: TaskAnalysis[], threadId: string, agentId: string, lookback: number, tokenBudget: number): ActivityLog;
|
|
19
|
+
export declare function summarizeAnalysis(a: TaskAnalysis): TaskActivitySummary;
|
|
13
20
|
export {};
|
|
14
21
|
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../src/analyzer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../src/analyzer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAIV,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAC;AA6BpB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GA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