dsh-timeback 0.6.0 → 0.6.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.
- package/README.md +4 -1
- package/client.js +86 -4
- package/docs/MARKET.md +10 -2
- package/docs/PUBLISHING.md +41 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# dsh-timeback (时间回溯)
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-timeback)
|
|
4
|
+
|
|
3
5
|
A DeepSeek Harness plugin that combines two things the built-in UI keeps apart:
|
|
4
6
|
|
|
5
7
|
1. **A conversation tree** — branch a conversation at any completed turn; the old
|
|
@@ -99,8 +101,9 @@ Pick the profile you actually use (`web` for `dsh web`/browser, `desktop` for th
|
|
|
99
101
|
desktop app):
|
|
100
102
|
|
|
101
103
|
```bash
|
|
102
|
-
# From npm (
|
|
104
|
+
# From npm (published: https://www.npmjs.com/package/dsh-timeback)
|
|
103
105
|
dsh plugin --profile web add dsh-timeback
|
|
106
|
+
dsh plugin --profile web add dsh-timeback@0.6.0 # pin a release
|
|
104
107
|
|
|
105
108
|
# Straight from GitHub (no npm release needed)
|
|
106
109
|
dsh plugin --profile web add github:<owner>/dsh-timeback
|
package/client.js
CHANGED
|
@@ -23,7 +23,7 @@ window.__ModuleLoader__.load({
|
|
|
23
23
|
const REFRESH_MS = 3000
|
|
24
24
|
const MAX_ROWS = 240
|
|
25
25
|
/** Bump together with package.json so a stale browser bundle is obvious. */
|
|
26
|
-
const BUILD = '0.6.
|
|
26
|
+
const BUILD = '0.6.1+dialog'
|
|
27
27
|
/** Set by apply(): opens another Session in the main column. */
|
|
28
28
|
let openSessionBridge = null
|
|
29
29
|
/** Set by apply(): opens the Timeback tab in the right sidebar. */
|
|
@@ -115,6 +115,8 @@ window.__ModuleLoader__.load({
|
|
|
115
115
|
'board.saved': '记录已保存',
|
|
116
116
|
'board.deleted': '记录已删除',
|
|
117
117
|
'board.count': '{count} 条记录 · 版本 v{version}',
|
|
118
|
+
'board.resetSize': '默认大小',
|
|
119
|
+
'board.resizeHint': '可拖拽弹框右边缘、下边缘或右下角调整大小',
|
|
118
120
|
'board.error': '记录板操作失败:{error}',
|
|
119
121
|
'board.agentHint': '提示:让会话调用 timeback_note 工具即可把结论写进记录板;回溯时记录板会一起回退。',
|
|
120
122
|
'guide.boardTitle': '记录板',
|
|
@@ -289,6 +291,8 @@ window.__ModuleLoader__.load({
|
|
|
289
291
|
'board.saved': 'Note saved',
|
|
290
292
|
'board.deleted': 'Note deleted',
|
|
291
293
|
'board.count': '{count} notes · version v{version}',
|
|
294
|
+
'board.resetSize': 'Default size',
|
|
295
|
+
'board.resizeHint': 'Drag the right edge, bottom edge or bottom-right corner to resize',
|
|
292
296
|
'board.error': 'Notes board failed: {error}',
|
|
293
297
|
'board.agentHint': 'Tip: ask the session to use the timeback_note tool; rewinds roll the board back with the conversation.',
|
|
294
298
|
'guide.boardTitle': 'Notes board',
|
|
@@ -480,8 +484,15 @@ window.__ModuleLoader__.load({
|
|
|
480
484
|
.tb-note-dialog textarea,.tb-board-dialog textarea,.tb-board-dialog input{width:100%;box-sizing:border-box;background:var(--dsw-alias-bg-layer-1,rgba(255,255,255,.04));color:var(--dsw-alias-label-primary,#e6e6e6);border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));border-radius:7px;padding:7px 9px;font-size:12px;line-height:1.5;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;resize:vertical}
|
|
481
485
|
.tb-note-dialog textarea{min-height:180px}
|
|
482
486
|
.tb-note-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end;margin-top:auto}
|
|
483
|
-
.tb-board-dialog{
|
|
484
|
-
.tb-board-dialog textarea{min-height:
|
|
487
|
+
.tb-board-dialog{box-sizing:border-box;position:relative;min-width:340px;min-height:260px;background:var(--dsw-alias-bg-layer-2,rgba(28,32,40,.98));border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.14));border-radius:10px;padding:12px;display:flex;flex-direction:column;gap:8px;max-width:94vw;max-height:90vh;overflow:auto;box-shadow:0 18px 48px rgba(0,0,0,.38)}
|
|
488
|
+
.tb-board-dialog textarea{min-height:120px;flex:1;resize:none}
|
|
489
|
+
.tb-board-dialog .tb-md{flex:1;min-height:120px;overflow:auto;border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.1));border-radius:7px;padding:8px 10px}
|
|
490
|
+
.tb-resize-handle{position:absolute;z-index:6;background:transparent}
|
|
491
|
+
.tb-resize-handle.e{top:10px;right:0;bottom:10px;width:8px;cursor:ew-resize}
|
|
492
|
+
.tb-resize-handle.s{left:10px;right:10px;bottom:0;height:8px;cursor:ns-resize}
|
|
493
|
+
.tb-resize-handle.se{right:0;bottom:0;width:18px;height:18px;cursor:nwse-resize}
|
|
494
|
+
.tb-resize-handle.se:after{content:"";position:absolute;right:3px;bottom:3px;width:8px;height:8px;border-right:2px solid var(--dsw-alias-label-secondary,#9aa0a6);border-bottom:2px solid var(--dsw-alias-label-secondary,#9aa0a6);opacity:.55}
|
|
495
|
+
.tb-board-testid{display:none}
|
|
485
496
|
.tb-board-panel{display:flex;flex-direction:column;height:100%;min-height:100%;width:100%;font-size:12.5px;color:var(--dsw-alias-label-primary,#e6e6e6);background:var(--dsw-alias-bg-base,#16181d)}
|
|
486
497
|
.tb-board-head{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.1));flex-wrap:wrap}
|
|
487
498
|
.tb-board-title{font-weight:600;font-size:13.5px}
|
|
@@ -2694,6 +2705,21 @@ window.__ModuleLoader__.load({
|
|
|
2694
2705
|
const [state, setState] = React.useState({ loading: true, board: null, error: null })
|
|
2695
2706
|
const [draft, setDraft] = React.useState(null)
|
|
2696
2707
|
const [busy, setBusy] = React.useState('')
|
|
2708
|
+
const [dialogSize, setDialogSize] = React.useState(() => {
|
|
2709
|
+
const fallback = { width: 680, height: 520 }
|
|
2710
|
+
try {
|
|
2711
|
+
const raw = JSON.parse(window.localStorage.getItem('dsh-timeback:board-dialog-size') || 'null')
|
|
2712
|
+
if (raw && Number.isFinite(raw.width) && Number.isFinite(raw.height)) {
|
|
2713
|
+
return { width: Math.min(1200, Math.max(340, raw.width)), height: Math.min(900, Math.max(260, raw.height)) }
|
|
2714
|
+
}
|
|
2715
|
+
} catch {
|
|
2716
|
+
// fall through to the default
|
|
2717
|
+
}
|
|
2718
|
+
const height = typeof window !== 'undefined' && Number.isFinite(window.innerHeight) ? Math.round(window.innerHeight * 0.62) : fallback.height
|
|
2719
|
+
return { width: fallback.width, height: Math.max(320, Math.min(640, height)) }
|
|
2720
|
+
})
|
|
2721
|
+
const dialogSizeRef = React.useRef(dialogSize)
|
|
2722
|
+
dialogSizeRef.current = dialogSize
|
|
2697
2723
|
|
|
2698
2724
|
const refresh = React.useCallback(async () => {
|
|
2699
2725
|
try {
|
|
@@ -2713,6 +2739,51 @@ window.__ModuleLoader__.load({
|
|
|
2713
2739
|
return () => window.removeEventListener('dsh-timeback:board-changed', handler)
|
|
2714
2740
|
}, [refresh])
|
|
2715
2741
|
|
|
2742
|
+
const persistDialogSize = (value) => {
|
|
2743
|
+
try {
|
|
2744
|
+
window.localStorage.setItem('dsh-timeback:board-dialog-size', JSON.stringify(value))
|
|
2745
|
+
} catch {
|
|
2746
|
+
// Storage can be disabled.
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
const resetDialogSize = () => {
|
|
2750
|
+
const next = { width: 680, height: 520 }
|
|
2751
|
+
setDialogSize(next)
|
|
2752
|
+
persistDialogSize(next)
|
|
2753
|
+
}
|
|
2754
|
+
/** Drag one edge/corner of the note dialog to resize it. */
|
|
2755
|
+
const beginDialogResize = (event, direction) => {
|
|
2756
|
+
if (event.button !== 0) return
|
|
2757
|
+
event.preventDefault()
|
|
2758
|
+
event.stopPropagation()
|
|
2759
|
+
const startX = event.clientX
|
|
2760
|
+
const startY = event.clientY
|
|
2761
|
+
const start = { ...dialogSizeRef.current }
|
|
2762
|
+
const apply = (width, height) => {
|
|
2763
|
+
const next = {
|
|
2764
|
+
width: Math.min(1200, Math.max(340, Math.round(width))),
|
|
2765
|
+
height: Math.min(900, Math.max(260, Math.round(height))),
|
|
2766
|
+
}
|
|
2767
|
+
dialogSizeRef.current = next
|
|
2768
|
+
setDialogSize(next)
|
|
2769
|
+
}
|
|
2770
|
+
const move = (next) => {
|
|
2771
|
+
apply(
|
|
2772
|
+
start.width + (direction.includes('e') ? next.clientX - startX : 0),
|
|
2773
|
+
start.height + (direction.includes('s') ? next.clientY - startY : 0),
|
|
2774
|
+
)
|
|
2775
|
+
}
|
|
2776
|
+
const finish = () => {
|
|
2777
|
+
window.removeEventListener('pointermove', move)
|
|
2778
|
+
window.removeEventListener('pointerup', finish)
|
|
2779
|
+
window.removeEventListener('pointercancel', finish)
|
|
2780
|
+
persistDialogSize(dialogSizeRef.current)
|
|
2781
|
+
}
|
|
2782
|
+
window.addEventListener('pointermove', move)
|
|
2783
|
+
window.addEventListener('pointerup', finish)
|
|
2784
|
+
window.addEventListener('pointercancel', finish)
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2716
2787
|
const entries = [...(state.board?.entries ?? [])].sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))
|
|
2717
2788
|
const boardVersion = state.board?.version ?? 0
|
|
2718
2789
|
const startCreate = () => setDraft({ id: '', title: '', body: '', preview: false, busy: false, error: null })
|
|
@@ -2811,7 +2882,13 @@ window.__ModuleLoader__.load({
|
|
|
2811
2882
|
{ className: 'tb-overlay center', onClick: closeDraft },
|
|
2812
2883
|
h(
|
|
2813
2884
|
'div',
|
|
2814
|
-
{
|
|
2885
|
+
{
|
|
2886
|
+
className: 'tb-board-dialog',
|
|
2887
|
+
role: 'dialog',
|
|
2888
|
+
'aria-modal': true,
|
|
2889
|
+
style: { width: dialogSize.width, height: dialogSize.height },
|
|
2890
|
+
onClick: (event) => event.stopPropagation(),
|
|
2891
|
+
},
|
|
2815
2892
|
h(
|
|
2816
2893
|
'div',
|
|
2817
2894
|
{ className: 'tb-detail-head' },
|
|
@@ -2826,6 +2903,7 @@ window.__ModuleLoader__.load({
|
|
|
2826
2903
|
},
|
|
2827
2904
|
draft.preview ? t('board.editMode') : t('board.preview'),
|
|
2828
2905
|
),
|
|
2906
|
+
h('button', { type: 'button', className: 'tb-btn', title: t('board.resizeHint'), onClick: resetDialogSize }, t('board.resetSize')),
|
|
2829
2907
|
),
|
|
2830
2908
|
h('input', {
|
|
2831
2909
|
value: draft.title,
|
|
@@ -2841,6 +2919,7 @@ window.__ModuleLoader__.load({
|
|
|
2841
2919
|
disabled: draft.busy,
|
|
2842
2920
|
onChange: (event) => setDraft({ ...draft, body: event.target.value }),
|
|
2843
2921
|
}),
|
|
2922
|
+
h('div', { className: 'tb-ws-hint' }, t('board.resizeHint')),
|
|
2844
2923
|
draft.error ? h('div', { className: 'tb-feedback err' }, format(t('board.error'), { error: draft.error })) : null,
|
|
2845
2924
|
h(
|
|
2846
2925
|
'div',
|
|
@@ -2848,6 +2927,9 @@ window.__ModuleLoader__.load({
|
|
|
2848
2927
|
h('button', { type: 'button', className: 'tb-btn', disabled: draft.busy, onClick: closeDraft }, t('board.cancel')),
|
|
2849
2928
|
h('button', { type: 'button', className: 'tb-btn primary', disabled: draft.busy, onClick: saveDraft }, t('board.save')),
|
|
2850
2929
|
),
|
|
2930
|
+
h('div', { className: 'tb-resize-handle e', onPointerDown: (event) => beginDialogResize(event, 'e') }),
|
|
2931
|
+
h('div', { className: 'tb-resize-handle s', onPointerDown: (event) => beginDialogResize(event, 's') }),
|
|
2932
|
+
h('div', { className: 'tb-resize-handle se', onPointerDown: (event) => beginDialogResize(event, 'se') }),
|
|
2851
2933
|
),
|
|
2852
2934
|
)
|
|
2853
2935
|
: null,
|
package/docs/MARKET.md
CHANGED
|
@@ -76,9 +76,17 @@ dshmarket;要让所有人的 dshmarket 搜到,必须走下一节的公共目
|
|
|
76
76
|
- **dshbase**:<https://github.com/ylwl1997/dshbase/issues> 用插件提交表单;
|
|
77
77
|
- **dshhub**:<https://dshhub.dev/submit>(明确要求声明许可证,本项目 MIT)。
|
|
78
78
|
|
|
79
|
-
## 4. npm
|
|
79
|
+
## 4. npm(已发布 0.6.0)
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
`dsh-timeback@0.6.0` 已发布到官方 npm(<https://www.npmjs.com/package/dsh-timeback>),
|
|
82
|
+
用户可以直接安装/固定版本:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
dsh plugin --profile web add dsh-timeback
|
|
86
|
+
dsh plugin --profile web add dsh-timeback@0.6.0
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
awesome 目录 CI 会从 npm 自动补充映射,之后市场安装和更新会走 registry。发布流程参考:
|
|
82
90
|
|
|
83
91
|
```bash
|
|
84
92
|
cd /home/kali/timeback
|
package/docs/PUBLISHING.md
CHANGED
|
@@ -161,6 +161,47 @@ DSH 没有官方中央商店;Discover 读取的是 format-1 JSON 索引,实
|
|
|
161
161
|
|
|
162
162
|
然后用户在 `Plugins → Discover → Index sources` 添加该 URL 即可。
|
|
163
163
|
|
|
164
|
+
## 5.5 Trusted Publishing(GitHub OIDC,推荐用于后续发版)
|
|
165
|
+
|
|
166
|
+
首次发布(0.6.0)已经手动完成。之后建议把发布交给 GitHub Actions OIDC,工作流里
|
|
167
|
+
**不再需要任何 npm token**,npm 会用 OIDC 换一个短期的发布凭证。
|
|
168
|
+
|
|
169
|
+
仓库里已带 [`.github/workflows/publish.yml`](../.github/workflows/publish.yml):
|
|
170
|
+
`release: published` 或手动 `workflow_dispatch` 触发,`permissions.id-token: write`,
|
|
171
|
+
跑测试后执行 `npm publish --provenance`,没有 `NODE_AUTH_TOKEN`。
|
|
172
|
+
|
|
173
|
+
在 npm 侧一次性配置:
|
|
174
|
+
|
|
175
|
+
1. 打开 <https://www.npmjs.com/package/dsh-timeback/access>(或包页面 → Settings →
|
|
176
|
+
**Trusted Publishers**)
|
|
177
|
+
2. **Add publisher** → 选 **GitHub Actions**
|
|
178
|
+
3. 填:
|
|
179
|
+
- Organization or user: `ppmchen`
|
|
180
|
+
- Repository: `dsh-timeback`
|
|
181
|
+
- Workflow filename: `publish.yml`(只写文件名,不带路径)
|
|
182
|
+
- Environment: `npm`(与 workflow 里的 `environment: npm` 一致;不设环境名也可以,但两边必须一致)
|
|
183
|
+
4. 保存时按提示完成 2FA(你的安全密钥)
|
|
184
|
+
|
|
185
|
+
之后每次发版:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# 1) 同步版本:package.json version 与 client.js BUILD(如 0.6.1 / '0.6.1+xxx')
|
|
189
|
+
node --test test/*.test.js
|
|
190
|
+
git add -A && git commit -m "release: 0.6.1"
|
|
191
|
+
git push
|
|
192
|
+
|
|
193
|
+
# 2) 打 tag 并创建 GitHub Release(publish release,不是 draft)
|
|
194
|
+
git tag v0.6.1 && git push origin v0.6.1
|
|
195
|
+
# 在 GitHub → Releases → Draft a new release → 选择 v0.6.1 → Publish release
|
|
196
|
+
|
|
197
|
+
# 3) workflow 自动跑测试并 npm publish --provenance
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
可在 npm 包页面看到 **Provenance** 徽章;安装侧可用 `npm audit signatures` 验证签名。
|
|
201
|
+
|
|
202
|
+
注意:同一个版本号不能重复发布;发布前务必先 bump 版本。首次配置 Trusted Publisher 后,
|
|
203
|
+
建议把旧的发布 token(如果有)在 npm → Access Tokens 里撤销。
|
|
204
|
+
|
|
164
205
|
## 6. 发布前检查清单
|
|
165
206
|
|
|
166
207
|
- [ ] `node --test test/*.test.js` 全绿(当前 40 个)
|
package/package.json
CHANGED