@goldenpigeon/dsh-eu4-indexer 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/CONTRIBUTING.md +19 -9
  3. package/README.md +28 -15
  4. package/dist/client/client.js +28 -36
  5. package/dist/client/client.js.map +1 -1
  6. package/dist/contracts.d.ts +7 -5
  7. package/dist/contracts.js.map +1 -1
  8. package/dist/engine/index.d.ts +5 -0
  9. package/dist/engine/index.js +3 -0
  10. package/dist/engine/index.js.map +1 -0
  11. package/dist/engine/package.d.ts +6 -0
  12. package/dist/engine/package.js +76 -0
  13. package/dist/engine/package.js.map +1 -0
  14. package/dist/engine/runtime.d.ts +20 -12
  15. package/dist/engine/runtime.js +76 -222
  16. package/dist/engine/runtime.js.map +1 -1
  17. package/dist/index.js +3 -63
  18. package/dist/index.js.map +1 -1
  19. package/dist/integration/sessions.d.ts +14 -3
  20. package/dist/integration/sessions.js +93 -16
  21. package/dist/integration/sessions.js.map +1 -1
  22. package/dist/integration/skills.js +1 -1
  23. package/dist/integration/skills.js.map +1 -1
  24. package/dist/integration/tools.d.ts +69 -0
  25. package/dist/integration/tools.js +174 -0
  26. package/dist/integration/tools.js.map +1 -0
  27. package/dist/service.d.ts +1 -1
  28. package/dist/service.js +13 -34
  29. package/dist/service.js.map +1 -1
  30. package/docs/architecture.md +62 -39
  31. package/docs/installation.md +60 -0
  32. package/docs/management.md +56 -52
  33. package/docs/packaging.md +63 -20
  34. package/docs/privacy.md +10 -0
  35. package/docs/publishing.md +33 -3
  36. package/docs/usage.md +34 -28
  37. package/docs/validation.md +242 -25
  38. package/engine.lock.json +11 -9
  39. package/package.json +10 -9
  40. package/resources/docs/dependencies.md +7 -8
  41. package/resources/docs/management.md +10 -6
  42. package/resources/skills/eu4/en/SKILL.md +5 -4
  43. package/resources/skills/eu4/zh/SKILL.md +2 -2
  44. package/resources/skills/hoi4/en/SKILL.md +6 -5
  45. package/resources/skills/hoi4/zh/SKILL.md +3 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,39 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.1 — 2026-11-10
6
+
7
+ - Compare canonical packaged entry-point paths during npm/pnpm verification,
8
+ accepting Windows path separators while still requiring the exact dependency binary.
9
+
10
+ - Normalize upstream skill line endings before adapting them, so Windows builds
11
+ remove obsolete setup instructions and generate the same four skills as Unix.
12
+
13
+ - Version all eight platform binary packages with upstream engine `0.4.0`,
14
+ independently of plugin `0.1.1`. Pin the upstream release and verify source
15
+ version, exact dependencies, mixed-version release receipts and upgrades.
16
+
17
+ - Propagate chat-tool activation cancellation to registry requests and MCP startup,
18
+ and await client/query cleanup when shutdown overlaps an unload.
19
+
20
+ - Load management and MCP query tools on demand per chat through
21
+ `eu4_indexer_tools`, using original DSH rc.1 conditional tool registration.
22
+ Unloading retains background jobs and defaults; restored chats start unloaded.
23
+
24
+ - Bundle both games' pinned rule repositories inside the engine. Remove upstream
25
+ `setup`, plugin rule downloads and `install_engine`; refresh default rules from
26
+ the current engine while retaining explicit external directories.
27
+ - Replace `eu4_indexer_manage` with 16 independent management tools, preserving
28
+ chat isolation, task handling and the existing query tool set.
29
+
30
+ - Expose a DSH-independent TypeScript engine library at `@goldenpigeon/dsh-eu4-indexer/engine`; plugin management and session launch use it directly.
31
+ - Install and update the engine with the plugin through exact-version platform dependencies. Ship complete .NET publish directories, verify all file hashes, and remove the separate engine activation requirement. Preserve external engines, data and session isolation.
32
+ - Keep management `state` output valid lossless JSON when an engine is unavailable by omitting the absent environment field.
33
+
34
+ - Document Desktop's bundled CLI and migration from the unpublished local package name to `@goldenpigeon/dsh-eu4-indexer`, including the stale-dependency 404.
35
+
36
+ ## 0.1.0 — 2026-11-10
37
+
5
38
  - Upload platform engines separately from the tested Linux x64 main package, preventing concurrent same-name writes during CI release-set aggregation.
