dsh-session-sync 0.1.3 → 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/ARCHITECTURE.md +5 -2
- package/CHANGELOG.md +17 -0
- package/README.es.md +5 -2
- package/README.hi.md +5 -2
- package/README.md +26 -4
- package/README.pt.md +5 -2
- package/README.zh.md +5 -2
- package/cordis.patch.yml +9 -2
- package/index.mjs +107 -7
- package/lib/age.mjs +77 -0
- package/lib/backend.mjs +57 -0
- package/lib/constants.mjs +18 -1
- package/lib/encrypted.mjs +523 -0
- package/lib/errors.mjs +12 -2
- package/lib/git.mjs +38 -0
- package/lib/render.mjs +8 -4
- package/package.json +1 -1
- package/types.d.ts +11 -2
package/lib/render.mjs
CHANGED
|
@@ -37,6 +37,7 @@ export function renderStatus(status) {
|
|
|
37
37
|
lines.push(` last commits:\n${status.lastCommits.map(line => ` ${line}`).join('\n')}`)
|
|
38
38
|
}
|
|
39
39
|
if (status.error !== undefined) lines.push(` last error: ${status.error}`)
|
|
40
|
+
for (const warning of (status.warnings ?? [])) lines.push(` warning: ${warning}`)
|
|
40
41
|
return lines.join('\n')
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -61,7 +62,7 @@ export function renderDiff(status) {
|
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* pull 结果文本。
|
|
64
|
-
* @param {{ok: boolean, pulled?: boolean, merged?: boolean, adopted?: number, appended?: number, diverged?: number, forks?: string[], head?: string, error?: string}} result - pull 产物。
|
|
65
|
+
* @param {{ok: boolean, pulled?: boolean, merged?: boolean, adopted?: number, appended?: number, diverged?: number, forks?: string[], head?: string, error?: string, warnings?: string[]}} result - pull 产物。
|
|
65
66
|
* @returns {string}
|
|
66
67
|
*/
|
|
67
68
|
export function renderPull(result) {
|
|
@@ -77,22 +78,25 @@ export function renderPull(result) {
|
|
|
77
78
|
if ((result.diverged ?? 0) > 0) lines.push(` diverged in ${result.diverged} file(s) (non-append rewrite): local version kept, remote version preserved as fork file(s) — inspect before continuing`)
|
|
78
79
|
for (const fork of (result.forks ?? []).slice(0, 20)) lines.push(` fork ${fork}`)
|
|
79
80
|
if ((result.forks ?? []).length > 20) lines.push(` … ${result.forks.length - 20} more`)
|
|
81
|
+
for (const warning of (result.warnings ?? [])) lines.push(` warning: ${warning}`)
|
|
80
82
|
return lines.join('\n')
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
/**
|
|
84
86
|
* push 结果文本。
|
|
85
|
-
* @param {{ok: boolean, pushed?: boolean, head?: string, mirrored?: number, deleted?: number, remote?: string, error?: string}} result - push 产物。
|
|
87
|
+
* @param {{ok: boolean, pushed?: boolean, head?: string, mirrored?: number, deleted?: number, remote?: string, error?: string, warnings?: string[]}} result - push 产物。
|
|
86
88
|
* @returns {string}
|
|
87
89
|
*/
|
|
88
90
|
export function renderPush(result) {
|
|
89
91
|
if (!result.ok) return `sync: push failed: ${result.error ?? 'unknown error'}`
|
|
90
92
|
if (!result.pushed) return 'sync: push ok — nothing new to push (mirror already committed and remote up to date)'
|
|
91
|
-
|
|
93
|
+
const lines = [
|
|
92
94
|
'sync: push ok',
|
|
93
95
|
` mirrored ${result.mirrored ?? 0} file(s)${(result.deleted ?? 0) > 0 ? `, deleted ${result.deleted} (removed locally)` : ''}`,
|
|
94
96
|
` pushed to ${result.remote ?? 'remote'} → head ${result.head ?? ''}`,
|
|
95
|
-
]
|
|
97
|
+
]
|
|
98
|
+
for (const warning of (result.warnings ?? [])) lines.push(` warning: ${warning}`)
|
|
99
|
+
return lines.join('\n')
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-sync",
|
|
3
3
|
"description": "Cross-device sync for DeepSeek Harness sessions: a dedicated git mirror of the session store, append-only three-way merge with keep-both + fork conflict resolution, /sync command, sync_pull/sync_push/sync_status tools, and configurable auto push/pull",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/PerryLink/dsh-session-sync.git"
|
package/types.d.ts
CHANGED
|
@@ -51,8 +51,8 @@ declare module '@deepseek-ai/dsh-session' {
|
|
|
51
51
|
export interface Config {
|
|
52
52
|
/** 总开关;false 时命令、工具、监听器与自动模式全部卸载。 */
|
|
53
53
|
enabled?: boolean
|
|
54
|
-
/**
|
|
55
|
-
backend?: 'git'
|
|
54
|
+
/** 同步后端词汇;`git` 明文、`encrypted` age 加密的 git;对象存储为预留占位(配置即响亮失败)。 */
|
|
55
|
+
backend?: 'git' | 'encrypted'
|
|
56
56
|
/** 会话存储根;空 = $DSH_HOME/sessions(两者皆缺加载期响亮失败)。 */
|
|
57
57
|
sessionRoot?: string
|
|
58
58
|
/** 同步 git 工作树根;空 = $DSH_HOME/dsh-session-sync/repo。 */
|
|
@@ -63,6 +63,12 @@ export interface Config {
|
|
|
63
63
|
branch?: string
|
|
64
64
|
/** git 可执行路径(默认 'git')。 */
|
|
65
65
|
gitBin?: string
|
|
66
|
+
/** age 可执行路径(默认 'age';backend: encrypted 时探测,缺失降级明文)。 */
|
|
67
|
+
ageBin?: string
|
|
68
|
+
/** age 收件人(公钥/身份串;空 = 无法加密,降级明文)。 */
|
|
69
|
+
ageRecipient?: string
|
|
70
|
+
/** age 身份文件路径(无口令私钥;空 = 无法解密,降级明文)。 */
|
|
71
|
+
ageIdentity?: string
|
|
66
72
|
/** 挂载时自动拉取一次(配置即授权,不再确认)。 */
|
|
67
73
|
autoPullOnStart?: boolean
|
|
68
74
|
/** 每个 turn/end 后自动推送(配置即授权,不再确认)。 */
|
|
@@ -105,6 +111,7 @@ export interface StatusValue {
|
|
|
105
111
|
lastPushAt?: number
|
|
106
112
|
lastError?: string
|
|
107
113
|
error?: string
|
|
114
|
+
warnings?: string[]
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
/** sync_pull 工具规范结果。 */
|
|
@@ -118,6 +125,7 @@ export interface PullValue {
|
|
|
118
125
|
forks?: string[]
|
|
119
126
|
head?: string
|
|
120
127
|
error?: string
|
|
128
|
+
warnings?: string[]
|
|
121
129
|
}
|
|
122
130
|
|
|
123
131
|
/** sync_push 工具规范结果。 */
|
|
@@ -129,4 +137,5 @@ export interface PushValue {
|
|
|
129
137
|
deleted?: number
|
|
130
138
|
remote?: string
|
|
131
139
|
error?: string
|
|
140
|
+
warnings?: string[]
|
|
132
141
|
}
|