cawdex 1.35.65 → 1.35.67
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/README.md +186 -186
- package/bin/anycode.js +2 -2
- package/bin/cawdex.js +408 -408
- package/bin/ecc-hooks.cjs +11 -11
- package/dist/agents.js +1424 -1424
- package/dist/autonomous-loops.js +287 -287
- package/dist/command-palette.js +1 -1
- package/dist/command-palette.js.map +1 -1
- package/dist/compaction.js +8 -8
- package/dist/content-engine.js +543 -543
- package/dist/coverage.js +39 -39
- package/dist/docs-sync.js +98 -98
- package/dist/evaluation.js +452 -452
- package/dist/git-workflow.js +49 -49
- package/dist/index.js +75 -46
- package/dist/index.js.map +1 -1
- package/dist/instant-answer.js +10 -0
- package/dist/instant-answer.js.map +1 -1
- package/dist/modes.js +355 -355
- package/dist/orchestration.js +15 -15
- package/dist/pm2-manager.js +26 -26
- package/dist/prompt-buffer.d.ts +7 -0
- package/dist/prompt-buffer.js +31 -0
- package/dist/prompt-buffer.js.map +1 -1
- package/dist/query.d.ts +4 -0
- package/dist/query.js +79 -64
- package/dist/query.js.map +1 -1
- package/dist/refactor.js +87 -87
- package/dist/search-first.js +92 -92
- package/dist/session-picker.d.ts +44 -0
- package/dist/session-picker.js +227 -0
- package/dist/session-picker.js.map +1 -0
- package/dist/skill-create.js +100 -100
- package/dist/stitch.js +1 -1
- package/dist/swarm.d.ts +34 -54
- package/dist/swarm.js +175 -63
- package/dist/swarm.js.map +1 -1
- package/dist/system-prompt.js +10 -10
- package/dist/verification.js +55 -55
- package/dist/walkthrough.js +5 -5
- package/package.json +1 -1
- package/resources/__init__.py +1 -1
- package/resources/exgentic/cawdex_agent/README.md +114 -114
- package/resources/exgentic/cawdex_agent/__init__.py +5 -5
- package/resources/exgentic/cawdex_agent/agent.py +605 -605
- package/resources/exgentic/cawdex_agent/requirements.txt +2 -2
- package/resources/exgentic/cawdex_agent/setup.sh +21 -21
- package/resources/exgentic/cawdex_agent/utils.py +1061 -1061
- package/resources/hal/cawdex_agent/README.md +24 -24
- package/resources/hal/cawdex_agent/__init__.py +1 -1
- package/resources/hal/cawdex_agent/main.py +550 -550
- package/resources/hal/cawdex_agent/requirements.txt +2 -2
- package/resources/kbench/cawdex_agent/README.md +107 -107
- package/resources/kbench/cawdex_agent/adapter.manifest.json +19 -19
- package/resources/kbench/cawdex_agent/runner.mjs +753 -753
- package/resources/open_agent_leaderboard/cawdex-agent-card.md +119 -119
- package/resources/terminal_bench/__init__.py +1 -1
- package/resources/terminal_bench/cawdex_agent.py +174 -174
- package/resources/terminal_bench/setup.sh +121 -121
package/dist/search-first.js
CHANGED
|
@@ -176,45 +176,45 @@ export function buildSearchFirstPrompt(task, cwd) {
|
|
|
176
176
|
research += 'Found these related patterns in the codebase:\n';
|
|
177
177
|
research += relatedGreps.map((g) => `\`\`\`\n${g}\n\`\`\``).join('\n');
|
|
178
178
|
}
|
|
179
|
-
return `# Research-First Implementation
|
|
180
|
-
|
|
181
|
-
## Task
|
|
182
|
-
${task}
|
|
183
|
-
|
|
184
|
-
## Before Writing Code: Research Phase
|
|
185
|
-
|
|
186
|
-
Please follow this approach:
|
|
187
|
-
|
|
188
|
-
1. **Analyze existing patterns** in the codebase
|
|
189
|
-
- Look at similar functions and modules
|
|
190
|
-
- Understand how the project structures code
|
|
191
|
-
- Check for established patterns we should follow
|
|
192
|
-
|
|
193
|
-
2. **Review documentation and comments**
|
|
194
|
-
- Check relevant files for JSDoc and inline comments
|
|
195
|
-
- Look for design patterns in existing implementations
|
|
196
|
-
- Understand architectural decisions
|
|
197
|
-
|
|
198
|
-
3. **Identify applicable patterns**
|
|
199
|
-
- What patterns from existing code apply here?
|
|
200
|
-
- Are there similar functions we should model after?
|
|
201
|
-
- What conventions does this project follow?
|
|
202
|
-
|
|
203
|
-
4. **Reference existing code in your proposal**
|
|
204
|
-
- When proposing a solution, reference the existing code that informed it
|
|
205
|
-
- Explain how your implementation follows established patterns
|
|
206
|
-
- Point out if you're introducing a new pattern and why
|
|
207
|
-
|
|
208
|
-
## Current Codebase Research
|
|
209
|
-
${research || '(Run research to populate this section)'}
|
|
210
|
-
|
|
211
|
-
## Implementation Guidelines
|
|
212
|
-
- Follow the style and patterns of existing code
|
|
213
|
-
- Use the same import structure and module organization
|
|
214
|
-
- Match the error handling approach used elsewhere
|
|
215
|
-
- Maintain consistency with project conventions
|
|
216
|
-
- Reference specific files and functions that informed the design
|
|
217
|
-
|
|
179
|
+
return `# Research-First Implementation
|
|
180
|
+
|
|
181
|
+
## Task
|
|
182
|
+
${task}
|
|
183
|
+
|
|
184
|
+
## Before Writing Code: Research Phase
|
|
185
|
+
|
|
186
|
+
Please follow this approach:
|
|
187
|
+
|
|
188
|
+
1. **Analyze existing patterns** in the codebase
|
|
189
|
+
- Look at similar functions and modules
|
|
190
|
+
- Understand how the project structures code
|
|
191
|
+
- Check for established patterns we should follow
|
|
192
|
+
|
|
193
|
+
2. **Review documentation and comments**
|
|
194
|
+
- Check relevant files for JSDoc and inline comments
|
|
195
|
+
- Look for design patterns in existing implementations
|
|
196
|
+
- Understand architectural decisions
|
|
197
|
+
|
|
198
|
+
3. **Identify applicable patterns**
|
|
199
|
+
- What patterns from existing code apply here?
|
|
200
|
+
- Are there similar functions we should model after?
|
|
201
|
+
- What conventions does this project follow?
|
|
202
|
+
|
|
203
|
+
4. **Reference existing code in your proposal**
|
|
204
|
+
- When proposing a solution, reference the existing code that informed it
|
|
205
|
+
- Explain how your implementation follows established patterns
|
|
206
|
+
- Point out if you're introducing a new pattern and why
|
|
207
|
+
|
|
208
|
+
## Current Codebase Research
|
|
209
|
+
${research || '(Run research to populate this section)'}
|
|
210
|
+
|
|
211
|
+
## Implementation Guidelines
|
|
212
|
+
- Follow the style and patterns of existing code
|
|
213
|
+
- Use the same import structure and module organization
|
|
214
|
+
- Match the error handling approach used elsewhere
|
|
215
|
+
- Maintain consistency with project conventions
|
|
216
|
+
- Reference specific files and functions that informed the design
|
|
217
|
+
|
|
218
218
|
Now, please implement the task, but start by analyzing the codebase and then proposing your solution.`;
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
@@ -252,68 +252,68 @@ export function buildDocsLookupPrompt(query, cwd) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
return `# Documentation Lookup
|
|
256
|
-
|
|
257
|
-
## Query
|
|
258
|
-
${query}
|
|
259
|
-
|
|
260
|
-
## Research Results
|
|
261
|
-
|
|
262
|
-
### Step 1: Local Documentation
|
|
263
|
-
- Searched docs/ directory
|
|
264
|
-
- Searched README files
|
|
265
|
-
- Searched for configuration files
|
|
266
|
-
|
|
267
|
-
### Step 2: Code Comments & JSDoc
|
|
268
|
-
- Extracted JSDoc from relevant files
|
|
269
|
-
- Found inline documentation
|
|
270
|
-
- Checked for examples in tests
|
|
271
|
-
|
|
272
|
-
${docsContent || '(No documentation found - searching code patterns instead)'}
|
|
273
|
-
|
|
274
|
-
### Step 3: Code Patterns
|
|
255
|
+
return `# Documentation Lookup
|
|
256
|
+
|
|
257
|
+
## Query
|
|
258
|
+
${query}
|
|
259
|
+
|
|
260
|
+
## Research Results
|
|
261
|
+
|
|
262
|
+
### Step 1: Local Documentation
|
|
263
|
+
- Searched docs/ directory
|
|
264
|
+
- Searched README files
|
|
265
|
+
- Searched for configuration files
|
|
266
|
+
|
|
267
|
+
### Step 2: Code Comments & JSDoc
|
|
268
|
+
- Extracted JSDoc from relevant files
|
|
269
|
+
- Found inline documentation
|
|
270
|
+
- Checked for examples in tests
|
|
271
|
+
|
|
272
|
+
${docsContent || '(No documentation found - searching code patterns instead)'}
|
|
273
|
+
|
|
274
|
+
### Step 3: Code Patterns
|
|
275
275
|
${grepResults.length > 0
|
|
276
276
|
? 'Found these implementations:\n' +
|
|
277
277
|
grepResults.slice(0, 10).map((g) => `- ${g}`).join('\n')
|
|
278
|
-
: 'No specific patterns found'}
|
|
279
|
-
|
|
280
|
-
## Summary
|
|
281
|
-
Based on the documentation and code patterns found, here are the key findings:
|
|
282
|
-
|
|
283
|
-
1. **Documentation**: ${docFiles.length > 0 ? `Found ${docFiles.length} documentation files` : 'Limited documentation'}
|
|
284
|
-
2. **Code Examples**: ${grepResults.length > 0 ? `Found ${grepResults.length} related code snippets` : 'No examples'}
|
|
285
|
-
3. **Related Files**: ${findRelevantFiles(query, cwd).length} relevant source files
|
|
286
|
-
|
|
278
|
+
: 'No specific patterns found'}
|
|
279
|
+
|
|
280
|
+
## Summary
|
|
281
|
+
Based on the documentation and code patterns found, here are the key findings:
|
|
282
|
+
|
|
283
|
+
1. **Documentation**: ${docFiles.length > 0 ? `Found ${docFiles.length} documentation files` : 'Limited documentation'}
|
|
284
|
+
2. **Code Examples**: ${grepResults.length > 0 ? `Found ${grepResults.length} related code snippets` : 'No examples'}
|
|
285
|
+
3. **Related Files**: ${findRelevantFiles(query, cwd).length} relevant source files
|
|
286
|
+
|
|
287
287
|
Please use these findings to answer the query.`;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* Build a prompt for source-grounded external research before implementation.
|
|
291
291
|
*/
|
|
292
292
|
export function buildSourceResearchPrompt(topic) {
|
|
293
|
-
return `# Source-Grounded Research Brief
|
|
294
|
-
|
|
295
|
-
## Topic
|
|
296
|
-
${topic}
|
|
297
|
-
|
|
298
|
-
Use the \`research_sources\` tool before answering. Query at least:
|
|
299
|
-
- \`source:"arxiv"\`, \`recent_days:90\`, \`format:"json"\` for recent papers and methods
|
|
300
|
-
- \`source:"github"\`, \`github_kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for repos, issues, PRs, and code patterns
|
|
301
|
-
- \`source:"huggingface"\`, \`kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for papers, models, and datasets
|
|
302
|
-
- \`source:"kaggle"\`, \`kaggle_kind:"both"\`, \`format:"json"\` for datasets and competitions
|
|
303
|
-
|
|
304
|
-
After the GitHub pass, call \`github_repo_digest\` on one or two directly relevant public GitHub repos when the topic is about agent/harness implementation, benchmark strategy, or source-code patterns. Use the digest's manifests, likely commands, and component surface signals as evidence; do not infer implementation details from repo popularity alone.
|
|
305
|
-
For Terminal-Bench public-agent comparisons, call \`benchmark_repo_catalog\` first so known public leaderboard repos are not missed.
|
|
306
|
-
|
|
307
|
-
Then synthesize a brief with:
|
|
308
|
-
1. The strongest current ideas or artifacts relevant to the topic.
|
|
309
|
-
2. What is directly applicable to this codebase.
|
|
310
|
-
3. Compatibility or operational risks.
|
|
311
|
-
4. A concrete implementation plan with verification steps.
|
|
312
|
-
|
|
313
|
-
Rules:
|
|
314
|
-
- Cite URLs returned by the tool.
|
|
315
|
-
- Prefer recent and maintained sources over stale popularity.
|
|
316
|
-
- Do not invent papers, repos, datasets, or benchmark claims.
|
|
293
|
+
return `# Source-Grounded Research Brief
|
|
294
|
+
|
|
295
|
+
## Topic
|
|
296
|
+
${topic}
|
|
297
|
+
|
|
298
|
+
Use the \`research_sources\` tool before answering. Query at least:
|
|
299
|
+
- \`source:"arxiv"\`, \`recent_days:90\`, \`format:"json"\` for recent papers and methods
|
|
300
|
+
- \`source:"github"\`, \`github_kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for repos, issues, PRs, and code patterns
|
|
301
|
+
- \`source:"huggingface"\`, \`kind:"all"\`, \`recent_days:90\`, \`format:"json"\` for papers, models, and datasets
|
|
302
|
+
- \`source:"kaggle"\`, \`kaggle_kind:"both"\`, \`format:"json"\` for datasets and competitions
|
|
303
|
+
|
|
304
|
+
After the GitHub pass, call \`github_repo_digest\` on one or two directly relevant public GitHub repos when the topic is about agent/harness implementation, benchmark strategy, or source-code patterns. Use the digest's manifests, likely commands, and component surface signals as evidence; do not infer implementation details from repo popularity alone.
|
|
305
|
+
For Terminal-Bench public-agent comparisons, call \`benchmark_repo_catalog\` first so known public leaderboard repos are not missed.
|
|
306
|
+
|
|
307
|
+
Then synthesize a brief with:
|
|
308
|
+
1. The strongest current ideas or artifacts relevant to the topic.
|
|
309
|
+
2. What is directly applicable to this codebase.
|
|
310
|
+
3. Compatibility or operational risks.
|
|
311
|
+
4. A concrete implementation plan with verification steps.
|
|
312
|
+
|
|
313
|
+
Rules:
|
|
314
|
+
- Cite URLs returned by the tool.
|
|
315
|
+
- Prefer recent and maintained sources over stale popularity.
|
|
316
|
+
- Do not invent papers, repos, datasets, or benchmark claims.
|
|
317
317
|
- If a source fails, say which one failed and continue with the others.`;
|
|
318
318
|
}
|
|
319
319
|
/**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Session } from './sessions.js';
|
|
2
|
+
export type SessionSummary = Pick<Session, 'id' | 'name' | 'cwd' | 'model' | 'createdAt' | 'updatedAt' | 'turnCount'>;
|
|
3
|
+
export interface SessionPickerState {
|
|
4
|
+
filter: string;
|
|
5
|
+
selected: number;
|
|
6
|
+
}
|
|
7
|
+
export type SessionPickerInput = {
|
|
8
|
+
type: 'accept';
|
|
9
|
+
} | {
|
|
10
|
+
type: 'cancel';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'backspace';
|
|
13
|
+
} | {
|
|
14
|
+
type: 'move';
|
|
15
|
+
delta: number;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'jump';
|
|
18
|
+
target: 'start' | 'end';
|
|
19
|
+
} | {
|
|
20
|
+
type: 'append';
|
|
21
|
+
text: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'ignore';
|
|
24
|
+
};
|
|
25
|
+
export declare function formatSessionPickerLine(session: SessionSummary): string;
|
|
26
|
+
export declare function sessionPickerSearchText(session: SessionSummary): string;
|
|
27
|
+
export declare function filterSessionPickerItems(sessions: SessionSummary[], filter: string): SessionSummary[];
|
|
28
|
+
export declare function maxVisibleSessionRows(termRows?: number): number;
|
|
29
|
+
export declare function visibleSessionPickerWindow<T>(items: T[], selected: number, maxRows: number): {
|
|
30
|
+
items: T[];
|
|
31
|
+
startIdx: number;
|
|
32
|
+
endIdx: number;
|
|
33
|
+
};
|
|
34
|
+
export declare function parseSessionPickerInput(buf: Buffer): SessionPickerInput;
|
|
35
|
+
export declare function applySessionPickerInput(state: SessionPickerState, input: SessionPickerInput, visibleCount: number): {
|
|
36
|
+
state: SessionPickerState;
|
|
37
|
+
accepted?: boolean;
|
|
38
|
+
cancelled?: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare function eraseSessionPickerRows(rowCount: number): string;
|
|
41
|
+
export declare function pickSession(sessions: SessionSummary[], opts?: {
|
|
42
|
+
title?: string;
|
|
43
|
+
initialFilter?: string;
|
|
44
|
+
}): Promise<string | null>;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { stdin, stdout } from 'node:process';
|
|
2
|
+
import { theme, sym } from './theme.js';
|
|
3
|
+
export function formatSessionPickerLine(session) {
|
|
4
|
+
const updated = session.updatedAt ? session.updatedAt.slice(0, 16).replace('T', ' ') : 'unknown';
|
|
5
|
+
const turns = `${session.turnCount ?? 0} ${(session.turnCount ?? 0) === 1 ? 'turn' : 'turns'}`;
|
|
6
|
+
return `${session.name || '(untitled)'} ${turns} ${session.model || 'unknown model'} ${updated}`;
|
|
7
|
+
}
|
|
8
|
+
export function sessionPickerSearchText(session) {
|
|
9
|
+
return [
|
|
10
|
+
session.id,
|
|
11
|
+
session.name,
|
|
12
|
+
session.cwd,
|
|
13
|
+
session.model,
|
|
14
|
+
session.createdAt,
|
|
15
|
+
session.updatedAt,
|
|
16
|
+
String(session.turnCount ?? ''),
|
|
17
|
+
].join(' ').toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
export function filterSessionPickerItems(sessions, filter) {
|
|
20
|
+
const query = filter.trim().toLowerCase();
|
|
21
|
+
if (!query)
|
|
22
|
+
return sessions;
|
|
23
|
+
const terms = query.split(/\s+/).filter(Boolean);
|
|
24
|
+
return sessions.filter((session) => {
|
|
25
|
+
const text = sessionPickerSearchText(session);
|
|
26
|
+
return terms.every((term) => text.includes(term));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function maxVisibleSessionRows(termRows = stdout.rows || 24) {
|
|
30
|
+
const rows = Number.isFinite(termRows) ? Math.max(6, Math.floor(termRows)) : 24;
|
|
31
|
+
return Math.max(3, Math.min(8, Math.floor(rows / 2) - 3));
|
|
32
|
+
}
|
|
33
|
+
export function visibleSessionPickerWindow(items, selected, maxRows) {
|
|
34
|
+
const rows = Math.max(1, Math.floor(maxRows));
|
|
35
|
+
if (items.length <= rows)
|
|
36
|
+
return { items, startIdx: 0, endIdx: items.length };
|
|
37
|
+
const clamped = Math.max(0, Math.min(items.length - 1, selected));
|
|
38
|
+
let startIdx = clamped - Math.floor(rows / 2);
|
|
39
|
+
startIdx = Math.max(0, Math.min(items.length - rows, startIdx));
|
|
40
|
+
const endIdx = Math.min(items.length, startIdx + rows);
|
|
41
|
+
return { items: items.slice(startIdx, endIdx), startIdx, endIdx };
|
|
42
|
+
}
|
|
43
|
+
export function parseSessionPickerInput(buf) {
|
|
44
|
+
if (buf.length === 0)
|
|
45
|
+
return { type: 'ignore' };
|
|
46
|
+
if (buf.length === 1 && buf[0] === 0x03)
|
|
47
|
+
return { type: 'cancel' };
|
|
48
|
+
if (buf.length === 1 && buf[0] === 0x1B)
|
|
49
|
+
return { type: 'cancel' };
|
|
50
|
+
if (buf.length === 1 && (buf[0] === 0x0D || buf[0] === 0x0A))
|
|
51
|
+
return { type: 'accept' };
|
|
52
|
+
if (buf.length === 1 && (buf[0] === 0x7F || buf[0] === 0x08))
|
|
53
|
+
return { type: 'backspace' };
|
|
54
|
+
if (buf.length >= 3 && buf[0] === 0x1B && buf[1] === 0x5B) {
|
|
55
|
+
const code = buf[2];
|
|
56
|
+
if (code === 0x41)
|
|
57
|
+
return { type: 'move', delta: -1 };
|
|
58
|
+
if (code === 0x42)
|
|
59
|
+
return { type: 'move', delta: 1 };
|
|
60
|
+
if (code === 0x48)
|
|
61
|
+
return { type: 'jump', target: 'start' };
|
|
62
|
+
if (code === 0x46)
|
|
63
|
+
return { type: 'jump', target: 'end' };
|
|
64
|
+
if (buf.length >= 4 && (code === 0x35 || code === 0x36) && buf[3] === 0x7E) {
|
|
65
|
+
return { type: 'move', delta: code === 0x35 ? -5 : 5 };
|
|
66
|
+
}
|
|
67
|
+
return { type: 'ignore' };
|
|
68
|
+
}
|
|
69
|
+
let text = '';
|
|
70
|
+
for (const byte of buf) {
|
|
71
|
+
if (byte >= 0x20 && byte < 0x7F)
|
|
72
|
+
text += String.fromCharCode(byte);
|
|
73
|
+
}
|
|
74
|
+
return text ? { type: 'append', text } : { type: 'ignore' };
|
|
75
|
+
}
|
|
76
|
+
export function applySessionPickerInput(state, input, visibleCount) {
|
|
77
|
+
if (input.type === 'cancel')
|
|
78
|
+
return { state, cancelled: true };
|
|
79
|
+
if (input.type === 'accept')
|
|
80
|
+
return { state, accepted: visibleCount > 0 };
|
|
81
|
+
if (input.type === 'backspace') {
|
|
82
|
+
return {
|
|
83
|
+
state: {
|
|
84
|
+
filter: state.filter.slice(0, -1),
|
|
85
|
+
selected: 0,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (input.type === 'append') {
|
|
90
|
+
return {
|
|
91
|
+
state: {
|
|
92
|
+
filter: state.filter + input.text,
|
|
93
|
+
selected: 0,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (input.type === 'jump') {
|
|
98
|
+
return {
|
|
99
|
+
state: {
|
|
100
|
+
filter: state.filter,
|
|
101
|
+
selected: input.target === 'start' ? 0 : Math.max(0, visibleCount - 1),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (input.type === 'move' && visibleCount > 0) {
|
|
106
|
+
return {
|
|
107
|
+
state: {
|
|
108
|
+
filter: state.filter,
|
|
109
|
+
selected: Math.max(0, Math.min(visibleCount - 1, state.selected + input.delta)),
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return { state };
|
|
114
|
+
}
|
|
115
|
+
export function eraseSessionPickerRows(rowCount) {
|
|
116
|
+
if (rowCount <= 0)
|
|
117
|
+
return '';
|
|
118
|
+
const parts = [];
|
|
119
|
+
for (let i = 0; i < rowCount; i++) {
|
|
120
|
+
parts.push('\r\x1b[2K');
|
|
121
|
+
if (i < rowCount - 1)
|
|
122
|
+
parts.push('\x1b[1A');
|
|
123
|
+
}
|
|
124
|
+
return parts.join('');
|
|
125
|
+
}
|
|
126
|
+
function clip(text, max) {
|
|
127
|
+
if (text.length <= max)
|
|
128
|
+
return text;
|
|
129
|
+
if (max <= 1)
|
|
130
|
+
return text.slice(0, max);
|
|
131
|
+
return text.slice(0, max - 1) + '…';
|
|
132
|
+
}
|
|
133
|
+
export async function pickSession(sessions, opts = {}) {
|
|
134
|
+
if (sessions.length === 0)
|
|
135
|
+
return null;
|
|
136
|
+
return new Promise((resolve) => {
|
|
137
|
+
let state = { filter: opts.initialFilter ?? '', selected: 0 };
|
|
138
|
+
let renderedRows = 0;
|
|
139
|
+
const wasRaw = stdin.isRaw;
|
|
140
|
+
const dataListeners = stdin.listeners('data').slice();
|
|
141
|
+
for (const listener of dataListeners)
|
|
142
|
+
stdin.removeListener('data', listener);
|
|
143
|
+
const allKeypress = stdin.listeners('keypress').slice();
|
|
144
|
+
const togglable = allKeypress.filter((listener) => !listener.__cawdexHotkey__);
|
|
145
|
+
for (const listener of togglable)
|
|
146
|
+
stdin.removeListener('keypress', listener);
|
|
147
|
+
try {
|
|
148
|
+
stdin.setRawMode(true);
|
|
149
|
+
}
|
|
150
|
+
catch { /* noop */ }
|
|
151
|
+
stdin.resume();
|
|
152
|
+
function visible() {
|
|
153
|
+
return filterSessionPickerItems(sessions, state.filter);
|
|
154
|
+
}
|
|
155
|
+
function cleanup() {
|
|
156
|
+
stdin.removeListener('data', onData);
|
|
157
|
+
for (const listener of dataListeners) {
|
|
158
|
+
if (!stdin.listeners('data').includes(listener))
|
|
159
|
+
stdin.on('data', listener);
|
|
160
|
+
}
|
|
161
|
+
for (const listener of togglable)
|
|
162
|
+
stdin.on('keypress', listener);
|
|
163
|
+
try {
|
|
164
|
+
stdin.setRawMode(wasRaw);
|
|
165
|
+
}
|
|
166
|
+
catch { /* noop */ }
|
|
167
|
+
stdout.write(eraseSessionPickerRows(renderedRows));
|
|
168
|
+
renderedRows = 0;
|
|
169
|
+
}
|
|
170
|
+
function render() {
|
|
171
|
+
const items = visible();
|
|
172
|
+
if (state.selected >= items.length)
|
|
173
|
+
state.selected = Math.max(0, items.length - 1);
|
|
174
|
+
if (state.selected < 0)
|
|
175
|
+
state.selected = 0;
|
|
176
|
+
stdout.write(eraseSessionPickerRows(renderedRows));
|
|
177
|
+
const cols = Math.max(40, stdout.columns || 100);
|
|
178
|
+
const maxRows = maxVisibleSessionRows(stdout.rows || 24);
|
|
179
|
+
const win = visibleSessionPickerWindow(items, state.selected, maxRows);
|
|
180
|
+
const rows = [];
|
|
181
|
+
rows.push(theme.header(` ${opts.title ?? 'Resume Session'}`));
|
|
182
|
+
rows.push(theme.dim(` filter: `) + theme.primary(state.filter || '(type to narrow)'));
|
|
183
|
+
if (win.items.length === 0) {
|
|
184
|
+
rows.push(theme.dim(' (no matches - Backspace to clear, Esc to cancel)'));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
for (let i = 0; i < win.items.length; i++) {
|
|
188
|
+
const session = win.items[i];
|
|
189
|
+
const itemIndex = win.startIdx + i;
|
|
190
|
+
const selected = itemIndex === state.selected;
|
|
191
|
+
const prefix = selected ? theme.selection(' > ') : theme.syntaxPunctuation(' ');
|
|
192
|
+
const id = theme.syntaxCommand(clip(session.id, 18).padEnd(18));
|
|
193
|
+
const line = clip(formatSessionPickerLine(session), Math.max(20, cols - 26));
|
|
194
|
+
rows.push(prefix + id + ' ' + (selected ? theme.bright(line) : theme.dim(line)));
|
|
195
|
+
rows.push(theme.syntaxPunctuation(' ') + theme.muted(clip(session.cwd || '', Math.max(20, cols - 6))));
|
|
196
|
+
}
|
|
197
|
+
if (items.length > win.items.length) {
|
|
198
|
+
rows.push(theme.dim(` ${win.startIdx + 1}-${win.endIdx}/${items.length} ${sym.arrow} PgUp/PgDn scroll`));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
rows.push(theme.dim(` ${items.length}/${sessions.length} sessions • ↑↓ move • Enter resume • Esc cancel`));
|
|
202
|
+
stdout.write(rows.join('\n'));
|
|
203
|
+
renderedRows = rows.length;
|
|
204
|
+
}
|
|
205
|
+
function onData(buf) {
|
|
206
|
+
const items = visible();
|
|
207
|
+
const input = parseSessionPickerInput(buf);
|
|
208
|
+
const next = applySessionPickerInput(state, input, items.length);
|
|
209
|
+
state = next.state;
|
|
210
|
+
if (next.cancelled) {
|
|
211
|
+
cleanup();
|
|
212
|
+
resolve(null);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (next.accepted) {
|
|
216
|
+
const chosen = visible()[state.selected];
|
|
217
|
+
cleanup();
|
|
218
|
+
resolve(chosen?.id ?? null);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
render();
|
|
222
|
+
}
|
|
223
|
+
stdin.on('data', onData);
|
|
224
|
+
render();
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=session-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-picker.js","sourceRoot":"","sources":["../src/session-picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAqBxC,MAAM,UAAU,uBAAuB,CAAC,OAAuB;IAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjG,MAAM,KAAK,GAAG,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,IA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