@toddzheng024/dscode-bundle 0.7.11 → 0.7.13
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/THIRD_PARTY_NOTICES.md +3 -3
- package/cordis.patch.yml +1 -1
- package/package.json +5 -4
- package/plugins/i18n/messages.mjs +6 -6
- package/plugins/session-metrics/view.mjs +16 -5
- package/plugins/tui-tools/index.mjs +14 -1
- package/vendor/tui/lib/app.mjs +6674 -0
- package/vendor/tui/lib/approval.mjs +122 -0
- package/vendor/tui/lib/attachments.mjs +218 -0
- package/vendor/tui/lib/authorization-panel.mjs +242 -0
- package/vendor/tui/lib/authorization.mjs +111 -0
- package/vendor/tui/lib/commands.mjs +123 -0
- package/vendor/tui/lib/dscode/chat.mjs +64 -0
- package/vendor/tui/lib/dscode/flags.mjs +32 -0
- package/vendor/tui/lib/dscode/model-search.mjs +68 -0
- package/vendor/tui/lib/dscode/paste.mjs +87 -0
- package/vendor/tui/lib/dscode/telemetry.mjs +82 -0
- package/vendor/tui/lib/dscode/welcome.mjs +100 -0
- package/vendor/tui/lib/editor-keys.mjs +346 -0
- package/vendor/tui/lib/editor.mjs +50 -0
- package/vendor/tui/lib/fork.mjs +24 -0
- package/vendor/tui/lib/git-workflow.mjs +278 -0
- package/vendor/tui/{types/history.d.ts → lib/history.mjs} +69 -26
- package/vendor/tui/{types/i18n.d.ts → lib/i18n.mjs} +23 -15
- package/vendor/tui/lib/index.mjs +2198 -0
- package/vendor/tui/lib/input-split.mjs +170 -0
- package/vendor/tui/lib/internals.mjs +90 -0
- package/vendor/tui/lib/invariant.mjs +22 -0
- package/vendor/tui/lib/kernel-panels.mjs +1265 -0
- package/vendor/tui/lib/keyboard.mjs +283 -0
- package/vendor/tui/lib/language-panel.mjs +41 -0
- package/vendor/tui/lib/locales/en.mjs +495 -0
- package/vendor/tui/lib/locales/zh.mjs +495 -0
- package/vendor/tui/lib/mentions.mjs +150 -0
- package/vendor/tui/lib/model-capabilities.mjs +245 -0
- package/vendor/tui/lib/models.mjs +215 -0
- package/vendor/tui/{types/panel-accent.d.ts → lib/panel-accent.mjs} +11 -7
- package/vendor/tui/lib/permissions.mjs +45 -0
- package/vendor/tui/lib/plugin-inventory.mjs +27 -0
- package/vendor/tui/lib/presets.mjs +46 -0
- package/vendor/tui/lib/provider-settings.mjs +600 -0
- package/vendor/tui/lib/questions.mjs +116 -0
- package/vendor/tui/lib/rainbow.mjs +181 -0
- package/vendor/tui/lib/render/animations.mjs +665 -0
- package/vendor/tui/lib/render/editor.mjs +437 -0
- package/vendor/tui/lib/render/export.mjs +119 -0
- package/vendor/tui/lib/render/fuzzy.mjs +79 -0
- package/vendor/tui/lib/render/ime-cursor.mjs +135 -0
- package/vendor/tui/lib/render/inspector.mjs +93 -0
- package/vendor/tui/lib/render/lines.mjs +538 -0
- package/vendor/tui/lib/render/markdown.mjs +592 -0
- package/vendor/tui/lib/render/projection.mjs +1862 -0
- package/vendor/tui/lib/render/status.mjs +591 -0
- package/vendor/tui/lib/render/text.mjs +157 -0
- package/vendor/tui/lib/render/tool-detail.mjs +187 -0
- package/vendor/tui/lib/render/tool-preview.mjs +79 -0
- package/vendor/tui/lib/render/usage.mjs +336 -0
- package/vendor/tui/lib/render/width.mjs +191 -0
- package/vendor/tui/lib/session-directory.mjs +329 -0
- package/vendor/tui/lib/session-query.mjs +184 -0
- package/vendor/tui/lib/session-switch.mjs +51 -0
- package/vendor/tui/lib/settings-file.mjs +75 -0
- package/vendor/tui/lib/skills.mjs +119 -0
- package/vendor/tui/lib/startup.mjs +111 -0
- package/vendor/tui/lib/store.mjs +129 -0
- package/vendor/tui/lib/subagents.mjs +200 -0
- package/vendor/tui/lib/terminal-title.mjs +186 -0
- package/vendor/tui/lib/theme-panel.mjs +60 -0
- package/vendor/tui/lib/theme.mjs +379 -0
- package/vendor/tui/lib/update-panel.mjs +239 -0
- package/vendor/tui/lib/update.mjs +101 -0
- package/vendor/tui/lib/version.mjs +105 -0
- package/vendor/tui/lib/whale-glyph.mjs +20 -0
- package/vendor/tui/LICENSE +0 -21
- package/vendor/tui/devtools-CdTl3MNy.mjs +0 -3643
- package/vendor/tui/dscode-email/cli.mjs +0 -32
- package/vendor/tui/dscode-email/contacts.mjs +0 -36
- package/vendor/tui/dscode-email/gmail-oauth.mjs +0 -69
- package/vendor/tui/dscode-email/gmail-store.mjs +0 -2
- package/vendor/tui/dscode-email/gmail.mjs +0 -194
- package/vendor/tui/dscode-email/imap.mjs +0 -136
- package/vendor/tui/dscode-email/inbox.d.mts +0 -25
- package/vendor/tui/dscode-email/inbox.mjs +0 -76
- package/vendor/tui/dscode-email/smtp.mjs +0 -69
- package/vendor/tui/dscode-email/store.mjs +0 -32
- package/vendor/tui/dscode-providers/catalog.mjs +0 -136
- package/vendor/tui/dscode-providers/effort.mjs +0 -35
- package/vendor/tui/dscode-providers/openrouter-account.mjs +0 -171
- package/vendor/tui/index.mjs +0 -44483
- package/vendor/tui/invariant.mjs +0 -21
- package/vendor/tui/rolldown-runtime-CMFfr-1z.mjs +0 -26
- package/vendor/tui/session-query.mjs +0 -150
- package/vendor/tui/startup.mjs +0 -109
- package/vendor/tui/theme-7u5Qo3dF.mjs +0 -1265
- package/vendor/tui/types/app.d.ts +0 -348
- package/vendor/tui/types/approval.d.ts +0 -59
- package/vendor/tui/types/attachments.d.ts +0 -52
- package/vendor/tui/types/authorization-panel.d.ts +0 -22
- package/vendor/tui/types/authorization.d.ts +0 -36
- package/vendor/tui/types/commands.d.ts +0 -52
- package/vendor/tui/types/editor-keys.d.ts +0 -105
- package/vendor/tui/types/editor.d.ts +0 -6
- package/vendor/tui/types/fork.d.ts +0 -8
- package/vendor/tui/types/git-workflow.d.ts +0 -121
- package/vendor/tui/types/index.d.ts +0 -223
- package/vendor/tui/types/input-split.d.ts +0 -54
- package/vendor/tui/types/internals.d.ts +0 -26
- package/vendor/tui/types/invariant.d.ts +0 -15
- package/vendor/tui/types/kernel-panels.d.ts +0 -245
- package/vendor/tui/types/keyboard.d.ts +0 -80
- package/vendor/tui/types/language-panel.d.ts +0 -12
- package/vendor/tui/types/locales/en.d.ts +0 -450
- package/vendor/tui/types/locales/zh.d.ts +0 -9
- package/vendor/tui/types/mentions.d.ts +0 -85
- package/vendor/tui/types/model-capabilities.d.ts +0 -82
- package/vendor/tui/types/models.d.ts +0 -133
- package/vendor/tui/types/permissions.d.ts +0 -27
- package/vendor/tui/types/plugin-inventory.d.ts +0 -11
- package/vendor/tui/types/presets.d.ts +0 -22
- package/vendor/tui/types/provider-settings.d.ts +0 -239
- package/vendor/tui/types/questions.d.ts +0 -54
- package/vendor/tui/types/rainbow.d.ts +0 -69
- package/vendor/tui/types/render/animations.d.ts +0 -307
- package/vendor/tui/types/render/editor.d.ts +0 -163
- package/vendor/tui/types/render/export.d.ts +0 -9
- package/vendor/tui/types/render/fuzzy.d.ts +0 -21
- package/vendor/tui/types/render/ime-cursor.d.ts +0 -60
- package/vendor/tui/types/render/inspector.d.ts +0 -62
- package/vendor/tui/types/render/lines.d.ts +0 -86
- package/vendor/tui/types/render/markdown.d.ts +0 -29
- package/vendor/tui/types/render/projection.d.ts +0 -587
- package/vendor/tui/types/render/status.d.ts +0 -196
- package/vendor/tui/types/render/text.d.ts +0 -64
- package/vendor/tui/types/render/tool-detail.d.ts +0 -94
- package/vendor/tui/types/render/tool-preview.d.ts +0 -28
- package/vendor/tui/types/render/usage.d.ts +0 -113
- package/vendor/tui/types/render/width.d.ts +0 -29
- package/vendor/tui/types/session-directory.d.ts +0 -190
- package/vendor/tui/types/session-query.d.ts +0 -92
- package/vendor/tui/types/session-switch.d.ts +0 -17
- package/vendor/tui/types/settings-file.d.ts +0 -41
- package/vendor/tui/types/skills.d.ts +0 -47
- package/vendor/tui/types/startup.d.ts +0 -65
- package/vendor/tui/types/store.d.ts +0 -58
- package/vendor/tui/types/subagents.d.ts +0 -70
- package/vendor/tui/types/terminal-title.d.ts +0 -66
- package/vendor/tui/types/theme-panel.d.ts +0 -24
- package/vendor/tui/types/theme.d.ts +0 -434
- package/vendor/tui/types/update-panel.d.ts +0 -49
- package/vendor/tui/types/update.d.ts +0 -75
- package/vendor/tui/types/version.d.ts +0 -19
- package/vendor/tui/types/whale-glyph.d.ts +0 -6
- /package/vendor/tui/{dscode-clipboard-image → lib/dscode/clipboard-image}/clipboard-image.swift +0 -0
- /package/vendor/tui/{dscode-clipboard-image → lib/dscode/clipboard-image}/index.mjs +0 -0
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -13,9 +13,6 @@ Local changes: DSCODE effort, shell control, TUI commands and footer.
|
|
|
13
13
|
@deepseek-ai/dsh-subagent-fork-in-process@0.1.5-rc.2: MIT; {"type":"git","url":"git+https://github.com/deepseek-ai/deepseek-harness.git","directory":"packages/subagent/subagent-fork-in-process"}
|
|
14
14
|
Local changes: DSCODE effort, shell control, TUI commands and footer.
|
|
15
15
|
|
|
16
|
-
dsh-code@1.2.0: MIT; {"type":"git","url":"git+https://github.com/unlinearity/dsh-code.git"}
|
|
17
|
-
Local changes: DSCODE effort, shell control, TUI commands and footer.
|
|
18
|
-
|
|
19
16
|
@deepseek-ai/dsh-llm-deepseek@0.1.5-rc.2: MIT; {"type":"git","url":"git+https://github.com/deepseek-ai/deepseek-harness.git","directory":"packages/llm/llm-deepseek"}
|
|
20
17
|
Local changes: DSCODE effort, shell control, TUI commands and footer.
|
|
21
18
|
|
|
@@ -30,3 +27,6 @@ Local changes: DSCODE effort, shell control, TUI commands and footer.
|
|
|
30
27
|
|
|
31
28
|
@deepseek-ai/dsh-compaction-basic@0.1.5-rc.2: MIT; {"type":"git","url":"git+https://github.com/deepseek-ai/deepseek-harness.git","directory":"packages/compaction/compaction-basic"}
|
|
32
29
|
Local changes: DSCODE effort, shell control, TUI commands and footer.
|
|
30
|
+
|
|
31
|
+
dsh-code (DSCODE vendored terminal, forked from dsh-code@1.2.0): MIT; https://github.com/unlinearity/dsh-code
|
|
32
|
+
Local changes: DSCODE UI (welcome header, activity line, footer telemetry, effort bar), commands, panels and paste handling.
|
package/cordis.patch.yml
CHANGED
|
@@ -652,7 +652,7 @@
|
|
|
652
652
|
# base row above: same SQLite FTS5 service, observation loop patched to
|
|
653
653
|
# skip unreadable sources instead of failing every search.
|
|
654
654
|
- id: session-query-skip
|
|
655
|
-
name: '
|
|
655
|
+
name: '@toddzheng024/dscode-bundle/session-query'
|
|
656
656
|
config:
|
|
657
657
|
path: ':memory:'
|
|
658
658
|
openAt: first-search
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.7.
|
|
2
|
+
"version": "0.7.13",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Todd Zheng",
|
|
@@ -41,8 +41,10 @@
|
|
|
41
41
|
"./subagent-spawn": "./vendor/subagent-spawn/index.js",
|
|
42
42
|
"./subagent-fork": "./vendor/subagent-fork/index.js",
|
|
43
43
|
"./bootstrap": "./bootstrap.mjs",
|
|
44
|
-
"./tui": "./vendor/tui/index.mjs",
|
|
45
|
-
"./startup": "./vendor/tui/startup.mjs",
|
|
44
|
+
"./tui": "./vendor/tui/lib/index.mjs",
|
|
45
|
+
"./startup": "./vendor/tui/lib/startup.mjs",
|
|
46
|
+
"./session-query": "./vendor/tui/lib/session-query.mjs",
|
|
47
|
+
"./invariant": "./vendor/tui/lib/invariant.mjs",
|
|
46
48
|
"./deepseek": "./vendor/deepseek/index.js",
|
|
47
49
|
"./bash": "./vendor/bash/index.js",
|
|
48
50
|
"./persistent": "./vendor/persistent/index.js",
|
|
@@ -301,7 +303,6 @@
|
|
|
301
303
|
"@deepseek-ai/schemastery": "3.18.2",
|
|
302
304
|
"@anionex/dsh-computer-use": "0.3.2",
|
|
303
305
|
"chrome-devtools-mcp": "1.9.0",
|
|
304
|
-
"dsh-code": "1.2.0",
|
|
305
306
|
"imapflow": "2.0.2",
|
|
306
307
|
"mailparser": "3.9.26",
|
|
307
308
|
"nodemailer": "10.0.9",
|
|
@@ -40,7 +40,7 @@ export const MESSAGES = {
|
|
|
40
40
|
'language.set': 'language → {name}', 'language.title': '/language — interface language', 'language.currentMark': 'current', 'language.unknown': 'Unknown language "{value}". Choose en, zh-CN, zh-TW, ja, ko or es.',
|
|
41
41
|
'language.saveFailed': 'language save failed: {error}',
|
|
42
42
|
'doctor.logs.new': 'Only warnings/errors since this TUI version started are recorded.',
|
|
43
|
-
'footer.current': 'current', 'footer.average': 'average', 'footer.context': 'context', 'footer.cache': 'cache hit', 'composer.placeholder': 'type a message',
|
|
43
|
+
'footer.current': 'current', 'footer.average': 'average', 'footer.context': 'context', 'footer.cache': 'cache hit', 'composer.placeholder': 'type a message', 'composer.shellMode': '! shell mode · esc exits',
|
|
44
44
|
'compaction.running': 'Compacting context, please wait', 'compaction.confirm.title': 'Switching to {model} will compact the conversation',
|
|
45
45
|
'compaction.confirm.usage': 'context {used} ≥ compaction threshold {threshold} ({window} × {ratio})', 'compaction.confirm.next': 'the next step compacts older history first',
|
|
46
46
|
'compaction.confirm.overflow': 'it already exceeds the {window} window: the next request compacts and retries', 'compaction.confirm.hint': 'y switch · n/esc back',
|
|
@@ -68,7 +68,7 @@ export const MESSAGES = {
|
|
|
68
68
|
'language.set': '语言 → {name}', 'language.title': '/language — 界面语言', 'language.currentMark': '当前', 'language.unknown': '未知语言 "{value}"。可选 en、zh-CN、zh-TW、ja、ko、es。',
|
|
69
69
|
'language.saveFailed': '语言设置保存失败:{error}',
|
|
70
70
|
'doctor.logs.new': '仅记录新版 TUI 启动后的 warning/error。',
|
|
71
|
-
'footer.current': '当前', 'footer.average': '平均', 'footer.context': '上下文', 'footer.cache': '缓存命中', 'composer.placeholder': '输入消息',
|
|
71
|
+
'footer.current': '当前', 'footer.average': '平均', 'footer.context': '上下文', 'footer.cache': '缓存命中', 'composer.placeholder': '输入消息', 'composer.shellMode': '! shell 模式 · esc 退出',
|
|
72
72
|
'compaction.running': '正在压缩上下文,请稍后', 'compaction.confirm.title': '切换到 {model} 会触发自动压缩',
|
|
73
73
|
'compaction.confirm.usage': '当前上下文 {used} ≥ 压缩阈值 {threshold}({window} × {ratio})', 'compaction.confirm.next': '下一步开始前会先压缩较早的对话',
|
|
74
74
|
'compaction.confirm.overflow': '已超出新模型的 {window} 上下文窗口:下一次请求会先压缩再重试', 'compaction.confirm.hint': 'y 确认切换 · n/esc 返回',
|
|
@@ -96,7 +96,7 @@ export const MESSAGES = {
|
|
|
96
96
|
'language.set': '語言 → {name}', 'language.title': '/language — 介面語言', 'language.currentMark': '目前', 'language.unknown': '未知語言 "{value}"。可選 en、zh-CN、zh-TW、ja、ko、es。',
|
|
97
97
|
'language.saveFailed': '語言設定儲存失敗:{error}',
|
|
98
98
|
'doctor.logs.new': '僅記錄新版 TUI 啟動後的 warning/error。',
|
|
99
|
-
'footer.current': '目前', 'footer.average': '平均', 'footer.context': '上下文', 'footer.cache': '快取命中', 'composer.placeholder': '輸入訊息',
|
|
99
|
+
'footer.current': '目前', 'footer.average': '平均', 'footer.context': '上下文', 'footer.cache': '快取命中', 'composer.placeholder': '輸入訊息', 'composer.shellMode': '! shell 模式 · esc 離開',
|
|
100
100
|
'compaction.running': '正在壓縮上下文,請稍候', 'compaction.confirm.title': '切換到 {model} 會觸發自動壓縮',
|
|
101
101
|
'compaction.confirm.usage': '目前上下文 {used} ≥ 壓縮閾值 {threshold}({window} × {ratio})', 'compaction.confirm.next': '下一步開始前會先壓縮較早的對話',
|
|
102
102
|
'compaction.confirm.overflow': '已超出新模型的 {window} 上下文視窗:下一次請求會先壓縮再重試', 'compaction.confirm.hint': 'y 確認切換 · n/esc 返回',
|
|
@@ -124,7 +124,7 @@ export const MESSAGES = {
|
|
|
124
124
|
'language.set': '言語 → {name}', 'language.title': '/language — 表示言語', 'language.currentMark': '現在', 'language.unknown': '不明な言語 "{value}"。en、zh-CN、zh-TW、ja、ko、es から選んでください。',
|
|
125
125
|
'language.saveFailed': '言語設定の保存に失敗しました:{error}',
|
|
126
126
|
'doctor.logs.new': 'この TUI バージョンの起動以降の warning/error のみ記録されています。',
|
|
127
|
-
'footer.current': '現在', 'footer.average': '平均', 'footer.context': 'コンテキスト', 'footer.cache': 'キャッシュヒット', 'composer.placeholder': 'メッセージを入力',
|
|
127
|
+
'footer.current': '現在', 'footer.average': '平均', 'footer.context': 'コンテキスト', 'footer.cache': 'キャッシュヒット', 'composer.placeholder': 'メッセージを入力', 'composer.shellMode': '! shell モード · esc で終了',
|
|
128
128
|
'compaction.running': 'コンテキストを圧縮しています。しばらくお待ちください', 'compaction.confirm.title': '{model} に切り替えると自動圧縮が実行されます',
|
|
129
129
|
'compaction.confirm.usage': '現在のコンテキスト {used} ≥ 圧縮しきい値 {threshold}({window} × {ratio})', 'compaction.confirm.next': '次のステップの前に古い履歴を圧縮します',
|
|
130
130
|
'compaction.confirm.overflow': '新しいモデルの {window} ウィンドウを超えています。次のリクエストで圧縮して再試行します', 'compaction.confirm.hint': 'y 切り替え · n/esc 戻る',
|
|
@@ -152,7 +152,7 @@ export const MESSAGES = {
|
|
|
152
152
|
'language.set': '언어 → {name}', 'language.title': '/language — 인터페이스 언어', 'language.currentMark': '현재', 'language.unknown': '알 수 없는 언어 "{value}". en, zh-CN, zh-TW, ja, ko, es 중에서 선택하세요.',
|
|
153
153
|
'language.saveFailed': '언어 설정 저장 실패: {error}',
|
|
154
154
|
'doctor.logs.new': '이 TUI 버전 시작 이후의 warning/error만 기록됩니다.',
|
|
155
|
-
'footer.current': '현재', 'footer.average': '평균', 'footer.context': '컨텍스트', 'footer.cache': '캐시 적중', 'composer.placeholder': '메시지를 입력하세요',
|
|
155
|
+
'footer.current': '현재', 'footer.average': '평균', 'footer.context': '컨텍스트', 'footer.cache': '캐시 적중', 'composer.placeholder': '메시지를 입력하세요', 'composer.shellMode': '! shell 모드 · esc 종료',
|
|
156
156
|
'compaction.running': '컨텍스트를 압축하는 중입니다. 잠시만 기다려 주세요', 'compaction.confirm.title': '{model}(으)로 전환하면 자동 압축이 실행됩니다',
|
|
157
157
|
'compaction.confirm.usage': '현재 컨텍스트 {used} ≥ 압축 임계값 {threshold} ({window} × {ratio})', 'compaction.confirm.next': '다음 단계 전에 이전 대화를 먼저 압축합니다',
|
|
158
158
|
'compaction.confirm.overflow': '새 모델의 {window} 창을 이미 넘었습니다. 다음 요청에서 압축한 뒤 재시도합니다', 'compaction.confirm.hint': 'y 전환 · n/esc 뒤로',
|
|
@@ -180,7 +180,7 @@ export const MESSAGES = {
|
|
|
180
180
|
'language.set': 'idioma → {name}', 'language.title': '/language — idioma de la interfaz', 'language.currentMark': 'actual', 'language.unknown': 'Idioma desconocido "{value}". Elige en, zh-CN, zh-TW, ja, ko o es.',
|
|
181
181
|
'language.saveFailed': 'no se pudo guardar el idioma: {error}',
|
|
182
182
|
'doctor.logs.new': 'Solo se registran los warnings/errores desde que arrancó esta versión del TUI.',
|
|
183
|
-
'footer.current': 'actual', 'footer.average': 'promedio', 'footer.context': 'contexto', 'footer.cache': 'éxitos de caché', 'composer.placeholder': 'escribe un mensaje',
|
|
183
|
+
'footer.current': 'actual', 'footer.average': 'promedio', 'footer.context': 'contexto', 'footer.cache': 'éxitos de caché', 'composer.placeholder': 'escribe un mensaje', 'composer.shellMode': '! modo shell · esc sale',
|
|
184
184
|
'compaction.running': 'Compactando el contexto, espera un momento', 'compaction.confirm.title': 'Cambiar a {model} compactará la conversación',
|
|
185
185
|
'compaction.confirm.usage': 'contexto {used} ≥ umbral de compactación {threshold} ({window} × {ratio})', 'compaction.confirm.next': 'el siguiente paso compacta antes el historial antiguo',
|
|
186
186
|
'compaction.confirm.overflow': 'ya supera la ventana de {window}: la siguiente petición compacta y reintenta', 'compaction.confirm.hint': 'y cambiar · n/esc volver',
|
|
@@ -34,17 +34,28 @@ export function summarize(rows, events = [], corrupt = false) {
|
|
|
34
34
|
if (!Number.isFinite(row.cost)) unknown = true;
|
|
35
35
|
else cost += row.cost;
|
|
36
36
|
const u = row.usage;
|
|
37
|
-
|
|
37
|
+
// An auxiliary call (memory, review, an aborted stream) can end without a usage chunk: that
|
|
38
|
+
// call is unaccounted, not a cache miss, so it must not blank the whole session's ratio.
|
|
39
|
+
if (!u) continue;
|
|
40
|
+
if (!Number.isFinite(u.inputTokens) || !Number.isFinite(u.outputTokens)) { cacheUnknown = true; continue; }
|
|
38
41
|
const total = u.inputTokens + (u.cacheReadTokens ?? 0) + (u.cacheWriteTokens ?? 0);
|
|
39
42
|
// OpenRouter reports cache reads only when there are some: a missing count is zero, not unknown.
|
|
40
43
|
input += total; hit += u.cacheReadTokens ?? 0;
|
|
41
44
|
}
|
|
42
45
|
return { cost, unknown, calls, pending, cache: input > 0 && !cacheUnknown ? Math.min(100, hit / input * 100) : null };
|
|
43
46
|
}
|
|
44
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Terminal columns of a string: East Asian wide characters (such as the cache label's
|
|
49
|
+
* CJK glyphs) take two, and zero-width marks take none. The variation selectors matter
|
|
50
|
+
* here: `❄️` is U+2744 plus U+FE0F, and counting that selector as a column made the
|
|
51
|
+
* footer's provider budget swing with the DeepSeek pricing window.
|
|
52
|
+
*/
|
|
53
|
+
const WIDE = /[\u1100-\u115f\u2e80-\ua4cf\uac00-\ud7a3\uf900-\ufaff\ufe30-\ufe4f\uff00-\uff60\uffe0-\uffe6\u2600-\u27bf\u{1f300}-\u{1faff}]/u;
|
|
54
|
+
// eslint-disable-next-line no-misleading-character-class -- these are zero width by design
|
|
55
|
+
const ZERO_WIDTH = /[\u0300-\u036f\u200d\ufe00-\ufe0f]/;
|
|
45
56
|
export function displayWidth(text) {
|
|
46
57
|
let width = 0;
|
|
47
|
-
for (const char of text) width +=
|
|
58
|
+
for (const char of text) width += ZERO_WIDTH.test(char) ? 0 : WIDE.test(char) ? 2 : 1;
|
|
48
59
|
return width;
|
|
49
60
|
}
|
|
50
61
|
export function formatFooter(metrics, context, columns = 80, rates, locale = 'en', header = '', provider = providerOfHeader(header) ?? 'deepseek-official') {
|
|
@@ -60,10 +71,10 @@ export function formatFooter(metrics, context, columns = 80, rates, locale = 'en
|
|
|
60
71
|
`${label('footer.average')}: ${Number.isFinite(rates.average) ? rates.average.toFixed(1) : '--'} tps`,
|
|
61
72
|
`${label('footer.context')}: ${ctx}`, dollars, `${label('footer.cache')}: ${cache}`,
|
|
62
73
|
] : [`${label('footer.context')}: ${ctx}`, dollars, `${label('footer.cache')}: ${cache}`];
|
|
63
|
-
// Narrow terminals shed the quietest figures first: average,
|
|
74
|
+
// Narrow terminals shed the quietest figures first: average, current, context. The
|
|
64
75
|
// model header then falls back to its bare `model @ effort` form, then context goes,
|
|
65
76
|
// and only then the header itself — the running cost is the last thing standing.
|
|
66
|
-
const drops = rates ? [1,
|
|
77
|
+
const drops = rates ? [1, 0, 2, 4] : [0, 2];
|
|
67
78
|
const offset = header === '' ? 0 : 1;
|
|
68
79
|
const parts = header === '' ? base : [header, ...base];
|
|
69
80
|
const short = header.replace(/^[^:]+: /, '');
|
|
@@ -4,6 +4,7 @@ import { readLanguage, t } from '../i18n/messages.mjs';
|
|
|
4
4
|
import { readFile, readdir, access } from 'node:fs/promises';
|
|
5
5
|
import { dirname, join, resolve } from 'node:path';
|
|
6
6
|
import { parse } from 'yaml';
|
|
7
|
+
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
7
8
|
import { standingMountFor } from '@deepseek-ai/dsh-agent-presets';
|
|
8
9
|
import { hookEvents, validateHooks } from './hooks.mjs';
|
|
9
10
|
import { redact } from '../auto-review/policy.mjs';
|
|
@@ -83,7 +84,19 @@ export function apply(ctx) {
|
|
|
83
84
|
try { const result = await handler(inv); return { ...result, text: redact(result.text ?? '') }; }
|
|
84
85
|
catch (e) { return fail(redact(`${name}: ${e.message}`)); }
|
|
85
86
|
}});
|
|
86
|
-
register('shell-exec', 'Run a user shell command (also !command)', ({ rawInput, agent, signal }) =>
|
|
87
|
+
register('shell-exec', 'Run a user shell command (also !command)', async ({ rawInput, agent, signal }) => {
|
|
88
|
+
const result = await runShell(rawInput, { cwd: agent.session.header.cwd ?? process.cwd(), signal });
|
|
89
|
+
// What the user ran belongs to the conversation: the command and its (redacted) output
|
|
90
|
+
// are handed to the agent, which then gets a turn to react to them.
|
|
91
|
+
const handover = redact(`[shell] $ ${rawInput.trim()}\n${result.text}`).slice(0, 8000);
|
|
92
|
+
try {
|
|
93
|
+
agent.followup(createUserMessage({ content: [{ type: 'text', text: handover }], source: { kind: 'plugin', plugin: 'dscode-shell-exec' } }));
|
|
94
|
+
await ctx.get('sessions')?.flush?.(agent.session);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
return fail(`shell: the command ran, but its output could not reach the agent (${error.message})`);
|
|
97
|
+
}
|
|
98
|
+
return { ...result, text: `${result.text}\n\n[output handed to the agent]` };
|
|
99
|
+
});
|
|
87
100
|
register('status', 'Session, model, permissions, usage and plugin health', ({ agent }) => {
|
|
88
101
|
const session = agent.session;
|
|
89
102
|
const route = session.requestHeader()?.config ?? agent.options;
|