6
39
 
7
40
  - Normalize the Windows ZIP extraction root before checking entries, allowing 8.3 temporary paths while retaining traversal and link rejection. Add native Windows malicious-ZIP regressions.
package/CONTRIBUTING.md CHANGED
@@ -23,8 +23,8 @@ npm run build
23
23
  npm run check
24
24
  ```
25
25
 
26
- Optional dependencies are omitted during source development because the platform
27
- packages are not yet published. `engine.lock.json` records the exact upstream
26
+ Source development builds engines separately, so omitting optional dependencies
27
+ avoids downloading packaged platform binaries. `engine.lock.json` records the exact upstream
28
28
  source commit. Before sharing a new pin, ensure it is available remotely with its
29
29
  nested submodules. Upstream [PR #10](https://github.com/Golden-Pigeon/eu4-indexer/pull/10)
30
30
  merged the management, session isolation, HOI4 rules and SQLite security fixes into
@@ -65,22 +65,21 @@ belong upstream; DSH lifecycle and UI changes belong here.
65
65
  | `npm run test:dsh-rc1` | Install original official rc.1 dependencies temporarily and run real integrations |
66
66
  | `npm run test:dsh-rc1 -- --package` | rc.1 integration against the installed npm main and platform packages |
67
67
  | `npm run test:desktop` | The same integration using the installed desktop application's Node and dependencies |
68
- | `npm run verify:package` | Real npm/pnpm installation, platform selection, public types and offline recovery |
68
+ | `npm run verify:package` | Real npm/pnpm installation, platform selection, public types and immediate offline use |
69
69
  | `npm run verify:release` | Consistency of the complete main-plus-eight-platform release set |
70
70
 
71
71
  ### Engine and rules
72
72
 
73
- Build upstream and prepare both games' CWTools rules:
73
+ Build upstream with both games' bundled CWTools rules:
74
74
 
75
75
  ```sh
76
76
  dotnet build external/eu4-indexer/Eu4Indexer.slnx
77
- dotnet run --project external/eu4-indexer/Eu4Indexer.Cli -- setup --game eu4
78
- dotnet run --project external/eu4-indexer/Eu4Indexer.Cli -- setup --game hoi4
79
77
  npm run test:integration
80
78
  npm run test:dsh-rc1
