@sagmans/dsh-tui 0.1.1 → 0.2.0
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 +84 -10
- package/cordis.patch.yml +4 -2
- package/lib/agent/host.d.ts +14 -0
- package/lib/agent/host.d.ts.map +1 -1
- package/lib/agent/host.js +20 -4
- package/lib/agent/host.js.map +1 -1
- package/lib/agent/model.d.ts +24 -0
- package/lib/agent/model.d.ts.map +1 -1
- package/lib/agent/model.js +46 -1
- package/lib/agent/model.js.map +1 -1
- package/lib/agent/present.d.ts +7 -1
- package/lib/agent/present.d.ts.map +1 -1
- package/lib/agent/present.js +33 -4
- package/lib/agent/present.js.map +1 -1
- package/lib/agent/presets.d.ts +7 -1
- package/lib/agent/presets.d.ts.map +1 -1
- package/lib/agent/presets.js +7 -3
- package/lib/agent/presets.js.map +1 -1
- package/lib/cards.d.ts +127 -7
- package/lib/cards.d.ts.map +1 -1
- package/lib/cards.js +380 -52
- package/lib/cards.js.map +1 -1
- package/lib/export.d.ts +5 -4
- package/lib/export.d.ts.map +1 -1
- package/lib/export.js +62 -13
- package/lib/export.js.map +1 -1
- package/lib/fold-cursor.d.ts +23 -0
- package/lib/fold-cursor.d.ts.map +1 -0
- package/lib/fold-cursor.js +31 -0
- package/lib/fold-cursor.js.map +1 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +310 -32
- package/lib/index.js.map +1 -1
- package/lib/input/submission.d.ts +3 -1
- package/lib/input/submission.d.ts.map +1 -1
- package/lib/input/submission.js +5 -2
- package/lib/input/submission.js.map +1 -1
- package/lib/terminal/warning-screen.d.ts +8 -0
- package/lib/terminal/warning-screen.d.ts.map +1 -0
- package/lib/terminal/warning-screen.js +66 -0
- package/lib/terminal/warning-screen.js.map +1 -0
- package/lib/theme-capability.d.ts +36 -0
- package/lib/theme-capability.d.ts.map +1 -0
- package/lib/theme-capability.js +190 -0
- package/lib/theme-capability.js.map +1 -0
- package/lib/theme-command.d.ts +10 -0
- package/lib/theme-command.d.ts.map +1 -0
- package/lib/theme-command.js +61 -0
- package/lib/theme-command.js.map +1 -0
- package/lib/theme-settings.d.ts +161 -0
- package/lib/theme-settings.d.ts.map +1 -0
- package/lib/theme-settings.js +166 -0
- package/lib/theme-settings.js.map +1 -0
- package/lib/theme-tokens.d.ts +110 -0
- package/lib/theme-tokens.d.ts.map +1 -0
- package/lib/theme-tokens.js +401 -0
- package/lib/theme-tokens.js.map +1 -0
- package/lib/theme.d.ts +32 -35
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +112 -63
- package/lib/theme.js.map +1 -1
- package/lib/tokens.d.ts +15 -0
- package/lib/tokens.d.ts.map +1 -0
- package/lib/tokens.js +29 -0
- package/lib/tokens.js.map +1 -0
- package/lib/transcript.d.ts +26 -1
- package/lib/transcript.d.ts.map +1 -1
- package/lib/transcript.js +153 -25
- package/lib/transcript.js.map +1 -1
- package/lib/ui/dock.d.ts.map +1 -1
- package/lib/ui/dock.js +67 -28
- package/lib/ui/dock.js.map +1 -1
- package/lib/ui/editor.d.ts +34 -0
- package/lib/ui/editor.d.ts.map +1 -0
- package/lib/ui/editor.js +98 -0
- package/lib/ui/editor.js.map +1 -0
- package/lib/ui/markdown.d.ts +8 -0
- package/lib/ui/markdown.d.ts.map +1 -1
- package/lib/ui/markdown.js +12 -0
- package/lib/ui/markdown.js.map +1 -1
- package/lib/ui/picker.d.ts +37 -0
- package/lib/ui/picker.d.ts.map +1 -1
- package/lib/ui/picker.js +53 -0
- package/lib/ui/picker.js.map +1 -1
- package/lib/ui/status.d.ts +3 -1
- package/lib/ui/status.d.ts.map +1 -1
- package/lib/ui/status.js +76 -24
- package/lib/ui/status.js.map +1 -1
- package/lib/ui/view.d.ts +43 -0
- package/lib/ui/view.d.ts.map +1 -1
- package/lib/ui/view.js +254 -54
- package/lib/ui/view.js.map +1 -1
- package/package.json +3 -1
package/lib/ui/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/ui/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/ui/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,wBAAwB,CAAA;AAIrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1C,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1C,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAA;IAChD,yEAAyE;IACzE,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAsBD,wFAAwF;AAExF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQxE;AAOD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,CAsCvF;AAsCD,yDAAyD;AACzD,qBAAa,SAAU,YAAW,SAAS;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,KAAK,EAAE,MAAM,WAAW,EACxB,KAAK,EAAE,QAAQ;IAGlC,UAAU,IAAI,IAAI;IAIlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAGhC"}
|
package/lib/ui/status.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { visibleWidth } from '@earendil-works/pi-tui';
|
|
2
2
|
import { displayText } from "../text.js";
|
|
3
|
-
|
|
4
|
-
const HUNDRED_THOUSAND = 100 * THOUSAND;
|
|
5
|
-
const MILLION = 1_000_000;
|
|
3
|
+
import { formatTokens } from "../tokens.js";
|
|
6
4
|
const SECOND_MS = 1000;
|
|
7
5
|
const MINUTE_MS = 60 * SECOND_MS;
|
|
8
6
|
/** Path segments kept for a directory outside the home; a terminal row is not a file browser. */
|
|
9
7
|
const PATH_SEGMENTS = 2;
|
|
8
|
+
/** What sits between two facts that do not qualify each other. */
|
|
9
|
+
const SEPARATOR_TEXT = ' · ';
|
|
10
|
+
/** Marks the point where a row was cut; the reader must know something is missing. */
|
|
11
|
+
const ELLIPSIS = '…';
|
|
12
|
+
/** The mark that says which of the two activities the session is in. */
|
|
13
|
+
const WORKING_MARK = '▶';
|
|
14
|
+
const READY_MARK = '●';
|
|
10
15
|
/** Compact a token count, because the exact number changes nothing a reader decides. */
|
|
11
|
-
export function formatTokens(count) {
|
|
12
|
-
if (count >= MILLION)
|
|
13
|
-
return `${(count / MILLION).toFixed(1)}M`;
|
|
14
|
-
// A decimal on a five-digit count is noise: 128.0k reads worse than 128k.
|
|
15
|
-
if (count >= HUNDRED_THOUSAND)
|
|
16
|
-
return `${Math.round(count / THOUSAND)}k`;
|
|
17
|
-
if (count >= THOUSAND)
|
|
18
|
-
return `${(count / THOUSAND).toFixed(1)}k`;
|
|
19
|
-
return String(count);
|
|
20
|
-
}
|
|
21
16
|
/**
|
|
22
17
|
* Shorten an absolute path for the footer: the reader's own home becomes `~`,
|
|
23
18
|
* and only a path from outside it is cut down to its tail.
|
|
@@ -43,34 +38,91 @@ function elapsed(ms) {
|
|
|
43
38
|
/**
|
|
44
39
|
* One line of state, ordered by what a reader asks first: is it working, what is
|
|
45
40
|
* it, how full is the context, and where am I.
|
|
41
|
+
*
|
|
42
|
+
* Each segment is its own element, so a reader can quiet the path without
|
|
43
|
+
* losing the model, and the separator is one too.
|
|
46
44
|
*/
|
|
47
45
|
export function formatStatus(facts, width, theme) {
|
|
48
|
-
const
|
|
46
|
+
const segments = [];
|
|
47
|
+
/**
|
|
48
|
+
* Content is escaped as it is collected, and styling is applied only after the
|
|
49
|
+
* row has been cut to width. Styling earlier would put generated control
|
|
50
|
+
* characters in reach of `displayText`, which exists to make control
|
|
51
|
+
* characters visible, so a segment would print its own colour as text.
|
|
52
|
+
*/
|
|
53
|
+
const push = (token, text, join = false) => {
|
|
54
|
+
if (!theme.visible(token))
|
|
55
|
+
return;
|
|
56
|
+
segments.push({ token, text: displayText(text), join });
|
|
57
|
+
};
|
|
49
58
|
if (facts.activity === 'working') {
|
|
50
|
-
|
|
59
|
+
push('status.activity.working', `${WORKING_MARK} working`);
|
|
60
|
+
// Elapsed carries its own token so it can be toned apart from the activity,
|
|
61
|
+
// but it qualifies that activity, so it attaches rather than standing alone.
|
|
62
|
+
if (facts.elapsedMs !== undefined)
|
|
63
|
+
push('status.elapsed', ` ${elapsed(facts.elapsedMs)}`, true);
|
|
51
64
|
}
|
|
52
65
|
else {
|
|
53
|
-
|
|
66
|
+
push('status.activity.ready', `${READY_MARK} ready`);
|
|
54
67
|
}
|
|
55
68
|
// The mode comes first: it decides which tools exist at all, so a reader who
|
|
56
69
|
// saw a tool disappear needs it before the model that ran it.
|
|
57
70
|
if (facts.agentPreset !== undefined && facts.agentPreset !== '')
|
|
58
|
-
|
|
71
|
+
push('status.agentPreset', facts.agentPreset);
|
|
59
72
|
if (facts.model !== undefined && facts.model !== '') {
|
|
60
73
|
const route = facts.provider === undefined || facts.provider === '' ? facts.model : `${facts.provider}/${facts.model}`;
|
|
61
|
-
|
|
74
|
+
push('status.model', route);
|
|
75
|
+
// The effort qualifies the model, so it reads as part of it.
|
|
76
|
+
if (facts.effort !== undefined && facts.effort !== '')
|
|
77
|
+
push('status.effort', ` (${facts.effort})`, true);
|
|
62
78
|
}
|
|
63
79
|
if (facts.preset !== undefined && facts.preset !== '')
|
|
64
|
-
|
|
80
|
+
push('status.permission', facts.preset);
|
|
65
81
|
if (facts.contextTokens !== undefined) {
|
|
66
|
-
|
|
82
|
+
push('status.context', facts.contextWindow === undefined
|
|
67
83
|
? `ctx ${formatTokens(facts.contextTokens)}`
|
|
68
84
|
: `ctx ${formatTokens(facts.contextTokens)}/${formatTokens(facts.contextWindow)}`);
|
|
69
85
|
}
|
|
70
86
|
if (facts.cacheRate !== undefined)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return
|
|
87
|
+
push('status.cache', `cache ${Math.round(facts.cacheRate * 100)}%`);
|
|
88
|
+
push('status.cwd', shortPath(facts.cwd, facts.home));
|
|
89
|
+
return renderSegments(segments, width, theme);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Join styled segments into one row, cutting it to width first.
|
|
93
|
+
*
|
|
94
|
+
* The cut runs on unstyled text so it can never land inside a style and leave
|
|
95
|
+
* one open, and each segment is trimmed to the room left rather than dropped:
|
|
96
|
+
* a reader loses the tail of the last fact, not the fact, and the ellipsis
|
|
97
|
+
* still says that something was left out.
|
|
98
|
+
*/
|
|
99
|
+
function renderSegments(segments, width, theme) {
|
|
100
|
+
// Hiding the separator means drawing no separator, not drawing a plain one:
|
|
101
|
+
// "hidden" is the one promise the reader cannot see half-kept.
|
|
102
|
+
const showSeparator = theme.visible('status.separator');
|
|
103
|
+
const separator = showSeparator ? theme.style('status.separator', SEPARATOR_TEXT) : '';
|
|
104
|
+
const ellipsisWidth = visibleWidth(ELLIPSIS);
|
|
105
|
+
let out = '';
|
|
106
|
+
let budget = width;
|
|
107
|
+
for (const [index, segment] of segments.entries()) {
|
|
108
|
+
const joining = index === 0 || segment.join;
|
|
109
|
+
const lead = joining || !showSeparator ? 0 : visibleWidth(SEPARATOR_TEXT);
|
|
110
|
+
// A separator is drawn only alongside text, so there must be room for the
|
|
111
|
+
// separator and at least the mark that something was cut.
|
|
112
|
+
if (budget - lead < ellipsisWidth)
|
|
113
|
+
break;
|
|
114
|
+
const room = budget - lead;
|
|
115
|
+
const textWidth = visibleWidth(segment.text);
|
|
116
|
+
if (textWidth > room) {
|
|
117
|
+
// Not the last segment: the rest is omitted, so the row must show it.
|
|
118
|
+
const cut = theme.cut(segment.text, room, ELLIPSIS);
|
|
119
|
+
out += `${lead > 0 ? separator : ''}${theme.style(segment.token, cut)}`;
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
out += `${lead > 0 ? separator : ''}${theme.style(segment.token, segment.text)}`;
|
|
123
|
+
budget -= lead + textWidth;
|
|
124
|
+
}
|
|
125
|
+
return out === '' ? theme.cut('', Math.max(0, width), ELLIPSIS) : out;
|
|
74
126
|
}
|
|
75
127
|
/** A one-row view of the state around the transcript. */
|
|
76
128
|
export class StatusBar {
|
package/lib/ui/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/ui/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,
|
|
1
|
+
{"version":3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lib/ui/view.d.ts
CHANGED
|
@@ -9,7 +9,18 @@ import { RowCache } from './rows.ts';
|
|
|
9
9
|
export interface ViewState {
|
|
10
10
|
readonly expandCards: boolean;
|
|
11
11
|
readonly expandReasoning: boolean;
|
|
12
|
+
/** Whether the calls a PTC program dispatched draw under the card that made them. */
|
|
13
|
+
readonly expandSubCalls: boolean;
|
|
12
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The state a reader gets before opening anything, and the view's own fallback.
|
|
17
|
+
*
|
|
18
|
+
* Cards and thoughts start folded because either can be long enough to push the
|
|
19
|
+
* answer off the screen. A program's calls are the opposite case: one clipped
|
|
20
|
+
* line each, under a header that already names them, so folding them costs a
|
|
21
|
+
* reader the very thing the card stands for.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_VIEW_STATE: ViewState;
|
|
13
24
|
/**
|
|
14
25
|
* Renders the transcript rows and any pending gate as terminal lines.
|
|
15
26
|
*
|
|
@@ -43,14 +54,46 @@ export declare class TranscriptView implements Component {
|
|
|
43
54
|
invalidate(): void;
|
|
44
55
|
/** Wrap one text block under a prefix, keeping the prefix's column budget. */
|
|
45
56
|
private pushWrapped;
|
|
57
|
+
/**
|
|
58
|
+
* Wrap one already-styled block under a prefix.
|
|
59
|
+
*
|
|
60
|
+
* A card header mixes tokens — title, argument, stats — in a single string, so
|
|
61
|
+
* it cannot go through {@link pushWrapped}, which escapes and restyles plain
|
|
62
|
+
* text. Its width still has to fold at the screen edge rather than be cut,
|
|
63
|
+
* because the argument is the part a reader scans for and a silently dropped
|
|
64
|
+
* command is worse than a taller card.
|
|
65
|
+
*/
|
|
66
|
+
private pushStyledWrapped;
|
|
46
67
|
/** Render assistant text as markdown: the model writes structure, the reader reads it. */
|
|
47
68
|
private pushMarkdown;
|
|
48
69
|
private pushReasoning;
|
|
49
70
|
private pushCard;
|
|
71
|
+
/**
|
|
72
|
+
* The calls one card dispatched, one entry each.
|
|
73
|
+
*
|
|
74
|
+
* A nested call is a signpost rather than a card of its own, so it keeps one
|
|
75
|
+
* entry per call; a long argument still wraps under that entry rather than
|
|
76
|
+
* being cut, because the argument is the part a reader scans for and a
|
|
77
|
+
* silently shortened path reads as the one that ran.
|
|
78
|
+
*/
|
|
79
|
+
private pushSubCalls;
|
|
80
|
+
/**
|
|
81
|
+
* A card's header: its label, its argument, and its measured facts.
|
|
82
|
+
*
|
|
83
|
+
* The glyph is returned apart from the body so a wrapped continuation can
|
|
84
|
+
* align under the label rather than under the mark. A terminal's argument is
|
|
85
|
+
* left out because it needs a row of its own — it is the one argument that can
|
|
86
|
+
* be a whole command rather than a word.
|
|
87
|
+
*/
|
|
88
|
+
private renderHead;
|
|
89
|
+
/** The measured facts, each in its own colour, or nothing when none is visible. */
|
|
90
|
+
private renderStats;
|
|
50
91
|
private pushPicker;
|
|
51
92
|
private pushGate;
|
|
52
93
|
/** The rows one transcript entry becomes. */
|
|
53
94
|
private renderEntry;
|
|
95
|
+
/** The mark and the space that introduce an element, empty when it has none. */
|
|
96
|
+
private elementLead;
|
|
54
97
|
render(width: number): string[];
|
|
55
98
|
}
|
|
56
99
|
//# sourceMappingURL=view.d.ts.map
|
package/lib/ui/view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/ui/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/ui/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,wBAAwB,CAAA;AAEvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eA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