@sagmans/dsh-tui 0.1.2 → 0.3.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 +196 -17
- 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 +50 -0
- package/lib/agent/model.d.ts.map +1 -1
- package/lib/agent/model.js +87 -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/agent/status.d.ts +10 -0
- package/lib/agent/status.d.ts.map +1 -1
- package/lib/agent/status.js +2 -0
- package/lib/agent/status.js.map +1 -1
- package/lib/cards.d.ts +127 -7
- package/lib/cards.d.ts.map +1 -1
- package/lib/cards.js +381 -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/gates.d.ts +145 -2
- package/lib/gates.d.ts.map +1 -1
- package/lib/gates.js +335 -40
- package/lib/gates.js.map +1 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +651 -92
- package/lib/index.js.map +1 -1
- package/lib/input/actions.d.ts +136 -0
- package/lib/input/actions.d.ts.map +1 -0
- package/lib/input/actions.js +740 -0
- package/lib/input/actions.js.map +1 -0
- package/lib/input/keymap-settings.d.ts +21 -0
- package/lib/input/keymap-settings.d.ts.map +1 -0
- package/lib/input/keymap-settings.js +28 -0
- package/lib/input/keymap-settings.js.map +1 -0
- package/lib/input/keymap.d.ts +91 -0
- package/lib/input/keymap.d.ts.map +1 -0
- package/lib/input/keymap.js +170 -0
- package/lib/input/keymap.js.map +1 -0
- package/lib/input/match.d.ts +10 -0
- package/lib/input/match.d.ts.map +1 -0
- package/lib/input/match.js +83 -0
- package/lib/input/match.js.map +1 -0
- package/lib/input/submission.d.ts +8 -1
- package/lib/input/submission.d.ts.map +1 -1
- package/lib/input/submission.js +9 -2
- package/lib/input/submission.js.map +1 -1
- package/lib/input.d.ts +17 -0
- package/lib/input.d.ts.map +1 -0
- package/lib/input.js +27 -0
- package/lib/input.js.map +1 -0
- package/lib/keys-command.d.ts +16 -0
- package/lib/keys-command.d.ts.map +1 -0
- package/lib/keys-command.js +60 -0
- package/lib/keys-command.js.map +1 -0
- package/lib/queue.d.ts +6 -0
- package/lib/queue.d.ts.map +1 -0
- package/lib/queue.js +68 -0
- package/lib/queue.js.map +1 -0
- package/lib/settings-notice.d.ts +19 -0
- package/lib/settings-notice.d.ts.map +1 -0
- package/lib/settings-notice.js +30 -0
- package/lib/settings-notice.js.map +1 -0
- 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 +196 -0
- package/lib/theme-settings.d.ts.map +1 -0
- package/lib/theme-settings.js +229 -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 +427 -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 +51 -0
- package/lib/ui/editor.d.ts.map +1 -0
- package/lib/ui/editor.js +159 -0
- package/lib/ui/editor.js.map +1 -0
- package/lib/ui/frame.d.ts +54 -0
- package/lib/ui/frame.d.ts.map +1 -0
- package/lib/ui/frame.js +79 -0
- package/lib/ui/frame.js.map +1 -0
- package/lib/ui/gate-input.d.ts +20 -0
- package/lib/ui/gate-input.d.ts.map +1 -0
- package/lib/ui/gate-input.js +96 -0
- package/lib/ui/gate-input.js.map +1 -0
- package/lib/ui/markdown.d.ts +19 -2
- package/lib/ui/markdown.d.ts.map +1 -1
- package/lib/ui/markdown.js +37 -6
- package/lib/ui/markdown.js.map +1 -1
- package/lib/ui/mermaid.d.ts +44 -0
- package/lib/ui/mermaid.d.ts.map +1 -0
- package/lib/ui/mermaid.js +178 -0
- package/lib/ui/mermaid.js.map +1 -0
- package/lib/ui/picker.d.ts +66 -7
- package/lib/ui/picker.d.ts.map +1 -1
- package/lib/ui/picker.js +112 -19
- package/lib/ui/picker.js.map +1 -1
- package/lib/ui/prompt.d.ts +30 -0
- package/lib/ui/prompt.d.ts.map +1 -0
- package/lib/ui/prompt.js +45 -0
- package/lib/ui/prompt.js.map +1 -0
- package/lib/ui/queue.d.ts +24 -0
- package/lib/ui/queue.d.ts.map +1 -0
- package/lib/ui/queue.js +57 -0
- package/lib/ui/queue.js.map +1 -0
- package/lib/ui/status.d.ts +7 -1
- package/lib/ui/status.d.ts.map +1 -1
- package/lib/ui/status.js +84 -24
- package/lib/ui/status.js.map +1 -1
- package/lib/ui/view.d.ts +65 -2
- package/lib/ui/view.d.ts.map +1 -1
- package/lib/ui/view.js +319 -59
- package/lib/ui/view.js.map +1 -1
- package/lib/work.d.ts +48 -0
- package/lib/work.d.ts.map +1 -1
- package/lib/work.js +44 -0
- package/lib/work.js.map +1 -1
- package/package.json +5 -2
package/lib/input.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decoding shared by every surface that reads typed text.
|
|
3
|
+
*
|
|
4
|
+
* The terminal reports a paste as one bracketed run rather than as key presses,
|
|
5
|
+
* so a handler that only knows single characters silently drops what a reader
|
|
6
|
+
* copied; unwrapping it here keeps each surface answering for its own meaning
|
|
7
|
+
* instead of each re-deriving the same markers.
|
|
8
|
+
*/
|
|
9
|
+
/** The markers the surface wraps a paste in once the terminal reports one. */
|
|
10
|
+
const PASTE_START = '\x1b[200~';
|
|
11
|
+
const PASTE_END = '\x1b[201~';
|
|
12
|
+
/**
|
|
13
|
+
* The text a bracketed paste carries, or undefined when the input is a key press.
|
|
14
|
+
*
|
|
15
|
+
* Control bytes are the terminal's, not the reader's: a copied key arrives with
|
|
16
|
+
* the newline that copied it, and keeping that newline would confirm a question
|
|
17
|
+
* before the reader saw what landed.
|
|
18
|
+
*/
|
|
19
|
+
export function pastedText(data) {
|
|
20
|
+
const start = data.indexOf(PASTE_START);
|
|
21
|
+
if (start === -1)
|
|
22
|
+
return undefined;
|
|
23
|
+
const rest = data.slice(start + PASTE_START.length);
|
|
24
|
+
const end = rest.indexOf(PASTE_END);
|
|
25
|
+
return (end === -1 ? rest : rest.slice(0, end)).replace(/[\u0000-\u001f\u007f]/gu, '');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=input.js.map
|
package/lib/input.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,GAAG,WAAW,CAAA;AAC/B,MAAM,SAAS,GAAG,WAAW,CAAA;AAE7B;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACvC,IAAI,KAAK,KAAK,CAAC,CAAC;QAAE,OAAO,SAAS,CAAA;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACnC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAA;AACxF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ActionLayer, type Keymap } from './input/actions.ts';
|
|
2
|
+
/** The layers a reader may ask for, in the order the table lists them. */
|
|
3
|
+
export declare const KEYMAP_LAYERS: readonly ActionLayer[];
|
|
4
|
+
/** The layer a reader named, or nothing when the name is not one of them. */
|
|
5
|
+
export declare function keymapLayer(name: string): ActionLayer | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* The effective map, one line per action.
|
|
8
|
+
*
|
|
9
|
+
* The id comes first because it is what the reader types into settings.yaml;
|
|
10
|
+
* the keys follow in the order they are read, so a list action answers its
|
|
11
|
+
* first key before its second. A mark says which rows the reader wrote, because
|
|
12
|
+
* a document that no longer matches the shipped map cannot be read off the file
|
|
13
|
+
* once the file grows.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderKeymap(map: Keymap, only?: ActionLayer): string[];
|
|
16
|
+
//# sourceMappingURL=keys-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys-command.d.ts","sourceRoot":"","sources":["../src/keys-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6D,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE7H,0EAA0E;AAC1E,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAA4E,CAAA;AAuB5H,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,CAsBtE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ACTION_CATALOG, actionLabel, keyName, keysFor, newShadows } from "./input/actions.js";
|
|
2
|
+
/** The layers a reader may ask for, in the order the table lists them. */
|
|
3
|
+
export const KEYMAP_LAYERS = ['prompt', 'surface', 'chord', 'gate', 'question', 'picker', 'library'];
|
|
4
|
+
/** What each layer is for, so a list of ids reads as a surface rather than a dump. */
|
|
5
|
+
const LAYER_NOTES = {
|
|
6
|
+
prompt: 'the prompt bar',
|
|
7
|
+
surface: 'the surface, answered before the editor',
|
|
8
|
+
chord: 'the prefix first, then the key that follows it',
|
|
9
|
+
gate: 'an approval',
|
|
10
|
+
question: 'a question and its options',
|
|
11
|
+
picker: 'a list',
|
|
12
|
+
library: 'the editor and input pi-tui draws, read from the library',
|
|
13
|
+
};
|
|
14
|
+
/** Where the reader edits the section; the home is a variable, not a fixed path. */
|
|
15
|
+
const SETTINGS_HINT = 'edit $DSH_HOME/settings.yaml (default ~/.dsh/settings.yaml) under "dsh-tui:" · /keys shows the result';
|
|
16
|
+
/** The smallest document that says something, so the shape is never guessed at. */
|
|
17
|
+
const EXAMPLE = [
|
|
18
|
+
'keys:',
|
|
19
|
+
' prompt.submit: ctrl+enter # one key, or',
|
|
20
|
+
' prompt.newLine: [enter, shift+enter, ctrl+j] # a list of them',
|
|
21
|
+
];
|
|
22
|
+
/** The layer a reader named, or nothing when the name is not one of them. */
|
|
23
|
+
export function keymapLayer(name) {
|
|
24
|
+
return KEYMAP_LAYERS.find(layer => layer === name);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The effective map, one line per action.
|
|
28
|
+
*
|
|
29
|
+
* The id comes first because it is what the reader types into settings.yaml;
|
|
30
|
+
* the keys follow in the order they are read, so a list action answers its
|
|
31
|
+
* first key before its second. A mark says which rows the reader wrote, because
|
|
32
|
+
* a document that no longer matches the shipped map cannot be read off the file
|
|
33
|
+
* once the file grows.
|
|
34
|
+
*/
|
|
35
|
+
export function renderKeymap(map, only) {
|
|
36
|
+
const layers = only === undefined ? KEYMAP_LAYERS : [only];
|
|
37
|
+
const actions = ACTION_CATALOG.filter(action => layers.includes(action.layer));
|
|
38
|
+
const lines = [`keys · ${actions.length} actions · ${map.written.size} of them yours`, ''];
|
|
39
|
+
for (const layer of layers) {
|
|
40
|
+
const rows = actions.filter(action => action.layer === layer);
|
|
41
|
+
if (rows.length === 0)
|
|
42
|
+
continue;
|
|
43
|
+
lines.push(`${layer} · ${LAYER_NOTES[layer]}:`);
|
|
44
|
+
for (const action of rows) {
|
|
45
|
+
const keys = keysFor(map, action.id).map(keyName).join(' · ');
|
|
46
|
+
lines.push(` ${action.id} = ${keys === '' ? 'unbound' : keys} · ${actionLabel(action.id)}${map.written.has(action.id) ? ' (yours)' : ''}`);
|
|
47
|
+
}
|
|
48
|
+
lines.push('');
|
|
49
|
+
}
|
|
50
|
+
const shadows = newShadows(map);
|
|
51
|
+
if (shadows.length > 0) {
|
|
52
|
+
lines.push('keys you took from the library:');
|
|
53
|
+
for (const shadow of shadows)
|
|
54
|
+
lines.push(` ${keyName(shadow.key)}: ${shadow.winner} over ${shadow.loser}`);
|
|
55
|
+
lines.push('');
|
|
56
|
+
}
|
|
57
|
+
lines.push(...EXAMPLE, '', SETTINGS_HINT);
|
|
58
|
+
return lines;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=keys-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys-command.js","sourceRoot":"","sources":["../src/keys-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAiC,MAAM,oBAAoB,CAAA;AAE7H,0EAA0E;AAC1E,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AAE5H,sFAAsF;AACtF,MAAM,WAAW,GAA0C;IACzD,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,gDAAgD;IACvD,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,4BAA4B;IACtC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,0DAA0D;CACpE,CAAA;AAED,oFAAoF;AACpF,MAAM,aAAa,GAAG,uGAAuG,CAAA;AAE7H,mFAAmF;AACnF,MAAM,OAAO,GAAG;IACd,OAAO;IACP,kDAAkD;IAClD,mEAAmE;CACpE,CAAA;AAED,6EAA6E;AAC7E,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAA;AACpD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,IAAkB;IAC1D,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CA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C,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAA;QAC7C,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;QAC3G,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAChB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,aAAa,CAAC,CAAA;IACzC,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/lib/queue.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
/** The reader's own prompts still waiting in one inbox projection state. */
|
|
3
|
+
export declare function promptsOf(state: unknown): readonly string[];
|
|
4
|
+
/** The prompts one session's agent has not taken yet. */
|
|
5
|
+
export declare function pendingPrompts(ctx: Context, session: unknown): readonly string[];
|
|
6
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAmDlD,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAc3D;AAED,yDAAyD;AACzD,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAEhF"}
|
package/lib/queue.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { projectionState } from "./agent/projections.js";
|
|
2
|
+
/**
|
|
3
|
+
* The prompts an agent has not taken yet.
|
|
4
|
+
*
|
|
5
|
+
* The harness owns pending input and records every append, claim, and
|
|
6
|
+
* cancellation as a durable splice; the `inbox` projection folds those into the
|
|
7
|
+
* two lists a claim drains. Reading that projection rather than keeping a list
|
|
8
|
+
* of our own is what makes a row disappear exactly when the message is taken —
|
|
9
|
+
* including when an interrupt discarded it — and what lets a resumed session
|
|
10
|
+
* show input that is still owed.
|
|
11
|
+
*/
|
|
12
|
+
/** What a queued prompt shows when it carries no text block, so its row is never blank. */
|
|
13
|
+
const NO_TEXT = '(no text)';
|
|
14
|
+
/**
|
|
15
|
+
* The pending lists, in the order the harness delivers them.
|
|
16
|
+
*
|
|
17
|
+
* A step boundary claims next-step first and takes a queued turn after it, so
|
|
18
|
+
* this is also the order the reader's own rows reach the transcript in.
|
|
19
|
+
*/
|
|
20
|
+
const TARGETS = ['next-step', 'next-turn'];
|
|
21
|
+
function asRecord(value) {
|
|
22
|
+
return typeof value === 'object' && value !== null ? value : undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Whether a pending message is the reader's own input.
|
|
26
|
+
*
|
|
27
|
+
* Next-step also carries the contexts a tool or a plugin injects, which are
|
|
28
|
+
* machinery rather than something the reader is waiting to see delivered.
|
|
29
|
+
*/
|
|
30
|
+
function fromHuman(message) {
|
|
31
|
+
return asRecord(message.source)?.kind === 'user';
|
|
32
|
+
}
|
|
33
|
+
/** The text one pending message carries; a thought is the model's, not the reader's words. */
|
|
34
|
+
function textOf(message) {
|
|
35
|
+
const blocks = Array.isArray(message.content) ? message.content : [];
|
|
36
|
+
const texts = [];
|
|
37
|
+
for (const block of blocks) {
|
|
38
|
+
const record = asRecord(block);
|
|
39
|
+
if (record?.type !== 'text' || typeof record.text !== 'string')
|
|
40
|
+
continue;
|
|
41
|
+
texts.push(record.text);
|
|
42
|
+
}
|
|
43
|
+
return texts.length === 0 ? NO_TEXT : texts.join('\n');
|
|
44
|
+
}
|
|
45
|
+
/** The reader's own prompts still waiting in one inbox projection state. */
|
|
46
|
+
export function promptsOf(state) {
|
|
47
|
+
const inbox = asRecord(state);
|
|
48
|
+
if (inbox === undefined)
|
|
49
|
+
return [];
|
|
50
|
+
const prompts = [];
|
|
51
|
+
for (const target of TARGETS) {
|
|
52
|
+
const pending = inbox[target];
|
|
53
|
+
if (!Array.isArray(pending))
|
|
54
|
+
continue;
|
|
55
|
+
for (const entry of pending) {
|
|
56
|
+
const message = asRecord(entry);
|
|
57
|
+
if (message === undefined || !fromHuman(message))
|
|
58
|
+
continue;
|
|
59
|
+
prompts.push(textOf(message));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return prompts;
|
|
63
|
+
}
|
|
64
|
+
/** The prompts one session's agent has not taken yet. */
|
|
65
|
+
export function pendingPrompts(ctx, session) {
|
|
66
|
+
return session === undefined ? [] : promptsOf(projectionState(ctx, session, 'inbox'));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=queue.js.map
|
package/lib/queue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD;;;;;;;;;GASG;AAEH,2FAA2F;AAC3F,MAAM,OAAO,GAAG,WAAW,CAAA;AAE3B;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,WAAW,EAAE,WAAW,CAAU,CAAA;AAEnD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,SAAS,CAAA;AACnG,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,OAAgC;IACjD,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,MAAM,CAAA;AAClD,CAAC;AAED,8FAA8F;AAC9F,SAAS,MAAM,CAAC,OAAgC;IAC9C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;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,cAAc,CAAC,GAAY,EAAE,OAAgB;IAC3D,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;AACvF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Where a deferred notice prints once the surface owns the screen. */
|
|
2
|
+
export type NoticeSink = (message: string) => void;
|
|
3
|
+
/** A notice that waits until the surface can show it. */
|
|
4
|
+
export interface DeferredNotice {
|
|
5
|
+
/** Print through `sink` from now on, starting with anything held back. */
|
|
6
|
+
open(sink: NoticeSink): void;
|
|
7
|
+
/** Print the notice now, or hold it until {@link DeferredNotice.open}. */
|
|
8
|
+
post(message: string): void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hold a notice found before the alternate screen exists.
|
|
12
|
+
*
|
|
13
|
+
* The settings scope applies on its own schedule, so a section refused at boot
|
|
14
|
+
* is read either before the surface owns the screen or after it: one holder,
|
|
15
|
+
* opened when the screen is taken, keeps both orders honest — and a notice
|
|
16
|
+
* written to stderr alone would have been buried under the alternate screen.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createDeferredNotice(): DeferredNotice;
|
|
19
|
+
//# sourceMappingURL=settings-notice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-notice.d.ts","sourceRoot":"","sources":["../src/settings-notice.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;AAElD,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;IAC5B,0EAA0E;IAC1E,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAmBrD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hold a notice found before the alternate screen exists.
|
|
3
|
+
*
|
|
4
|
+
* The settings scope applies on its own schedule, so a section refused at boot
|
|
5
|
+
* is read either before the surface owns the screen or after it: one holder,
|
|
6
|
+
* opened when the screen is taken, keeps both orders honest — and a notice
|
|
7
|
+
* written to stderr alone would have been buried under the alternate screen.
|
|
8
|
+
*/
|
|
9
|
+
export function createDeferredNotice() {
|
|
10
|
+
let sink;
|
|
11
|
+
let pending;
|
|
12
|
+
return {
|
|
13
|
+
open(next) {
|
|
14
|
+
sink = next;
|
|
15
|
+
if (pending === undefined)
|
|
16
|
+
return;
|
|
17
|
+
const held = pending;
|
|
18
|
+
pending = undefined;
|
|
19
|
+
next(held);
|
|
20
|
+
},
|
|
21
|
+
post(message) {
|
|
22
|
+
if (sink === undefined) {
|
|
23
|
+
pending = message;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
sink(message);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=settings-notice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-notice.js","sourceRoot":"","sources":["../src/settings-notice.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,IAA4B,CAAA;IAChC,IAAI,OAA2B,CAAA;IAC/B,OAAO;QACL,IAAI,CAAC,IAAI;YACP,IAAI,GAAG,IAAI,CAAA;YACX,IAAI,OAAO,KAAK,SAAS;gBAAE,OAAM;YACjC,MAAM,IAAI,GAAG,OAAO,CAAA;YACpB,OAAO,GAAG,SAAS,CAAA;YACnB,IAAI,CAAC,IAAI,CAAC,CAAA;QACZ,CAAC;QACD,IAAI,CAAC,OAAO;YACV,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,GAAG,OAAO,CAAA;gBACjB,OAAM;YACR,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TuiAltScreen, type TuiStopOptions } from '@earendil-works/pi-tui';
|
|
2
|
+
/** Warning ownership follows screen ownership, including partial startup and repeated disposal. */
|
|
3
|
+
export declare class WarningSafeTui extends TuiAltScreen {
|
|
4
|
+
private releaseWarnings;
|
|
5
|
+
start(): void;
|
|
6
|
+
stop(options?: TuiStopOptions): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=warning-screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning-screen.d.ts","sourceRoot":"","sources":["../../src/terminal/warning-screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAmC1E,mGAAmG;AACnG,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,eAAe,CAA0B;IAExC,KAAK,IAAI,IAAI;IAUb,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;CAa9C"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { TuiAltScreen } from '@earendil-works/pi-tui';
|
|
2
|
+
const WARNING_EVENT = 'warning';
|
|
3
|
+
const RESTORE_SHELL = '\x1b[?1049l\x1b[0m\x1b[?7h\x1b[?25h';
|
|
4
|
+
/** Node's default warning listener writes outside the renderer, so delivery must wait for the shell. */
|
|
5
|
+
function deferWarnings() {
|
|
6
|
+
const emit = process.emit;
|
|
7
|
+
const pending = [];
|
|
8
|
+
let active = true;
|
|
9
|
+
const deferredEmit = function (event, ...args) {
|
|
10
|
+
if (active && this === process && event === WARNING_EVENT) {
|
|
11
|
+
pending.push(args);
|
|
12
|
+
return process.listenerCount(WARNING_EVENT) > 0;
|
|
13
|
+
}
|
|
14
|
+
return Reflect.apply(emit, this, [event, ...args]);
|
|
15
|
+
};
|
|
16
|
+
process.emit = deferredEmit;
|
|
17
|
+
return () => {
|
|
18
|
+
if (!active)
|
|
19
|
+
return;
|
|
20
|
+
active = false;
|
|
21
|
+
// A later wrapper may own the slot; its retained reference must become a pass-through instead.
|
|
22
|
+
if (process.emit === deferredEmit)
|
|
23
|
+
process.emit = emit;
|
|
24
|
+
const failures = [];
|
|
25
|
+
for (const args of pending.splice(0)) {
|
|
26
|
+
try {
|
|
27
|
+
Reflect.apply(emit, process, [WARNING_EVENT, ...args]);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
failures.push(error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (failures.length > 0)
|
|
34
|
+
throw failures[0];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Warning ownership follows screen ownership, including partial startup and repeated disposal. */
|
|
38
|
+
export class WarningSafeTui extends TuiAltScreen {
|
|
39
|
+
releaseWarnings;
|
|
40
|
+
start() {
|
|
41
|
+
this.releaseWarnings ??= deferWarnings();
|
|
42
|
+
try {
|
|
43
|
+
super.start();
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
this.stop({ preserveScreen: true });
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
stop(options) {
|
|
51
|
+
try {
|
|
52
|
+
super.stop(options);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// Rendering the final transcript can fail before pi-tui writes its alternate-screen exit.
|
|
56
|
+
this.terminal.write(RESTORE_SHELL);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
const release = this.releaseWarnings;
|
|
61
|
+
this.releaseWarnings = undefined;
|
|
62
|
+
release?.();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=warning-screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning-screen.js","sourceRoot":"","sources":["../../src/terminal/warning-screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,wBAAwB,CAAA;AAE1E,MAAM,aAAa,GAAG,SAAS,CAAA;AAC/B,MAAM,aAAa,GAAG,qCAAqC,CAAA;AAE3D,wGAAwG;AACxG,SAAS,aAAa;IACpB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IACzB,MAAM,OAAO,GAAgB,EAAE,CAAA;IAC/B,IAAI,MAAM,GAAG,IAAI,CAAA;IACjB,MAAM,YAAY,GAAG,UAAgC,KAAsB,EAAE,GAAG,IAAe;QAC7F,IAAI,MAAM,IAAI,IAAI,KAAK,OAAO,IAAI,KAAK,KAAK,aAAa,EAAE,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAClB,OAAO,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;QACjD,CAAC;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAY,CAAA;IAC/D,CAAwB,CAAA;IACxB,OAAO,CAAC,IAAI,GAAG,YAAY,CAAA;IAC3B,OAAO,GAAG,EAAE;QACV,IAAI,CAAC,MAAM;YAAE,OAAM;QACnB,MAAM,GAAG,KAAK,CAAA;QACd,+FAA+F;QAC/F,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY;YAAE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;QACtD,MAAM,QAAQ,GAAc,EAAE,CAAA;QAC9B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;YACxD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC5C,CAAC,CAAA;AACH,CAAC;AAED,mGAAmG;AACnG,MAAM,OAAO,cAAe,SAAQ,YAAY;IACtC,eAAe,CAA0B;IAExC,KAAK;QACZ,IAAI,CAAC,eAAe,KAAK,aAAa,EAAE,CAAA;QACxC,IAAI,CAAC;YACH,KAAK,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAA;YACnC,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAEQ,IAAI,CAAC,OAAwB;QACpC,IAAI,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0FAA0F;YAC1F,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;YAClC,MAAM,KAAK,CAAA;QACb,CAAC;gBAAS,CAAC;YACT,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAA;YACpC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAA;YAChC,OAAO,EAAE,EAAE,CAAA;QACb,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** How much colour the terminal can be trusted with. */
|
|
2
|
+
export type ColourMode = 'truecolor' | '256' | '16' | 'none';
|
|
3
|
+
/** An ANSI palette index, 0-255. */
|
|
4
|
+
export type AnsiIndex = number;
|
|
5
|
+
/** An RGB triple. */
|
|
6
|
+
export interface Rgb {
|
|
7
|
+
readonly r: number;
|
|
8
|
+
readonly g: number;
|
|
9
|
+
readonly b: number;
|
|
10
|
+
}
|
|
11
|
+
/** A parsed colour: an RGB triple, or a palette index. */
|
|
12
|
+
export type ParsedColour = Rgb | AnsiIndex;
|
|
13
|
+
/** Which layer an SGR colour code addresses. */
|
|
14
|
+
export type ColourLayer = 'fg' | 'bg';
|
|
15
|
+
/**
|
|
16
|
+
* Decide the colour budget from the environment.
|
|
17
|
+
*
|
|
18
|
+
* `NO_COLOR` is the cross-tool convention (no-color.org) and outranks every
|
|
19
|
+
* capability: a reader who set it wants no styling from any tool in the session.
|
|
20
|
+
* `COLORTERM` is what terminals actually set for 24-bit, and `TERM` only proves
|
|
21
|
+
* 256, so truecolor is checked first.
|
|
22
|
+
*/
|
|
23
|
+
export declare function detectColourMode(env: Record<string, string | undefined>): ColourMode;
|
|
24
|
+
/** Parse a colour specification, or `undefined` when it is not one. */
|
|
25
|
+
export declare function parseColour(spec: string | number): ParsedColour | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The SGR prefix that starts a foreground colour, or empty when colour is off.
|
|
28
|
+
*
|
|
29
|
+
* Degrading a chosen shade to the nearest available slot keeps the reader's
|
|
30
|
+
* intent on a weaker terminal, which matters more for text that is meant to
|
|
31
|
+
* recede than exactness does.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sgrPrefix(spec: string | number, mode: ColourMode): string;
|
|
34
|
+
/** The SGR prefix that starts a background colour, or empty when colour is off. */
|
|
35
|
+
export declare function sgrBackgroundPrefix(spec: string | number, mode: ColourMode): string;
|
|
36
|
+
//# sourceMappingURL=theme-capability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-capability.d.ts","sourceRoot":"","sources":["../src/theme-capability.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,CAAA;AAE5D,oCAAoC;AACpC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B,qBAAqB;AACrB,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,0DAA0D;AAC1D,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,SAAS,CAAA;AAE1C,gDAAgD;AAChD,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAA;AA+CrC;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,UAAU,CAUpF;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,CAQ3E;AA8FD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAEzE;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnF"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
const HEX = /^#([0-9a-f]{6})$/iu;
|
|
2
|
+
const MAX_INDEX = 255;
|
|
3
|
+
const HEX_MAX = 0xff;
|
|
4
|
+
const CUBE_LEVELS = 5;
|
|
5
|
+
const MID_GREY = 128;
|
|
6
|
+
/** The base SGR codes for a layer, normal and bright. */
|
|
7
|
+
const FG_NORMAL = 30;
|
|
8
|
+
const FG_BRIGHT = 90;
|
|
9
|
+
const BG_NORMAL = 40;
|
|
10
|
+
const BG_BRIGHT = 100;
|
|
11
|
+
/** Indices 0-15 are the base slots; above that an index names a 256-colour entry. */
|
|
12
|
+
const BASE_COLOURS = 16;
|
|
13
|
+
const CUBE_BASE = 16;
|
|
14
|
+
const CUBE_SIDE = 6;
|
|
15
|
+
const CUBE_SQUARES = 36;
|
|
16
|
+
const GREY_BASE = 232;
|
|
17
|
+
const GREY_START = 8;
|
|
18
|
+
const GREY_STEP = 10;
|
|
19
|
+
/** The xterm cube is not linear at the dark end, so its six levels are a table. */
|
|
20
|
+
const CUBE_RGB = [0, 95, 135, 175, 215, 255];
|
|
21
|
+
/** The six hue slots of the base palette, by which channel dominates. */
|
|
22
|
+
const HUE_RED = 1;
|
|
23
|
+
const HUE_GREEN = 2;
|
|
24
|
+
const HUE_YELLOW = 3;
|
|
25
|
+
const HUE_BLUE = 4;
|
|
26
|
+
const HUE_MAGENTA = 5;
|
|
27
|
+
const HUE_CYAN = 6;
|
|
28
|
+
const WHITE_SLOT = 7;
|
|
29
|
+
const BRIGHT_BLACK_SLOT = 8;
|
|
30
|
+
const BRIGHT_WHITE_SLOT = 15;
|
|
31
|
+
/**
|
|
32
|
+
* A colour this far from grey keeps its hue family when degraded to 16 colours.
|
|
33
|
+
*
|
|
34
|
+
* A luminance average alone sent the muted green additions to black on a dark
|
|
35
|
+
* terminal, which is the failure this threshold exists to prevent.
|
|
36
|
+
*/
|
|
37
|
+
const GREY_CHROMA = 30;
|
|
38
|
+
/** Luma boundaries between the four grey slots a degrade may pick. */
|
|
39
|
+
const GREY_BLACK_MAX = 64;
|
|
40
|
+
const GREY_LIGHT_MAX = 160;
|
|
41
|
+
const GREY_WHITE_MAX = 224;
|
|
42
|
+
/**
|
|
43
|
+
* Decide the colour budget from the environment.
|
|
44
|
+
*
|
|
45
|
+
* `NO_COLOR` is the cross-tool convention (no-color.org) and outranks every
|
|
46
|
+
* capability: a reader who set it wants no styling from any tool in the session.
|
|
47
|
+
* `COLORTERM` is what terminals actually set for 24-bit, and `TERM` only proves
|
|
48
|
+
* 256, so truecolor is checked first.
|
|
49
|
+
*/
|
|
50
|
+
export function detectColourMode(env) {
|
|
51
|
+
const noColor = env.NO_COLOR;
|
|
52
|
+
if (noColor !== undefined && noColor !== '')
|
|
53
|
+
return 'none';
|
|
54
|
+
// `dumb` declares a terminal with no capabilities at all, so nothing below
|
|
55
|
+
// can be trusted; NO_COLOR is not the only way to say "no styling here".
|
|
56
|
+
if ((env.TERM ?? '') === 'dumb')
|
|
57
|
+
return 'none';
|
|
58
|
+
const colorterm = env.COLORTERM ?? '';
|
|
59
|
+
if (colorterm === 'truecolor' || colorterm === '24bit')
|
|
60
|
+
return 'truecolor';
|
|
61
|
+
if ((env.TERM ?? '').includes('256color'))
|
|
62
|
+
return '256';
|
|
63
|
+
return '16';
|
|
64
|
+
}
|
|
65
|
+
/** Parse a colour specification, or `undefined` when it is not one. */
|
|
66
|
+
export function parseColour(spec) {
|
|
67
|
+
if (typeof spec === 'number') {
|
|
68
|
+
return Number.isInteger(spec) && spec >= 0 && spec <= MAX_INDEX ? spec : undefined;
|
|
69
|
+
}
|
|
70
|
+
const match = HEX.exec(spec);
|
|
71
|
+
if (match === null)
|
|
72
|
+
return undefined;
|
|
73
|
+
const value = Number.parseInt(match[1] ?? '', 16);
|
|
74
|
+
return { r: (value >> 16) & HEX_MAX, g: (value >> 8) & HEX_MAX, b: value & HEX_MAX };
|
|
75
|
+
}
|
|
76
|
+
/** The SGR code for one of the 16 base slots. */
|
|
77
|
+
function slotCode(slot, layer) {
|
|
78
|
+
const normal = layer === 'fg' ? FG_NORMAL : BG_NORMAL;
|
|
79
|
+
const bright = layer === 'fg' ? FG_BRIGHT : BG_BRIGHT;
|
|
80
|
+
if (slot >= 0 && slot <= WHITE_SLOT)
|
|
81
|
+
return normal + slot;
|
|
82
|
+
if (slot > WHITE_SLOT && slot <= BRIGHT_WHITE_SLOT)
|
|
83
|
+
return bright + (slot - 8);
|
|
84
|
+
return normal;
|
|
85
|
+
}
|
|
86
|
+
/** The nearest 256-colour cube index for a triple. */
|
|
87
|
+
function cubeIndex(rgb) {
|
|
88
|
+
const level = (value) => Math.round((value / HEX_MAX) * CUBE_LEVELS);
|
|
89
|
+
return 16 + 36 * level(rgb.r) + 6 * level(rgb.g) + level(rgb.b);
|
|
90
|
+
}
|
|
91
|
+
/** The triple a 256-colour index names, for degradation to the base palette. */
|
|
92
|
+
function indexToRgb(index) {
|
|
93
|
+
if (index >= GREY_BASE) {
|
|
94
|
+
const value = GREY_START + (index - GREY_BASE) * GREY_STEP;
|
|
95
|
+
return { r: value, g: value, b: value };
|
|
96
|
+
}
|
|
97
|
+
const cube = index - CUBE_BASE;
|
|
98
|
+
const top = Math.floor(cube / CUBE_SQUARES);
|
|
99
|
+
const middle = Math.floor((cube % CUBE_SQUARES) / CUBE_SIDE);
|
|
100
|
+
const bottom = cube % CUBE_SIDE;
|
|
101
|
+
return {
|
|
102
|
+
r: CUBE_RGB[top] ?? 0,
|
|
103
|
+
g: CUBE_RGB[middle] ?? 0,
|
|
104
|
+
b: CUBE_RGB[bottom] ?? 0,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The hue slot a non-grey triple belongs to.
|
|
109
|
+
*
|
|
110
|
+
* A secondary channel close to the leading one is the mixed hue (amber, sky,
|
|
111
|
+
* pink), which is why the band exists: without it the amber warning read as
|
|
112
|
+
* plain red on a 16-colour terminal.
|
|
113
|
+
*/
|
|
114
|
+
function hueSlot(rgb) {
|
|
115
|
+
const max = Math.max(rgb.r, rgb.g, rgb.b);
|
|
116
|
+
const min = Math.min(rgb.r, rgb.g, rgb.b);
|
|
117
|
+
const band = (max - min) / 2;
|
|
118
|
+
if (rgb.b === min && Math.abs(rgb.r - rgb.g) < band)
|
|
119
|
+
return HUE_YELLOW;
|
|
120
|
+
if (rgb.r === min && Math.abs(rgb.g - rgb.b) < band)
|
|
121
|
+
return HUE_CYAN;
|
|
122
|
+
if (rgb.g === min && Math.abs(rgb.r - rgb.b) < band)
|
|
123
|
+
return HUE_MAGENTA;
|
|
124
|
+
if (rgb.r === max)
|
|
125
|
+
return HUE_RED;
|
|
126
|
+
if (rgb.g === max)
|
|
127
|
+
return HUE_GREEN;
|
|
128
|
+
return HUE_BLUE;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The nearest base-palette slot for a triple.
|
|
132
|
+
*
|
|
133
|
+
* Greys pick a grey slot, so "recede" survives on a 16-colour terminal, and a
|
|
134
|
+
* colour keeps its hue family so an addition stays green; collapsing both onto
|
|
135
|
+
* black or white is what made the degraded palette unreadable.
|
|
136
|
+
*/
|
|
137
|
+
function degradeTo16(rgb) {
|
|
138
|
+
const max = Math.max(rgb.r, rgb.g, rgb.b);
|
|
139
|
+
const min = Math.min(rgb.r, rgb.g, rgb.b);
|
|
140
|
+
const level = Math.round((rgb.r + rgb.g + rgb.b) / 3);
|
|
141
|
+
if (max - min < GREY_CHROMA) {
|
|
142
|
+
if (level >= GREY_WHITE_MAX)
|
|
143
|
+
return BRIGHT_WHITE_SLOT;
|
|
144
|
+
if (level >= GREY_LIGHT_MAX)
|
|
145
|
+
return WHITE_SLOT;
|
|
146
|
+
if (level >= GREY_BLACK_MAX)
|
|
147
|
+
return BRIGHT_BLACK_SLOT;
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
const slot = hueSlot(rgb);
|
|
151
|
+
return level >= MID_GREY ? slot + 8 : slot;
|
|
152
|
+
}
|
|
153
|
+
/** The SGR sequence that starts a colour on one layer, or empty when there is none. */
|
|
154
|
+
function colourSgr(spec, mode, layer) {
|
|
155
|
+
if (mode === 'none')
|
|
156
|
+
return '';
|
|
157
|
+
const parsed = parseColour(spec);
|
|
158
|
+
if (parsed === undefined)
|
|
159
|
+
return '';
|
|
160
|
+
const extended = layer === 'fg' ? 38 : 48;
|
|
161
|
+
if (typeof parsed === 'number') {
|
|
162
|
+
// A base slot is itself a 16-colour code; only a 16-colour terminal has to
|
|
163
|
+
// degrade a 256 entry, and a 24-bit terminal can address it directly.
|
|
164
|
+
if (mode === '16') {
|
|
165
|
+
const slot = parsed < BASE_COLOURS ? parsed : degradeTo16(indexToRgb(parsed));
|
|
166
|
+
return `\u001B[${slotCode(slot, layer)}m`;
|
|
167
|
+
}
|
|
168
|
+
return `\u001B[${extended};5;${parsed}m`;
|
|
169
|
+
}
|
|
170
|
+
if (mode === 'truecolor')
|
|
171
|
+
return `\u001B[${extended};2;${parsed.r};${parsed.g};${parsed.b}m`;
|
|
172
|
+
if (mode === '256')
|
|
173
|
+
return `\u001B[${extended};5;${cubeIndex(parsed)}m`;
|
|
174
|
+
return `\u001B[${slotCode(degradeTo16(parsed), layer)}m`;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The SGR prefix that starts a foreground colour, or empty when colour is off.
|
|
178
|
+
*
|
|
179
|
+
* Degrading a chosen shade to the nearest available slot keeps the reader's
|
|
180
|
+
* intent on a weaker terminal, which matters more for text that is meant to
|
|
181
|
+
* recede than exactness does.
|
|
182
|
+
*/
|
|
183
|
+
export function sgrPrefix(spec, mode) {
|
|
184
|
+
return colourSgr(spec, mode, 'fg');
|
|
185
|
+
}
|
|
186
|
+
/** The SGR prefix that starts a background colour, or empty when colour is off. */
|
|
187
|
+
export function sgrBackgroundPrefix(spec, mode) {
|
|
188
|
+
return colourSgr(spec, mode, 'bg');
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=theme-capability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-capability.js","sourceRoot":"","sources":["../src/theme-capability.ts"],"names":[],"mappings":"AAmBA,MAAM,GAAG,GAAG,oBAAoB,CAAA;AAChC,MAAM,SAAS,GAAG,GAAG,CAAA;AACrB,MAAM,OAAO,GAAG,IAAI,CAAA;AACpB,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,MAAM,QAAQ,GAAG,GAAG,CAAA;AAEpB,yDAAyD;AACzD,MAAM,SAAS,GAAG,EAAE,CAAA;AACpB,MAAM,SAAS,GAAG,EAAE,CAAA;AACpB,MAAM,S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C3E,sEAAsE;QACtE,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,GAAG,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;YAC7E,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAA;QAC3C,CAAC;QACD,OAAO,UAAU,QAAQ,MAAM,MAAM,GAAG,CAAA;IAC1C,CAAC;IACD,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,UAAU,QAAQ,MAAM,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAA;IAC5F,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,UAAU,QAAQ,MAAM,SAAS,CAAC,MAAM,CAAC,GAAG,CAAA;IACvE,OAAO,UAAU,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAA;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAqB,EAAE,IAAgB;IAC/D,OAAO,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACpC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,mBAAmB,CAAC,IAAqB,EAAE,IAAgB;IACzE,OAAO,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ThemeOverrides } from './theme-settings.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The effective table, one line per element.
|
|
4
|
+
*
|
|
5
|
+
* The token name comes first because it is what the reader types into
|
|
6
|
+
* settings.yaml; the origin comes last because it is what explains the value
|
|
7
|
+
* when the value is not what they expected.
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderThemeTable(overrides: ThemeOverrides): string[];
|
|
10
|
+
//# sourceMappingURL=theme-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-command.d.ts","sourceRoot":"","sources":["../src/theme-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAwCzD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,cAAc,GAAG,MAAM,EAAE,CAepE"}
|