@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 CHANGED
@@ -1,97 +1,143 @@
1
1
  ---
2
2
  name: crewx/dreaming
3
3
  description: >
4
- 선별 실행하는 필수 회고 스킬. 태스크/대화 단위로 에이전트 행동을 되돌아보는
5
- 1급 자기성찰 도구. memory/doc/search와 동급으로 상황 판단해 주도적으로 호출한다.
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은 에이전트의 1급 자기성찰 도구다.**
14
- memory(기억 저장/검색), doc(설계서 탐색), search(코드 검색)와 동급으로,
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` | 돋보기 | 태스크 1건을 깊게 — 행동 타임라인, 삽질 패턴, 효율 패턴, 스킬 사용 현황 |
22
- | `crewx dreaming --thread=thd_xxx --recent=N` | 지도 | 대화 내 최근 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
- - **작업 시작 전**: 방금 끊긴 태스크가 있는지 확인 → `--thread` 목록 확인
27
- - **실패 태스크 재시도**: 직전에 어디까지 하다 멈췄는지 → `--task` 로 타임라인 확인
28
- - **대화 맥락 파악**: 이 대화에서 뭘 시켰는지 목록으로 파악 → `--thread --recent=5`
29
- - **작업 후 자기 점검**: 삽질 패턴 / 효율 패턴 확인 → `--task` 로 회고
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
- # 태스크 1건 깊이 회고
36
+ # Deep retrospective on one task
35
37
  crewx dreaming --task=tsk_abc123
36
38
 
37
- # 대화 내 최근 5건 목록 (기본값)
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
- ## 출력 예시 — --task 모드
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
- 📋 지시: dreaming 빌트인 승격 작업
53
- 📝 결론: packages/built-in/dreaming/ 생성 완료
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
- 💡 삽질: analyzer.ts 2회 수정 (41→43) — 타입 불일치
65
+ 💡 Struggle: edited analyzer.ts twice (41→43) — type mismatch
64
66
 
65
- [스킬 사용]
66
- crewx/memory 3회 (index, find, save)
67
- crewx/doc 2회 (toc, section)
67
+ [Skill Usage]
68
+ crewx/memory 3x (index, find, save)
69
+ crewx/doc 2x (toc, section)
68
70
 
69
- [회고 요약]
70
- ⚠️ 삽질 패턴: 같은 파일 반복 수정 1건 (analyzer.ts 2회)
71
- 💡 인사이트: 에러 대부분 타입 불일치 (1건)
72
- 🔍 코드 분석 활용 — tsserver 5회 사용
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
- ## 출력 예시 — --thread 모드
77
+ ## Output Example — --thread Mode
76
78
 
77
79
  ```
78
- ━━━ Dreaming: thread thd_xyz789 — 최근 5건 ━━━
79
- 태스크 목록: 5건
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
- 드릴다운: crewx dreaming --task=<id>
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` | — | 태스크 ID (tsk_xxx) |
95
- | `--thread=ID` | — | 스레드 ID (thd_xxx) |
96
- | `--recent=N` | 5 | --thread 시 최근 N건 |
97
- | `--json` | false | JSON 출력 |
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
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
+ export declare const DEFAULT_ACTIVITY_LOG_BUDGET = 8000;
2
3
  export declare function main(inputArgs?: string[]): Promise<void>;
3
4
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AAoEA,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkE9D"}
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
- 에이전트가 작업 전/후, 재시도 시 상황을 파악하기 위해 호출하는 1급 자기성찰 도구.
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 태스크 1건 깊이 회고 (행동 타임라인 + 스킬 사용 + 삽질/효율 요약)
56
- --thread=ID 대화 내 최근 N개 태스크 목록 + 각 종료상태
57
- --recent=N --thread 시 최근 N건 (기본값: 5)
58
- --json JSON 출력
59
- --help, -h 도움말
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
- - 대화 맥락 파악: --thread 로 이 대화에서 뭘 시켰는지 목록 확인
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 --recent=20
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
- process.stdout.write(JSON.stringify(result, null, 2) + '\n');
201
+ writeJson(jsonSafeAnalysis(result, flags.full));
96
202
  return;
97
203
  }
98
- console.log((0, renderer_js_1.renderTaskFull)(result));
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
- const allTasks = taskRepo.findTasksByThread(flags.thread);
104
- const topLevel = allTasks
105
- .filter((t) => !t.parent_task_id)
106
- .sort((a, b) => (b.started_at > a.started_at ? 1 : -1))
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
- process.stdout.write(JSON.stringify(summaryRows, null, 2) + '\n');
297
+ writeJson(summaryRows);
118
298
  return;
119
299
  }
120
- console.log((0, renderer_js_1.renderThreadTaskList)(summaryRows, flags.thread, recent));
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;;AAmEb,oBAkEC;AAnID,oCAA4D;AAC5D,mDAAgD;AAChD,mDAAyE;AAGzE,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;KACX,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC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AAE;QACxB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -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":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAIV,YAAY,EACb,MAAM,YAAY,CAAC;AA6BpB,wBAAgB,i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