@agentick/tui 0.5.0 → 0.7.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 +164 -21
- package/dist/commands-context.d.ts +10 -0
- package/dist/commands-context.d.ts.map +1 -0
- package/dist/commands-context.js +10 -0
- package/dist/commands-context.js.map +1 -0
- package/dist/commands.d.ts +30 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +165 -0
- package/dist/commands.js.map +1 -0
- package/dist/components/CompletionPicker.d.ts +12 -0
- package/dist/components/CompletionPicker.d.ts.map +1 -0
- package/dist/components/CompletionPicker.js +41 -0
- package/dist/components/CompletionPicker.js.map +1 -0
- package/dist/components/DiffView.d.ts +21 -0
- package/dist/components/DiffView.d.ts.map +1 -0
- package/dist/components/DiffView.js +94 -0
- package/dist/components/DiffView.js.map +1 -0
- package/dist/components/ErrorDisplay.d.ts +6 -6
- package/dist/components/ErrorDisplay.d.ts.map +1 -1
- package/dist/components/ErrorDisplay.js +6 -8
- package/dist/components/ErrorDisplay.js.map +1 -1
- package/dist/components/InputBar.d.ts +8 -17
- package/dist/components/InputBar.d.ts.map +1 -1
- package/dist/components/InputBar.js +7 -22
- package/dist/components/InputBar.js.map +1 -1
- package/dist/components/MessageList.d.ts +11 -6
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +37 -54
- package/dist/components/MessageList.js.map +1 -1
- package/dist/components/RichTextInput.d.ts +14 -0
- package/dist/components/RichTextInput.d.ts.map +1 -0
- package/dist/components/RichTextInput.js +24 -0
- package/dist/components/RichTextInput.js.map +1 -0
- package/dist/components/ToolCallIndicator.d.ts.map +1 -1
- package/dist/components/ToolCallIndicator.js +12 -5
- package/dist/components/ToolCallIndicator.js.map +1 -1
- package/dist/components/ToolConfirmationPrompt.d.ts +9 -6
- package/dist/components/ToolConfirmationPrompt.d.ts.map +1 -1
- package/dist/components/ToolConfirmationPrompt.js +18 -19
- package/dist/components/ToolConfirmationPrompt.js.map +1 -1
- package/dist/components/status-bar/DefaultStatusBar.d.ts +20 -0
- package/dist/components/status-bar/DefaultStatusBar.d.ts.map +1 -0
- package/dist/components/status-bar/DefaultStatusBar.js +11 -0
- package/dist/components/status-bar/DefaultStatusBar.js.map +1 -0
- package/dist/components/status-bar/StatusBar.d.ts +22 -0
- package/dist/components/status-bar/StatusBar.d.ts.map +1 -0
- package/dist/components/status-bar/StatusBar.js +16 -0
- package/dist/components/status-bar/StatusBar.js.map +1 -0
- package/dist/components/status-bar/StatusBarRight.d.ts +12 -0
- package/dist/components/status-bar/StatusBarRight.d.ts.map +1 -0
- package/dist/components/status-bar/StatusBarRight.js +29 -0
- package/dist/components/status-bar/StatusBarRight.js.map +1 -0
- package/dist/components/status-bar/context.d.ts +27 -0
- package/dist/components/status-bar/context.d.ts.map +1 -0
- package/dist/components/status-bar/context.js +18 -0
- package/dist/components/status-bar/context.js.map +1 -0
- package/dist/components/status-bar/index.d.ts +5 -0
- package/dist/components/status-bar/index.d.ts.map +1 -0
- package/dist/components/status-bar/index.js +5 -0
- package/dist/components/status-bar/index.js.map +1 -0
- package/dist/components/status-bar/widgets/BrandLabel.d.ts +8 -0
- package/dist/components/status-bar/widgets/BrandLabel.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/BrandLabel.js +6 -0
- package/dist/components/status-bar/widgets/BrandLabel.js.map +1 -0
- package/dist/components/status-bar/widgets/ContextUtilization.d.ts +11 -0
- package/dist/components/status-bar/widgets/ContextUtilization.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/ContextUtilization.js +12 -0
- package/dist/components/status-bar/widgets/ContextUtilization.js.map +1 -0
- package/dist/components/status-bar/widgets/KeyboardHints.d.ts +16 -0
- package/dist/components/status-bar/widgets/KeyboardHints.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/KeyboardHints.js +25 -0
- package/dist/components/status-bar/widgets/KeyboardHints.js.map +1 -0
- package/dist/components/status-bar/widgets/ModelInfo.d.ts +7 -0
- package/dist/components/status-bar/widgets/ModelInfo.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/ModelInfo.js +10 -0
- package/dist/components/status-bar/widgets/ModelInfo.js.map +1 -0
- package/dist/components/status-bar/widgets/Separator.d.ts +7 -0
- package/dist/components/status-bar/widgets/Separator.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/Separator.js +6 -0
- package/dist/components/status-bar/widgets/Separator.js.map +1 -0
- package/dist/components/status-bar/widgets/StateIndicator.d.ts +12 -0
- package/dist/components/status-bar/widgets/StateIndicator.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/StateIndicator.js +21 -0
- package/dist/components/status-bar/widgets/StateIndicator.js.map +1 -0
- package/dist/components/status-bar/widgets/TickCount.d.ts +9 -0
- package/dist/components/status-bar/widgets/TickCount.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/TickCount.js +11 -0
- package/dist/components/status-bar/widgets/TickCount.js.map +1 -0
- package/dist/components/status-bar/widgets/TokenCount.d.ts +12 -0
- package/dist/components/status-bar/widgets/TokenCount.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/TokenCount.js +28 -0
- package/dist/components/status-bar/widgets/TokenCount.js.map +1 -0
- package/dist/components/status-bar/widgets/index.d.ts +9 -0
- package/dist/components/status-bar/widgets/index.d.ts.map +1 -0
- package/dist/components/status-bar/widgets/index.js +9 -0
- package/dist/components/status-bar/widgets/index.js.map +1 -0
- package/dist/create-tui.d.ts +5 -0
- package/dist/create-tui.d.ts.map +1 -1
- package/dist/create-tui.js +15 -12
- package/dist/create-tui.js.map +1 -1
- package/dist/hooks/use-double-ctrl-c.d.ts +5 -0
- package/dist/hooks/use-double-ctrl-c.d.ts.map +1 -0
- package/dist/hooks/use-double-ctrl-c.js +32 -0
- package/dist/hooks/use-double-ctrl-c.js.map +1 -0
- package/dist/hooks/use-line-editor.d.ts +26 -0
- package/dist/hooks/use-line-editor.d.ts.map +1 -0
- package/dist/hooks/use-line-editor.js +63 -0
- package/dist/hooks/use-line-editor.js.map +1 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/input-utils.d.ts +15 -0
- package/dist/input-utils.d.ts.map +1 -0
- package/dist/input-utils.js +29 -0
- package/dist/input-utils.js.map +1 -0
- package/dist/rendering/content-block.d.ts +12 -0
- package/dist/rendering/content-block.d.ts.map +1 -0
- package/dist/rendering/content-block.js +82 -0
- package/dist/rendering/content-block.js.map +1 -0
- package/dist/rendering/index.d.ts +5 -0
- package/dist/rendering/index.d.ts.map +1 -0
- package/dist/rendering/index.js +5 -0
- package/dist/rendering/index.js.map +1 -0
- package/dist/rendering/markdown.d.ts +14 -0
- package/dist/rendering/markdown.d.ts.map +1 -0
- package/dist/rendering/markdown.js +61 -0
- package/dist/rendering/markdown.js.map +1 -0
- package/dist/rendering/message.d.ts +25 -0
- package/dist/rendering/message.d.ts.map +1 -0
- package/dist/rendering/message.js +54 -0
- package/dist/rendering/message.js.map +1 -0
- package/dist/rendering/theme.d.ts +37 -0
- package/dist/rendering/theme.d.ts.map +1 -0
- package/dist/rendering/theme.js +49 -0
- package/dist/rendering/theme.js.map +1 -0
- package/dist/ui/chat.d.ts +26 -4
- package/dist/ui/chat.d.ts.map +1 -1
- package/dist/ui/chat.js +91 -68
- package/dist/ui/chat.js.map +1 -1
- package/package.json +11 -6
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState, useCallback, useRef } from "react";
|
|
2
|
+
const EXIT_WINDOW_MS = 2000;
|
|
3
|
+
export function useDoubleCtrlC(onExit) {
|
|
4
|
+
const [showExitHint, setShowExitHint] = useState(false);
|
|
5
|
+
const timerRef = useRef(null);
|
|
6
|
+
const firstPressRef = useRef(false);
|
|
7
|
+
const handleCtrlC = useCallback((isStreaming, onAbort) => {
|
|
8
|
+
if (isStreaming) {
|
|
9
|
+
onAbort();
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (firstPressRef.current) {
|
|
13
|
+
// Second press within window — exit
|
|
14
|
+
if (timerRef.current)
|
|
15
|
+
clearTimeout(timerRef.current);
|
|
16
|
+
firstPressRef.current = false;
|
|
17
|
+
setShowExitHint(false);
|
|
18
|
+
onExit();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// First press — show hint, start timer
|
|
22
|
+
firstPressRef.current = true;
|
|
23
|
+
setShowExitHint(true);
|
|
24
|
+
timerRef.current = setTimeout(() => {
|
|
25
|
+
firstPressRef.current = false;
|
|
26
|
+
setShowExitHint(false);
|
|
27
|
+
timerRef.current = null;
|
|
28
|
+
}, EXIT_WINDOW_MS);
|
|
29
|
+
}, [onExit]);
|
|
30
|
+
return { handleCtrlC, showExitHint };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=use-double-ctrl-c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-double-ctrl-c.js","sourceRoot":"","sources":["../../src/hooks/use-double-ctrl-c.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,UAAU,cAAc,CAAC,MAAkB;IAC/C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpC,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,WAAoB,EAAE,OAAmB,EAAE,EAAE;QAC5C,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QAED,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;YAC1B,oCAAoC;YACpC,IAAI,QAAQ,CAAC,OAAO;gBAAE,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACrD,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;YAC9B,eAAe,CAAC,KAAK,CAAC,CAAC;YACvB,MAAM,EAAE,CAAC;YACT,OAAO;QACT,CAAC;QAED,uCAAuC;QACvC,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;QAC7B,eAAe,CAAC,IAAI,CAAC,CAAC;QAEtB,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YACjC,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;YAC9B,eAAe,CAAC,KAAK,CAAC,CAAC;YACvB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1B,CAAC,EAAE,cAAc,CAAC,CAAC;IACrB,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useLineEditor — Ink-specific wrapper around @agentick/client's LineEditor.
|
|
3
|
+
*
|
|
4
|
+
* Converts Ink's (input, Key) pairs to normalized keystroke strings,
|
|
5
|
+
* then delegates to the framework-agnostic LineEditor class.
|
|
6
|
+
*/
|
|
7
|
+
import type { Key } from "ink";
|
|
8
|
+
import { LineEditor } from "@agentick/client";
|
|
9
|
+
import type { CompletionState, CompletedRange } from "@agentick/client";
|
|
10
|
+
export interface UseLineEditorOptions {
|
|
11
|
+
onSubmit: (value: string) => void;
|
|
12
|
+
bindings?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface LineEditorResult {
|
|
15
|
+
value: string;
|
|
16
|
+
cursor: number;
|
|
17
|
+
completion: CompletionState | null;
|
|
18
|
+
completedRanges: readonly CompletedRange[];
|
|
19
|
+
setValue: (value: string) => void;
|
|
20
|
+
clear: () => void;
|
|
21
|
+
handleInput: (input: string, key: Key) => void;
|
|
22
|
+
editor: LineEditor;
|
|
23
|
+
}
|
|
24
|
+
export declare function normalizeInkKeystroke(input: string, key: Key): string | null;
|
|
25
|
+
export declare function useLineEditor({ onSubmit, bindings }: UseLineEditorOptions): LineEditorResult;
|
|
26
|
+
//# sourceMappingURL=use-line-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-line-editor.d.ts","sourceRoot":"","sources":["../../src/hooks/use-line-editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIxE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/C,MAAM,EAAE,UAAU,CAAC;CACpB;AAID,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAa5E;AAID,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,gBAAgB,CAuC5F"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useLineEditor — Ink-specific wrapper around @agentick/client's LineEditor.
|
|
3
|
+
*
|
|
4
|
+
* Converts Ink's (input, Key) pairs to normalized keystroke strings,
|
|
5
|
+
* then delegates to the framework-agnostic LineEditor class.
|
|
6
|
+
*/
|
|
7
|
+
import { useMemo, useEffect, useCallback, useRef, useSyncExternalStore } from "react";
|
|
8
|
+
import { LineEditor } from "@agentick/client";
|
|
9
|
+
// ── Ink key normalization ───────────────────────────────────────────────────
|
|
10
|
+
export function normalizeInkKeystroke(input, key) {
|
|
11
|
+
if (key.return)
|
|
12
|
+
return "return";
|
|
13
|
+
if (key.upArrow)
|
|
14
|
+
return "up";
|
|
15
|
+
if (key.downArrow)
|
|
16
|
+
return "down";
|
|
17
|
+
if (key.leftArrow)
|
|
18
|
+
return key.meta ? "meta+left" : "left";
|
|
19
|
+
if (key.rightArrow)
|
|
20
|
+
return key.meta ? "meta+right" : "right";
|
|
21
|
+
if (key.backspace)
|
|
22
|
+
return "backspace";
|
|
23
|
+
if (key.delete)
|
|
24
|
+
return "delete";
|
|
25
|
+
if (key.tab)
|
|
26
|
+
return "tab";
|
|
27
|
+
if (key.escape)
|
|
28
|
+
return "escape";
|
|
29
|
+
if (key.ctrl && input)
|
|
30
|
+
return `ctrl+${input}`;
|
|
31
|
+
if (key.meta && input)
|
|
32
|
+
return `meta+${input}`;
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
// ── Hook ────────────────────────────────────────────────────────────────────
|
|
36
|
+
export function useLineEditor({ onSubmit, bindings }) {
|
|
37
|
+
const onSubmitRef = useRef(onSubmit);
|
|
38
|
+
onSubmitRef.current = onSubmit;
|
|
39
|
+
const editor = useMemo(() => new LineEditor({ onSubmit: (v) => onSubmitRef.current(v), bindings }), []);
|
|
40
|
+
useEffect(() => () => editor.destroy(), [editor]);
|
|
41
|
+
const state = useSyncExternalStore(useCallback((cb) => editor.onStateChange(cb), [editor]), () => editor.state);
|
|
42
|
+
const handleInput = useCallback((input, key) => {
|
|
43
|
+
// Let Ctrl+C pass through — never consume it
|
|
44
|
+
if (key.ctrl && input === "c")
|
|
45
|
+
return;
|
|
46
|
+
// Let Ctrl+L pass through (clear screen)
|
|
47
|
+
if (key.ctrl && input === "l")
|
|
48
|
+
return;
|
|
49
|
+
const keystroke = normalizeInkKeystroke(input, key);
|
|
50
|
+
editor.handleInput(keystroke, input);
|
|
51
|
+
}, [editor]);
|
|
52
|
+
return {
|
|
53
|
+
value: state.value,
|
|
54
|
+
cursor: state.cursor,
|
|
55
|
+
completion: state.completion,
|
|
56
|
+
completedRanges: state.completedRanges,
|
|
57
|
+
setValue: useCallback((v) => editor.setValue(v), [editor]),
|
|
58
|
+
clear: useCallback(() => editor.clear(), [editor]),
|
|
59
|
+
handleInput,
|
|
60
|
+
editor,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=use-line-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-line-editor.js","sourceRoot":"","sources":["../../src/hooks/use-line-editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqB9C,+EAA+E;AAE/E,MAAM,UAAU,qBAAqB,CAAC,KAAa,EAAE,GAAQ;IAC3D,IAAI,GAAG,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IAChC,IAAI,GAAG,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC7B,IAAI,GAAG,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC;IACjC,IAAI,GAAG,CAAC,SAAS;QAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1D,IAAI,GAAG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,GAAG,WAAW,CAC7B,CAAC,KAAa,EAAE,GAAQ,EAAE,EAAE;QAC1B,6CAA6C;QAC7C,IAAI,GAAG,CAAC,IAAI,IAAI,KAAK,KAAK,GAAG;YAAE,OAAO;QACtC,yCAAyC;QACzC,IAAI,GAAG,CAAC,IAAI,IAAI,KAAK,KAAK,GAAG;YAAE,OAAO;QAEtC,MAAM,SAAS,GAAG,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACpD,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAClE,KAAK,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;QAClD,WAAW;QACX,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,12 +31,22 @@
|
|
|
31
31
|
* @module @agentick/tui
|
|
32
32
|
*/
|
|
33
33
|
export { createTUI, type TUIOptions, type TUIComponent } from "./create-tui.js";
|
|
34
|
-
export { Chat } from "./ui/chat.js";
|
|
34
|
+
export { Chat, type ChatStatusBarState } from "./ui/chat.js";
|
|
35
35
|
export { MessageList } from "./components/MessageList.js";
|
|
36
36
|
export { StreamingMessage } from "./components/StreamingMessage.js";
|
|
37
37
|
export { ToolCallIndicator } from "./components/ToolCallIndicator.js";
|
|
38
38
|
export { ToolConfirmationPrompt } from "./components/ToolConfirmationPrompt.js";
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
39
|
+
export { DiffView } from "./components/DiffView.js";
|
|
40
|
+
export { ErrorDisplay, type ErrorDisplayProps } from "./components/ErrorDisplay.js";
|
|
41
|
+
export { InputBar, type InputBarProps } from "./components/InputBar.js";
|
|
42
|
+
export { CompletionPicker, type CompletionPickerProps } from "./components/CompletionPicker.js";
|
|
43
|
+
export { RichTextInput } from "./components/RichTextInput.js";
|
|
44
|
+
export { useLineEditor, normalizeInkKeystroke, type UseLineEditorOptions, type LineEditorResult, } from "./hooks/use-line-editor.js";
|
|
45
|
+
export { useDoubleCtrlC } from "./hooks/use-double-ctrl-c.js";
|
|
46
|
+
export { handleConfirmationKey } from "./input-utils.js";
|
|
41
47
|
export { default as Spinner } from "ink-spinner";
|
|
48
|
+
export { StatusBar, type StatusBarProps, DefaultStatusBar, StatusBarContext, useStatusBarData, type StatusBarData, ModelInfo, TokenCount, TickCount, ContextUtilization, StateIndicator, KeyboardHints, type KeyboardHint, BrandLabel, Separator, } from "./components/status-bar/index.js";
|
|
49
|
+
export { useSlashCommands, helpCommand, clearCommand, exitCommand, loadCommand, createCommandCompletionSource, type SlashCommand, type CommandContext, } from "./commands.js";
|
|
50
|
+
export { CommandsProvider, useCommandsConfig } from "./commands-context.js";
|
|
51
|
+
export { theme, formatDuration, renderMarkdown, getTerminalWidth, renderContentBlock, renderToolCall, renderMessage, type RenderMessageOptions, type ToolCallInfo, } from "./rendering/index.js";
|
|
42
52
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGhF,OAAO,EAAE,IAAI,EAAE,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EACT,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,KAAK,YAAY,EACjB,UAAU,EACV,SAAS,GACV,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,6BAA6B,EAC7B,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EACL,KAAK,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,21 @@ export { MessageList } from "./components/MessageList.js";
|
|
|
38
38
|
export { StreamingMessage } from "./components/StreamingMessage.js";
|
|
39
39
|
export { ToolCallIndicator } from "./components/ToolCallIndicator.js";
|
|
40
40
|
export { ToolConfirmationPrompt } from "./components/ToolConfirmationPrompt.js";
|
|
41
|
+
export { DiffView } from "./components/DiffView.js";
|
|
41
42
|
export { ErrorDisplay } from "./components/ErrorDisplay.js";
|
|
42
43
|
export { InputBar } from "./components/InputBar.js";
|
|
44
|
+
export { CompletionPicker } from "./components/CompletionPicker.js";
|
|
45
|
+
export { RichTextInput } from "./components/RichTextInput.js";
|
|
46
|
+
export { useLineEditor, normalizeInkKeystroke, } from "./hooks/use-line-editor.js";
|
|
47
|
+
export { useDoubleCtrlC } from "./hooks/use-double-ctrl-c.js";
|
|
48
|
+
// Input routing utilities
|
|
49
|
+
export { handleConfirmationKey } from "./input-utils.js";
|
|
43
50
|
export { default as Spinner } from "ink-spinner";
|
|
51
|
+
// StatusBar — composable status bar system
|
|
52
|
+
export { StatusBar, DefaultStatusBar, StatusBarContext, useStatusBarData, ModelInfo, TokenCount, TickCount, ContextUtilization, StateIndicator, KeyboardHints, BrandLabel, Separator, } from "./components/status-bar/index.js";
|
|
53
|
+
// Slash commands
|
|
54
|
+
export { useSlashCommands, helpCommand, clearCommand, exitCommand, loadCommand, createCommandCompletionSource, } from "./commands.js";
|
|
55
|
+
export { CommandsProvider, useCommandsConfig } from "./commands-context.js";
|
|
56
|
+
// Rendering — ANSI-styled terminal output for messages and content blocks
|
|
57
|
+
export { theme, formatDuration, renderMarkdown, getTerminalWidth, renderContentBlock, renderToolCall, renderMessage, } from "./rendering/index.js";
|
|
44
58
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,SAAS,EAAsC,MAAM,iBAAiB,CAAC;AAEhF,eAAe;AACf,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,SAAS,EAAsC,MAAM,iBAAiB,CAAC;AAEhF,eAAe;AACf,OAAO,EAAE,IAAI,EAA2B,MAAM,cAAc,CAAC;AAE7D,uCAAuC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,EAA0B,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAsB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAA8B,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EACL,aAAa,EACb,qBAAqB,GAGtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,0BAA0B;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAEjD,2CAA2C;AAC3C,OAAO,EACL,SAAS,EAET,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAEhB,SAAS,EACT,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,aAAa,EAEb,UAAU,EACV,SAAS,GACV,MAAM,kCAAkC,CAAC;AAE1C,iBAAiB;AACjB,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,6BAA6B,GAG9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,0EAA0E;AAC1E,OAAO,EACL,KAAK,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,GAGd,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input routing utilities for centralized keystroke handling.
|
|
3
|
+
*
|
|
4
|
+
* These helpers let the orchestrator (Chat or custom TUI) route keystrokes
|
|
5
|
+
* to the appropriate handler based on application state.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolConfirmationResponse } from "@agentick/client";
|
|
8
|
+
/**
|
|
9
|
+
* Handle a keystroke during tool confirmation state.
|
|
10
|
+
*
|
|
11
|
+
* Routes Y/N/A keys to the respond callback. Returns true if the key
|
|
12
|
+
* was handled (consumed), false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
export declare function handleConfirmationKey(input: string, respond: (response: ToolConfirmationResponse) => void): boolean;
|
|
15
|
+
//# sourceMappingURL=input-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-utils.d.ts","sourceRoot":"","sources":["../src/input-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,QAAQ,EAAE,wBAAwB,KAAK,IAAI,GACpD,OAAO,CAeT"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input routing utilities for centralized keystroke handling.
|
|
3
|
+
*
|
|
4
|
+
* These helpers let the orchestrator (Chat or custom TUI) route keystrokes
|
|
5
|
+
* to the appropriate handler based on application state.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Handle a keystroke during tool confirmation state.
|
|
9
|
+
*
|
|
10
|
+
* Routes Y/N/A keys to the respond callback. Returns true if the key
|
|
11
|
+
* was handled (consumed), false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export function handleConfirmationKey(input, respond) {
|
|
14
|
+
const key = input.toLowerCase();
|
|
15
|
+
if (key === "y") {
|
|
16
|
+
respond({ approved: true });
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (key === "n") {
|
|
20
|
+
respond({ approved: false, reason: "rejected by user" });
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (key === "a") {
|
|
24
|
+
respond({ approved: true, always: true });
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=input-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-utils.js","sourceRoot":"","sources":["../src/input-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,OAAqD;IAErD,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAChC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-type content block rendering for terminal output.
|
|
3
|
+
*
|
|
4
|
+
* Each block type gets a dedicated renderer that returns ANSI-styled strings.
|
|
5
|
+
* Used by renderMessage() to compose full message output.
|
|
6
|
+
*/
|
|
7
|
+
import type { ContentBlock } from "@agentick/shared";
|
|
8
|
+
/** Render a single content block to an ANSI string. */
|
|
9
|
+
export declare function renderContentBlock(block: ContentBlock): string | null;
|
|
10
|
+
/** Render a tool call indicator line. */
|
|
11
|
+
export declare function renderToolCall(name: string, duration?: number): string;
|
|
12
|
+
//# sourceMappingURL=content-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-block.d.ts","sourceRoot":"","sources":["../../src/rendering/content-block.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,uDAAuD;AACvD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAmFrE;AAED,yCAAyC;AACzC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAGtE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-type content block rendering for terminal output.
|
|
3
|
+
*
|
|
4
|
+
* Each block type gets a dedicated renderer that returns ANSI-styled strings.
|
|
5
|
+
* Used by renderMessage() to compose full message output.
|
|
6
|
+
*/
|
|
7
|
+
import { theme, formatDuration } from "./theme.js";
|
|
8
|
+
import { renderMarkdown } from "./markdown.js";
|
|
9
|
+
/** Render a single content block to an ANSI string. */
|
|
10
|
+
export function renderContentBlock(block) {
|
|
11
|
+
switch (block.type) {
|
|
12
|
+
case "text":
|
|
13
|
+
return renderMarkdown(block.text);
|
|
14
|
+
case "reasoning":
|
|
15
|
+
if (block.isRedacted)
|
|
16
|
+
return null;
|
|
17
|
+
return theme.reasoning(block.text);
|
|
18
|
+
case "tool_use":
|
|
19
|
+
// Tool calls are rendered separately with duration info
|
|
20
|
+
return null;
|
|
21
|
+
case "tool_result": {
|
|
22
|
+
if (!block.content || block.content.length === 0)
|
|
23
|
+
return null;
|
|
24
|
+
const inner = block.content
|
|
25
|
+
.map((b) => renderContentBlock(b))
|
|
26
|
+
.filter(Boolean)
|
|
27
|
+
.join("\n");
|
|
28
|
+
if (!inner)
|
|
29
|
+
return null;
|
|
30
|
+
if (block.isError) {
|
|
31
|
+
return `${theme.errorLabel("error")} ${theme.error(inner)}`;
|
|
32
|
+
}
|
|
33
|
+
return inner;
|
|
34
|
+
}
|
|
35
|
+
case "code":
|
|
36
|
+
return renderMarkdown(`\`\`\`${block.language}\n${block.text}\n\`\`\``);
|
|
37
|
+
case "executable_code":
|
|
38
|
+
return renderMarkdown(`\`\`\`${block.language ?? ""}\n${block.code}\n\`\`\``);
|
|
39
|
+
case "code_execution_result":
|
|
40
|
+
if (block.isError) {
|
|
41
|
+
return `${theme.errorLabel("error")} ${theme.error(block.output)}`;
|
|
42
|
+
}
|
|
43
|
+
return theme.dim(block.output);
|
|
44
|
+
case "json":
|
|
45
|
+
if (block.data !== undefined) {
|
|
46
|
+
return renderMarkdown(`\`\`\`json\n${JSON.stringify(block.data, null, 2)}\n\`\`\``);
|
|
47
|
+
}
|
|
48
|
+
return renderMarkdown(`\`\`\`json\n${block.text}\n\`\`\``);
|
|
49
|
+
case "xml":
|
|
50
|
+
return renderMarkdown(`\`\`\`xml\n${block.text}\n\`\`\``);
|
|
51
|
+
case "csv":
|
|
52
|
+
return theme.dim(block.text);
|
|
53
|
+
case "html":
|
|
54
|
+
return theme.dim(block.text);
|
|
55
|
+
case "image":
|
|
56
|
+
return theme.dim(`[image${block.altText ? `: ${block.altText}` : ""}]`);
|
|
57
|
+
case "document":
|
|
58
|
+
return theme.dim(`[document${block.title ? `: ${block.title}` : ""}]`);
|
|
59
|
+
case "audio":
|
|
60
|
+
return theme.dim(`[audio${block.transcript ? `: ${block.transcript.slice(0, 80)}` : ""}]`);
|
|
61
|
+
case "video":
|
|
62
|
+
return theme.dim(`[video${block.transcript ? `: ${block.transcript.slice(0, 80)}` : ""}]`);
|
|
63
|
+
case "generated_image":
|
|
64
|
+
return theme.dim(`[generated image${block.altText ? `: ${block.altText}` : ""}]`);
|
|
65
|
+
case "generated_file":
|
|
66
|
+
return theme.dim(`[file: ${block.displayName ?? block.uri}]`);
|
|
67
|
+
case "user_action":
|
|
68
|
+
return block.text ?? theme.dim(`[action: ${block.action}]`);
|
|
69
|
+
case "system_event":
|
|
70
|
+
return block.text ?? theme.dim(`[event: ${block.event}]`);
|
|
71
|
+
case "state_change":
|
|
72
|
+
return block.text ?? theme.dim(`[state: ${block.entity}]`);
|
|
73
|
+
default:
|
|
74
|
+
return theme.dim(`[${block.type}]`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Render a tool call indicator line. */
|
|
78
|
+
export function renderToolCall(name, duration) {
|
|
79
|
+
const dur = duration != null ? ` ${theme.toolDuration(`(${formatDuration(duration)})`)}` : "";
|
|
80
|
+
return ` ${theme.toolSymbol("+")} ${theme.toolName(name)}${dur}`;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=content-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-block.js","sourceRoot":"","sources":["../../src/rendering/content-block.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,uDAAuD;AACvD,MAAM,UAAU,kBAAkB,CAAC,KAAmB;IACpD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,MAAM;YACT,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEpC,KAAK,WAAW;YACd,IAAI,KAAK,CAAC,UAAU;gBAAE,OAAO,IAAI,CAAC;YAClC,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAErC,KAAK,UAAU;YACb,wDAAwD;YACxD,OAAO,IAAI,CAAC;QAEd,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO;iBACxB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAiB,CAAC,CAAC;iBACjD,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,IAAI,CAAC,KAAK;gBAAE,OAAO,I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AAK,CAAC,GAAG,CAAC,WAAW,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QAE5D,KAAK,cAAc;YACjB,OAAO,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAE7D;YACE,OAAO,KAAK,CAAC,GAAG,CAAC,IAAK,KAAa,CAAC,IAAI,GAAG,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,QAAiB;IAC5D,MAAM,GAAG,GAAG,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,OAAO,KAAK,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { theme, formatDuration } from "./theme.js";
|
|
2
|
+
export { renderMarkdown, getTerminalWidth } from "./markdown.js";
|
|
3
|
+
export { renderContentBlock, renderToolCall } from "./content-block.js";
|
|
4
|
+
export { renderMessage, type RenderMessageOptions, type ToolCallInfo } from "./message.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rendering/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { theme, formatDuration } from "./theme.js";
|
|
2
|
+
export { renderMarkdown, getTerminalWidth } from "./markdown.js";
|
|
3
|
+
export { renderContentBlock, renderToolCall } from "./content-block.js";
|
|
4
|
+
export { renderMessage } from "./message.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rendering/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAgD,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown-to-terminal rendering via marked + marked-terminal.
|
|
3
|
+
*
|
|
4
|
+
* Returns ANSI-styled strings suitable for console.log output.
|
|
5
|
+
* Width is computed at call time so the output adapts to terminal resizes.
|
|
6
|
+
*/
|
|
7
|
+
/** Terminal width for rendering — text reflow, borders, separators. */
|
|
8
|
+
export declare function getTerminalWidth(): number;
|
|
9
|
+
/**
|
|
10
|
+
* Render a markdown string to ANSI-styled terminal output.
|
|
11
|
+
* Strips the trailing newline that marked adds.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderMarkdown(text: string): string;
|
|
14
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/rendering/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,uEAAuE;AACvE,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AA8CD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown-to-terminal rendering via marked + marked-terminal.
|
|
3
|
+
*
|
|
4
|
+
* Returns ANSI-styled strings suitable for console.log output.
|
|
5
|
+
* Width is computed at call time so the output adapts to terminal resizes.
|
|
6
|
+
*/
|
|
7
|
+
import { Marked } from "marked";
|
|
8
|
+
import { markedTerminal } from "marked-terminal";
|
|
9
|
+
import { theme } from "./theme.js";
|
|
10
|
+
/** Terminal width for rendering — text reflow, borders, separators. */
|
|
11
|
+
export function getTerminalWidth() {
|
|
12
|
+
return process.stdout.columns ?? 80;
|
|
13
|
+
}
|
|
14
|
+
let cachedWidth = 0;
|
|
15
|
+
let md;
|
|
16
|
+
function getMarked() {
|
|
17
|
+
const width = getTerminalWidth();
|
|
18
|
+
if (md && width === cachedWidth)
|
|
19
|
+
return md;
|
|
20
|
+
cachedWidth = width;
|
|
21
|
+
const ext = markedTerminal({
|
|
22
|
+
firstHeading: theme.firstHeading,
|
|
23
|
+
heading: theme.heading,
|
|
24
|
+
strong: theme.strong,
|
|
25
|
+
em: theme.em,
|
|
26
|
+
codespan: theme.codespan,
|
|
27
|
+
blockquote: theme.blockquote,
|
|
28
|
+
hr: theme.hr,
|
|
29
|
+
link: theme.link,
|
|
30
|
+
href: theme.href,
|
|
31
|
+
paragraph: (s) => s,
|
|
32
|
+
showSectionPrefix: false,
|
|
33
|
+
reflowText: true,
|
|
34
|
+
width,
|
|
35
|
+
tab: 2,
|
|
36
|
+
emoji: false,
|
|
37
|
+
});
|
|
38
|
+
// marked-terminal bug: text renderer ignores inline tokens for tight list items.
|
|
39
|
+
// When marked parses "1. **Bold:** desc" as a tight list, list item content arrives
|
|
40
|
+
// as a { type: "text", text: "...", tokens: [...] } — the tokens array contains
|
|
41
|
+
// parsed inline elements (strong, em, etc.) but the default text renderer discards
|
|
42
|
+
// them and returns the raw string with literal ** markers. Fix: parse inline tokens.
|
|
43
|
+
const originalText = ext.renderer.text;
|
|
44
|
+
ext.renderer.text = function (token) {
|
|
45
|
+
if (typeof token === "object" && token.tokens) {
|
|
46
|
+
return this.parser.parseInline(token.tokens);
|
|
47
|
+
}
|
|
48
|
+
return originalText.call(this, token);
|
|
49
|
+
};
|
|
50
|
+
md = new Marked(ext);
|
|
51
|
+
return md;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Render a markdown string to ANSI-styled terminal output.
|
|
55
|
+
* Strips the trailing newline that marked adds.
|
|
56
|
+
*/
|
|
57
|
+
export function renderMarkdown(text) {
|
|
58
|
+
const rendered = getMarked().parse(text);
|
|
59
|
+
return rendered.replace(/\n+$/, "");
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/rendering/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,uEAAuE;AACvE,MAAM,UAAU,gBAAgB;IAC9B,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,EAAU,CAAC;AAEf,SAAS,SAAS;IAChB,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,IAAI,EAAE,IAAI,KAAK,KAAK,WAAW;QAAE,OAAO,EAAE,CAAC;IAE3C,WAAW,GAAG,KAAK,CAAC;IACpB,MAAM,GAAG,GAAG,cAAc,CAAC;QACzB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,OAAO,E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/**
|
|
2
|
+
* Full message rendering — content blocks + tool calls.
|
|
3
|
+
*
|
|
4
|
+
* Outputs ANSI-styled strings for console.log (Ink scrollback).
|
|
5
|
+
*/
|
|
6
|
+
import type { ContentBlock } from "@agentick/shared";
|
|
7
|
+
export interface ToolCallInfo {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
duration?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface RenderMessageOptions {
|
|
13
|
+
role: "user" | "assistant" | "system";
|
|
14
|
+
content: string | ContentBlock[];
|
|
15
|
+
toolCalls?: ToolCallInfo[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Render a complete message to an ANSI string for terminal output.
|
|
19
|
+
*
|
|
20
|
+
* User messages: subtle gray borders, muted text — recognizable but not dominant.
|
|
21
|
+
* Assistant messages: rich-rendered content blocks, tool call indicators.
|
|
22
|
+
* No role labels — the styling differentiates.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderMessage({ role, content, toolCalls }: RenderMessageOptions): string;
|
|
25
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/rendering/message.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAMnE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,oBAAoB,GAAG,MAAM,CASxF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full message rendering — content blocks + tool calls.
|
|
3
|
+
*
|
|
4
|
+
* Outputs ANSI-styled strings for console.log (Ink scrollback).
|
|
5
|
+
*/
|
|
6
|
+
import { extractText } from "@agentick/shared";
|
|
7
|
+
import { theme } from "./theme.js";
|
|
8
|
+
import { renderContentBlock, renderToolCall } from "./content-block.js";
|
|
9
|
+
import { getTerminalWidth } from "./markdown.js";
|
|
10
|
+
/**
|
|
11
|
+
* Render a complete message to an ANSI string for terminal output.
|
|
12
|
+
*
|
|
13
|
+
* User messages: subtle gray borders, muted text — recognizable but not dominant.
|
|
14
|
+
* Assistant messages: rich-rendered content blocks, tool call indicators.
|
|
15
|
+
* No role labels — the styling differentiates.
|
|
16
|
+
*/
|
|
17
|
+
export function renderMessage({ role, content, toolCalls }) {
|
|
18
|
+
const blocks = typeof content === "string" ? [{ type: "text", text: content }] : content;
|
|
19
|
+
if (role === "user") {
|
|
20
|
+
return renderUserMessage(blocks);
|
|
21
|
+
}
|
|
22
|
+
return renderAssistantMessage(blocks, toolCalls);
|
|
23
|
+
}
|
|
24
|
+
function renderUserMessage(blocks) {
|
|
25
|
+
const text = extractText(blocks);
|
|
26
|
+
if (!text)
|
|
27
|
+
return "";
|
|
28
|
+
const width = getTerminalWidth();
|
|
29
|
+
const border = theme.border("─".repeat(width));
|
|
30
|
+
const styledText = theme.dim(text);
|
|
31
|
+
return `${border}\n${styledText}\n${border}`;
|
|
32
|
+
}
|
|
33
|
+
function renderAssistantMessage(blocks, toolCalls) {
|
|
34
|
+
const parts = [];
|
|
35
|
+
for (const block of blocks) {
|
|
36
|
+
const rendered = renderContentBlock(block);
|
|
37
|
+
if (rendered) {
|
|
38
|
+
parts.push(rendered);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (toolCalls && toolCalls.length > 0) {
|
|
42
|
+
for (const tc of toolCalls) {
|
|
43
|
+
parts.push(renderToolCall(tc.name, tc.duration));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const blockToolCalls = blocks.filter((b) => b.type === "tool_use");
|
|
48
|
+
for (const tc of blockToolCalls) {
|
|
49
|
+
parts.push(renderToolCall(tc.name));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return parts.join("\n");
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/rendering/message.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAcjD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAwB;IAC9E,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAkB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5F,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAsB;IAC/C,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,MAAM,KAAK,GAAG,gBAAgB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|
4
|
+
* Uses chalk for ANSI color output. All colors are defined here so the
|
|
5
|
+
* palette can be adjusted in one place.
|
|
6
|
+
*
|
|
7
|
+
* Brand color: emerald green (#34d399 / #10b981).
|
|
8
|
+
*/
|
|
9
|
+
export declare const theme: {
|
|
10
|
+
user: import("chalk").ChalkInstance;
|
|
11
|
+
assistant: import("chalk").ChalkInstance;
|
|
12
|
+
system: import("chalk").ChalkInstance;
|
|
13
|
+
heading: import("chalk").ChalkInstance;
|
|
14
|
+
firstHeading: import("chalk").ChalkInstance;
|
|
15
|
+
strong: import("chalk").ChalkInstance;
|
|
16
|
+
em: import("chalk").ChalkInstance;
|
|
17
|
+
codespan: import("chalk").ChalkInstance;
|
|
18
|
+
blockquote: import("chalk").ChalkInstance;
|
|
19
|
+
hr: import("chalk").ChalkInstance;
|
|
20
|
+
link: import("chalk").ChalkInstance;
|
|
21
|
+
href: import("chalk").ChalkInstance;
|
|
22
|
+
toolName: import("chalk").ChalkInstance;
|
|
23
|
+
toolDuration: import("chalk").ChalkInstance;
|
|
24
|
+
toolSymbol: import("chalk").ChalkInstance;
|
|
25
|
+
error: import("chalk").ChalkInstance;
|
|
26
|
+
errorLabel: import("chalk").ChalkInstance;
|
|
27
|
+
success: import("chalk").ChalkInstance;
|
|
28
|
+
dim: import("chalk").ChalkInstance;
|
|
29
|
+
label: import("chalk").ChalkInstance;
|
|
30
|
+
reasoning: import("chalk").ChalkInstance;
|
|
31
|
+
border: import("chalk").ChalkInstance;
|
|
32
|
+
separator: import("chalk").ChalkInstance;
|
|
33
|
+
muted: import("chalk").ChalkInstance;
|
|
34
|
+
};
|
|
35
|
+
/** Format a duration in ms to a human-readable string */
|
|
36
|
+
export declare function formatDuration(ms: number): string;
|
|
37
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/rendering/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;CAgCjB,CAAC;AAEF,yDAAyD;AACzD,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|