dsh-cait 1.0.3 → 1.0.5

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/CHANGELOG.md CHANGED
@@ -1,352 +1,410 @@
1
- # Changelog
2
-
3
- All notable changes to CAIT are documented here. The project follows
4
- [Semantic Versioning](https://semver.org/) and the format is based on
5
- [Keep a Changelog](https://keepachangelog.com/).
6
-
7
- ## [1.0.3] - 2026-11-05
8
-
9
- npm distribution.
10
-
11
- ### Added
12
-
13
- - The package can now be installed from the npm registry:
14
- `plugin_manager install_bundle target: dsh-cait` in DSH Desktop, or
15
- `dsh plugin --profile <name> add dsh-cait`. Pin a release with
16
- `dsh-cait@1.0.3`; the GitHub and local-checkout routes still work.
17
- - `engines.dsh` (`>=0.2.2-rc.1`), so the plugin manager refuses an older host
18
- with a compatibility report instead of a broken mount.
19
- - `publishConfig.access: public`, an `author` field, and the `dsh-plugin` /
20
- `cordis` keywords for the registry listing.
21
- - `prepublishOnly` rebuilds the client bundle and syntax-checks it, so a
22
- release cannot ship a stale `client.js`.
23
- - `.github/workflows/publish.yml` publishes a GitHub release through npm
24
- Trusted Publishing with `--provenance`; it checks the tag against
25
- `package.json`, runs the whole test suite, and never stores an npm token.
26
- - `@deepseek-ai/schemastery` is a `devDependency` as well as a peer dependency,
27
- so a fresh checkout can run the tests.
28
-
29
- ### Changed
30
-
31
- - `README.ja.md` ships in the package (`files`).
32
- - The README install section leads with the npm route and keeps the GitHub and
33
- local-checkout routes as alternatives.
34
- - The repository no longer tracks `node_modules/`; packed tarballs are ignored.
35
-
36
- ### Removed
37
-
38
- - `"private": true`, which blocked `npm publish`.
39
-
40
- ## [1.0.2] - 2026-11-04
41
-
42
- Interface-language fix.
43
-
44
- ### Added
45
-
46
- - Japanese README (`README.ja.md`), linked from the language switcher of all
47
- three READMEs and listed in the project layout.
48
-
49
- ### Fixed
50
-
51
- - **Follow DSH language** now follows the DSH locale instead of staying on
52
- English. The client plugin declared only `slots` in its inject list, so
53
- Cordis rejected the `ctx.locale` access with a throw that the registration
54
- `try`/`catch` swallowed: the DSH-bound translator stayed `null`, every lookup
55
- fell through to the English dictionary, and a Simplified-Chinese DSH looked
56
- English. `locale` is now a declared dependency.
57
- - `auto` resolves the locale service snapshot itself (`zh-CN` → `zh`,
58
- `ja-JP` → `ja`, `en-US` → `en`) before consulting the DSH-bound translator,
59
- so a locale tag without a registered fallback chain no longer degrades to
60
- English. The export `resolveUiLang` covers this mapping.
61
- - The workbench and the sidebar label subscribe to DSH locale changes, so
62
- switching the DSH language while `auto` is selected re-renders CAIT
63
- immediately instead of requiring a reload.
64
-
65
- ## [1.0.1] - 2026-11-04
66
-
67
- UI languages and license metadata.
68
-
69
- ### Added
70
-
71
- - Japanese (`ja`) UI dictionary. The workbench now ships three interface
72
- languages: Simplified Chinese, English, and Japanese.
73
- - **Settings → Interface → Interface language**, with *Follow DSH language*
74
- (default), 简体中文, English, and 日本語. The choice is stored as
75
- `settings.uiLang` in the CAIT store, applies to the workbench and the sidebar
76
- label immediately, and only affects the CAIT interface — document source and
77
- target languages are untouched.
78
- - `NOTICE`, the attribution supplement for Apache-2.0 (section 4(d)), and an
79
- explicit `license` field in `package.json`.
80
-
81
- ### Changed
82
-
83
- - `LICENSE` appendix copyright line now reads `Copyright 2026 Jovi Lecca`.
84
- - Version bumped to `1.0.1` (`package.json`, `CAIT_VERSION`, and the exported
85
- document metadata move together).
86
- - Verified against DSH `0.2.2-rc.1`; the README badges and development notes use
87
- that version.
88
-
89
- ### Fixed
90
-
91
- - `saveSettings` rejects an unsupported interface language with
92
- `INVALID_UI_LANG` instead of silently storing it.
93
-
94
- ## [1.0.0] - 2026-11-04
95
-
96
- First public release. CAIT was developed as `0.1.0` and renumbered to `1.0.0`
97
- for the first GitHub release.
98
-
99
- The npm package and Cordis entry are named `dsh-cait`; the UI entry, data
100
- directory (`$DSH_HOME/cait`), and API route (`/cait/api`) keep the CAIT name.
101
-
102
- ### Highlights
103
-
104
- - A complete CAT workbench inside DeepSeek Harness: sidebar entry, main panel,
105
- segment list/editor, TM/glossary/MT side panel, and export flow.
106
- - Seven agent tools that share the exact store used by the UI.
107
- - Multiple TM and glossary libraries with mounted-only lookup and default write
108
- targets.
109
- - Format-preserving DOCX and PPTX export, plus a broad text, subtitle,
110
- localization, and Office format matrix.
111
- - Persistence with atomic snapshots, corrupt-file recovery, strict confirm
112
- writes, and revision polling between agents and the open workbench.
113
-
114
- ### Added
115
-
116
- #### Plugin and UI
117
-
118
- - Host + Client bundle structure (`index.js`, `client.js`, `cordis.patch.yml`,
119
- `package.json`, locale metadata, icon).
120
- - New two-bubble A/文 icon: a bilingual speech-bubble pair that reads as
121
- source/target, used both for the package icon and the DSH sidebar mark.
122
- - Left-sidebar entry `cait` and main panel `cait`; all styling uses DSH
123
- `--dsw-alias-*` theme tokens.
124
- - English and Chinese UI dictionaries; plugin metadata locales.
125
- - Workbench with document tabs, segment rail, source highlighting, glossary
126
- chips, target editor, confirm/next/previous/draft actions, progress, and
127
- responsive density scaling from 1× to 1.8×.
128
- - Document tabs with close, reopen, new-page import, duplicate-import reuse,
129
- and a recent-document cleanup dialog for one or all closed documents.
130
- - Settings modal for source/target languages, fuzzy threshold, TM result limit,
131
- MT route/model/temperature, and library mounts.
132
- - Lightweight **库 / Libraries** modal to create, mount, and choose default TM
133
- and glossary libraries.
134
- - Visual save-failure/stale banner and a two-second revision poll so
135
- agent-triggered document switches and confirmations appear in an open
136
- workbench without discarding a dirty draft.
137
-
138
- #### Translation memory and glossary
139
-
140
- - Multiple TM libraries with id, name, mount state, default write library, and
141
- per-library deduplication.
142
- - Graded TM matching: `exact`, independent `near_exact` (ignores digits,
143
- punctuation, and whitespace), `high_fuzzy >= 0.85`,
144
- `medium_fuzzy 0.75–0.85`, `low_fuzzy < 0.75` above the configurable floor.
145
- - Lexical fuzzy scoring: character-bigram Dice (72%) + token Jaccard (28%);
146
- Latin words and CJK characters are tokenized separately.
147
- - Multiple glossary libraries, source-language filtering, live highlighting,
148
- click-to-insert terms, case-sensitive terms, CSV/TSV import, and notes.
149
- - Mounted-only lookups in the UI and tools; unmounted write targets are rejected
150
- with `TM_NOT_MOUNTED` / `GLOSSARY_NOT_MOUNTED`.
151
- - Clear operations default to mounted libraries, accept explicit mounted ids, and
152
- require `all: true` plus `confirm: true` to clear every library.
153
- - Canonical language tags via `Intl.getCanonicalLocales` (`EN` → `en`,
154
- `ZH_cn` → `zh-CN`).
155
-
156
- #### Agent tools
157
-
158
- - `cat_get_segment` — current segment, TM matches, glossary hits.
159
- - `cat_submit_translation` — confirm target, optional mounted `targetTmId`,
160
- write to TM, advance.
161
- - `cat_lookup_tm` — mounted-library graded lookup.
162
- - `cat_lookup_glossary` — mounted glossary query with language/case handling.
163
- - `cat_list_documents` — document list and progress.
164
- - `cat_switch_document` — switch active document.
165
- - `cat_suggest_mt` — MT through the selected DSH route, or explicit offline
166
- glossary-substitution fallback.
167
-
168
- #### MT
169
-
170
- - MT provider-route selector built from `ctx.llm.listProviders()` and
171
- `ctx.llm.listModels()`, optionally filtered by `ctx.loader.entries()`.
172
- - Calls through `ctx.llm.stream()`; concatenates `text-delta` chunks only.
173
- - No CAIT-managed `baseUrl` or API key; DSH resolves credentials.
174
- - Explicit offline fallback labelled **术语替换(离线) / Glossary substitution
175
- (offline)** (internal id `mock`) when no route/model is available.
176
- - Host-only detailed logging of stream failures; clients receive the generic
177
- `MT_PROVIDER_FAILED`.
178
-
179
- #### Persistence and configuration
180
-
181
- - Schemastery `dataDir` config; default `$DSH_HOME/cait` or `~/.dsh/cait`.
182
- - Versioned JSON snapshot (`version: 2`) containing documents, segments, open-tab
183
- ids, TM, glossary, libraries, mounts, and non-secret settings.
184
- - Atomic temp-file + rename writes; strict confirm writes that roll back on disk
185
- failure and return `PERSISTENCE_FAILED` (503); best-effort structural writes
186
- with a visible storage-error banner.
187
- - Corrupt/unknown-version snapshots are backed up as
188
- `store.json.corrupt-<timestamp>` and replaced with empty state.
189
- - v1 → v2 migration to default TM/glossary libraries.
190
- - DOCX and PPTX source sidecars under `sources/<document-id>.*` for
191
- format-preserving export; sidecars are removed when the document is deleted.
192
- - Open tabs and `activeDocId` persist; draft text and per-document cursor do not.
193
- - Duplicate import guard based on SHA-256 of languages, source, format, and
194
- exchange metadata.
195
-
196
- #### Formats
197
-
198
- - TXT, Markdown, DOCX body text, TMX 1.4, CSV, SRT, WebVTT, PO, XLIFF 1.2,
199
- basic XLIFF 2.0, basic SDLXLIFF, HTML, JSON string paths, XLSX, PPTX, and RTF
200
- import.
201
- - Target-only TXT/Markdown/HTML/RTF/SRT/WebVTT export; bilingual
202
- Markdown/CSV/TMX; document exports for PO, XLIFF, XLSX, and PPTX;
203
- current-document JSON; structure-preserving JSON; DOCX source-package export.
204
- - CSV column mapping by header name or 1-based number.
205
- - SRT/VTT cue timing/settings/identifier metadata; semantic inline tags retained;
206
- invalid ranges rejected; untimed cues follow the previous cue end + 2 s.
207
- - PO contexts, plural forms, translator comments, and obsolete `#~` entries.
208
- - XLIFF inline placeholders converted to `{n}` tokens and expanded back on
209
- export; confirmation rejects dropped tokens with `PLACEHOLDER_MISMATCH`.
210
- - DOCX export patches translated text into the original package, preserving
211
- paragraph/run properties, styles, numbering, images, headers, tables, and
212
- layout.
213
- - PPTX export patches translated body text into the retained source package,
214
- preserving slides, masters, shapes, images, and layout.
215
- - XLSX two-column Source/Target workbook import/export.
216
- - JSON original-template preservation through `formatMeta.jsonTemplate`.
217
-
218
- #### API and security
219
-
220
- - Same-origin JSON bridge at `GET /cait/api/health` and
221
- `POST /cait/api/rpc`.
222
- - `ctx.connection.requestRejection` browser/Origin check.
223
- - 32 MB body limit (`413 BODY_TOO_LARGE`), JSON content-type check, and
224
- allow-listed handlers.
225
- - `clearTM` / `clearGlossary` require `confirm: true` (`409
226
- CONFIRMATION_REQUIRED` otherwise).
227
- - No API key in the browser, snapshot, RPC response, or logs.
228
-
229
- ### Changed
230
-
231
- - Renamed the UI fallback from “mock” to **术语替换(离线) / Glossary
232
- substitution (offline)** while keeping internal ids compatible.
233
- - Replaced CAIT-managed OpenAI-compatible HTTP calls with DSH provider routes.
234
- - Split the 1,718-line `lib/store.js` into a `CatStore` facade plus
235
- `libraries.js`, `tm.js`, `glossary.js`, `persistence.js`,
236
- `import-export.js`, `store-utils.js`, and `errors.js`.
237
- - Split the Web UI into `client/helpers.js`, `rpc.js`, `styles.js`,
238
- `components.js`, `locales.js`, and `entry.js`; `client.js` is now generated by
239
- `scripts/build-client.mjs`.
240
- - JSON export was renamed from a purported “project backup” to
241
- `*.document.json` (current document only); structured JSON export is a
242
- separate `json-tree` format.
243
- - Subtitle export now renumbers cues in file order and maintains a monotonic
244
- cursor for untimed cues instead of overlapping `index * 2s`.
245
- - Removed the never-incremented `usageCount` TM metric.
246
- - `cat_submit_translation` now returns `tm.count` as the mounted count and
247
- `tm.total` as the all-library count.
248
- - Open documents persist `openDocIds` and `activeDocId`; settings persist, but
249
- drafts, cursor, and library-modal UI state do not.
250
- - API key and endpoint fields were removed from settings; `publicSettings()`
251
- exposes only route/model/temperature.
252
- - README rewritten for GitHub; this changelog added.
253
-
254
- ### Fixed
255
-
256
- - Mount checkbox was disabled for every unmounted library when only one was
257
- mounted; unmounted libraries are now selectable and only the last mounted one
258
- is protected.
259
- - `loadDemo()` TM entries were not persisted; demo state now survives reload.
260
- - Save errors were swallowed and confirmations could report success without a
261
- disk write; strict confirm + rollback + banner now surface the failure.
262
- - Agent-driven document switches/confirmations were invisible in an open
263
- workbench; revision polling and stale/draft handling fixed this.
264
- - DOCX table paragraphs were flattened into the body text despite the docs; table
265
- blocks are now excluded during import.
266
- - TMX inline `bpt/ept/ph` markup was silently dropped; imports now return a
267
- `TMX_INLINE_MARKUP_LOST` warning with a count.
268
- - Glossary language matching was case-sensitive in hits but case-insensitive in
269
- the tool; both paths now canonicalize.
270
- - XLIFF placeholders, PO plurals/comments/obsolete blocks, and subtitle semantic
271
- tags were dropped in earlier adapters; all are preserved now.
272
- - Subtitle zero/negative-duration cues were silently rewritten; they now fail
273
- with an explicit parse error.
274
- - Duplicate imports always created a new document; identical content now reuses
275
- the existing document.
276
- - Closed documents could not be cleaned up; the recent-documents dialog can now
277
- delete one or all closed documents.
278
- - `cat_lookup_glossary` parameter text still claimed case-insensitive matching
279
- after case-sensitive support was added; corrected.
280
- - PPTX export no longer silently emits an unformatted deck when the source
281
- package is missing; it returns `PPTX_SOURCE_REQUIRED`.
282
- - JSON `formatMeta.jsonTemplate`, XLSX metadata, and PPTX source sidecars were
283
- not preserved through reload in the first integration pass; fixed and tested.
284
- - Save-label text was invisible in the settings modal because the generic button
285
- reset overrode `.cait-btn-primary`; fixed and covered by the mount test.
286
-
287
- ### Security
288
-
289
- - Removed the CAIT-managed `baseUrl` and API key path, eliminating the SSRF /
290
- keyless-regex / remote-error-body findings from the audit.
291
- - MT failures expose only `MT_PROVIDER_FAILED`; provider/model/code/status stay in
292
- the Host log.
293
- - All RPC calls retain the DSH Origin/browser-trust check; clear methods require
294
- explicit confirmation.
295
- - Snapshot excludes API keys by design; MT credentials remain inside DSH.
296
-
297
- ### Tests
298
-
299
- - 13 suites: `test-core`, `test-imports`, `test-formats`,
300
- `test-second-tier`, `test-docx-export`, `test-api`, `test-plugin`,
301
- `test-persistence`, `test-documents`, `test-libraries`, `test-mounts`,
302
- `test-ui-scale`, and `test-mt`.
303
- - Coverage includes TM grading and boundaries, multi-library mounts,
304
- mounted-only lookup, unmounted-target rejection, clear scope/confirmation,
305
- corruption fallback, v1 migration, strict persistence rollback, demo reload,
306
- document tabs/dedupe/delete, DOCX/XLSX/PPTX source preservation, CSV mapping,
307
- SRT/VTT timelines, PO plurals/comments/obsolete, XLIFF 1.2/2.0 placeholders,
308
- second-tier round-trips, API 413/403/404/409/415, and UI helper logic.
309
- - Fixtures: `sample.docx`, `sample-table.docx`, `sample-format.docx` with
310
- `make-*.py` regeneration scripts.
311
-
312
- ### Documentation
313
-
314
- - Replaced the long development README with a GitHub-oriented README: badges,
315
- quick start, feature overview, format matrix, install paths, configuration,
316
- tools, architecture, development, security, and limits.
317
- - Added this changelog and set `package.json` version to `1.0.0`.
318
- - Added a complete Simplified Chinese README (`README.zh-CN.md`) and a language
319
- switcher; the English README now contains English-only prose and UI labels.
320
-
321
- ### Known limitations
322
-
323
- - No PDF, EPUB, or image/OCR import yet; no PDF layout-preserving export.
324
- - DOCX: tables, headers/footers, footnotes, fields, alt text, and tracked
325
- deletions are not imported; mixed-run translation inherits the first run style.
326
- - PPTX: body text only; notes, charts, SmartArt, and fields are not imported.
327
- - XLSX: two-column table only; styles, formulas, merged cells, images, and extra
328
- sheets are not preserved.
329
- - HTML/RTF export does not round-trip original styling; JSON only translates
330
- string values.
331
- - TM matching is lexical, not semantic.
332
- - Library rename/delete and per-tab mount state are not part of v1.0.0.
333
- - Persistence is one snapshot with last-write-wins semantics, not a multi-user
334
- journal.
335
- - No browser pixel/click test is included; the generated client is validated by
336
- `node --check`, helper tests, and plugin slot activation.
337
-
338
- ## Development history
339
-
340
- | Date | Milestone |
341
- | --- | --- |
342
- | 2026-11-03 | Plugin skeleton, Host/Client split, CAT store, segmentation, TM, glossary, three tools, workbench UI, TXT/MD/DOCX/TMX import/export, mock MT. |
343
- | 2026-11-03 | Persistence layer (`dataDir`, v1 snapshot, atomic writes, corrupt fallback), `tmId`/`glossaryId` reservations, reload/corruption tests. |
344
- | 2026-11-03 | Graded `matchType` (`exact`/`near_exact`/three fuzzy bands) with locale labels and boundary tests. |
345
- | 2026-11-03 | Four additional agent tools (`cat_lookup_glossary`, `cat_list_documents`, `cat_switch_document`, `cat_suggest_mt`). |
346
- | 2026-11-03 | Multi-library TM/glossary mounts, `targetTmId`, v1→v2 migration, library modal, mounted-only semantics. |
347
- | 2026-11-03 | Read-only audit and hardening: mount checkbox, MT route reuse, clear confirmation, mounted write boundaries, strict persistence, revision polling, language/metadata fixes, store/client split. |
348
- | 2026-11-04 | Document tabs, close/reopen, duplicate fingerprint, recent-document cleanup. |
349
- | 2026-11-04 | Source-format-preserving DOCX export with sidecar storage and fixtures. |
350
- | 2026-11-04 | First-tier exchange formats: CSV mapping, SRT, WebVTT, PO, XLIFF 1.2, metadata persistence, timeline fixes. |
351
- | 2026-11-04 | Second-tier formats: HTML, JSON, XLSX, PPTX, RTF; binary upload/export; source-preserving PPTX. |
352
- | 2026-11-04 | Responsive UI density 1×–1.8×; button contrast fix; v1.0.0 release. |
1
+ # Changelog
2
+
3
+ All notable changes to CAIT are documented here. The project follows
4
+ [Semantic Versioning](https://semver.org/) and the format is based on
5
+ [Keep a Changelog](https://keepachangelog.com/).
6
+
7
+ ## [1.0.5] - 2026-11-06
8
+
9
+ EPUB support, an import preprocessing stage, and format hardening.
10
+
11
+ ### Added
12
+
13
+ - EPUB 3 import and export. Import walks the OPF spine, turns XHTML text blocks
14
+ into segments, and keeps inline tags as placeholder tokens; export patches the
15
+ translations back into the retained source package, preserving chapters,
16
+ styles, images, and navigation. Documents created from plain text export as a
17
+ fresh EPUB 3 package. DRM, fixed-layout, and scripted EPUBs are out of scope.
18
+ - Import preprocessing: whitespace normalization, invisible/control character
19
+ stripping, and blank-line collapsing before segmentation. Each step has a
20
+ settings toggle, applies to file imports and `createDocument`, and is stored
21
+ with the other settings.
22
+ - A shared HTML/XHTML run scanner (`lib/html.js`) used by both HTML and EPUB, so
23
+ headings and inline markup survive import and are patched back on export.
24
+ - CSV delimiter detection (comma, semicolon, tab, pipe) and richer RTF escapes
25
+ (`\cell`, `\row`, `\page`, `\sect`, symbol characters).
26
+
27
+ ### Changed
28
+
29
+ - PDF import is explicitly out of scope. All three READMEs explain why PDF is a
30
+ poor fit for AI-assisted translation and recommend converting it with pandoc,
31
+ Acrobat, or LibreOffice first.
32
+ - The supported-formats table, project layout, roadmap, and “Known limits”
33
+ sections now describe EPUB, preprocessing, and the PDF policy.
34
+
35
+ ### Fixed
36
+
37
+ - Settings persistence now stores `uiLang` and the preprocessing flags instead of
38
+ falling back to defaults on reload.
39
+ - The EPUB `mimetype` entry is written uncompressed, as the OCF specification
40
+ requires, and every other entry stays deflated.
41
+ - HTML import no longer flattens headings and inline markup into blank-line
42
+ paragraphs.
43
+
44
+ ### Development
45
+
46
+ - New `_dev/test-epub.mjs` and `_dev/test-preprocess.mjs` suites; the full suite
47
+ count is 15.
48
+
49
+ ## [1.0.4] - 2026-11-05
50
+
51
+ Provenance publishing.
52
+
53
+ ### Added
54
+
55
+ - `README.md`, `README.zh-CN.md` and `README.ja.md` carry the live npm badge, so
56
+ the package page and the repository show the published version.
57
+
58
+ ### Changed
59
+
60
+ - Releases from this version on are produced by `.github/workflows/publish.yml`,
61
+ which attaches npm provenance and validates the GitHub trusted publisher.
62
+ `npm publish` from a local checkout still works and still asks for an OTP.
63
+
64
+ ## [1.0.3] - 2026-11-05
65
+
66
+ npm distribution.
67
+
68
+ ### Added
69
+
70
+ - The package can now be installed from the npm registry:
71
+ `plugin_manager install_bundle target: dsh-cait` in DSH Desktop, or
72
+ `dsh plugin --profile <name> add dsh-cait`. Pin a release with
73
+ `dsh-cait@1.0.3`; the GitHub and local-checkout routes still work.
74
+ - `engines.dsh` (`>=0.2.2-rc.1`), so the plugin manager refuses an older host
75
+ with a compatibility report instead of a broken mount.
76
+ - `publishConfig.access: public`, an `author` field, and the `dsh-plugin` /
77
+ `cordis` keywords for the registry listing.
78
+ - `prepublishOnly` rebuilds the client bundle and syntax-checks it, so a
79
+ release cannot ship a stale `client.js`.
80
+ - `.github/workflows/publish.yml` publishes a GitHub release through npm
81
+ Trusted Publishing with `--provenance`; it checks the tag against
82
+ `package.json`, runs the whole test suite, and never stores an npm token.
83
+ - `@deepseek-ai/schemastery` is a `devDependency` as well as a peer dependency,
84
+ so a fresh checkout can run the tests.
85
+
86
+ ### Changed
87
+
88
+ - `README.ja.md` ships in the package (`files`).
89
+ - The README install section leads with the npm route and keeps the GitHub and
90
+ local-checkout routes as alternatives.
91
+ - The repository no longer tracks `node_modules/`; packed tarballs are ignored.
92
+
93
+ ### Removed
94
+
95
+ - `"private": true`, which blocked `npm publish`.
96
+
97
+ ## [1.0.2] - 2026-11-04
98
+
99
+ Interface-language fix.
100
+
101
+ ### Added
102
+
103
+ - Japanese README (`README.ja.md`), linked from the language switcher of all
104
+ three READMEs and listed in the project layout.
105
+
106
+ ### Fixed
107
+
108
+ - **Follow DSH language** now follows the DSH locale instead of staying on
109
+ English. The client plugin declared only `slots` in its inject list, so
110
+ Cordis rejected the `ctx.locale` access with a throw that the registration
111
+ `try`/`catch` swallowed: the DSH-bound translator stayed `null`, every lookup
112
+ fell through to the English dictionary, and a Simplified-Chinese DSH looked
113
+ English. `locale` is now a declared dependency.
114
+ - `auto` resolves the locale service snapshot itself (`zh-CN` → `zh`,
115
+ `ja-JP` → `ja`, `en-US` → `en`) before consulting the DSH-bound translator,
116
+ so a locale tag without a registered fallback chain no longer degrades to
117
+ English. The export `resolveUiLang` covers this mapping.
118
+ - The workbench and the sidebar label subscribe to DSH locale changes, so
119
+ switching the DSH language while `auto` is selected re-renders CAIT
120
+ immediately instead of requiring a reload.
121
+
122
+ ## [1.0.1] - 2026-11-04
123
+
124
+ UI languages and license metadata.
125
+
126
+ ### Added
127
+
128
+ - Japanese (`ja`) UI dictionary. The workbench now ships three interface
129
+ languages: Simplified Chinese, English, and Japanese.
130
+ - **Settings → Interface → Interface language**, with *Follow DSH language*
131
+ (default), 简体中文, English, and 日本語. The choice is stored as
132
+ `settings.uiLang` in the CAIT store, applies to the workbench and the sidebar
133
+ label immediately, and only affects the CAIT interface — document source and
134
+ target languages are untouched.
135
+ - `NOTICE`, the attribution supplement for Apache-2.0 (section 4(d)), and an
136
+ explicit `license` field in `package.json`.
137
+
138
+ ### Changed
139
+
140
+ - `LICENSE` appendix copyright line now reads `Copyright 2026 Jovi Lecca`.
141
+ - Version bumped to `1.0.1` (`package.json`, `CAIT_VERSION`, and the exported
142
+ document metadata move together).
143
+ - Verified against DSH `0.2.2-rc.1`; the README badges and development notes use
144
+ that version.
145
+
146
+ ### Fixed
147
+
148
+ - `saveSettings` rejects an unsupported interface language with
149
+ `INVALID_UI_LANG` instead of silently storing it.
150
+
151
+ ## [1.0.0] - 2026-11-04
152
+
153
+ First public release. CAIT was developed as `0.1.0` and renumbered to `1.0.0`
154
+ for the first GitHub release.
155
+
156
+ The npm package and Cordis entry are named `dsh-cait`; the UI entry, data
157
+ directory (`$DSH_HOME/cait`), and API route (`/cait/api`) keep the CAIT name.
158
+
159
+ ### Highlights
160
+
161
+ - A complete CAT workbench inside DeepSeek Harness: sidebar entry, main panel,
162
+ segment list/editor, TM/glossary/MT side panel, and export flow.
163
+ - Seven agent tools that share the exact store used by the UI.
164
+ - Multiple TM and glossary libraries with mounted-only lookup and default write
165
+ targets.
166
+ - Format-preserving DOCX and PPTX export, plus a broad text, subtitle,
167
+ localization, and Office format matrix.
168
+ - Persistence with atomic snapshots, corrupt-file recovery, strict confirm
169
+ writes, and revision polling between agents and the open workbench.
170
+
171
+ ### Added
172
+
173
+ #### Plugin and UI
174
+
175
+ - Host + Client bundle structure (`index.js`, `client.js`, `cordis.patch.yml`,
176
+ `package.json`, locale metadata, icon).
177
+ - New two-bubble A/文 icon: a bilingual speech-bubble pair that reads as
178
+ source/target, used both for the package icon and the DSH sidebar mark.
179
+ - Left-sidebar entry `cait` and main panel `cait`; all styling uses DSH
180
+ `--dsw-alias-*` theme tokens.
181
+ - English and Chinese UI dictionaries; plugin metadata locales.
182
+ - Workbench with document tabs, segment rail, source highlighting, glossary
183
+ chips, target editor, confirm/next/previous/draft actions, progress, and
184
+ responsive density scaling from 1× to 1.8×.
185
+ - Document tabs with close, reopen, new-page import, duplicate-import reuse,
186
+ and a recent-document cleanup dialog for one or all closed documents.
187
+ - Settings modal for source/target languages, fuzzy threshold, TM result limit,
188
+ MT route/model/temperature, and library mounts.
189
+ - Lightweight **库 / Libraries** modal to create, mount, and choose default TM
190
+ and glossary libraries.
191
+ - Visual save-failure/stale banner and a two-second revision poll so
192
+ agent-triggered document switches and confirmations appear in an open
193
+ workbench without discarding a dirty draft.
194
+
195
+ #### Translation memory and glossary
196
+
197
+ - Multiple TM libraries with id, name, mount state, default write library, and
198
+ per-library deduplication.
199
+ - Graded TM matching: `exact`, independent `near_exact` (ignores digits,
200
+ punctuation, and whitespace), `high_fuzzy >= 0.85`,
201
+ `medium_fuzzy 0.75–0.85`, `low_fuzzy < 0.75` above the configurable floor.
202
+ - Lexical fuzzy scoring: character-bigram Dice (72%) + token Jaccard (28%);
203
+ Latin words and CJK characters are tokenized separately.
204
+ - Multiple glossary libraries, source-language filtering, live highlighting,
205
+ click-to-insert terms, case-sensitive terms, CSV/TSV import, and notes.
206
+ - Mounted-only lookups in the UI and tools; unmounted write targets are rejected
207
+ with `TM_NOT_MOUNTED` / `GLOSSARY_NOT_MOUNTED`.
208
+ - Clear operations default to mounted libraries, accept explicit mounted ids, and
209
+ require `all: true` plus `confirm: true` to clear every library.
210
+ - Canonical language tags via `Intl.getCanonicalLocales` (`EN` → `en`,
211
+ `ZH_cn` → `zh-CN`).
212
+
213
+ #### Agent tools
214
+
215
+ - `cat_get_segment` — current segment, TM matches, glossary hits.
216
+ - `cat_submit_translation` — confirm target, optional mounted `targetTmId`,
217
+ write to TM, advance.
218
+ - `cat_lookup_tm` — mounted-library graded lookup.
219
+ - `cat_lookup_glossary` — mounted glossary query with language/case handling.
220
+ - `cat_list_documents` — document list and progress.
221
+ - `cat_switch_document` — switch active document.
222
+ - `cat_suggest_mt` — MT through the selected DSH route, or explicit offline
223
+ glossary-substitution fallback.
224
+
225
+ #### MT
226
+
227
+ - MT provider-route selector built from `ctx.llm.listProviders()` and
228
+ `ctx.llm.listModels()`, optionally filtered by `ctx.loader.entries()`.
229
+ - Calls through `ctx.llm.stream()`; concatenates `text-delta` chunks only.
230
+ - No CAIT-managed `baseUrl` or API key; DSH resolves credentials.
231
+ - Explicit offline fallback labelled **术语替换(离线) / Glossary substitution
232
+ (offline)** (internal id `mock`) when no route/model is available.
233
+ - Host-only detailed logging of stream failures; clients receive the generic
234
+ `MT_PROVIDER_FAILED`.
235
+
236
+ #### Persistence and configuration
237
+
238
+ - Schemastery `dataDir` config; default `$DSH_HOME/cait` or `~/.dsh/cait`.
239
+ - Versioned JSON snapshot (`version: 2`) containing documents, segments, open-tab
240
+ ids, TM, glossary, libraries, mounts, and non-secret settings.
241
+ - Atomic temp-file + rename writes; strict confirm writes that roll back on disk
242
+ failure and return `PERSISTENCE_FAILED` (503); best-effort structural writes
243
+ with a visible storage-error banner.
244
+ - Corrupt/unknown-version snapshots are backed up as
245
+ `store.json.corrupt-<timestamp>` and replaced with empty state.
246
+ - v1 → v2 migration to default TM/glossary libraries.
247
+ - DOCX and PPTX source sidecars under `sources/<document-id>.*` for
248
+ format-preserving export; sidecars are removed when the document is deleted.
249
+ - Open tabs and `activeDocId` persist; draft text and per-document cursor do not.
250
+ - Duplicate import guard based on SHA-256 of languages, source, format, and
251
+ exchange metadata.
252
+
253
+ #### Formats
254
+
255
+ - TXT, Markdown, DOCX body text, TMX 1.4, CSV, SRT, WebVTT, PO, XLIFF 1.2,
256
+ basic XLIFF 2.0, basic SDLXLIFF, HTML, JSON string paths, XLSX, PPTX, and RTF
257
+ import.
258
+ - Target-only TXT/Markdown/HTML/RTF/SRT/WebVTT export; bilingual
259
+ Markdown/CSV/TMX; document exports for PO, XLIFF, XLSX, and PPTX;
260
+ current-document JSON; structure-preserving JSON; DOCX source-package export.
261
+ - CSV column mapping by header name or 1-based number.
262
+ - SRT/VTT cue timing/settings/identifier metadata; semantic inline tags retained;
263
+ invalid ranges rejected; untimed cues follow the previous cue end + 2 s.
264
+ - PO contexts, plural forms, translator comments, and obsolete `#~` entries.
265
+ - XLIFF inline placeholders converted to `{n}` tokens and expanded back on
266
+ export; confirmation rejects dropped tokens with `PLACEHOLDER_MISMATCH`.
267
+ - DOCX export patches translated text into the original package, preserving
268
+ paragraph/run properties, styles, numbering, images, headers, tables, and
269
+ layout.
270
+ - PPTX export patches translated body text into the retained source package,
271
+ preserving slides, masters, shapes, images, and layout.
272
+ - XLSX two-column Source/Target workbook import/export.
273
+ - JSON original-template preservation through `formatMeta.jsonTemplate`.
274
+
275
+ #### API and security
276
+
277
+ - Same-origin JSON bridge at `GET /cait/api/health` and
278
+ `POST /cait/api/rpc`.
279
+ - `ctx.connection.requestRejection` browser/Origin check.
280
+ - 32 MB body limit (`413 BODY_TOO_LARGE`), JSON content-type check, and
281
+ allow-listed handlers.
282
+ - `clearTM` / `clearGlossary` require `confirm: true` (`409
283
+ CONFIRMATION_REQUIRED` otherwise).
284
+ - No API key in the browser, snapshot, RPC response, or logs.
285
+
286
+ ### Changed
287
+
288
+ - Renamed the UI fallback from “mock” to **术语替换(离线) / Glossary
289
+ substitution (offline)** while keeping internal ids compatible.
290
+ - Replaced CAIT-managed OpenAI-compatible HTTP calls with DSH provider routes.
291
+ - Split the 1,718-line `lib/store.js` into a `CatStore` facade plus
292
+ `libraries.js`, `tm.js`, `glossary.js`, `persistence.js`,
293
+ `import-export.js`, `store-utils.js`, and `errors.js`.
294
+ - Split the Web UI into `client/helpers.js`, `rpc.js`, `styles.js`,
295
+ `components.js`, `locales.js`, and `entry.js`; `client.js` is now generated by
296
+ `scripts/build-client.mjs`.
297
+ - JSON export was renamed from a purported “project backup” to
298
+ `*.document.json` (current document only); structured JSON export is a
299
+ separate `json-tree` format.
300
+ - Subtitle export now renumbers cues in file order and maintains a monotonic
301
+ cursor for untimed cues instead of overlapping `index * 2s`.
302
+ - Removed the never-incremented `usageCount` TM metric.
303
+ - `cat_submit_translation` now returns `tm.count` as the mounted count and
304
+ `tm.total` as the all-library count.
305
+ - Open documents persist `openDocIds` and `activeDocId`; settings persist, but
306
+ drafts, cursor, and library-modal UI state do not.
307
+ - API key and endpoint fields were removed from settings; `publicSettings()`
308
+ exposes only route/model/temperature.
309
+ - README rewritten for GitHub; this changelog added.
310
+
311
+ ### Fixed
312
+
313
+ - Mount checkbox was disabled for every unmounted library when only one was
314
+ mounted; unmounted libraries are now selectable and only the last mounted one
315
+ is protected.
316
+ - `loadDemo()` TM entries were not persisted; demo state now survives reload.
317
+ - Save errors were swallowed and confirmations could report success without a
318
+ disk write; strict confirm + rollback + banner now surface the failure.
319
+ - Agent-driven document switches/confirmations were invisible in an open
320
+ workbench; revision polling and stale/draft handling fixed this.
321
+ - DOCX table paragraphs were flattened into the body text despite the docs; table
322
+ blocks are now excluded during import.
323
+ - TMX inline `bpt/ept/ph` markup was silently dropped; imports now return a
324
+ `TMX_INLINE_MARKUP_LOST` warning with a count.
325
+ - Glossary language matching was case-sensitive in hits but case-insensitive in
326
+ the tool; both paths now canonicalize.
327
+ - XLIFF placeholders, PO plurals/comments/obsolete blocks, and subtitle semantic
328
+ tags were dropped in earlier adapters; all are preserved now.
329
+ - Subtitle zero/negative-duration cues were silently rewritten; they now fail
330
+ with an explicit parse error.
331
+ - Duplicate imports always created a new document; identical content now reuses
332
+ the existing document.
333
+ - Closed documents could not be cleaned up; the recent-documents dialog can now
334
+ delete one or all closed documents.
335
+ - `cat_lookup_glossary` parameter text still claimed case-insensitive matching
336
+ after case-sensitive support was added; corrected.
337
+ - PPTX export no longer silently emits an unformatted deck when the source
338
+ package is missing; it returns `PPTX_SOURCE_REQUIRED`.
339
+ - JSON `formatMeta.jsonTemplate`, XLSX metadata, and PPTX source sidecars were
340
+ not preserved through reload in the first integration pass; fixed and tested.
341
+ - Save-label text was invisible in the settings modal because the generic button
342
+ reset overrode `.cait-btn-primary`; fixed and covered by the mount test.
343
+
344
+ ### Security
345
+
346
+ - Removed the CAIT-managed `baseUrl` and API key path, eliminating the SSRF /
347
+ keyless-regex / remote-error-body findings from the audit.
348
+ - MT failures expose only `MT_PROVIDER_FAILED`; provider/model/code/status stay in
349
+ the Host log.
350
+ - All RPC calls retain the DSH Origin/browser-trust check; clear methods require
351
+ explicit confirmation.
352
+ - Snapshot excludes API keys by design; MT credentials remain inside DSH.
353
+
354
+ ### Tests
355
+
356
+ - 13 suites: `test-core`, `test-imports`, `test-formats`,
357
+ `test-second-tier`, `test-docx-export`, `test-api`, `test-plugin`,
358
+ `test-persistence`, `test-documents`, `test-libraries`, `test-mounts`,
359
+ `test-ui-scale`, and `test-mt`.
360
+ - Coverage includes TM grading and boundaries, multi-library mounts,
361
+ mounted-only lookup, unmounted-target rejection, clear scope/confirmation,
362
+ corruption fallback, v1 migration, strict persistence rollback, demo reload,
363
+ document tabs/dedupe/delete, DOCX/XLSX/PPTX source preservation, CSV mapping,
364
+ SRT/VTT timelines, PO plurals/comments/obsolete, XLIFF 1.2/2.0 placeholders,
365
+ second-tier round-trips, API 413/403/404/409/415, and UI helper logic.
366
+ - Fixtures: `sample.docx`, `sample-table.docx`, `sample-format.docx` with
367
+ `make-*.py` regeneration scripts.
368
+
369
+ ### Documentation
370
+
371
+ - Replaced the long development README with a GitHub-oriented README: badges,
372
+ quick start, feature overview, format matrix, install paths, configuration,
373
+ tools, architecture, development, security, and limits.
374
+ - Added this changelog and set `package.json` version to `1.0.0`.
375
+ - Added a complete Simplified Chinese README (`README.zh-CN.md`) and a language
376
+ switcher; the English README now contains English-only prose and UI labels.
377
+
378
+ ### Known limitations
379
+
380
+ - No PDF, EPUB, or image/OCR import yet; no PDF layout-preserving export.
381
+ - DOCX: tables, headers/footers, footnotes, fields, alt text, and tracked
382
+ deletions are not imported; mixed-run translation inherits the first run style.
383
+ - PPTX: body text only; notes, charts, SmartArt, and fields are not imported.
384
+ - XLSX: two-column table only; styles, formulas, merged cells, images, and extra
385
+ sheets are not preserved.
386
+ - HTML/RTF export does not round-trip original styling; JSON only translates
387
+ string values.
388
+ - TM matching is lexical, not semantic.
389
+ - Library rename/delete and per-tab mount state are not part of v1.0.0.
390
+ - Persistence is one snapshot with last-write-wins semantics, not a multi-user
391
+ journal.
392
+ - No browser pixel/click test is included; the generated client is validated by
393
+ `node --check`, helper tests, and plugin slot activation.
394
+
395
+ ## Development history
396
+
397
+ | Date | Milestone |
398
+ | --- | --- |
399
+ | 2026-11-03 | Plugin skeleton, Host/Client split, CAT store, segmentation, TM, glossary, three tools, workbench UI, TXT/MD/DOCX/TMX import/export, mock MT. |
400
+ | 2026-11-03 | Persistence layer (`dataDir`, v1 snapshot, atomic writes, corrupt fallback), `tmId`/`glossaryId` reservations, reload/corruption tests. |
401
+ | 2026-11-03 | Graded `matchType` (`exact`/`near_exact`/three fuzzy bands) with locale labels and boundary tests. |
402
+ | 2026-11-03 | Four additional agent tools (`cat_lookup_glossary`, `cat_list_documents`, `cat_switch_document`, `cat_suggest_mt`). |
403
+ | 2026-11-03 | Multi-library TM/glossary mounts, `targetTmId`, v1→v2 migration, library modal, mounted-only semantics. |
404
+ | 2026-11-03 | Read-only audit and hardening: mount checkbox, MT route reuse, clear confirmation, mounted write boundaries, strict persistence, revision polling, language/metadata fixes, store/client split. |
405
+ | 2026-11-04 | Document tabs, close/reopen, duplicate fingerprint, recent-document cleanup. |
406
+ | 2026-11-04 | Source-format-preserving DOCX export with sidecar storage and fixtures. |
407
+ | 2026-11-04 | First-tier exchange formats: CSV mapping, SRT, WebVTT, PO, XLIFF 1.2, metadata persistence, timeline fixes. |
408
+ | 2026-11-04 | Second-tier formats: HTML, JSON, XLSX, PPTX, RTF; binary upload/export; source-preserving PPTX. |
409
+ | 2026-11-04 | Responsive UI density 1×–1.8×; button contrast fix; v1.0.0 release. |
410
+ | 2026-11-06 | EPUB 3 import/export with source-package patching, shared HTML/XHTML scanner, import preprocessing stage, CSV/RTF hardening, PDF out of scope; v1.0.5 release. |