dsh-cwtools 0.1.0 → 0.2.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 +11 -7
- package/lib/client.js +342 -134
- package/lib/index.js +68 -15
- package/lib/types/client/cwtools-controller.d.ts +3 -1
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/config.d.ts +27 -3
- package/lib/types/contract/configTypes.d.ts +13 -0
- package/lib/types/index.d.ts +8 -3
- package/package.json +41 -14
package/README.md
CHANGED
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
- Up to 37 read-only tools for project knowledge, rules and scopes, navigation, diagnostics, localisation, semantic analysis, and Shader queries.
|
|
13
13
|
- `query_targeting_weight` for Stellaris combat targeting calculations.
|
|
14
|
+
- Diagnostics honour the filter list configured for the workspace (`.vscode/settings.json`), and suppressed items stay counted.
|
|
15
|
+
- Vanilla-game errors are off by default; the settings page also forwards ignored error codes, ignored file names, and the localisation diagnostic filter to the backend.
|
|
14
16
|
- Optional `write_localisation`, disabled by default, with workspace path checks and UTF-8 BOM handling.
|
|
15
17
|
- Active-first backend reuse over a dedicated `/cwtools/*` HTTP API, with no second process when a healthy matching host exists.
|
|
16
18
|
- A bounded runtime per mod workspace with single-flight startup, LRU/idle disposal, cooperative cancellation, and backend protocol/capability checks.
|
|
17
|
-
- A bilingual CWTools settings section
|
|
19
|
+
- A bilingual CWTools settings section split into Project, Backend, Read tools, and Write and output tabs, covering backend paths, runtime bounds, read groups, individual read tools, the write allowlist, and output limits.
|
|
18
20
|
|
|
19
21
|
CWT-only workspaces expose only their supported document/navigation/diagnostic subset. Targeting weights require a Stellaris full-mod workspace. The five VS Code-dependent domain writes, IDE tools, and visual editors are outside this release.
|
|
20
22
|
|
|
@@ -22,9 +24,9 @@ CWT-only workspaces expose only their supported document/navigation/diagnostic s
|
|
|
22
24
|
|
|
23
25
|
- DSH `>=0.2.2-rc.1 <0.3.0`.
|
|
24
26
|
- A matching external CWTools server built with capability protocol 1. Older servers are rejected with `backend_incompatible` instead of silently producing partial results.
|
|
25
|
-
- `cwtools-shared` 0.3.0 and `cwtools-node` 0.
|
|
27
|
+
- `cwtools-shared` 0.3.0 and `cwtools-node` 0.2.0. Development installations can link those checkouts; published installations should install them before this bundle.
|
|
26
28
|
|
|
27
|
-
The bundle does not ship a backend. Empty `backend.serverPath` auto-discovers a standalone CWTools installation or development build. Empty `backend.activeManifestPath` auto-discovers the active-host manifest.
|
|
29
|
+
The bundle does not ship a backend. Empty `backend.serverPath` auto-discovers a standalone CWTools installation or development build. Empty `backend.activeManifestPath` auto-discovers the active-host manifest. An empty `backend.gamePath` is discovered from the local Steam libraries; empty rules and cache paths try the installed extension first, then the workspace's rule checkout, then the server default.
|
|
28
30
|
|
|
29
31
|
### Install
|
|
30
32
|
|
|
@@ -60,10 +62,12 @@ See `ARCHITECTURE.md` for data flow and `CONTRIBUTING.md` for verification.
|
|
|
60
62
|
|
|
61
63
|
- 最多 37 个只读工具,覆盖项目知识、规则与作用域、导航、诊断、本地化、语义分析和 Shader 查询。
|
|
62
64
|
- 使用 `query_targeting_weight` 计算 Stellaris 战斗索敌权重。
|
|
65
|
+
- 诊断会按工作区配置的过滤列表(`.vscode/settings.json`)过滤,被过滤掉的条目仍计入统计。
|
|
66
|
+
- 原版游戏错误默认关闭;设置页还会把忽略的错误码、忽略的文件名和本地化诊断过滤模式透传给后端。
|
|
63
67
|
- 可选 `write_localisation`,默认关闭,带工作区路径约束和 UTF-8 BOM 处理。
|
|
64
68
|
- 通过独立 `/cwtools/*` HTTP API 优先复用活跃后端,工作区匹配且健康时不创建第二个进程。
|
|
65
69
|
- 每个 Mod 工作区使用有界运行时,支持 single-flight 启动、LRU/idle 释放、协作取消和后端协议/能力握手。
|
|
66
|
-
- 中英双语 CWTools
|
|
70
|
+
- 中英双语 CWTools 设置分区,分为项目 / 后端 / 只读工具 / 写入与输出四个页签,覆盖后端路径、运行时上限、只读组、单个只读工具、写入白名单和结果上限。
|
|
67
71
|
|
|
68
72
|
CWT-only 工作区只提供支持的文档、导航和诊断子集。索敌权重只用于 Stellaris full-mod 工作区。另外五个依赖 VS Code 的领域写入、IDE 工具和可视化编辑器不在首版范围内。
|
|
69
73
|
|
|
@@ -71,9 +75,9 @@ CWT-only 工作区只提供支持的文档、导航和诊断子集。索敌权
|
|
|
71
75
|
|
|
72
76
|
- DSH `>=0.2.2-rc.1 <0.3.0`。
|
|
73
77
|
- 带能力协议 1 的匹配外置 CWTools 服务端。旧服务端会返回 `backend_incompatible`,不会静默产生不完整的语义结果。
|
|
74
|
-
- `cwtools-shared` 0.3.0 与 `cwtools-node` 0.
|
|
78
|
+
- `cwtools-shared` 0.3.0 与 `cwtools-node` 0.2.0。开发安装可链接这些 checkout;发布安装应先安装这两个包。
|
|
75
79
|
|
|
76
|
-
组合包不自带后端。`backend.serverPath` 留空时自动发现独立 CWTools 安装或开发构建;`backend.activeManifestPath`
|
|
80
|
+
组合包不自带后端。`backend.serverPath` 留空时自动发现独立 CWTools 安装或开发构建;`backend.activeManifestPath` 留空时自动发现活跃宿主清单。`backend.gamePath` 留空时从本机 Steam 库自动发现安装目录;规则与缓存路径留空时先尝试已安装扩展,再尝试工作区的规则检出,最后用服务器默认值。
|
|
77
81
|
|
|
78
82
|
### 安装
|
|
79
83
|
|
|
@@ -98,4 +102,4 @@ dsh --profile <profile> --dump-config
|
|
|
98
102
|
|
|
99
103
|
工具使用调用 Agent Session 的当前工作目录。清单缺失或畸形、进程失效、工作区不匹配、宿主尚未活跃、连接失败或超时才回退到独立后端。活跃宿主协议或能力握手不兼容时返回 `backend_incompatible`,绝不启动竞争实例。已创建的运行时不会在两种后端间热迁移。不支持或歧义项目不会启动语言服务。加载中和仅有 mod 数据的结果带 readiness/cache provenance,不能当作完整 vanilla 结论。
|
|
100
104
|
|
|
101
|
-
数据流见 `ARCHITECTURE.md`,验证方式见 `CONTRIBUTING.md`。
|
|
105
|
+
数据流见 `ARCHITECTURE.md`,验证方式见 `CONTRIBUTING.md`。
|
package/lib/client.js
CHANGED
|
@@ -183,10 +183,29 @@ window.__ModuleLoader__.load({
|
|
|
183
183
|
...NUMBER_FIELDS,
|
|
184
184
|
...DEFAULT_ON_FIELDS
|
|
185
185
|
].filter((ref) => ref.block === block);
|
|
186
|
+
/** Diagnostic noise controls: two lists and the localisation filter mode. */
|
|
187
|
+
const DIAGNOSTIC_LIST_FIELDS = [{
|
|
188
|
+
field: "diagnostics.ignoreCodes",
|
|
189
|
+
block: "diagnostics"
|
|
190
|
+
}, {
|
|
191
|
+
field: "diagnostics.ignoreFiles",
|
|
192
|
+
block: "diagnostics"
|
|
193
|
+
}];
|
|
194
|
+
/** The three values the Host accepts for the localisation diagnostic filter. */
|
|
195
|
+
const CWTOOLS_LOCALISATION_FILTERS = [
|
|
196
|
+
"off",
|
|
197
|
+
"problems",
|
|
198
|
+
"all"
|
|
199
|
+
];
|
|
186
200
|
/** Every control on the page, in rendering order. */
|
|
187
201
|
const CWTOOLS_FIELDS = [
|
|
188
202
|
...topLevel("enabled"),
|
|
189
203
|
...topLevel("backend"),
|
|
204
|
+
...DIAGNOSTIC_LIST_FIELDS,
|
|
205
|
+
{
|
|
206
|
+
field: "diagnostics.localisationFilter",
|
|
207
|
+
block: "diagnostics"
|
|
208
|
+
},
|
|
190
209
|
...topLevel("readGroups"),
|
|
191
210
|
...topLevel("readTools"),
|
|
192
211
|
...topLevel("writeTools"),
|
|
@@ -240,6 +259,31 @@ window.__ModuleLoader__.load({
|
|
|
240
259
|
}
|
|
241
260
|
};
|
|
242
261
|
}
|
|
262
|
+
/** A comma-separated list field: the Host document stores an array. */
|
|
263
|
+
function listField(field) {
|
|
264
|
+
return {
|
|
265
|
+
field,
|
|
266
|
+
format: (value) => Array.isArray(value) ? value.map((item) => String(item)).join(", ") : "",
|
|
267
|
+
parse: (text) => {
|
|
268
|
+
const items = text.split(/[,\n]/).map((item) => item.trim()).filter((item) => item.length > 0);
|
|
269
|
+
return items.length === 0 ? { kind: "clear" } : {
|
|
270
|
+
kind: "set",
|
|
271
|
+
value: items
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/** The localisation filter enum: only the three Host values are accepted. */
|
|
277
|
+
function localisationFilterField(field) {
|
|
278
|
+
return {
|
|
279
|
+
field,
|
|
280
|
+
format: (value) => typeof value === "string" && CWTOOLS_LOCALISATION_FILTERS.includes(value) ? value : "off",
|
|
281
|
+
parse: (text) => CWTOOLS_LOCALISATION_FILTERS.includes(text) ? {
|
|
282
|
+
kind: "set",
|
|
283
|
+
value: text
|
|
284
|
+
} : void 0
|
|
285
|
+
};
|
|
286
|
+
}
|
|
243
287
|
/** The conversion spec of every control on the page. */
|
|
244
288
|
const SPECS = [
|
|
245
289
|
...topLevel("enabled").map((ref) => switchField(ref.field, "true")),
|
|
@@ -247,6 +291,8 @@ window.__ModuleLoader__.load({
|
|
|
247
291
|
...TEXT_FIELDS.map((ref) => (0, _deepseek_ai_dsh_client_ui_primitives.settingsTextField)(ref.field)),
|
|
248
292
|
...DEFAULT_OFF_FIELDS.filter((ref) => ref.block === "backend").map((ref) => switchField(ref.field, "false")),
|
|
249
293
|
...NUMBER_FIELDS.filter((ref) => ref.block === "backend").map(boundedNumberField),
|
|
294
|
+
...DIAGNOSTIC_LIST_FIELDS.map((ref) => listField(ref.field)),
|
|
295
|
+
localisationFilterField("diagnostics.localisationFilter"),
|
|
250
296
|
...topLevel("readGroups").map((ref) => switchField(ref.field, "true")),
|
|
251
297
|
...topLevel("readTools").map((ref) => switchField(ref.field, "true")),
|
|
252
298
|
...DEFAULT_OFF_FIELDS.filter((ref) => ref.block === "writeTools").map((ref) => switchField(ref.field, "false")),
|
|
@@ -431,8 +477,23 @@ window.__ModuleLoader__.load({
|
|
|
431
477
|
nav: "CWTools",
|
|
432
478
|
title: "CWTools",
|
|
433
479
|
intro: "Configure the CWTools language server and which semantic tools this bundle exposes. Every control on this page is saved together.",
|
|
434
|
-
|
|
480
|
+
sectionProject: "Project and game",
|
|
481
|
+
sectionBackend: "Backend and runtime",
|
|
482
|
+
tabProject: "Project",
|
|
483
|
+
tabBackend: "Backend",
|
|
484
|
+
tabRead: "Read tools",
|
|
485
|
+
tabOutput: "Write and output",
|
|
435
486
|
sectionReadAccess: "Read tools",
|
|
487
|
+
sectionDiagnostics: "Diagnostic filter",
|
|
488
|
+
ignoreCodes: "Ignored error codes",
|
|
489
|
+
ignoreCodesHint: "Comma-separated codes or message fragments the backend never reports. Vanilla errors are already off.",
|
|
490
|
+
ignoreFiles: "Ignored file names",
|
|
491
|
+
ignoreFilesHint: "Comma-separated file names whose diagnostics are dropped, such as zz_legacy.txt.",
|
|
492
|
+
localisationFilter: "Localisation diagnostics",
|
|
493
|
+
localisationFilterHint: "Filter localisation diagnostics the way the VS Code extension does.",
|
|
494
|
+
localisationFilterOff: "Off",
|
|
495
|
+
localisationFilterProblems: "Problems",
|
|
496
|
+
localisationFilterAll: "All",
|
|
436
497
|
sectionWriteAccess: "Write access",
|
|
437
498
|
sectionOutput: "Output",
|
|
438
499
|
enabled: "Enable CWTools tools",
|
|
@@ -440,11 +501,11 @@ window.__ModuleLoader__.load({
|
|
|
440
501
|
serverPath: "Server path",
|
|
441
502
|
serverPathHint: "Path to the CWTools language server executable. When empty, the backend is discovered automatically: an installed CWTools extension or a development build. This bundle does not ship one.",
|
|
442
503
|
gamePath: "Game path",
|
|
443
|
-
gamePathHint: "Path to the Paradox game installation.",
|
|
504
|
+
gamePathHint: "Path to the Paradox game installation. When empty, the install is discovered from the local Steam libraries (registry and libraryfolders.vdf).",
|
|
444
505
|
rulesPath: "Rules path",
|
|
445
|
-
rulesPathHint: "Path to the CWTools rules directory. Empty
|
|
506
|
+
rulesPathHint: "Path to the CWTools rules directory. Empty tries the installed extension, then this workspace's rule checkout, then the server default.",
|
|
446
507
|
cachePath: "Cache path",
|
|
447
|
-
cachePathHint: "Directory for the server cache. Empty
|
|
508
|
+
cachePathHint: "Directory for the server cache. Empty reuses the installed extension cache when present, otherwise the workspace default.",
|
|
448
509
|
activeManifestPath: "Active bridge manifest (optional)",
|
|
449
510
|
activeManifestPathHint: "Explicit bridge-manifest.json for active-first reuse. Empty auto-discovers the current workspace host.",
|
|
450
511
|
preferActiveBackend: "Prefer the active backend",
|
|
@@ -497,8 +558,23 @@ window.__ModuleLoader__.load({
|
|
|
497
558
|
nav: "CWTools",
|
|
498
559
|
title: "CWTools",
|
|
499
560
|
intro: "配置 CWTools 语言服务器,以及本组合包开放哪些语义工具。本页所有控件会一起保存。",
|
|
500
|
-
|
|
561
|
+
sectionProject: "项目与游戏",
|
|
562
|
+
sectionBackend: "后端与运行",
|
|
563
|
+
tabProject: "项目",
|
|
564
|
+
tabBackend: "后端",
|
|
565
|
+
tabRead: "只读工具",
|
|
566
|
+
tabOutput: "写入与输出",
|
|
501
567
|
sectionReadAccess: "只读工具",
|
|
568
|
+
sectionDiagnostics: "诊断过滤",
|
|
569
|
+
ignoreCodes: "忽略的错误码",
|
|
570
|
+
ignoreCodesHint: "逗号分隔的错误码或消息片段,后端不再报告。原版错误默认已关闭。",
|
|
571
|
+
ignoreFiles: "忽略的文件名",
|
|
572
|
+
ignoreFilesHint: "逗号分隔的文件名,其诊断会被丢弃,例如 zz_legacy.txt。",
|
|
573
|
+
localisationFilter: "本地化诊断",
|
|
574
|
+
localisationFilterHint: "按与 VS Code 扩展一致的方式过滤本地化诊断。",
|
|
575
|
+
localisationFilterOff: "不过滤",
|
|
576
|
+
localisationFilterProblems: "仅问题",
|
|
577
|
+
localisationFilterAll: "全部",
|
|
502
578
|
sectionWriteAccess: "写入权限",
|
|
503
579
|
sectionOutput: "输出",
|
|
504
580
|
enabled: "启用 CWTools 工具",
|
|
@@ -506,11 +582,11 @@ window.__ModuleLoader__.load({
|
|
|
506
582
|
serverPath: "服务器路径",
|
|
507
583
|
serverPathHint: "CWTools 语言服务器可执行文件路径。留空时自动发现后端:已安装的 CWTools 扩展或开发构建。本组合包不自带后端。",
|
|
508
584
|
gamePath: "游戏路径",
|
|
509
|
-
gamePathHint: "Paradox
|
|
585
|
+
gamePathHint: "Paradox 游戏安装目录。留空时自动从本机 Steam 库发现(注册表 + libraryfolders.vdf),无需手填。",
|
|
510
586
|
rulesPath: "规则路径",
|
|
511
|
-
rulesPathHint: "CWTools
|
|
587
|
+
rulesPathHint: "CWTools 规则目录。留空时依次尝试已安装扩展的规则、当前工作区的规则检出,最后用服务器默认值。",
|
|
512
588
|
cachePath: "缓存路径",
|
|
513
|
-
cachePathHint: "
|
|
589
|
+
cachePathHint: "服务器缓存目录。留空时优先复用已安装扩展的缓存,否则用工作区默认值。",
|
|
514
590
|
activeManifestPath: "活跃桥接清单(可选)",
|
|
515
591
|
activeManifestPathHint: "指定活跃优先复用的 bridge-manifest.json。留空时自动发现当前工作区宿主。",
|
|
516
592
|
preferActiveBackend: "优先复用活跃后端",
|
|
@@ -573,7 +649,7 @@ window.__ModuleLoader__.load({
|
|
|
573
649
|
};
|
|
574
650
|
}
|
|
575
651
|
// \0dsh-cwtools-css:C:\Users\A\Documents\cwtools-vscode\submodules\dsh-cwtool\src\client\CwtoolsSection.module.css.mjs
|
|
576
|
-
const css = ".cwtools-PxssPq_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:
|
|
652
|
+
const css = ".cwtools-PxssPq_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:16px;display:flex}.cwtools-PxssPq_header{flex-direction:column;gap:6px;display:flex}.cwtools-PxssPq_title{margin:0;font-size:16px;font-weight:500;line-height:24px}.cwtools-PxssPq_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px;line-height:20px}.cwtools-PxssPq_stack{flex-direction:column;gap:14px;display:flex}.cwtools-PxssPq_master{flex-direction:column;display:flex}.cwtools-PxssPq_tabs{align-self:stretch}.cwtools-PxssPq_panel{flex-direction:column;gap:12px;display:flex}.cwtools-PxssPq_blockHead{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:20px}.cwtools-PxssPq_rows{flex-direction:column;gap:10px;display:flex}.cwtools-PxssPq_row{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-settings-card-fill);align-items:flex-start;gap:12px;padding:10px 12px;display:flex}.cwtools-PxssPq_rowText{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.cwtools-PxssPq_rowLabel{overflow-wrap:anywhere;font-size:13px;line-height:20px}.cwtools-PxssPq_rowHint{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;font-size:12px;line-height:18px}.cwtools-PxssPq_rowMark{flex-shrink:0;align-items:center;gap:6px;display:flex}.cwtools-PxssPq_rowState{color:var(--dsw-alias-label-tertiary);min-width:24px;font-size:12px;line-height:18px}.cwtools-PxssPq_reset{appearance:none;font:inherit;border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;padding:2px 4px;font-size:12px}@media (hover:hover){.cwtools-PxssPq_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}}.cwtools-PxssPq_reset:disabled{opacity:.5;cursor:default}.cwtools-PxssPq_reset:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}.cwtools-PxssPq_cards{flex-direction:column;gap:10px;display:flex}.cwtools-PxssPq_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-settings-card-fill);padding:10px 12px}.cwtools-PxssPq_card>*{border-top:0;padding:0}.cwtools-PxssPq_groups{flex-direction:column;gap:10px;display:flex}.cwtools-PxssPq_group{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-settings-card-fill);flex-direction:column;gap:8px;padding:10px 12px 12px;display:flex}.cwtools-PxssPq_groupHead{align-items:center;gap:8px;min-height:24px;display:flex}.cwtools-PxssPq_groupTitle{flex:1;margin:0;font-size:13px;font-weight:600;line-height:20px}.cwtools-PxssPq_groupCount{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);border:.5px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);border-radius:999px;padding:0 6px;font-size:11px;line-height:16px}.cwtools-PxssPq_tools{grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:6px 14px;margin:0;padding:0;list-style:none;display:grid}.cwtools-PxssPq_tool{align-items:center;gap:8px;min-width:0;display:flex}.cwtools-PxssPq_toolName{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;font-size:12px;line-height:18px}.cwtools-PxssPq_groupOff .cwtools-PxssPq_toolName{color:var(--dsw-alias-label-tertiary)}.cwtools-PxssPq_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.cwtools-PxssPq_failure{border:.5px solid var(--dsw-alias-state-error-primary);border-radius:var(--dsw-radius-lg);flex-direction:column;gap:8px;padding:10px 12px;display:flex}.cwtools-PxssPq_failureTitle{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px;font-weight:600;line-height:20px}.cwtools-PxssPq_accepted{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:4px 16px;margin:0;font-size:12px;line-height:18px;display:flex}.cwtools-PxssPq_accepted dt{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--dsw-alias-label-tertiary)}.cwtools-PxssPq_accepted dd{overflow-wrap:anywhere;margin:0}@media (width<=560px){.cwtools-PxssPq_tools{grid-template-columns:minmax(0,1fr)}}";
|
|
577
653
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify("dsh-cwtools/CwtoolsSection.module.css") + "]") === null) {
|
|
578
654
|
const tag = document.createElement("style");
|
|
579
655
|
tag.dataset.plugin = "dsh-cwtools";
|
|
@@ -582,44 +658,71 @@ window.__ModuleLoader__.load({
|
|
|
582
658
|
document.head.appendChild(tag);
|
|
583
659
|
}
|
|
584
660
|
var CwtoolsSection_module_css_default = {
|
|
585
|
-
"groups": "cwtools-PxssPq_groups",
|
|
586
|
-
"tool": "cwtools-PxssPq_tool",
|
|
587
|
-
"toolOff": "cwtools-PxssPq_toolOff",
|
|
588
661
|
"toolName": "cwtools-PxssPq_toolName",
|
|
589
|
-
"
|
|
590
|
-
"rowMark": "cwtools-PxssPq_rowMark",
|
|
591
|
-
"groupCount": "cwtools-PxssPq_groupCount",
|
|
592
|
-
"failureTitle": "cwtools-PxssPq_failureTitle",
|
|
662
|
+
"rows": "cwtools-PxssPq_rows",
|
|
593
663
|
"rowHint": "cwtools-PxssPq_rowHint",
|
|
664
|
+
"note": "cwtools-PxssPq_note",
|
|
665
|
+
"panel": "cwtools-PxssPq_panel",
|
|
666
|
+
"failureTitle": "cwtools-PxssPq_failureTitle",
|
|
667
|
+
"section": "cwtools-PxssPq_section",
|
|
668
|
+
"title": "cwtools-PxssPq_title",
|
|
669
|
+
"rowMark": "cwtools-PxssPq_rowMark",
|
|
670
|
+
"groupHead": "cwtools-PxssPq_groupHead",
|
|
671
|
+
"groups": "cwtools-PxssPq_groups",
|
|
672
|
+
"groupTitle": "cwtools-PxssPq_groupTitle",
|
|
594
673
|
"tools": "cwtools-PxssPq_tools",
|
|
595
674
|
"failure": "cwtools-PxssPq_failure",
|
|
596
|
-
"
|
|
597
|
-
"
|
|
598
|
-
"
|
|
675
|
+
"groupOff": "cwtools-PxssPq_groupOff",
|
|
676
|
+
"groupCount": "cwtools-PxssPq_groupCount",
|
|
677
|
+
"rowText": "cwtools-PxssPq_rowText",
|
|
599
678
|
"accepted": "cwtools-PxssPq_accepted",
|
|
600
|
-
"
|
|
679
|
+
"tool": "cwtools-PxssPq_tool",
|
|
601
680
|
"row": "cwtools-PxssPq_row",
|
|
602
|
-
"
|
|
603
|
-
"block": "cwtools-PxssPq_block",
|
|
604
|
-
"groupTitle": "cwtools-PxssPq_groupTitle",
|
|
605
|
-
"intro": "cwtools-PxssPq_intro",
|
|
681
|
+
"tabs": "cwtools-PxssPq_tabs",
|
|
606
682
|
"rowLabel": "cwtools-PxssPq_rowLabel",
|
|
683
|
+
"blockHead": "cwtools-PxssPq_blockHead",
|
|
684
|
+
"master": "cwtools-PxssPq_master",
|
|
685
|
+
"stack": "cwtools-PxssPq_stack",
|
|
686
|
+
"card": "cwtools-PxssPq_card",
|
|
687
|
+
"group": "cwtools-PxssPq_group",
|
|
688
|
+
"rowState": "cwtools-PxssPq_rowState",
|
|
689
|
+
"intro": "cwtools-PxssPq_intro",
|
|
607
690
|
"reset": "cwtools-PxssPq_reset",
|
|
608
|
-
"
|
|
609
|
-
"
|
|
691
|
+
"cards": "cwtools-PxssPq_cards",
|
|
692
|
+
"header": "cwtools-PxssPq_header"
|
|
610
693
|
};
|
|
611
694
|
// src/client/CwtoolsSection.tsx
|
|
612
695
|
/**
|
|
613
696
|
* The CWTools settings section.
|
|
614
697
|
*
|
|
615
|
-
* One page over the `cwtools` Host entry
|
|
616
|
-
*
|
|
617
|
-
*
|
|
698
|
+
* One page over the `cwtools` Host entry, split into four tabs: the project
|
|
699
|
+
* and its game, the backend and its runtime bounds, the six read groups with
|
|
700
|
+
* their 37 tools, and the write allowlist with the result preview bound. The
|
|
701
|
+
* master switch stays above the tabs because it gates every other control.
|
|
618
702
|
*
|
|
619
703
|
* The page stages nothing itself: every control reports what the user typed to
|
|
620
704
|
* the controller, and the shared `SettingsForm` frame is the single place a
|
|
621
705
|
* draft becomes a document mutation. Leaving the page drops the drafts.
|
|
622
706
|
*/
|
|
707
|
+
/** Tab order and the locale key naming each one. */
|
|
708
|
+
const TABS = [
|
|
709
|
+
{
|
|
710
|
+
value: "project",
|
|
711
|
+
label: "tabProject"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
value: "backend",
|
|
715
|
+
label: "tabBackend"
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
value: "read",
|
|
719
|
+
label: "tabRead"
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
value: "output",
|
|
723
|
+
label: "tabOutput"
|
|
724
|
+
}
|
|
725
|
+
];
|
|
623
726
|
/** Locale keys of every group heading. */
|
|
624
727
|
const GROUP_LABEL = {
|
|
625
728
|
project: "groupProject",
|
|
@@ -687,6 +790,14 @@ window.__ModuleLoader__.load({
|
|
|
687
790
|
label: "maxWorkspaceRuntimes",
|
|
688
791
|
hint: "maxWorkspaceRuntimesHint"
|
|
689
792
|
},
|
|
793
|
+
"diagnostics.ignoreCodes": {
|
|
794
|
+
label: "ignoreCodes",
|
|
795
|
+
hint: "ignoreCodesHint"
|
|
796
|
+
},
|
|
797
|
+
"diagnostics.ignoreFiles": {
|
|
798
|
+
label: "ignoreFiles",
|
|
799
|
+
hint: "ignoreFilesHint"
|
|
800
|
+
},
|
|
690
801
|
"writeTools.write_localisation": {
|
|
691
802
|
label: "writeLocalisation",
|
|
692
803
|
hint: "writeLocalisationHint"
|
|
@@ -696,23 +807,23 @@ window.__ModuleLoader__.load({
|
|
|
696
807
|
hint: "maxResultCharsHint"
|
|
697
808
|
}
|
|
698
809
|
};
|
|
699
|
-
/**
|
|
700
|
-
const
|
|
701
|
-
"backend.serverPath",
|
|
810
|
+
/** Project tab: where the game and its rules live. */
|
|
811
|
+
const PROJECT_FIELDS = [
|
|
702
812
|
"backend.gamePath",
|
|
703
813
|
"backend.rulesPath",
|
|
704
814
|
"backend.cachePath",
|
|
705
|
-
"backend.activeManifestPath",
|
|
706
815
|
"backend.game"
|
|
707
816
|
];
|
|
708
|
-
/**
|
|
817
|
+
/** Backend tab: how the language server is found. */
|
|
818
|
+
const BACKEND_PATH_FIELDS = ["backend.serverPath", "backend.activeManifestPath"];
|
|
819
|
+
/** Backend tab: the bounds the runtime honours. */
|
|
709
820
|
const BACKEND_NUMBER_FIELDS = [
|
|
710
821
|
"backend.startupTimeoutMs",
|
|
711
822
|
"backend.requestTimeoutMs",
|
|
712
823
|
"backend.idleShutdownMs",
|
|
713
824
|
"backend.maxWorkspaceRuntimes"
|
|
714
825
|
];
|
|
715
|
-
/**
|
|
826
|
+
/** Backend tab: switches that change how the backend is chosen. */
|
|
716
827
|
const BACKEND_SWITCH_FIELDS = [
|
|
717
828
|
"backend.preferActiveBackend",
|
|
718
829
|
"backend.forceStart",
|
|
@@ -754,7 +865,7 @@ window.__ModuleLoader__.load({
|
|
|
754
865
|
}
|
|
755
866
|
}),
|
|
756
867
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
757
|
-
className: CwtoolsSection_module_css_default.
|
|
868
|
+
className: CwtoolsSection_module_css_default.rowState,
|
|
758
869
|
children: checked ? t("on") : t("off")
|
|
759
870
|
})
|
|
760
871
|
]
|
|
@@ -767,29 +878,22 @@ window.__ModuleLoader__.load({
|
|
|
767
878
|
const active = state.groups[group];
|
|
768
879
|
const tools = CWTOOLS_READ_TOOL_GROUPS[group];
|
|
769
880
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
770
|
-
className: CwtoolsSection_module_css_default.group,
|
|
881
|
+
className: active ? CwtoolsSection_module_css_default.group : CwtoolsSection_module_css_default.group + " " + CwtoolsSection_module_css_default.groupOff,
|
|
771
882
|
"aria-label": t(GROUP_LABEL[group]),
|
|
772
883
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
773
884
|
className: CwtoolsSection_module_css_default.groupHead,
|
|
774
|
-
children: [
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
label: t(GROUP_LABEL[group]),
|
|
787
|
-
disabled,
|
|
788
|
-
onChange: (next) => {
|
|
789
|
-
onToggle(groupField, next);
|
|
790
|
-
}
|
|
791
|
-
}),
|
|
792
|
-
state.fields[groupField]?.overridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
885
|
+
children: [
|
|
886
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
887
|
+
className: CwtoolsSection_module_css_default.groupTitle,
|
|
888
|
+
children: t(GROUP_LABEL[group])
|
|
889
|
+
}),
|
|
890
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
891
|
+
className: CwtoolsSection_module_css_default.groupCount,
|
|
892
|
+
children: tools.length
|
|
893
|
+
}),
|
|
894
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
895
|
+
className: CwtoolsSection_module_css_default.rowMark,
|
|
896
|
+
children: [state.fields[groupField]?.overridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
793
897
|
type: "button",
|
|
794
898
|
className: CwtoolsSection_module_css_default.reset,
|
|
795
899
|
disabled,
|
|
@@ -797,9 +901,16 @@ window.__ModuleLoader__.load({
|
|
|
797
901
|
onReset(groupField);
|
|
798
902
|
},
|
|
799
903
|
children: t("reset")
|
|
800
|
-
}) : null
|
|
801
|
-
|
|
802
|
-
|
|
904
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
|
|
905
|
+
checked: active,
|
|
906
|
+
label: t(GROUP_LABEL[group]),
|
|
907
|
+
disabled,
|
|
908
|
+
onChange: (next) => {
|
|
909
|
+
onToggle(groupField, next);
|
|
910
|
+
}
|
|
911
|
+
})]
|
|
912
|
+
})
|
|
913
|
+
]
|
|
803
914
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
804
915
|
className: CwtoolsSection_module_css_default.tools,
|
|
805
916
|
children: tools.map((tool) => {
|
|
@@ -832,6 +943,7 @@ window.__ModuleLoader__.load({
|
|
|
832
943
|
*/
|
|
833
944
|
function CwtoolsSection(props) {
|
|
834
945
|
const { t } = props;
|
|
946
|
+
const [tab, setTab] = (0, react.useState)("project");
|
|
835
947
|
const state = props.useCwtoolsSection((value) => value);
|
|
836
948
|
const id = (0, react.useId)();
|
|
837
949
|
const locked = !state.writable || state.saving;
|
|
@@ -885,22 +997,45 @@ window.__ModuleLoader__.load({
|
|
|
885
997
|
}
|
|
886
998
|
}, path);
|
|
887
999
|
};
|
|
1000
|
+
const cardOf = (path, numeric) => {
|
|
1001
|
+
const field = valueRow(path, numeric);
|
|
1002
|
+
/* v8 ignore next -- an undeclared path yields no field and therefore no card. */
|
|
1003
|
+
return field === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1004
|
+
className: CwtoolsSection_module_css_default.card,
|
|
1005
|
+
children: field
|
|
1006
|
+
}, path);
|
|
1007
|
+
};
|
|
1008
|
+
const localisationFilter = fieldOf("diagnostics.localisationFilter").text || "off";
|
|
1009
|
+
const tabOf = (entry) => ({
|
|
1010
|
+
value: entry.value,
|
|
1011
|
+
label: t(entry.label),
|
|
1012
|
+
id: id + "-tab-" + entry.value,
|
|
1013
|
+
panelId: id + "-panel-" + entry.value
|
|
1014
|
+
});
|
|
1015
|
+
const tabItems = [
|
|
1016
|
+
tabOf(TABS[0]),
|
|
1017
|
+
tabOf(TABS[1]),
|
|
1018
|
+
tabOf(TABS[2]),
|
|
1019
|
+
tabOf(TABS[3])
|
|
1020
|
+
];
|
|
888
1021
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
889
1022
|
className: CwtoolsSection_module_css_default.section,
|
|
890
|
-
children: [
|
|
891
|
-
|
|
1023
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
1024
|
+
className: CwtoolsSection_module_css_default.header,
|
|
1025
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
892
1026
|
className: CwtoolsSection_module_css_default.title,
|
|
893
1027
|
children: t("title")
|
|
894
|
-
}),
|
|
895
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1028
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
896
1029
|
className: CwtoolsSection_module_css_default.intro,
|
|
897
1030
|
children: t("intro")
|
|
898
|
-
})
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
1031
|
+
})]
|
|
1032
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsForm, {
|
|
1033
|
+
labels: formLabels(t),
|
|
1034
|
+
state,
|
|
1035
|
+
onSave: props.save,
|
|
1036
|
+
onDiscard: props.discard,
|
|
1037
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1038
|
+
className: CwtoolsSection_module_css_default.stack,
|
|
904
1039
|
children: [
|
|
905
1040
|
state.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
906
1041
|
className: CwtoolsSection_module_css_default.failure,
|
|
@@ -928,80 +1063,153 @@ window.__ModuleLoader__.load({
|
|
|
928
1063
|
})
|
|
929
1064
|
]
|
|
930
1065
|
}) : null,
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
children: [
|
|
935
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
936
|
-
className: CwtoolsSection_module_css_default.blockHead,
|
|
937
|
-
children: t("sectionBackend")
|
|
938
|
-
}),
|
|
939
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
940
|
-
className: CwtoolsSection_module_css_default.fields,
|
|
941
|
-
children: TEXT_ROW_FIELDS.map((path) => valueRow(path, false))
|
|
942
|
-
}),
|
|
943
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
944
|
-
className: CwtoolsSection_module_css_default.fields,
|
|
945
|
-
children: BACKEND_NUMBER_FIELDS.map((path) => valueRow(path, true))
|
|
946
|
-
}),
|
|
947
|
-
BACKEND_SWITCH_FIELDS.map((path) => switchRow(path, locked))
|
|
948
|
-
]
|
|
1066
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1067
|
+
className: CwtoolsSection_module_css_default.master,
|
|
1068
|
+
children: switchRow("enabled", locked)
|
|
949
1069
|
}),
|
|
950
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
958
|
-
className: CwtoolsSection_module_css_default.note,
|
|
959
|
-
children: t("readAccessIntro")
|
|
960
|
-
}),
|
|
961
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
962
|
-
className: CwtoolsSection_module_css_default.groups,
|
|
963
|
-
children: CWTOOLS_READ_GROUP_ORDER.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GroupBlock, {
|
|
964
|
-
group,
|
|
965
|
-
state,
|
|
966
|
-
disabled: locked,
|
|
967
|
-
t,
|
|
968
|
-
onToggle: props.toggle,
|
|
969
|
-
onReset: props.resetField
|
|
970
|
-
}, group))
|
|
971
|
-
}),
|
|
972
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
973
|
-
className: CwtoolsSection_module_css_default.note,
|
|
974
|
-
children: t("groupDisabledNote")
|
|
975
|
-
})
|
|
976
|
-
]
|
|
1070
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SegmentedTabs, {
|
|
1071
|
+
items: tabItems,
|
|
1072
|
+
value: tab,
|
|
1073
|
+
onChange: setTab,
|
|
1074
|
+
label: t("title"),
|
|
1075
|
+
size: "sm",
|
|
1076
|
+
className: CwtoolsSection_module_css_default.tabs
|
|
977
1077
|
}),
|
|
978
1078
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
979
|
-
className: CwtoolsSection_module_css_default.
|
|
1079
|
+
className: CwtoolsSection_module_css_default.panel,
|
|
1080
|
+
role: "tabpanel",
|
|
1081
|
+
id: id + "-panel-" + tab,
|
|
1082
|
+
"aria-labelledby": id + "-tab-" + tab,
|
|
980
1083
|
children: [
|
|
981
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1084
|
+
tab === "project" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
982
1085
|
className: CwtoolsSection_module_css_default.blockHead,
|
|
983
|
-
children: t("
|
|
984
|
-
}),
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1086
|
+
children: t("sectionProject")
|
|
1087
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1088
|
+
className: CwtoolsSection_module_css_default.cards,
|
|
1089
|
+
children: PROJECT_FIELDS.map((path) => cardOf(path, false))
|
|
1090
|
+
})] }) : null,
|
|
1091
|
+
tab === "backend" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1092
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1093
|
+
className: CwtoolsSection_module_css_default.blockHead,
|
|
1094
|
+
children: t("sectionBackend")
|
|
1095
|
+
}),
|
|
1096
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1097
|
+
className: CwtoolsSection_module_css_default.cards,
|
|
1098
|
+
children: BACKEND_PATH_FIELDS.map((path) => cardOf(path, false))
|
|
1099
|
+
}),
|
|
1100
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1101
|
+
className: CwtoolsSection_module_css_default.cards,
|
|
1102
|
+
children: BACKEND_NUMBER_FIELDS.map((path) => cardOf(path, true))
|
|
1103
|
+
}),
|
|
1104
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1105
|
+
className: CwtoolsSection_module_css_default.rows,
|
|
1106
|
+
children: BACKEND_SWITCH_FIELDS.map((path) => switchRow(path, locked))
|
|
1107
|
+
})
|
|
1108
|
+
] }) : null,
|
|
1109
|
+
tab === "read" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1110
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1111
|
+
className: CwtoolsSection_module_css_default.blockHead,
|
|
1112
|
+
children: t("sectionReadAccess")
|
|
1113
|
+
}),
|
|
1114
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1115
|
+
className: CwtoolsSection_module_css_default.note,
|
|
1116
|
+
children: t("readAccessIntro")
|
|
1117
|
+
}),
|
|
1118
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1119
|
+
className: CwtoolsSection_module_css_default.blockHead,
|
|
1120
|
+
children: t("sectionDiagnostics")
|
|
1121
|
+
}),
|
|
1122
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1123
|
+
className: CwtoolsSection_module_css_default.cards,
|
|
1124
|
+
children: [
|
|
1125
|
+
cardOf("diagnostics.ignoreCodes", false),
|
|
1126
|
+
cardOf("diagnostics.ignoreFiles", false),
|
|
1127
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1128
|
+
className: CwtoolsSection_module_css_default.card,
|
|
1129
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1130
|
+
className: CwtoolsSection_module_css_default.row,
|
|
1131
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1132
|
+
className: CwtoolsSection_module_css_default.rowText,
|
|
1133
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1134
|
+
className: CwtoolsSection_module_css_default.rowLabel,
|
|
1135
|
+
children: t("localisationFilter")
|
|
1136
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1137
|
+
className: CwtoolsSection_module_css_default.rowHint,
|
|
1138
|
+
children: t("localisationFilterHint")
|
|
1139
|
+
})]
|
|
1140
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1141
|
+
className: CwtoolsSection_module_css_default.rowMark,
|
|
1142
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SegmentedControl, {
|
|
1143
|
+
id: id + "-localisation-filter",
|
|
1144
|
+
value: localisationFilter,
|
|
1145
|
+
label: t("localisationFilter"),
|
|
1146
|
+
disabled: locked,
|
|
1147
|
+
options: [
|
|
1148
|
+
{
|
|
1149
|
+
value: "off",
|
|
1150
|
+
label: t("localisationFilterOff")
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
value: "problems",
|
|
1154
|
+
label: t("localisationFilterProblems")
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
value: "all",
|
|
1158
|
+
label: t("localisationFilterAll")
|
|
1159
|
+
}
|
|
1160
|
+
],
|
|
1161
|
+
onChange: (next) => {
|
|
1162
|
+
props.edit("diagnostics.localisationFilter", next);
|
|
1163
|
+
}
|
|
1164
|
+
})
|
|
1165
|
+
})]
|
|
1166
|
+
})
|
|
1167
|
+
})
|
|
1168
|
+
]
|
|
1169
|
+
}),
|
|
1170
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1171
|
+
className: CwtoolsSection_module_css_default.groups,
|
|
1172
|
+
children: CWTOOLS_READ_GROUP_ORDER.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GroupBlock, {
|
|
1173
|
+
group,
|
|
1174
|
+
state,
|
|
1175
|
+
disabled: locked,
|
|
1176
|
+
t,
|
|
1177
|
+
onToggle: props.toggle,
|
|
1178
|
+
onReset: props.resetField
|
|
1179
|
+
}, group))
|
|
1180
|
+
}),
|
|
1181
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1182
|
+
className: CwtoolsSection_module_css_default.note,
|
|
1183
|
+
children: t("groupDisabledNote")
|
|
1184
|
+
})
|
|
1185
|
+
] }) : null,
|
|
1186
|
+
tab === "output" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1187
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1188
|
+
className: CwtoolsSection_module_css_default.blockHead,
|
|
1189
|
+
children: t("sectionWriteAccess")
|
|
1190
|
+
}),
|
|
1191
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1192
|
+
className: CwtoolsSection_module_css_default.rows,
|
|
1193
|
+
children: switchRow("writeTools.write_localisation", locked)
|
|
1194
|
+
}),
|
|
1195
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1196
|
+
className: CwtoolsSection_module_css_default.note,
|
|
1197
|
+
children: t("writePolicyNote")
|
|
1198
|
+
}),
|
|
1199
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1200
|
+
className: CwtoolsSection_module_css_default.blockHead,
|
|
1201
|
+
children: t("sectionOutput")
|
|
1202
|
+
}),
|
|
1203
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1204
|
+
className: CwtoolsSection_module_css_default.cards,
|
|
1205
|
+
children: cardOf("output.maxResultChars", true)
|
|
1206
|
+
})
|
|
1207
|
+
] }) : null
|
|
990
1208
|
]
|
|
991
|
-
}),
|
|
992
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
993
|
-
className: CwtoolsSection_module_css_default.block,
|
|
994
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
995
|
-
className: CwtoolsSection_module_css_default.blockHead,
|
|
996
|
-
children: t("sectionOutput")
|
|
997
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
998
|
-
className: CwtoolsSection_module_css_default.fields,
|
|
999
|
-
children: valueRow("output.maxResultChars", true)
|
|
1000
|
-
})]
|
|
1001
1209
|
})
|
|
1002
1210
|
]
|
|
1003
1211
|
})
|
|
1004
|
-
]
|
|
1212
|
+
})]
|
|
1005
1213
|
});
|
|
1006
1214
|
}
|
|
1007
1215
|
// src/client/CwtoolsSectionIcon.tsx
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createToolCallHandler, getMcpToolRegistryMetadata, isMcpToolAvailable, listMcpToolSchemas } from "cwtools-shared";
|
|
2
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { createToolCallHandler, getMcpToolRegistryMetadata, isMcpToolAvailable, listMcpToolSchemas } from "cwtools-shared";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createNativeBridgeLspHost, createNodeHostServices, detectProjectSupport, discoverNativeBridge } from "cwtools-node";
|
|
5
5
|
// src/contract/toolCatalog.ts
|
|
@@ -77,7 +77,7 @@ function cwtoolsReadGroupFor(name) {
|
|
|
77
77
|
// src/config.ts
|
|
78
78
|
const timer = z.number().step(1).min(1).max(2147483647);
|
|
79
79
|
const Config = z.object({
|
|
80
|
-
enabled: z.boolean().default(true),
|
|
80
|
+
enabled: z.boolean().default(true).volatile(),
|
|
81
81
|
readGroups: z.object({
|
|
82
82
|
project: z.boolean().default(true),
|
|
83
83
|
localisation: z.boolean().default(true),
|
|
@@ -85,9 +85,9 @@ const Config = z.object({
|
|
|
85
85
|
navigation: z.boolean().default(true),
|
|
86
86
|
diagnostics: z.boolean().default(true),
|
|
87
87
|
shader: z.boolean().default(true)
|
|
88
|
-
}).default({}),
|
|
89
|
-
readTools: z.dict(z.boolean(), z.string()).default({}),
|
|
90
|
-
writeTools: z.object({ write_localisation: z.boolean().default(false) }).default({}),
|
|
88
|
+
}).default({}).volatile(),
|
|
89
|
+
readTools: z.dict(z.boolean(), z.string()).default({}).volatile(),
|
|
90
|
+
writeTools: z.object({ write_localisation: z.boolean().default(false) }).default({}).volatile(),
|
|
91
91
|
backend: z.object({
|
|
92
92
|
serverPath: z.string().default(""),
|
|
93
93
|
gamePath: z.string().default(""),
|
|
@@ -102,9 +102,37 @@ const Config = z.object({
|
|
|
102
102
|
preferActiveBackend: z.boolean().default(true),
|
|
103
103
|
activeManifestPath: z.string().default(""),
|
|
104
104
|
debug: z.boolean().default(false)
|
|
105
|
-
}).default({}),
|
|
106
|
-
|
|
105
|
+
}).default({}).volatile(),
|
|
106
|
+
diagnostics: z.object({
|
|
107
|
+
ignoreCodes: z.array(z.string()).default([]),
|
|
108
|
+
ignoreFiles: z.array(z.string()).default([]),
|
|
109
|
+
localisationFilter: z.union([
|
|
110
|
+
z.const("off"),
|
|
111
|
+
z.const("problems"),
|
|
112
|
+
z.const("all")
|
|
113
|
+
]).default("off")
|
|
114
|
+
}).default({}).volatile(),
|
|
115
|
+
output: z.object({ maxResultChars: z.number().step(1).min(1e3).max(2e5).default(16e3) }).default({}).volatile()
|
|
107
116
|
});
|
|
117
|
+
/** Read every live section once so one operation sees one consistent configuration.
|
|
118
|
+
* @param config - the Host-provided live configuration.
|
|
119
|
+
* @returns plain values for the runtime, tools and their snapshots.
|
|
120
|
+
*/
|
|
121
|
+
function snapshotConfig(config) {
|
|
122
|
+
return {
|
|
123
|
+
enabled: config.enabled.get(),
|
|
124
|
+
readGroups: { ...config.readGroups.get() },
|
|
125
|
+
readTools: { ...config.readTools.get() },
|
|
126
|
+
writeTools: { ...config.writeTools.get() },
|
|
127
|
+
backend: { ...config.backend.get() },
|
|
128
|
+
diagnostics: {
|
|
129
|
+
ignoreCodes: [...config.diagnostics.get().ignoreCodes],
|
|
130
|
+
ignoreFiles: [...config.diagnostics.get().ignoreFiles],
|
|
131
|
+
localisationFilter: config.diagnostics.get().localisationFilter
|
|
132
|
+
},
|
|
133
|
+
output: { ...config.output.get() }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
108
136
|
function isReadToolEnabled(config, name) {
|
|
109
137
|
return config.enabled && config.readGroups[cwtoolsReadGroupFor(name)] && config.readTools[name] !== false;
|
|
110
138
|
}
|
|
@@ -436,24 +464,29 @@ var CwtoolsRuntimePool = class {
|
|
|
436
464
|
throw new CwtoolsToolError("runtime_disposed", "The CWTools runtime has been disposed.");
|
|
437
465
|
}
|
|
438
466
|
const writes = isWriteLocalisationEnabled(this.config);
|
|
439
|
-
const
|
|
467
|
+
const hostOptions = {
|
|
440
468
|
workspaceRoot: project.root,
|
|
441
469
|
game: project.game === "paradox" || project.game === "cwt" ? void 0 : project.game,
|
|
442
470
|
serverPath: optional(this.config.backend.serverPath),
|
|
443
471
|
gamePath: optional(this.config.backend.gamePath),
|
|
444
472
|
cachePath: optional(this.config.backend.cachePath),
|
|
445
473
|
rulesPath: optional(this.config.backend.rulesPath),
|
|
474
|
+
errorIgnoreCodes: this.config.diagnostics.ignoreCodes,
|
|
475
|
+
errorIgnoreFiles: this.config.diagnostics.ignoreFiles,
|
|
476
|
+
localisationDiagnosticFilter: this.config.diagnostics.localisationFilter,
|
|
446
477
|
enableWrites: writes,
|
|
447
478
|
allowedTools: writes ? ["write_localisation"] : [],
|
|
448
479
|
forceStart: this.config.backend.forceStart,
|
|
449
480
|
startupTimeoutMs: this.config.backend.startupTimeoutMs,
|
|
450
481
|
requestTimeoutMs: this.config.backend.requestTimeoutMs,
|
|
451
482
|
debug: this.config.backend.debug,
|
|
483
|
+
honorWorkspaceIgnoreList: true,
|
|
452
484
|
...active === void 0 ? {} : {
|
|
453
485
|
lspHost: active.lspHost,
|
|
454
486
|
readyAtMs: active.readyAtMs
|
|
455
487
|
}
|
|
456
|
-
}
|
|
488
|
+
};
|
|
489
|
+
const host = createNodeHostServices(hostOptions);
|
|
457
490
|
const entry = {
|
|
458
491
|
root: project.root,
|
|
459
492
|
host,
|
|
@@ -518,22 +551,42 @@ const inject = [
|
|
|
518
551
|
"systemPrompt",
|
|
519
552
|
"workingDirectory"
|
|
520
553
|
];
|
|
521
|
-
/** Register native CWTools tools and own every runtime resource in one effect.
|
|
554
|
+
/** Register native CWTools tools and own every runtime resource in one effect.
|
|
555
|
+
* A settings save commits volatile values into this running instance, so the
|
|
556
|
+
* resources that capture them are rebuilt instead of waiting for a restart.
|
|
557
|
+
* @param ctx - the Host plugin context.
|
|
558
|
+
* @param config - the live configuration sections this entry owns.
|
|
559
|
+
*/
|
|
522
560
|
function apply(ctx, config) {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const
|
|
561
|
+
let dispose;
|
|
562
|
+
const mount = () => {
|
|
563
|
+
const values = snapshotConfig(config);
|
|
564
|
+
if (!values.enabled) return;
|
|
565
|
+
const runtime = new CwtoolsRuntimePool(values);
|
|
526
566
|
const removePrompt = ctx.systemPrompt.section({
|
|
527
567
|
name: "tool:cwtools",
|
|
528
568
|
order: 2210,
|
|
529
569
|
text: CWTOOLS_SYSTEM_PROMPT
|
|
530
570
|
});
|
|
531
|
-
const removeTools = registerNativeCwtoolsTools(ctx,
|
|
532
|
-
|
|
571
|
+
const removeTools = registerNativeCwtoolsTools(ctx, values, runtime);
|
|
572
|
+
dispose = () => {
|
|
533
573
|
removeTools();
|
|
534
574
|
removePrompt();
|
|
535
575
|
runtime.dispose();
|
|
536
576
|
};
|
|
577
|
+
};
|
|
578
|
+
const unmount = () => {
|
|
579
|
+
const current = dispose;
|
|
580
|
+
dispose = void 0;
|
|
581
|
+
current?.();
|
|
582
|
+
};
|
|
583
|
+
ctx.effect(() => {
|
|
584
|
+
mount();
|
|
585
|
+
return unmount;
|
|
537
586
|
}, "cwtools: native tools and workspace runtimes");
|
|
587
|
+
ctx.on("loader/volatile-update", () => {
|
|
588
|
+
unmount();
|
|
589
|
+
mount();
|
|
590
|
+
});
|
|
538
591
|
}
|
|
539
592
|
export { Config, apply, inject, name };
|
|
@@ -6,7 +6,7 @@ import { type CwtoolsReadGroup, type CwtoolsReadToolName } from '../contract/too
|
|
|
6
6
|
/** Settings namespace of the Host entry this section edits. */
|
|
7
7
|
export declare const CWTOOLS_SETTINGS_NAMESPACE = "cwtools";
|
|
8
8
|
/** Configuration block a leaf belongs to. */
|
|
9
|
-
type CwtoolsBlock = 'enabled' | 'backend' | 'readGroups' | 'readTools' | 'writeTools' | 'output';
|
|
9
|
+
type CwtoolsBlock = 'enabled' | 'backend' | 'diagnostics' | 'readGroups' | 'readTools' | 'writeTools' | 'output';
|
|
10
10
|
/** One leaf field of the section, addressed inside the Host document. */
|
|
11
11
|
export interface CwtoolsFieldRef {
|
|
12
12
|
/** Dotted path inside the namespace section. */
|
|
@@ -46,6 +46,8 @@ export interface CwtoolsSectionFace extends SettingsFormActions {
|
|
|
46
46
|
*/
|
|
47
47
|
toggle: (field: string, next: boolean) => void;
|
|
48
48
|
}
|
|
49
|
+
/** The three values the Host accepts for the localisation diagnostic filter. */
|
|
50
|
+
export declare const CWTOOLS_LOCALISATION_FILTERS: readonly ["off", "problems", "all"];
|
|
49
51
|
/** Every control on the page, in rendering order. */
|
|
50
52
|
export declare const CWTOOLS_FIELDS: readonly CwtoolsFieldRef[];
|
|
51
53
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* never translated.
|
|
7
7
|
*/
|
|
8
8
|
/** Every key this section renders. */
|
|
9
|
-
export type CwtoolsLocaleKey = 'nav' | 'title' | 'intro' | 'sectionBackend' | 'sectionReadAccess' | 'sectionWriteAccess' | 'sectionOutput' | 'enabled' | 'enabledHint' | 'serverPath' | 'serverPathHint' | 'gamePath' | 'gamePathHint' | 'rulesPath' | 'rulesPathHint' | 'cachePath' | 'cachePathHint' | 'activeManifestPath' | 'activeManifestPathHint' | 'preferActiveBackend' | 'preferActiveBackendHint' | 'game' | 'gameHint' | 'forceStart' | 'forceStartHint' | 'debug' | 'debugHint' | 'startupTimeoutMs' | 'startupTimeoutMsHint' | 'requestTimeoutMs' | 'requestTimeoutMsHint' | 'idleShutdownMs' | 'idleShutdownMsHint' | 'maxWorkspaceRuntimes' | 'maxWorkspaceRuntimesHint' | 'maxResultChars' | 'maxResultCharsHint' | 'writeLocalisation' | 'writeLocalisationHint' | 'writePolicyNote' | 'groupProject' | 'groupLocalisation' | 'groupSemantic' | 'groupNavigation' | 'groupDiagnostics' | 'groupShader' | 'groupDisabledNote' | 'readAccessIntro' | 'overridden' | 'reset' | 'invalidNumber' | 'readOnly' | 'unavailable' | 'save' | 'saving' | 'saveFailed' | 'failedTitle' | 'acceptedValue' | 'retryHint' | 'conflictNotice' | 'emptyValue' | 'on' | 'off';
|
|
9
|
+
export type CwtoolsLocaleKey = 'nav' | 'title' | 'intro' | 'sectionProject' | 'sectionBackend' | 'sectionReadAccess' | 'sectionDiagnostics' | 'sectionWriteAccess' | 'sectionOutput' | 'tabProject' | 'tabBackend' | 'tabRead' | 'tabOutput' | 'enabled' | 'enabledHint' | 'serverPath' | 'serverPathHint' | 'gamePath' | 'gamePathHint' | 'rulesPath' | 'rulesPathHint' | 'cachePath' | 'cachePathHint' | 'activeManifestPath' | 'activeManifestPathHint' | 'preferActiveBackend' | 'preferActiveBackendHint' | 'game' | 'gameHint' | 'forceStart' | 'forceStartHint' | 'debug' | 'debugHint' | 'startupTimeoutMs' | 'startupTimeoutMsHint' | 'requestTimeoutMs' | 'requestTimeoutMsHint' | 'idleShutdownMs' | 'idleShutdownMsHint' | 'maxWorkspaceRuntimes' | 'maxWorkspaceRuntimesHint' | 'maxResultChars' | 'maxResultCharsHint' | 'writeLocalisation' | 'writeLocalisationHint' | 'writePolicyNote' | 'groupProject' | 'groupLocalisation' | 'groupSemantic' | 'groupNavigation' | 'groupDiagnostics' | 'groupShader' | 'groupDisabledNote' | 'readAccessIntro' | 'ignoreCodes' | 'ignoreCodesHint' | 'ignoreFiles' | 'ignoreFilesHint' | 'localisationFilter' | 'localisationFilterHint' | 'localisationFilterOff' | 'localisationFilterProblems' | 'localisationFilterAll' | 'overridden' | 'reset' | 'invalidNumber' | 'readOnly' | 'unavailable' | 'save' | 'saving' | 'saveFailed' | 'failedTitle' | 'acceptedValue' | 'retryHint' | 'conflictNotice' | 'emptyValue' | 'on' | 'off';
|
|
10
10
|
/** English copy. */
|
|
11
11
|
export declare const en: Record<CwtoolsLocaleKey, string>;
|
|
12
12
|
/** Simplified Chinese copy, checked against the English keys. */
|
package/lib/types/config.d.ts
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
import type { Volatile } from '@deepseek-ai/cordis';
|
|
1
2
|
import z from '@deepseek-ai/schemastery';
|
|
2
|
-
import type { CwtoolsConfig, CwtoolsConfigInput } from './contract/configTypes.ts';
|
|
3
|
-
import { type CwtoolsReadToolName } from './contract/toolCatalog.ts';
|
|
3
|
+
import type { CwtoolsBackendConfig, CwtoolsConfig, CwtoolsConfigInput, CwtoolsDiagnosticsConfig } from './contract/configTypes.ts';
|
|
4
|
+
import { type CwtoolsReadGroup, type CwtoolsReadToolName, type CwtoolsWriteToolName } from './contract/toolCatalog.ts';
|
|
5
|
+
/** Plain, unwrapped values the runtime consumes. */
|
|
4
6
|
export type Config = CwtoolsConfig;
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Host-provided live surface: the Host passes every editable section as a
|
|
9
|
+
* volatile reference, so a saved settings change reaches the running instance
|
|
10
|
+
* without remounting it. Sections without a volatile reference never appear in
|
|
11
|
+
* the Host settings page at all.
|
|
12
|
+
*/
|
|
13
|
+
export interface CwtoolsLiveConfig {
|
|
14
|
+
enabled: Volatile<boolean>;
|
|
15
|
+
readGroups: Volatile<Record<CwtoolsReadGroup, boolean>>;
|
|
16
|
+
readTools: Volatile<Partial<Record<CwtoolsReadToolName, boolean>>>;
|
|
17
|
+
writeTools: Volatile<Partial<Record<CwtoolsWriteToolName, boolean>>>;
|
|
18
|
+
backend: Volatile<CwtoolsBackendConfig>;
|
|
19
|
+
diagnostics: Volatile<CwtoolsDiagnosticsConfig>;
|
|
20
|
+
output: Volatile<{
|
|
21
|
+
maxResultChars: number;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
export declare const Config: z<CwtoolsConfigInput, CwtoolsLiveConfig>;
|
|
25
|
+
/** Read every live section once so one operation sees one consistent configuration.
|
|
26
|
+
* @param config - the Host-provided live configuration.
|
|
27
|
+
* @returns plain values for the runtime, tools and their snapshots.
|
|
28
|
+
*/
|
|
29
|
+
export declare function snapshotConfig(config: CwtoolsLiveConfig): Config;
|
|
6
30
|
export declare function isReadToolEnabled(config: Config, name: CwtoolsReadToolName): boolean;
|
|
7
31
|
export declare function isWriteLocalisationEnabled(config: Config): boolean;
|
|
@@ -14,12 +14,24 @@ export interface CwtoolsBackendConfig {
|
|
|
14
14
|
activeManifestPath: string;
|
|
15
15
|
debug: boolean;
|
|
16
16
|
}
|
|
17
|
+
/** How localisation diagnostics are filtered, mirroring the server's `errors.localisationFilter`. */
|
|
18
|
+
export type CwtoolsLocalisationFilter = 'off' | 'problems' | 'all';
|
|
19
|
+
/** Diagnostic noise controls forwarded to the backend. */
|
|
20
|
+
export interface CwtoolsDiagnosticsConfig {
|
|
21
|
+
/** Error codes (or message fragments) the backend never reports. */
|
|
22
|
+
ignoreCodes: string[];
|
|
23
|
+
/** File names whose diagnostics are dropped. */
|
|
24
|
+
ignoreFiles: string[];
|
|
25
|
+
/** Localisation diagnostic filter mode. */
|
|
26
|
+
localisationFilter: CwtoolsLocalisationFilter;
|
|
27
|
+
}
|
|
17
28
|
export interface CwtoolsConfig {
|
|
18
29
|
enabled: boolean;
|
|
19
30
|
readGroups: Record<CwtoolsReadGroup, boolean>;
|
|
20
31
|
readTools: Partial<Record<CwtoolsReadToolName, boolean>>;
|
|
21
32
|
writeTools: Partial<Record<CwtoolsWriteToolName, boolean>>;
|
|
22
33
|
backend: CwtoolsBackendConfig;
|
|
34
|
+
diagnostics: CwtoolsDiagnosticsConfig;
|
|
23
35
|
output: {
|
|
24
36
|
maxResultChars: number;
|
|
25
37
|
};
|
|
@@ -31,6 +43,7 @@ export interface CwtoolsConfigInput {
|
|
|
31
43
|
readTools?: Partial<Record<CwtoolsReadToolName, boolean>>;
|
|
32
44
|
writeTools?: Partial<Record<CwtoolsWriteToolName, boolean>>;
|
|
33
45
|
backend?: Partial<CwtoolsBackendConfig>;
|
|
46
|
+
diagnostics?: Partial<CwtoolsDiagnosticsConfig>;
|
|
34
47
|
output?: {
|
|
35
48
|
maxResultChars?: number;
|
|
36
49
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import type
|
|
2
|
+
import { type CwtoolsLiveConfig } from './config.ts';
|
|
3
3
|
export { Config } from './config.ts';
|
|
4
4
|
export declare const name = "cwtools";
|
|
5
5
|
export declare const inject: string[];
|
|
6
|
-
/** Register native CWTools tools and own every runtime resource in one effect.
|
|
7
|
-
|
|
6
|
+
/** Register native CWTools tools and own every runtime resource in one effect.
|
|
7
|
+
* A settings save commits volatile values into this running instance, so the
|
|
8
|
+
* resources that capture them are rebuilt instead of waiting for a restart.
|
|
9
|
+
* @param ctx - the Host plugin context.
|
|
10
|
+
* @param config - the live configuration sections this entry owns.
|
|
11
|
+
*/
|
|
12
|
+
export declare function apply(ctx: Context, config: CwtoolsLiveConfig): void;
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cwtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Native DeepSeek Harness tools and settings for CWTools Paradox modding",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"types": "lib/types/index.d.ts",
|
|
9
|
+
"packageManager": "pnpm@11.24.0",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"types": "./lib/types/index.d.ts",
|
|
@@ -30,9 +31,7 @@
|
|
|
30
31
|
"LICENSE"
|
|
31
32
|
],
|
|
32
33
|
"dsh": {
|
|
33
|
-
"bundle": {
|
|
34
|
-
"patch": "./cordis.patch.yml"
|
|
35
|
-
},
|
|
34
|
+
"bundle": { "patch": "./cordis.patch.yml" },
|
|
36
35
|
"client": {
|
|
37
36
|
"platform": "web",
|
|
38
37
|
"inject": [
|
|
@@ -42,13 +41,23 @@
|
|
|
42
41
|
]
|
|
43
42
|
}
|
|
44
43
|
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "pnpm run typecheck && pnpm run build:types && tsdown",
|
|
46
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
47
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:host": "vitest run tests/host",
|
|
50
|
+
"test:client": "vitest run tests/client",
|
|
51
|
+
"prepack": "pnpm run build",
|
|
52
|
+
"prepare": "tsdown"
|
|
53
|
+
},
|
|
45
54
|
"engines": {
|
|
46
55
|
"node": ">=24.9.0",
|
|
47
56
|
"dsh": ">=0.2.2-rc.1 <0.3.0"
|
|
48
57
|
},
|
|
49
58
|
"dependencies": {
|
|
50
59
|
"@deepseek-ai/schemastery": "^3.19.0",
|
|
51
|
-
"cwtools-node": "0.
|
|
60
|
+
"cwtools-node": "0.2.0",
|
|
52
61
|
"cwtools-shared": "0.3.0"
|
|
53
62
|
},
|
|
54
63
|
"peerDependencies": {
|
|
@@ -59,6 +68,7 @@
|
|
|
59
68
|
},
|
|
60
69
|
"devDependencies": {
|
|
61
70
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
71
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.1.0",
|
|
62
72
|
"@deepseek-ai/dsh-api-remotes": ">=0.2.2-rc.1 <0.3.0",
|
|
63
73
|
"@deepseek-ai/dsh-client-locale": ">=0.2.2-rc.1 <0.3.0",
|
|
64
74
|
"@deepseek-ai/dsh-client-store": ">=0.2.2-rc.1 <0.3.0",
|
|
@@ -69,26 +79,43 @@
|
|
|
69
79
|
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.2-rc.1 <0.3.0",
|
|
70
80
|
"@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.1 <0.3.0",
|
|
71
81
|
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.1 <0.3.0",
|
|
82
|
+
"@deepseek-ai/dsh-util-code-language": "0.1.7-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.1.2-alpha.2",
|
|
72
84
|
"@deepseek-ai/dsh-working-directory": ">=0.2.2-rc.1 <0.3.0",
|
|
85
|
+
"@shikijs/langs": "^4.6.0",
|
|
73
86
|
"@testing-library/react": "^16.3.0",
|
|
87
|
+
"@types/mdast": "^4.0.4",
|
|
74
88
|
"@types/node": "^24.0.0",
|
|
75
89
|
"@types/react": "^18.3.0",
|
|
76
90
|
"@types/react-dom": "^18.3.0",
|
|
91
|
+
"anser": "^2.3.5",
|
|
92
|
+
"clsx": "^2.1.1",
|
|
93
|
+
"diff": "^9.0.0",
|
|
94
|
+
"immer": "^10.2.0",
|
|
77
95
|
"jsdom": "^26.1.0",
|
|
96
|
+
"katex": "^0.19.1",
|
|
78
97
|
"lightningcss": "^1.30.0",
|
|
98
|
+
"mdast-util-from-markdown": "^2.1.0",
|
|
99
|
+
"mdast-util-gfm": "^3.1.0",
|
|
100
|
+
"mdast-util-math": "^3.0.0",
|
|
101
|
+
"micromark-core-commonmark": "^2.0.4",
|
|
102
|
+
"micromark-extension-gfm": "^3.0.0",
|
|
103
|
+
"micromark-extension-math": "^3.1.0",
|
|
104
|
+
"micromark-factory-space": "^2.1.0",
|
|
105
|
+
"micromark-util-character": "^2.1.1",
|
|
106
|
+
"micromark-util-classify-character": "^2.0.1",
|
|
107
|
+
"micromark-util-decode-string": "^2.0.1",
|
|
108
|
+
"micromark-util-sanitize-uri": "^2.0.1",
|
|
109
|
+
"micromark-util-symbol": "^2.0.1",
|
|
110
|
+
"micromark-util-types": "^2.0.3",
|
|
79
111
|
"playwright-core": "^1.56.0",
|
|
80
112
|
"react": "^18.2.0",
|
|
81
113
|
"react-dom": "^18.2.0",
|
|
114
|
+
"shiki": "^4.6.0",
|
|
115
|
+
"simple-icons": "^16.37.0",
|
|
82
116
|
"tsdown": "^0.22.2",
|
|
83
117
|
"typescript": "^5.8.3",
|
|
84
|
-
"vitest": "^4.0.0"
|
|
85
|
-
|
|
86
|
-
"scripts": {
|
|
87
|
-
"build": "pnpm run typecheck && pnpm run build:types && tsdown",
|
|
88
|
-
"build:types": "tsc -p tsconfig.build.json",
|
|
89
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
90
|
-
"test": "vitest run",
|
|
91
|
-
"test:host": "vitest run tests/host",
|
|
92
|
-
"test:client": "vitest run tests/client"
|
|
118
|
+
"vitest": "^4.0.0",
|
|
119
|
+
"zustand": "~4.5.7"
|
|
93
120
|
}
|
|
94
121
|
}
|