@leiyi-works/dsh-session-tmpdir 0.10.8 → 0.10.9
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 +6 -1
- package/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ v0.7 起,这条规则不再只靠 `write`/`edit`/`pwsh`/`bash` 四个工具名
|
|
|
69
69
|
## 长期文件审批流程
|
|
70
70
|
|
|
71
71
|
1. 模型判断某文件需要长期保存,且不在任务指定位置;
|
|
72
|
-
2. 模型调用 `ask_user_question` 给用户**固定问法**的选择题(标题「保存位置」、问题「这份要长期保存吗?」,只给 **A 不长期保存** / **B 工作区根目录保存** 两个选项;v0.10.8 起 A 的 description 必须用 `task_tmpdir` 返回的真实绝对路径(含真实会话标题,如「临时目录 D:\DSH工作区\_tmp\<实际标题>,随会话删除后 7
|
|
72
|
+
2. 模型调用 `ask_user_question` 给用户**固定问法**的选择题(标题「保存位置」、问题「这份要长期保存吗?」,只给 **A 不长期保存** / **B 工作区根目录保存** 两个选项;v0.10.8 起 A 的 description 必须用 `task_tmpdir` 返回的真实绝对路径(含真实会话标题,如「临时目录 D:\DSH工作区\_tmp\<实际标题>,随会话删除后 7 天清理」);v0.10.9 起 B 的 description 也用本会话工作目录的真实绝对路径(如「长期保存到 D:\DSH工作区 下」);两处都不出现占位符和反引号;v0.10.7 起禁止自创/替换/增删选项、禁止把路径写进标签;选 B 时模型自行起目录名、不再跟用户确认;其他位置由用户直接在输入框里写路径);
|
|
73
73
|
3. 用户选长期 + 给路径 → 模型调 `longterm_approve({ path, reason, basis })` 登记:**默认 `mode: 'file'` 只批准这一个文件**;用户明确要"整个目录都行"时才用 `mode: 'dir'`。工作区外路径也能登记(例如鸿蒙的 `Download/<包名>/`),但不能登记磁盘根目录、用户主目录本身或层级过浅的目录;
|
|
74
74
|
4. 之后 `write`/`edit`、shell 命令、`publish` 交付、python 等代码工具才能**新建**该位置的文件;用户否定 → 模型改用 `task_tmpdir` 写 `_tmp`。**改写已存在文件不需要登记**(`allowOverwrite`)。
|
|
75
75
|
|
|
@@ -287,3 +287,8 @@ v0.10.3 变更(2026-11-16):
|
|
|
287
287
|
- 问题文字去掉「存哪?」:固定为「这份要长期保存吗?」(位置由 A/B 两个选项表达)。
|
|
288
288
|
- A「不长期保存」的 description 改为**实时真实路径**:弹窗前先调 `task_tmpdir` 取本会话临时目录的绝对路径(含真实会话标题),写成「临时目录 <该路径>,随会话删除后 N 天清理」;不再出现 `<会话标题>` 占位符和反引号(GUI 会把反引号原样显示)。
|
|
289
289
|
- `full` 注入同步;guard 判定、审批、清理逻辑未改。
|
|
290
|
+
|
|
291
|
+
## v0.10.9 变更(2026-11-19):B 选项小字也显示实际路径
|
|
292
|
+
|
|
293
|
+
- B「工作区根目录保存」的 description 从固定文案「长期保存到会话工作区根目录下」改为**本会话工作目录的真实绝对路径**(如「长期保存到 D:\DSH工作区 下」),路径取运行时上下文里的 Current working directory;不出现占位符和反引号。
|
|
294
|
+
- `compact` / `full` 注入同步;guard 判定、审批、清理逻辑未改。
|
package/index.js
CHANGED
|
@@ -317,7 +317,7 @@ export function buildPromptText(cfg) {
|
|
|
317
317
|
'',
|
|
318
318
|
`- 临时产物一律写到 <会话工作目录>/${rootDirName}/<会话标题>/,不要放在工作区根目录;先调用 \`task_tmpdir\` 拿准确路径(会话改名会跟着改,别写死)。`,
|
|
319
319
|
`- 长期文件(可复用脚本/记录/交付成品)写到 \`${rootDirName}/\` 以外前必须先问用户,且只能用下面的固定问法;用户同意后 \`longterm_approve\` 登记再写;${allowOverwrite ? '覆盖已存在的文件不用问;' : '覆盖已存在文件也要问;'}临时产物不要问用户。`,
|
|
320
|
-
`- 固定问法(禁止自创/替换/增删选项,禁止把位置写进选项标签):标题「保存位置」+ 问题「这份要长期保存吗?」+ 选项 A「不长期保存」+ 选项 B「工作区根目录保存」。A 的 description 必须先调用 \`task_tmpdir\` 拿本会话临时目录的真实绝对路径(含真实会话标题),写成「临时目录 <该绝对路径>,随会话删除后 ${orphanCleanupDays} 天清理」,不要出现 <会话标题> 占位符、不要用反引号;B 的 description
|
|
320
|
+
`- 固定问法(禁止自创/替换/增删选项,禁止把位置写进选项标签):标题「保存位置」+ 问题「这份要长期保存吗?」+ 选项 A「不长期保存」+ 选项 B「工作区根目录保存」。A 的 description 必须先调用 \`task_tmpdir\` 拿本会话临时目录的真实绝对路径(含真实会话标题),写成「临时目录 <该绝对路径>,随会话删除后 ${orphanCleanupDays} 天清理」,不要出现 <会话标题> 占位符、不要用反引号;B 的 description 写「长期保存到 <本会话工作目录的真实绝对路径> 下」(路径取运行时上下文里的工作目录,不要留占位符、不要用反引号)。其它位置由用户在输入框自己写,不另列成选项。`,
|
|
321
321
|
`- 未登记就写到 \`${rootDirName}/\` 以外会被 guard 直接拒绝(write/edit、shell、代码执行、publish 等所有写通道);被拒就改用 task_tmpdir 的路径,不要换写法绕过。白名单见左侧「临时目录」面板。`,
|
|
322
322
|
].join('\n')
|
|
323
323
|
}
|
|
@@ -338,7 +338,7 @@ export function buildPromptText(cfg) {
|
|
|
338
338
|
'- question: 这份要长期保存吗?',
|
|
339
339
|
'- A. 不长期保存',
|
|
340
340
|
'- B. 工作区根目录保存',
|
|
341
|
-
`Use exactly these two labels; put the explanation in each option's \`description\` instead. A: call \`task_tmpdir\` FIRST and write the REAL absolute path of this session's temp folder (it contains the actual session title): 临时目录 <that absolute path>,随会话删除后 ${orphanCleanupDays} 天清理 — never the <会话标题> placeholder, never backticks. B:
|
|
341
|
+
`Use exactly these two labels; put the explanation in each option's \`description\` instead. A: call \`task_tmpdir\` FIRST and write the REAL absolute path of this session's temp folder (it contains the actual session title): 临时目录 <that absolute path>,随会话删除后 ${orphanCleanupDays} 天清理 — never the <会话标题> placeholder, never backticks. B: write the REAL absolute path of this session's working directory: 长期保存到 <that absolute path> 下 — resolve it from the runtime context (Current working directory), no placeholder, no backticks. Never put a path or folder name into a label. Any other location is typed by the user in the free-text answer box — that box covers 用户目录/指定目录/工作区外目录, so none of those may become options.`,
|
|
342
342
|
'Do not create anything until the user answers.',
|
|
343
343
|
'Picking B: pick a clear file path under the workspace root, call `longterm_approve` with it (mode=file by default), then write it.',
|
|
344
344
|
'Any answer other than A/B (e.g. a path the user typed in the free-text box) is a designated location: if it is missing or ambiguous, ask the user to confirm it before calling `longterm_approve` — never guess.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leiyi-works/dsh-session-tmpdir",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Per-session task temp folder with a long-term write guard. v0.9 (方案3): creating a new file outside _tmp requires the user's approval (per file by default, per directory with mode=dir), overwriting an existing file is allowed without asking, every write channel is guarded (write/edit, shell including ffmpeg/pandoc/Export-*/IO APIs, publish copies, code runtimes, unknown tools), and the persisted whitelist is shown in a left-sidebar panel「临时目录」 where entries can be removed. Every session also gets _tmp/<session title>/ in its working directory, cleaned 7 days after the session is deleted; the same tick reclaims the attachment store.",
|
|
6
6
|
"exports": {
|