81
79
  ```
82
80
 
83
- Rules default to `~/.eu4indexer/config/{eu4,hoi4}`. Set `EU4_CONFIG_DIR` and
81
+ Rules are copied from pinned submodules into engine build/publish output.
82
+ Set `EU4_CONFIG_DIR` and
84
83
  `HOI4_CONFIG_DIR` to use separate directories. Set `DSH_EU4_ENGINE` to select a
85
84
  self-contained engine; otherwise integration tests use upstream Debug output.
86
85
  Fixtures use synthetic games and do not distribute real game or mod data.
@@ -91,6 +90,12 @@ dependencies provide additional regression coverage; they are not host
91
90
  installation requirements. See [builds and checks](docs/packaging.md#builds-and-checks)
92
91
  for the artifact-validation sequence.
93
92
 
93
+ Set `DSH_TEST_PLUGIN_ARCHIVE` with `--package` to test a candidate main tarball
94
+ from another directory while preserving an existing release set. Platform packages
95
+ still come from `artifacts/npm/`. This mode also verifies the real management tool
96
+ pipeline with an immediately ready engine and both games' rules, independent
97
+ management tools and missing-external-engine errors.
98
+
94
99
  `test:desktop` defaults to `/Applications/DeepSeek Harness.app`; override it with
95
100
  `DSH_DESKTOP_APP`. Other platforms can set `DSH_DESKTOP_NODE` and
96
101
  `DSH_DESKTOP_RUNTIME` separately. It runs integration tests in temporary data
@@ -121,7 +126,7 @@ for installing the artifacts.
121
126
 
122
127
  When retesting an unpublished tarball with the same version, use an isolated
123
128
  cache and compare the installed browser file with current compiled output. Check
124
- engine installation, rule downloads, indexing, chat binding, in-use removal
129
+ immediate engine and bundled-rule readiness, indexing, chat binding, in-use removal
125
130
  protection and plugin disable/re-enable behavior. Record browser errors and the
126
131
  scope tested. Close the test instance and remove its temporary directories when
127
132
  finished; leave the daily desktop instance and global pnpm store alone.
@@ -136,8 +141,13 @@ archive-metadata checks.
136
141
 
137
142
  1. Update `external/eu4-indexer` and required nested submodules. Implement and
138
143
  test general functionality upstream, then commit those changes locally.
139
- 2. Set `engine.lock.json`'s `sourceCommit` to that commit. Engine builds and skill
144
+ 2. Publish an upstream release, then set `engine.lock.json`'s `sourceCommit`,
145
+ `sourceTag` and `engineVersion` to that release. Platform package versions
146
+ match the upstream engine; the plugin has its own version. Engine builds and skill
140
147
  generation require a clean upstream worktree matching the lock.
148
+ Fetch upstream tags with `git -C external/eu4-indexer fetch origin --tags`
149
+ if the checkout is shallow or predates the release. CI fetches these tags
150
+ explicitly before source validation.
141
151
  3. Run `npm run prepare:engines` to synchronize versions and platform dependencies,
142
152
  then `npm run build` to generate skills and reference docs. Rebuild affected
143
153
  native engines.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Manage and query **Europa Universalis IV** and **Hearts of Iron IV** game and mod
4
4
  scripts in DeepSeek Harness.
5
- Build indexes, manage CWTools rules, track background jobs, and query each chat's
5
+ Build indexes with bundled CWTools rules, track background jobs, and query each chat's
6
6
  selected database through MCP. Parsing and game queries come from
7
7
  [eu4-indexer](https://github.com/Golden-Pigeon/eu4-indexer), pinned as a git
8
8
  submodule.
@@ -20,8 +20,8 @@ submodule.
20
20
  ## Architecture
21
21
 
22
22
  The upstream engine provides the parser, database model, management protocol and
23
- MCP query tools. This repository adds the DSH plugin, a TypeScript/TSX management
24
- UI, background tasks and chat connections. Each chat uses an independent official
23
+ MCP query tools. This repository adds a reusable TypeScript engine library, the DSH plugin,
24
+ a TypeScript/TSX management UI, background tasks and chat connections. Each chat uses an independent official
25
25
  DSH MCP client to select its database. See [docs/architecture.md](docs/architecture.md)
26
26
  for the layout, lifecycle and concurrency model.
27
27
 
@@ -33,6 +33,8 @@ for the layout, lifecycle and concurrency model.
33
33
  browse paginated parse errors with file locations.
34
34
  - **Background tasks** — persistent progress and results, queuing, cancellation
35
35
  and interrupted-task recovery. Failed rebuilds preserve the previous index.
36
+ - **On-demand tools** — one short loader per chat; management and query schemas
37
+ appear only after activation and can be unloaded.
36
38
  - **Chat isolation** — independent default indexes with all upstream
37
39
  `mcp__eu4__…` query tools.
38
40
  - **English / Chinese skills** — the model chooses the appropriate EU4 or HOI4
@@ -46,37 +48,46 @@ Requires **DSH v0.2.2-rc.1** (declared range `>=0.2.2-rc.1 <0.3.0`) and
46
48
  Node.js 24+. The engine bundles the .NET runtime; Linux also needs the
47
49
  [platform's native libraries](docs/packaging.md#linux-native-dependencies).
48
50
 
49
- The packages are **not yet published to npm**. For local artifacts, see
50
- [local installation](docs/packaging.md#local-installation). Once published:
51
+ Install the [published npm package](https://www.npmjs.com/package/@goldenpigeon/dsh-eu4-indexer)
52
+ into your DSH profile:
51
53
 
52
54
  ```sh
