zames_pro 2.73.11 → 2.75.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +37 -7
  3. package/dist/attachments.js +6 -1
  4. package/dist/banner.js +71 -0
  5. package/dist/browser.js +84 -27
  6. package/dist/code-blocks.js +48 -0
  7. package/dist/commands.js +1 -0
  8. package/dist/config-live.js +53 -0
  9. package/dist/config.js +38 -0
  10. package/dist/goal.js +81 -0
  11. package/dist/i18n/common.js +35 -0
  12. package/dist/i18n/config.js +20 -0
  13. package/dist/i18n/deepseek.js +14 -0
  14. package/dist/i18n/help.js +30 -2
  15. package/dist/i18n/qwen.js +4 -0
  16. package/dist/i18n/self-review.js +8 -0
  17. package/dist/i18n/spinner.js +6 -0
  18. package/dist/index.js +487 -65
  19. package/dist/input/layout.js +19 -0
  20. package/dist/input/suggest.js +29 -1
  21. package/dist/input.js +14 -3
  22. package/dist/net-capture.js +18 -0
  23. package/dist/qwen-browser.js +43 -20
  24. package/dist/run-task.js +97 -4
  25. package/dist/theme.js +16 -1
  26. package/dist/tool-summary.js +83 -0
  27. package/dist/tui/ConfigMenu.js +337 -0
  28. package/dist/tui/ConfirmDialog.js +42 -0
  29. package/dist/tui/FullScreenApp.js +113 -0
  30. package/dist/tui/InputLine.js +318 -0
  31. package/dist/tui/LogView.js +48 -0
  32. package/dist/tui/LoginForm.js +83 -0
  33. package/dist/tui/SelectList.js +54 -0
  34. package/dist/tui/StatusBar.js +170 -0
  35. package/dist/tui/TextPrompt.js +41 -0
  36. package/dist/tui/TuiApp.js +29 -0
  37. package/dist/tui/TuiEditor.js +490 -0
  38. package/dist/tui/edit.js +317 -0
  39. package/dist/tui/keys.js +195 -0
  40. package/dist/tui/log-window.js +93 -0
  41. package/dist/tui/login-pure.js +20 -0
  42. package/dist/tui/run-config-menu.js +19 -0
  43. package/dist/tui/run-confirm.js +22 -0
  44. package/dist/tui/run-login.js +43 -0
  45. package/dist/tui/run-select.js +18 -0
  46. package/dist/tui/store.js +104 -0
  47. package/dist/tui/types.js +10 -0
  48. package/dist/tui/useMouseWheel.js +164 -0
  49. package/dist/tui/widgets.js +60 -0
  50. package/package.json +7 -3
  51. package/scripts/coverage-gate.mts +10 -0
  52. package/scripts/inline-status-driver.mts +31 -0
  53. package/scripts/inline-status.tsx +33 -0
  54. package/scripts/mouse-churn.mts +34 -0
  55. package/scripts/qwen-models-smoke.mts +117 -0
  56. package/scripts/render-demo.mts +1 -1
  57. package/scripts/tui-comp-shot.mts +63 -0
  58. package/scripts/tui-components.tsx +62 -0
  59. package/scripts/tui-config-driver.mts +82 -0
  60. package/scripts/tui-config-probe.tsx +74 -0
  61. package/scripts/tui-edit-driver.mts +100 -0
  62. package/scripts/tui-edit-probe.tsx +38 -0
  63. package/scripts/tui-editor-probe.tsx +24 -0
  64. package/scripts/tui-input-driver.mts +54 -0
  65. package/scripts/tui-input-shot.tsx +59 -0
  66. package/scripts/tui-log-driver.mts +35 -0
  67. package/scripts/tui-log-shot.tsx +48 -0
  68. package/scripts/tui-longpaste-driver.mts +56 -0
  69. package/scripts/tui-longpaste.tsx +35 -0
  70. package/scripts/tui-manyselect-shot.mts +34 -0
  71. package/scripts/tui-manyselect.tsx +17 -0
  72. package/scripts/tui-mouse-churn-probe.tsx +28 -0
  73. package/scripts/tui-paste-driver.mts +88 -0
  74. package/scripts/tui-paste-kinds.tsx +76 -0
  75. package/scripts/tui-pastetest.mts +38 -0
  76. package/scripts/tui-probe.tsx +62 -0
  77. package/scripts/tui-repro.tsx +64 -0
  78. package/scripts/tui-resize.mts +70 -0
  79. package/scripts/tui-scroll-driver.mts +53 -0
  80. package/scripts/tui-scroll-probe.tsx +46 -0
  81. package/scripts/tui-shot.mts +106 -0
  82. package/scripts/tui-status-driver.mts +24 -0
  83. package/scripts/tui-status-shot.tsx +27 -0
  84. package/scripts/tui-submit.tsx +57 -0
  85. package/scripts/tui-wheel-driver.mts +61 -0
  86. package/scripts/tui-wheel-probe.tsx +48 -0
  87. package/scripts/tui-widgets-driver.mts +20 -0
  88. package/scripts/tui-widgets.tsx +44 -0
