dominds 1.27.6 → 1.28.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/dist/dialog.js +1 -1
- package/dist/docs/team_mgmt-toolset.md +21 -20
- package/dist/docs/team_mgmt-toolset.zh.md +21 -20
- package/dist/docs/txt-editing-tools.md +196 -122
- package/dist/docs/txt-editing-tools.zh.md +171 -97
- package/dist/llm/gen/failure-classifier.js +60 -11
- package/dist/llm/kernel-driver/drive.js +1 -1
- package/dist/tool.d.ts +2 -0
- package/dist/tool.js +52 -0
- package/dist/tools/app-reminders.js +1 -1
- package/dist/tools/builtins.js +31 -12
- package/dist/tools/prompts/team_mgmt.en.md +13 -29
- package/dist/tools/prompts/team_mgmt.zh.md +13 -29
- package/dist/tools/prompts/ws_mod/en/errors.md +45 -42
- package/dist/tools/prompts/ws_mod/en/index.md +10 -10
- package/dist/tools/prompts/ws_mod/en/principles.md +27 -34
- package/dist/tools/prompts/ws_mod/en/scenarios.md +42 -29
- package/dist/tools/prompts/ws_mod/en/tools.md +43 -46
- package/dist/tools/prompts/ws_mod/zh/errors.md +45 -42
- package/dist/tools/prompts/ws_mod/zh/index.md +10 -10
- package/dist/tools/prompts/ws_mod/zh/principles.md +27 -34
- package/dist/tools/prompts/ws_mod/zh/scenarios.md +42 -29
- package/dist/tools/prompts/ws_mod/zh/tools.md +42 -45
- package/dist/tools/prompts/ws_mod.en.md +77 -47
- package/dist/tools/prompts/ws_mod.zh.md +77 -47
- package/dist/tools/team_mgmt.d.ts +7 -6
- package/dist/tools/team_mgmt.js +379 -220
- package/dist/tools/txt.d.ts +20 -9
- package/dist/tools/txt.js +2282 -1842
- package/dist/utils/taskdoc.js +2 -2
- package/package.json +5 -5
- package/webapp/dist/assets/{main-NXVX2KTO.js → main-YWP5PWOM.js} +62 -1
- package/webapp/dist/assets/{main-NXVX2KTO.js.map → main-YWP5PWOM.js.map} +4 -4
- package/webapp/dist/index.html +1 -1
package/dist/tools/builtins.js
CHANGED
|
@@ -63,12 +63,21 @@ function manualSpecFor(toolsetId) {
|
|
|
63
63
|
(0, registry_1.registerTool)(picture_1.writePictureTool);
|
|
64
64
|
(0, registry_1.registerTool)(txt_1.createNewFileTool);
|
|
65
65
|
(0, registry_1.registerTool)(txt_1.overwriteEntireFileTool);
|
|
66
|
-
(0, registry_1.registerTool)(txt_1.
|
|
67
|
-
(0, registry_1.registerTool)(txt_1.
|
|
68
|
-
(0, registry_1.registerTool)(txt_1.
|
|
69
|
-
(0, registry_1.registerTool)(txt_1.
|
|
70
|
-
(0, registry_1.registerTool)(txt_1.
|
|
71
|
-
(0, registry_1.registerTool)(txt_1.
|
|
66
|
+
(0, registry_1.registerTool)(txt_1.fileRangeEditTool);
|
|
67
|
+
(0, registry_1.registerTool)(txt_1.padWriteTool);
|
|
68
|
+
(0, registry_1.registerTool)(txt_1.padLoadFileRangeTool);
|
|
69
|
+
(0, registry_1.registerTool)(txt_1.padEditTool);
|
|
70
|
+
(0, registry_1.registerTool)(txt_1.padInsertTool);
|
|
71
|
+
(0, registry_1.registerTool)(txt_1.padDeleteRangeTool);
|
|
72
|
+
(0, registry_1.registerTool)(txt_1.padCopyTool);
|
|
73
|
+
(0, registry_1.registerTool)(txt_1.padMoveTool);
|
|
74
|
+
(0, registry_1.registerTool)(txt_1.padDeleteTool);
|
|
75
|
+
(0, registry_1.registerTool)(txt_1.fileAppendTool);
|
|
76
|
+
(0, registry_1.registerTool)(txt_1.fileInsertAfterTool);
|
|
77
|
+
(0, registry_1.registerTool)(txt_1.fileInsertBeforeTool);
|
|
78
|
+
(0, registry_1.registerTool)(txt_1.fileBlockReplaceTool);
|
|
79
|
+
(0, registry_1.registerTool)(txt_1.prepareOccurrenceReplaceTool);
|
|
80
|
+
(0, registry_1.registerTool)(txt_1.applyOccurrenceReplaceTool);
|
|
72
81
|
// Ripgrep tools
|
|
73
82
|
(0, registry_1.registerTool)(ripgrep_1.ripgrepFilesTool);
|
|
74
83
|
(0, registry_1.registerTool)(ripgrep_1.ripgrepSnippetsTool);
|
|
@@ -299,12 +308,21 @@ for (const tool of team_mgmt_1.teamMgmtTools) {
|
|
|
299
308
|
picture_1.writePictureTool,
|
|
300
309
|
txt_1.createNewFileTool,
|
|
301
310
|
txt_1.overwriteEntireFileTool,
|
|
302
|
-
txt_1.
|
|
303
|
-
txt_1.
|
|
304
|
-
txt_1.
|
|
305
|
-
txt_1.
|
|
306
|
-
txt_1.
|
|
307
|
-
txt_1.
|
|
311
|
+
txt_1.fileRangeEditTool,
|
|
312
|
+
txt_1.padWriteTool,
|
|
313
|
+
txt_1.padLoadFileRangeTool,
|
|
314
|
+
txt_1.padEditTool,
|
|
315
|
+
txt_1.padInsertTool,
|
|
316
|
+
txt_1.padDeleteRangeTool,
|
|
317
|
+
txt_1.padCopyTool,
|
|
318
|
+
txt_1.padMoveTool,
|
|
319
|
+
txt_1.padDeleteTool,
|
|
320
|
+
txt_1.fileAppendTool,
|
|
321
|
+
txt_1.fileInsertAfterTool,
|
|
322
|
+
txt_1.fileInsertBeforeTool,
|
|
323
|
+
txt_1.fileBlockReplaceTool,
|
|
324
|
+
txt_1.prepareOccurrenceReplaceTool,
|
|
325
|
+
txt_1.applyOccurrenceReplaceTool,
|
|
308
326
|
ripgrep_1.ripgrepFilesTool,
|
|
309
327
|
ripgrep_1.ripgrepSnippetsTool,
|
|
310
328
|
ripgrep_1.ripgrepCountTool,
|
|
@@ -347,3 +365,4 @@ for (const tool of team_mgmt_1.teamMgmtTools) {
|
|
|
347
365
|
(0, registry_1.registerReminderOwner)(os_1.shellCmdReminderOwner);
|
|
348
366
|
(0, registry_1.registerReminderOwner)(mcp_1.mcpLeaseReminderOwner);
|
|
349
367
|
(0, registry_1.registerReminderOwner)(pending_tellask_reminder_1.pendingTellaskReminderOwner);
|
|
368
|
+
(0, registry_1.registerReminderOwner)(txt_1.wsModPadReminderOwner);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# team_mgmt: manage `.minds/` (
|
|
1
|
+
# team_mgmt: manage `.minds/` (direct edit)
|
|
2
2
|
|
|
3
3
|
You have read/write access to `.minds/**`, but this toolset **only operates within the `.minds/` subtree** (it should not touch other rtws (runtime workspace) files).
|
|
4
4
|
|
|
5
5
|
## Principles
|
|
6
6
|
|
|
7
|
-
- Incremental edits
|
|
7
|
+
- Incremental edits: single-block edits write directly. Use `team_mgmt_file_range_edit` for line ranges, `team_mgmt_file_append` for EOF appends, `team_mgmt_file_insert_after` / `team_mgmt_file_insert_before` for anchor insertions, and `team_mgmt_file_block_replace` for anchor-delimited blocks. For multi-point same-literal replacement, prefer `team_mgmt_prepare_occurrence_replace` followed by `team_mgmt_apply_occurrence_replace`; if only one occurrence is selected, prepare succeeds but returns `notice: NOT_MULTI_OCCURRENCE`. These edit tools accept inline `content` or a ws_mod `pad_id/pad_range` source.
|
|
8
8
|
- If you carry team-management responsibility, read the relevant `man({ "toolsetId": "team_mgmt" })` chapters before performing concrete team-management actions, and maintain `.minds/**` team mind assets by the handbook-standard workflow.
|
|
9
|
-
- Parallelism constraint: multiple function tool calls in one generation step may run in parallel
|
|
10
|
-
- Exception (create): `team_mgmt_create_new_file` only creates a new file (empty content allowed)
|
|
11
|
-
- Exception (overwrite): `team_mgmt_overwrite_entire_file` writes
|
|
9
|
+
- Parallelism constraint: multiple function tool calls in one generation step may run in parallel. Same-file writes are serialized internally, but avoid making same-turn edits depend on unread results from each other.
|
|
10
|
+
- Exception (create): `team_mgmt_create_new_file` only creates a new file from `content` or `pad_id/pad_range` (empty content allowed); it refuses to overwrite existing files.
|
|
11
|
+
- Exception (overwrite): `team_mgmt_overwrite_entire_file` writes `content` or `pad_id/pad_range` immediately. It requires `known_old_total_lines/known_old_total_bytes` guardrails; use `team_mgmt_read_file` to read `total_lines/size_bytes` from the YAML header.
|
|
12
12
|
- Normalization: each line ends with `\\n` (including the last line); the tool may add a trailing newline and report it in `normalized.*`.
|
|
13
13
|
|
|
14
14
|
## read_file output fields (important)
|
|
@@ -26,44 +26,28 @@ The YAML header from `team_mgmt_read_file` includes:
|
|
|
26
26
|
## Which tool to use
|
|
27
27
|
|
|
28
28
|
- Read/locate: `team_mgmt_read_file` / `team_mgmt_list_dir` / `team_mgmt_ripgrep_*`
|
|
29
|
-
- Create a new file (empty allowed): `team_mgmt_create_new_file({ path, content })`
|
|
30
|
-
- Small edits (line range): `
|
|
31
|
-
- Append to EOF: `
|
|
32
|
-
- Anchor insertion: `
|
|
33
|
-
- Block replace between anchors: `
|
|
34
|
-
-
|
|
29
|
+
- Create a new file (empty allowed): `team_mgmt_create_new_file({ path, content })` or `team_mgmt_create_new_file({ path, pad_id, pad_range })`
|
|
30
|
+
- Small edits (line range): `team_mgmt_file_range_edit({ path, range, content })` or `team_mgmt_file_range_edit({ path, range, pad_id, pad_range })`
|
|
31
|
+
- Append to EOF: `team_mgmt_file_append({ path, content, create })`
|
|
32
|
+
- Anchor insertion: `team_mgmt_file_insert_after|team_mgmt_file_insert_before({ path, anchor, content, occurrence, match })`
|
|
33
|
+
- Block replace between anchors: `team_mgmt_file_block_replace({ path, start_anchor, end_anchor, content, occurrence, include_anchors, match, require_unique, strict })`
|
|
34
|
+
- Batch literal occurrence replacement: `team_mgmt_prepare_occurrence_replace({ path, find, content|pad_id, occurrence_indexes? })` then `team_mgmt_apply_occurrence_replace({ plan_id })`; it is designed for multi-point same-literal replacement, and single-occurrence plans succeed but return `notice: NOT_MULTI_OCCURRENCE`.
|
|
35
35
|
- After editing `.minds/team.yaml`: always run `team_mgmt_validate_team_cfg({})`; if the output shows "Resolved But Not Yet Cleared", finish with `team_mgmt_clear_problems({ source: "team", path: "team.yaml" })`.
|
|
36
36
|
- After editing `.minds/mcp.yaml`: always run `team_mgmt_validate_mcp_cfg({})`; if the output shows "Resolved But Not Yet Cleared", finish with `team_mgmt_clear_problems({ source: "mcp", path: "mcp.yaml" })`.
|
|
37
37
|
|
|
38
38
|
> Optional fields can be omitted.
|
|
39
39
|
> If you want to pass explicit “unset / default” values, the following sentinel forms are supported:
|
|
40
40
|
>
|
|
41
|
-
> - `existing_hunk_id: ""` means generate a new hunk.
|
|
42
41
|
> - `occurrence: ""` or `0` means occurrence is not specified.
|
|
43
42
|
> - `match: ""` means default `contains` (note: `match` is the match mode).
|
|
44
43
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
- `exact`: file matches the prepare context exactly.
|
|
48
|
-
- `fuzz`: file drifted but still safe to apply; the output includes `file_changed_since_preview` and digests for review.
|
|
49
|
-
- `rejected`: cannot locate uniquely or unsafe; re-prepare.
|
|
50
|
-
|
|
51
|
-
## Two-step template
|
|
52
|
-
|
|
53
|
-
1. Prepare:
|
|
44
|
+
## Direct line-range edit template
|
|
54
45
|
|
|
55
46
|
```text
|
|
56
|
-
Call the function tool `
|
|
47
|
+
Call the function tool `team_mgmt_file_range_edit` with:
|
|
57
48
|
{ "path": "team.yaml", "range": "10~12", "content": "..." }
|
|
58
49
|
```
|
|
59
50
|
|
|
60
|
-
2. Apply (must be a separate step):
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
Call the function tool `team_mgmt_apply_file_modification` with:
|
|
64
|
-
{ "hunk_id": "<hunk_id>" }
|
|
65
|
-
```
|
|
66
|
-
|
|
67
51
|
## Create an empty file example
|
|
68
52
|
|
|
69
53
|
```text
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# team_mgmt:管理 `.minds/`(
|
|
1
|
+
# team_mgmt:管理 `.minds/`(direct edit)
|
|
2
2
|
|
|
3
3
|
你拥有对 `.minds/**` 的读写能力,但该 toolset **只允许操作 `.minds/` 子树**(不会也不应触碰 rtws(运行时工作区)其他文件)。
|
|
4
4
|
|
|
5
5
|
## 总原则
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 增量编辑:单块编辑直接写入;行号范围用 `team_mgmt_file_range_edit`,末尾追加用 `team_mgmt_file_append`,锚点插入用 `team_mgmt_file_insert_after` / `team_mgmt_file_insert_before`,锚点块替换用 `team_mgmt_file_block_replace`。同一字面量多点批量替换优先用 `team_mgmt_prepare_occurrence_replace` 后接 `team_mgmt_apply_occurrence_replace`;若只选中单个 occurrence,prepare 会成功但返回 `notice: NOT_MULTI_OCCURRENCE`。这些编辑工具均支持内联 `content` 或 ws_mod `pad_id/pad_range` 来源。
|
|
8
8
|
- 若你承担团队管理职责,执行具体团队管理操作前,先查看 `man({ "toolsetId": "team_mgmt" })` 的相关章节,并按手册标准做法维护 `.minds/**` 团队心智资产。
|
|
9
|
-
-
|
|
10
|
-
- 例外(创建):`team_mgmt_create_new_file`
|
|
11
|
-
- 例外(整文件覆盖):`team_mgmt_overwrite_entire_file`
|
|
9
|
+
- 并行约束:同一轮生成中的多个工具调用可能并行执行;同一文件写入会在工具侧串行化,但不要让同轮多个编辑依赖彼此未读到的结果。
|
|
10
|
+
- 例外(创建):`team_mgmt_create_new_file` 只负责用 `content` 或 `pad_id/pad_range` 创建新文件(允许空内容);若文件已存在会拒绝(避免误用覆盖写入语义)。
|
|
11
|
+
- 例外(整文件覆盖):`team_mgmt_overwrite_entire_file` 会直接写入 `content` 或 `pad_id/pad_range`,必须提供 `known_old_total_lines/known_old_total_bytes` 作为对账护栏;建议先用 `team_mgmt_read_file` 从 YAML header 读取 `total_lines/size_bytes` 再填写。
|
|
12
12
|
- 规范化:写入遵循“每行以 `\\n` 结尾(含最后一行)”;必要时会补齐并通过输出字段呈现(例如 `normalized_trailing_newline_added` / `normalized.*`)。
|
|
13
13
|
|
|
14
14
|
## read_file 输出字段(重要)
|
|
@@ -26,44 +26,28 @@
|
|
|
26
26
|
## 该用哪个工具
|
|
27
27
|
|
|
28
28
|
- 读取定位:`team_mgmt_read_file` / `team_mgmt_list_dir` / `team_mgmt_ripgrep_*`
|
|
29
|
-
- 创建新文件(允许空内容):`team_mgmt_create_new_file({ path, content })`
|
|
30
|
-
- 小改动(行号范围):`
|
|
31
|
-
- 末尾追加:`
|
|
32
|
-
- 锚点插入:`
|
|
33
|
-
- 双锚点块替换:`
|
|
34
|
-
-
|
|
29
|
+
- 创建新文件(允许空内容):`team_mgmt_create_new_file({ path, content })` 或 `team_mgmt_create_new_file({ path, pad_id, pad_range })`
|
|
30
|
+
- 小改动(行号范围):`team_mgmt_file_range_edit({ path, range, content })` 或 `team_mgmt_file_range_edit({ path, range, pad_id, pad_range })`
|
|
31
|
+
- 末尾追加:`team_mgmt_file_append({ path, content, create })`
|
|
32
|
+
- 锚点插入:`team_mgmt_file_insert_after|team_mgmt_file_insert_before({ path, anchor, content, occurrence, match })`
|
|
33
|
+
- 双锚点块替换:`team_mgmt_file_block_replace({ path, start_anchor, end_anchor, content, occurrence, include_anchors, match, require_unique, strict })`
|
|
34
|
+
- 批量字面量 occurrence 替换:`team_mgmt_prepare_occurrence_replace({ path, find, content|pad_id, occurrence_indexes? })` 后接 `team_mgmt_apply_occurrence_replace({ plan_id })`;设计目的偏向多点同字面量替换,单点会成功但返回 `notice: NOT_MULTI_OCCURRENCE`。
|
|
35
35
|
- 修改完 `.minds/team.yaml`:务必运行 `team_mgmt_validate_team_cfg({})`;若输出里出现“已解决但未清理的问题”,可用 `team_mgmt_clear_problems({ source: "team", path: "team.yaml" })` 收尾。
|
|
36
36
|
- 修改完 `.minds/mcp.yaml`:务必运行 `team_mgmt_validate_mcp_cfg({})`;若输出里出现“已解决但未清理的问题”,可用 `team_mgmt_clear_problems({ source: "mcp", path: "mcp.yaml" })` 收尾。
|
|
37
37
|
|
|
38
38
|
> 可选字段默认可省略。
|
|
39
39
|
> 若你想显式传入“未指定/默认”,支持以下哨兵值写法:
|
|
40
40
|
>
|
|
41
|
-
> - `existing_hunk_id: ""`:不覆写旧规划(生成新 hunk)。
|
|
42
41
|
> - `occurrence: ""` 或 `0`:不指定 occurrence。
|
|
43
42
|
> - `match: ""`:默认 `contains`(注意:`match` 是 match mode,不是要匹配的文本/正则)。
|
|
44
43
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
- `exact`:文件与 prepare 时一致,或在原位匹配成功。
|
|
48
|
-
- `fuzz`:文件有漂移但仍能安全应用;此时输出会给出 `file_changed_since_preview` 与(planned/current)digest 便于复核。
|
|
49
|
-
- `rejected`:无法唯一定位/不安全,必须重新 prepare。
|
|
50
|
-
|
|
51
|
-
## 两步模板(复制即用)
|
|
52
|
-
|
|
53
|
-
1. Prepare:
|
|
44
|
+
## 直接行号范围编辑模板(复制即用)
|
|
54
45
|
|
|
55
46
|
```text
|
|
56
|
-
按以下参数调用函数工具 `
|
|
47
|
+
按以下参数调用函数工具 `team_mgmt_file_range_edit`:
|
|
57
48
|
{ "path": "team.yaml", "range": "10~12", "content": "..." }
|
|
58
49
|
```
|
|
59
50
|
|
|
60
|
-
2. Apply(必须单独一轮):
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
按以下参数调用函数工具 `team_mgmt_apply_file_modification`:
|
|
64
|
-
{ "hunk_id": "<hunk_id>" }
|
|
65
|
-
```
|
|
66
|
-
|
|
67
51
|
## 创建空文件示例
|
|
68
52
|
|
|
69
53
|
```text
|
|
@@ -12,33 +12,26 @@
|
|
|
12
12
|
|
|
13
13
|
## Error Classification
|
|
14
14
|
|
|
15
|
-
| Stage
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| apply | `APPLY_REJECTED_*` | Apply-time safety check rejected hunk | Read the rejection suffix and re-run prepare with stronger context |
|
|
36
|
-
| write | `ACCESS_DENIED` | Reserved rtws path is hard-denied | Use the dedicated tool/path listed in the error message |
|
|
37
|
-
| write | `FILE_EXISTS` | File already exists (create_new_file) | Use different path or delete existing file first |
|
|
38
|
-
| write | `NOT_A_FILE` | Target path exists but is not a file | Choose a different path or remove the non-file entry first |
|
|
39
|
-
| write | `STATS_MISMATCH` | Whole-file overwrite snapshot mismatches | Re-read the file and retry with the latest snapshot |
|
|
40
|
-
| write | `SUSPICIOUS_DIFF` | Diff/patch-looking content is undeclared | Declare `content_format`, or use prepare/apply tools |
|
|
41
|
-
| write | `FAILED` | Filesystem or runtime failure | Inspect the error text and fix the underlying condition |
|
|
15
|
+
| Stage | Error Code | Description | Solution |
|
|
16
|
+
| ------ | ---------------------------- | ---------------------------------------- | ------------------------------------------------------------------ |
|
|
17
|
+
| direct | `PATH_REQUIRED` | File path is missing | Provide a non-empty relative file path |
|
|
18
|
+
| direct | `INVALID_ARGS` | Tool arguments are invalid | Fix the argument shape shown in the error message |
|
|
19
|
+
| direct | `INVALID_PATH` | Path is outside rtws or otherwise bad | Use a normalized relative path inside rtws |
|
|
20
|
+
| direct | `INVALID_FORMAT` | Modification format is invalid | Use the documented format for the selected tool |
|
|
21
|
+
| direct | `FILE_NOT_FOUND` | File does not exist | Use `create=true` for append, or create/read the file first |
|
|
22
|
+
| direct | `CONTENT_REQUIRED` | Content empty but tool requires content | Provide `content` or `pad_id/pad_range` for the edit |
|
|
23
|
+
| direct | `ANCHOR_NOT_FOUND` | Anchor line not found | Check anchor text correctness, or use `ripgrep_snippets` to locate |
|
|
24
|
+
| direct | `ANCHOR_AMBIGUOUS` | Anchor has multiple matches | Specify `occurrence` parameter to identify which match |
|
|
25
|
+
| direct | `OCCURRENCE_OUT_OF_RANGE` | occurrence out of range | Check if occurrence value is within `1~candidates_count` range |
|
|
26
|
+
| direct | `OCCURRENCE_NOT_FOUND` | Literal text has no matches | Re-check `find` with `ripgrep_fixed` or inspect the file |
|
|
27
|
+
| apply | `FILE_CHANGED_SINCE_PREPARE` | Occurrence plan target file drifted | Re-read and re-run `prepare_occurrence_replace` |
|
|
28
|
+
| apply | `PLAN_NOT_FOUND` | Occurrence plan expired/applied/missing | Re-run `prepare_occurrence_replace` |
|
|
29
|
+
| write | `ACCESS_DENIED` | Reserved rtws path is hard-denied | Use the dedicated tool/path listed in the error message |
|
|
30
|
+
| write | `FILE_EXISTS` | File already exists (create_new_file) | Use different path or delete existing file first |
|
|
31
|
+
| write | `NOT_A_FILE` | Target path exists but is not a file | Choose a different path or remove the non-file entry first |
|
|
32
|
+
| write | `STATS_MISMATCH` | Whole-file overwrite snapshot mismatches | Re-read the file and retry with the latest snapshot |
|
|
33
|
+
| write | `SUSPICIOUS_DIFF` | Diff/patch-looking content is undeclared | Declare `content_format`, or use a direct edit tool |
|
|
34
|
+
| write | `FAILED` | Filesystem or runtime failure | Inspect the error text and fix the underlying condition |
|
|
42
35
|
|
|
43
36
|
## Common Error Scenarios & Troubleshooting
|
|
44
37
|
|
|
@@ -61,23 +54,33 @@
|
|
|
61
54
|
- Cause: Specified occurrence greater than actual match count
|
|
62
55
|
- Solution: Change occurrence value to a valid range number
|
|
63
56
|
|
|
64
|
-
###
|
|
57
|
+
### Successful Notices
|
|
65
58
|
|
|
66
|
-
**
|
|
59
|
+
**NOT_MULTI_OCCURRENCE**
|
|
67
60
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- Solution: Re-run prepare to generate new hunk
|
|
61
|
+
- Meaning: `prepare_occurrence_replace` selected only one occurrence; the tool still creates a valid plan
|
|
62
|
+
- Recommendation: use `file_range_edit` or `file_block_replace` for one-off edits; use `prepare_occurrence_replace` for multi-point same-literal replacement
|
|
71
63
|
|
|
72
|
-
**
|
|
64
|
+
**PAD_INTENT_MISSING**
|
|
73
65
|
|
|
74
|
-
-
|
|
75
|
-
-
|
|
66
|
+
- Meaning: the pad tool succeeded, but the current pad has no `intent` metadata
|
|
67
|
+
- Recommendation: add `intent` with `pad_write` / `pad_load_file_range` / `pad_copy` / `pad_move`, and preferably add `completion` / `source_note` so later model turns and the human UI understand why the pad exists and when to delete it
|
|
76
68
|
|
|
77
|
-
|
|
69
|
+
### 2. Direct Edit Drift Errors
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
Direct edits write immediately unless `preview: true` is set. If a direct edit fails because anchors or line ranges no longer match your intent, re-read the current file, tighten the range/anchors, and retry with `preview: true, show_diff: true` if review is needed.
|
|
72
|
+
|
|
73
|
+
### 2.1 Occurrence Plan Drift Errors
|
|
74
|
+
|
|
75
|
+
**FILE_CHANGED_SINCE_PREPARE**
|
|
76
|
+
|
|
77
|
+
- Cause: `apply_occurrence_replace` was called after the target file changed
|
|
78
|
+
- Solution: Re-read the file, re-run `prepare_occurrence_replace`, then apply the fresh plan
|
|
79
|
+
|
|
80
|
+
**PLAN_NOT_FOUND**
|
|
81
|
+
|
|
82
|
+
- Cause: Plan expired, was already applied, or the process restarted
|
|
83
|
+
- Solution: Re-run `prepare_occurrence_replace`
|
|
81
84
|
|
|
82
85
|
### 3. Content Format Errors
|
|
83
86
|
|
|
@@ -85,8 +88,8 @@
|
|
|
85
88
|
|
|
86
89
|
- Cause: Using `overwrite_entire_file`, body looks like diff/patch format but not declared
|
|
87
90
|
- Solution:
|
|
88
|
-
- Option 1:
|
|
89
|
-
- Option 2:
|
|
91
|
+
- Option 1: If you really want to store diff/patch text literally, declare `content_format: "diff"` or `content_format: "patch"`
|
|
92
|
+
- Option 2: If you only want to review an edit, use `preview: true, show_diff: true` on the direct tool
|
|
90
93
|
|
|
91
94
|
**STATS_MISMATCH**
|
|
92
95
|
|
|
@@ -121,12 +124,12 @@
|
|
|
121
124
|
|
|
122
125
|
## Error Prevention Tips
|
|
123
126
|
|
|
124
|
-
1. **
|
|
127
|
+
1. **Avoid dependent parallel writes**: Same-file writes are serialized internally, but multiple tool calls in one generation cannot see each other's outputs; read again before a dependent follow-up edit
|
|
125
128
|
|
|
126
129
|
2. **Read before write**: Call `read_file` first to get old file snapshot before using `overwrite_entire_file`
|
|
127
130
|
|
|
128
131
|
3. **Use unique anchors**: Avoid using too generic text as anchors; use `occurrence` to be explicit when needed
|
|
129
132
|
|
|
130
|
-
4. **
|
|
133
|
+
4. **Use preview deliberately**: Set `preview: true, show_diff: true` only when you need review output; otherwise direct tools write immediately
|
|
131
134
|
|
|
132
135
|
5. **Check output fields**: Especially `normalized.*` fields to confirm write behavior is as expected
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
|
|
25
25
|
- <When to use this vs a sibling toolset>
|
|
26
26
|
|
|
27
|
-
ws_mod is Dominds' text editing toolset, using **
|
|
27
|
+
ws_mod is Dominds' text editing toolset, using **direct edit + pad source** architecture:
|
|
28
28
|
|
|
29
|
-
- **
|
|
30
|
-
- **single
|
|
31
|
-
- **
|
|
29
|
+
- **direct range edit**: precise line ranges should use one-step `file_range_edit`
|
|
30
|
+
- **direct single-block edit**: EOF appends, anchor insertions, and block replacements use `file_append`, `file_insert_*`, and `file_block_replace`
|
|
31
|
+
- **preview as display option**: set `preview/show_diff` when review output is needed
|
|
32
32
|
- **Legacy tools removed**: `append_file` / `insert_after` / `insert_before` / `replace_block` / `apply_block_replace` are completely removed
|
|
33
33
|
|
|
34
34
|
## Quick Navigation
|
|
35
35
|
|
|
36
|
-
| Topic | Description
|
|
37
|
-
| ----------------------------- |
|
|
38
|
-
| [principles](./principles.md) | Core concepts, workflow, concurrency constraints,
|
|
39
|
-
| [tools](./tools.md) | Usage guidance, editing boundaries, and workflow notes
|
|
40
|
-
| [scenarios](./scenarios.md) | Common usage scenarios (copy-paste ready)
|
|
41
|
-
| [errors](./errors.md) | Error codes and solutions
|
|
36
|
+
| Topic | Description |
|
|
37
|
+
| ----------------------------- | ------------------------------------------------------------------ |
|
|
38
|
+
| [principles](./principles.md) | Core concepts, workflow, concurrency constraints, preview behavior |
|
|
39
|
+
| [tools](./tools.md) | Usage guidance, editing boundaries, and workflow notes |
|
|
40
|
+
| [scenarios](./scenarios.md) | Common usage scenarios (copy-paste ready) |
|
|
41
|
+
| [errors](./errors.md) | Error codes and solutions |
|
|
42
42
|
|
|
43
43
|
## Status
|
|
44
44
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
- <Toolset-specific terms>
|
|
25
25
|
|
|
26
|
-
## 1. Background: Why
|
|
26
|
+
## 1. Background: Why direct edit + pad source
|
|
27
27
|
|
|
28
28
|
Historically, text editing tools had multiple mental models ("direct write" vs "plan first then apply"), causing:
|
|
29
29
|
|
|
@@ -31,26 +31,28 @@ Historically, text editing tools had multiple mental models ("direct write" vs "
|
|
|
31
31
|
- Race condition between prepare→apply: tool calls in one message execute in parallel, potentially "prepare based on old file, but another tool already wrote"
|
|
32
32
|
- Split apply entrypoints: high learning cost, high regression cost
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
The first prepare-first + single apply version improved reviewability, but made precise line-range and large-text edits too slow. The current model is:
|
|
35
35
|
|
|
36
|
-
- **
|
|
37
|
-
- **single
|
|
38
|
-
- **
|
|
36
|
+
- **direct range edit**: precise line ranges use `file_range_edit` directly; it defaults to YAML-only/redacted output
|
|
37
|
+
- **direct single-block edit**: EOF appends, anchor insertions, and anchor-delimited block replacements use `file_append`, `file_insert_after` / `file_insert_before`, and `file_block_replace`
|
|
38
|
+
- **batch occurrence replace**: for multi-point same-literal replacement, prefer `prepare_occurrence_replace` followed by `apply_occurrence_replace`; single-occurrence plans still succeed but return `notice: NOT_MULTI_OCCURRENCE`
|
|
39
|
+
- **preview as display option**: set `preview/show_diff` when review output is needed; otherwise direct tools write immediately
|
|
39
40
|
- **Legacy tools removed**: `append_file` / `insert_after` / `insert_before` / `replace_block` / `apply_block_replace` are completely removed (no aliases, no compat layer)
|
|
40
41
|
|
|
41
42
|
## 2. Goals & Non-Goals
|
|
42
43
|
|
|
43
44
|
### 2.1 Goals
|
|
44
45
|
|
|
45
|
-
- Unify
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
- Provide
|
|
46
|
+
- Unify precise line-range edits to: `file_range_edit`
|
|
47
|
+
- Unify single-block append/insert/block replacement to direct `file_*` tools
|
|
48
|
+
- Keep prepare/apply centered on multi-occurrence literal batch replacement
|
|
49
|
+
- Provide reviewable output: direct tools default to YAML-only; explicit `preview/show_diff` emits diff
|
|
50
|
+
- Clarify concurrency/ordering constraints: same-file writes are serialized in-process
|
|
51
|
+
- Provide stable failure modes and next-step suggestions (especially anchor ambiguity)
|
|
49
52
|
|
|
50
53
|
### 2.2 Non-Goals
|
|
51
54
|
|
|
52
55
|
- No complex patch DSL (still based on unified diff)
|
|
53
|
-
- No cross-process/restart hunk persistence (current hunk registry is in-memory + TTL=1h)
|
|
54
56
|
- No "auto-formatting/auto-blank-line alignment"; only observable (style_warning) and minimal necessary normalization (EOF newline)
|
|
55
57
|
|
|
56
58
|
## 3. Key Concurrency Constraints & Ordering
|
|
@@ -59,37 +61,28 @@ Therefore unified to:
|
|
|
59
61
|
|
|
60
62
|
Multiple function tool calls in one message execute in parallel, unable to see each other's outputs/writes. Therefore:
|
|
61
63
|
|
|
62
|
-
-
|
|
64
|
+
- Use `file_range_edit` for precise line ranges; use the matching direct `file_*` tool for appends, anchor insertions, and block replacements.
|
|
65
|
+
- Prefer `prepare_occurrence_replace` when replacing multiple occurrences of the same literal in one file; apply the returned plan in a later call. Single-occurrence use also succeeds, but if you see `notice: NOT_MULTI_OCCURRENCE`, `file_range_edit` or `file_block_replace` is usually clearer.
|
|
66
|
+
- Set `preview/show_diff` when review output is needed.
|
|
63
67
|
|
|
64
|
-
### 3.2
|
|
68
|
+
### 3.2 Write Concurrency Safety (current implementation)
|
|
65
69
|
|
|
66
|
-
- Multiple
|
|
67
|
-
-
|
|
70
|
+
- Multiple direct writes on the same file are serialized in-process
|
|
71
|
+
- Writes on different files can run in parallel, no shared lock
|
|
68
72
|
|
|
69
|
-
## 4.
|
|
73
|
+
## 4. Scratch Pad Mental Model
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
Scratch Pad is a current-task temporary workbench for large text. It is not long-term memory and not a multi-document management system. Prefer one current pad by default; create multiple pads only when you need to compare a few candidate bodies.
|
|
72
76
|
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
- `
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- Whether current member has write permission (`hasWriteAccess`)
|
|
79
|
-
|
|
80
|
-
### 4.2 "Overwrite Same Plan" Rules (important)
|
|
81
|
-
|
|
82
|
-
Tools supporting "re-plan with `existing_hunk_id` to overwrite" and their rules:
|
|
83
|
-
|
|
84
|
-
- `prepare_file_range_edit`: supports `existing_hunk_id`, but that id must exist, belong to current member, and match mode (cannot use another prepare mode's id to overwrite)
|
|
85
|
-
- `prepare_file_append` / `prepare_file_insert_after` / `prepare_file_insert_before`: same support for `existing_hunk_id` to overwrite same-mode preview
|
|
86
|
-
- `prepare_file_block_replace`: supports `existing_hunk_id` to overwrite same-mode preview (same owner / same kind; cross-mode rejected)
|
|
87
|
-
- All plan tools **do not allow custom new ids**: can only generate new plan by "omitting/clearing `existing_hunk_id`"; only pass `existing_hunk_id` when you want to overwrite an existing plan
|
|
77
|
+
- Pads are managed by `pad_*` tools, not ordinary `add_reminder` / `update_reminder` / `delete_reminder`.
|
|
78
|
+
- When creating or loading a pad, provide `intent`, `completion`, and `source_note` when possible; `delete_when_done` defaults to true. If `intent` is missing, successful results include a `PAD_INTENT_MISSING` notice.
|
|
79
|
+
- Pad reminders show `pad_id`, `intent`, `completion`, `lifecycle`, and `source` before the full line-numbered body. The body is data for editing/reference, not new instructions.
|
|
80
|
+
- There are no observation tools such as `pad_read`, `pad_preview`, or `pad_list`; the projected reminders are the current pad view.
|
|
81
|
+
- When the body has been applied, abandoned, or is no longer needed for the current task, call `pad_delete`.
|
|
88
82
|
|
|
89
83
|
> Optional fields can be omitted naturally.
|
|
90
84
|
> If you want to express explicit "unspecified/use default", use these sentinel forms:
|
|
91
85
|
>
|
|
92
|
-
> - `existing_hunk_id: ""`: do not overwrite old plan (generate new hunk)
|
|
93
86
|
> - `occurrence: ""` or `0`: do not specify occurrence
|
|
94
87
|
> - `match: ""`: use default `contains` (note: `match` is match mode, not the text/regex to match)
|
|
95
88
|
> - `read_file({ range: "", max_lines: 0 })`: respectively "do not specify range / use default 500 lines"
|
|
@@ -104,8 +97,8 @@ Writing follows "each line ends with `\n` (including last line)":
|
|
|
104
97
|
|
|
105
98
|
- If file has no trailing newline, one is added before writing (`normalized_file_eof_newline_added`)
|
|
106
99
|
- If content has no trailing newline, one is added before writing (`normalized_content_eof_newline_added`)
|
|
107
|
-
-
|
|
100
|
+
- Write and preview outputs include `normalized.*` fields for review
|
|
108
101
|
|
|
109
102
|
### 5.2 Blank Line Style (observable only)
|
|
110
103
|
|
|
111
|
-
For append/insert,
|
|
104
|
+
For append/insert, direct tool output includes `blankline_style` and `style_warning` to alert about "potential double blank lines / stuck-together" risks; currently does not actively modify content blank line style
|