counterparts 0.3.42 → 0.3.43
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/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/src/adapters/claude-code/doctor.ts +12 -3
- package/src/adapters/claude-code/hooks.ts +3 -2
- package/src/adapters/cli/commands-self.ts +32 -0
- package/src/adapters/cli/commands.ts +10 -1
- package/src/adapters/cli/help.ts +2 -0
- package/src/adapters/fired.ts +41 -9
- package/src/adapters/lifecycle.ts +27 -2
- package/src/adapters/log/index.ts +3 -0
- package/src/adapters/mcp/chat-wake.ts +2 -2
- package/src/adapters/mcp/server-words.ts +1 -1
- package/src/adapters/mcp/server.ts +112 -1
- package/src/adapters/mcp/tools.ts +3 -3
- package/src/adapters/update-check.ts +1 -1
- package/src/core/counterpart-boundary.ts +3 -1
- package/src/core/counterpart-wake-shape.ts +949 -0
- package/src/core/counterpart.ts +162 -5
- package/src/core/dream/CONTRACT.md +5 -0
- package/src/core/dream/night-line.ts +27 -11
- package/src/core/dream/slices.ts +14 -0
- package/src/core/handoff/CONTRACT.md +5 -0
- package/src/core/handoff/NOTES.md +22 -0
- package/src/core/handoff/index.ts +68 -5
- package/src/core/handoff/last-exchange.ts +3 -1
- package/src/core/prospective/CONTRACT.md +3 -0
- package/src/core/prospective/NOTES.md +27 -0
- package/src/core/self/CONTRACT.md +1 -0
- package/src/core/self/NOTES.md +21 -0
- package/src/core/self/briefing.ts +5 -0
- package/src/core/self/index.ts +75 -2
- package/src/core/self/tunables.ts +68 -0
- package/src/core/store/index.ts +13 -0
- package/src/core/store/reads-memories.ts +43 -0
- package/src/core/time.ts +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.43 — 2026-11-01
|
|
4
|
+
|
|
5
|
+
Nearly nothing changes by default. A folder you set off, observer or paused no longer puts its plain work reminders in the line above the wake: one is said if the folder is turned back on within a week of its day, and doctor counts the ones waiting. `recall "elsewhere"` lists the other folders the way the wake's Elsewhere reads them. The wake's new shape is in, switched off: with it off, every wake is byte-for-byte what 0.3.42 writes, and `counterparts wake-shape on` turns it on for one store (`off` or `default` turns it back). No store-format change (store v15, cache v7); the switch is one setting kept in the store, with no migration. Nothing to run after upgrading beyond the usual restart of the dashboard and every Claude Code session. Going back to 0.3.42 needs no store restore: `counterparts disconnect`, 0.3.42's install, then `counterparts connect`; 0.3.42 ignores the switch.
|
|
6
|
+
|
|
7
|
+
- **The wake's approved shape, built, and off.** One section per question, no item twice, and a thing that doesn't fit becomes a whole
|
|
8
|
+
title and a door. Nothing changes until it's turned on, one store at a time, with `counterparts wake-shape on`.
|
|
9
|
+
- **Two new doors work either way:** `recall "coming up"` lists what's due by whole title, and `recall "handoffs"` lists this
|
|
10
|
+
folder's handoffs with what came after the newest.
|
|
11
|
+
- **`session_end` now asks a handoff to lead with what comes next**, as `next: X (waiting on Y)`, and to retire a finished one.
|
|
12
|
+
- **`recall "elsewhere"` lists the other folders a wake's Elsewhere had no room for**, in its order and by its rules, with the shape
|
|
13
|
+
on or off. The shaped wake's `+N more folders` now points there, and its count is what the door lists past the lines it printed.
|
|
14
|
+
- **A plain reminder from a folder set off, observer or paused isn't said above the wake any more.** It isn't marked told either: turn
|
|
15
|
+
the folder on and it's said then, on its day or within the week after. One marked about you, or with no folder, is still said
|
|
16
|
+
wherever it was written. Doctor no longer counts one held back as missed, and its Fired line says how many are held back. With the
|
|
17
|
+
wake's shape off, the wake's own Coming up still lists it, as 0.3.42 did; with the shape on, it doesn't.
|
|
18
|
+
|
|
3
19
|
## 0.3.42 — 2026-10-30
|
|
4
20
|
|
|
5
21
|
The wake is cleaner: it no longer lists bare ids, "Might be relevant" is gone once a store has its page, and where this folder stands is one block, led by the newest handoff. Yesterday's day summary shows again when a late write-up of another day used to hide it. Turns are faster on a large store and a late one is shown rather than lost. A folder set off, paused or to observe now stays out of the night and the catch-up, and a folder setting file that won't read stops the night and says so instead of thinning the page. No store-format change (store v15, cache v7), and nothing to run after upgrading beyond the usual restart of the dashboard and every Claude Code session. The first background run after updating builds recall's new index by itself, about half a second, no migration, and the cache file grows by about 15 MB. Going back to 0.3.41 needs no store restore: `counterparts disconnect`, 0.3.41's install, then `counterparts connect`.
|
package/package.json
CHANGED
|
@@ -1647,7 +1647,8 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1647
1647
|
),
|
|
1648
1648
|
];
|
|
1649
1649
|
}
|
|
1650
|
-
const
|
|
1650
|
+
const folderOn = input.configReason === "not-read" ? undefined : owedFolders(input.configPath);
|
|
1651
|
+
const report = firedReport(store, input.today, folderOn === undefined ? {} : { folderOn });
|
|
1651
1652
|
const c = report.counts;
|
|
1652
1653
|
const blocked =
|
|
1653
1654
|
c.blocked === 0
|
|
@@ -1687,9 +1688,17 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1687
1688
|
wentQuiet: report.wentQuiet.join("; "),
|
|
1688
1689
|
wentBlocked: report.wentBlocked.join("; "),
|
|
1689
1690
|
missedOccasion: report.missedOccasion.join("; "),
|
|
1691
|
+
heldBack: report.heldBack,
|
|
1690
1692
|
young: report.young,
|
|
1691
1693
|
livedDay: report.livedDay,
|
|
1692
1694
|
};
|
|
1695
|
+
// HELD BACK, NOT MISSED (2026-10-30): no fault, but said, since a reminder held
|
|
1696
|
+
// past the week after its day is gone with no other line. A missed one's
|
|
1697
|
+
// sentence already carries the count.
|
|
1698
|
+
const held =
|
|
1699
|
+
report.heldBack === 0 || report.missedOccasion.length > 0
|
|
1700
|
+
? ""
|
|
1701
|
+
: ` ${report.heldBack === 1 ? "1 plain reminder is" : `${String(report.heldBack)} plain reminders are`} held back, ${report.heldBack === 1 ? "its folder" : "their folders"} not on: said if turned on within a week of the day, and not after.`;
|
|
1693
1702
|
// TOO NEW TO GRADE (2026-09-20, finding 2). On a store younger than a lived
|
|
1694
1703
|
// day or two, "28 have never fired" is a true sentence that reads like a
|
|
1695
1704
|
// broken install — nothing has fired because nothing has happened yet. One
|
|
@@ -1719,7 +1728,7 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1719
1728
|
"fired",
|
|
1720
1729
|
"green",
|
|
1721
1730
|
"Fired",
|
|
1722
|
-
`${roll}. Nothing that fired last week has fallen silent this week
|
|
1731
|
+
`${roll}. Nothing that fired last week has fallen silent this week.${held}`,
|
|
1723
1732
|
"",
|
|
1724
1733
|
data,
|
|
1725
1734
|
),
|
|
@@ -1741,7 +1750,7 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1741
1750
|
"fired",
|
|
1742
1751
|
"amber",
|
|
1743
1752
|
"Fired",
|
|
1744
|
-
`${roll}. ${changed.join(". ")}`,
|
|
1753
|
+
`${roll}. ${changed.join(". ")}${held === "" ? "" : `.${held}`}`,
|
|
1745
1754
|
report.wentBlocked.length > 0
|
|
1746
1755
|
? `Run: counterparts mechanisms --all — ${STATE_MEANING.blocked}, and the reason on the row names what to fix.`
|
|
1747
1756
|
: report.missedOccasion.length > 0
|
|
@@ -1110,8 +1110,9 @@ export class ClaudeCodeAdapter extends Lifecycle {
|
|
|
1110
1110
|
// The composed recall and its durable row (`Lifecycle#recallTurn`).
|
|
1111
1111
|
const result = this.recallTurn(input, text, {
|
|
1112
1112
|
...(budgetBytes === undefined ? {} : { budgetBytes }),
|
|
1113
|
-
// Said outright this turn, so not ALSO handed over as a quiet cue
|
|
1114
|
-
|
|
1113
|
+
// Said outright this turn, so not ALSO handed over as a quiet cue; and
|
|
1114
|
+
// one held back for its closed folder isn't let out that way instead.
|
|
1115
|
+
...(waiting.length === 0 && plain.held === undefined ? {} : { withhold: new Set([...waiting.map((r) => r.memoryId), ...(plain.held ?? [])]) }),
|
|
1115
1116
|
...(byHost ? { noCues: true } : {}),
|
|
1116
1117
|
// Who started the turn, for the row only (N1): the reading above.
|
|
1117
1118
|
startedBy: !isInteractive(input) ? "unattended" : byHost ? "host" : "person",
|
|
@@ -4,6 +4,7 @@ import { localDate } from "../../core/time.js";
|
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
6
6
|
import { Counterpart } from "../../core/counterpart.js";
|
|
7
|
+
import { WAKE_SHAPE_KEY } from "../../core/counterpart-wake-shape.js";
|
|
7
8
|
import { NO_PAGE_VERSION } from "../../core/self/index.js";
|
|
8
9
|
import { REFLECTED_FEELING_KEY } from "../../core/sleep/index.js";
|
|
9
10
|
import { CLAIMS_ERA_CUTOFF_KEY, storeExists } from "../../core/store/index.js";
|
|
@@ -361,6 +362,37 @@ const ABOUT_BY_WORDS: Record<string, string> = {
|
|
|
361
362
|
* everything and refuses under observer. The dashboard's "about" action runs
|
|
362
363
|
* this same command.
|
|
363
364
|
*/
|
|
365
|
+
/**
|
|
366
|
+
* THE WAKE'S SHAPE FOR ONE STORE (WK2, 2026-10-30): one meta row, so a store can
|
|
367
|
+
* read the shape on every host at once before any default changes, and go back
|
|
368
|
+
* by saying so. Nothing else is written; the next session start reads it.
|
|
369
|
+
*/
|
|
370
|
+
export function wakeShapeCommand(dir: string, io: Io, parsed: Parsed, observer: boolean, namedDir: boolean): number {
|
|
371
|
+
if (!storeExists(dir)) {
|
|
372
|
+
io.err(`No store at ${dir}. Run 'counterparts init${namedDir ? ` --dir ${dir}` : ""}' to create one.`);
|
|
373
|
+
return EXIT.usage;
|
|
374
|
+
}
|
|
375
|
+
const [word, ...rest] = parsed.positional;
|
|
376
|
+
if (rest.length > 0 || (word !== undefined && word !== "on" && word !== "off" && word !== "default")) {
|
|
377
|
+
io.err("refused: counterparts wake-shape [on|off|default].");
|
|
378
|
+
return EXIT.usage;
|
|
379
|
+
}
|
|
380
|
+
if (word !== undefined && observer) {
|
|
381
|
+
io.err("refused: this console has stood down (observer), so the shape stays as it is.");
|
|
382
|
+
return EXIT.usage;
|
|
383
|
+
}
|
|
384
|
+
const counterpart = openCounterpart(dir, word === undefined || observer);
|
|
385
|
+
try {
|
|
386
|
+
if (word === "default") counterpart.store.setMeta(WAKE_SHAPE_KEY, "");
|
|
387
|
+
else if (word !== undefined) counterpart.store.setMeta(WAKE_SHAPE_KEY, word);
|
|
388
|
+
const said = (counterpart.store.getMeta(WAKE_SHAPE_KEY) ?? "").trim();
|
|
389
|
+
io.out(`The wake's shape here: ${counterpart.wakeShapeOn() ? "on" : "off"}${said === "" ? " (the build's default)" : ""}.`);
|
|
390
|
+
return EXIT.ok;
|
|
391
|
+
} finally {
|
|
392
|
+
counterpart.close();
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
364
396
|
export function aboutCommand(dir: string, io: Io, parsed: Parsed, observer: boolean, namedDir: boolean): number {
|
|
365
397
|
if (!storeExists(dir)) {
|
|
366
398
|
io.err(`No store at ${dir}. Run 'counterparts init${namedDir ? ` --dir ${dir}` : ""}' to create one.`);
|
|
@@ -119,7 +119,7 @@ import {
|
|
|
119
119
|
coreCommand,
|
|
120
120
|
claimsEraCommand,
|
|
121
121
|
settleCommand,
|
|
122
|
-
aboutCommand,
|
|
122
|
+
aboutCommand, wakeShapeCommand,
|
|
123
123
|
} from "./commands-self.js";
|
|
124
124
|
import { projectCommand } from "./commands-project.js";
|
|
125
125
|
import {
|
|
@@ -239,6 +239,9 @@ export const COMMANDS = [
|
|
|
239
239
|
// session can run it to review the night with the owner.
|
|
240
240
|
"night",
|
|
241
241
|
"core",
|
|
242
|
+
// The wake's shape, one store at a time (WK2, 2026-10-30): read it, or set it.
|
|
243
|
+
// Reads and writes, like `about`; the write refuses under observer.
|
|
244
|
+
"wake-shape",
|
|
242
245
|
// Contradictions (2026-09-29): what is unsettled and what was settled, and
|
|
243
246
|
// the owner's settle and undo. Reads and writes, like `dream`; the write
|
|
244
247
|
// refuses at the core's own seam under observer.
|
|
@@ -598,6 +601,7 @@ export const COMMAND_FLAGS: Record<Command, readonly string[]> = {
|
|
|
598
601
|
core: ["list", "demote", "reaffirm", "reason", "reflected-feeling"],
|
|
599
602
|
settle: ["list", "pair", "holds", "against", "how", "why", "undo"],
|
|
600
603
|
about: ["why"],
|
|
604
|
+
"wake-shape": [],
|
|
601
605
|
project: [],
|
|
602
606
|
coverage: ["date"],
|
|
603
607
|
// `--config` because the store it opens is the one the configuration names,
|
|
@@ -677,6 +681,8 @@ export const COMMAND_BLURB: Record<Command, string> = {
|
|
|
677
681
|
"What each dream did, and its undo — and what the waking self made of it. With no flags (or --list), the newest 20 dreams (--list --all for every one): date, state, title and what changed, then the recent reflections; --show <id> prints one dream's journal, every change it made and the reflection after it (--show <rfl_…> prints one reflection: its questions, entry, what it rests on and its morning share); --undo <id> reverses that dream's whole batch (merges come apart, links and gists go, replays and nominations are taken back) and keeps its journal, marked undone — a reflection is lived and stays. Reading works under observer; --undo refuses there.",
|
|
678
682
|
night:
|
|
679
683
|
"Last night, read-only: what a dream did and what the waking self made of it. It changes nothing — it opens the store as an observer, so it runs the same under --observer. With nothing after it (or list), the recent dreams and reflections, newest first (--all for every dream); last prints the newest dream — its journal, every change it made, and the reflection after it (last-reflection: the newest reflection); an id (drm_… or rfl_…) prints that one, and show <id|last> means the same. Undoing a dream stays on `counterparts dream`, the owner's door.",
|
|
684
|
+
"wake-shape":
|
|
685
|
+
"The wake's shape for this store: on, off, or the build's default. With nothing after it, says which this store has. On: a session start reads the wake top-down, one question per section and no item twice; off: as it has been. Takes effect at the next session start; it writes one setting in the store and nothing else. Reading works under observer; setting refuses there.",
|
|
680
686
|
core:
|
|
681
687
|
"The core — the memories about me and about us that do not fade. With no flags (or --list), what it holds and which lane carried each one there, what dreams have nominated, what is being reconsidered, and what was sent back; --demote <id> --reason \"...\" sends one back to ordinary fading from today, records why, and keeps the lanes from promoting it again; --reaffirm <id> --reason \"...\" keeps one that is being reconsidered (it is not flagged again for what it is); --reflected-feeling on|off opens or closes the core to reflection alone. On (the default): a feeling a reflection records later and a reflection citing a memory both count toward the fast lane, and a reflection may re-label what a memory is about either way — each re-label is recorded with its reason, and one into me, us or the owner is told in the next morning share. Off: nothing reaches the core on a reflection alone — the fast lane needs a feeling felt at the time (not one a reflection recorded later) and an ordinary use after a gap (not a reflection citing it), and a reflection may only move what a memory is about toward work or world. Reading works under observer; the changes refuse there.",
|
|
682
688
|
settle:
|
|
@@ -718,6 +724,7 @@ const COMMAND_ARGS: Partial<Record<Command, string>> = {
|
|
|
718
724
|
core: " [--demote <id> --reason \"...\" | --reaffirm <id> --reason \"...\" | --reflected-feeling on|off]",
|
|
719
725
|
settle: " [--list | --pair <id> --holds <id> --how changed|corrected|open --why \"...\" | --undo <pair>]",
|
|
720
726
|
about: " <id> [me|us|owner|work|world] [--why \"...\"]",
|
|
727
|
+
"wake-shape": " [on|off|default]",
|
|
721
728
|
project: " [list | join <folder> <project name or folder> | leave <folder>]",
|
|
722
729
|
coverage: " [--date YYYY-MM-DD]",
|
|
723
730
|
};
|
|
@@ -1740,6 +1747,8 @@ export async function run(argv: readonly string[], opts: RunOptions): Promise<nu
|
|
|
1740
1747
|
return dreamCommand(dir, io, parsed, observer, typeof parsed.flags["dir"] === "string");
|
|
1741
1748
|
case "night":
|
|
1742
1749
|
return nightCommand(dir, io, parsed, typeof parsed.flags["dir"] === "string");
|
|
1750
|
+
case "wake-shape":
|
|
1751
|
+
return wakeShapeCommand(dir, io, parsed, observer, typeof parsed.flags["dir"] === "string");
|
|
1743
1752
|
case "core":
|
|
1744
1753
|
return coreCommand(dir, io, parsed, observer, typeof parsed.flags["dir"] === "string");
|
|
1745
1754
|
case "claims-era":
|
package/src/adapters/cli/help.ts
CHANGED
|
@@ -134,6 +134,7 @@ export const SHORT: Record<string, string | readonly string[]> = {
|
|
|
134
134
|
core: "What became part of who I am — and send one back",
|
|
135
135
|
settle: "Two memories that disagree: which holds — and undo one",
|
|
136
136
|
about: "What a memory is about — and change it",
|
|
137
|
+
"wake-shape": "The wake's shape for this store: on, off or the default",
|
|
137
138
|
project: "Which folders are one piece of work — join or leave",
|
|
138
139
|
coverage: "What is written up, and what is not yet, for a date",
|
|
139
140
|
"catch-up": "Write up, now, sessions that ended unwritten (the night does it too)",
|
|
@@ -188,6 +189,7 @@ export const ADVANCED: readonly string[] = [
|
|
|
188
189
|
"log",
|
|
189
190
|
"dream",
|
|
190
191
|
"night",
|
|
192
|
+
"wake-shape",
|
|
191
193
|
"core",
|
|
192
194
|
"settle",
|
|
193
195
|
"about",
|
package/src/adapters/fired.ts
CHANGED
|
@@ -73,6 +73,8 @@ import { addDays, daysBetween as calendarDaysBetween, localDate, parseCalendarDa
|
|
|
73
73
|
import type { EventRow, ReadOnlyStore } from "../core/store/index.js";
|
|
74
74
|
import { rowToPhysics } from "../core/store/index.js";
|
|
75
75
|
import { emotionalIntensity } from "../core/physics/index.js";
|
|
76
|
+
import { reminderHeldBack } from "../core/dream/slices.js";
|
|
77
|
+
import type { FolderOn } from "../core/dream/slices.js";
|
|
76
78
|
import { chapterMoments } from "../core/self/episodes.js";
|
|
77
79
|
import type { DurableEventName } from "./dashboard/registries.js";
|
|
78
80
|
import { NON_INTERACTIVE_ENTRYPOINTS, readSession } from "./sessions.js";
|
|
@@ -1287,6 +1289,13 @@ export interface FiredReport {
|
|
|
1287
1289
|
* this week, with nothing last week to compare — would have read green.
|
|
1288
1290
|
*/
|
|
1289
1291
|
readonly missedOccasion: readonly string[];
|
|
1292
|
+
/**
|
|
1293
|
+
* Plain reminders due this week and not said because their folder is closed
|
|
1294
|
+
* (`FiredOptions.folderOn`): no fault, and doctor says the count, since past
|
|
1295
|
+
* the week after its day one is gone with no other line. 0 when the setting
|
|
1296
|
+
* isn't known.
|
|
1297
|
+
*/
|
|
1298
|
+
readonly heldBack: number;
|
|
1290
1299
|
/** The store's own clock — the number of days it has actually LIVED. */
|
|
1291
1300
|
readonly livedDay: number;
|
|
1292
1301
|
/** Calendar days between the oldest row this pass read and today, or null
|
|
@@ -1321,6 +1330,12 @@ export interface FiredOptions {
|
|
|
1321
1330
|
* and the report NAMES what it did not read rather than guessing at it.
|
|
1322
1331
|
*/
|
|
1323
1332
|
readonly probes?: boolean;
|
|
1333
|
+
/**
|
|
1334
|
+
* The host's folder setting, for what a person could not be told: a plain
|
|
1335
|
+
* reminder a closed folder's work held back (`reminderHeldBack`) was not missed.
|
|
1336
|
+
* Absent: not known, so it reads as said or not, as before.
|
|
1337
|
+
*/
|
|
1338
|
+
readonly folderOn?: FolderOn;
|
|
1324
1339
|
}
|
|
1325
1340
|
|
|
1326
1341
|
/** `YYYY-MM-DD`, `back` days before `today` — label arithmetic (`time.ts`). */
|
|
@@ -1376,6 +1391,7 @@ export function firedReport(store: ReadOnlyStore, today: string, opts: FiredOpti
|
|
|
1376
1391
|
const rows: FiredRow[] = [];
|
|
1377
1392
|
const notRead: string[] = [];
|
|
1378
1393
|
const missedOccasion: string[] = [];
|
|
1394
|
+
let heldBack = 0;
|
|
1379
1395
|
for (const m of MECHANISMS) {
|
|
1380
1396
|
if (m.evidence.kind === "probe" && probed === null) {
|
|
1381
1397
|
notRead.push(m.id);
|
|
@@ -1384,10 +1400,11 @@ export function firedReport(store: ReadOnlyStore, today: string, opts: FiredOpti
|
|
|
1384
1400
|
// An occasion check reads memories, so it costs what a probe costs and is
|
|
1385
1401
|
// skipped with them: an unchecked occasion row reads `waiting`, claiming
|
|
1386
1402
|
// nothing either way.
|
|
1387
|
-
const occasion = probed === null ? null : readOccasion(m, store, log, window);
|
|
1403
|
+
const occasion = probed === null ? null : readOccasion(m, store, log, window, opts.folderOn);
|
|
1388
1404
|
const row = rowFor(m, log, probed, window, occasion);
|
|
1389
1405
|
rows.push(row);
|
|
1390
1406
|
if (occasion !== null && occasion.missed > 0) missedOccasion.push(`${row.label} (${occasion.says})`);
|
|
1407
|
+
heldBack += occasion?.held ?? 0;
|
|
1391
1408
|
}
|
|
1392
1409
|
|
|
1393
1410
|
const counts = Object.fromEntries(FIRED_STATES.map((s) => [s, 0])) as Record<FiredState, number>;
|
|
@@ -1427,6 +1444,7 @@ export function firedReport(store: ReadOnlyStore, today: string, opts: FiredOpti
|
|
|
1427
1444
|
// A missed occasion is named in its own list, with what was missed, rather
|
|
1428
1445
|
// than twice.
|
|
1429
1446
|
missedOccasion,
|
|
1447
|
+
heldBack,
|
|
1430
1448
|
wentQuiet: rows
|
|
1431
1449
|
.filter((r) => r.state === "quiet" && r.firedInPreviousWindow > 0 && r.occasionMissed === 0)
|
|
1432
1450
|
// A row whose table keeps only LIVED days was compared on the lived clock,
|
|
@@ -2025,22 +2043,24 @@ export interface OccasionReading {
|
|
|
2025
2043
|
readonly missed: number;
|
|
2026
2044
|
/** One plain sentence: what came, or that nothing did. */
|
|
2027
2045
|
readonly says: string;
|
|
2046
|
+
/** Not said because its folder is closed, and so not in `missed`. */
|
|
2047
|
+
readonly held?: number;
|
|
2028
2048
|
}
|
|
2029
2049
|
|
|
2030
2050
|
/** The checks, by `OccasionCheckId`. Each is a READ, and each may fail. */
|
|
2031
2051
|
const OCCASION_CHECKS: Record<
|
|
2032
2052
|
OccasionCheckId,
|
|
2033
|
-
(store: ReadOnlyStore, log: LogRead, w: Window) => OccasionReading
|
|
2053
|
+
(store: ReadOnlyStore, log: LogRead, w: Window, on?: FolderOn) => OccasionReading
|
|
2034
2054
|
> = {
|
|
2035
2055
|
"plain-due": plainDueReading,
|
|
2036
2056
|
};
|
|
2037
2057
|
|
|
2038
2058
|
/** The occasion reading for one mechanism, or null when it has no check — or
|
|
2039
2059
|
* when its check could not be read, which is "cannot tell", never a fault. */
|
|
2040
|
-
function readOccasion(m: Mechanism, store: ReadOnlyStore, log: LogRead, w: Window): OccasionReading | null {
|
|
2060
|
+
function readOccasion(m: Mechanism, store: ReadOnlyStore, log: LogRead, w: Window, on: FolderOn | undefined): OccasionReading | null {
|
|
2041
2061
|
if (m.cadence?.kind !== "occasion" || m.cadence.check === undefined) return null;
|
|
2042
2062
|
try {
|
|
2043
|
-
return OCCASION_CHECKS[m.cadence.check](store, log, w);
|
|
2063
|
+
return OCCASION_CHECKS[m.cadence.check](store, log, w, on);
|
|
2044
2064
|
} catch {
|
|
2045
2065
|
return null;
|
|
2046
2066
|
}
|
|
@@ -2069,8 +2089,12 @@ function readOccasion(m: Mechanism, store: ReadOnlyStore, log: LogRead, w: Windo
|
|
|
2069
2089
|
* A memory that cannot be read is skipped, as `plainDue` skips it, rather than
|
|
2070
2090
|
* failing the whole reading: one unreadable row must not turn a real miss on
|
|
2071
2091
|
* another into "cannot tell" (review of #337).
|
|
2092
|
+
*
|
|
2093
|
+
* One not said because its folder is closed (`on`, `reminderHeldBack`) is no miss:
|
|
2094
|
+
* the line says how many are waiting, and it counts in neither number. Read at
|
|
2095
|
+
* today's setting: a folder turned on since reads as what it now is, due and unsaid.
|
|
2072
2096
|
*/
|
|
2073
|
-
function plainDueReading(store: ReadOnlyStore, log: LogRead, w: Window): OccasionReading {
|
|
2097
|
+
function plainDueReading(store: ReadOnlyStore, log: LogRead, w: Window, on?: FolderOn): OccasionReading {
|
|
2074
2098
|
const lastDay = daysBefore(w.to, 1);
|
|
2075
2099
|
const none: OccasionReading = { missed: 0, says: "none fell due this week on a day a session ran" };
|
|
2076
2100
|
if (lastDay < w.from) return none;
|
|
@@ -2079,6 +2103,7 @@ function plainDueReading(store: ReadOnlyStore, log: LogRead, w: Window): Occasio
|
|
|
2079
2103
|
let present: ReadonlyMap<string, number> | null = null;
|
|
2080
2104
|
let due = 0;
|
|
2081
2105
|
let missed = 0;
|
|
2106
|
+
let held = 0;
|
|
2082
2107
|
for (const dated of store.datedMemories(w.from, lastDay)) {
|
|
2083
2108
|
if (denied.has(dated.id)) continue;
|
|
2084
2109
|
const row = store.row(dated.id);
|
|
@@ -2101,7 +2126,6 @@ function plainDueReading(store: ReadOnlyStore, log: LogRead, w: Window): Occasio
|
|
|
2101
2126
|
beats.add(span.precision === "day" ? "day" : day === span.last ? "last-day" : "opens");
|
|
2102
2127
|
}
|
|
2103
2128
|
if (beats.size === 0) continue;
|
|
2104
|
-
due += 1;
|
|
2105
2129
|
const key = windowKey(dated.eventDate, span.precision);
|
|
2106
2130
|
const lineage = plainLineage(store, dated.id);
|
|
2107
2131
|
// Counted per REMINDER, not per beat: a month item that missed both its
|
|
@@ -2114,15 +2138,23 @@ function plainDueReading(store: ReadOnlyStore, log: LogRead, w: Window): Occasio
|
|
|
2114
2138
|
.some((e) => e.dedup_key === `${PROSPECTIVE_PLAIN_EVENT}:${id}:${key}:${beat}`),
|
|
2115
2139
|
),
|
|
2116
2140
|
);
|
|
2141
|
+
if (untold && on !== undefined && reminderHeldBack(store, row, on)) {
|
|
2142
|
+
held += 1;
|
|
2143
|
+
continue;
|
|
2144
|
+
}
|
|
2145
|
+
due += 1;
|
|
2117
2146
|
if (untold) missed += 1;
|
|
2118
2147
|
}
|
|
2119
|
-
|
|
2148
|
+
const waiting = held === 0 ? "" : `${due === 0 ? "" : "; "}${String(held)} held back, ${held === 1 ? "its folder" : "their folders"} not on`;
|
|
2149
|
+
const heldCount = held === 0 ? {} : { held };
|
|
2150
|
+
if (due === 0) return held === 0 ? none : { missed: 0, says: waiting, held };
|
|
2120
2151
|
if (missed === 0) {
|
|
2121
|
-
return { missed: 0, says: `${String(due)} fell due this week, and ${due === 1 ? "it was" : "each was"} said
|
|
2152
|
+
return { missed: 0, says: `${String(due)} fell due this week, and ${due === 1 ? "it was" : "each was"} said${waiting}`, ...heldCount };
|
|
2122
2153
|
}
|
|
2123
2154
|
return {
|
|
2124
2155
|
missed,
|
|
2125
|
-
says: `${String(missed)} plain ${missed === 1 ? "reminder was" : "reminders were"} due on a day a session ran and not said`,
|
|
2156
|
+
says: `${String(missed)} plain ${missed === 1 ? "reminder was" : "reminders were"} due on a day a session ran and not said${waiting}`,
|
|
2157
|
+
...heldCount,
|
|
2126
2158
|
};
|
|
2127
2159
|
}
|
|
2128
2160
|
|
|
@@ -113,6 +113,7 @@ import {
|
|
|
113
113
|
writeUpPartsDated,
|
|
114
114
|
writeUpPlan,
|
|
115
115
|
} from "./sessions.js";
|
|
116
|
+
import type { ElsewhereListed } from "../core/counterpart-wake-shape.js";
|
|
116
117
|
import type { FolderOn, SessionPhase } from "./sessions.js";
|
|
117
118
|
import { planSpawn, spawnDetached } from "./spawn.js";
|
|
118
119
|
import type { SpawnOutcome, Spawner } from "./spawn.js";
|
|
@@ -365,6 +366,11 @@ export interface PlainLines {
|
|
|
365
366
|
readonly notices: string[];
|
|
366
367
|
/** The records behind them, in the same order — claimed only at delivery. */
|
|
367
368
|
readonly due: PlainReminder[];
|
|
369
|
+
/**
|
|
370
|
+
* What is due and this reader is not told, a closed folder's work (`plainFor`):
|
|
371
|
+
* memory ids, so a turn doesn't hand over as a quiet cue what it held back.
|
|
372
|
+
*/
|
|
373
|
+
readonly held?: readonly string[];
|
|
368
374
|
}
|
|
369
375
|
|
|
370
376
|
/**
|
|
@@ -687,6 +693,16 @@ export class Lifecycle implements HostLifecycle {
|
|
|
687
693
|
};
|
|
688
694
|
}
|
|
689
695
|
|
|
696
|
+
/**
|
|
697
|
+
* WHAT THE WAKE'S ELSEWHERE WOULD LIST WITH ROOM (the `elsewhere` handle): this
|
|
698
|
+
* session's reader, sessions and all (`elsewhereHere`), asked of `exportsFrom`,
|
|
699
|
+
* the setting the door reads.
|
|
700
|
+
*/
|
|
701
|
+
elsewhereListed(input: SessionInput, exportsFrom: ((scope: string) => boolean) | undefined): ElsewhereListed[] {
|
|
702
|
+
const { exportsFrom: _unused, ...here } = this.elsewhereHere(input);
|
|
703
|
+
return this.counterpart.elsewhere({ ...here, ...(exportsFrom === undefined ? {} : { exportsFrom }) });
|
|
704
|
+
}
|
|
705
|
+
|
|
690
706
|
/**
|
|
691
707
|
* A SESSION THAT HAS JUST BEEN HANDED ITS WAKE has heard what the other
|
|
692
708
|
* directories did (2026-10-11): its "Since you started" line counts from
|
|
@@ -935,17 +951,26 @@ export class Lifecycle implements HostLifecycle {
|
|
|
935
951
|
* `claude-code/bin/hook.ts#deliverTurn`) and strips the rest, so a beat is
|
|
936
952
|
* never spent on a line the person did not get. No date (`input.at` absent)
|
|
937
953
|
* means no calendar, and so nothing; the headless nightly run is told nothing
|
|
938
|
-
* (`SessionInput.nightRun`).
|
|
954
|
+
* (`SessionInput.nightRun`). A closed folder's work is held back, whichever road
|
|
955
|
+
* the wake takes (2026-10-30, `Counterpart#plainHeldBack`): not in these lines,
|
|
956
|
+
* not claimed, not spent. The setting is read only when something is due: with
|
|
957
|
+
* no configuration named every folder is on, and one that won't read closes
|
|
958
|
+
* every folder (`writeUpFolders`). Never throws.
|
|
939
959
|
*/
|
|
940
960
|
plainFor(input: SessionInput): PlainLines {
|
|
941
961
|
const none = { context: "", notices: [], due: [] };
|
|
942
962
|
if (input.at === undefined || input.nightRun === true) return none;
|
|
943
963
|
try {
|
|
944
|
-
const
|
|
964
|
+
const all = this.counterpart.plainDueToday({ at: input.at });
|
|
965
|
+
if (all.length === 0) return none;
|
|
966
|
+
const on = this.writeUpFolders();
|
|
967
|
+
const held = on === undefined ? new Set<string>() : this.counterpart.plainHeldBack(all.map((r) => r.memoryId), on, input.scope);
|
|
968
|
+
const due = all.filter((r) => !held.has(r.memoryId));
|
|
945
969
|
return {
|
|
946
970
|
context: due.map((r) => `${plainContextLine(r)}\n`).join(""),
|
|
947
971
|
notices: due.map(plainLine),
|
|
948
972
|
due,
|
|
973
|
+
...(held.size === 0 ? {} : { held: [...held] }),
|
|
949
974
|
};
|
|
950
975
|
} catch {
|
|
951
976
|
return none;
|
|
@@ -107,6 +107,9 @@ export const LOGGED: { readonly names: ReadonlySet<string>; readonly suffixes: r
|
|
|
107
107
|
"adapter.wake.injected",
|
|
108
108
|
"counterpart.self.briefing",
|
|
109
109
|
"counterpart.rebrief",
|
|
110
|
+
// ...and a store with the shape on that took the old road anyway (WK2): its
|
|
111
|
+
// ring dies with the hook, and the row it leaves doesn't say which road.
|
|
112
|
+
"counterpart.wake.shape.declined",
|
|
110
113
|
// The worker's day: the cycle, the retention pass, and its own summary.
|
|
111
114
|
"counterpart.sleep.cycle",
|
|
112
115
|
"runner.retention",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* Pure text functions; the server composes and claims (`server.ts#wakeTool`).
|
|
25
25
|
*/
|
|
26
|
-
import { FRAMING, LEGACY_CONTEXT, LEGACY_FRAMING, collapsedLane } from "../../core/self/briefing.js";
|
|
26
|
+
import { FRAMING, LEGACY_CONTEXT, LEGACY_FRAMING, SHAPED_CONTEXT, collapsedLane } from "../../core/self/briefing.js";
|
|
27
27
|
|
|
28
28
|
/** The session line a claude.ai wake opens with. */
|
|
29
29
|
export function claudeAiSessionLine(session: string): string {
|
|
@@ -43,7 +43,7 @@ const PAGE_END = "(End of my page.)";
|
|
|
43
43
|
*/
|
|
44
44
|
export function chatLanesFirst(text: string): string {
|
|
45
45
|
const lines = text.split("\n");
|
|
46
|
-
const framing = lines.findIndex((l) => l === FRAMING.context || l === LEGACY_CONTEXT);
|
|
46
|
+
const framing = lines.findIndex((l) => l === FRAMING.context || l === LEGACY_CONTEXT || l === SHAPED_CONTEXT);
|
|
47
47
|
if (framing < 0) return text;
|
|
48
48
|
const pageEnd = lines.indexOf(PAGE_END, framing);
|
|
49
49
|
const from = pageEnd < 0 ? framing + 1 : pageEnd + 1;
|
|
@@ -21,7 +21,7 @@ export const SERVER_NAME = "counterparts";
|
|
|
21
21
|
* host decides whether to trust what follows. Read from a constant rather than
|
|
22
22
|
* from disk so the server opens no file to answer its first message.
|
|
23
23
|
*/
|
|
24
|
-
export const SERVER_VERSION = "0.3.
|
|
24
|
+
export const SERVER_VERSION = "0.3.43";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* THE ONE LINE EVERY TOOL ANSWERS WITH when the store on disk is a schema AHEAD
|
|
@@ -62,6 +62,9 @@ import type { Recurrence } from "../../core/time.js";
|
|
|
62
62
|
import type { Counterpart, DepositResult } from "../../core/counterpart.js";
|
|
63
63
|
import { LAST_EXCHANGE_HANDLE, lastExchangeAnswer } from "../../core/handoff/last-exchange.js";
|
|
64
64
|
import { HANDOFFS_HERE_HANDLE } from "../../core/handoff/index.js";
|
|
65
|
+
import { COMING_UP_HANDLE, ELSEWHERE_HANDLE, HANDOFFS_HANDLE } from "../../core/counterpart-wake-shape.js";
|
|
66
|
+
import type { Cue } from "../../core/counterpart-wake-shape.js";
|
|
67
|
+
import { placeWords } from "../../core/handoff/last-here.js";
|
|
65
68
|
import { loadGateState } from "../../core/recall/index.js";
|
|
66
69
|
import type { SemanticSource } from "../../core/recall/index.js";
|
|
67
70
|
import { AUTHOR_DIMENSIONS } from "../../core/remember/index.js";
|
|
@@ -143,6 +146,7 @@ import {
|
|
|
143
146
|
isSessionId,
|
|
144
147
|
latestLiveSession,
|
|
145
148
|
listSessions,
|
|
149
|
+
NON_INTERACTIVE_ENTRYPOINTS,
|
|
146
150
|
manifestVersionOnDisk,
|
|
147
151
|
readSession,
|
|
148
152
|
reflectorDone,
|
|
@@ -2424,9 +2428,22 @@ export class McpServer {
|
|
|
2424
2428
|
}
|
|
2425
2429
|
// THIS FOLDER'S HANDOFFS (WK1, 2026-10-30): the door the wake's line counts
|
|
2426
2430
|
// the rest behind, to expand or retire one, with no bare ids in the wake.
|
|
2427
|
-
|
|
2431
|
+
// `handoffs` is the shaped wake's name for it (WK2, 2026-10-30).
|
|
2432
|
+
if (typeof handle === "string" && (handle.trim().toLowerCase() === HANDOFFS_HERE_HANDLE || handle.trim().toLowerCase() === HANDOFFS_HANDLE) && args["question"] === undefined && args["ids"] === undefined) {
|
|
2428
2433
|
return this.handoffsHereTool();
|
|
2429
2434
|
}
|
|
2435
|
+
// WHAT'S DUE (WK2, 2026-10-30): the door the shaped wake's "Coming up" counts behind.
|
|
2436
|
+
if (typeof handle === "string" && handle.trim().toLowerCase() === COMING_UP_HANDLE && args["question"] === undefined && args["ids"] === undefined) {
|
|
2437
|
+
return this.comingUpTool();
|
|
2438
|
+
}
|
|
2439
|
+
// OTHER FOLDERS, WITH ROOM (2026-10-30): the door the shaped wake's "+N more folders" counts behind.
|
|
2440
|
+
if (typeof handle === "string" && handle.trim().toLowerCase() === ELSEWHERE_HANDLE && args["question"] === undefined && args["ids"] === undefined) {
|
|
2441
|
+
const page = args["page"];
|
|
2442
|
+
if (page !== undefined && (typeof page !== "number" || !Number.isInteger(page) || page < 1)) {
|
|
2443
|
+
return this.refuse("recall", "page-not-a-positive-integer", {});
|
|
2444
|
+
}
|
|
2445
|
+
return this.elsewhereTool(typeof page === "number" ? page : 1);
|
|
2446
|
+
}
|
|
2430
2447
|
// WHAT'S STILL OPEN (2026-10-25): the list "Still open" carries, by the
|
|
2431
2448
|
// handle, or by a facts question that asks for exactly that.
|
|
2432
2449
|
const stillOpenAsked =
|
|
@@ -2575,6 +2592,7 @@ export class McpServer {
|
|
|
2575
2592
|
lastAt: Math.max(r.lastBoundaryAt, r.endedAt ?? 0),
|
|
2576
2593
|
live: isLive(r, this.nowFn(), this.sessionTtlMs),
|
|
2577
2594
|
endedAt: r.endedAt,
|
|
2595
|
+
headless: r.entrypoint !== undefined && NON_INTERACTIVE_ENTRYPOINTS.has(r.entrypoint),
|
|
2578
2596
|
})),
|
|
2579
2597
|
});
|
|
2580
2598
|
this.emit("mcp.recall.lastexchange", undefined, { found: ex !== null });
|
|
@@ -2664,8 +2682,98 @@ export class McpServer {
|
|
|
2664
2682
|
return openCarry(store, store.livedDay(), t.OPEN_CARRY_DAYS, t.OPEN_CARRY_GLIMPSE_TOUCH).notCarried.size;
|
|
2665
2683
|
}
|
|
2666
2684
|
|
|
2685
|
+
/**
|
|
2686
|
+
* `recall` with the handle `coming up` (WK2, 2026-10-30): what's due, by whole
|
|
2687
|
+
* title, for this folder as its wake reads it; other folders' only where the
|
|
2688
|
+
* setting lets them be named, and a closed folder's not even as a count.
|
|
2689
|
+
*/
|
|
2690
|
+
private comingUpTool(): ToolResult {
|
|
2691
|
+
const on = this.folderOn();
|
|
2692
|
+
const closed = this.nightClosed();
|
|
2693
|
+
const list = this.counterpart.comingUp({ scope: this.scope, ...(on === undefined ? {} : { exportsFrom: on }) });
|
|
2694
|
+
const shown = (cs: readonly Cue[]): Record<string, unknown>[] =>
|
|
2695
|
+
cs
|
|
2696
|
+
.filter((c) => !closed.has(c.id))
|
|
2697
|
+
.map((c) => ({
|
|
2698
|
+
id: c.id,
|
|
2699
|
+
title: c.title,
|
|
2700
|
+
...(c.plain ? { text: c.body, plain: true } : {}),
|
|
2701
|
+
...(c.due === null ? {} : { due: c.due }),
|
|
2702
|
+
...(c.every === null ? {} : { every: c.every }),
|
|
2703
|
+
...(c.settles === null ? {} : { settlesWhen: c.settles }),
|
|
2704
|
+
...(c.folder === null ? {} : { folder: placeWords(c.folder) }),
|
|
2705
|
+
}));
|
|
2706
|
+
const today = shown(list.today);
|
|
2707
|
+
const overdue = shown(list.overdue);
|
|
2708
|
+
const later = shown(list.later);
|
|
2709
|
+
const otherFolders = shown(list.otherFolders);
|
|
2710
|
+
const total = today.length + overdue.length + later.length + otherFolders.length;
|
|
2711
|
+
this.emit("mcp.recall.comingup", undefined, { total });
|
|
2712
|
+
return this.result(
|
|
2713
|
+
{
|
|
2714
|
+
path: "handle",
|
|
2715
|
+
reason: "coming-up",
|
|
2716
|
+
handle: COMING_UP_HANDLE,
|
|
2717
|
+
total,
|
|
2718
|
+
today,
|
|
2719
|
+
overdue,
|
|
2720
|
+
later,
|
|
2721
|
+
otherFolders,
|
|
2722
|
+
note:
|
|
2723
|
+
total === 0
|
|
2724
|
+
? "Nothing dated is coming up here."
|
|
2725
|
+
: "What's due: today, then overdue (newest first), then later (soonest first), this folder's and what's about you or the owner; then other folders'. Recall an id to read it whole.",
|
|
2726
|
+
},
|
|
2727
|
+
false,
|
|
2728
|
+
);
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
/**
|
|
2732
|
+
* `recall` with the handle `elsewhere` (2026-10-30): the folders and titles the
|
|
2733
|
+
* wake's Elsewhere would show with room, by its own read (`readElsewhere`): the
|
|
2734
|
+
* same gate, the same window, the same order, this session as its reader. So a
|
|
2735
|
+
* wake's `+N more folders` is what lies past the lines it printed, including
|
|
2736
|
+
* the folders it only counts, listed last with no title. A closed folder is
|
|
2737
|
+
* neither. Reads only, like `coming up`: a ring event alone.
|
|
2738
|
+
*/
|
|
2739
|
+
private elsewhereTool(page: number): ToolResult {
|
|
2740
|
+
const closed = this.nightClosed();
|
|
2741
|
+
const scope = this.scope ?? "";
|
|
2742
|
+
const session = this.session ?? this.hostSession() ?? "";
|
|
2743
|
+
const all = this.lifecycle()
|
|
2744
|
+
.elsewhereListed({ sessionId: session, scope }, this.folderOn())
|
|
2745
|
+
.filter((e) => e.id === null || !closed.has(e.id));
|
|
2746
|
+
const pages = Math.max(1, Math.ceil(all.length / STILL_OPEN_PAGE));
|
|
2747
|
+
const at = Math.min(page, pages);
|
|
2748
|
+
const shown = all.slice((at - 1) * STILL_OPEN_PAGE, at * STILL_OPEN_PAGE);
|
|
2749
|
+
this.emit("mcp.recall.elsewhere", undefined, { total: all.length, page: at, shown: shown.length });
|
|
2750
|
+
return this.result(
|
|
2751
|
+
{
|
|
2752
|
+
path: "handle",
|
|
2753
|
+
reason: "elsewhere",
|
|
2754
|
+
handle: ELSEWHERE_HANDLE,
|
|
2755
|
+
total: all.length,
|
|
2756
|
+
page: at,
|
|
2757
|
+
pages,
|
|
2758
|
+
folders: shown.map((e) => ({
|
|
2759
|
+
folder: e.place,
|
|
2760
|
+
...(e.title === null ? {} : { title: e.title }),
|
|
2761
|
+
...(e.id === null ? {} : { id: e.id }),
|
|
2762
|
+
...(e.age === null ? {} : { age: e.age }),
|
|
2763
|
+
...(e.live ? { live: true } : {}),
|
|
2764
|
+
})),
|
|
2765
|
+
note:
|
|
2766
|
+
all.length === 0
|
|
2767
|
+
? "No other folder has work to name since yesterday."
|
|
2768
|
+
: "Other folders' work since yesterday, as the wake's Elsewhere reads it: folders with a session open first, then newest; each one's newest title. A folder with no title was worked in, with nothing to say by title. Recall an id to read it whole.",
|
|
2769
|
+
},
|
|
2770
|
+
false,
|
|
2771
|
+
);
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2667
2774
|
private handoffsHereTool(): ToolResult {
|
|
2668
2775
|
const listed = this.counterpart.handoffsHere(this.scope ?? "");
|
|
2776
|
+
const after = this.counterpart.sinceNewestHere(this.scope ?? "", this.folderOn());
|
|
2669
2777
|
this.emit("mcp.recall.handoffshere", undefined, { total: listed.length });
|
|
2670
2778
|
return this.result(
|
|
2671
2779
|
{
|
|
@@ -2673,6 +2781,9 @@ export class McpServer {
|
|
|
2673
2781
|
reason: "handoffs-here",
|
|
2674
2782
|
handle: HANDOFFS_HERE_HANDLE,
|
|
2675
2783
|
total: listed.length,
|
|
2784
|
+
// What the wake's `+N` under "Since, here" and "Yesterday here" count (WK2).
|
|
2785
|
+
...(after.since.length === 0 ? {} : { sinceNewest: after.since.map((s) => ({ id: s.id, title: s.title, ...(s.status === null ? {} : { status: s.status }), ...(s.chapter ? { chapter: true } : {}) })) }),
|
|
2786
|
+
...(after.yesterday.length === 0 ? {} : { yesterdayChapters: after.yesterday }),
|
|
2676
2787
|
handoffs: listed.map((h) => ({
|
|
2677
2788
|
id: h.id,
|
|
2678
2789
|
writtenOn: h.writtenOn,
|