@@ -0,0 +1,53 @@
1
+ // Press keys on the scroll probe and print the scroll values it saw. Accepts
2
+ // several End/Home encodings so a terminal that sends a non-xterm form can be
3
+ // diagnosed.
4
+ import { spawn } from 'node:child_process'
5
+ import fs from 'node:fs'
6
+ import path from 'node:path'
7
+ const ESC = String.fromCharCode(27)
8
+ const LOG = '/tmp/scroll-probe.log'
9
+ try {
10
+ fs.unlinkSync(LOG)
11
+ } catch {
12
+ /* ignore */
13
+ }
14
+ const map: Record<string, string> = {
15
+ PGUP: ESC + '[5~',
16
+ PGDN: ESC + '[6~',
17
+ HOME: ESC + '[H',
18
+ END: ESC + '[F',
19
+ END4: ESC + '[4~',
20
+ HOME1: ESC + '[1~',
21
+ CEND: ESC + '[1;5F',
22
+ CHOME: ESC + '[1;5H',
23
+ SPGDN: ESC + '[6;2~',
24
+ SPGUP: ESC + '[5;2~',
25
+ }
26
+ const keys = (process.argv[2] || 'PGUP').split(',').map((k) => map[k] ?? k)
27
+ const child = spawn(
28
+ 'script',
29
+ ['-qec', 'npx tsx scripts/tui-scroll-probe.tsx', '/dev/null'],
30
+ {
31
+ cwd: path.resolve('.'),
32
+ env: { ...process.env, COLUMNS: '80', LINES: '24', PROBE_SCROLL_LOG: LOG },
33
+ },
34
+ )
35
+ child.stdout.on('data', () => {})
36
+ child.stderr.on('data', () => {})
37
+ let i = 0
38
+ const tick = (): void => {
39
+ if (i < keys.length) {
40
+ child.stdin.write(keys[i])
41
+ i++
42
+ setTimeout(tick, 250)
43
+ } else setTimeout(() => child.kill('SIGTERM'), 400)
44
+ }
45
+ setTimeout(tick, 5000)
46
+ child.on('close', () => {
47
+ const lines = fs
48
+ .readFileSync(LOG, 'utf-8')
49
+ .trim()
50
+ .split(String.fromCharCode(10))
51
+ console.log('SCROLL=' + JSON.stringify(lines.map(Number)))
52
+ process.exit(0)
53
+ })
@@ -0,0 +1,46 @@
1
+ // Mount the REAL FullScreenApp with a LONG log and log every scroll change,
2
+ // so a pty can press PgUp/PgDn/Home/End and prove the viewport moves.
3
+ import React from 'react'
4
+ import fs from 'node:fs'
5
+ import { render } from 'ink'
6
+ import { TuiStore } from '../src/tui/store.js'
7
+ import { FullScreenApp } from '../src/tui/FullScreenApp.js'
8
+ import { initialEditState } from '../src/tui/edit.js'
9
+
10
+ const LOG = process.env.PROBE_SCROLL_LOG || '/tmp/scroll-probe.log'
11
+ fs.writeFileSync(LOG, '')
12
+ const store = new TuiStore()
13
+ store.set({
14
+ title: 'probe',
15
+ version: '0',
16
+ workdir: '/tmp',
17
+ prompt: '\u2794 probe \u203a ',
18
+ locale: 'en',
19
+ commands: [],
20
+ edit: { ...initialEditState(), buf: '' },
21
+ })
22
+ for (let i = 0; i < 100; i++) store.pushLog('system', 'log line ' + i)
23
+ const inputProps = {
24
+ onSubmit: () => {},
25
+ onEscape: () => {},
26
+ onCtrlC: () => {},
27
+ onCopyCode: () => {},
28
+ onAttach: () => null,
29
+ onClipboard: () => Promise.resolve(null),
30
+ onHistoryChange: () => {},
31
+ onClearScreen: () => {},
32
+ attachments: [],
33
+ onPastesChange: () => {},
34
+ }
35
+ store.subscribe(() => {
36
+ fs.appendFileSync(
37
+ LOG,
38
+ String(store.getSnapshot().scroll) + String.fromCharCode(10),
39
+ )
40
+ })
41
+ render(React.createElement(FullScreenApp, { store, inputProps }), {
42
+ exitOnCtrlC: false,
43
+ patchConsole: false,
44
+ alternateScreen: true,
45
+ })
46
+ setInterval(() => {}, 1 << 30)
@@ -0,0 +1,106 @@
1
+ // Take a VT100 "screenshot" of the TUI under a pty and print the grid.
2
+ //
3
+ // Usage: npx tsx scripts/tui-shot.mts [--inline] [--probe=tui-repro|tui-probe]
4
+ // [--buf=<initial buffer>] [--keys=a,LF,b,ENTER] [--cols=80] [--rows=24]
5
+ //
6
+ // Keys are sent ONE CHUNK AT A TIME. Tokens: LF (Ctrl+J newline), CR (Enter),
7
+ // ESC, TAB, or any literal character. The screen is snapshotted WHILE the app
8
+ // is still alive, so the real terminal-cursor cell is included.
9
+
10
+ import { spawn } from 'node:child_process'
11
+ import path from 'node:path'
12
+ import { Term } from '../test/vt100.mts'
13
+
14
+ const ESC = String.fromCharCode(27)
15
+ const LF = String.fromCharCode(10)
16
+ const CR = String.fromCharCode(13)
17
+ const TAB = String.fromCharCode(9)
18
+
19
+ function arg(name: string, def = ''): string {
20
+ const hit = process.argv.find((a) => a.startsWith('--' + name + '='))
21
+ return hit ? hit.slice(name.length + 3) : def
22
+ }
23
+ const hasFlag = (name: string): boolean => process.argv.includes('--' + name)
24
+
25
+ const inline = hasFlag('inline')
26
+ const probe = arg('probe', 'tui-repro')
27
+ const buf = arg('buf', '')
28
+ const keys = arg('keys', '')
29
+ .split(',')
30
+ .filter((s) => s.length > 0)
31
+ .map((s) => {
32
+ if (s === 'LF') return LF
33
+ if (s === 'CR' || s === 'ENTER') return CR
34
+ if (s === 'ESC') return ESC
35
+ if (s === 'TAB') return TAB
36
+ // Alt+Enter and Shift+Enter must arrive as ONE chunk, like a real terminal
37
+ // sends them; splitting them into separate chunks makes Ink read a bare
38
+ // Escape key instead of the modified Enter.
39
+ if (s === 'ALTENTER') return ESC + CR
40
+ if (s === 'SHIFTENTER') return ESC + '[13;2u'
41
+ if (s === 'UP') return ESC + '[A'
42
+ if (s === 'DOWN') return ESC + '[B'
43
+ if (s === 'RIGHT') return ESC + '[C'
44
+ if (s === 'LEFT') return ESC + '[D'
45
+ // Editing keys, so the word-delete bindings can be exercised on a real pty.
46
+ if (s === 'CTDL') return ESC + '[3;5~' // Ctrl+Delete (xterm)
47
+ if (s === 'CTDLU') return ESC + '[3;5u' // Ctrl+Delete (kitty CSI-u)
48
+ if (s === 'CTRLBS') return ESC + String.fromCharCode(127) // Ctrl+Backspace
49
+ if (s === 'CTB08') return String.fromCharCode(8) // Ctrl+Backspace (0x08)
50
+ if (s === 'DEL') return ESC + '[3~' // Delete
51
+ if (s === 'CTRLW') return String.fromCharCode(23)
52
+ if (s === 'CTRLU') return String.fromCharCode(21)
53
+ if (s === 'CTRLK') return String.fromCharCode(11)
54
+ if (s === 'SPACE') return ' '
55
+ return s
56
+ })
57
+ const cols = Number(arg('cols', '80'))
58
+ const rows = Number(arg('rows', '24'))
59
+ const hold = Number(arg('hold', '500'))
60
+
61
+ const scriptPath = 'npx tsx scripts/' + probe + '.tsx ' + JSON.stringify(buf)
62
+
63
+ const term = new Term(rows, cols)
64
+ const child = spawn('script', ['-qec', scriptPath, '/dev/null'], {
65
+ cwd: path.resolve('.'),
66
+ env: {
67
+ ...process.env,
68
+ COLUMNS: String(cols),
69
+ LINES: String(rows),
70
+ ...(inline ? { PROBE_INLINE: '1' } : {}),
71
+ },
72
+ })
73
+ child.stdout.on('data', (d) => term.write(d.toString('utf-8')))
74
+ child.stderr.on('data', (d) => term.write(d.toString('utf-8')))
75
+
76
+ let i = 0
77
+ const tick = (): void => {
78
+ if (i < keys.length) {
79
+ child.stdin.write(keys[i])
80
+ i++
81
+ setTimeout(tick, 250)
82
+ } else {
83
+ setTimeout(() => {
84
+ const cr = term.r
85
+ const cc = term.c
86
+ const lines = term.render().split(LF)
87
+ if (lines[cr])
88
+ lines[cr] =
89
+ lines[cr].slice(0, cc) +
90
+ String.fromCharCode(9673) +
91
+ lines[cr].slice(cc + 1)
92
+ process.stdout.write(
93
+ lines.map((l, n) => String(n).padStart(2) + '| ' + l).join(LF) +
94
+ LF +
95
+ 'cursor: row ' +
96
+ cr +
97
+ ', col ' +
98
+ cc +
99
+ LF,
100
+ )
101
+ child.kill('SIGTERM')
102
+ }, hold)
103
+ }
104
+ }
105
+ setTimeout(tick, 4500)
106
+ child.on('close', () => process.exit(0))
@@ -0,0 +1,24 @@
1
+ import { spawn } from 'node:child_process'
2
+ import path from 'node:path'
3
+ import { Term } from '../test/vt100.mts'
4
+ const NL = String.fromCharCode(10)
5
+ const cols = Number(
6
+ (process.argv.find((a) => a.startsWith('--cols=')) || '--cols=80').slice(7),
7
+ )
8
+ const rows = 8
9
+ const term = new Term(rows, cols)
10
+ const child = spawn(
11
+ 'script',
12
+ ['-qec', 'npx tsx scripts/tui-status-shot.tsx', '/dev/null'],
13
+ {
14
+ cwd: path.resolve('.'),
15
+ env: { ...process.env, COLUMNS: String(cols), LINES: String(rows) },
16
+ },
17
+ )
18
+ child.stdout.on('data', (d) => term.write(d.toString('utf-8')))
19
+ child.stderr.on('data', (d) => term.write(d.toString('utf-8')))
20
+ setTimeout(() => {
21
+ process.stdout.write(term.render() + NL)
22
+ child.kill('SIGTERM')
23
+ }, 5000)
24
+ child.on('close', () => process.exit(0))
@@ -0,0 +1,27 @@
1
+ // Mount the REAL StatusBar with all badges set, to check the width math at
2
+ // narrow terminals (truncation must not clip the badges).
3
+ import React from 'react'
4
+ import { render } from 'ink'
5
+ import { StatusBar } from '../src/tui/StatusBar.js'
6
+ import { TuiStore } from '../src/tui/store.js'
7
+ const store = new TuiStore()
8
+ store.set({
9
+ locale: 'ru',
10
+ busy: true,
11
+ animBase: 'Думаю',
12
+ animStart: Date.now() - 45000,
13
+ provider: 'DeepSeek',
14
+ queueLength: 2,
15
+ tasks: 'задачи: 2/5',
16
+ thinkingEnabled: true,
17
+ searchEnabled: true,
18
+ contextText: 'ctx: 302k · 30%',
19
+ contextLevel: 'warn',
20
+ statusLine: 'git:master',
21
+ sendState: 'generating',
22
+ })
23
+ render(React.createElement(StatusBar, { state: store.getSnapshot() }), {
24
+ exitOnCtrlC: false,
25
+ patchConsole: false,
26
+ })
27
+ setInterval(() => {}, 1 << 30)
@@ -0,0 +1,57 @@
1
+ // Minimal probe: mount the REAL FullScreenApp with a store whose submit
2
+ // callback logs what it receives. Used to verify the bracketed-paste ->
3
+ // [Pasted lines#N] -> expandPastes path end to end.
4
+
5
+ import React from 'react'
6
+ import fs from 'node:fs'
7
+ import { render } from 'ink'
8
+ import { TuiStore } from '../src/tui/store.js'
9
+ import { FullScreenApp } from '../src/tui/FullScreenApp.js'
10
+ import { initialEditState } from '../src/tui/edit.js'
11
+ import { expandPastes } from '../src/input/layout.js'
12
+
13
+ const LOG = process.env.PROBE_SUBMIT_LOG || '/tmp/paste-submit.log'
14
+ const store = new TuiStore()
15
+ store.set({
16
+ title: 'probe',
17
+ version: '0',
18
+ workdir: '/tmp',
19
+ prompt: '> ',
20
+ locale: 'en',
21
+ commands: [],
22
+ edit: { ...initialEditState(), buf: '' },
23
+ })
24
+ const inputProps = {
25
+ onSubmit: (text: string) => {
26
+ // Mirrors TuiEditor.handleSubmit: expand the paste markers from the
27
+ // CURRENT store snapshot, which is what the agent actually receives.
28
+ const expanded = expandPastes(store.getSnapshot().pastes, text)
29
+ fs.appendFileSync(
30
+ LOG,
31
+ 'SUBMIT=' + JSON.stringify(expanded) + String.fromCharCode(10),
32
+ )
33
+ },
34
+ onEscape: () => {},
35
+ onCtrlC: () => {},
36
+ onCopyCode: () => {},
37
+ onAttach: () => null,
38
+ onClipboard: () => Promise.resolve(null),
39
+ onHistoryChange: () => {},
40
+ onClearScreen: () => {},
41
+ attachments: [],
42
+ onPastesChange: (p: unknown) => {
43
+ // Mirrors TuiEditor.buildInputProps: the adapter writes the paste list
44
+ // BACK into the store, which is what handleSubmit reads to expand markers.
45
+ store.set({ pastes: p as never })
46
+ fs.appendFileSync(
47
+ LOG,
48
+ 'PASTES=' + JSON.stringify(p) + String.fromCharCode(10),
49
+ )
50
+ },
51
+ }
52
+ render(<FullScreenApp store={store} inputProps={inputProps} />, {
53
+ exitOnCtrlC: false,
54
+ patchConsole: false,
55
+ alternateScreen: true,
56
+ })
57
+ setInterval(() => {}, 1 << 30)
@@ -0,0 +1,61 @@
1
+ // Drive scripts/tui-wheel-probe.tsx under a pty and send REAL SGR wheel events
2
+ // (mouse reporting must be on for these to arrive; the probe sets nothing, so
3
+ // this also proves the SCROLL mode sequences are emitted). Prints the buffer
4
+ // and scroll transitions the probe logged: the buffer must NEVER change and
5
+ // the scroll must INCREASE on wheel-up.
6
+ import { spawn } from 'node:child_process'
7
+ import fs from 'node:fs'
8
+ import path from 'node:path'
9
+
10
+ const ESC = String.fromCharCode(27)
11
+ const LOG = '/tmp/wheel-probe.log'
12
+ const SCROLL = process.argv.includes('--scroll')
13
+ // SGR wheel-up = Cb 64, wheel-down = 65: ESC [ < 64 ; col ; row M
14
+ try {
15
+ fs.unlinkSync(LOG)
16
+ } catch {
17
+ /* ignore */
18
+ }
19
+
20
+ const child = spawn(
21
+ 'script',
22
+ ['-qec', 'npx tsx scripts/tui-wheel-probe.tsx', '/dev/null'],
23
+ {
24
+ cwd: path.resolve('.'),
25
+ env: {
26
+ ...process.env,
27
+ COLUMNS: '80',
28
+ LINES: '24',
29
+ PROBE_WHEEL_LOG: LOG,
30
+ ...(SCROLL ? { PROBE_MOUSE_SCROLL: '1' } : {}),
31
+ },
32
+ },
33
+ )
34
+ child.stdout.on('data', () => {})
35
+ child.stderr.on('data', () => {})
36
+
37
+ setTimeout(() => {
38
+ // Five wheel-up notches.
39
+ for (let i = 0; i < 5; i++) {
40
+ child.stdin.write(ESC + '[<64;10;10M')
41
+ setTimeout(() => {}, 50)
42
+ }
43
+ setTimeout(() => child.kill('SIGTERM'), 800)
44
+ }, 6000)
45
+
46
+ child.on('close', () => {
47
+ let lines: string[] = []
48
+ try {
49
+ lines = fs.readFileSync(LOG, 'utf-8').trim().split(String.fromCharCode(10))
50
+ } catch {
51
+ /* ignore */
52
+ }
53
+ const parsed = lines.map(
54
+ (l) => JSON.parse(l) as { buf: string; scroll: number },
55
+ )
56
+ const bufs = [...new Set(parsed.map((p) => p.buf))]
57
+ const scrolls = parsed.map((p) => p.scroll)
58
+ console.log('BUFS=' + JSON.stringify(bufs))
59
+ console.log('SCROLLS=' + JSON.stringify(scrolls))
60
+ process.exit(0)
61
+ })
@@ -0,0 +1,48 @@
1
+ // Mount the REAL TuiEditor with a NON-EMPTY input history and a long log, so a
2
+ // pty can send real SGR wheel events and the probe can log whether the INPUT
3
+ // BUFFER or the LOG scroll offset changed. This distinguishes the two failure
4
+ // modes the operator kept hitting: wheel must scroll the LOG (SCROLL mode) and
5
+ // must NEVER touch the input history.
6
+
7
+ import fs from 'node:fs'
8
+ import { TuiEditor } from '../src/tui/TuiEditor.js'
9
+
10
+ const LOG = process.env.PROBE_WHEEL_LOG || '/tmp/wheel-probe.log'
11
+ fs.writeFileSync(LOG, '')
12
+
13
+ const ed = new TuiEditor({
14
+ prompt: '> ',
15
+ commands: [],
16
+ locale: 'en',
17
+ alternateScreen: true,
18
+ })
19
+ ed.onSubmit = () => {}
20
+ ed.onAttach = () => null
21
+ ed.onClipboard = () => Promise.resolve(null)
22
+ // Mouse-wheel scroll of the log is opt-in (config.ui.mouseScroll). Set it from
23
+ // the env so the driver can exercise BOTH modes on a real pty.
24
+ ed.setHeader?.({ mouseScroll: process.env.PROBE_MOUSE_SCROLL === '1' })
25
+
26
+ // A non-empty history: a wheel-to-history bug would replace the empty buffer
27
+ // with one of these lines.
28
+ const snap = ed.store.getSnapshot()
29
+ ed.store.set({
30
+ edit: { ...snap.edit, history: ['OLD_COMMAND_ONE', 'OLD_COMMAND_TWO'] },
31
+ scroll: 0,
32
+ })
33
+ // A tall log so there is something to scroll.
34
+ for (let i = 0; i < 40; i++) ed.printAbove('log line ' + i)
35
+
36
+ const report = (): void => {
37
+ const s = ed.store.getSnapshot()
38
+ fs.appendFileSync(
39
+ LOG,
40
+ JSON.stringify({ buf: s.edit.buf, scroll: s.scroll }) +
41
+ String.fromCharCode(10),
42
+ )
43
+ }
44
+ ed.store.subscribe(report)
45
+ report()
46
+
47
+ ed.start()
48
+ setInterval(() => {}, 1 << 30)
@@ -0,0 +1,20 @@
1
+ import { spawn } from 'node:child_process'
2
+ import path from 'node:path'
3
+ import { Term } from '../test/vt100.mts'
4
+ const NL = String.fromCharCode(10)
5
+ const term = new Term(16, 60)
6
+ const child = spawn(
7
+ 'script',
8
+ ['-qec', 'npx tsx scripts/tui-widgets.tsx', '/dev/null'],
9
+ {
10
+ cwd: path.resolve('.'),
11
+ env: { ...process.env, COLUMNS: '60', LINES: '16' },
12
+ },
13
+ )
14
+ child.stdout.on('data', (d) => term.write(d.toString('utf-8')))
15
+ child.stderr.on('data', (d) => term.write(d.toString('utf-8')))
16
+ setTimeout(() => {
17
+ process.stdout.write(term.render() + NL)
18
+ child.kill('SIGTERM')
19
+ }, 5000)
20
+ child.on('close', () => process.exit(0))
@@ -0,0 +1,44 @@
1
+ import React from 'react'
2
+ import { render, Box, Text } from 'ink'
3
+ import {
4
+ Checkbox,
5
+ Select,
6
+ Panel,
7
+ HintBar,
8
+ CodeBlock,
9
+ } from '../src/tui/widgets.js'
10
+ render(
11
+ React.createElement(
12
+ Box,
13
+ { flexDirection: 'column' },
14
+ React.createElement(
15
+ Text,
16
+ null,
17
+ 'Checkbox: ',
18
+ React.createElement(Checkbox, { checked: true, focused: true }),
19
+ ' ',
20
+ React.createElement(Checkbox, { checked: false, focused: false }),
21
+ ),
22
+ React.createElement(
23
+ Text,
24
+ null,
25
+ 'Select: ',
26
+ React.createElement(Select, { value: 'qwen3.7-plus', focused: true }),
27
+ ),
28
+ React.createElement(
29
+ Panel,
30
+ { title: 'Панель', subtitle: '2', width: 50 },
31
+ React.createElement(Text, null, 'содержимое'),
32
+ ),
33
+ React.createElement(HintBar, {
34
+ hints: [
35
+ ['↑/↓', 'выбор'],
36
+ ['Enter', 'ok'],
37
+ ['Esc', 'отмена'],
38
+ ],
39
+ }),
40
+ React.createElement(CodeBlock, { code: 'const a = 1', lang: 'ts' }),
41
+ ),
42
+ { exitOnCtrlC: false, patchConsole: false },
43
+ )
44
+ setInterval(() => {}, 1 << 30)