@causyne/agent 1.20.104 → 1.20.105
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/tui/sessionSidebar.js +25 -14
- package/src/tui/sessionSidebar.ts +22 -13
- package/src/tui/stageSurface.js +14 -8
package/package.json
CHANGED
|
@@ -7,18 +7,18 @@ export const SIDEBAR_WIDTH = 42;
|
|
|
7
7
|
// Narrow IDE terminals should prioritize the user's complete message over metadata.
|
|
8
8
|
export const SIDEBAR_THRESHOLD = 160;
|
|
9
9
|
/** A side panel is useful only when a readable conversation column remains. */
|
|
10
|
-
export function sidebarVisible(columns, home = false) {
|
|
11
|
-
if (
|
|
12
|
-
const setting = String(
|
|
10
|
+
export function sidebarVisible(columns, home = false, env = typeof process !== 'undefined' ? process.env : {}) {
|
|
11
|
+
if (env) {
|
|
12
|
+
const setting = String(env.CAUSYNE_SIDEBAR ?? '').trim().toLowerCase();
|
|
13
13
|
if (setting === 'off' || setting === '0' || setting === 'false')
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
16
|
return !home && Number.isFinite(columns) && columns > SIDEBAR_THRESHOLD;
|
|
17
17
|
}
|
|
18
18
|
/** Reserve the last terminal column so a wide row cannot wrap the stage. */
|
|
19
|
-
export function sessionMainWidth(columns, home = false) {
|
|
19
|
+
export function sessionMainWidth(columns, home = false, env = typeof process !== 'undefined' ? process.env : {}) {
|
|
20
20
|
const width = Number.isFinite(columns) ? Math.max(20, Math.floor(columns)) : 80;
|
|
21
|
-
return sidebarVisible(width, home) ? width - SIDEBAR_WIDTH - 1 : width;
|
|
21
|
+
return sidebarVisible(width, home, env) ? width - SIDEBAR_WIDTH - 1 : width;
|
|
22
22
|
}
|
|
23
23
|
/** The session input uses the available conversation column, with a small inset. */
|
|
24
24
|
export function sessionComposerWidth(columns) {
|
|
@@ -59,7 +59,13 @@ export function sessionSidebarRows(facts, height) {
|
|
|
59
59
|
}
|
|
60
60
|
line();
|
|
61
61
|
styled(bold('Model'));
|
|
62
|
-
|
|
62
|
+
if (height >= 24 && facts.provider && facts.model) {
|
|
63
|
+
line(facts.provider);
|
|
64
|
+
line(facts.model);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
line([facts.provider, facts.model].filter(Boolean).join(' / ') || 'Not configured');
|
|
68
|
+
}
|
|
63
69
|
line();
|
|
64
70
|
styled(bold('Workspace'));
|
|
65
71
|
line(facts.cwd || 'Unknown');
|
|
@@ -70,7 +76,7 @@ export function sessionSidebarRows(facts, height) {
|
|
|
70
76
|
if (skillId) {
|
|
71
77
|
line();
|
|
72
78
|
styled(bold('Active Skill'));
|
|
73
|
-
styled(paint('accent', `✦ ${truncate(skillId, inner - 4, '…')}`));
|
|
79
|
+
styled(paint('accent', `✦ ${truncate(safeDisplay(skillId), inner - 4, '…')}`));
|
|
74
80
|
if (skillDesc) {
|
|
75
81
|
line(truncate(skillDesc, inner, '…'));
|
|
76
82
|
}
|
|
@@ -80,17 +86,22 @@ export function sessionSidebarRows(facts, height) {
|
|
|
80
86
|
const completed = facts.plan.filter(item => item.status === 'completed').length;
|
|
81
87
|
line();
|
|
82
88
|
styled(bold(`Plan ${completed}/${facts.plan.length}`));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
// Keep plan steps in execution order and keep the active step in view.
|
|
90
|
+
const maxSteps = Math.max(2, Math.min(10, Math.floor(height) - 14));
|
|
91
|
+
const activeIndex = facts.plan.findIndex(item => item.status === 'in_progress');
|
|
92
|
+
const pendingIndex = facts.plan.findIndex(item => item.status !== 'completed');
|
|
93
|
+
const focus = activeIndex >= 0 ? activeIndex : pendingIndex >= 0 ? pendingIndex : facts.plan.length - 1;
|
|
94
|
+
const start = Math.max(0, Math.min(focus - 2, facts.plan.length - maxSteps));
|
|
95
|
+
const planItems = facts.plan.slice(start, start + maxSteps);
|
|
96
|
+
if (start > 0)
|
|
97
|
+
line(`${start} earlier plan steps`);
|
|
88
98
|
for (const item of planItems) {
|
|
89
99
|
const mark = item.status === 'completed' ? '✓' : item.status === 'in_progress' ? '▸' : '·';
|
|
90
100
|
line(`${mark} ${item.text || item.step || item.content || ''}`);
|
|
91
101
|
}
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
const remaining = facts.plan.length - start - planItems.length;
|
|
103
|
+
if (remaining > 0)
|
|
104
|
+
line(`${remaining} later plan steps`);
|
|
94
105
|
}
|
|
95
106
|
const count = Number.isFinite(height) ? Math.max(1, Math.floor(height)) : 1;
|
|
96
107
|
const visible = rows.slice(0, count);
|
|
@@ -21,18 +21,18 @@ export interface SidebarFacts {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/** A side panel is useful only when a readable conversation column remains. */
|
|
24
|
-
export function sidebarVisible(columns: number, home = false): boolean {
|
|
25
|
-
if (
|
|
26
|
-
const setting = String(
|
|
24
|
+
export function sidebarVisible(columns: number, home = false, env: { CAUSYNE_SIDEBAR?: string } = typeof process !== 'undefined' ? process.env : {}): boolean {
|
|
25
|
+
if (env) {
|
|
26
|
+
const setting = String(env.CAUSYNE_SIDEBAR ?? '').trim().toLowerCase();
|
|
27
27
|
if (setting === 'off' || setting === '0' || setting === 'false') return false;
|
|
28
28
|
}
|
|
29
29
|
return !home && Number.isFinite(columns) && columns > SIDEBAR_THRESHOLD;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** Reserve the last terminal column so a wide row cannot wrap the stage. */
|
|
33
|
-
export function sessionMainWidth(columns: number, home = false): number {
|
|
33
|
+
export function sessionMainWidth(columns: number, home = false, env: { CAUSYNE_SIDEBAR?: string } = typeof process !== 'undefined' ? process.env : {}): number {
|
|
34
34
|
const width = Number.isFinite(columns) ? Math.max(20, Math.floor(columns)) : 80;
|
|
35
|
-
return sidebarVisible(width, home) ? width - SIDEBAR_WIDTH - 1 : width;
|
|
35
|
+
return sidebarVisible(width, home, env) ? width - SIDEBAR_WIDTH - 1 : width;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/** The session input uses the available conversation column, with a small inset. */
|
|
@@ -74,7 +74,12 @@ export function sessionSidebarRows(facts: SidebarFacts, height: number): string[
|
|
|
74
74
|
}
|
|
75
75
|
line();
|
|
76
76
|
styled(bold('Model'));
|
|
77
|
-
|
|
77
|
+
if (height >= 24 && facts.provider && facts.model) {
|
|
78
|
+
line(facts.provider);
|
|
79
|
+
line(facts.model);
|
|
80
|
+
} else {
|
|
81
|
+
line([facts.provider, facts.model].filter(Boolean).join(' / ') || 'Not configured');
|
|
82
|
+
}
|
|
78
83
|
line();
|
|
79
84
|
styled(bold('Workspace'));
|
|
80
85
|
line(facts.cwd || 'Unknown');
|
|
@@ -86,7 +91,7 @@ export function sessionSidebarRows(facts: SidebarFacts, height: number): string[
|
|
|
86
91
|
if (skillId) {
|
|
87
92
|
line();
|
|
88
93
|
styled(bold('Active Skill'));
|
|
89
|
-
styled(paint('accent', `✦ ${truncate(skillId, inner - 4, '…')}`));
|
|
94
|
+
styled(paint('accent', `✦ ${truncate(safeDisplay(skillId), inner - 4, '…')}`));
|
|
90
95
|
if (skillDesc) {
|
|
91
96
|
line(truncate(skillDesc, inner, '…'));
|
|
92
97
|
}
|
|
@@ -97,16 +102,20 @@ export function sessionSidebarRows(facts: SidebarFacts, height: number): string[
|
|
|
97
102
|
const completed = facts.plan.filter(item => item.status === 'completed').length;
|
|
98
103
|
line();
|
|
99
104
|
styled(bold(`Plan ${completed}/${facts.plan.length}`));
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
// Keep plan steps in execution order and keep the active step in view.
|
|
106
|
+
const maxSteps = Math.max(2, Math.min(10, Math.floor(height) - 14));
|
|
107
|
+
const activeIndex = facts.plan.findIndex(item => item.status === 'in_progress');
|
|
108
|
+
const pendingIndex = facts.plan.findIndex(item => item.status !== 'completed');
|
|
109
|
+
const focus = activeIndex >= 0 ? activeIndex : pendingIndex >= 0 ? pendingIndex : facts.plan.length - 1;
|
|
110
|
+
const start = Math.max(0, Math.min(focus - 2, facts.plan.length - maxSteps));
|
|
111
|
+
const planItems = facts.plan.slice(start, start + maxSteps);
|
|
112
|
+
if (start > 0) line(`${start} earlier plan steps`);
|
|
105
113
|
for (const item of planItems) {
|
|
106
114
|
const mark = item.status === 'completed' ? '✓' : item.status === 'in_progress' ? '▸' : '·';
|
|
107
115
|
line(`${mark} ${item.text || item.step || item.content || ''}`);
|
|
108
116
|
}
|
|
109
|
-
|
|
117
|
+
const remaining = facts.plan.length - start - planItems.length;
|
|
118
|
+
if (remaining > 0) line(`${remaining} later plan steps`);
|
|
110
119
|
}
|
|
111
120
|
|
|
112
121
|
const count = Number.isFinite(height) ? Math.max(1, Math.floor(height)) : 1;
|
package/src/tui/stageSurface.js
CHANGED
|
@@ -245,13 +245,13 @@ export class StageSurface {
|
|
|
245
245
|
|
|
246
246
|
composeAvailableWidth() {
|
|
247
247
|
if (this.homeInfo) return this.width;
|
|
248
|
-
return sessionMainWidth(this.width);
|
|
248
|
+
return sessionMainWidth(this.width, false, this.env);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
/** Home is compact; a session uses its full conversation column. */
|
|
252
252
|
composeWidth() {
|
|
253
253
|
if (this.homeInfo) return composerWidth(this.width);
|
|
254
|
-
const mainWidth = sessionMainWidth(this.width);
|
|
254
|
+
const mainWidth = sessionMainWidth(this.width, false, this.env);
|
|
255
255
|
return sessionComposerWidth(mainWidth);
|
|
256
256
|
}
|
|
257
257
|
|
|
@@ -413,7 +413,7 @@ export class StageSurface {
|
|
|
413
413
|
handleChange() {
|
|
414
414
|
if (!this.transcript.isEmpty()) this.opened = true;
|
|
415
415
|
const before = this.lastHeight;
|
|
416
|
-
const mainWidth = sessionMainWidth(this.width);
|
|
416
|
+
const mainWidth = sessionMainWidth(this.width, false, this.env);
|
|
417
417
|
const contentWidth = this.railEnabled(mainWidth)
|
|
418
418
|
? Math.max(20, mainWidth - RAIL_BUDGET - (hasSessionTurns(this.transcript) ? TURN_RAIL_BUDGET : 0))
|
|
419
419
|
: mainWidth;
|
|
@@ -466,8 +466,8 @@ export class StageSurface {
|
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
const width = this.width;
|
|
469
|
-
const sidebar = sidebarVisible(width);
|
|
470
|
-
const mainWidth = sessionMainWidth(width);
|
|
469
|
+
const sidebar = sidebarVisible(width, false, this.env);
|
|
470
|
+
const mainWidth = sessionMainWidth(width, false, this.env);
|
|
471
471
|
const rail = this.railEnabled(mainWidth);
|
|
472
472
|
const contentWidth = rail
|
|
473
473
|
? Math.max(20, mainWidth - RAIL_BUDGET - (hasSessionTurns(this.transcript) ? TURN_RAIL_BUDGET : 0))
|
|
@@ -675,12 +675,18 @@ export class StageSurface {
|
|
|
675
675
|
this.close();
|
|
676
676
|
return false;
|
|
677
677
|
}
|
|
678
|
-
//
|
|
679
|
-
|
|
678
|
+
// A width-only resize must not collapse and re-claim the whole session.
|
|
679
|
+
// Claiming fresh lines on every drag scrolls the transcript and leaves
|
|
680
|
+
// obsolete sidebar columns behind during the 160-column breakpoint.
|
|
681
|
+
// The existing rows are already reserved: repaint them in place with
|
|
682
|
+
// their new width, clearing trailing cells through Stage.paint().
|
|
683
|
+
if (!this.stage.reserved || next !== this.stage.maxHeight) {
|
|
684
|
+
this.stage.resize(next, 1);
|
|
685
|
+
}
|
|
680
686
|
this.stage.invalidate();
|
|
681
687
|
// Re-derive from the new geometry: growing the viewport lowers maxScrollTop,
|
|
682
688
|
// and leaving scrollTop above it would read as "the user scrolled away".
|
|
683
|
-
const mainWidth = sessionMainWidth(this.width);
|
|
689
|
+
const mainWidth = sessionMainWidth(this.width, false, this.env);
|
|
684
690
|
const contentWidth = this.railEnabled(mainWidth)
|
|
685
691
|
? Math.max(20, mainWidth - RAIL_BUDGET - (hasSessionTurns(this.transcript) ? TURN_RAIL_BUDGET : 0))
|
|
686
692
|
: mainWidth;
|