dsh-seal-scripts 0.5.2 → 0.6.1
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 +220 -167
- package/README.md +214 -186
- package/lib/client.js +322 -17
- package/lib/core/index.js +11 -1
- package/lib/host/capabilities.js +4 -0
- package/lib/host/compact-delete.js +188 -24
- package/lib/host/delete.js +32 -4
- package/lib/host/import-session.js +498 -0
- package/lib/host/routes/sessions.js +47 -1
- package/package.json +4 -3
package/README.en.md
CHANGED
|
@@ -7,326 +7,379 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-seal-scripts)
|
|
8
8
|
[](./LICENSE)
|
|
9
9
|
[](https://nodejs.org)
|
|
10
|
-
[](https://github.com/deepseek-ai/dsh)
|
|
11
11
|
[](./package.json)
|
|
12
12
|
|
|
13
|
-
**Sealed scripts
|
|
13
|
+
**Sealed scripts**: a chain that just worked is sealed into a tool script — a directory, a manifest entry, one line in the system prompt; next time it runs with a single sentence.
|
|
14
14
|
|
|
15
|
-
**Reviews
|
|
15
|
+
**Reviews**: when DSH compacts the context, the shadowed transcript is written to a review file, decays by calendar day and is injected back; the model can read the original from a clue. Reviews are also the raw material for sealing across sessions.
|
|
16
16
|
|
|
17
17
|
## Contents
|
|
18
18
|
|
|
19
|
-
- [Features](#features)
|
|
20
|
-
- [Install](#install)
|
|
21
|
-
- [Quick start](#
|
|
22
|
-
- [Sealed scripts](#
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
- [Data and backup](#data
|
|
27
|
-
- [Compatibility](#
|
|
28
|
-
- [Known limitations](#
|
|
29
|
-
- [Development](#
|
|
19
|
+
- [Features](#sec-features)
|
|
20
|
+
- [Install](#sec-install)
|
|
21
|
+
- [Quick start](#sec-quickstart)
|
|
22
|
+
- [Sealed scripts](#sec-tools)
|
|
23
|
+
- [Session management](#sec-sessions)
|
|
24
|
+
- [Reviews](#sec-reviews)
|
|
25
|
+
- [Configuration and settings page](#sec-config)
|
|
26
|
+
- [Data and backup](#sec-data)
|
|
27
|
+
- [Compatibility and degradation](#sec-compat)
|
|
28
|
+
- [Known limitations](#sec-limits)
|
|
29
|
+
- [Development](#sec-dev)
|
|
30
|
+
|
|
31
|
+
<a name="sec-features"></a>
|
|
30
32
|
|
|
31
33
|
## Features
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
#### Sealed scripts
|
|
36
|
+
|
|
37
|
+
- **One chain → one tool script**: full script text, entry, args, steps, provenance, per-file sha256.
|
|
38
|
+
- **In the system prompt**: the toolSequence block lists every sealed tool, one line each.
|
|
39
|
+
- **Runs as written**: args as an argv array, never through a shell; interpreter chosen by the run field.
|
|
40
|
+
- **Verifiable**: sha256 compared before running; a hand-edited script is refused unless explicitly allowed.
|
|
41
|
+
- **Portable**: store-only zip; import previews first, index rebuilt from the files on disk.
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
- **Present in the system prompt**: the tool list sits at the end of the prompt every turn (up to 24 entries), so the model knows what it can run.
|
|
37
|
-
- **Runs as written**: arguments travel as an argv array and never pass through a shell; the interpreter comes from the run field (bash / node / powershell / cmd).
|
|
38
|
-
- **Verifiable**: per-file sha256 is compared before running; a hand-edited script is refused unless you explicitly allow it.
|
|
39
|
-
- **Portable**: the whole set packs into a store-only zip; import previews before writing and rebuilds the index from the files on disk.
|
|
43
|
+
#### Context reviews
|
|
40
44
|
|
|
41
|
-
**
|
|
45
|
+
- **Captured on compaction**: no model call; tool calls and arguments kept verbatim.
|
|
46
|
+
- **Four-level decay**: original → summary → diary → keywords; a read bumps and pins the level.
|
|
47
|
+
- **Cross-workspace search**: workspace → children → siblings → parents; outer rings need permission.
|
|
48
|
+
- **Diary nudges**: asked once when the diary or keywords are empty.
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
- **Four-level decay**: today original → next-day summary → diary → keyword index; reading it bumps one level and pins it.
|
|
45
|
-
- **Cross-workspace search**: this workspace → children → siblings → parents; outer rings need explicit permission.
|
|
46
|
-
- **Diary nudges**: while keywords or the diary are still empty the model is asked to finish them in one call; the nudge disappears once they are written.
|
|
50
|
+
#### Engineering
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
- Zero runtime dependencies, Node built-ins only; UI and injected text follow DSH's 8 languages, model-facing errors and receipts are English.
|
|
53
|
+
- A missing host capability disables that block only.
|
|
54
|
+
- Plain-text data: copy `session-memory/` for a backup.
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
- A missing host capability disables that block only — no crash, no blank settings page.
|
|
52
|
-
- Plain-text data: copy `session-memory/` and you have a backup.
|
|
56
|
+
<a name="sec-install"></a>
|
|
53
57
|
|
|
54
58
|
## Install
|
|
55
59
|
|
|
56
|
-
Add the package in the
|
|
60
|
+
Add the package in the plugin manager (package name, local path, tarball, or Git URL). `--profile` is required, e.g. `web`:
|
|
57
61
|
|
|
58
62
|
~~~bash
|
|
59
|
-
# --profile is required (otherwise: required option "--profile" not specified)
|
|
60
63
|
dsh plugin --profile web add dsh-seal-scripts
|
|
61
|
-
|
|
62
|
-
# local directory: pnpm records it as a link dependency in that profile
|
|
63
64
|
dsh plugin --profile web add /path/to/dsh-seal-scripts
|
|
64
65
|
~~~
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
The second line is a local directory, registered as a link dependency. Restart the profile to load it.
|
|
67
68
|
|
|
68
|
-
Requirements:
|
|
69
|
-
|
|
70
|
-
- host `@deepseek-ai/dsh` `>=0.2.1-rc.2`, `<1.0.0` (peer dependency, not forced)
|
|
71
|
-
- Node `>=18` (without native zstd the built-in decoder takes over; functionality is unchanged)
|
|
69
|
+
Requirements: host `@deepseek-ai/dsh` `>=0.2.2-rc.1`, `<1.0.0` (peer, not forced); Node `>=18`.
|
|
72
70
|
|
|
73
71
|
After the restart, Settings shows **Tool (script) manager**.
|
|
74
72
|
|
|
73
|
+
<a name="sec-quickstart"></a>
|
|
74
|
+
|
|
75
75
|
## Quick start
|
|
76
76
|
|
|
77
|
-
1. **
|
|
78
|
-
2. **Run a chain end to end
|
|
77
|
+
1. **Master switch**: Settings → Tool (script) manager → Options → turn on **Auto review** (off by default; nothing is created while off).
|
|
78
|
+
2. **Run a chain end to end**.
|
|
79
79
|
3. **Seal it**: ask the model to turn the steps above into a tool.
|
|
80
|
-
4. **Reuse it**:
|
|
81
|
-
|
|
82
|
-
A sample session (output is illustrative):
|
|
80
|
+
4. **Reuse it**: "run <id>"; add "show me the commands first, do not run" to preview.
|
|
83
81
|
|
|
84
82
|
~~~text
|
|
85
83
|
You: turn that packaging flow into a tool
|
|
86
|
-
Model: (
|
|
87
|
-
entry pack.sh, params source_dir out_dir
|
|
84
|
+
Model: (session_tool_create_write) installed dsh-plugin-pack at .../toolSequence/dsh-plugin-pack
|
|
85
|
+
entry pack.sh, params source_dir out_dir
|
|
88
86
|
|
|
89
87
|
(new session)
|
|
90
|
-
You: run dsh-plugin-pack, the source dir is /sdcard/Download/
|
|
91
|
-
Model: (
|
|
88
|
+
You: run dsh-plugin-pack, the source dir is /sdcard/Download/my-src
|
|
89
|
+
Model: (session_tool_call) exit 0, N files, sha256 matches the manifest
|
|
92
90
|
~~~
|
|
93
91
|
|
|
92
|
+
<a name="sec-tools"></a>
|
|
93
|
+
|
|
94
94
|
## Sealed scripts
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
#### Why this is not a note
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
A note cannot run, and rebuilding commands on the spot differs every time. What gets stored is the script itself: the lines that worked, byte for byte, argument order included.
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
#### How to trigger it
|
|
101
101
|
|
|
102
102
|
| What you say | What happens | When to use |
|
|
103
103
|
|---|---|---|
|
|
104
104
|
| turn the steps above into a tool | seals the steps that just ran | same session, commands still in context |
|
|
105
|
-
| turn the workflow from an earlier session into a tool | reads review originals first with `session_tool_create_read
|
|
105
|
+
| turn the workflow from an earlier session into a tool | reads review originals first with `session_tool_create_read`, then seals | new session, new machine, old history |
|
|
106
106
|
|
|
107
|
-
The
|
|
107
|
+
The version that ran is stored, not a draft; editing after installing means re-sending the context.
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
#### What gets created
|
|
110
110
|
|
|
111
111
|
~~~
|
|
112
112
|
$DSH_HOME/session-memory/toolSequence/
|
|
113
113
|
_index.json registry: id, title, purpose, entry, args, steps, per-file sha256
|
|
114
114
|
<id>/
|
|
115
|
-
toolScript.json manifest: full script text, docs, hashes, provenance
|
|
115
|
+
toolScript.json manifest: full script text, docs, hashes, provenance
|
|
116
116
|
<script> the file that actually runs (.sh / .js .mjs .cjs / .ps1 / .bat .cmd)
|
|
117
|
-
README.md generated from the manifest
|
|
118
|
-
<notes>.md read-only notes
|
|
119
|
-
_runs/ full stdout/stderr log of every run
|
|
117
|
+
README.md generated from the manifest
|
|
118
|
+
<notes>.md read-only notes (never executed)
|
|
119
|
+
_runs/ full stdout/stderr log of every run
|
|
120
120
|
<id>.bak-<timestamp>/ previous directory kept on reinstall or import
|
|
121
121
|
~~~
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
#### How the model learns about it
|
|
124
124
|
|
|
125
|
-
The
|
|
126
|
-
|
|
127
|
-
When that list refreshes (option **When the list is refreshed**):
|
|
125
|
+
The system prompt gains a toolSequence block, one line each: `· id (title): purpose|entry <entry>|args <p1> <p2>`. No entry or character cap; purpose shown in full.
|
|
128
126
|
|
|
129
127
|
| Mode | Behaviour | Cost |
|
|
130
128
|
|---|---|---|
|
|
131
|
-
| Before a new session (default) | computed
|
|
132
|
-
| Live per session | computed every turn | one cache miss on the next message
|
|
129
|
+
| Before a new session (default) | computed at the first assembly, fixed until the session ends | installing or removing a tool mid-session leaves the prompt unchanged |
|
|
130
|
+
| Live per session | computed every turn | one cache miss on the next message |
|
|
133
131
|
|
|
134
|
-
Changing
|
|
132
|
+
Changing the mode refreshes every remembered session immediately.
|
|
135
133
|
|
|
136
|
-
|
|
134
|
+
#### The three tools
|
|
137
135
|
|
|
138
136
|
| Tool | Purpose | Key arguments |
|
|
139
137
|
|---|---|---|
|
|
140
138
|
| `session_tool_create_write` | seal a chain | `toolScript{ id, title, purpose, entry, scripts[], docs[], params, steps, timeoutMs }`; `replace` overwrites |
|
|
141
|
-
| `session_tool_create_read` | read review originals
|
|
139
|
+
| `session_tool_create_read` | read review originals, read-only | `file` or `date`+`nth`; `mode` = outline / raw / block; `cursor`, `chars`, `line`, `span` |
|
|
142
140
|
| `session_tool_call` | run as written | `toolScript`, `step`, `args`, `stdin`, `cwd`, `dryRun`, `calls`, `stopOnError`, `allowDrift`, `timeoutMs`, `maxOutputBytes` |
|
|
143
141
|
|
|
144
|
-
-
|
|
145
|
-
- `dryRun: true
|
|
146
|
-
- `calls: []
|
|
142
|
+
- No arguments: lists every tool script.
|
|
143
|
+
- `dryRun: true`: echoes the arguments and cwd only.
|
|
144
|
+
- `calls: []`: runs in order, no count limit, reporting exit code, duration and logs per entry.
|
|
147
145
|
|
|
148
|
-
|
|
146
|
+
#### Validation when sealing
|
|
149
147
|
|
|
150
148
|
| Item | Rule |
|
|
151
149
|
|---|---|
|
|
152
|
-
| `id` | starts with a lowercase letter,
|
|
153
|
-
| file name | starts alphanumeric,
|
|
150
|
+
| `id` | starts with a lowercase letter, only `a-z0-9-`, no length limit |
|
|
151
|
+
| file name | starts alphanumeric, letters, digits and . _ - only, no paths, no leading dot |
|
|
154
152
|
| `run` vs extension | bash→`.sh`; node→`.js/.mjs/.cjs`; ps1→`.ps1`; cmd→`.bat/.cmd` |
|
|
155
|
-
| size | no cap
|
|
156
|
-
| `title` / `purpose` | non-empty; any length
|
|
157
|
-
| `entry` / `steps` | must name files in `scripts`; entry defaults to the first
|
|
158
|
-
| `timeoutMs` | any positive ms, clamped
|
|
159
|
-
| docs | must be `.md`,
|
|
160
|
-
| script body | non-empty; must not contain `<!--ovr:`
|
|
153
|
+
| size | no cap |
|
|
154
|
+
| `title` / `purpose` | non-empty; any length |
|
|
155
|
+
| `entry` / `steps` | must name files in `scripts`; entry defaults to the first |
|
|
156
|
+
| `timeoutMs` | any positive ms, clamped to the host maxTimeoutMs, defaults to the host timeoutMs |
|
|
157
|
+
| docs | must be `.md`, not `README.md`, no duplicates |
|
|
158
|
+
| script body | non-empty; must not contain `<!--ovr:` |
|
|
161
159
|
| same id exists | refused without `replace`; the error quotes the first 12 hex chars of the manifest sha256 |
|
|
162
160
|
|
|
163
|
-
`steps` only declares
|
|
161
|
+
`steps` only declares order and never chains; `params` only declares argv order and names are not validated.
|
|
164
162
|
|
|
165
|
-
|
|
163
|
+
#### Execution semantics
|
|
166
164
|
|
|
167
165
|
| Item | Value |
|
|
168
166
|
|---|---|
|
|
169
|
-
| interpreter | bash
|
|
170
|
-
| argv | interpreter
|
|
171
|
-
| cwd | `workspace
|
|
167
|
+
| interpreter | bash; node uses `process.execPath`; ps1 uses Windows PowerShell (`pwsh` elsewhere); cmd uses `%ComSpec% /d /c` (falls back to `sh` off Windows) |
|
|
168
|
+
| argv | interpreter args + absolute script path + args, as an array, never through a shell |
|
|
169
|
+
| cwd | `workspace`, `toolScript`, or an absolute path inside either |
|
|
172
170
|
| environment | inherits `process.env`, plus `TOOL_NAME`, `TOOL_SCRIPT`, `TOOL_ROOT`, `DSH_HOME` |
|
|
173
|
-
| timeout | follows the DSH terminal settings (120 s default, capped by
|
|
174
|
-
| output |
|
|
175
|
-
| result | `{ exitCode, signal, timedOut, stdout, stderr, truncated, spill }
|
|
176
|
-
| argument count | more
|
|
177
|
-
| drift | sha256
|
|
178
|
-
| containment | only files inside the
|
|
171
|
+
| timeout | follows the DSH terminal settings (120 s default, capped by maxTimeoutMs); on expiry it moves to the background and the reply carries pid and the log path; explicit stop: SIGTERM → 2 s → SIGKILL; process group on POSIX, `taskkill /T /F` on Windows |
|
|
172
|
+
| output | DSH maxOutputBytes; every run written to `_runs/` and the reply carries the file path |
|
|
173
|
+
| result | `{ exitCode, signal, timedOut, background, pid, logFile, stdout, stderr, truncated, spill }` |
|
|
174
|
+
| argument count | more than `params` declares fails before running; fewer is fine |
|
|
175
|
+
| drift | sha256 compared first; mismatch refuses, `allowDrift: true` allows it and marks `drift` |
|
|
176
|
+
| containment | only files inside the script directory run; unknown script names refused |
|
|
177
|
+
|
|
178
|
+
#### Import / export
|
|
179
|
+
|
|
180
|
+
- **Export**: Sealed tools tab → Export. Packs `toolSequence.zip` (store) into the session workspace and returns the path — no browser download.
|
|
181
|
+
- **Import**: pick a zip → `dryRun` preview → confirm to write; an existing directory is kept as `.bak-<timestamp>`.
|
|
182
|
+
- `_index.json` in the package is not trusted; the index is rebuilt from disk. `_runs`, backups, escaping paths and invalid ids are skipped.
|
|
183
|
+
- No size cap; the zip-bomb guard compares extracted bytes + 16 MB against free disk space. zip64 and encrypted archives are not supported.
|
|
184
|
+
|
|
185
|
+
#### Clear cache
|
|
186
|
+
|
|
187
|
+
Two clicks (the first only changes the button label):
|
|
188
|
+
|
|
189
|
+
- **Deleted**: `<id>.bak-<timestamp>` rollback directories, every log in `_runs/`.
|
|
190
|
+
- **Kept**: `_index.json` and every `<id>/` directory.
|
|
191
|
+
- Only "valid id + `.bak-` + digits" directories count; a staged import package is skipped.
|
|
192
|
+
- One entry that cannot be removed does not abort the run; the receipt reports counts and bytes.
|
|
193
|
+
|
|
194
|
+
<a name="sec-sessions"></a>
|
|
195
|
+
|
|
196
|
+
## Session management
|
|
197
|
+
|
|
198
|
+
The Sessions tab lists this machine's sessions grouped by workspace and manages each one: import a package, delete it, or delete it after producing a review.
|
|
199
|
+
|
|
200
|
+
#### The list
|
|
201
|
+
|
|
202
|
+
- **Grouped by workspace**: one block per workspace that has sessions, headed by the workspace path; empty workspaces take no space.
|
|
203
|
+
- **One row each**: the session title (the id in grey while a title does not exist yet), with an **Archived** badge when the session is archived.
|
|
204
|
+
- **Unreadable logs are named**: when a log cannot be decoded the list says so at the top instead of showing it as an empty session.
|
|
179
205
|
|
|
180
|
-
|
|
206
|
+
#### Import
|
|
181
207
|
|
|
182
|
-
- **
|
|
183
|
-
- **
|
|
184
|
-
-
|
|
185
|
-
-
|
|
208
|
+
- **One button**: the leftmost **Import** in the footer takes a `dsh-session-<id>.zip`; no hand-built directories. When the host cannot write zstd the button is disabled and says why.
|
|
209
|
+
- **Preview first**: the dry run says whether the id will be renamed and whether it hangs under that session as a branch; nothing is written until you confirm.
|
|
210
|
+
- **Openable immediately**: the log is packed the way DSH stores it (a one-line header frame plus a body frame) and then `attachSession` registers it; images and files land under the attachment store by sha256; the host is told the list gained a session, so the main window shows it at once, with no restart.
|
|
211
|
+
- **Collisions are not forced**: an id that already exists anywhere on this machine gets a new id and the original stays untouched; a same-workspace collision also hangs under that session as a branch (`parentSession`), another workspace gets a plain rename. A session that carries inherited history (`isSeeded:true`) records its real inherited count and still opens and branches.
|
|
212
|
+
- **Backed up first**: the workspace roster and projection cache are copied into `会话导入备份-<time>/` inside the target workspace before writing.
|
|
186
213
|
|
|
187
|
-
|
|
214
|
+
#### Delete
|
|
188
215
|
|
|
189
|
-
|
|
216
|
+
- **Two taps**: the first tap only turns the button into Confirm; the second deletes.
|
|
217
|
+
- **Live sessions are closed first**: cancel → wait idle → flush → release the write handle, then remove the directory; if it cannot be closed, the delete is refused and the log is kept.
|
|
218
|
+
- **Removed from the list**: the directory is deleted and the session is detached from its workspace, so it leaves the list at once.
|
|
219
|
+
- **Leftovers are reported**: when the engine still holds a reference, the receipt says so ("it may be remembered until restart") instead of pretending it is clean.
|
|
190
220
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
221
|
+
#### Delete + review
|
|
222
|
+
|
|
223
|
+
- **Review first, then delete**: compact, wait for the review to be split out, validate, and only then delete.
|
|
224
|
+
- **No delete on failure**: any failing step keeps the session; the worst case is "compaction succeeded, split failed, session still there", and that compaction is irreversible.
|
|
225
|
+
- **Log**: each failing step writes a line to `session-memory/_compact-delete.log`, otherwise only one English error remains.
|
|
226
|
+
- **Result**: the review it produces shows up on the Reviews tab and decays by calendar day.
|
|
227
|
+
|
|
228
|
+
<a name="sec-reviews"></a>
|
|
197
229
|
|
|
198
230
|
## Reviews and context memory
|
|
199
231
|
|
|
200
|
-
The
|
|
232
|
+
The shadowed transcript is kept as a file and can be read back when it matters.
|
|
201
233
|
|
|
202
|
-
|
|
234
|
+
#### When a review is created
|
|
203
235
|
|
|
204
|
-
- Only on **compaction**:
|
|
205
|
-
- Tool calls and
|
|
236
|
+
- Only on **compaction**: written as one review file (summary + original + empty diary).
|
|
237
|
+
- Tool calls and arguments are kept verbatim, never truncated.
|
|
206
238
|
- Spawned subagent sessions produce nothing; with Auto review off, not even detection happens.
|
|
207
|
-
- Delete + review
|
|
239
|
+
- Delete + review triggers one on purpose: compact → confirm the review landed → delete. Any failed step aborts.
|
|
240
|
+
- Compaction runs through the host command registry: the service is mounted per agent preset and isolated, so the plugin root never calls it — `/compact` is executed by the command handler.
|
|
241
|
+
- Once compaction ends, the plugin reads the newest `compaction/summary` and splits the review.
|
|
242
|
+
- Every failed step is logged to `session-memory/_compact-delete.log` (trimmed to its last 64 KB past 256 KB).
|
|
208
243
|
|
|
209
|
-
|
|
244
|
+
#### Four levels
|
|
210
245
|
|
|
211
246
|
| Day | Level | What the model sees |
|
|
212
247
|
|---|---|---|
|
|
213
|
-
| the day of compaction | 3 | the original dialogue (tool calls and errors filtered
|
|
248
|
+
| the day of compaction | 3 | the original dialogue (tool calls and errors filtered) |
|
|
214
249
|
| day 2 | 2 | the compaction summary |
|
|
215
|
-
| days 3–28 | 1 | the diary
|
|
216
|
-
| day 29 and later | 0 | keywords plus the file name
|
|
250
|
+
| days 3–28 | 1 | the diary |
|
|
251
|
+
| day 29 and later | 0 | keywords plus the file name |
|
|
217
252
|
|
|
218
|
-
|
|
253
|
+
Local calendar days. Only reading this workspace's own review bumps and pins the level (0→1, 1→2) and stops decay; child, sibling and parent reviews are read-only.
|
|
219
254
|
|
|
220
|
-
|
|
255
|
+
#### Cross-workspace search
|
|
221
256
|
|
|
222
|
-
The unit is a workspace review folder
|
|
257
|
+
The unit is a workspace review folder. Order: this workspace → children → siblings → the parent → the parent's siblings → their level-1 and level-2 children. Outer rings need `allowOuter`.
|
|
223
258
|
|
|
224
|
-
|
|
259
|
+
Hits go keywords first, then summary, then original; within a workspace they sort by level, matched terms, then compaction time.
|
|
225
260
|
|
|
226
|
-
|
|
261
|
+
#### Diary nudges
|
|
227
262
|
|
|
228
|
-
At level 1 or 0
|
|
263
|
+
At level 1 or 0, an empty diary or empty keywords trigger one nudge:
|
|
229
264
|
|
|
230
|
-
- **In context** (default): appended to the review text
|
|
231
|
-
- **In the system prompt**:
|
|
265
|
+
- **In context** (default): appended to the review text, disappears once written.
|
|
266
|
+
- **In the system prompt**: a trailing prompt section.
|
|
232
267
|
|
|
233
|
-
|
|
268
|
+
#### Injection and preview
|
|
234
269
|
|
|
235
270
|
- Reviews enter the context every turn, oldest first.
|
|
236
|
-
- The preview box
|
|
237
|
-
-
|
|
271
|
+
- The preview box runs the same assembly function as the real injection (selecting one review shows only that one).
|
|
272
|
+
- A failed assembly gives the model a diagnostic (how many, total size, largest file) instead of silently showing no reviews.
|
|
238
273
|
|
|
239
|
-
|
|
274
|
+
#### The two review tools
|
|
240
275
|
|
|
241
|
-
|
|
276
|
+
Installed only while Auto review is on.
|
|
242
277
|
|
|
243
278
|
| Tool | Purpose | Key arguments |
|
|
244
279
|
|---|---|---|
|
|
245
|
-
| `session_mem_read` | find a review from
|
|
246
|
-
| `session_mem_write` | read one
|
|
280
|
+
| `session_mem_read` | find a review from a clue, one hit per call | `need` (required), `skip`, `allowOuter` |
|
|
281
|
+
| `session_mem_write` | read one original; write keywords and diary, in batch | `file` or `date`+`nth`; `keywords`, `diary`; `writes[]` |
|
|
282
|
+
|
|
283
|
+
- Locator only = the Original section: dialogue only, tool calls stripped.
|
|
284
|
+
- Writing many uses `writes[]`; all-or-nothing.
|
|
285
|
+
- Neither tool changes depth.
|
|
286
|
+
|
|
287
|
+
#### How it relates to sealing
|
|
288
|
+
|
|
289
|
+
Reviews are the raw-material store: the model uses `session_tool_create_read` to recover commands and arguments, then `session_tool_create_write` to seal them.
|
|
247
290
|
|
|
248
|
-
|
|
249
|
-
- Writing many uses `writes[]`: all-or-nothing — one bad entry and the batch is not written.
|
|
250
|
-
- Neither tool changes depth: only a read that hits this workspace's own review raises it one level and pins it.
|
|
291
|
+
<a name="sec-config"></a>
|
|
251
292
|
|
|
252
|
-
|
|
293
|
+
## Configuration and settings page
|
|
253
294
|
|
|
254
|
-
|
|
295
|
+
There is one config file, `$DSH_HOME/session-memory/_options.json`; changes apply immediately and are shared by all workspaces. Settings → **Tool (script) manager** → **Options** edits the same file.
|
|
255
296
|
|
|
256
|
-
|
|
297
|
+
#### The four tabs
|
|
298
|
+
|
|
299
|
+
| Tab | Contents |
|
|
300
|
+
|---|---|
|
|
301
|
+
| Sealed tools (`toolList` in the English UI) | tool path, the injected prompt text, list toggle and refresh mode, import / export / clear cache |
|
|
302
|
+
| Sessions | sessions grouped by workspace; Delete, Delete + review (both confirmed) |
|
|
303
|
+
| Reviews | calendar filter, review list with depth badges, injection preview, delete one |
|
|
304
|
+
| Options | four groups: Sealed tools, Recall injection, Review content, Review depth |
|
|
257
305
|
|
|
258
|
-
|
|
306
|
+
#### Every option field
|
|
259
307
|
|
|
260
308
|
| Field | Values | Default | Meaning |
|
|
261
309
|
|---|---|---|---|
|
|
262
310
|
| `autoReviewEnabled` | bool | `false` | master switch: no reviews, no injection, no review tools when off |
|
|
263
|
-
| `injectEnabled` | bool | `true` | recall injection and diary nudges (
|
|
311
|
+
| `injectEnabled` | bool | `true` | recall injection and diary nudges (not the tool list) |
|
|
264
312
|
| `toolListEnabled` | bool | `true` | inject the toolSequence block and install/remove the three `session_tool_*` tools |
|
|
265
313
|
| `toolListRefresh` | `newSession` / `realtime` | `newSession` | when the list is recomputed |
|
|
266
|
-
| `fullLoad` | bool | `false` | keep tool calls and errors at level 3 (
|
|
267
|
-
| `reminderChannel` | `context` / `system` | `context` |
|
|
268
|
-
| `stopLowering` | bool | `false` |
|
|
269
|
-
| `loadLevel` | `follow` / 0–3 | `follow` | force a level at load time (
|
|
314
|
+
| `fullLoad` | bool | `false` | keep tool calls and errors at level 3 (full re-injection) |
|
|
315
|
+
| `reminderChannel` | `context` / `system` | `context` | where the diary nudge goes |
|
|
316
|
+
| `stopLowering` | bool | `false` | reviews keep their recorded level, no daily decay |
|
|
317
|
+
| `loadLevel` | `follow` / 0–3 | `follow` | force a level at load time (recorded depth unchanged) |
|
|
270
318
|
|
|
271
|
-
Two couplings: with Auto review off,
|
|
319
|
+
Two couplings: with Auto review off, `injectEnabled` reads as off (the stored value is untouched); with Stop lowering on, Load level falls back to follow.
|
|
272
320
|
|
|
273
|
-
|
|
321
|
+
#### UI language
|
|
274
322
|
|
|
275
|
-
|
|
323
|
+
Follows DSH: settings strings, injected review text, diary reminders and the toolSequence block all switch. A review file is written with the header and section titles of the language active **at capture time**; switching later only changes the display (all 8 spellings are accepted). Errors and receipts the tools return to the model are English.
|
|
276
324
|
|
|
277
|
-
|
|
278
|
-
|---|---|
|
|
279
|
-
| Sealed tools (shown as `toolList` in the English UI) | tool path, the prompt text about to be injected, "Inject toolSequence list" toggle and refresh mode, import / export / clear cache |
|
|
280
|
-
|
|
281
|
-
The UI language follows DSH only: every settings-page string, the review injection (preamble / heading / placeholders / body line markers), the diary reminder, and the toolSequence section all switch with it. A review file is written with the header and section titles of the language active **at capture time**; switching later only changes the display, never the file (all 8 spellings are accepted when reading). Errors and receipts the tools return to the model are English — they do not follow the UI language.
|
|
282
|
-
| Sessions | sessions grouped by workspace (title, archived badge), Delete / Delete + review, both confirmed |
|
|
283
|
-
| Reviews | calendar range filter, review list with depth badges, injection preview, delete one review |
|
|
284
|
-
| Options | four groups: Sealed tools, Recall injection, Review content, Review depth |
|
|
325
|
+
<a name="sec-data"></a>
|
|
285
326
|
|
|
286
327
|
## Data and backup
|
|
287
328
|
|
|
288
329
|
~~~
|
|
289
330
|
$DSH_HOME/session-memory/
|
|
290
331
|
_options.json options
|
|
291
|
-
_locale.json language
|
|
332
|
+
_locale.json language
|
|
292
333
|
_health.json last success/failure per workspace
|
|
334
|
+
_compact-delete.log per-step diagnostics (trimmed past 256 KB)
|
|
293
335
|
<workspace key>/
|
|
294
|
-
<stamp>-<id>.md review text (
|
|
295
|
-
<same name>.json load cache
|
|
296
|
-
_assembly.json.migrated-* leftover of the old
|
|
297
|
-
toolSequence/ tool scripts (machine level, shared
|
|
336
|
+
<stamp>-<id>.md review text (plain text, readable and searchable)
|
|
337
|
+
<same name>.json load cache (rebuilt from file time if lost)
|
|
338
|
+
_assembly.json.migrated-* leftover of the old index (never auto-deleted)
|
|
339
|
+
toolSequence/ tool scripts (machine level, shared)
|
|
298
340
|
~~~
|
|
299
341
|
|
|
300
|
-
- The workspace key uses the
|
|
342
|
+
- The workspace key uses the host `sessions/` encoding: `/` becomes `-`, non-ASCII becomes `~XXXX`.
|
|
301
343
|
- Backup: copy the whole `session-memory/`. Migration: put it at the same place on the new machine and install the same plugin.
|
|
302
|
-
- Uninstalling
|
|
344
|
+
- Uninstalling deletes no data.
|
|
345
|
+
|
|
346
|
+
<a name="sec-compat"></a>
|
|
303
347
|
|
|
304
348
|
## Compatibility and degradation
|
|
305
349
|
|
|
306
|
-
Missing host capabilities disable the matching block
|
|
350
|
+
Missing host capabilities disable the matching block only (the settings page lists what is missing):
|
|
307
351
|
|
|
308
352
|
| Missing | Effect |
|
|
309
353
|
|---|---|
|
|
310
354
|
| `systemPrompt.context` | recall injection off |
|
|
311
355
|
| `systemPrompt.section` | diary nudge section and toolSequence block do not appear |
|
|
312
356
|
| `tools.register` | none of the five tools is installed |
|
|
313
|
-
| `webServer.register` |
|
|
314
|
-
| `agents.create` / `resume` |
|
|
357
|
+
| `webServer.register` | settings endpoints not installed |
|
|
358
|
+
| `agents.create` / `resume` | deleting a live session falls back to tier 2 (plugin-built teardown) |
|
|
359
|
+
| `commands.execute`, or `command-compact` not mounted | Delete + review is unavailable; plain delete still works |
|
|
360
|
+
|
|
361
|
+
Two tiers for deleting a live session: (1) the `dispose` returned by `agents.create` / `resume`, captured by the lifecycle hook; (2) no handle — the plugin builds its own `cancel({kind:'disposed'})` → `whenIdle()` → `scope.dispose()`. Tier 2 only stops the agent; unregistering belongs to the host closure with no public API, so the delete succeeds with a `warnings` entry (the settings page says the engine may still remember it until restart).
|
|
315
362
|
|
|
316
|
-
Session logs are multi-frame zstd
|
|
363
|
+
Session logs are multi-frame zstd, split by frame header; without native `zlib.zstdDecompressSync` the built-in decoder takes over.
|
|
364
|
+
|
|
365
|
+
<a name="sec-limits"></a>
|
|
317
366
|
|
|
318
367
|
## Known limitations
|
|
319
368
|
|
|
320
|
-
- Tool scripts have **no delete or edit in the UI**:
|
|
321
|
-
- `steps`
|
|
322
|
-
- Reviews are created on compaction only; the Reviews tab has
|
|
369
|
+
- Tool scripts have **no delete or edit in the UI**: reinstall to overwrite (a `.bak-` is kept) or remove the directory (the registry keeps the entry and later runs report a missing directory).
|
|
370
|
+
- `steps` never chain automatically; use `calls`.
|
|
371
|
+
- Reviews are created on compaction only; the Reviews tab has no full-text search.
|
|
323
372
|
- Subagent sessions produce no reviews and no diary nudges.
|
|
324
|
-
- Import and export cover tool scripts only
|
|
373
|
+
- Import and export cover tool scripts only; copy `session-memory/` for reviews.
|
|
374
|
+
- Delete + review needs `command-compact` mounted on that session's preset.
|
|
375
|
+
- With the plugin-built teardown, the engine may still remember the session until it restarts.
|
|
376
|
+
|
|
377
|
+
<a name="sec-dev"></a>
|
|
325
378
|
|
|
326
379
|
## Development
|
|
327
380
|
|
|
328
381
|
~~~
|
|
329
|
-
index.js plugin entry (exports name / apply / inject
|
|
382
|
+
index.js plugin entry (exports name / apply / inject)
|
|
330
383
|
cordis.patch.yml inserts the plugin into the host loader
|
|
331
384
|
lib/core/ host-side logic: storage, decay, tool definitions, script runner
|
|
332
385
|
lib/host/ host service adapters: 12 HTTP endpoints, capability probe, session delete
|
|
@@ -334,8 +387,8 @@ lib/client.js settings page (React, registered at settings.section)
|
|
|
334
387
|
~~~
|
|
335
388
|
|
|
336
389
|
- Zero runtime dependencies, ESM, Node `>=18`.
|
|
337
|
-
- Tests
|
|
338
|
-
- Packaging
|
|
390
|
+
- Tests `node --test test/*.test.mjs` (not shipped in the package).
|
|
391
|
+
- Packaging `npm pack`; whitelist is the `files` field of `package.json`.
|
|
339
392
|
|
|
340
393
|
## License
|
|
341
394
|
|