@nomadop/session-watcher-dsh 0.10.1 → 0.11.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.
@@ -1,6 +1,6 @@
1
1
  # Turn Notes
2
2
 
3
- What each note says. Reading and filling the two files is the `protocol` that `get_turn_skeleton` returns; this file governs content only.
3
+ Write continuity notes that help the next session find the turns it needs to continue the same line of work. Reading and filling the two files is the `protocol` that `get_turn_skeleton` returns; this file governs content only.
4
4
 
5
5
  ## Reading the skeleton
6
6
 
@@ -16,7 +16,7 @@ T 26 | A : …所以按 turn 采样,护栏落在 turn 的行数上而不
16
16
  | NOTE[12]: ____
17
17
  ```
18
18
 
19
- **The skeleton anchors your own context; it is not the evidence.** You are the agent that lived these turns, so their full text is already in your context. The block samples the turn: the first assistant message head-cut, the last tail-cut, and an aggregate row whose counts and basenames come from the tool trace and are indexed without you. Locate the turn in your context and write the note from the whole of it.
19
+ **Use the skeleton to locate each turn in the available conversation.** Its assistant excerpts and tool aggregate locate the turn, not replace its evidence. Write from the messages and results available in context. Record only what they state or show; do not infer missing events or reconstruct internal reasoning.
20
20
 
21
21
  **A turn runs from its `U` head to the row before the next block's `U` head.** A sub-agent's returned result, a tool result, a skill payload — none of these opens a turn; the block's last `A` row is the last thing this turn said, and the note covers everything up to it.
22
22
 
@@ -24,13 +24,13 @@ T 26 | A : …所以按 turn 采样,护栏落在 turn 的行数上而不
24
24
 
25
25
  The note covers what the **assistant** did in that turn, at the length the turn earns: a one-line span yields a one-clause note. Never restate the user's message: the `U` row already carries it and the user's decision, so open on the assistant's first act.
26
26
 
27
- Reader: a fresh agent that will never see this conversation. Per turn its only decision is: pull this turn in full, or move on. The note carries the bearing; the turn carries the evidence.
27
+ Per turn the next session decides: pull this turn in full, or move on. The note carries the bearing; the turn carries the evidence.
28
28
 
29
29
  Register: a commit message body — terse, fragments correct. The note is itself the searched text, so compression drops function words and keeps the subject: copy commands, identifiers, numbers, versions and error strings EXACTLY, because they are both the record and the words a later query is made of. A number is copied from a row of the turn, never recounted; a tally you cannot point at, leave out. "fix notes.md append seam — heading glued onto unterminated body line", not "I went ahead and fixed the seam".
30
30
 
31
31
  **Write what no retrieval holds.** Retrieval is by name or by pulling this turn, and the note treats each differently.
32
32
 
33
- A **named artifact** the turn left behind — a commit, a plan, a backlog row, an ADR, a step the skill prescribes — is reachable by its name from anywhere, so what it carries the note leaves to it: an identifier the commit message names is the commit's, and the note writes the sha. Write what the artifact does not hold: what was chosen, what was turned down, and the reason.
33
+ A **named artifact** the turn left behind — a commit, a plan, a backlog row, an ADR, a step the skill prescribes — is reachable by its name from anywhere, so what it carries the note leaves to it: an identifier the commit message names is the commit's, and the note writes the sha. Write choices, rejected alternatives and reasons that the available conversation explicitly states and the artifact does not hold.
34
34
  "adopt W_amber=0.4; reject 0.6 — overshoot already absorbed by W coordinate"
35
35
  "reject per-episode quota — starves small classes; switch to global joint selection"
36
36
 
@@ -13,6 +13,8 @@ Prepare a handoff package so the next session can resume without re-reading what
13
13
 
14
14
  - **The call fails** — an error instead of that shape, whatever its cause. Stop this run: report to the user that the turn skeleton could not be captured; do not produce or submit notes, and do not go on to `prepare_handoff`.
15
15
 
16
+ - A successful reply freezes the run: perform steps 2–7 using the returned metadata and existing context. Unverified facts remain in Blockers / risks; resolving them belongs to next_task.
17
+
16
18
  2. **Produce turn notes** you MUST follow [`NOTES.md`](NOTES.md) exactly for what each note says. Write them inline — do not delegate to a subagent.
17
19
 
18
20
  3. **Submit notes** via the `submit_turn_notes` tool with `snapshot_id`. The tool reads `notes_path` itself.
@@ -24,20 +26,16 @@ Prepare a handoff package so the next session can resume without re-reading what
24
26
  - **`invalid_snapshot`** — the capture's source identity or required metadata is invalid, including a transcript that cannot be read. Stop: report to the user.
25
27
  - **`storage_unavailable`** (`retryable: true`) — store temporarily unavailable. Stop: report to the user; they may re-run the skill when ready.
26
28
 
27
- 4. **Fetch bucket data** via the `get_bucket_summary` tool.
28
-
29
- If `metrics.br < 0.05` AND few turns: note "Context is still light — handoff may not be necessary yet, but proceeding as requested."
29
+ 4. **Fetch bucket data** via the `get_bucket_summary` tool and complete any explicitly requested runtime handoff actions before this call. Call `get_bucket_summary` once per handoff.
30
30
 
31
31
  5. **Select paths to keep.** The kept set is what the next task must have in hand before it can act. Candidates are the bucket summary plus any path this segment used that the bucket lacks. For each candidate, name the act of `next_task` that opens it; a candidate with no such act is not kept, whatever this segment did with it.
32
32
  - The repo outlives the context reset and the conversation does not, so a file the next session can read on demand is kept only where that first act needs it in hand: the file the task edits, the test that guards it, the artifact under discussion.
33
33
  - A blob under review is read by its reviewer, so what the next task needs is the review's return and the sources it cites.
34
- - Read each candidate's `tokens` from the bucket summary and total them before prepare. Where one path carries more than half that total, state which act needs all of it, or keep its `symbols` alone.
34
+ - Use the returned `tokens` to estimate the kept total. Where one path carries more than half that total, state which act needs all of it, or keep its `symbols` alone. Unavailable or symbol-only costs may remain unknown, `prepare_handoff` returns the final total.
35
35
 
36
36
  Always: `userOverride` decides that path; a `keep:` list in the arguments is kept verbatim; symbols come from `activeSymbols` into `paths_to_keep[].symbols`; memories, `CONTEXT.md`, `CLAUDE.md` stay off the list.
37
37
 
38
- Before prepare, tell the user the kept total, each kept path with the act that opens it, and every edited or repeatedly read bucket path left out.
39
-
40
- 6. **Select skills** — `skills_to_keep`: only skills actively guiding the workflow or required by next_task. Skip one-shot completed skills. Never include `sw-load` — it drives the load flow itself and is always invoked automatically. If the user's `keep:` list includes skill names, use those directly.
38
+ 6. **Select skills** — `skills_to_keep`: only skills actively guiding the workflow or required by next_task. Skip one-shot completed skills. Never include `sw-load` — it drives the load flow itself. If the user's `keep:` list includes skill names, use those directly.
41
39
 
42
40
  7. **Write the summary** you MUST following [`SUMMARY.md`](SUMMARY.md) exactly. Redact secrets as `[REDACTED]`
43
41
 
@@ -1,9 +1,11 @@
1
1
  # Handoff Summary Template
2
2
 
3
+ Write a concise checkpoint so the next session can continue the same line of work after the context reset. Use the state and decisions shown in the available conversation; do not infer missing events or reconstruct internal reasoning.
4
+
3
5
  Two principles govern what goes in the summary:
4
6
 
5
7
  1. **State, not history.** The next session needs where we ARE and how to RESUME. Commits record what happened — reference them by hash, don't retell them.
6
- 2. **Underivable only.** If git log, grep, reading the code, or a turn note you just wrote answers it, leave it out. The summary carries intent, reasoning, and conversation-only state.
8
+ 2. **Underivable only.** If git log, grep, reading the code, or a turn note you just wrote answers it, leave it out. The summary carries user intent, choices and reasons already stated, and conversation-only state.
7
9
 
8
10
  Use these section headers exactly. Write `(none)` for empty sections — never omit or pad.
9
11
 
@@ -19,7 +21,7 @@ Use these section headers exactly. Write `(none)` for empty sections — never o
19
21
 
20
22
  ## Discussion context
21
23
 
22
- [User-side and unresolved context — a turn note records what the assistant did, not what it was told. Omit entirely if the session was purely mechanical.]
24
+ [User-side and unresolved context — a turn note records what the assistant did, not what it was told. Write `(none)` if there is no such context.]
23
25
 
24
26
  - **User corrections**: where the user redirected approach, and what they said
25
27
  - **Constraints from conversation**: verbal rules not yet in code or CLAUDE.md
@@ -27,7 +29,7 @@ Use these section headers exactly. Write `(none)` for empty sections — never o
27
29
 
28
30
  ## Active constraints
29
31
 
30
- [Invariants the next session must respect — the choice and 1-line WHY. Locked interfaces.]
32
+ [Invariants the next session must respect, including locked interfaces. Include an already-stated reason when it affects how to apply a constraint.]
31
33
 
32
34
  ## Blockers / risks
33
35
 
package/package.json CHANGED
@@ -1,24 +1,47 @@
1
1
  {
2
2
  "name": "@nomadop/session-watcher-dsh",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Session Watcher as a DeepSeek Harness host plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "author": "Longju Cheng",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/nomadop/session-watcher.git",
11
+ "directory": "dsh"
12
+ },
13
+ "homepage": "https://nomadop.github.io/session-watcher/docs/dsh/",
14
+ "bugs": {
15
+ "url": "https://github.com/nomadop/session-watcher/issues"
16
+ },
7
17
  "exports": {
8
18
  ".": "./dist/index.js",
9
- "./client": "./dist/client.js"
19
+ "./client": "./dist/client.js",
20
+ "./pi-ai": "./dist/pi-ai-index.js"
10
21
  },
11
22
  "files": [
12
23
  "dist/",
24
+ "assets/",
13
25
  "dsh.bundle.patch.yml"
14
26
  ],
15
27
  "publishConfig": {
16
28
  "access": "public"
17
29
  },
30
+ "engines": {
31
+ "dsh": ">=0.2.2-rc.1"
32
+ },
18
33
  "peerDependencies": {
19
- "@deepseek-ai/dsh-compaction": ">=0.2.0-rc.1",
20
- "@deepseek-ai/dsh-llm": ">=0.2.0-rc.1",
21
- "@deepseek-ai/dsh-tools": ">=0.2.0-rc.1"
34
+ "@deepseek-ai/dsh-compaction": ">=0.2.2-rc.1",
35
+ "@deepseek-ai/dsh-credentials": ">=0.2.2-rc.1",
36
+ "@deepseek-ai/dsh-launch-environment": ">=0.2.2-rc.1",
37
+ "@deepseek-ai/dsh-llm": ">=0.2.2-rc.1",
38
+ "@deepseek-ai/dsh-llm-pi-ai": ">=0.2.2-rc.1",
39
+ "@deepseek-ai/dsh-session": ">=0.2.2-rc.1",
40
+ "@deepseek-ai/dsh-timeout": ">=0.2.2-rc.1",
41
+ "@deepseek-ai/dsh-tools": ">=0.2.2-rc.1",
42
+ "@deepseek-ai/dsh-util-values": ">=0.2.2-rc.1",
43
+ "@deepseek-ai/schemastery": ">=3.19.0",
44
+ "@earendil-works/pi-ai": "^1.3.0"
22
45
  },
23
46
  "dsh": {
24
47
  "client": {
@@ -27,5 +50,25 @@
27
50
  "bundle": {
28
51
  "patch": "./dsh.bundle.patch.yml"
29
52
  }
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@deepseek-ai/dsh-credentials": {
56
+ "optional": true
57
+ },
58
+ "@deepseek-ai/dsh-launch-environment": {
59
+ "optional": true
60
+ },
61
+ "@deepseek-ai/dsh-llm-pi-ai": {
62
+ "optional": true
63
+ },
64
+ "@deepseek-ai/dsh-timeout": {
65
+ "optional": true
66
+ },
67
+ "@deepseek-ai/dsh-util-values": {
68
+ "optional": true
69
+ },
70
+ "@earendil-works/pi-ai": {
71
+ "optional": true
72
+ }
30
73
  }
31
74
  }
@@ -1,45 +0,0 @@
1
- ---
2
- name: sw-load
3
- description: "Use when the user provides a handoff token, asks to resume or continue previous work, the host's handoff notice announces a handoff, or you are about to call load_handoff."
4
- ---
5
-
6
- # Session Watcher Load Handoff
7
-
8
- Restore a previous session's handoff package into context so work can resume.
9
-
10
- ## Steps
11
-
12
- 1. **Load the handoff.** Resolve a token from the skill `args`, from the user's message, or from the host's own handoff notice, which names pending handoffs by token: the Claude Code SessionStart hook's additionalContext, or the message DSH injects when the agent starts or resumes. Then call the `load_handoff` tool, whose schema carries the three ways in.
13
-
14
- A token you were handed is the one path that proceeds without asking. Any other way in — a free-text match, an auto-match, or several tokens offered at once — means listing what came back with each one's age and task preview and letting the user pick before you go on. Nothing found → tell the user the token is expired or invalid, and ask for direction.
15
-
16
- 2. **Read the kept paths.** Relative paths resolve against CWD, then `project_dir`.
17
-
18
- One strategy per entry, the first row that applies:
19
-
20
- | Entry has | Read at load |
21
- |---|---|
22
- | `lines` | each range |
23
- | `resolvedSymbols` | the `(lines a-b)` each string carries |
24
- | neither | the file's first 40 lines; with `symbols`, also `grep -n` each name in the file to place the entry points |
25
-
26
- Each read is the host's file-reading tool over a line range of the kept file. Each call names one file. Issue every read for every entry in one message — each further turn re-reads the whole accumulated context.
27
-
28
- Unresolvable path → tell the user, skip. Empty `paths_to_keep` → ask the user what they are working on.
29
-
30
- 3. **Place the summary in its lineage.** `lineage` runs oldest to newest. The sessions the budget left out are collapsed into runs marked `omitted`, ahead of the newest sessions' headlines, and the budget may keep none. When the next task or what is already in context needs the headlines of an omitted run, `lineage_headlines` with that run's numbers as `k` (`S2-S5` is `2-5`) reads them; read a run for that need only, not by default. The injected page holds the newest turns and is already in context. From the page, list the turns whose `A:` note bears on the next task, by their `S{k}:{T}` address. When a headline bears on the next task and the page does not reach that member, call `turn_page` with that member's label as `before`; a session inside an omitted run is `S{k}`, `k` being its own number. That list is what step 5 reports.
31
-
32
- 4. **Load the kept skills** — invoke each name in `skills_to_keep` through the host's skill tool. A skill named only in the summary text is invoked after the user agrees.
33
-
34
- 5. **Present, then hold.** One `git status --short && git log -1 --oneline`, then write, from the kept paths and that output:
35
- - Objective, one line
36
- - Working state — each claim the summary makes about the current state, set against what the kept paths and the git output show: matches, differs (say how), or reaches neither (say unverified)
37
- - Next task and its entry points — the `neither` entries with where their symbols sit, and the turns step 3 named
38
- - Blockers and risks
39
- - The kept paths now in context and the load token you used
40
-
41
- Then stop and wait for the user to confirm or correct it. The next task's first act begins after the reply.
42
-
43
- ### Completion criterion
44
-
45
- Done when the kept paths are in context, the state is presented in the shape step 5 gives, and the user has replied confirming or correcting it.