dsh-plan-steps 0.1.3 → 0.1.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/README.en.md +1 -1
- package/README.md +1 -1
- package/client.js +31 -0
- package/docs/DETAIL.md +1 -1
- package/index.js +3 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -16,7 +16,7 @@ plugin is a rewrite against DSH's event and slot model, not a port.
|
|
|
16
16
|
|
|
17
17
|
| Piece | Effect |
|
|
18
18
|
| --- | --- |
|
|
19
|
-
| `plan_write` | Records a two-level plan: `level` 0 phases, `level` 1 sub-steps, an optional stable `step_id`, exactly one current item. A rewrite is checked for continuity: an existing id is never dropped, the current item is never removed or moved back to pending, and completed history keeps its position. |
|
|
19
|
+
| `plan_write` | Records a two-level plan: `level` 0 phases, `level` 1 sub-steps, an optional stable `step_id`, exactly one current item. A rewrite is checked for continuity: an existing id is never dropped, the current item is never removed or moved back to pending, and completed history keeps its position — once every item is completed the plan is history and a new one may replace it. |
|
|
20
20
|
| `complete_step` | Signs the current `in_progress` item off, appends the advanced list as a `todo/write` snapshot (the panel follows), and names the next step. A phase signs off only after its sub-steps. |
|
|
21
21
|
| guard | Refuses a `plan_write` / `todo_write` that turns an item `completed` while the host still has it open. |
|
|
22
22
|
| turn hold | Steers the turn back when it is about to close with open items — once per turn. |
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
| 部件 | 作用 |
|
|
17
17
|
| --- | --- |
|
|
18
|
-
| `plan_write` | 记录两级计划:`level` 0 是阶段,`level` 1 是它的子步骤,每项可带稳定 `step_id`,全表只有一个当前项。重写时执行连续性校验:已有的 id
|
|
18
|
+
| `plan_write` | 记录两级计划:`level` 0 是阶段,`level` 1 是它的子步骤,每项可带稳定 `step_id`,全表只有一个当前项。重写时执行连续性校验:已有的 id 不能丢、当前项不能被删或降级、已完成项保持原位;上一份计划全部完成后可以直接写新计划。 |
|
|
19
19
|
| `complete_step` | 签掉当前 `in_progress` 那一项,宿主推进列表并写入 `todo/write` 快照(面板随之更新),再把下一步告诉你。阶段必须等子步骤全部完成后才能签。 |
|
|
20
20
|
| 守卫 | 列表里还开着的项被 `plan_write` / `todo_write` 直接标成 `completed` 时拒绝。 |
|
|
21
21
|
| 收尾拉回 | 轮末列表还有未完成项时,用 `agent.steer()` 把这一轮拉回来——每轮最多一次。 |
|
package/client.js
CHANGED
|
@@ -15,6 +15,26 @@ window.__ModuleLoader__.load({
|
|
|
15
15
|
radius: 'var(--dsw-radius-lg, 12px)',
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Glass themes (dsh-catppuccin and siblings) expose their look as body
|
|
20
|
+
* variables and mark the document with `data-dsh-glass`; they only blur the
|
|
21
|
+
* surfaces listed in their own seam table, which does not know this panel.
|
|
22
|
+
* Reading the same variables keeps the panel visually identical without
|
|
23
|
+
* patching the theme.
|
|
24
|
+
* @returns extra styles for the panel root, empty when no glass theme is on.
|
|
25
|
+
*/
|
|
26
|
+
function glassSurface() {
|
|
27
|
+
if (typeof document === 'undefined' || !document.documentElement.hasAttribute('data-dsh-glass')) return {}
|
|
28
|
+
const blur = 'blur(var(--dsh-glass-blur, 14px))'
|
|
29
|
+
return {
|
|
30
|
+
background: 'var(--dsh-glass-card, var(--dsw-specific-menu, transparent))',
|
|
31
|
+
border: '1px solid var(--dsh-glass-rim-soft, transparent)',
|
|
32
|
+
backdropFilter: blur,
|
|
33
|
+
WebkitBackdropFilter: blur,
|
|
34
|
+
borderRadius: '14px',
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
// Material Symbols (google/material-design-icons, Apache-2.0), inlined as
|
|
19
39
|
// path data so the panel renders offline.
|
|
20
40
|
const ICONS = {
|
|
@@ -109,6 +129,16 @@ window.__ModuleLoader__.load({
|
|
|
109
129
|
// inside the content as a zero-width marker and is stripped here.
|
|
110
130
|
const todos = (useProjection('todos') ?? []).map(readItem)
|
|
111
131
|
const [open, setOpen] = React.useState(false)
|
|
132
|
+
// A glass theme can be switched on while the panel is mounted.
|
|
133
|
+
const [glass, setGlass] = React.useState(() => glassSurface())
|
|
134
|
+
React.useEffect(() => {
|
|
135
|
+
const observer = new MutationObserver(() => setGlass(glassSurface()))
|
|
136
|
+
observer.observe(document.documentElement, {
|
|
137
|
+
attributes: true,
|
|
138
|
+
attributeFilter: ['data-dsh-glass', 'data-dsh-glass-float'],
|
|
139
|
+
})
|
|
140
|
+
return () => observer.disconnect()
|
|
141
|
+
}, [])
|
|
112
142
|
if (todos.length === 0) return null
|
|
113
143
|
const { done, total, index, current } = positionOf(todos)
|
|
114
144
|
const label = '计划 · 第 ' + String(index) + ' / ' + String(total) + ' 步'
|
|
@@ -127,6 +157,7 @@ window.__ModuleLoader__.load({
|
|
|
127
157
|
color: TOKENS.title,
|
|
128
158
|
fontSize: '13px',
|
|
129
159
|
overflow: 'hidden',
|
|
160
|
+
...glass,
|
|
130
161
|
},
|
|
131
162
|
},
|
|
132
163
|
h(
|
package/docs/DETAIL.md
CHANGED
|
@@ -84,7 +84,7 @@ phase's first sub-step), serial validation (single current item, phase made
|
|
|
84
84
|
current too early, pending work with no current item), call replay, step
|
|
85
85
|
identity, the stored-state parser, and the state block — plus the four
|
|
86
86
|
continuity rules a rewrite must respect (id preserved, current item kept and not
|
|
87
|
-
regressed, completed history in place, first write and additive replan allowed).
|
|
87
|
+
regressed, completed history in place, first write and additive replan allowed, and a fully completed plan replaced outright).
|
|
88
88
|
|
|
89
89
|
## Verification
|
|
90
90
|
|
package/index.js
CHANGED
|
@@ -407,6 +407,9 @@ function findSame(item, list) {
|
|
|
407
407
|
*/
|
|
408
408
|
function continuityProblem(previous, next) {
|
|
409
409
|
if (previous === null || previous.length === 0) return null
|
|
410
|
+
// A finished plan is history, not state: once every item is completed there is
|
|
411
|
+
// no completion left to keep attached, so a new plan may replace it outright.
|
|
412
|
+
if (previous.every((item) => item.status === 'completed')) return null
|
|
410
413
|
for (const item of previous) {
|
|
411
414
|
if (item.stepId === undefined) continue
|
|
412
415
|
if (next.some((candidate) => candidate.stepId === item.stepId)) continue
|