@xp266/dshtui 0.1.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 (159) hide show
  1. package/bin/dshtui.js +65 -0
  2. package/cordis.patch.yml +81 -0
  3. package/lib/contract/index.d.mts +2 -0
  4. package/lib/contract/index.mjs +5 -0
  5. package/lib/dialog.d.mts +156 -0
  6. package/lib/dialog.mjs +3 -0
  7. package/lib/index-DqnaSXqP.d.mts +823 -0
  8. package/lib/index.d.mts +17 -0
  9. package/lib/index.mjs +11404 -0
  10. package/lib/prod-react-Dzof4qJx.mjs +4 -0
  11. package/lib/surface-DdxzIgIY.mjs +3126 -0
  12. package/lib/vendor.d.mts +3 -0
  13. package/lib/vendor.mjs +4 -0
  14. package/package.json +128 -0
  15. package/src/apply-theme.ts +8 -0
  16. package/src/boot-log.ts +35 -0
  17. package/src/chat/blocks.ts +41 -0
  18. package/src/chat/bridge.ts +1076 -0
  19. package/src/chat/builtin-tool-views.ts +53 -0
  20. package/src/chat/chat-face.ts +16 -0
  21. package/src/chat/chat-nodes.ts +53 -0
  22. package/src/chat/efforts.ts +4 -0
  23. package/src/chat/interactions.ts +329 -0
  24. package/src/chat/models.ts +263 -0
  25. package/src/chat/partial-json.ts +125 -0
  26. package/src/chat/presets.ts +26 -0
  27. package/src/chat/question-view.ts +106 -0
  28. package/src/chat/retry-status.ts +33 -0
  29. package/src/chat/session-groups.ts +34 -0
  30. package/src/chat/session-list.ts +311 -0
  31. package/src/chat/store.ts +636 -0
  32. package/src/chat/todo-view.ts +66 -0
  33. package/src/chat/tool-view.ts +311 -0
  34. package/src/chat/tool-views.ts +114 -0
  35. package/src/contract/index.ts +704 -0
  36. package/src/contract/upstream.ts +165 -0
  37. package/src/core/caret-nonce.ts +19 -0
  38. package/src/core/composer-layout.ts +65 -0
  39. package/src/core/edit.ts +152 -0
  40. package/src/core/field-view.ts +52 -0
  41. package/src/core/fields.ts +185 -0
  42. package/src/core/metrics.ts +26 -0
  43. package/src/core/paste.ts +149 -0
  44. package/src/core/segments.ts +112 -0
  45. package/src/core/text.ts +290 -0
  46. package/src/dialog.ts +11 -0
  47. package/src/env.ts +38 -0
  48. package/src/harness-home.ts +22 -0
  49. package/src/hot-theme.ts +56 -0
  50. package/src/index.tsx +185 -0
  51. package/src/kernel/registry.ts +102 -0
  52. package/src/kernel/surface.ts +33 -0
  53. package/src/log.ts +249 -0
  54. package/src/model/message.ts +89 -0
  55. package/src/model/selection.ts +63 -0
  56. package/src/performance-guard.ts +28 -0
  57. package/src/runtime/prod-react.ts +10 -0
  58. package/src/terminal/background.ts +66 -0
  59. package/src/terminal/capabilities.ts +54 -0
  60. package/src/terminal/clipboard-backends.ts +69 -0
  61. package/src/terminal/clipboard.ts +161 -0
  62. package/src/terminal/cursor-shape.ts +13 -0
  63. package/src/terminal/glyphs.ts +44 -0
  64. package/src/terminal/mouse.ts +154 -0
  65. package/src/terminal/probe.ts +61 -0
  66. package/src/terminal/screen.ts +349 -0
  67. package/src/theme-settings.ts +31 -0
  68. package/src/theme.ts +319 -0
  69. package/src/ui/app.tsx +454 -0
  70. package/src/ui/chrome/caps.tsx +9 -0
  71. package/src/ui/chrome/hint-service.ts +87 -0
  72. package/src/ui/chrome/input-status.ts +27 -0
  73. package/src/ui/chrome/key-gate.tsx +29 -0
  74. package/src/ui/chrome/status-bar.tsx +147 -0
  75. package/src/ui/contributions.ts +47 -0
  76. package/src/ui/dialog/defaults-dialog.tsx +152 -0
  77. package/src/ui/dialog/dialog-item.tsx +38 -0
  78. package/src/ui/dialog/dialog.tsx +386 -0
  79. package/src/ui/dialog/effort-dialog.tsx +45 -0
  80. package/src/ui/dialog/geometry.ts +131 -0
  81. package/src/ui/dialog/items.ts +124 -0
  82. package/src/ui/dialog/list-dialog.tsx +63 -0
  83. package/src/ui/dialog/models-dialog.tsx +203 -0
  84. package/src/ui/dialog/presets-dialog.tsx +46 -0
  85. package/src/ui/dialog/providers-dialog.tsx +313 -0
  86. package/src/ui/dialog/sessions-dialog.tsx +163 -0
  87. package/src/ui/dialog/sizes.ts +7 -0
  88. package/src/ui/dialog/status-lines.ts +11 -0
  89. package/src/ui/dialog/todo-dialog.tsx +29 -0
  90. package/src/ui/dialog/use-dialog-input.ts +186 -0
  91. package/src/ui/extension-point.ts +188 -0
  92. package/src/ui/home-logo.ts +132 -0
  93. package/src/ui/hooks/use-async-action.ts +25 -0
  94. package/src/ui/hooks/use-async-list.ts +71 -0
  95. package/src/ui/hooks/use-caret.ts +24 -0
  96. package/src/ui/hooks/use-chat-events.ts +153 -0
  97. package/src/ui/hooks/use-mouse-selection.ts +352 -0
  98. package/src/ui/hooks/use-scroll.ts +49 -0
  99. package/src/ui/hooks/use-terminal-size.ts +20 -0
  100. package/src/ui/input/commands.ts +118 -0
  101. package/src/ui/input/composer-bus.ts +14 -0
  102. package/src/ui/input/composer-fields.ts +111 -0
  103. package/src/ui/input/composer-keys.ts +21 -0
  104. package/src/ui/input/composer-paste.ts +20 -0
  105. package/src/ui/input/input-bar.tsx +279 -0
  106. package/src/ui/input/use-composer.ts +495 -0
  107. package/src/ui/key-arbiter.ts +37 -0
  108. package/src/ui/keymap.ts +15 -0
  109. package/src/ui/layout-service.ts +77 -0
  110. package/src/ui/message/layout.ts +763 -0
  111. package/src/ui/message/md/block.ts +247 -0
  112. package/src/ui/message/md/engine.ts +430 -0
  113. package/src/ui/message/md/extensions.ts +58 -0
  114. package/src/ui/message/md/highlight.ts +626 -0
  115. package/src/ui/message/md/index.ts +14 -0
  116. package/src/ui/message/md/inline.ts +97 -0
  117. package/src/ui/message/md/palette.ts +87 -0
  118. package/src/ui/message/message-list.tsx +69 -0
  119. package/src/ui/message/message-row.tsx +137 -0
  120. package/src/ui/message/message-views.ts +16 -0
  121. package/src/ui/message/renderers.ts +39 -0
  122. package/src/ui/message/tool-diff.ts +188 -0
  123. package/src/ui/message/warmup.ts +41 -0
  124. package/src/ui/message/wave.ts +98 -0
  125. package/src/ui/overlay.ts +22 -0
  126. package/src/ui/panels/approval-panel.tsx +193 -0
  127. package/src/ui/panels/exports.ts +3 -0
  128. package/src/ui/panels/question-model.ts +424 -0
  129. package/src/ui/panels/question-panel.tsx +154 -0
  130. package/src/ui/panels/surface.tsx +106 -0
  131. package/src/ui/panels-builtin.tsx +86 -0
  132. package/src/ui/pointer/builtins.ts +281 -0
  133. package/src/ui/pointer/registry.ts +25 -0
  134. package/src/ui/region.tsx +31 -0
  135. package/src/ui/selection/service.ts +92 -0
  136. package/src/ui/selection-registry.ts +88 -0
  137. package/src/ui/selection.tsx +148 -0
  138. package/src/ui/spinner-tick.tsx +24 -0
  139. package/src/ui/use-available-windows.ts +31 -0
  140. package/src/ui/widgets/actions.tsx +84 -0
  141. package/src/ui/widgets/button.tsx +57 -0
  142. package/src/ui/widgets/checkbox.tsx +58 -0
  143. package/src/ui/widgets/header.tsx +36 -0
  144. package/src/ui/widgets/index.ts +8 -0
  145. package/src/ui/widgets/input.tsx +76 -0
  146. package/src/ui/widgets/registry.ts +32 -0
  147. package/src/ui/widgets/search.tsx +59 -0
  148. package/src/ui/widgets/select.tsx +97 -0
  149. package/src/ui/widgets/static.tsx +37 -0
  150. package/src/ui/widgets/types.ts +1 -0
  151. package/src/ui/window-services-bridge.ts +71 -0
  152. package/src/ui/window-services.ts +20 -0
  153. package/src/ui/windows/models-window.tsx +15 -0
  154. package/src/ui/windows/providers-window.tsx +14 -0
  155. package/src/ui/windows/service-window.tsx +18 -0
  156. package/src/ui/windows/sessions-window.tsx +25 -0
  157. package/src/ui/windows-builtin.tsx +94 -0
  158. package/src/ui/windows.ts +18 -0
  159. package/src/vendor.ts +12 -0