53
55
  dsh plugin --profile web add @goldenpigeon/dsh-eu4-indexer
54
56
  ```
55
57
 
58
+ For Desktop's bundled CLI and migration from local unscoped builds, see the
59
+ [installation guide](docs/installation.md).
60
+
56
61
  Exact-version optional dependencies select the engine package for the host's OS,
57
- CPU and libc, downloading only the matching binary by default. To build from
58
- source, see [CONTRIBUTING.md](CONTRIBUTING.md).
62
+ CPU and libc, downloading only the matching binary by default. The engine is
63
+ ready with the plugin and updates with it; no separate engine installation or
64
+ activation is required. To build from
65
+ source, see [CONTRIBUTING.md](CONTRIBUTING.md); for local artifacts, see
66
+ [local installation](docs/packaging.md#local-installation).
59
67
 
60
68
  ## Usage
61
69
 
62
70
  Open the plugin's **Game script indexes** configuration page:
63
71
 
64
- 1. In **Engine & settings**, install the managed engine and download the rules
65
- for the games you need.
66
- 2. Select a game, mods and an index name, preview the sources, then build.
67
- 3. Bind an index to a chat and ask about events, missions, focuses, conditions,
72
+ The engine and both games' rules are already available after installation.
73
+
74
+ 1. Select a game, mods and an index name, preview the sources, then build.
75
+ 2. Bind an index to a chat and ask about events, missions, focuses, conditions,
68
76
  modifiers or game goals.
69
77
 
70
- The `eu4_indexer_manage` tool also manages indexes. `/eu4` and `/hoi4` are explicit
78
+ The model loads independent `eu4_indexer_*` tools on demand through
79
+ `eu4_indexer_tools`. `/eu4` and `/hoi4` are explicit
71
80
  skill entry points. Configuration, tasks, chat selection and upgrades are covered
72
81
  in the [usage guide](docs/usage.md); operation parameters are in the
73
82
  [management reference](docs/management.md).
74
83
 
75
84
  ## Documentation
76
85
 
77
- - [Usage Guide](docs/usage.md) — configuration, engine and rule setup, indexes,
86
+ - [Installation](docs/installation.md) — Web and Desktop commands, including
87
+ migration from local unscoped packages.
88
+ - [Usage Guide](docs/usage.md) — configuration, bundled engine and rules, indexes,
78
89
  tasks, chat bindings and skill languages.
79
- - [Management Reference](docs/management.md) — `eu4_indexer_manage` operations,
90
+ - [Management Reference](docs/management.md) — independent management tools,
80
91
  parameters and task results.
81
92
  - [Project Structure & Architecture](docs/architecture.md) — modules, lifecycle,
82
93
  concurrency and data boundaries.
@@ -101,7 +112,9 @@ validation and the submodule update workflow.
101
112
 
102
113
  This plugin is licensed under [MIT](LICENSE). The indexing engine comes from
103
114
  [eu4-indexer](https://github.com/Golden-Pigeon/eu4-indexer), with script parsing
104
- provided by [CWTools](https://github.com/cwtools/cwtools). The
115
+ provided by [CWTools](https://github.com/cwtools/cwtools). Bundled game rules come
116
+ from [EU4 config](https://github.com/cwtools/cwtools-eu4-config) and
117
+ [HOI4 config](https://github.com/cwtools/cwtools-hoi4-config), both under MIT. The
105
118
  [upstream license](resources/UPSTREAM-LICENSE) and full engine third-party notices
106
119
  are included in the packages. Game files, mods and user-generated databases are
107
120
  not distributed in the npm packages.
@@ -27,7 +27,7 @@ window.__ModuleLoader__.load({
27
27
  name: '索引名称',
28
28
  game: '游戏',
29
29
  gameDir: '游戏安装目录(留空自动检测)',
30
- configDir: '规则目录(留空使用托管规则)',
30
+ configDir: '规则目录(留空使用随包规则)',
31
31
  mods: '手动模组路径,每行一个,按加载顺序排列',
32
32
  workshop: 'Workshop 模组',
33
33
  playset: '启动器模组集',
@@ -39,7 +39,7 @@ window.__ModuleLoader__.load({
39
39
  skip: '仅索引核心类型',
40
40
  noFts: '禁用全文检索',
41
41
  advanced: '高级选项',
42
- noIndexes: '还没有索引。先下载规则,再选择游戏与模组创建索引;也可以导入已有数据库。',
42
+ noIndexes: '还没有索引。选择游戏与模组,使用随包规则创建索引;也可以导入已有数据库。',
43
43
  noTasks: '暂无后台任务',
44
44
  noSessions: '暂无已加载会话。在 DSH 中打开聊天后即可绑定。',
45
45
  chooseSession: '请选择会话',
@@ -54,9 +54,7 @@ window.__ModuleLoader__.load({
54
54
  importAction: '注册数据库',
55
55
  cancel: '取消',
56
56
  close: '关闭',
57
- install: '安装 / 更新托管引擎',
58
- setup: '下载 / 更新规则',
59
- external: '外部引擎路径(留空使用托管引擎)',
57
+ external: '外部引擎路径(留空使用随包引擎)',
60
58
  save: '检查并保存',
61
59
  running: '进行中',
62
60
  queued: '排队中',
@@ -73,9 +71,9 @@ window.__ModuleLoader__.load({
73
71
  available: '可用规则',
74
72
  clear: '清除',
75
73
  default: '自动 / 当前默认',
76
- rulesHint: '规则只需下载一次;游戏或模组更新后刷新索引即可。',
74
+ rulesHint: '规则随引擎提供并随插件更新;游戏或模组更新后刷新索引即可。',
77
75
  retained: '重建会创建并验证新数据库,完成后切换;失败或取消保留原索引。',
78
- engineHint: '托管引擎随插件构建或从锁定的发布产物安装。外部引擎必须支持管理 API 1。',
76
+ engineHint: '引擎和游戏规则随插件自动安装和更新。外部引擎必须支持管理 API 1。',
79
77
  loading: '正在读取…',
80
78
  taskId: '任务',
81
79
  sourceCount: '来源',
@@ -118,7 +116,7 @@ window.__ModuleLoader__.load({
118
116
  name: 'Index name',
119
117
  game: 'Game',
120
118
  gameDir: 'Game directory (blank: auto-detect)',
121
- configDir: 'Rules directory (blank: managed rules)',
119
+ configDir: 'Rules directory (blank: bundled rules)',
122
120
  mods: 'Manual mod paths, one per line, in load order',
123
121
  workshop: 'Workshop mods',
124
122
  playset: 'Launcher playset',
@@ -130,7 +128,7 @@ window.__ModuleLoader__.load({
130
128
  skip: 'Core entity types only',
131
129
  noFts: 'Disable full-text search',
132
130
  advanced: 'Advanced options',
133
- noIndexes: 'No indexes yet. Download rules and choose a game and mods to build an index, or import an existing database.',
131
+ noIndexes: 'No indexes yet. Choose a game and mods to build an index using bundled rules, or import an existing database.',
134
132
  noTasks: 'No background tasks',
135
133
  noSessions: 'No loaded sessions. Open a DSH chat to bind an index.',
136
134
  chooseSession: 'Choose a session',
@@ -145,9 +143,7 @@ window.__ModuleLoader__.load({
145
143
  importAction: 'Register database',
146
144
  cancel: 'Cancel',
147
145
  close: 'Close',
148
- install: 'Install / update managed engine',
149
- setup: 'Download / update rules',
150
- external: 'External engine path (blank: managed engine)',
146
+ external: 'External engine path (blank: packaged engine)',
151
147
  save: 'Check and save',
152
148
  running: 'Running',
153
149
  queued: 'Queued',
@@ -164,9 +160,9 @@ window.__ModuleLoader__.load({
164
160
  available: 'Available rules',
165
161
  clear: 'Clear',
166
162
  default: 'Auto / current default',
167
- rulesHint: 'Download rules once. Refresh indexes after a game or mod update.',
163
+ rulesHint: 'Rules are bundled with the engine and updated with the plugin. Refresh indexes after a game or mod update.',
168
164
  retained: 'A rebuild validates a new database before switching. Failure or cancellation retains the previous index.',
169
- engineHint: 'The managed engine is bundled at build time or installed from a pinned release artifact. External engines must support management API 1.',
165
+ engineHint: 'The engine and game rules are installed and updated with the plugin. External engines must support management API 1.',
170
166
  loading: 'Loading…',
171
167
  taskId: 'Task',
172
168
  sourceCount: 'sources',
@@ -414,25 +410,23 @@ window.__ModuleLoader__.load({
414
410
  React.createElement("p", { className: "hint" }, t('renameHint')),
415
411
  field('gameDir', 'gameDir'),
416
412
  field('configDir', 'configDir'),
417
- React.createElement("div", { className: "buttons" },
418
- button(t('setup'), () => act({ operation: 'setup', game: form.game }, () => setTab('tasks'))),
419
- button(t('load'), async () => {
420
- setBusy(true);
421
- setError('');
422
- try {
423
- const [workshop, playsets] = await Promise.all([
424
- api({ operation: 'workshop', game: form.game }),
425
- api({ operation: 'playsets', game: form.game }),
426
- ]);
427
- setChoices({ game: form.game, workshop, playsets });
428
- }
429
- catch (e) {
430
- setError(errorMessage(e));
431
- }
432
- finally {
433
- setBusy(false);
434
- }
435
- })),
413
+ React.createElement("div", { className: "buttons" }, button(t('load'), async () => {
414
+ setBusy(true);
415
+ setError('');
416
+ try {
417
+ const [workshop, playsets] = await Promise.all([
418
+ api({ operation: 'workshop', game: form.game }),
419
+ api({ operation: 'playsets', game: form.game }),
420
+ ]);
421
+ setChoices({ game: form.game, workshop, playsets });
422
+ }
423
+ catch (e) {
424
+ setError(errorMessage(e));
425
+ }
426
+ finally {
427
+ setBusy(false);
428
+ }
429
+ })),
436
430
  React.createElement("p", { className: "hint" }, t('rulesHint')),
437
431
  choices?.game === form.game ? (React.createElement("div", null,
438
432
  React.createElement("label", null,
@@ -505,7 +499,6 @@ window.__ModuleLoader__.load({
505
499
  React.createElement("p", { className: "hint" }, t('engineHint')),
506
500
  React.createElement("p", { className: "mono" }, `${t('enginePath')}: ${state?.engine.executable ?? state?.engine.error ?? ''}`),
507
501
  React.createElement("p", { className: "mono" }, `${t('home')}: ${state?.home ?? ''}`),
508
- button(t('install'), () => act({ operation: 'install_engine' }, () => setTab('tasks')), 'primary'),
509
502
  React.createElement("label", null,
510
503
  t('external'),
511
504
  React.createElement("input", { value: external, onChange: (e) => setExternal(e.target.value), placeholder: state?.engine.executable ?? '' })),
@@ -517,8 +510,7 @@ window.__ModuleLoader__.load({
517
510
  React.createElement("span", null,
518
511
  g.game.toUpperCase(),
519
512
  " ",
520
- g.configReady ? '✓' : '—'),
521
- button(t('setup'), () => act({ operation: 'setup', game: g.game }, () => setTab('tasks'))))))))) : null));
513
+ g.configReady ? '✓' : '—'))))))) : null));
522
514
  }
523
515
  function apply(ctx) {
524
516
  ctx.effect(() => ctx.locale.register('eu4Indexer', { zh, en }));