counterparts 0.3.37 → 0.3.39
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 +188 -0
- package/README.md +2 -1
- package/docs/QUICKSTART.md +14 -8
- package/docs/module-map.md +4 -2
- package/package.json +9 -1
- package/src/adapters/claude-code/CONTRACT.md +26 -4
- package/src/adapters/claude-code/NOTES.md +116 -0
- package/src/adapters/claude-code/bin/hook.ts +70 -6
- package/src/adapters/claude-code/bin/nightly.ts +2 -0
- package/src/adapters/claude-code/bin/runner.ts +64 -2
- package/src/adapters/claude-code/child-error.ts +211 -0
- package/src/adapters/claude-code/child.ts +29 -10
- package/src/adapters/claude-code/doctor-checkout.ts +4 -2
- package/src/adapters/claude-code/doctor-host.ts +31 -0
- package/src/adapters/claude-code/doctor-meaning.ts +200 -0
- package/src/adapters/claude-code/doctor-modes.ts +115 -0
- package/src/adapters/claude-code/doctor-open.ts +12 -2
- package/src/adapters/claude-code/doctor-self-page.ts +2 -0
- package/src/adapters/claude-code/doctor-write-ups.ts +84 -19
- package/src/adapters/claude-code/doctor.ts +199 -23
- package/src/adapters/claude-code/hooks.ts +162 -11
- package/src/adapters/claude-code/index.ts +15 -0
- package/src/adapters/claude-code/night-catch-up.ts +25 -5
- package/src/adapters/claude-code/night-run.ts +86 -11
- package/src/adapters/claude-code/stale-windows.ts +160 -0
- package/src/adapters/claude-code/standdown.ts +70 -3
- package/src/adapters/cli/INTERFACE-GAPS.md +14 -0
- package/src/adapters/cli/NOTES.md +25 -0
- package/src/adapters/cli/bin/counterparts.ts +4 -2
- package/src/adapters/cli/commands-dashboard.ts +8 -5
- package/src/adapters/cli/commands-install.ts +12 -14
- package/src/adapters/cli/commands.ts +5 -2
- package/src/adapters/cli/coverage.ts +28 -6
- package/src/adapters/cli/help.ts +6 -1
- package/src/adapters/cli/index.ts +2 -0
- package/src/adapters/cli/install.ts +24 -1
- package/src/adapters/cli/mechanisms.ts +31 -8
- package/src/adapters/cli/rollback.ts +3 -3
- package/src/adapters/cli/snapshot.ts +4 -4
- package/src/adapters/cli/ui.ts +10 -0
- package/src/adapters/cli/uninstall.ts +16 -74
- package/src/adapters/cli/wire.ts +227 -33
- package/src/adapters/config.ts +23 -0
- package/src/adapters/dashboard/bin/dashboard.ts +2 -0
- package/src/adapters/dashboard/registries.ts +1 -1
- package/src/adapters/dashboard/web/mechanisms/index.js +2 -0
- package/src/adapters/dashboard/web/mechanisms/schema/index.js +9 -6
- package/src/adapters/dashboard/web/mechanisms/schema/panel.js +14 -0
- package/src/adapters/dashboard/web/narrate.ts +10 -3
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +44 -0
- package/src/adapters/dashboard/web/views/mechanisms.ts +13 -1
- package/src/adapters/expansions.ts +4 -3
- package/src/adapters/fired.ts +29 -0
- package/src/adapters/host-wiring.ts +56 -1
- package/src/adapters/hosts.ts +51 -0
- package/src/adapters/lifecycle.ts +4 -2
- package/src/adapters/mcp/CONTRACT.md +26 -3
- package/src/adapters/mcp/INTERFACE-GAPS.md +11 -0
- package/src/adapters/mcp/NOTES.md +149 -0
- package/src/adapters/mcp/bin/serve.ts +83 -4
- package/src/adapters/mcp/chat-wake.ts +111 -0
- package/src/adapters/mcp/deliberate.ts +5 -2
- package/src/adapters/mcp/index.ts +3 -1
- package/src/adapters/mcp/nights.ts +434 -9
- package/src/adapters/mcp/protocol.ts +11 -2
- package/src/adapters/mcp/server-args.ts +6 -0
- package/src/adapters/mcp/server-options.ts +19 -2
- package/src/adapters/mcp/server-self-tools.ts +23 -8
- package/src/adapters/mcp/server-session-end.ts +5 -3
- package/src/adapters/mcp/server-words.ts +218 -4
- package/src/adapters/mcp/server.ts +524 -56
- package/src/adapters/mcp/tools.ts +266 -12
- package/src/adapters/mechanism-evidence.ts +90 -15
- package/src/adapters/owned-names.ts +105 -0
- package/src/adapters/plugin.ts +34 -7
- package/src/adapters/private-base.ts +175 -0
- package/src/adapters/private-umask.ts +71 -0
- package/src/adapters/remote/CONTRACT.md +75 -0
- package/src/adapters/remote/INTERFACE-GAPS.md +20 -0
- package/src/adapters/remote/NOTES.md +80 -0
- package/src/adapters/remote/bin/serve-http.ts +258 -0
- package/src/adapters/remote/call-log.ts +206 -0
- package/src/adapters/remote/http.ts +500 -0
- package/src/adapters/sessions.ts +121 -7
- package/src/adapters/snapshots.ts +3 -3
- package/src/adapters/spawn.ts +13 -6
- package/src/adapters/update-check.ts +870 -0
- package/src/adapters/update-words.ts +230 -0
- package/src/core/counterpart-deposit.ts +35 -2
- package/src/core/counterpart-sweep.ts +7 -1
- package/src/core/counterpart-types.ts +7 -0
- package/src/core/counterpart.ts +185 -23
- package/src/core/coverage/CONTRACT.md +12 -5
- package/src/core/coverage/NOTES.md +40 -1
- package/src/core/coverage/index.ts +73 -14
- package/src/core/coverage/tunables.ts +15 -1
- package/src/core/dream/CONTRACT.md +47 -9
- package/src/core/dream/NOTES.md +115 -0
- package/src/core/dream/index.ts +51 -6
- package/src/core/dream/recalled.ts +90 -0
- package/src/core/dream/reflect.ts +156 -25
- package/src/core/dream/tunables.ts +61 -0
- package/src/core/handoff/CONTRACT.md +8 -1
- package/src/core/handoff/NOTES.md +52 -0
- package/src/core/handoff/last-here.ts +52 -0
- package/src/core/mint.ts +8 -1
- package/src/core/onboarding.ts +35 -8
- package/src/core/recall/CONTRACT.md +11 -0
- package/src/core/reconsolidation.ts +2 -1
- package/src/core/remember/CONTRACT.md +2 -1
- package/src/core/remember/owes.ts +7 -1
- package/src/core/remember/proposals.ts +41 -1
- package/src/core/schemas/CONTRACT.md +4 -2
- package/src/core/self/INTERFACE-GAPS.md +20 -0
- package/src/core/self/briefing.ts +37 -1
- package/src/core/self/identity.ts +54 -4
- package/src/core/self/index.ts +69 -4
- package/src/core/self/work.ts +20 -0
- package/src/core/self/writer.ts +15 -1
- package/src/core/store/CONTRACT.md +28 -2
- package/src/core/store/NOTES.md +97 -2
- package/src/core/store/db.ts +24 -1
- package/src/core/store/index.ts +28 -2
- package/src/core/store/operational.ts +37 -1
- package/src/core/store/pre-migration.ts +6 -2
- package/src/core/store/private.ts +319 -0
- package/src/core/store/shapes.ts +6 -0
- package/src/core/types.ts +28 -0
- package/tools/install-loop/run.sh +3 -0
|
@@ -52,7 +52,9 @@ import { loadConfig, withEmbedderDefault } from "../../config.js";
|
|
|
52
52
|
import type { AdapterConfig } from "../../config.js";
|
|
53
53
|
import { openEmbedder } from "../../claude-code/embed-client.js";
|
|
54
54
|
import type { LiveEmbedder } from "../../claude-code/embed-client.js";
|
|
55
|
-
import { SESSION_NOTICE_BUDGET_MS, doctorFindings, noticeMessage } from "../../claude-code/doctor.js";
|
|
55
|
+
import { SESSION_NOTICE_BUDGET_MS, doctorFindings, noticeMessage, wakeMeaningLine } from "../../claude-code/doctor.js";
|
|
56
|
+
import { staleWindowsLine } from "../../claude-code/stale-windows.js";
|
|
57
|
+
import { updateLineInputHere, updateNoticeLine, urgentUpdateLine } from "../../update-check.js";
|
|
56
58
|
import { SPAWN_REFUSAL_PREFIX, SPAWN_START_COUNT_KEY, SPAWN_START_DATE_KEY } from "../../lifecycle.js";
|
|
57
59
|
import { WORKER_RUNNER_PATH } from "../../spawn.js";
|
|
58
60
|
import { claudeCodeEnvMarker } from "../../hosts.js";
|
|
@@ -65,10 +67,11 @@ import { serveStdio } from "../stdio.js";
|
|
|
65
67
|
import { SidebarStatusWriter, keepPluginPresence, removeSidebarStatus, sidebarInstalled } from "../../sidebar-status.js";
|
|
66
68
|
import { stoodDownServer } from "../stood-down.js";
|
|
67
69
|
import { noteNpmLive, npmWiringForGate } from "../../npm-live.js";
|
|
68
|
-
import { installedVersion } from "../../sessions.js";
|
|
70
|
+
import { installedVersion, manifestVersionOnDisk } from "../../sessions.js";
|
|
69
71
|
import { PLUGIN_ROOT_ENV, ensureFirstRun, installRoute, mcpGate, pluginOrigin, runningAsPlugin } from "../../plugin.js";
|
|
70
72
|
import { DATA_DIR_ENV, describeGuardRefusal } from "../../../core/store/index.js";
|
|
71
73
|
import { BINARY, scriptArgs } from "../../runtime.js";
|
|
74
|
+
import { usePrivateUmask } from "../../private-umask.js";
|
|
72
75
|
import type { Binary } from "../../runtime.js";
|
|
73
76
|
import { OBSERVER_ENV, observerFromEnv, unreadableStanceLine } from "../../stance-env.js";
|
|
74
77
|
|
|
@@ -243,6 +246,78 @@ export function desktopDoctorNotice(input: {
|
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
248
|
|
|
249
|
+
/**
|
|
250
|
+
* WHAT A HOOKLESS `wake` CARRIES IN ITS NOTICE SLOT: doctor's red line
|
|
251
|
+
* (`desktopDoctorNotice`) and — when search by meaning is on and cannot run —
|
|
252
|
+
* the same line a Claude Code session start carries
|
|
253
|
+
* (`claude-code/doctor-meaning.ts#wakeMeaningLine`), with this copy's route.
|
|
254
|
+
* Null when neither has anything to say. Never throws. A night's own wake
|
|
255
|
+
* (`night`) carries no meaning line: no person reads it, and the `stopped`
|
|
256
|
+
* line's once-a-day would be spent on nobody. Since U1a it carries the
|
|
257
|
+
* older-windows line too (`claude-code/stale-windows.ts`), between the two.
|
|
258
|
+
*/
|
|
259
|
+
export function desktopWakeNotice(input: {
|
|
260
|
+
store: Store;
|
|
261
|
+
config: AdapterConfig;
|
|
262
|
+
configPath: string;
|
|
263
|
+
today: string;
|
|
264
|
+
night?: boolean;
|
|
265
|
+
env?: Record<string, string | undefined>;
|
|
266
|
+
/** This server's pid, whose own record is not an older window; absent, this process's. */
|
|
267
|
+
selfPid?: number;
|
|
268
|
+
/** The home Claude Code's records are read under; absent, this process's. */
|
|
269
|
+
home?: string;
|
|
270
|
+
/** The package version on disk now; absent, `sessions.ts#manifestVersionOnDisk`. */
|
|
271
|
+
onDisk?: () => string | null;
|
|
272
|
+
}): string | null {
|
|
273
|
+
let meaning: string | null = null;
|
|
274
|
+
let stale: string | null = null;
|
|
275
|
+
let urgent: string | null = null;
|
|
276
|
+
let update: string | null = null;
|
|
277
|
+
try {
|
|
278
|
+
const env = input.env ?? process.env;
|
|
279
|
+
meaning =
|
|
280
|
+
input.night === true
|
|
281
|
+
? null
|
|
282
|
+
: wakeMeaningLine({ config: input.config, store: input.store, install: installRoute(env), env, today: input.today });
|
|
283
|
+
// OLDER WINDOWS AFTER AN UPGRADE (U1a, `claude-code/stale-windows.ts`):
|
|
284
|
+
// the same once-per-store-version line a Claude Code start carries, above
|
|
285
|
+
// W1's, and never on a night's own wake. A window whose record does not
|
|
286
|
+
// say its route gets both routes' steps: this server is Desktop's (npm),
|
|
287
|
+
// and says nothing about how those windows came (review of #666).
|
|
288
|
+
stale =
|
|
289
|
+
input.night === true
|
|
290
|
+
? null
|
|
291
|
+
: (staleWindowsLine({ store: input.store, fallback: { route: "either", codeTab: false }, now: Date.now(), selfPid: input.selfPid ?? process.pid })?.line ?? null);
|
|
292
|
+
// UPDATES (U1b, `adapters/update-check.ts`): the same lines a Claude Code
|
|
293
|
+
// start carries, in the same order and under the same cap of three
|
|
294
|
+
// maintenance lines — never on a night's own wake.
|
|
295
|
+
// DESKTOP'S SERVER LIVES AS LONG AS THE APP (review of #672): the version
|
|
296
|
+
// it loaded is not necessarily the one installed now. When the package on
|
|
297
|
+
// disk differs from this process's, its own "was updated" line
|
|
298
|
+
// (`wakeUpdateLine`) is the one to say, and an update line would tell the
|
|
299
|
+
// person to install what they already have: none is said.
|
|
300
|
+
const onDisk = (input.onDisk ?? manifestVersionOnDisk)();
|
|
301
|
+
if (input.night !== true && onDisk === installedVersion()) {
|
|
302
|
+
const lineInput = updateLineInputHere({
|
|
303
|
+
store: input.store,
|
|
304
|
+
configPath: input.configPath,
|
|
305
|
+
config: input.config,
|
|
306
|
+
route: installRoute(env),
|
|
307
|
+
today: input.today,
|
|
308
|
+
env,
|
|
309
|
+
home: input.home ?? homedir(),
|
|
310
|
+
});
|
|
311
|
+
urgent = urgentUpdateLine(lineInput);
|
|
312
|
+
if ([stale, urgent, meaning].filter((l) => l !== null).length < 3) update = updateNoticeLine({ ...lineInput, urgentSaid: urgent !== null });
|
|
313
|
+
}
|
|
314
|
+
} catch {
|
|
315
|
+
meaning = null;
|
|
316
|
+
}
|
|
317
|
+
const lines = [desktopDoctorNotice(input), stale, urgent, meaning, update].filter((l): l is string => l !== null);
|
|
318
|
+
return lines.length === 0 ? null : lines.join("\n");
|
|
319
|
+
}
|
|
320
|
+
|
|
246
321
|
/**
|
|
247
322
|
* Which configuration this server will read, and which rule chose it. Exported
|
|
248
323
|
* and injectable for the same reason `launchOptions` is: the rule is provable
|
|
@@ -445,13 +520,16 @@ async function main(): Promise<void> {
|
|
|
445
520
|
args: scriptArgs(WORKER_RUNNER_PATH),
|
|
446
521
|
},
|
|
447
522
|
// Called only from a `wake`, long after `server` below is assigned.
|
|
448
|
-
|
|
523
|
+
// Doctor's red line, and the line for search by meaning that cannot run
|
|
524
|
+
// (2026-10-27, W1), each when it has something to say.
|
|
525
|
+
wakeNotice: ({ night }) => {
|
|
449
526
|
const store = server.counterpart.store;
|
|
450
|
-
return
|
|
527
|
+
return desktopWakeNotice({
|
|
451
528
|
store,
|
|
452
529
|
config,
|
|
453
530
|
configPath: choice.path,
|
|
454
531
|
today: localDate(Date.now(), store.zone()),
|
|
532
|
+
night,
|
|
455
533
|
});
|
|
456
534
|
},
|
|
457
535
|
});
|
|
@@ -523,6 +601,7 @@ export function isEntryPoint(argv1: string | undefined, url: string, binary: Bin
|
|
|
523
601
|
/** Run the server until stdin closes — what this file does as a script, and
|
|
524
602
|
* what the single binary's `mcp` mode calls. */
|
|
525
603
|
export function start(): void {
|
|
604
|
+
usePrivateUmask();
|
|
526
605
|
void main().then(
|
|
527
606
|
// `process.exitCode` is 1 when the launch refused a named configuration it
|
|
528
607
|
// could not honour; every other path ends 0.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE CLAUDE.AI WAKE'S SHAPE (2026-10-26, OL1b item 2; lightly held).
|
|
3
|
+
*
|
|
4
|
+
* claude.ai's `wake` is the same composition as every host's — the published
|
|
5
|
+
* wake assembled for this moment, the clock, today's plain reminders — laid
|
|
6
|
+
* out for a chat on the web, where the model reads it once before a reply and
|
|
7
|
+
* the person is waiting:
|
|
8
|
+
*
|
|
9
|
+
* 1. ONE SHORT SESSION LINE. Desktop's head names four tools by name;
|
|
10
|
+
* claude.ai's says once to pass the id on every later call.
|
|
11
|
+
* 2. WHAT IS FOR THE PERSON FIRST: the morning share (a slot, empty until
|
|
12
|
+
* the share carry for hookless hosts lands — OL1a owns that rule), then
|
|
13
|
+
* the clock and the plain reminders due today, then the wake with its
|
|
14
|
+
* "Coming up" and "Still open" lanes moved up to just under the framing
|
|
15
|
+
* line (`chatLanesFirst`). Nothing is reworded, cut or added: the lanes
|
|
16
|
+
* move whole, and every other line keeps its place.
|
|
17
|
+
* 3. NO DREAM LINE. On this host the night is the person's own routine
|
|
18
|
+
* (`dream` launch from a scheduled task); the day's dream ask, relayed
|
|
19
|
+
* in a chat, read as "say dream if you want" (trial, 2026-10-26).
|
|
20
|
+
* 4. "THE SAME YOU" ONLY WHEN IT IS TRUE (`sameYouLine`): one line naming
|
|
21
|
+
* the hosts that share this store. None does yet — a claude.ai store is
|
|
22
|
+
* its own — so the server hands it nothing and the line is never printed.
|
|
23
|
+
*
|
|
24
|
+
* Pure text functions; the server composes and claims (`server.ts#wakeTool`).
|
|
25
|
+
*/
|
|
26
|
+
import { FRAMING, LEGACY_CONTEXT, LEGACY_FRAMING, collapsedLane } from "../../core/self/briefing.js";
|
|
27
|
+
|
|
28
|
+
/** The session line a claude.ai wake opens with. */
|
|
29
|
+
export function claudeAiSessionLine(session: string): string {
|
|
30
|
+
return `Counterparts session ${session}: pass it as \`session\` on every later Counterparts call in this conversation.`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The page's own last line (`core/self`): a lane heading inside the page is not a lane. */
|
|
34
|
+
const PAGE_END = "(End of my page.)";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* "Coming up" and then "Still open", each moved whole to just under the
|
|
38
|
+
* framing line — in full, or collapsed to its one counting line. A lane is
|
|
39
|
+
* its heading and every line after it up to the next blank line (lanes hold
|
|
40
|
+
* no blank line; the page can, so headings are looked
|
|
41
|
+
* for after the page's end line). A wake without the framing line, or without
|
|
42
|
+
* either lane, comes back unchanged. Pure.
|
|
43
|
+
*/
|
|
44
|
+
export function chatLanesFirst(text: string): string {
|
|
45
|
+
const lines = text.split("\n");
|
|
46
|
+
const framing = lines.findIndex((l) => l === FRAMING.context || l === LEGACY_CONTEXT);
|
|
47
|
+
if (framing < 0) return text;
|
|
48
|
+
const pageEnd = lines.indexOf(PAGE_END, framing);
|
|
49
|
+
const from = pageEnd < 0 ? framing + 1 : pageEnd + 1;
|
|
50
|
+
const blocks: string[][] = [];
|
|
51
|
+
// A lane the budget collapsed to its one line ("Coming up: 1 — none due
|
|
52
|
+
// today, 1 overdue; recall ids: …") moves too: it is still the lane.
|
|
53
|
+
const lanes = [
|
|
54
|
+
{ lane: "horizon", headings: [FRAMING.horizon, LEGACY_FRAMING.horizon] as readonly string[] },
|
|
55
|
+
{ lane: "threads", headings: [FRAMING.threads] as readonly string[] },
|
|
56
|
+
] as const;
|
|
57
|
+
for (const { lane, headings } of lanes) {
|
|
58
|
+
const at = lines.findIndex((l, i) => i >= from && (headings.includes(l) || collapsedLane(l) === lane) && lines[i - 1] === "");
|
|
59
|
+
if (at < 0) continue;
|
|
60
|
+
let end = at + 1;
|
|
61
|
+
while (end < lines.length && lines[end] !== "") end += 1;
|
|
62
|
+
blocks.push(lines.slice(at, end));
|
|
63
|
+
// Out, with the blank line after it, so no double blank is left behind.
|
|
64
|
+
lines.splice(at, end - at + (lines[end] === "" ? 1 : 0));
|
|
65
|
+
}
|
|
66
|
+
if (blocks.length === 0) return text;
|
|
67
|
+
const moved = blocks.flatMap((b) => [...b, ""]);
|
|
68
|
+
// Under the framing line: its blank line, then the lanes, then what was first.
|
|
69
|
+
const head = lines.slice(0, framing + 1);
|
|
70
|
+
const rest = lines.slice(framing + 1);
|
|
71
|
+
const restStart = rest[0] === "" ? rest.slice(1) : rest;
|
|
72
|
+
return [...head, "", ...moved, ...restStart].join("\n");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* THE SEAM FOR "ONE ME" (the online plan, stage 3): the line that says this is
|
|
77
|
+
* the same counterpart who works with the owner elsewhere, named by the hosts
|
|
78
|
+
* that share this store. Null for none — the case today, so nothing prints.
|
|
79
|
+
*/
|
|
80
|
+
export function sameYouLine(owner: string | null, sharedWith: readonly string[]): string | null {
|
|
81
|
+
if (sharedWith.length === 0) return null;
|
|
82
|
+
const who = owner ?? "them";
|
|
83
|
+
return `You are the same you who works with ${who} in ${sharedWith.join(" and ")}: one memory.`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** What a claude.ai wake is made of, in the order it is said. */
|
|
87
|
+
export interface ClaudeAiWakeParts {
|
|
88
|
+
readonly session: string;
|
|
89
|
+
/** The morning share, carried (OL1a's): empty until that lands. */
|
|
90
|
+
readonly share: readonly string[];
|
|
91
|
+
/** The clock, the tag line when it rides apart, and today's plain reminders. */
|
|
92
|
+
readonly lead: string;
|
|
93
|
+
/** The wake itself, as composed. */
|
|
94
|
+
readonly wake: string;
|
|
95
|
+
readonly sameYou: string | null;
|
|
96
|
+
readonly notices: readonly string[];
|
|
97
|
+
readonly meet: string | null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** The claude.ai wake, laid out. Pure. */
|
|
101
|
+
export function claudeAiWakeText(p: ClaudeAiWakeParts): string {
|
|
102
|
+
const parts = [
|
|
103
|
+
claudeAiSessionLine(p.session),
|
|
104
|
+
...(p.sameYou === null ? [] : [p.sameYou]),
|
|
105
|
+
...(p.share.length === 0 ? [] : [p.share.join("\n")]),
|
|
106
|
+
`${p.lead}\n${chatLanesFirst(p.wake)}`.trimEnd(),
|
|
107
|
+
...(p.notices.length === 0 ? [] : [p.notices.join("\n")]),
|
|
108
|
+
...(p.meet === null ? [] : [p.meet]),
|
|
109
|
+
];
|
|
110
|
+
return parts.join("\n\n");
|
|
111
|
+
}
|
|
@@ -380,7 +380,8 @@ export function deliberateRecall(
|
|
|
380
380
|
if ([hasHandle, hasQuestion, hasIds].filter(Boolean).length > 1) {
|
|
381
381
|
return { path: "none", reason: "both-arguments", ...EMPTY, storeSize: liveCount(counterpart) };
|
|
382
382
|
}
|
|
383
|
-
|
|
383
|
+
// A night asked for alone, by its handle, comes whole (2026-10-26, OL1b).
|
|
384
|
+
if (hasHandle) return expandHandle(counterpart, (input.handle as string).trim(), opts, { wholeNight: true });
|
|
384
385
|
if (hasIds) return expandIds(counterpart, askedIds, opts);
|
|
385
386
|
// A question is a MODE's (`facts.ts`, `meaning.ts`), never this file's.
|
|
386
387
|
if (hasQuestion) return { path: "none", reason: "question-needs-mode", ...EMPTY, storeSize: liveCount(counterpart) };
|
|
@@ -405,6 +406,8 @@ export function expandHandle(
|
|
|
405
406
|
counterpart: Counterpart,
|
|
406
407
|
handle: string,
|
|
407
408
|
opts: DeliberateOptions,
|
|
409
|
+
/** `wholeNight`: a night's journal and entry uncut (the handle path); among `ids`, a summary. */
|
|
410
|
+
how: { readonly wholeNight?: boolean } = {},
|
|
408
411
|
): DeliberateResult {
|
|
409
412
|
const store = counterpart.store;
|
|
410
413
|
const storeSize = store.list({ archived: false }).length;
|
|
@@ -429,7 +432,7 @@ export function expandHandle(
|
|
|
429
432
|
// like every address (`nights.ts`).
|
|
430
433
|
const night = nightKindOf(handle);
|
|
431
434
|
if (night !== null) {
|
|
432
|
-
const got = readNight(counterpart, handle);
|
|
435
|
+
const got = readNight(counterpart, handle, { whole: how.wholeNight === true });
|
|
433
436
|
if (!got.ok) return { ...base, reason: got.reason, memories: [], considered: 0, nightAsked: night };
|
|
434
437
|
return { ...base, reason: "expanded", memories: [], considered: 1, nights: [got.night] };
|
|
435
438
|
}
|
|
@@ -21,7 +21,7 @@ export {
|
|
|
21
21
|
} from "./protocol.js";
|
|
22
22
|
export type { ErrorResponse, Id, ParsedLine, Request, Response, SuccessResponse } from "./protocol.js";
|
|
23
23
|
|
|
24
|
-
export { DESKTOP_TOOLS, TOOLS, TOOL_ALIASES, TOOL_NAMES, WAKE, canonicalToolName, renderDescription, toolDefinitions, toolSpec } from "./tools.js";
|
|
24
|
+
export { CLAUDE_AI_TOOLS, CLAUDE_AI_WAKE, DESKTOP_TOOLS, TOOLS, TOOL_ALIASES, TOOL_NAMES, WAKE, canonicalToolName, renderDescription, toolDefinitions, toolListFor, toolSpec } from "./tools.js";
|
|
25
25
|
export type { Privilege, ToolName, ToolSpec } from "./tools.js";
|
|
26
26
|
|
|
27
27
|
export {
|
|
@@ -161,9 +161,11 @@ export function openServer(opts: OpenServerOptions = {}): McpServer {
|
|
|
161
161
|
// Which host, and what Claude Desktop's `wake` needs (2026-09-30) — carried
|
|
162
162
|
// through unchanged; the server decides what to do with them.
|
|
163
163
|
...(opts.host === undefined ? {} : { host: opts.host }),
|
|
164
|
+
...(opts.canary === undefined ? {} : { canary: opts.canary }),
|
|
164
165
|
...(opts.lifecycle === undefined ? {} : { lifecycle: opts.lifecycle }),
|
|
165
166
|
...(opts.wakeNotice === undefined ? {} : { wakeNotice: opts.wakeNotice }),
|
|
166
167
|
...(opts.manifestVersion === undefined ? {} : { manifestVersion: opts.manifestVersion }),
|
|
168
|
+
...(opts.pluginVersion === undefined ? {} : { pluginVersion: opts.pluginVersion }),
|
|
167
169
|
...(opts.env === undefined ? {} : { env: opts.env }),
|
|
168
170
|
...(opts.launchObserver === undefined ? {} : { launchObserver: opts.launchObserver }),
|
|
169
171
|
...(opts.onEvent === undefined ? {} : { onEvent: opts.onEvent }),
|