dsh-prompt-picker 0.0.0-stage → 0.8.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/CHANGELOG.md ADDED
@@ -0,0 +1,134 @@
1
+ # Changelog
2
+
3
+ ## 0.8.0
4
+
5
+ ### Security
6
+
7
+ - **Same-origin guard on the RPC route.** A webpage could make a browser POST
8
+ `text/plain` JSON at the loopback port (no preflight) and silently add or
9
+ check prompts. `/_dsh/prompt-picker/rpc` now refuses a request before
10
+ reading anything unless Origin (when present) equals the server's own
11
+ origin, Host is loopback or the server's own hostname, and POST bodies are
12
+ `application/json`; refusals answer `403 {code:'forbidden'}` and change
13
+ nothing.
14
+
15
+ ### Changed
16
+
17
+ - **Slim debug log by default.** The per-assembly line keeps `t`, `sub`,
18
+ `why`, `injected`; the context dump (`keys` + `ctx`) is only written with
19
+ `debugContext: true` in the row config. Fixes the stale
20
+ `full-throttle-debug.log` filename in the header comment.
21
+
22
+ ## 0.7.0
23
+
24
+ ### Added
25
+
26
+ - **The built-in row is editable.** The `update` action now accepts
27
+ `full-throttle` like any row — pencil, scope chip and the footer's edit list
28
+ all work on it (the footer list shows every row, built-in included). The
29
+ edit persists as a `builtin` override in `prompt-picker.json` and survives
30
+ restarts; editing the row back to its generated default drops the override
31
+ key entirely, so an uncustomized row keeps following config `instructions`.
32
+ Only deletion stays rejected: the row itself is code.
33
+
34
+ ### Changed
35
+
36
+ - The footer's edit list now contains every row (the built-in one first), so
37
+ "Edit prompt…" is never disabled and the unreachable empty hint is gone.
38
+
39
+ ## 0.6.0
40
+
41
+ ### Added
42
+
43
+ - **Clear all** — the footer's new button (right of the prompt button) removes
44
+ every saved row after its own second confirmation (`将删除全部 {n} 条自建提示词…`),
45
+ through the new host RPC action `deleteAll` (`{action:'deleteAll'}`). One
46
+ serialized persist; the built-in row is code and keeps its own checked state.
47
+ Disabled while no user row exists.
48
+ - **Two-level prompt menu** — the footer's prompt button now expands
49
+ `新增提示词… / 修改提示词…` instead of opening the add dialog directly; the
50
+ edit branch lists every saved row (name + scope chip), and picking one opens
51
+ the shared dialog prefilled. The per-row inline pencil stays.
52
+
53
+ ### Changed
54
+
55
+ - **Removed the footer's Uncheck-all item** (unchecking stays one click per row,
56
+ and `deleteAll` empties the list outright). The host `clear` RPC action is
57
+ unchanged for API compatibility.
58
+ - The add/edit dialogs merged into one `PromptDialog` (mode add | edit) whose
59
+ save is awaited: a rejected RPC keeps the dialog open and surfaces the message
60
+ inline, instead of closing and erroring the whole widget.
61
+
62
+ ### Fixed
63
+
64
+ - Verified scope routing end to end against a live harness: a `main` row reached
65
+ only the top session (`why=header:main`), a `sub` row only a spawned child
66
+ (`why=origin=subagent,delegationDepth=1`), `both` reached both.
67
+
68
+ ## 0.5.1
69
+
70
+ ### Fixed
71
+
72
+ - **Concurrent state writes no longer drift.** `persist()` used a temporary file
73
+ named only after `process.pid`, so overlapping `toggle` / `update` / `delete`
74
+ calls clobbered the same temporary file and raced their rename/unlink steps; the
75
+ in-memory `selectedIds` could then disagree with the state file until the next
76
+ successful write (the file never tore, and a reload took the disk as truth).
77
+ Writes are now serialized through one promise chain and each uses a unique
78
+ temporary name (`<pid>.<time>.<random>.tmp`); the payload is serialized when
79
+ the write runs, so the last write always reflects the current rows.
80
+
81
+ ### Changed
82
+
83
+ - Documented the validation contract of `update`: an empty name or text answers
84
+ `400 rejected`, while an out-of-range `scope` falls back to `both` — the same
85
+ `scopeOf()` rule `add` has always applied, kept identical on purpose.
86
+ - `test/edit-delete.test.mjs` now also covers 36 overlapping toggle/update calls
87
+ (memory must equal disk, no `.tmp` residue, a reload must agree) and the
88
+ documented scope fallback.
89
+
90
+ ## 0.5.0
91
+
92
+ ### Added
93
+
94
+ - Per-row **edit** (pencil → inline form for name / text / scope, saved through the
95
+ new `update` action) and **delete** (trash → second confirmation, then the new
96
+ `delete` action). The built-in row is read-only: it shows neither entry.
97
+ - Host RPC actions on `/_dsh/prompt-picker/rpc`:
98
+ - `update` — `{action:'update', id, name?, text?, scope?}`; a partial update.
99
+ Unchanged fields keep their value; validation matches `add` (name trimmed to
100
+ 60 characters and non-empty, text non-empty, scope through `scopeOf`);
101
+ the in-memory row is restored if the write fails.
102
+ - `delete` — `{action:'delete', id}`; removes the row and drops its id from
103
+ `selectedIds`, rolling both back if the write fails.
104
+ - Both answer `{ok:true, value:<state>}`, or `400 {ok:false, error:{code:'rejected', message}}`
105
+ for an unknown id, an empty field, or the built-in row.
106
+ - `test/edit-delete.test.mjs`: action-level, RPC-contract, restart-reload,
107
+ toggle/update interleaving, scope-routing and zh/en copy-parity coverage.
108
+
109
+ ### Fixed
110
+
111
+ - **Sub-agent detection.** `classifyAgent` read `delegationDepth` / `origin` off
112
+ the flat assembly context, which never carries them, so every assembly fell
113
+ through to the `default-main` branch. `scope: 'main'` rows therefore leaked
114
+ into sub-agents — including teammates (18/18 assemblies in a real session).
115
+ It now reads the durable session header (`context.agent.session.header`) plus
116
+ `AgentOptions.subagentDepth`, matching `delegationDepthOf()` in
117
+ `@deepseek-ai/dsh-subagent`, and the calibration log distinguishes
118
+ `origin=…`, `delegationDepth=…`, `header:main` and
119
+ `default-main:no-header`.
120
+
121
+ ### Changed
122
+
123
+ - Version 0.4.0 → 0.5.0. README (both languages) documents the scope
124
+ discriminator, the degradation path and the new row actions.
125
+
126
+ ## 0.4.0
127
+
128
+ - Published as the standalone plugin `dsh-prompt-picker`: multi-select prompts,
129
+ per-row scopes (both / main / sub), solid-hollow bolt icon, same-origin host RPC.
130
+
131
+ ## 0.3.x
132
+
133
+ - Earlier releases under the previous `dsh-full-throttle` identity (single switch →
134
+ multi-select picker).
package/README.md CHANGED
@@ -1,3 +1,33 @@
1
- # Temporary Holding Version
1
+ # dsh-prompt-picker
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ English | [中文](README.zh.md)
4
+
5
+ One bolt icon ⚡ in the composer toolbar: click it and check the system prompts to inject. Multi-select.
6
+
7
+ | Off (hollow) | On (solid) |
8
+ | --- | --- |
9
+ | ![off](docs/preview-bolt-off.svg) | ![on](docs/preview-bolt-on.svg) |
10
+
11
+ ## What it does
12
+
13
+ - **Check = inject**: checked rows go into the system prompt in list order, separated by blank lines; check nothing and nothing is injected
14
+ - **Per-row scope**: all / main agent only / sub-agents only (click the chip at the end of a row; teammate sessions count as sub-agents)
15
+ - **Manage**: add, edit (the built-in "Full Throttle" row included), delete one by one, or clear every saved row at once
16
+ - **Survives restarts**: state lives in `~/.dsh/prompt-picker.json`
17
+ - **Local debug log**: each injection appends one slim JSON line (scope verdict + names) to `~/.dsh/prompt-picker-debug.log`; add `debugContext: true` to the row config for the full context dump. Local only, auto-resets past 256 KiB
18
+
19
+ ## Install
20
+
21
+ - **Market**: search `dsh-prompt-picker` in the DSH plugin market (dshmarket), one click
22
+ - **Manual**: Plugins page → Add plugin → paste `https://github.com/solopole/dsh-prompt-picker`
23
+ - **CLI**: `dsh plugin --profile <name> add dsh-prompt-picker`
24
+
25
+ ## Customize the built-in text (optional)
26
+
27
+ Edit the built-in row right in the menu, or change its generated default in the profile's `cordis.patch.yml`:
28
+
29
+ ```yaml
30
+ - id: prompt-picker
31
+ config:
32
+ instructions: 'Your default text'
33
+ ```
package/README.zh.md ADDED
@@ -0,0 +1,33 @@
1
+ # dsh-prompt-picker(提示词选择器)
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 输入框工具栏的闪电图标 ⚡:点开勾选要注入的系统提示词,可多选。
6
+
7
+ | 关(空心) | 开(实心) |
8
+ | --- | --- |
9
+ | ![关](docs/preview-bolt-off.svg) | ![开](docs/preview-bolt-on.svg) |
10
+
11
+ ## 功能
12
+
13
+ - **勾选即注入**:勾选的提示词按列表顺序、空行分隔写进系统提示词;一条不勾就什么都不注入
14
+ - **每条可设作用域**:全部 / 仅主 agent / 仅子 agent(点行尾圆片切换;teammate 会话也算子 agent)
15
+ - **管理**:新增、修改(内置「火力全开」行也能改)、单条删除、一键全清自建条目
16
+ - **重启不丢**:状态保存在 `~/.dsh/prompt-picker.json`
17
+ - **本地调试日志**:每次注入在 `~/.dsh/prompt-picker-debug.log` 记一行极简 JSON(作用域判定与注入名);需要完整上下文转储时在配置里加 `debugContext: true`。纯本地,超 256KiB 自动清零
18
+
19
+ ## 安装
20
+
21
+ - **插件市场**:DSH 插件市场(dshmarket)搜 `dsh-prompt-picker`,一键安装
22
+ - **手动**:插件页 → 添加插件 → 贴 `https://github.com/solopole/dsh-prompt-picker`
23
+ - **CLI**:`dsh plugin --profile <名字> add dsh-prompt-picker`
24
+
25
+ ## 自定义内置文案(可选)
26
+
27
+ 内置「火力全开」可以在菜单里直接改;也可以在 profile 的 `cordis.patch.yml` 里改它的默认值:
28
+
29
+ ```yaml
30
+ - id: prompt-picker
31
+ config:
32
+ instructions: '你的默认文案'
33
+ ```