@@ -0,0 +1,3 @@
1
+ import { Box, Static, Text, measureElement, useApp, useFocus, useFocusManager, useInput, useStdin, useStdout } from "ink";
2
+ import React, { Children, Component, Fragment, Profiler, StrictMode, Suspense, createContext, createElement, createRef, forwardRef, isValidElement, lazy, memo, startTransition, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition } from "react";
3
+ export { Box, Children, Component, Fragment, Profiler, React, Static, StrictMode, Suspense, Text, createContext, createElement, createRef, forwardRef, isValidElement, lazy, measureElement, memo, startTransition, useApp, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFocus, useFocusManager, useId, useImperativeHandle, useInput, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useStdin, useStdout, useSyncExternalStore, useTransition };
package/lib/vendor.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import "./prod-react-Dzof4qJx.mjs";
2
+ import { Box, Static, Text, measureElement, useApp, useFocus, useFocusManager, useInput, useStdin, useStdout } from "ink";
3
+ import React, { Children, Component, Fragment, Profiler, StrictMode, Suspense, createContext, createElement, createRef, forwardRef, isValidElement, lazy, memo, startTransition, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition } from "react";
4
+ export { Box, Children, Component, Fragment, Profiler, React, Static, StrictMode, Suspense, Text, createContext, createElement, createRef, forwardRef, isValidElement, lazy, measureElement, memo, startTransition, useApp, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFocus, useFocusManager, useId, useImperativeHandle, useInput, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useStdin, useStdout, useSyncExternalStore, useTransition };
package/package.json ADDED
@@ -0,0 +1,128 @@
1
+ {
2
+ "name": "@xp266/dshtui",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "ink-based terminal UI plugin for DeepSeek Harness",
6
+ "engines": {
7
+ "node": "^22.19.0 || >=24.0.0"
8
+ },
9
+ "bin": {
10
+ "dshtui": "./bin/dshtui.js"
11
+ },
12
+ "main": "lib/index.mjs",
13
+ "types": "lib/index.d.mts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./lib/index.d.mts",
17
+ "default": "./lib/index.mjs"
18
+ },
19
+ "./contract": {
20
+ "types": "./lib/contract/index.d.mts",
21
+ "default": "./lib/contract/index.mjs"
22
+ },
23
+ "./vendor": {
24
+ "types": "./lib/vendor.d.mts",
25
+ "default": "./lib/vendor.mjs"
26
+ },
27
+ "./dialog": {
28
+ "types": "./lib/dialog.d.mts",
29
+ "default": "./lib/dialog.mjs"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "files": [
34
+ "bin",
35
+ "lib",
36
+ "src",
37
+ "cordis.patch.yml"
38
+ ],
39
+ "license": "MIT",
40
+ "peerDependencies": {
41
+ "@deepseek-ai/cordis": "^4.0.1",
42
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
43
+ "@deepseek-ai/dsh-agent-default-model": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
44
+ "@deepseek-ai/dsh-agent-loop": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
45
+ "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
46
+ "@deepseek-ai/dsh-attachment": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
47
+ "@deepseek-ai/dsh-credentials": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
48
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
49
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
50
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.2",
51
+ "@deepseek-ai/schemastery": "^3.18.1"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "@deepseek-ai/cordis": {
55
+ "optional": true
56
+ },
57
+ "@deepseek-ai/dsh-agent": {
58
+ "optional": true
59
+ },
60
+ "@deepseek-ai/dsh-agent-default-model": {
61
+ "optional": true
62
+ },
63
+ "@deepseek-ai/dsh-agent-loop": {
64
+ "optional": true
65
+ },
66
+ "@deepseek-ai/dsh-agent-presets": {
67
+ "optional": true
68
+ },
69
+ "@deepseek-ai/dsh-attachment": {
70
+ "optional": true
71
+ },
72
+ "@deepseek-ai/dsh-credentials": {
73
+ "optional": true
74
+ },
75
+ "@deepseek-ai/dsh-llm": {
76
+ "optional": true
77
+ },
78
+ "@deepseek-ai/dsh-session": {
79
+ "optional": true
80
+ },
81
+ "@deepseek-ai/dsh-settings": {
82
+ "optional": true
83
+ },
84
+ "@deepseek-ai/schemastery": {
85
+ "optional": true
86
+ }
87
+ },
88
+ "dependencies": {
89
+ "chalk": "5.6.2",
90
+ "ink": "^7.1.1",
91
+ "marked": "^18.0.10",
92
+ "prismjs": "^1.30.0",
93
+ "react": "^19.2.0",
94
+ "string-width": "^8.2.2"
95
+ },
96
+ "devDependencies": {
97
+ "@deepseek-ai/cordis": "^4.0.1",
98
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.6",
99
+ "@deepseek-ai/dsh-agent-default-model": "0.1.0-rc.6",
100
+ "@deepseek-ai/dsh-agent-loop": "0.1.0-rc.6",
101
+ "@deepseek-ai/dsh-agent-presets": "0.1.0-rc.6",
102
+ "@deepseek-ai/dsh-attachment": "0.1.0-rc.6",
103
+ "@deepseek-ai/dsh-credentials": "0.1.0-rc.6",
104
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.6",
105
+ "@deepseek-ai/dsh-session": "0.1.0-rc.6",
106
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.6",
107
+ "@deepseek-ai/schemastery": "^3.18.1",
108
+ "@types/node": "^24.0.0",
109
+ "@types/prismjs": "^1.26.6",
110
+ "@types/react": "^19.2.0",
111
+ "tsdown": "^0.22.14",
112
+ "tsx": "^4.0.0",
113
+ "typescript": "^5.9.0"
114
+ },
115
+ "dsh": {
116
+ "bundle": {
117
+ "patch": "./cordis.patch.yml"
118
+ }
119
+ },
120
+ "scripts": {
121
+ "build": "tsdown",
122
+ "typecheck": "tsc --noEmit",
123
+ "verify": "pnpm run verify:contract && pnpm run verify:manifest && pnpm run verify:package",
124
+ "verify:contract": "node --import tsx/esm scripts/verify-contract.ts",
125
+ "verify:manifest": "node --import tsx/esm scripts/verify-manifest.ts",
126
+ "verify:package": "node scripts/verify-package.mjs"
127
+ }
128
+ }
@@ -0,0 +1,8 @@
1
+ import { setThemeMode } from './theme.ts'
2
+ import type { ThemeMode } from './theme.ts'
3
+ import { bumpSurface } from './kernel/surface.ts'
4
+
5
+ export function applyTheme(mode: ThemeMode): void {
6
+ setThemeMode(mode)
7
+ bumpSurface()
8
+ }
@@ -0,0 +1,35 @@
1
+ import { keyedRegistry } from './kernel/registry.ts'
2
+
3
+ export interface BootSink {
4
+ id: string
5
+ write(line: string): void
6
+ }
7
+
8
+ const sinks = keyedRegistry<BootSink>()
9
+ const history: string[] = []
10
+ let open = false
11
+
12
+ export function registerBootSink(sink: BootSink): () => void {
13
+ if (open) {
14
+ for (const line of history) sink.write(line)
15
+ }
16
+ return sinks.register(sink.id, sink)
17
+ }
18
+
19
+ export function openBootLog(): void {
20
+ open = true
21
+ history.length = 0
22
+ }
23
+
24
+ export function emitBootLine(line: string): void {
25
+ if (!open) return
26
+ history.push(line)
27
+ for (const sink of sinks.values()) sink.write(line)
28
+ }
29
+
30
+ export function closeBootLog(): void {
31
+ if (!open) return
32
+ open = false
33
+ for (const sink of sinks.values()) sink.write('')
34
+ history.length = 0
35
+ }
@@ -0,0 +1,41 @@
1
+ import type { ContentBlock } from '@deepseek-ai/dsh-llm'
2
+ import { allocateField, imageChipLabel } from '../core/fields.ts'
3
+
4
+ export function textFromBlocks(blocks: readonly ContentBlock[]): string {
5
+ let text = ''
6
+ for (const block of blocks) {
7
+ if (block.type === 'text') text += block.text
8
+ else if (block.type === 'tool-result') text += textFromBlocks(block.content)
9
+ }
10
+ return text
11
+ }
12
+
13
+ export function reasoningFromBlocks(blocks: readonly ContentBlock[]): string {
14
+ let text = ''
15
+ for (const block of blocks) {
16
+ if (block.type === 'reasoning') text += block.text
17
+ }
18
+ return text
19
+ }
20
+
21
+ export function userDisplayText(blocks: readonly ContentBlock[]): string {
22
+ let text = ''
23
+ let pendingImages = 0
24
+ const flushImages = (): void => {
25
+ if (pendingImages === 0) return
26
+ const label = imageChipLabel(pendingImages)
27
+ const char = allocateField('image', label, 'message')
28
+ text += char ?? label
29
+ pendingImages = 0
30
+ }
31
+ for (const block of blocks) {
32
+ if (block.type === 'image') {
33
+ pendingImages += 1
34
+ continue
35
+ }
36
+ flushImages()
37
+ if (block.type === 'text' && block.text !== '') text += block.text
38
+ }
39
+ flushImages()
40
+ return text
41
+ }