@causyne/agent 1.20.65 → 1.20.69
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/package.json +1 -1
- package/src/agentLoop.js +49 -26
- package/src/agentLoop.ts +49 -26
- package/src/browser/causyneBrowser.js +1 -1
- package/src/browser/causyneBrowser.ts +1 -1
- package/src/cliMode.js +68 -11
- package/src/commands.js +46 -19
- package/src/contextManager.js +1 -1
- package/src/continuum/ui/continuumPicker.js +1 -1
- package/src/continuum/ui/continuumPicker.ts +1 -1
- package/src/embodimentSession.js +1 -1
- package/src/planCache.js +1 -1
- package/src/planCache.ts +1 -1
- package/src/promptMentions.js +7 -7
- package/src/promptMentions.ts +7 -7
- package/src/providers/antigravity.js +52 -12
- package/src/providers/antigravity.ts +47 -16
- package/src/providers/dashscope-byok.js +1 -1
- package/src/providers/qwen-byok.js +1 -1
- package/src/skillsManager.d.ts +4 -1
- package/src/tokenTracker.js +1 -1
- package/src/tokenTracker.ts +1 -1
- package/src/tool-scripts/ax_snapshot.ps1 +10 -10
- package/src/tools/fsList.js +1 -1
- package/src/tools/memoryWrite.js +1 -1
- package/src/tools/memoryWrite.ts +1 -1
- package/src/tui/chatRenderer.js +3 -2
- package/src/tui/codeStreamRenderer.js +8 -5
- package/src/tui/codeStreamRenderer.ts +10 -5
- package/src/tui/consoleGuard.js +15 -0
- package/src/tui/consoleGuard.ts +15 -0
- package/src/tui/lineEditor.js +14 -21
- package/src/tui/modelPicker.js +1 -1
- package/src/tui/modelPicker.ts +1 -1
- package/src/tui/prompt.js +41 -13
- package/src/tui/sessionPicker.js +1 -1
- package/src/tui/sessionPicker.ts +1 -1
- package/src/tui/sessionSidebar.js +13 -0
- package/src/tui/sessionSidebar.ts +15 -0
- package/src/tui/skillAuthoring.js +147 -0
- package/src/tui/skillAuthoring.ts +172 -0
- package/src/tui/stage.js +4 -2
- package/src/tui/stageSurface.js +43 -11
- package/src/tui/text.js +25 -2
- package/src/tui/text.ts +24 -2
- package/src/tui/theme.js +3 -0
- package/src/vfeTracker.js +1 -1
- package/src/vfeTracker.ts +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Add-Type -AssemblyName UIAutomationClient,UIAutomationTypes
|
|
2
|
-
$max = [int]$args[0]
|
|
3
|
-
$root = [System.Windows.Automation.AutomationElement]::RootElement
|
|
4
|
-
$cond = [System.Windows.Automation.Condition]::TrueCondition
|
|
5
|
-
$n = 0
|
|
6
|
-
foreach ($e in $root.FindAll([System.Windows.Automation.TreeScope]::Descendants, $cond)) {
|
|
7
|
-
if ($n -ge $max) { break }
|
|
8
|
-
$name = $e.Current.Name
|
|
9
|
-
if ($name) { Write-Output ("" + $e.Current.ControlType.ProgrammaticName + "|" + $name + "|"); $n++ }
|
|
10
|
-
}
|
|
1
|
+
Add-Type -AssemblyName UIAutomationClient,UIAutomationTypes
|
|
2
|
+
$max = [int]$args[0]
|
|
3
|
+
$root = [System.Windows.Automation.AutomationElement]::RootElement
|
|
4
|
+
$cond = [System.Windows.Automation.Condition]::TrueCondition
|
|
5
|
+
$n = 0
|
|
6
|
+
foreach ($e in $root.FindAll([System.Windows.Automation.TreeScope]::Descendants, $cond)) {
|
|
7
|
+
if ($n -ge $max) { break }
|
|
8
|
+
$name = $e.Current.Name
|
|
9
|
+
if ($name) { Write-Output ("" + $e.Current.ControlType.ProgrammaticName + "|" + $name + "|"); $n++ }
|
|
10
|
+
}
|
package/src/tools/fsList.js
CHANGED
|
@@ -67,7 +67,7 @@ export const fsList = {
|
|
|
67
67
|
const maxDepth = args.depth || 2;
|
|
68
68
|
|
|
69
69
|
const tree = await generateTree(target, 1, maxDepth);
|
|
70
|
-
const header =
|
|
70
|
+
const header = `${target}\n`;
|
|
71
71
|
|
|
72
72
|
return { success: true, output: header + (tree || ' (Empty or access denied)') };
|
|
73
73
|
} catch (e) {
|
package/src/tools/memoryWrite.js
CHANGED
|
@@ -71,7 +71,7 @@ export const memoryWrite = {
|
|
|
71
71
|
if (dependencies && typeof dependencies.broadcast === 'function') {
|
|
72
72
|
dependencies.broadcast({
|
|
73
73
|
type: 'agent_message',
|
|
74
|
-
content:
|
|
74
|
+
content: `◆ Persistent memory updated: "${fact}"`
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
const notes = [
|
package/src/tools/memoryWrite.ts
CHANGED
|
@@ -98,7 +98,7 @@ export const memoryWrite = {
|
|
|
98
98
|
if (dependencies && typeof dependencies.broadcast === 'function') {
|
|
99
99
|
dependencies.broadcast({
|
|
100
100
|
type: 'agent_message',
|
|
101
|
-
content:
|
|
101
|
+
content: `◆ Persistent memory updated: "${fact}"`
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
|
package/src/tui/chatRenderer.js
CHANGED
|
@@ -1219,8 +1219,9 @@ export class ChatRenderer {
|
|
|
1219
1219
|
// single write put the continuation lines at column 0, under a marker
|
|
1220
1220
|
// indented five columns, so the whole block read as unrelated fragments.
|
|
1221
1221
|
const label = `${msg.tool || ''}`.trim();
|
|
1222
|
-
const
|
|
1223
|
-
const
|
|
1222
|
+
const rawError = msg.error || (msg.result && (msg.result.error || msg.result.message)) || '';
|
|
1223
|
+
const detail = safeDisplay(`${rawError}`.trim());
|
|
1224
|
+
const head = label && detail ? `${label} ${detail}` : (detail || label || 'failed');
|
|
1224
1225
|
|
|
1225
1226
|
this.frame('error', () => {
|
|
1226
1227
|
const rows = wrapBlock(head, Math.max(20, this.width() - 7), { hang: 0 });
|
|
@@ -35,15 +35,18 @@ export class CodeStreamRenderer extends ChatRenderer {
|
|
|
35
35
|
const transcript = this.transcript;
|
|
36
36
|
if (!transcript || !Array.isArray(transcript.frames))
|
|
37
37
|
return;
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
38
|
+
const activeFrame = transcript.frames.findLast((f) => f?.meta?.reasoning === true && f.meta?.streaming === true);
|
|
39
|
+
if (activeFrame && activeFrame.meta) {
|
|
40
40
|
if (nowMs > 0) {
|
|
41
|
-
|
|
41
|
+
activeFrame.meta.durationText = formatElapsed(nowMs);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
activeFrame.rows = null;
|
|
44
|
+
activeFrame.renderedWidth = -1;
|
|
45
45
|
transcript.cache = null;
|
|
46
46
|
transcript.revision++;
|
|
47
|
+
if (typeof transcript.changed === 'function') {
|
|
48
|
+
transcript.changed();
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
renderReasoning(content, options = {}) {
|
|
@@ -61,15 +61,20 @@ export class CodeStreamRenderer extends ChatRenderer {
|
|
|
61
61
|
this.streamingTick = tick;
|
|
62
62
|
const transcript = this.transcript as unknown as CodeTranscript | null;
|
|
63
63
|
if (!transcript || !Array.isArray(transcript.frames)) return;
|
|
64
|
-
const
|
|
65
|
-
|
|
64
|
+
const activeFrame = transcript.frames.findLast(
|
|
65
|
+
(f: CodeFrame) => f?.meta?.reasoning === true && f.meta?.streaming === true
|
|
66
|
+
);
|
|
67
|
+
if (activeFrame && activeFrame.meta) {
|
|
66
68
|
if (nowMs > 0) {
|
|
67
|
-
|
|
69
|
+
activeFrame.meta.durationText = formatElapsed(nowMs);
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
activeFrame.rows = null;
|
|
72
|
+
activeFrame.renderedWidth = -1;
|
|
71
73
|
transcript.cache = null;
|
|
72
74
|
transcript.revision++;
|
|
75
|
+
if (typeof transcript.changed === 'function') {
|
|
76
|
+
transcript.changed();
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
|
package/src/tui/consoleGuard.js
CHANGED
|
@@ -7,6 +7,9 @@ const originalConsole = {
|
|
|
7
7
|
warn: console.warn.bind(console),
|
|
8
8
|
error: console.error.bind(console)
|
|
9
9
|
};
|
|
10
|
+
const originalStderrWrite = process.stderr?.write
|
|
11
|
+
? process.stderr.write.bind(process.stderr)
|
|
12
|
+
: null;
|
|
10
13
|
export function isAnyStageReservedOnStdout() {
|
|
11
14
|
if (stageMouseSessionDepth > 0 && process.stdout?.isTTY) {
|
|
12
15
|
return true;
|
|
@@ -35,6 +38,18 @@ function ensureConsoleGuardInstalled() {
|
|
|
35
38
|
console.info = wrap(originalConsole.info);
|
|
36
39
|
console.warn = wrap(originalConsole.warn);
|
|
37
40
|
console.error = wrap(originalConsole.error);
|
|
41
|
+
if (originalStderrWrite && process.stderr) {
|
|
42
|
+
process.stderr.write = ((chunk, encodingOrCb, cb) => {
|
|
43
|
+
if (isAnyStageReservedOnStdout()) {
|
|
44
|
+
if (typeof encodingOrCb === 'function')
|
|
45
|
+
encodingOrCb();
|
|
46
|
+
else if (typeof cb === 'function')
|
|
47
|
+
cb();
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return originalStderrWrite(chunk, encodingOrCb, cb);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
38
53
|
}
|
|
39
54
|
/**
|
|
40
55
|
* Track TUI Stage open/close lifecycle so raw console writes cannot corrupt the composer box.
|
package/src/tui/consoleGuard.ts
CHANGED
|
@@ -19,6 +19,10 @@ const originalConsole = {
|
|
|
19
19
|
error: console.error.bind(console)
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
const originalStderrWrite = process.stderr?.write
|
|
23
|
+
? process.stderr.write.bind(process.stderr)
|
|
24
|
+
: null;
|
|
25
|
+
|
|
22
26
|
export function isAnyStageReservedOnStdout(): boolean {
|
|
23
27
|
if (stageMouseSessionDepth > 0 && process.stdout?.isTTY) {
|
|
24
28
|
return true;
|
|
@@ -49,6 +53,17 @@ function ensureConsoleGuardInstalled(): void {
|
|
|
49
53
|
console.info = wrap(originalConsole.info);
|
|
50
54
|
console.warn = wrap(originalConsole.warn);
|
|
51
55
|
console.error = wrap(originalConsole.error);
|
|
56
|
+
|
|
57
|
+
if (originalStderrWrite && process.stderr) {
|
|
58
|
+
process.stderr.write = ((chunk: unknown, encodingOrCb?: unknown, cb?: unknown): boolean => {
|
|
59
|
+
if (isAnyStageReservedOnStdout()) {
|
|
60
|
+
if (typeof encodingOrCb === 'function') (encodingOrCb as () => void)();
|
|
61
|
+
else if (typeof cb === 'function') (cb as () => void)();
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return (originalStderrWrite as (...a: unknown[]) => boolean)(chunk, encodingOrCb, cb);
|
|
65
|
+
}) as typeof process.stderr.write;
|
|
66
|
+
}
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
/**
|
package/src/tui/lineEditor.js
CHANGED
|
@@ -374,12 +374,14 @@ export class LineEditor {
|
|
|
374
374
|
|
|
375
375
|
let pos = 0;
|
|
376
376
|
while (pos <= line.length) {
|
|
377
|
-
if (
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
377
|
+
if (pos === line.length) {
|
|
378
|
+
if (isCurrentLine && pos === this.col && !placed) {
|
|
379
|
+
cursorRow = rows.length;
|
|
380
|
+
cursorCol = prefixWidth + used;
|
|
381
|
+
placed = true;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
381
384
|
}
|
|
382
|
-
if (pos === line.length) break;
|
|
383
385
|
|
|
384
386
|
const isSpace = /\s/.test(line[pos]);
|
|
385
387
|
let nextPos = pos;
|
|
@@ -389,24 +391,14 @@ export class LineEditor {
|
|
|
389
391
|
nextPos++;
|
|
390
392
|
}
|
|
391
393
|
|
|
392
|
-
// If non-whitespace word exceeds remaining space on non-empty line: wrap to next line!
|
|
394
|
+
// If non-whitespace word exceeds remaining space on non-empty line: wrap to next line first!
|
|
393
395
|
if (used > 0 && used + tokenWidth > budget && !isSpace) {
|
|
394
396
|
rows.push(row);
|
|
395
397
|
row = prefix;
|
|
396
398
|
used = 0;
|
|
397
|
-
if (isCurrentLine && pos === this.col && !placed) {
|
|
398
|
-
cursorRow = rows.length;
|
|
399
|
-
cursorCol = prefixWidth;
|
|
400
|
-
placed = true;
|
|
401
|
-
}
|
|
402
399
|
}
|
|
403
400
|
|
|
404
401
|
while (pos < nextPos) {
|
|
405
|
-
if (isCurrentLine && pos === this.col && !placed) {
|
|
406
|
-
cursorRow = rows.length;
|
|
407
|
-
cursorCol = prefixWidth + used;
|
|
408
|
-
placed = true;
|
|
409
|
-
}
|
|
410
402
|
const char = line[pos];
|
|
411
403
|
const charWidth = visibleWidth(char);
|
|
412
404
|
|
|
@@ -414,11 +406,12 @@ export class LineEditor {
|
|
|
414
406
|
rows.push(row);
|
|
415
407
|
row = prefix;
|
|
416
408
|
used = 0;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (isCurrentLine && pos === this.col && !placed) {
|
|
412
|
+
cursorRow = rows.length;
|
|
413
|
+
cursorCol = prefixWidth + used;
|
|
414
|
+
placed = true;
|
|
422
415
|
}
|
|
423
416
|
|
|
424
417
|
const isSelected = range ? isInsideRange(index, pos, range) : false;
|
package/src/tui/modelPicker.js
CHANGED
|
@@ -367,7 +367,7 @@ export async function runInteractiveModelPicker(prompt, store = { loadConfig, sa
|
|
|
367
367
|
// Case 1: ACP Peer Agent or Antigravity
|
|
368
368
|
if (target.type === 'acp') {
|
|
369
369
|
if (!target.installed) {
|
|
370
|
-
return (
|
|
370
|
+
return (`△ Notice: "${target.providerLabel}" is not installed on this machine.\n` +
|
|
371
371
|
`Setup: ${target.setupInstruction || 'Install the CLI binary.'}\n\n` +
|
|
372
372
|
`Model was not changed.`);
|
|
373
373
|
}
|
package/src/tui/modelPicker.ts
CHANGED
|
@@ -468,7 +468,7 @@ export async function runInteractiveModelPicker(
|
|
|
468
468
|
if (target.type === 'acp') {
|
|
469
469
|
if (!target.installed) {
|
|
470
470
|
return (
|
|
471
|
-
|
|
471
|
+
`△ Notice: "${target.providerLabel}" is not installed on this machine.\n` +
|
|
472
472
|
`Setup: ${target.setupInstruction || 'Install the CLI binary.'}\n\n` +
|
|
473
473
|
`Model was not changed.`
|
|
474
474
|
);
|
package/src/tui/prompt.js
CHANGED
|
@@ -138,7 +138,7 @@ export class ChatPrompt {
|
|
|
138
138
|
this.cursorRow = 0;
|
|
139
139
|
|
|
140
140
|
// The status row of the live region, and the clock that animates it.
|
|
141
|
-
this.renderer = null;
|
|
141
|
+
this.renderer = options.renderer || null;
|
|
142
142
|
this.statusMessage = '';
|
|
143
143
|
this.tick = 0;
|
|
144
144
|
this.tickTimer = null;
|
|
@@ -421,6 +421,13 @@ export class ChatPrompt {
|
|
|
421
421
|
const plan = this.renderer && Array.isArray(this.renderer.latestPlan) ? this.renderer.latestPlan : [];
|
|
422
422
|
if (plan.length === 0) return [];
|
|
423
423
|
const completed = plan.filter(item => item.status === 'completed').length;
|
|
424
|
+
const stageMax = this.surface?.stage?.maxHeight || this.out?.rows || 24;
|
|
425
|
+
if (stageMax < 22) {
|
|
426
|
+
const activeStep = plan.find(item => item.status === 'in_progress') || plan.find(item => item.status !== 'completed') || plan[0];
|
|
427
|
+
const stepText = activeStep ? (activeStep.text || activeStep.step || '') : '';
|
|
428
|
+
const summary = `${paint('accent', GLYPHS.skill || '✦')} ${bold('plan')} ${dim(`(${completed}/${plan.length})`)} ${dim('·')} ${truncate(safeDisplay(stepText), Math.max(8, width - 24), GLYPHS.ellipsis)}`;
|
|
429
|
+
return [summary, ''];
|
|
430
|
+
}
|
|
424
431
|
const rows = [`${bold(paint('accent', 'implementation plan'))} ${dim(`${completed}/${plan.length}`)}`];
|
|
425
432
|
const limit = Math.min(plan.length, 5);
|
|
426
433
|
for (const item of plan.slice(0, limit)) {
|
|
@@ -454,6 +461,7 @@ export class ChatPrompt {
|
|
|
454
461
|
openLayer(layer) {
|
|
455
462
|
this.closeLayer();
|
|
456
463
|
this.layer = layer;
|
|
464
|
+
if (this.surface?.stage) this.surface.stage.invalidate();
|
|
457
465
|
this.draw();
|
|
458
466
|
return layer;
|
|
459
467
|
}
|
|
@@ -466,6 +474,7 @@ export class ChatPrompt {
|
|
|
466
474
|
// is torn down without one would otherwise leave its promise pending forever
|
|
467
475
|
// and hang the turn.
|
|
468
476
|
if (typeof layer.answer === 'function') layer.answer(false);
|
|
477
|
+
if (this.surface?.stage) this.surface.stage.invalidate();
|
|
469
478
|
this.draw();
|
|
470
479
|
}
|
|
471
480
|
|
|
@@ -672,9 +681,30 @@ export class ChatPrompt {
|
|
|
672
681
|
// Reading
|
|
673
682
|
// -------------------------------------------------------------------------
|
|
674
683
|
|
|
684
|
+
/**
|
|
685
|
+
* Render submitted user message into the chat transcript.
|
|
686
|
+
*/
|
|
687
|
+
renderSubmittedUserMessage(text) {
|
|
688
|
+
if (this.surface?.homeInfo) this.surface.leaveHome();
|
|
689
|
+
if (this.renderer?.renderUserMessage) this.renderer.renderUserMessage(text);
|
|
690
|
+
else this.commit('user', (width) => {
|
|
691
|
+
const blockWidth = Math.max(8, width);
|
|
692
|
+
return barBlock(
|
|
693
|
+
wrapBlock(safeDisplay(text), Math.max(8, blockWidth - visibleWidth(GLYPHS.barHeavy || GLYPHS.bar) - GUTTER), { hang: 0 }),
|
|
694
|
+
{ width: blockWidth, role: 'user', filled: true, surface: 'surfaceHi' }
|
|
695
|
+
);
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
|
|
675
699
|
/** Next submitted line. Resolves immediately if one was queued while busy. */
|
|
676
700
|
read() {
|
|
677
|
-
if (this.queue.length > 0)
|
|
701
|
+
if (this.queue.length > 0) {
|
|
702
|
+
const text = this.queue.shift();
|
|
703
|
+
if (typeof text === 'string' && !this.isCommand(text)) {
|
|
704
|
+
this.renderSubmittedUserMessage(text);
|
|
705
|
+
}
|
|
706
|
+
return Promise.resolve(text);
|
|
707
|
+
}
|
|
678
708
|
return new Promise((resolve) => { this.waiter = resolve; });
|
|
679
709
|
}
|
|
680
710
|
|
|
@@ -720,6 +750,7 @@ export class ChatPrompt {
|
|
|
720
750
|
this.busy = busy;
|
|
721
751
|
resetTurnInterruptState(this, busy);
|
|
722
752
|
if (busy) this.startTick(); else this.stopTick();
|
|
753
|
+
if (this.surface?.stage) this.surface.stage.invalidate();
|
|
723
754
|
this.draw();
|
|
724
755
|
}
|
|
725
756
|
|
|
@@ -805,15 +836,9 @@ export class ChatPrompt {
|
|
|
805
836
|
}
|
|
806
837
|
|
|
807
838
|
// Render live submissions through the same path used when history reflows.
|
|
808
|
-
if (this.
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
const blockWidth = Math.max(8, width);
|
|
812
|
-
return barBlock(
|
|
813
|
-
wrapBlock(safeDisplay(text), Math.max(8, blockWidth - visibleWidth(GLYPHS.barHeavy || GLYPHS.bar) - GUTTER), { hang: 0 }),
|
|
814
|
-
{ width: blockWidth, role: 'user', filled: true, surface: 'surfaceHi' }
|
|
815
|
-
);
|
|
816
|
-
});
|
|
839
|
+
if (!this.isCommand(text)) {
|
|
840
|
+
this.renderSubmittedUserMessage(text);
|
|
841
|
+
}
|
|
817
842
|
const resolve = this.waiter;
|
|
818
843
|
this.waiter = null;
|
|
819
844
|
if (resolve) resolve(text);
|
|
@@ -916,7 +941,7 @@ export class ChatPrompt {
|
|
|
916
941
|
switch (key.name) {
|
|
917
942
|
case 'escape': return this.handleEscape();
|
|
918
943
|
case 'enter':
|
|
919
|
-
if (key.alt) { this.editor.newline(); return; }
|
|
944
|
+
if (key.alt || key.shift) { this.editor.newline(); return; }
|
|
920
945
|
return this.submit();
|
|
921
946
|
case 'tab':
|
|
922
947
|
if (key.shift) return;
|
|
@@ -1691,7 +1716,10 @@ export class ChatPrompt {
|
|
|
1691
1716
|
const inline = this.surface && !this.surface.homeInfo;
|
|
1692
1717
|
const availableWidth = inline ? sessionMainWidth(this.surface.width) : width;
|
|
1693
1718
|
const panelWidth = dialogWidth(availableWidth, this.layer.width || 64);
|
|
1694
|
-
const
|
|
1719
|
+
const stageMax = this.surface?.stage?.maxHeight || this.out?.rows || 24;
|
|
1720
|
+
const statusReserve = 2; // status row + margin
|
|
1721
|
+
const availableDialogRows = Math.max(4, stageMax - statusReserve);
|
|
1722
|
+
const maxHeight = dialogHeight(availableDialogRows, this.layer.preferredHeight());
|
|
1695
1723
|
const panel = panelRows(this.layer, panelWidth, maxHeight);
|
|
1696
1724
|
const status = this.statusRow(width);
|
|
1697
1725
|
const all = this.clampRows(panel.concat(status), width);
|
package/src/tui/sessionPicker.js
CHANGED
|
@@ -244,7 +244,7 @@ export async function runInteractiveSessionPicker(prompt, options = {}) {
|
|
|
244
244
|
}
|
|
245
245
|
if (!switched) {
|
|
246
246
|
cleanPrompt();
|
|
247
|
-
return
|
|
247
|
+
return `△ Could not switch to session "${targetId}". File may have been removed.`;
|
|
248
248
|
}
|
|
249
249
|
const historyMessages = options.loop?.memoryManager && typeof options.loop.memoryManager.loadHistory === 'function'
|
|
250
250
|
? options.loop.memoryManager.loadHistory()
|
package/src/tui/sessionPicker.ts
CHANGED
|
@@ -323,7 +323,7 @@ export async function runInteractiveSessionPicker(
|
|
|
323
323
|
|
|
324
324
|
if (!switched) {
|
|
325
325
|
cleanPrompt();
|
|
326
|
-
return
|
|
326
|
+
return `△ Could not switch to session "${targetId}". File may have been removed.`;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
const historyMessages = options.loop?.memoryManager && typeof options.loop.memoryManager.loadHistory === 'function'
|
|
@@ -61,6 +61,19 @@ export function sessionSidebarRows(facts, height) {
|
|
|
61
61
|
line();
|
|
62
62
|
styled(bold('Workspace'));
|
|
63
63
|
line(facts.cwd || 'Unknown');
|
|
64
|
+
if (facts.activeSkill) {
|
|
65
|
+
const raw = facts.activeSkill;
|
|
66
|
+
const skillId = typeof raw === 'string' ? raw : (raw.id || raw.name || '');
|
|
67
|
+
const skillDesc = typeof raw === 'object' && raw ? raw.description || '' : '';
|
|
68
|
+
if (skillId) {
|
|
69
|
+
line();
|
|
70
|
+
styled(bold('Active Skill'));
|
|
71
|
+
styled(paint('accent', `✦ ${truncate(skillId, inner - 4, '…')}`));
|
|
72
|
+
if (skillDesc) {
|
|
73
|
+
line(truncate(skillDesc, inner, '…'));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
64
77
|
if (facts.plan?.length) {
|
|
65
78
|
const completed = facts.plan.filter(item => item.status === 'completed').length;
|
|
66
79
|
line();
|
|
@@ -15,6 +15,7 @@ export interface SidebarFacts {
|
|
|
15
15
|
contextChars?: number;
|
|
16
16
|
contextLimit?: number;
|
|
17
17
|
plan?: Array<{ text?: string; step?: string; content?: string; status?: string }>;
|
|
18
|
+
activeSkill?: { id?: string; name?: string; domain?: string; description?: string } | string | null;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
/** A side panel is useful only when a readable conversation column remains. */
|
|
@@ -76,6 +77,20 @@ export function sessionSidebarRows(facts: SidebarFacts, height: number): string[
|
|
|
76
77
|
styled(bold('Workspace'));
|
|
77
78
|
line(facts.cwd || 'Unknown');
|
|
78
79
|
|
|
80
|
+
if (facts.activeSkill) {
|
|
81
|
+
const raw = facts.activeSkill;
|
|
82
|
+
const skillId = typeof raw === 'string' ? raw : (raw.id || raw.name || '');
|
|
83
|
+
const skillDesc = typeof raw === 'object' && raw ? raw.description || '' : '';
|
|
84
|
+
if (skillId) {
|
|
85
|
+
line();
|
|
86
|
+
styled(bold('Active Skill'));
|
|
87
|
+
styled(paint('accent', `✦ ${truncate(skillId, inner - 4, '…')}`));
|
|
88
|
+
if (skillDesc) {
|
|
89
|
+
line(truncate(skillDesc, inner, '…'));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
79
94
|
if (facts.plan?.length) {
|
|
80
95
|
const completed = facts.plan.filter(item => item.status === 'completed').length;
|
|
81
96
|
line();
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// @ts-expect-error userSkills.js is awaiting TypeScript migration.
|
|
2
|
+
import { writeUserSkill, validateSegment, skillTemplate } from '../userSkills.js';
|
|
3
|
+
import { invalidateUserSkills } from '../skillsManager.js';
|
|
4
|
+
// @ts-expect-error theme.js has no TypeScript declaration yet.
|
|
5
|
+
import { paint, bold, dim } from './theme.js';
|
|
6
|
+
// @ts-expect-error dialogs.js is awaiting TypeScript migration.
|
|
7
|
+
import { InputLayer, SelectLayer } from './dialogs.js';
|
|
8
|
+
const COMMON_DOMAINS = [
|
|
9
|
+
{ value: 'custom', label: 'custom', description: 'General project & personal workflow skills' },
|
|
10
|
+
{ value: 'engineering', label: 'engineering', description: 'Software architecture, refactoring & review' },
|
|
11
|
+
{ value: 'frontend', label: 'frontend', description: 'Web UI, CSS, React, components & layout' },
|
|
12
|
+
{ value: 'backend', label: 'backend', description: 'APIs, databases, server infrastructure' },
|
|
13
|
+
{ value: 'devops', label: 'devops', description: 'CI/CD, Docker, deployment & releases' },
|
|
14
|
+
{ value: 'testing', label: 'testing', description: 'Unit, integration & regression tests' },
|
|
15
|
+
{ value: 'mobile', label: 'mobile', description: 'Android, iOS, Flutter, React Native' },
|
|
16
|
+
{ value: '__other__', label: '+ Enter custom category...', description: 'Specify any category name' }
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Interactive wizard hosted on ChatPrompt to scaffold and create a new skill.
|
|
20
|
+
*/
|
|
21
|
+
export async function runInteractiveSkillWizard(prompt) {
|
|
22
|
+
// Step 1: Select or enter domain/category
|
|
23
|
+
const chosenDomain = await new Promise((resolve) => {
|
|
24
|
+
let resolved = false;
|
|
25
|
+
const finish = (val) => {
|
|
26
|
+
if (!resolved) {
|
|
27
|
+
resolved = true;
|
|
28
|
+
resolve(val);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const layer = new SelectLayer({
|
|
32
|
+
title: 'create skill · category',
|
|
33
|
+
placeholder: 'choose or type category',
|
|
34
|
+
items: COMMON_DOMAINS,
|
|
35
|
+
width: 72,
|
|
36
|
+
height: 14,
|
|
37
|
+
onPick: (item) => {
|
|
38
|
+
finish(item?.value || null);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
prompt.openLayer(layer);
|
|
42
|
+
});
|
|
43
|
+
if (!chosenDomain)
|
|
44
|
+
return null;
|
|
45
|
+
let domain = chosenDomain;
|
|
46
|
+
if (domain === '__other__') {
|
|
47
|
+
const customDomain = await new Promise((resolve) => {
|
|
48
|
+
let resolved = false;
|
|
49
|
+
const finish = (val) => {
|
|
50
|
+
if (!resolved) {
|
|
51
|
+
resolved = true;
|
|
52
|
+
resolve(val);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const layer = new InputLayer({
|
|
56
|
+
title: 'create skill · category name',
|
|
57
|
+
lines: ['Category / domain name (e.g. data, analytics, cloud, tools):'],
|
|
58
|
+
placeholder: 'category-name',
|
|
59
|
+
onSubmit: (val) => finish(val.trim().toLowerCase()),
|
|
60
|
+
onCancel: () => finish(null)
|
|
61
|
+
});
|
|
62
|
+
prompt.openLayer(layer);
|
|
63
|
+
});
|
|
64
|
+
if (!customDomain)
|
|
65
|
+
return null;
|
|
66
|
+
const err = validateSegment(customDomain, 'category');
|
|
67
|
+
if (err) {
|
|
68
|
+
if (typeof prompt.showText === 'function') {
|
|
69
|
+
prompt.showText('Invalid Category', err, { danger: true });
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
domain = customDomain;
|
|
74
|
+
}
|
|
75
|
+
// Step 2: Skill name
|
|
76
|
+
const skillName = await new Promise((resolve) => {
|
|
77
|
+
let resolved = false;
|
|
78
|
+
const finish = (val) => {
|
|
79
|
+
if (!resolved) {
|
|
80
|
+
resolved = true;
|
|
81
|
+
resolve(val);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const layer = new InputLayer({
|
|
85
|
+
title: 'create skill · name',
|
|
86
|
+
lines: [
|
|
87
|
+
`Category: ${paint('accent', domain)}`,
|
|
88
|
+
'Skill name (lowercase letters, numbers, hyphens — e.g. play-store-release, pr-review):'
|
|
89
|
+
],
|
|
90
|
+
placeholder: 'my-new-skill',
|
|
91
|
+
onSubmit: (val) => finish(val.trim().toLowerCase()),
|
|
92
|
+
onCancel: () => finish(null)
|
|
93
|
+
});
|
|
94
|
+
prompt.openLayer(layer);
|
|
95
|
+
});
|
|
96
|
+
if (!skillName)
|
|
97
|
+
return null;
|
|
98
|
+
const nameErr = validateSegment(skillName, 'skill name');
|
|
99
|
+
if (nameErr) {
|
|
100
|
+
if (typeof prompt.showText === 'function') {
|
|
101
|
+
prompt.showText('Invalid Skill Name', nameErr, { danger: true });
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
// Step 3: Skill description
|
|
106
|
+
const skillDesc = await new Promise((resolve) => {
|
|
107
|
+
let resolved = false;
|
|
108
|
+
const finish = (val) => {
|
|
109
|
+
if (!resolved) {
|
|
110
|
+
resolved = true;
|
|
111
|
+
resolve(val);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const layer = new InputLayer({
|
|
115
|
+
title: 'create skill · description',
|
|
116
|
+
lines: [
|
|
117
|
+
`Skill: ${paint('accent', `${domain}/${skillName}`)}`,
|
|
118
|
+
'Short description: what this skill does and when the agent should use it:'
|
|
119
|
+
],
|
|
120
|
+
placeholder: 'e.g. Prepares and validates Android app bundles for Google Play Store release.',
|
|
121
|
+
onSubmit: (val) => finish(val.trim()),
|
|
122
|
+
onCancel: () => finish(null)
|
|
123
|
+
});
|
|
124
|
+
prompt.openLayer(layer);
|
|
125
|
+
});
|
|
126
|
+
if (!skillDesc)
|
|
127
|
+
return null;
|
|
128
|
+
// Step 4: Write skill file
|
|
129
|
+
const content = skillTemplate(domain, skillName, skillDesc);
|
|
130
|
+
const written = writeUserSkill({ domain, name: skillName, content, overwrite: false });
|
|
131
|
+
if (!written.ok) {
|
|
132
|
+
if (typeof prompt.showText === 'function') {
|
|
133
|
+
prompt.showText('Skill Creation Failed', written.error || 'Failed to write skill file', { danger: true });
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
invalidateUserSkills();
|
|
138
|
+
return {
|
|
139
|
+
domain,
|
|
140
|
+
id: skillName,
|
|
141
|
+
name: skillName,
|
|
142
|
+
description: skillDesc,
|
|
143
|
+
content,
|
|
144
|
+
path: written.path,
|
|
145
|
+
source: 'user'
|
|
146
|
+
};
|
|
147
|
+
}
|