dsh-gufa-code 1.3.103 → 1.3.108
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/client.js +12 -8
- package/desktop/float/bin/gufa-float-macos-arm64 +0 -0
- package/desktop/float/bin/gufa-float-macos-universal +0 -0
- package/desktop/float/bin/gufa-float-macos-x64 +0 -0
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/Info.plist +2 -2
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/MacOS/gufa-float +0 -0
- package/host/completion.js +29 -1
- package/host/fs.js +11 -3
- package/locale/en.json +2 -1
- package/locale/zh.json +2 -1
- package/package.json +1 -1
- package/src/client/00-core.js +2 -0
- package/src/client/20-editor.js +7 -0
- package/src/client/90-app.js +2 -7
package/client.js
CHANGED
|
@@ -16,7 +16,7 @@ const GUFA_NS = 'gufa-code'
|
|
|
16
16
|
const G = {}
|
|
17
17
|
G.NS = GUFA_NS
|
|
18
18
|
/** 客户端构建标记(排查页面是否加载了新代码时看标题栏) */
|
|
19
|
-
G.BUILD = '1.3.
|
|
19
|
+
G.BUILD = '1.3.108'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -169,6 +169,7 @@ const DICT_ZH = {
|
|
|
169
169
|
'app.openFolder': '打开文件夹',
|
|
170
170
|
'app.noProject': '尚未打开工作区',
|
|
171
171
|
'app.noProjectHint': '选择一个工作区,或新建一个工作区,开始古法编程。',
|
|
172
|
+
'app.noProjectHintTop': '从左上角「选择工作区」切换已有工作区,或点右上角「+ 新建工作区」。',
|
|
172
173
|
'app.projectName': '工作区名',
|
|
173
174
|
'app.parentFolder': '父目录',
|
|
174
175
|
'app.cancel': '取消',
|
|
@@ -418,6 +419,7 @@ const DICT_EN = {
|
|
|
418
419
|
'app.openFolder': 'Open folder',
|
|
419
420
|
'app.noProject': 'No workspace opened',
|
|
420
421
|
'app.noProjectHint': 'Choose a workspace or create a new one to start classic coding.',
|
|
422
|
+
'app.noProjectHintTop': 'Use the workspace picker at the top left, or + New workspace at the top right.',
|
|
421
423
|
'app.projectName': 'Workspace name',
|
|
422
424
|
'app.parentFolder': 'Parent folder',
|
|
423
425
|
'app.cancel': 'Cancel',
|
|
@@ -3103,6 +3105,13 @@ const GUFA_DEFINITION_STRONG_KINDS = new Set(['function', 'class', 'method', 'de
|
|
|
3103
3105
|
scrollbar: { verticalScrollbarSize: 10, horizontalScrollbarSize: 10, useShadows: false },
|
|
3104
3106
|
mouseWheelZoom: false,
|
|
3105
3107
|
contextmenu: true,
|
|
3108
|
+
/* 基础代码联想:显式打开自动补全与单词建议,避免依赖 Monaco 版本默认值 */
|
|
3109
|
+
quickSuggestions: { other: true, comments: false, strings: false },
|
|
3110
|
+
quickSuggestionsDelay: 10,
|
|
3111
|
+
suggestOnTriggerCharacters: true,
|
|
3112
|
+
wordBasedSuggestions: 'currentDocument',
|
|
3113
|
+
acceptSuggestionOnEnter: 'on',
|
|
3114
|
+
tabCompletion: 'on',
|
|
3106
3115
|
inlineSuggest: { enabled: true, showToolbar: 'never' },
|
|
3107
3116
|
}
|
|
3108
3117
|
}
|
|
@@ -14156,14 +14165,9 @@ G.GufaApp = function GufaApp(props) {
|
|
|
14156
14165
|
{ className: 'gufa-empty' },
|
|
14157
14166
|
h(G.Seal, { size: 64 }),
|
|
14158
14167
|
h('div', { className: 'gufa-empty-title' }, t('app.noProject')),
|
|
14159
|
-
|
|
14168
|
+
/* 不再放「选择工作区 / 新建工作区」按钮:顶部已有同一套入口,避免两套逻辑 */
|
|
14169
|
+
h('div', { className: 'gufa-empty-hint' }, t('app.noProjectHintTop')),
|
|
14160
14170
|
bootError !== '' ? h('div', { className: 'gufa-error-banner', style: { margin: 0 } }, bootError) : null,
|
|
14161
|
-
h(
|
|
14162
|
-
'div',
|
|
14163
|
-
{ className: 'gufa-row', style: { justifyContent: 'center', marginTop: 8 } },
|
|
14164
|
-
h(G.Button, { primary: true, icon: 'folder-open', onClick: () => void chooseAndOpenProject() }, t('app.openProject')),
|
|
14165
|
-
h(G.Button, { icon: 'plus', onClick: () => setModal({ type: 'newProject', parent: '', name: '' }) }, t('app.newProject')),
|
|
14166
|
-
),
|
|
14167
14171
|
)
|
|
14168
14172
|
: null
|
|
14169
14173
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<key>CFBundleDisplayName</key><string>古法编程悬浮层</string>
|
|
8
8
|
<key>CFBundleExecutable</key><string>gufa-float</string>
|
|
9
9
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
10
|
-
<key>CFBundleShortVersionString</key><string>1.3.
|
|
11
|
-
<key>CFBundleVersion</key><string>1.3.
|
|
10
|
+
<key>CFBundleShortVersionString</key><string>1.3.108</string>
|
|
11
|
+
<key>CFBundleVersion</key><string>1.3.108</string>
|
|
12
12
|
<key>LSUIElement</key><true/>
|
|
13
13
|
<key>NSHighResolutionCapable</key><true/>
|
|
14
14
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
|
Binary file
|
package/host/completion.js
CHANGED
|
@@ -20,6 +20,7 @@ const SUPPORTED = new Set([
|
|
|
20
20
|
'csharp', 'cpp', 'c', 'shell', 'yaml', 'sql', 'php', 'ruby',
|
|
21
21
|
])
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
function sanitize(text) {
|
|
24
25
|
let value = String(text ?? '')
|
|
25
26
|
/* 去掉模型偶尔带出的 markdown 围栏 */
|
|
@@ -44,6 +45,26 @@ function selectionOf(ctx) {
|
|
|
44
45
|
return undefined
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
const effortCache = new Map()
|
|
49
|
+
|
|
50
|
+
/** 补全要求低延迟:优先选最小 reasoning effort(不同模型 id 不同,如 off/minimal/low)。 */
|
|
51
|
+
async function pickReasoningEffort(llm, provider, model) {
|
|
52
|
+
const key = `${provider}|${model}`
|
|
53
|
+
if (effortCache.has(key)) return effortCache.get(key)
|
|
54
|
+
let chosen = ''
|
|
55
|
+
try {
|
|
56
|
+
const info = await llm.resolveModelInfo(provider, model)
|
|
57
|
+
const efforts = info !== null && info !== undefined && info.reasoning !== null && info.reasoning !== undefined && Array.isArray(info.reasoning.efforts)
|
|
58
|
+
? info.reasoning.efforts.map((entry) => String(entry?.id ?? '')).filter((id) => id !== '')
|
|
59
|
+
: []
|
|
60
|
+
chosen = efforts.find((id) => /^(off|none|minimal|low)$/i.test(id)) ?? efforts[0] ?? ''
|
|
61
|
+
} catch {
|
|
62
|
+
chosen = ''
|
|
63
|
+
}
|
|
64
|
+
effortCache.set(key, chosen)
|
|
65
|
+
return chosen
|
|
66
|
+
}
|
|
67
|
+
|
|
47
68
|
export async function suggest(body, env) {
|
|
48
69
|
if (typeof body.prefix !== 'string' && typeof body.suffix !== 'string') throw badRequest('prefix is required')
|
|
49
70
|
const ctx = env.ctx
|
|
@@ -79,15 +100,19 @@ export async function suggest(body, env) {
|
|
|
79
100
|
'Insertion:',
|
|
80
101
|
].join('\n')
|
|
81
102
|
|
|
103
|
+
const reasoningEffort = await pickReasoningEffort(llm, provider, model)
|
|
82
104
|
const controller = new AbortController()
|
|
83
105
|
const timer = setTimeout(() => controller.abort(), 9000)
|
|
84
106
|
let text = ''
|
|
85
107
|
let failure = null
|
|
108
|
+
let finishKind = ''
|
|
109
|
+
let usage = null
|
|
86
110
|
const startedAt = Date.now()
|
|
87
111
|
try {
|
|
88
112
|
const stream = llm.stream({
|
|
89
113
|
provider,
|
|
90
114
|
model,
|
|
115
|
+
...(reasoningEffort === '' ? {} : { reasoningEffort }),
|
|
91
116
|
system: SYSTEM_PROMPT,
|
|
92
117
|
messages: [{ role: 'user', content: [{ type: 'text', text: userPrompt }] }],
|
|
93
118
|
maxTokens: 160,
|
|
@@ -99,8 +124,10 @@ export async function suggest(body, env) {
|
|
|
99
124
|
if (chunk === null || typeof chunk !== 'object') continue
|
|
100
125
|
if (chunk.type === 'text-delta' && typeof chunk.text === 'string') text += chunk.text
|
|
101
126
|
if (chunk.type === 'reasoning-delta') continue
|
|
127
|
+
if (chunk.type === 'usage') usage = chunk.usage
|
|
102
128
|
if (chunk.type === 'finish') {
|
|
103
129
|
const reason = chunk.reason
|
|
130
|
+
finishKind = reason !== null && typeof reason === 'object' && typeof reason.kind === 'string' ? reason.kind : ''
|
|
104
131
|
if (reason !== null && typeof reason === 'object' && (reason.kind === 'error' || reason.kind === 'aborted')) {
|
|
105
132
|
failure = reason.failure ?? { message: reason.kind }
|
|
106
133
|
}
|
|
@@ -117,10 +144,11 @@ export async function suggest(body, env) {
|
|
|
117
144
|
if (controller.signal.aborted) throw new ApiError('llm-timeout', '补全请求超时', 504)
|
|
118
145
|
throw new ApiError('llm-failed', `补全模型调用失败:${message}`, 502)
|
|
119
146
|
}
|
|
147
|
+
const sanitized = sanitize(text)
|
|
120
148
|
return {
|
|
121
149
|
provider,
|
|
122
150
|
model,
|
|
123
|
-
text:
|
|
151
|
+
text: sanitized,
|
|
124
152
|
latencyMs: Date.now() - startedAt,
|
|
125
153
|
}
|
|
126
154
|
}
|
package/host/fs.js
CHANGED
|
@@ -13,7 +13,6 @@ import { tmpdir } from 'node:os'
|
|
|
13
13
|
import { dirname, extname, isAbsolute, join, relative, resolve, sep } from 'node:path'
|
|
14
14
|
import { ApiError, badRequest } from './context.js'
|
|
15
15
|
import { registerLsp } from './lsp.js'
|
|
16
|
-
import { registerCompletion } from './completion.js'
|
|
17
16
|
|
|
18
17
|
const TEXT_LIMIT = 4 * 1024 * 1024
|
|
19
18
|
const runCommand = promisify(execFile)
|
|
@@ -286,8 +285,17 @@ export function register(router, env) {
|
|
|
286
285
|
/* Python 语言服务(LSP/pyright):/lsp/definition API;Cmd+点击与悬停由客户端调用 */
|
|
287
286
|
registerLsp(router, env)
|
|
288
287
|
|
|
289
|
-
/* Tab 行内补全:借用 Harness
|
|
290
|
-
|
|
288
|
+
/* Tab 行内补全:借用 Harness 自己的模型服务(completion.js 用带 mtime 的动态 import,改它免重启) */
|
|
289
|
+
router.method('completion.suggest', async (body) => {
|
|
290
|
+
let stamp = '0'
|
|
291
|
+
try {
|
|
292
|
+
stamp = String(statSync(new URL('./completion.js', import.meta.url)).mtimeMs)
|
|
293
|
+
} catch {
|
|
294
|
+
stamp = '0'
|
|
295
|
+
}
|
|
296
|
+
const module = await import(new URL(`./completion.js?gufa-completion=${stamp}`, import.meta.url).href)
|
|
297
|
+
return module.suggest(body, env)
|
|
298
|
+
})
|
|
291
299
|
|
|
292
300
|
/* ⌘⇧N:打开新的 Harness 实例窗口(Electron 单实例下新建 BrowserWindow)。
|
|
293
301
|
app-window.js 用带 mtime 的动态 import,改它不必重启 Host。 */
|
package/locale/en.json
CHANGED
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"loading": "Loading…",
|
|
26
26
|
"error": "Something went wrong",
|
|
27
27
|
"retry": "Retry",
|
|
28
|
-
"hostStale": "Plugin upgraded: the Host is still an older build. The editor and AI chat already work; quit and reopen DeepSeek Harness to enable the real terminal."
|
|
28
|
+
"hostStale": "Plugin upgraded: the Host is still an older build. The editor and AI chat already work; quit and reopen DeepSeek Harness to enable the real terminal.",
|
|
29
|
+
"noProjectHintTop": "Use the workspace picker at the top left, or + New workspace at the top right."
|
|
29
30
|
},
|
|
30
31
|
"activity": {
|
|
31
32
|
"explorer": "Explorer",
|
package/locale/zh.json
CHANGED
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"error": "出错了",
|
|
27
27
|
"retry": "重试",
|
|
28
28
|
"hostStale": "插件已升级:当前 Host 仍是旧版本。AI 对话与编辑器已可用;请退出并重新打开 DeepSeek Harness 以启用真实终端。",
|
|
29
|
-
"noRepo": "当前工作区不是 Git 仓库"
|
|
29
|
+
"noRepo": "当前工作区不是 Git 仓库",
|
|
30
|
+
"noProjectHintTop": "从左上角「选择工作区」切换已有工作区,或点右上角「+ 新建工作区」。"
|
|
30
31
|
},
|
|
31
32
|
"activity": {
|
|
32
33
|
"explorer": "资源管理器",
|
package/package.json
CHANGED
package/src/client/00-core.js
CHANGED
|
@@ -161,6 +161,7 @@ const DICT_ZH = {
|
|
|
161
161
|
'app.openFolder': '打开文件夹',
|
|
162
162
|
'app.noProject': '尚未打开工作区',
|
|
163
163
|
'app.noProjectHint': '选择一个工作区,或新建一个工作区,开始古法编程。',
|
|
164
|
+
'app.noProjectHintTop': '从左上角「选择工作区」切换已有工作区,或点右上角「+ 新建工作区」。',
|
|
164
165
|
'app.projectName': '工作区名',
|
|
165
166
|
'app.parentFolder': '父目录',
|
|
166
167
|
'app.cancel': '取消',
|
|
@@ -410,6 +411,7 @@ const DICT_EN = {
|
|
|
410
411
|
'app.openFolder': 'Open folder',
|
|
411
412
|
'app.noProject': 'No workspace opened',
|
|
412
413
|
'app.noProjectHint': 'Choose a workspace or create a new one to start classic coding.',
|
|
414
|
+
'app.noProjectHintTop': 'Use the workspace picker at the top left, or + New workspace at the top right.',
|
|
413
415
|
'app.projectName': 'Workspace name',
|
|
414
416
|
'app.parentFolder': 'Parent folder',
|
|
415
417
|
'app.cancel': 'Cancel',
|
package/src/client/20-editor.js
CHANGED
|
@@ -481,6 +481,13 @@ const GUFA_DEFINITION_STRONG_KINDS = new Set(['function', 'class', 'method', 'de
|
|
|
481
481
|
scrollbar: { verticalScrollbarSize: 10, horizontalScrollbarSize: 10, useShadows: false },
|
|
482
482
|
mouseWheelZoom: false,
|
|
483
483
|
contextmenu: true,
|
|
484
|
+
/* 基础代码联想:显式打开自动补全与单词建议,避免依赖 Monaco 版本默认值 */
|
|
485
|
+
quickSuggestions: { other: true, comments: false, strings: false },
|
|
486
|
+
quickSuggestionsDelay: 10,
|
|
487
|
+
suggestOnTriggerCharacters: true,
|
|
488
|
+
wordBasedSuggestions: 'currentDocument',
|
|
489
|
+
acceptSuggestionOnEnter: 'on',
|
|
490
|
+
tabCompletion: 'on',
|
|
484
491
|
inlineSuggest: { enabled: true, showToolbar: 'never' },
|
|
485
492
|
}
|
|
486
493
|
}
|
package/src/client/90-app.js
CHANGED
|
@@ -2315,14 +2315,9 @@ G.GufaApp = function GufaApp(props) {
|
|
|
2315
2315
|
{ className: 'gufa-empty' },
|
|
2316
2316
|
h(G.Seal, { size: 64 }),
|
|
2317
2317
|
h('div', { className: 'gufa-empty-title' }, t('app.noProject')),
|
|
2318
|
-
|
|
2318
|
+
/* 不再放「选择工作区 / 新建工作区」按钮:顶部已有同一套入口,避免两套逻辑 */
|
|
2319
|
+
h('div', { className: 'gufa-empty-hint' }, t('app.noProjectHintTop')),
|
|
2319
2320
|
bootError !== '' ? h('div', { className: 'gufa-error-banner', style: { margin: 0 } }, bootError) : null,
|
|
2320
|
-
h(
|
|
2321
|
-
'div',
|
|
2322
|
-
{ className: 'gufa-row', style: { justifyContent: 'center', marginTop: 8 } },
|
|
2323
|
-
h(G.Button, { primary: true, icon: 'folder-open', onClick: () => void chooseAndOpenProject() }, t('app.openProject')),
|
|
2324
|
-
h(G.Button, { icon: 'plus', onClick: () => setModal({ type: 'newProject', parent: '', name: '' }) }, t('app.newProject')),
|
|
2325
|
-
),
|
|
2326
2321
|
)
|
|
2327
2322
|
: null
|
|
2328
2323
|
|