@sparkelf/dsh-plugin-backup 0.1.0-rc.10
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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +67 -0
- package/README.zh.md +67 -0
- package/lib/client.js +594 -0
- package/lib/index.js +701 -0
- package/lib/invariant.js +18 -0
- package/lib/types/archive.d.ts +63 -0
- package/lib/types/client/BackupSection.d.ts +42 -0
- package/lib/types/client/index.d.ts +17 -0
- package/lib/types/client/locales.d.ts +34 -0
- package/lib/types/client/store.d.ts +20 -0
- package/lib/types/client/types.d.ts +29 -0
- package/lib/types/index.d.ts +19 -0
- package/lib/types/invariant.d.ts +11 -0
- package/lib/types/protocol.d.ts +32 -0
- package/lib/types/routes.d.ts +20 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/plus/backup/README.md
|
|
5
|
+
README.md: 627c96595000ade5cb802da1de23cd5f6b95bcae
|
|
6
|
+
README.zh.md: ac763584453417834a2bc920755651a5e25aeb0e
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Streamed, authenticated export and validated restore of file-backed DSH user data with browser progress."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @sparkelf/dsh-plugin-backup
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
This complete Host and Client plugin exports a file-backed DSH home as a ZIP archive, validates and restores an uploaded archive, reopens Workspace storage, and contributes the localized Backup Settings section. Export, upload, and import stream through Host temporary files with bounded NDJSON progress; import validates the manifest, paths, and expanded byte total before Workspace mutation.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Model Experience](#model-experience)
|
|
18
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
19
|
+
- [Dev Note](#dev-note)
|
|
20
|
+
|
|
21
|
+
-----
|
|
22
|
+
|
|
23
|
+
<a id="use-this-package"></a>
|
|
24
|
+
## Use this package
|
|
25
|
+
|
|
26
|
+
Mount the Host entry after `connection`, `webServer`, `settings`, and `workspaceRegistry`, and mount the Client entry after locale and Settings. The file-backed Settings provider supplies `settings.documentPath`; `maxUploadBytes` defaults to 2147483648 bytes.
|
|
27
|
+
|
|
28
|
+
The authenticated routes are POST `/api/backup.export.prepare`, GET/HEAD `/api/backup.export`, POST `/api/backup.upload`, and POST `/api/backup.import`. Every route applies Connection Host, Origin, and browser-authentication policy before request data. Tokens expire after ten minutes and are single-use, except HEAD metadata inspection.
|
|
29
|
+
|
|
30
|
+
Once restore writes begin, closing the page does not interrupt replacement. Workspace storage closes around file replacement and reopens before completion; the Client releases the completed progress stream reader before the UI offers one explicit reload. Client failures remain visible in the Backup section without browser console errors.
|
|
31
|
+
|
|
32
|
+
-----
|
|
33
|
+
|
|
34
|
+
<a id="model-experience"></a>
|
|
35
|
+
## Model Experience
|
|
36
|
+
|
|
37
|
+
### Backup operations
|
|
38
|
+
|
|
39
|
+
#### What the model sees
|
|
40
|
+
|
|
41
|
+
Nothing. `@sparkelf/dsh-plugin-backup` keeps Backup archives, progress, failures, and restored files in Host storage and the Settings UI; this package registers no model-facing tool, prompt section, or Session event.
|
|
42
|
+
|
|
43
|
+
#### Token effect
|
|
44
|
+
|
|
45
|
+
Zero. Backup operations add no model-request tokens.
|
|
46
|
+
|
|
47
|
+
#### KV Cache effect
|
|
48
|
+
|
|
49
|
+
Independent. Export, import, progress, and reload do not change a model request prefix.
|
|
50
|
+
|
|
51
|
+
## Known Limitations and Deferred Work
|
|
52
|
+
|
|
53
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
54
|
+
|
|
55
|
+
- **Overwrite without rollback**: restore replaces same-name files, retains files absent from the archive, and creates no rollback copy if a disk write fails after mutation begins.
|
|
56
|
+
|
|
57
|
+
<a id="dev-note"></a>
|
|
58
|
+
### Dev Note
|
|
59
|
+
|
|
60
|
+
<details>
|
|
61
|
+
<summary>Working context for maintainers, click to expand</summary>
|
|
62
|
+
|
|
63
|
+
This Dev Note is working context for maintainers; shipped behavior, limits, and rationale live in the sections above, the package code, and the linked Agent Note.
|
|
64
|
+
|
|
65
|
+
- The [Backup Agent Note](../../../.agents/notes/proposed/architecture/2026-08-30-plus-backup-plugin.md) owns archive, route, restore, and progress decisions; `src/index.ts` and `src/client/BackupSection.tsx` own current behavior.
|
|
66
|
+
|
|
67
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "为file-backed DSH user data提供streamed authenticated export、validated restore及browser progress。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @sparkelf/dsh-plugin-backup
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
该完整Host及Client plugin把file-backed DSH home导出为ZIP archive,验证并恢复uploaded archive,重新打开Workspace storage,并贡献localized Backup Settings section。Export、upload和import通过Host temporary files stream并提供bounded NDJSON progress;import会在Workspace mutation前验证manifest、paths及expanded byte total。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用此软件包](#use-this-package)
|
|
17
|
+
- [模型体验](#model-experience)
|
|
18
|
+
- [已知限制和延期工作](#known-limitations-and-deferred-work)
|
|
19
|
+
- [开发备注](#dev-note)
|
|
20
|
+
|
|
21
|
+
-----
|
|
22
|
+
|
|
23
|
+
<a id="use-this-package"></a>
|
|
24
|
+
## 使用此软件包
|
|
25
|
+
|
|
26
|
+
Host entry需mount在`connection`、`webServer`、`settings`及`workspaceRegistry`之后,Client entry需mount在locale及Settings之后。file-backed Settings provider提供`settings.documentPath`;`maxUploadBytes`默认为2147483648 bytes。
|
|
27
|
+
|
|
28
|
+
authenticated routes为POST `/api/backup.export.prepare`、GET/HEAD `/api/backup.export`、POST `/api/backup.upload`及POST `/api/backup.import`。每条route会在读取request data前应用Connection Host、Origin及browser-authentication policy。Token在十分钟后过期并且single-use,HEAD metadata inspection除外。
|
|
29
|
+
|
|
30
|
+
一旦restore开始写入,关闭page不会中断replacement。Workspace storage会在file replacement期间关闭并在completion前重新打开;Client会先释放completed progress stream reader,再由UI提供一次explicit reload。Client failure保留在Backup section可见状态,不产生browser console error。
|
|
31
|
+
|
|
32
|
+
-----
|
|
33
|
+
|
|
34
|
+
<a id="model-experience"></a>
|
|
35
|
+
## 模型体验
|
|
36
|
+
|
|
37
|
+
### Backup operations
|
|
38
|
+
|
|
39
|
+
#### 模型看到什么
|
|
40
|
+
|
|
41
|
+
没有内容。`@sparkelf/dsh-plugin-backup`把Backup archives、progress、failures及restored files留在Host storage和Settings UI;该package不注册model-facing tool、prompt section或Session event。
|
|
42
|
+
|
|
43
|
+
#### Token 影响
|
|
44
|
+
|
|
45
|
+
为零。Backup operations不增加model-request tokens。
|
|
46
|
+
|
|
47
|
+
#### KV Cache 影响
|
|
48
|
+
|
|
49
|
+
独立。Export、import、progress及reload不改变model request prefix。
|
|
50
|
+
|
|
51
|
+
## 已知限制和延期工作
|
|
52
|
+
|
|
53
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
54
|
+
|
|
55
|
+
- **Overwrite without rollback**:restore会替换same-name files,保留archive中不存在的files,并且在mutation开始后disk write失败时不创建rollback copy。
|
|
56
|
+
|
|
57
|
+
<a id="dev-note"></a>
|
|
58
|
+
### 开发备注
|
|
59
|
+
|
|
60
|
+
<details>
|
|
61
|
+
<summary>维护者工作上下文,点击展开</summary>
|
|
62
|
+
|
|
63
|
+
该开发备注是maintainer working context;shipped behavior、limits及rationale以以上sections、package code及linked Agent Note为准。
|
|
64
|
+
|
|
65
|
+
- [Backup Agent Note](../../../.agents/notes/proposed/architecture/2026-08-30-plus-backup-plugin.zh.md)持有archive、route、restore及progress decisions;`src/index.ts`和`src/client/BackupSection.tsx`持有current behavior。
|
|
66
|
+
|
|
67
|
+
</details>
|