dsh-prompt-for-me 0.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chuan Tian
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.md ADDED
@@ -0,0 +1,131 @@
1
+ # Prompt for Me
2
+
3
+ [中文](README.zh.md)
4
+
5
+ Prompt for Me (中文名:Prompt 嘴替) suggests the next message you may want to send from the DeepSeek Harness composer. It learns from bounded conversation history and your local suggestion interactions, but it never submits on your behalf.
6
+
7
+ ## What it does
8
+
9
+ - Adds one Sparkles button to the composer action row.
10
+ - Uses the same Trigger for the whole flow: click the button or press `Mod+Shift+Space`.
11
+ - Generates exactly one suggestion per accepted Trigger. Each validated suggestion enters the draft as soon as its complete NDJSON line arrives.
12
+ - Sends suggestions skipped during the current cycle with the next request, instructing the model not to repeat or paraphrase them.
13
+ - Coalesces rapid repeated Triggers and ignores shortcut key-repeat, so one input burst advances at most one suggestion.
14
+ - Keeps at most ten skipped suggestions in the current cycle, so repeated Triggers do not grow the request indefinitely.
15
+ - Writes the selected suggestion into the draft. Press Enter to send, edit it first, delete it, or Trigger again for another suggestion.
16
+ - Never bypasses Harness approvals, never invokes tools, and never sends a message automatically.
17
+
18
+ ## Install
19
+
20
+ The release tarball is the simplest option because it contains prebuilt Host and Client artifacts:
21
+
22
+ ```sh
23
+ dsh plugin --profile web add https://github.com/ChuanTianML/prompt-for-me/releases/download/v0.4.0/dsh-prompt-for-me-0.4.0.tgz
24
+ ```
25
+
26
+ Restart `dsh web` after installation.
27
+
28
+ You may also install a pinned Git tag:
29
+
30
+ ```sh
31
+ dsh plugin --profile web add github:ChuanTianML/prompt-for-me#v0.4.0
32
+ ```
33
+
34
+ pnpm 10 may ask you to allow the package's `prepare` script for a Git install. Add `dsh-prompt-for-me: true` under `allowBuilds` in the Web profile's `pnpm-workspace.yaml`, then run the command again. The script only copies the checked-out Host files and wraps the checked-out Client factory; it performs no downloads.
35
+
36
+ Update or remove it with:
37
+
38
+ ```sh
39
+ dsh plugin --profile web update dsh-prompt-for-me
40
+ dsh plugin --profile web remove dsh-prompt-for-me
41
+ ```
42
+
43
+ ## Model and API key
44
+
45
+ The plugin calls `ctx.llm` on the Harness Host. By default it reuses the current session's provider and model, falling back to the Harness default selection. The provider therefore uses the API key already configured in DeepSeek Harness. The browser never receives or reads that key, and this plugin has no separate key.
46
+
47
+ To pin an auxiliary model, set both `provider` and `model` in `cordis.patch.yml` or an overriding profile patch:
48
+
49
+ ```yaml
50
+ - id: prompt-for-me
51
+ name: dsh-prompt-for-me
52
+ config:
53
+ provider: deepseek-official
54
+ model: deepseek-chat
55
+ ```
56
+
57
+ ## Data and privacy
58
+
59
+ On each generation request, the Host may send these bounded text fields to the selected model provider:
60
+
61
+ - the current draft;
62
+ - the last three direct-human/assistant turns from the current session;
63
+ - current-session submitted suggestion edits, exact accepts, and rejected suggestions;
64
+ - bounded raw examples from manual prompts and suggestion interactions in up to 20 earlier sessions;
65
+ - up to ten suggestions skipped during the current cycle, so the model can avoid repeating or paraphrasing them.
66
+
67
+ The current draft and recent turns determine the task, intent, and message content. Current-session feedback adjusts the immediate wording. Cross-session memory may influence only durable style, detail, and workflow preferences. Manual prompts and submitted suggestion edits carry more weight than exact accepts; rejected suggestions are weak negative evidence. Editing a suggestion and triggering again rejects the original suggestion but does not treat the unsubmitted edit as a positive preference.
68
+
69
+ Harness records injected workspace instructions, runtime context, and skill catalogs in user-role events. The plugin excludes these non-human sources from conversation turns and preference memory. If both the draft and direct-human conversation are empty, generation stops before the model call.
70
+
71
+ Common API-key, token, password, and Bearer-token patterns are replaced with `[REDACTED_SECRET]` before the model call. Attachments, tool arguments, files, credentials, and binary blocks are not collected. The plugin has no analytics endpoint and sends data only to the model route already selected in Harness.
72
+
73
+ Interaction records are stored only in this browser's `localStorage` under `dsh.prompt-for-me.outcomes.v2`. Each record contains its session ID, final action, origin, and the relevant original/final text. Version 1 records migrate automatically and remain untouched. Clear both versions in the browser console with:
74
+
75
+ ```js
76
+ localStorage.removeItem('dsh.prompt-for-me.outcomes.v1')
77
+ localStorage.removeItem('dsh.prompt-for-me.outcomes.v2')
78
+ ```
79
+
80
+ DeepSeek Harness `0.1.0-rc.6` does not expose downstream registration for custom durable session-event types. For that reason, the standalone plugin does not append its auxiliary model request or outcomes to the Harness session log; doing so would make persisted sessions unreadable to the stock runtime. This is the main difference from the experimental in-tree implementation and will be revisited when a public event-registration API exists.
81
+
82
+ The generation RPC uses NDJSON. Each complete candidate is validated before it reaches the draft; partial model tokens and incomplete JSON never enter the composer. Hovering the Sparkles button shows only the current action and shortcut, such as `Generate next message (⌘⇧Space)` or `Try another (⌘⇧Space)`.
83
+
84
+ The auxiliary request always uses reasoning effort `off`. The model receives one system instruction plus one JSON user message with `current`, `currentSessionFeedback`, `userPreferenceMemory`, and `currentCycleSkipped`. It receives no tool schemas or attachments.
85
+
86
+ The Host retains the latest 50 privacy-safe performance records in memory and logs each record as `prompt-for-me metrics`. Records contain model route, text byte/item counts, history/input preparation time, first model chunk/reasoning/text times, suggestion arrival time, total model/request time, and provider token usage. They contain no prompt, candidate, or outcome text. Query the current process with:
87
+
88
+ ```sh
89
+ curl -sS -X POST -H 'content-type: application/json' \
90
+ -d '{"method":"metrics"}' \
91
+ http://127.0.0.1:3080/dsh-prompt-for-me/rpc
92
+ ```
93
+
94
+ ## Configuration
95
+
96
+ All generation limits are configurable in `cordis.patch.yml`:
97
+
98
+ | Field | Default | Meaning |
99
+ | --- | ---: | --- |
100
+ | `maxCandidateBytes` | `4096` | UTF-8 limit per suggestion. |
101
+ | `maxDraftBytes` | `32768` | UTF-8 limit for a draft or edited outcome. |
102
+ | `maxCurrentCycleSkipped` | `10` | Skipped suggestions retained as hard negative context for the next Trigger. |
103
+ | `maxCurrentCycleSkippedBytes` | `16384` | Shared JSON budget for suggestions skipped during the current cycle. |
104
+ | `maxCurrentTurns` | `3` | Most recent current-session turns retained. |
105
+ | `maxCurrentContextBytes` | `16384` | JSON budget for the retained turns. |
106
+ | `maxCurrentFeedbackBytes` | `4096` | JSON budget for current-session suggestion feedback. |
107
+ | `maxPreferenceMemoryBytes` | `8192` | JSON budget for cross-session preference memory. |
108
+ | `maxHistorySessions` | `20` | Earlier sessions inspected. |
109
+ | `maxManualPrompts` | `8` | Earlier manual prompts retained. |
110
+ | `maxEditedSuggestions` | `6` | Edited suggestion pairs retained per feedback tier. |
111
+ | `maxAcceptedExact` | `6` | Exact accepts retained per feedback tier. |
112
+ | `maxRejectedSuggestions` | `4` | Weak rejection signals retained per feedback tier. |
113
+ | `maxLocalOutcomes` | `50` | Browser-local interaction records retained. |
114
+ | `maxLocalOutcomesBytes` | `131072` | Shared JSON budget for browser-local records and their RPC copy. |
115
+ | `maxOutputTokens` | `2048` | Auxiliary model output budget. |
116
+ | `timeoutMs` | `30000` | Auxiliary model-call timeout. |
117
+ | `shortcut` | `Mod+Shift+Space` | Portable Trigger, or `disabled`. |
118
+
119
+ ## Development
120
+
121
+ Requires Node.js 22.19 or newer.
122
+
123
+ ```sh
124
+ npm run check
125
+ ```
126
+
127
+ The command rebuilds the static Host/Client artifacts, runs the Node test suite, and verifies the npm package contents.
128
+
129
+ ## License
130
+
131
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,131 @@
1
+ # Prompt for Me(Prompt 嘴替)
2
+
3
+ [English](README.md)
4
+
5
+ Prompt for Me 会根据 DeepSeek Harness 中有界的会话历史和本地建议交互,推测你下一句可能想说什么。它只把建议写入输入框,绝不会代替你发送。
6
+
7
+ ## 功能
8
+
9
+ - 只在输入框操作区增加一个 Sparkles 按钮。
10
+ - 全流程使用同一个 Trigger:点击按钮,或按 `Mod+Shift+Space`。
11
+ - 每次有效 Trigger 只生成一条建议;完整 NDJSON 行通过校验后立即进入输入框。
12
+ - 下一次请求会携带本轮已经跳过的建议,并要求模型不得重复或改写复述它们。
13
+ - 快速连续 Trigger 会被合并,快捷键长按产生的按键连发会被忽略;一次输入连发最多只推进一条建议。
14
+ - 本轮最多保留 10 条已经跳过的建议,连续 Trigger 不会让请求无限增长。
15
+ - 建议只写入草稿。你可以按 Enter 发送、先编辑、全部删除,或继续 Trigger。
16
+ - 不绕过 Harness 权限审批、不调用工具、不自动发送消息。
17
+
18
+ ## 安装
19
+
20
+ 推荐安装 Release 中已经构建好的 tarball,不需要执行构建脚本:
21
+
22
+ ```sh
23
+ dsh plugin --profile web add https://github.com/ChuanTianML/prompt-for-me/releases/download/v0.4.0/dsh-prompt-for-me-0.4.0.tgz
24
+ ```
25
+
26
+ 安装后重启 `dsh web`。
27
+
28
+ 也可以安装固定 Git 标签:
29
+
30
+ ```sh
31
+ dsh plugin --profile web add github:ChuanTianML/prompt-for-me#v0.4.0
32
+ ```
33
+
34
+ 使用 pnpm 10 从 Git 安装时,可能需要在 Web profile 的 `pnpm-workspace.yaml` 中为 `allowBuilds` 添加 `dsh-prompt-for-me: true`,然后重新运行命令。`prepare` 脚本只复制 checkout 中的 Host 文件并包装 Client factory,不会下载任何内容。
35
+
36
+ 更新或卸载:
37
+
38
+ ```sh
39
+ dsh plugin --profile web update dsh-prompt-for-me
40
+ dsh plugin --profile web remove dsh-prompt-for-me
41
+ ```
42
+
43
+ ## 模型和 API Key
44
+
45
+ 插件在 Harness Host 上调用 `ctx.llm`。默认优先复用当前会话的 provider/model,没有时使用 Harness 默认模型,因此使用的就是 DeepSeek Harness 已配置的 API Key。浏览器拿不到也不会读取这个 Key,插件没有单独的 Key。
46
+
47
+ 如需固定辅助模型,可在 `cordis.patch.yml` 或更高优先级的 profile patch 中同时配置:
48
+
49
+ ```yaml
50
+ - id: prompt-for-me
51
+ name: dsh-prompt-for-me
52
+ config:
53
+ provider: deepseek-official
54
+ model: deepseek-chat
55
+ ```
56
+
57
+ ## 数据与隐私
58
+
59
+ 每次生成建议时,Host 可能把下列有界文本发送给当前选择的模型提供方:
60
+
61
+ - 当前草稿;
62
+ - 当前会话最近 3 轮真人用户/助手文本;
63
+ - 当前会话中已发送的建议编辑、原样接受和拒绝记录;
64
+ - 来自最多 20 个历史会话的手写提示词和建议交互原始样本;
65
+ - 本轮最多 10 条已经跳过的建议,用于让模型避免重复或改写复述。
66
+
67
+ 当前草稿和最近 3 轮决定当前任务、意图和消息内容;当前会话反馈只调整眼前的表达;跨会话记忆只能影响长期的风格、详略和工作流偏好。手写提示词和编辑后发送的建议权重高于原样接受,拒绝记录只作为较弱的负向信号。编辑建议后再次 Trigger 会拒绝原建议,但不会把尚未发送的编辑结果当成正向偏好。
68
+
69
+ Harness 会把工作区指令、运行时上下文和 Skill 列表记录为用户角色事件;插件会从会话轮次和偏好记忆中排除这些非真人来源。如果草稿与真人会话均为空,插件会在调用模型前停止生成。
70
+
71
+ 常见 API Key、token、password 和 Bearer token 会在模型调用前替换为 `[REDACTED_SECRET]`。插件不会收集附件、工具参数、文件、凭证或二进制内容;没有分析上报服务,只会调用 Harness 已选择的模型路由。
72
+
73
+ 交互记录只保存在当前浏览器 `localStorage` 的 `dsh.prompt-for-me.outcomes.v2`,每条包含会话 ID、最终动作、来源以及相关的原文/最终文本。V1 记录会自动迁移,原记录不会删除。可在浏览器控制台同时清除两个版本:
74
+
75
+ ```js
76
+ localStorage.removeItem('dsh.prompt-for-me.outcomes.v1')
77
+ localStorage.removeItem('dsh.prompt-for-me.outcomes.v2')
78
+ ```
79
+
80
+ DeepSeek Harness `0.1.0-rc.6` 尚未提供下游插件注册自定义持久化 session event 的公开接口。因此独立版不会把辅助模型请求和建议结果追加到 Harness session log;强行写入会导致原版运行时无法重新读取会话。这是独立版与实验性仓库内实现的主要差异,待官方开放事件注册接口后再补齐。
81
+
82
+ 生成 RPC 使用 NDJSON。每条候选只有在完整并通过校验后才会进入输入框;模型的半截 token 和不完整 JSON 不会写入草稿。鼠标悬停在 Sparkles 按钮上时,只显示当前动作和快捷键,例如“生成下一句(⌘⇧Space)”或“换一条(⌘⇧Space)”。
83
+
84
+ 辅助请求始终使用 `off` reasoning。模型收到一段系统指令,以及一条包含 `current`、`currentSessionFeedback`、`userPreferenceMemory` 和 `currentCycleSkipped` 的 JSON 用户消息;不会收到工具定义或附件。
85
+
86
+ Host 在内存中保留最近 50 条隐私安全的性能记录,并把每条记录以 `prompt-for-me metrics` 写入日志。记录包含模型路由、各类文本的字节数/条数、历史读取和输入组装耗时、首个模型增量/reasoning/text 的时间、建议到达时间、模型与请求总耗时,以及提供方返回的 token usage;不包含提示词、候选或交互结果正文。可查询当前进程:
87
+
88
+ ```sh
89
+ curl -sS -X POST -H 'content-type: application/json' \
90
+ -d '{"method":"metrics"}' \
91
+ http://127.0.0.1:3080/dsh-prompt-for-me/rpc
92
+ ```
93
+
94
+ ## 配置
95
+
96
+ 所有生成限制均可在 `cordis.patch.yml` 中配置:
97
+
98
+ | 字段 | 默认值 | 含义 |
99
+ | --- | ---: | --- |
100
+ | `maxCandidateBytes` | `4096` | 单条建议 UTF-8 上限。 |
101
+ | `maxDraftBytes` | `32768` | 草稿或编辑结果 UTF-8 上限。 |
102
+ | `maxCurrentCycleSkipped` | `10` | 作为下一次 Trigger 强负向上下文保留的已跳过建议数。 |
103
+ | `maxCurrentCycleSkippedBytes` | `16384` | 当前周期已跳过建议共享的 JSON 预算。 |
104
+ | `maxCurrentTurns` | `3` | 保留的当前会话最近轮数。 |
105
+ | `maxCurrentContextBytes` | `16384` | 最近会话轮次的 JSON 预算。 |
106
+ | `maxCurrentFeedbackBytes` | `4096` | 当前会话建议反馈的 JSON 预算。 |
107
+ | `maxPreferenceMemoryBytes` | `8192` | 跨会话偏好记忆的 JSON 预算。 |
108
+ | `maxHistorySessions` | `20` | 检查的历史会话数。 |
109
+ | `maxManualPrompts` | `8` | 保留的历史手写提示词数。 |
110
+ | `maxEditedSuggestions` | `6` | 每个反馈层保留的建议编辑对数。 |
111
+ | `maxAcceptedExact` | `6` | 每个反馈层保留的原样接受数。 |
112
+ | `maxRejectedSuggestions` | `4` | 每个反馈层保留的弱拒绝信号数。 |
113
+ | `maxLocalOutcomes` | `50` | 浏览器本地交互记录上限。 |
114
+ | `maxLocalOutcomesBytes` | `131072` | 浏览器本地记录及其 RPC 副本共享的 JSON 预算。 |
115
+ | `maxOutputTokens` | `2048` | 辅助模型输出预算。 |
116
+ | `timeoutMs` | `30000` | 辅助模型调用超时。 |
117
+ | `shortcut` | `Mod+Shift+Space` | 跨平台 Trigger,也可设为 `disabled`。 |
118
+
119
+ ## 开发
120
+
121
+ 需要 Node.js 22.19 或更高版本。
122
+
123
+ ```sh
124
+ npm run check
125
+ ```
126
+
127
+ 该命令会重新构建 Host/Client 静态产物、运行 Node 测试,并检查 npm 包内容。
128
+
129
+ ## License
130
+
131
+ MIT
@@ -0,0 +1,23 @@
1
+ # Prompt for Me / Prompt 嘴替
2
+ - insert:
3
+ - id: prompt-for-me
4
+ name: dsh-prompt-for-me
5
+ config:
6
+ maxCandidateBytes: 4096
7
+ maxDraftBytes: 32768
8
+ maxCurrentCycleSkipped: 10
9
+ maxCurrentCycleSkippedBytes: 16384
10
+ maxCurrentTurns: 3
11
+ maxCurrentContextBytes: 16384
12
+ maxCurrentFeedbackBytes: 4096
13
+ maxPreferenceMemoryBytes: 8192
14
+ maxHistorySessions: 20
15
+ maxManualPrompts: 8
16
+ maxEditedSuggestions: 6
17
+ maxAcceptedExact: 6
18
+ maxRejectedSuggestions: 4
19
+ maxLocalOutcomes: 50
20
+ maxLocalOutcomesBytes: 131072
21
+ maxOutputTokens: 2048
22
+ timeoutMs: 30000
23
+ shortcut: Mod+Shift+Space