notesoup 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/{src/claude → plugins/claude/src}/helper.js +7 -7
- package/dist/{src/claude → plugins/claude/src}/history.d.ts +1 -1
- package/dist/{src/claude → plugins/claude/src}/history.js +1 -1
- package/dist/plugins/claude/src/text.d.ts +6 -0
- package/dist/plugins/claude/src/text.js +7 -0
- package/dist/{src/claude → plugins/claude/src}/thresholds.js +3 -3
- package/dist/{src → plugins}/dsh/budget.js +1 -1
- package/dist/{src → plugins}/dsh/engine.d.ts +1 -1
- package/dist/{src → plugins}/dsh/engine.js +1 -1
- package/dist/{src → plugins}/dsh/history.d.ts +1 -1
- package/dist/{src → plugins}/dsh/history.js +1 -1
- package/dist/{src → plugins}/dsh/index.js +1 -1
- package/dist/{src → plugins}/dsh/tools.js +3 -3
- package/dist/{src → plugins}/dsh/window.d.ts +1 -1
- package/dist/{src → plugins}/dsh/window.js +5 -5
- package/dist/{src → plugins}/pi/boot.d.ts +1 -1
- package/dist/{src → plugins}/pi/boot.js +5 -4
- package/dist/{src → plugins}/pi/budget.js +4 -4
- package/dist/{src → plugins}/pi/dream/cli.d.ts +1 -1
- package/dist/{src → plugins}/pi/dream/cli.js +6 -6
- package/dist/{src → plugins}/pi/dream/runner.d.ts +1 -1
- package/dist/{src → plugins}/pi/dream/runner.js +3 -3
- package/dist/{src → plugins}/pi/dream/settings.d.ts +1 -1
- package/dist/{src → plugins}/pi/dream/settings.js +2 -2
- package/dist/{src → plugins}/pi/history-tools.js +1 -1
- package/dist/{src → plugins}/pi/history.d.ts +1 -1
- package/dist/{src → plugins}/pi/history.js +1 -1
- package/dist/plugins/pi/index.d.ts +1 -0
- package/dist/plugins/pi/index.js +1 -0
- package/dist/{src → plugins}/pi/notes/adapter.d.ts +1 -1
- package/dist/{src → plugins}/pi/notes/adapter.js +1 -1
- package/dist/{src → plugins}/pi/notes/tools.js +1 -1
- package/dist/{src → plugins}/pi/reset/artifacts.d.ts +1 -1
- package/dist/{src → plugins}/pi/reset/artifacts.js +1 -1
- package/dist/{src → plugins}/pi/reset/lifecycle.d.ts +1 -1
- package/dist/{src → plugins}/pi/reset/lifecycle.js +1 -1
- package/dist/{src → plugins}/pi/runtime.js +2 -2
- package/dist/plugins/pi/text.d.ts +23 -0
- package/dist/plugins/pi/text.js +30 -0
- package/dist/{src → plugins}/pi/thresholds.d.ts +1 -1
- package/dist/{src → plugins}/pi/thresholds.js +4 -4
- package/dist/{src → plugins}/pi/tool-result.d.ts +1 -1
- package/dist/{src → plugins}/pi/tool-result.js +1 -1
- package/dist/{src → plugins}/pi/window.d.ts +1 -1
- package/dist/src/boot/text.d.ts +4 -13
- package/dist/src/boot/text.js +1 -11
- package/dist/src/budget/policy.d.ts +2 -3
- package/dist/src/budget/policy.js +1 -1
- package/dist/src/budget/text.d.ts +1 -12
- package/dist/src/budget/text.js +2 -24
- package/dist/src/dream/settings.d.ts +1 -2
- package/dist/src/dream/settings.js +4 -2
- package/dist/src/index.d.ts +29 -1
- package/dist/src/index.js +26 -1
- package/dist/src/notes/address.d.ts +5 -4
- package/dist/src/notes/address.js +13 -7
- package/dist/src/notes/identity.js +3 -7
- package/dist/src/notes/paths.d.ts +4 -2
- package/dist/src/notes/paths.js +11 -6
- package/dist/src/notes/store.d.ts +4 -1
- package/dist/src/notes/store.js +66 -34
- package/dist/src/settings.d.ts +7 -16
- package/dist/src/settings.js +7 -10
- package/dist/src/tools/notes.d.ts +5 -5
- package/dist/src/tools/notes.js +5 -4
- package/dist/test/agent-loop.test.js +5 -4
- package/dist/test/boot.integration.test.js +5 -5
- package/dist/test/budget-settings.integration.test.js +1 -1
- package/dist/test/claude-history.test.js +2 -2
- package/dist/test/claude-mod.test.js +12 -11
- package/dist/test/claude-validation.test.js +3 -3
- package/dist/test/dependencies.test.js +52 -44
- package/dist/test/doctor.test.js +1 -1
- package/dist/test/dream-skill.test.js +4 -4
- package/dist/test/dream.test.js +2 -2
- package/dist/test/dsh-cli.test.js +2 -2
- package/dist/test/dsh-compaction-parity.test.js +1 -1
- package/dist/test/dsh.test.js +4 -4
- package/dist/test/helpers/dependency-graph.js +9 -7
- package/dist/test/helpers/dsh.d.ts +1 -1
- package/dist/test/helpers/dsh.js +2 -2
- package/dist/test/helpers/extension.js +6 -5
- package/dist/test/helpers/notes.js +1 -1
- package/dist/test/model-facing-text.test.js +4 -2
- package/dist/test/notes-query-homes.test.d.ts +1 -0
- package/dist/test/notes-query-homes.test.js +161 -0
- package/dist/test/notes.integration.test.js +3 -2
- package/dist/test/notes.test.js +1 -1
- package/dist/test/reset-lifecycle.test.js +8 -7
- package/docs/architecture.md +21 -18
- package/docs/claude-code-mod.md +3 -3
- package/docs/dsh.md +1 -1
- package/docs/dsh.profile.patch.yml +1 -1
- package/docs/notes-library.md +17 -10
- package/docs/reset-lifecycle.md +1 -1
- package/docs/sdk-integration.md +2 -2
- package/package.json +17 -13
- package/{mods/notesoup → plugins/claude}/.claude-plugin/plugin.json +1 -1
- package/{mods/notesoup → plugins/claude}/dist/claude/helper.js +565 -540
- package/{mods/notesoup → plugins/claude}/skills/memory/SKILL.md +3 -0
- package/{src/claude → plugins/claude/src}/helper.ts +10 -9
- package/{src/claude → plugins/claude/src}/history.ts +1 -1
- package/plugins/claude/src/text.ts +10 -0
- package/{src/claude → plugins/claude/src}/thresholds.ts +3 -3
- package/{src → plugins}/dsh/budget.ts +1 -1
- package/{src → plugins}/dsh/engine.ts +1 -1
- package/{src → plugins}/dsh/history.ts +1 -1
- package/{src → plugins}/dsh/index.ts +1 -1
- package/{src → plugins}/dsh/tools.ts +3 -3
- package/{src → plugins}/dsh/window.ts +5 -5
- package/{src → plugins}/pi/boot.ts +5 -4
- package/{src → plugins}/pi/budget.ts +4 -4
- package/{src → plugins}/pi/dream/cli.ts +8 -8
- package/{src → plugins}/pi/dream/runner.ts +4 -4
- package/{src → plugins}/pi/dream/settings.ts +2 -2
- package/{src → plugins}/pi/history-tools.ts +1 -1
- package/{src → plugins}/pi/history.ts +1 -1
- package/plugins/pi/index.ts +1 -0
- package/{src → plugins}/pi/notes/adapter.ts +1 -1
- package/{src → plugins}/pi/notes/tools.ts +2 -2
- package/{src → plugins}/pi/reset/artifacts.ts +1 -1
- package/{src → plugins}/pi/reset/lifecycle.ts +2 -2
- package/{src → plugins}/pi/runtime.ts +2 -2
- package/plugins/pi/text.ts +35 -0
- package/{src → plugins}/pi/thresholds.ts +4 -4
- package/{src → plugins}/pi/tool-result.ts +1 -1
- package/{src → plugins}/pi/window.ts +1 -1
- package/skills/memory/SKILL.md +3 -0
- package/src/boot/text.ts +5 -15
- package/src/budget/policy.ts +3 -3
- package/src/budget/text.ts +2 -30
- package/src/dream/settings.ts +6 -3
- package/src/index.ts +52 -1
- package/src/notes/address.ts +12 -8
- package/src/notes/identity.ts +2 -8
- package/src/notes/paths.ts +12 -6
- package/src/notes/store.ts +62 -29
- package/src/settings.ts +8 -24
- package/src/tools/notes.ts +5 -4
- /package/dist/{src/claude → plugins/claude/src}/helper.d.ts +0 -0
- /package/dist/{src/claude → plugins/claude/src}/thresholds.d.ts +0 -0
- /package/dist/{src → plugins}/dsh/budget.d.ts +0 -0
- /package/dist/{src → plugins}/dsh/index.d.ts +0 -0
- /package/dist/{src → plugins}/dsh/tools.d.ts +0 -0
- /package/dist/{src → plugins}/pi/anchored.d.ts +0 -0
- /package/dist/{src → plugins}/pi/anchored.js +0 -0
- /package/dist/{src → plugins}/pi/budget.d.ts +0 -0
- /package/dist/{src → plugins}/pi/entries.d.ts +0 -0
- /package/dist/{src → plugins}/pi/entries.js +0 -0
- /package/dist/{src → plugins}/pi/estimate.d.ts +0 -0
- /package/dist/{src → plugins}/pi/estimate.js +0 -0
- /package/dist/{src → plugins}/pi/extension.d.ts +0 -0
- /package/dist/{src → plugins}/pi/extension.js +0 -0
- /package/dist/{src → plugins}/pi/history-tools.d.ts +0 -0
- /package/dist/{src → plugins}/pi/notes/tools.d.ts +0 -0
- /package/dist/{src → plugins}/pi/reset/committed.d.ts +0 -0
- /package/dist/{src → plugins}/pi/reset/committed.js +0 -0
- /package/dist/{src → plugins}/pi/runtime.d.ts +0 -0
- /package/dist/{src → plugins}/pi/session-reader.d.ts +0 -0
- /package/dist/{src → plugins}/pi/session-reader.js +0 -0
- /package/dist/{src → plugins}/pi/window.js +0 -0
- /package/{mods/notesoup → plugins/claude}/hooks/hooks.json +0 -0
- /package/{mods/notesoup → plugins/claude}/hooks/register.ts +0 -0
- /package/{mods/notesoup → plugins/claude}/playbook.md +0 -0
- /package/{mods/notesoup → plugins/claude}/skills/dream/SKILL.md +0 -0
- /package/{src → plugins}/pi/anchored.ts +0 -0
- /package/{src → plugins}/pi/entries.ts +0 -0
- /package/{src → plugins}/pi/estimate.ts +0 -0
- /package/{src → plugins}/pi/extension.ts +0 -0
- /package/{src → plugins}/pi/reset/committed.ts +0 -0
- /package/{src → plugins}/pi/session-reader.ts +0 -0
package/README.md
CHANGED
|
@@ -87,8 +87,20 @@ npm test # build from a clean dist, then run the suite
|
|
|
87
87
|
npm run typecheck
|
|
88
88
|
git diff --check
|
|
89
89
|
node scripts/check-notes-package.mjs # optional built /notes CRUD smoke; no install
|
|
90
|
+
npx tsx scripts/boot-smoke.mts [cwd] # optional live boot render against the real notes homes
|
|
90
91
|
```
|
|
91
92
|
|
|
93
|
+
The repository splits host-neutral code from host plugins:
|
|
94
|
+
|
|
95
|
+
| Path | What it is |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `src/` | The core: notes library, boot snapshot/renderer, history projection, budget policy and the shared tool operations. It never imports an SDK or a plugin. |
|
|
98
|
+
| `plugins/pi/` | The Pi extension (`plugins/pi/index.ts` is what `pi.extensions` loads from source) and the `dream` CLI. |
|
|
99
|
+
| `plugins/claude/` | The self-contained Claude Code plugin (`.claude-plugin/`, `hooks/`, bundled `dist/claude/helper.js`, skills and playbook), with its adapter sources in `plugins/claude/src/`. |
|
|
100
|
+
| `plugins/dsh/` | The Cordis rows published as `notesoup/dsh` and `notesoup/dsh/engine`. |
|
|
101
|
+
|
|
102
|
+
Each plugin owns its host's words — Pi's pre-reset hints and `last_word` nudge live in `plugins/pi/text.ts`, Claude's reset and missing-history prose in `plugins/claude/src/text.ts` — while the shared boot, protocol and warning bodies stay in `src/boot/text.ts` and `src/budget/text.ts`.
|
|
103
|
+
|
|
92
104
|
The harness runs against the real installed Pi `SessionManager`/`SettingsManager` in temporary directories with fake credentials — no model or network calls, and the real `~/.pi` is never touched. See [CONTRIBUTING.md](CONTRIBUTING.md) for ownership and verification rules.
|
|
93
105
|
|
|
94
106
|
## License
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
import { Check, Errors } from "typebox/value";
|
|
4
|
-
import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "
|
|
5
|
-
import { historyList, historyRead, historyWindows } from "
|
|
4
|
+
import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../../../src/tools/notes.js";
|
|
5
|
+
import { historyList, historyRead, historyWindows } from "../../../src/tools/history.js";
|
|
6
6
|
import { readClaudeHistory } from "./history.js";
|
|
7
|
-
import { loadNotesSnapshot } from "
|
|
8
|
-
import { renderBootBlock } from "
|
|
9
|
-
import {
|
|
10
|
-
import { CLAUDE_WARNING_PROMPT,
|
|
7
|
+
import { loadNotesSnapshot } from "../../../src/boot/snapshot.js";
|
|
8
|
+
import { renderBootBlock } from "../../../src/boot/render.js";
|
|
9
|
+
import { selectContinuation } from "../../../src/budget/text.js";
|
|
10
|
+
import { CLAUDE_HISTORY_UNAVAILABLE_SENTENCE, CLAUDE_WARNING_PROMPT, CLAUDE_WIPE_SENTENCE } from "./text.js";
|
|
11
11
|
import { resolveClaudeLimits } from "./thresholds.js";
|
|
12
|
-
import { projectKey, snapshotNotesIdentity } from "
|
|
12
|
+
import { projectKey, snapshotNotesIdentity } from "../../../src/notes/index.js";
|
|
13
13
|
const MAX_REQUEST_BYTES = 512 * 1024;
|
|
14
14
|
const MAX_RESPONSE_BYTES = 1024 * 1024;
|
|
15
15
|
function identity(input) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Claude's persisted main transcript -> the shared history projection. No inference-context API. */
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
|
-
import { contentText, projectHistory } from "
|
|
4
|
+
import { contentText, projectHistory } from "../../../src/history/history.js";
|
|
5
5
|
const METADATA = new Set([
|
|
6
6
|
"queue-operation", "last-prompt", "atis-latch", "mode", "permission-mode", "file-history-snapshot", "cost-state",
|
|
7
7
|
"summary", "custom-title", "agent-name", "agent-color", "tag", "session-title", "progress",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Claude has no model-facing reset tool: the model ends its turn and the human runs the command. */
|
|
2
|
+
export declare const CLAUDE_WIPE_SENTENCE = "If this feels like the right moment, end your turn and ask the human to run `/fresh-window`.";
|
|
3
|
+
/** Claude's boot says history is missing rather than naming tools it cannot serve. */
|
|
4
|
+
export declare const CLAUDE_HISTORY_UNAVAILABLE_SENTENCE = "History isn't available in this Claude session: no main transcript_path was supplied. Keep essential state in notes; don't pretend those notes are the missing transcript.";
|
|
5
|
+
/** Claude's variant: the mod resets after the turn, so the model only has to stop. */
|
|
6
|
+
export declare const CLAUDE_WARNING_PROMPT = "This brain is about to be emptied. The notes stay where they are; history has the rest written down, though digging it back out is on you. Whatever lives only in this brain goes with it.\nBefore that, put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.\nWhen the notes are ready, end your turn; the reset runs after it.\nBrain emptied in 3\u2026 2\u2026";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { COUNTDOWN_LINE, WARNING_BODY } from "../../../src/budget/text.js";
|
|
2
|
+
/** Claude has no model-facing reset tool: the model ends its turn and the human runs the command. */
|
|
3
|
+
export const CLAUDE_WIPE_SENTENCE = "If this feels like the right moment, end your turn and ask the human to run `/fresh-window`.";
|
|
4
|
+
/** Claude's boot says history is missing rather than naming tools it cannot serve. */
|
|
5
|
+
export const CLAUDE_HISTORY_UNAVAILABLE_SENTENCE = "History isn't available in this Claude session: no main transcript_path was supplied. Keep essential state in notes; don't pretend those notes are the missing transcript.";
|
|
6
|
+
/** Claude's variant: the mod resets after the turn, so the model only has to stop. */
|
|
7
|
+
export const CLAUDE_WARNING_PROMPT = `${WARNING_BODY}\nWhen the notes are ready, end your turn; the reset runs after it.\n${COUNTDOWN_LINE}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WARNING_RUNWAY_TOKENS } from "
|
|
2
|
-
import { percent, positiveInteger, positiveNumber, presenceFlag } from "
|
|
3
|
-
import { isPlainObject, mergeNotesoupSettings } from "
|
|
1
|
+
import { WARNING_RUNWAY_TOKENS } from "../../../src/budget/constants.js";
|
|
2
|
+
import { percent, positiveInteger, positiveNumber, presenceFlag } from "../../../src/budget/parse.js";
|
|
3
|
+
import { isPlainObject, mergeNotesoupSettings } from "../../../src/settings.js";
|
|
4
4
|
/**
|
|
5
5
|
* Claude's auto-compact point, derived the way Claude derives it — never a hardcoded percent.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { estimateToolsTokens } from "@deepseek-ai/dsh-token-meter/estimate";
|
|
2
|
-
import { deriveThresholds, remainingBudget } from "
|
|
2
|
+
import { deriveThresholds, remainingBudget } from "../../src/budget/policy.js";
|
|
3
3
|
/** The host's ratio and output/headroom reserves are one reset line, not competing policies. */
|
|
4
4
|
export async function measureBudget(ctx, agent, config, signal) {
|
|
5
5
|
const route = agent.session.requestHeader()?.config ?? agent.options;
|
|
@@ -3,7 +3,7 @@ import type { CommandId } from "@deepseek-ai/dsh-commands/brand";
|
|
|
3
3
|
import { CompactionEngine, type CompactionAgentContext, type CompactionResult, type CompactionTrigger, type ManualCompactAgentContext } from "@deepseek-ai/dsh-compaction";
|
|
4
4
|
import { type SessionSeq } from "@deepseek-ai/dsh-session";
|
|
5
5
|
import { type BudgetConfig } from "./budget.js";
|
|
6
|
-
import { type ResetOrigin } from "
|
|
6
|
+
import { type ResetOrigin } from "../../src/budget/text.js";
|
|
7
7
|
import { Windows, type NotesConfig } from "./window.js";
|
|
8
8
|
export type EngineConfig = NotesConfig & Partial<BudgetConfig>;
|
|
9
9
|
export type ResolvedConfig = NotesConfig & BudgetConfig;
|
|
@@ -3,7 +3,7 @@ import { CompactionEngine, CompactionId, ManualCompactionError, compactCheckpoin
|
|
|
3
3
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
import { appendPluginRecord } from "@deepseek-ai/dsh-session";
|
|
5
5
|
import { measureBudget } from "./budget.js";
|
|
6
|
-
import { selectContinuation } from "
|
|
6
|
+
import { selectContinuation } from "../../src/budget/text.js";
|
|
7
7
|
import { checkpointText, Windows, WINDOW_RECORD } from "./window.js";
|
|
8
8
|
function resolveConfig(config) {
|
|
9
9
|
const resolved = { ...config, auto: config.auto ?? true, thresholdRatio: config.thresholdRatio ?? 0.8, headroomTokens: config.headroomTokens ?? 65536 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
import type { SessionId, SessionEvent } from "@deepseek-ai/dsh-session";
|
|
3
|
-
import { type HistoryProjection } from "
|
|
3
|
+
import { type HistoryProjection } from "../../src/history/history.js";
|
|
4
4
|
/** Native seq zero becomes public seq one. Forks contain only their selected seed prefix. */
|
|
5
5
|
export declare function decodeHistory(sessionId: string, events: readonly SessionEvent[]): HistoryProjection;
|
|
6
6
|
export declare function historyProjection(ctx: Context, sessionId: SessionId): Promise<HistoryProjection>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { projectHistory } from "
|
|
1
|
+
import { projectHistory } from "../../src/history/history.js";
|
|
2
2
|
import { checkpointSnapshot, recordSnapshot, windowId } from "./window.js";
|
|
3
3
|
/** Preserve every recorded block; attachments/reasoning have JSON evidence rather than invented text. */
|
|
4
4
|
function blockText(content, omitCalls = false) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
2
|
-
import { COUNTDOWN_LINE, warningPrompt, tokenBudgetGuidance } from "
|
|
2
|
+
import { COUNTDOWN_LINE, warningPrompt, tokenBudgetGuidance } from "../../src/budget/text.js";
|
|
3
3
|
import { measureBudget } from "./budget.js";
|
|
4
4
|
import { BOOT_SECTION, restoreWarnings } from "./window.js";
|
|
5
5
|
import { preflight } from "./engine.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HarnessError } from "@deepseek-ai/dsh-llm";
|
|
2
2
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
3
3
|
import { Check, Errors } from "typebox/value";
|
|
4
|
-
import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "
|
|
5
|
-
import { historyList, historyRead, historyWindows } from "
|
|
6
|
-
import { success } from "
|
|
4
|
+
import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../../src/tools/notes.js";
|
|
5
|
+
import { historyList, historyRead, historyWindows } from "../../src/tools/history.js";
|
|
6
|
+
import { success } from "../../src/tools/result.js";
|
|
7
7
|
import { historyProjection } from "./history.js";
|
|
8
8
|
import { notesIdentity } from "./window.js";
|
|
9
9
|
import { measureBudget } from "./budget.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
2
2
|
import { type Session, type SessionEvent } from "@deepseek-ai/dsh-session";
|
|
3
|
-
import { type NotesIdentity } from "
|
|
3
|
+
import { type NotesIdentity } from "../../src/notes/index.js";
|
|
4
4
|
export declare const WINDOW_RECORD = "plugin:notesoup/window";
|
|
5
5
|
export declare const BOOT_SECTION = "notesoup:boot";
|
|
6
6
|
export type WindowSnapshot = Readonly<{
|
|
@@ -3,11 +3,11 @@ import { isCompactCheckpointSource } from "@deepseek-ai/dsh-compaction";
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
|
-
import { loadNotesSnapshot } from "
|
|
7
|
-
import { renderBootBlock } from "
|
|
8
|
-
import { DEFAULT_BOOT_TOOL_NAMES } from "
|
|
9
|
-
import { contentText } from "
|
|
10
|
-
import { projectKey, slugify, snapshotNotesIdentity } from "
|
|
6
|
+
import { loadNotesSnapshot } from "../../src/boot/snapshot.js";
|
|
7
|
+
import { renderBootBlock } from "../../src/boot/render.js";
|
|
8
|
+
import { DEFAULT_BOOT_TOOL_NAMES } from "../../src/boot/text.js";
|
|
9
|
+
import { contentText } from "../../src/history/history.js";
|
|
10
|
+
import { projectKey, slugify, snapshotNotesIdentity } from "../../src/notes/index.js";
|
|
11
11
|
export const WINDOW_RECORD = "plugin:notesoup/window";
|
|
12
12
|
export const BOOT_SECTION = "notesoup:boot";
|
|
13
13
|
const BOOT_OPEN = "<notesoup-boot>\n";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { type NotesSnapshot } from "
|
|
2
|
+
import { type NotesSnapshot } from "../../src/boot/snapshot.js";
|
|
3
3
|
export type IncompleteNotesNotifier = (ctx: ExtensionContext, windowId: string, snapshot: NotesSnapshot) => void;
|
|
4
4
|
/** The boot custom message: identity, notes snapshot, and static protocol; never reset prose. */
|
|
5
5
|
export type BootMessage = {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { DEFAULT_BOOT_TOOL_NAMES
|
|
1
|
+
import { DEFAULT_BOOT_TOOL_NAMES } from "../../src/boot/text.js";
|
|
2
|
+
import { PI_PRE_RESET_HINTS } from "./text.js";
|
|
2
3
|
import { agentSlug, modelSlug, notesIdentityFromPi } from "./notes/adapter.js";
|
|
3
|
-
import { loadNotesSnapshot, unavailableNotesSnapshot } from "
|
|
4
|
-
import { isFilesystemError } from "
|
|
4
|
+
import { loadNotesSnapshot, unavailableNotesSnapshot } from "../../src/boot/snapshot.js";
|
|
5
|
+
import { isFilesystemError } from "../../src/notes/index.js";
|
|
5
6
|
import { BOOT_TYPE } from "./entries.js";
|
|
6
|
-
import { renderBootBlock } from "
|
|
7
|
+
import { renderBootBlock } from "../../src/boot/render.js";
|
|
7
8
|
import { historyFromSession, nextHistorySeq } from "./history.js";
|
|
8
9
|
/**
|
|
9
10
|
* Acquire one notes snapshot and build the boot custom message for a window. All identity
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DEFAULT_BOOT_TOOL_NAMES } from "
|
|
2
|
-
import { remainingBudget } from "
|
|
1
|
+
import { DEFAULT_BOOT_TOOL_NAMES } from "../../src/boot/text.js";
|
|
2
|
+
import { remainingBudget } from "../../src/budget/policy.js";
|
|
3
3
|
import { Type } from "@earendil-works/pi-ai";
|
|
4
4
|
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { GUIDANCE_TYPE, WARNING_TYPE } from "./entries.js";
|
|
6
|
-
import { warningContent } from "
|
|
6
|
+
import { warningContent } from "./text.js";
|
|
7
7
|
import { readThresholdSettings } from "./thresholds.js";
|
|
8
8
|
import { currentWindowId, hasWindowMessage, windowUsage } from "./window.js";
|
|
9
|
-
import { tokenBudgetGuidance } from "
|
|
9
|
+
import { tokenBudgetGuidance } from "../../src/budget/text.js";
|
|
10
10
|
import { arrangeAnchoredReminders } from "./anchored.js";
|
|
11
11
|
import { output } from "./tool-result.js";
|
|
12
12
|
/** Remaining tokens in the provider's active window, or null without a usable estimate. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import type { DreamerSetting } from "
|
|
2
|
+
import type { DreamerSetting } from "../../../src/dream/settings.js";
|
|
3
3
|
import { runDreamer, type DreamerSessionFactory } from "./runner.js";
|
|
4
4
|
/** Injection seams used by tests; production uses the defaults. */
|
|
5
5
|
export type DreamDependencies = {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { finishDream } from "
|
|
2
|
+
import { finishDream } from "../../../src/dream/report.js";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { acquireLock, failLock, lastRunPath, releaseLock } from "
|
|
7
|
-
import { materialGate, timeGate } from "
|
|
6
|
+
import { acquireLock, failLock, lastRunPath, releaseLock } from "../../../src/dream/lock.js";
|
|
7
|
+
import { materialGate, timeGate } from "../../../src/dream/gates.js";
|
|
8
8
|
import { runDreamer } from "./runner.js";
|
|
9
|
-
import { gitCommit } from "
|
|
9
|
+
import { gitCommit } from "../../../src/dream/git.js";
|
|
10
10
|
import { readDreamerSettings } from "./settings.js";
|
|
11
|
-
import { doctor } from "
|
|
11
|
+
import { doctor } from "../../../src/dream/doctor.js";
|
|
12
12
|
import { notesRoot } from "../notes/adapter.js";
|
|
13
|
-
import { errorMessage } from "
|
|
13
|
+
import { errorMessage } from "../../../src/error-message.js";
|
|
14
14
|
function args(argv) { const out = {}; for (let i = 0; i < argv.length; i++) {
|
|
15
15
|
const a = argv[i];
|
|
16
16
|
if (a === "--force" || a === "--help")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DreamResult } from "
|
|
1
|
+
import type { DreamResult } from "../../../src/dream/result.js";
|
|
2
2
|
import { type AgentSession, type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
export type DreamerSession = Pick<AgentSession, "prompt" | "subscribe" | "dispose">;
|
|
4
4
|
export type DreamerSessionFactory = (options: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jailWritePath, deleteCrumpledNote } from "
|
|
1
|
+
import { jailWritePath, deleteCrumpledNote } from "../../../src/dream/jail.js";
|
|
2
2
|
import { createAgentSession, createEditToolDefinition, createWriteToolDefinition, ModelRuntime, resolveModelScopeWithDiagnostics, SessionManager } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { Type } from "@earendil-works/pi-ai";
|
|
4
|
-
import { contentText } from "
|
|
5
|
-
import { errorMessage } from "
|
|
4
|
+
import { contentText } from "../../../src/history/history.js";
|
|
5
|
+
import { errorMessage } from "../../../src/error-message.js";
|
|
6
6
|
export const DREAMER_TOOLS = ["read", "grep", "find", "ls", "write", "edit"];
|
|
7
7
|
function jailToolDefinition(definition, notesHome) {
|
|
8
8
|
const execute = definition.execute;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DreamerSetting } from "
|
|
1
|
+
import { type DreamerSetting } from "../../../src/dream/settings.js";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve the configurable dreamer model from Pi settings for a CLI invocation: global
|
|
4
4
|
* `~/.pi/agent/settings.json` merged with the project's `.pi/settings.json`, project
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { deriveDreamer } from "
|
|
1
|
+
import { deriveDreamer } from "../../../src/dream/settings.js";
|
|
2
2
|
import { SettingsManager } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { mergeNotesoupSettings } from "
|
|
3
|
+
import { mergeNotesoupSettings } from "../../../src/settings.js";
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the configurable dreamer model from Pi settings for a CLI invocation: global
|
|
6
6
|
* `~/.pi/agent/settings.json` merged with the project's `.pi/settings.json`, project
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { historyWindows, historyList, historyRead } from "
|
|
1
|
+
import { historyWindows, historyList, historyRead } from "../../src/tools/history.js";
|
|
2
2
|
import { historyFromSession } from "./history.js";
|
|
3
3
|
import { HISTORY_NAMESPACE, registerOperation } from "./tool-result.js";
|
|
4
4
|
/** Register the three shared history operations; the adapter allocates addresses and supplies them. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SessionBoundaryDraft } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { SessionReader } from "./session-reader.js";
|
|
3
|
-
import { type HistoryProjection } from "
|
|
3
|
+
import { type HistoryProjection } from "../../src/history/history.js";
|
|
4
4
|
/** Pending boundary drafts use the same slots as persisted entries. */
|
|
5
5
|
export declare function nextHistorySeq(ctx: SessionReader, pending?: readonly SessionBoundaryDraft[]): number;
|
|
6
6
|
/** Build stable internal addresses, then project the active branch into public events. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isWindowMarker, rootWindowId } from "./window.js";
|
|
2
|
-
import { contentText, projectHistory } from "
|
|
2
|
+
import { contentText, projectHistory } from "../../src/history/history.js";
|
|
3
3
|
function mapRole(role) {
|
|
4
4
|
if (role === "user" || role === "assistant")
|
|
5
5
|
return role;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, createNotesoup } from "./extension.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, createNotesoup } from "./extension.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { type NotesIdentity } from "
|
|
2
|
+
import { type NotesIdentity } from "../../../src/notes/index.js";
|
|
3
3
|
/** Pi's default notes root; environment access stays on the host side of the library boundary. */
|
|
4
4
|
export declare function notesRoot(): string;
|
|
5
5
|
/** Translate the current Pi runtime into a fresh, explicit identity snapshot. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
|
-
import { projectKey, slugify } from "
|
|
3
|
+
import { projectKey, slugify } from "../../../src/notes/index.js";
|
|
4
4
|
/** Pi's default notes root; environment access stays on the host side of the library boundary. */
|
|
5
5
|
export function notesRoot() {
|
|
6
6
|
const override = process.env.PI_NOTES_HOME;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generateDiffString } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { notesWrite, notesUpdate, notesRead, notesList, notesSearch } from "
|
|
2
|
+
import { notesWrite, notesUpdate, notesRead, notesList, notesSearch } from "../../../src/tools/notes.js";
|
|
3
3
|
import { notesIdentityFromPi } from "./adapter.js";
|
|
4
4
|
import { NOTES_NAMESPACE, registerOperation } from "../tool-result.js";
|
|
5
5
|
function renderDiff(change) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext, SessionBoundaryDraft, SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { type ResetOrigin } from "
|
|
2
|
+
import { type ResetOrigin } from "../../../src/budget/text.js";
|
|
3
3
|
import { type WindowMarker } from "../window.js";
|
|
4
4
|
import { type IncompleteNotesNotifier } from "../boot.js";
|
|
5
5
|
export type ResetTailState = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { BOOT_TYPE, CONTINUATION_TYPE, RESET_LAST_WORD_TYPE, RESET_MARKER_TYPE } from "../entries.js";
|
|
3
|
-
import { selectContinuation } from "
|
|
3
|
+
import { selectContinuation } from "../../../src/budget/text.js";
|
|
4
4
|
import { isForeignResetTailEntry, isWindowBootEntry, isWindowMarker, markerResetOrigin } from "../window.js";
|
|
5
5
|
import { buildBootMessage, sendBoot } from "../boot.js";
|
|
6
6
|
/** A sticky note, not a letter: over this, empty_brain refuses instead of truncating. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext, SessionBoundaryDraft } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { ResetOrigin } from "
|
|
2
|
+
import type { ResetOrigin } from "../../../src/budget/text.js";
|
|
3
3
|
type BudgetOwner = {
|
|
4
4
|
automaticResetEnabled: (ctx: ExtensionContext) => boolean;
|
|
5
5
|
hardReserveDue: (ctx: ExtensionContext) => boolean;
|
|
@@ -2,7 +2,7 @@ import { getCurrentSystemMessage, isContextOverflow, isRecoverableLength } from
|
|
|
2
2
|
import { currentReset, currentWindowId } from "../window.js";
|
|
3
3
|
import { nextHistorySeq } from "../history.js";
|
|
4
4
|
import { resetBoundaryCommitted } from "./committed.js";
|
|
5
|
-
import { errorMessage } from "
|
|
5
|
+
import { errorMessage } from "../../../src/error-message.js";
|
|
6
6
|
function isAbort(message, outcome, ctx) {
|
|
7
7
|
return outcome === "aborted" || (message.role === "assistant" && message.stopReason === "aborted") || ctx.signal?.aborted === true;
|
|
8
8
|
}
|
|
@@ -8,10 +8,10 @@ import { currentReset, currentWindowId, isCheckpointBackedReset, isWindowBoot, i
|
|
|
8
8
|
import { registerResetLifecycle } from "./reset/lifecycle.js";
|
|
9
9
|
import { buildResetDrafts, LAST_WORD_PREFIX, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
|
|
10
10
|
import { BOOT_TYPE, MANUAL_WIPE_TYPE, RESET_LAST_WORD_TYPE } from "./entries.js";
|
|
11
|
-
import { warningContent } from "
|
|
11
|
+
import { warningContent } from "./text.js";
|
|
12
12
|
import { buildBootMessage, sendBoot } from "./boot.js";
|
|
13
13
|
import { nextHistorySeq } from "./history.js";
|
|
14
|
-
import { errorMessage } from "
|
|
14
|
+
import { errorMessage } from "../../src/error-message.js";
|
|
15
15
|
function readPackageVersion() {
|
|
16
16
|
for (const up of ["../../package.json", "../../../package.json"]) {
|
|
17
17
|
try {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi-only closing hints. Pi's TUI drops the human's visible transcript when a window resets, and
|
|
3
|
+
* the model, not the human, owns when that reset happens. A host whose reset leaves the human's
|
|
4
|
+
* view intact must not carry these — the claim would be false there. The bare `empty_brain` token
|
|
5
|
+
* is interpolated by renderProtocolBlock; the prose itself stays plain English.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PI_PRE_RESET_HINTS = "Resetting clears the human's chat view too. Don't put a long explanation right before a reset and assume they'll still be able to read it. Save the handoff in notes; give the explanation after the reset.\nUnless the human explicitly directs otherwise, decide for yourself when to call empty_brain. Don't keep asking them whether to reset.";
|
|
8
|
+
/** Pi-only nudge: pi's empty_brain persists a parting line; the dsh tool has no such parameter. */
|
|
9
|
+
export declare const LAST_WORD_HINT = "If you want, pass `empty_brain` a `last_word`: a tiny sticky note (at most 250 characters) slapped on your forehead after the wipe.";
|
|
10
|
+
/**
|
|
11
|
+
* With a prompt attached the close-out is an order rather than a nudge: the human already
|
|
12
|
+
* said when to reset, and a task line for the next window just preceded it. Only Pi has a
|
|
13
|
+
* reset command that takes a prompt, so this lives with the Pi text.
|
|
14
|
+
*/
|
|
15
|
+
export declare const WARNING_CALL_PROMPTED = "Organize the notes first, then call `empty_brain` right away \u2014 do not wait to be cut off.";
|
|
16
|
+
/**
|
|
17
|
+
* The human typed `/empty <prompt>`: the raw command line leads the close-out so the
|
|
18
|
+
* closing model sees what the next window was asked to do, verbatim. The tag names it as the
|
|
19
|
+
* next window's prompt, so no prose has to explain that.
|
|
20
|
+
*/
|
|
21
|
+
export declare function promptBlock(commandLine: string): string;
|
|
22
|
+
/** The hidden checkpoint text for Pi's manual/budget-triggered requests (dsh reads warningPrompt() directly). */
|
|
23
|
+
export declare function warningContent(commandLine?: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { COUNTDOWN_LINE, GUIDANCE_CLOSE_TAG, GUIDANCE_OPEN_TAG, WARNING_BODY, WARNING_CALL } from "../../src/budget/text.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pi-only closing hints. Pi's TUI drops the human's visible transcript when a window resets, and
|
|
4
|
+
* the model, not the human, owns when that reset happens. A host whose reset leaves the human's
|
|
5
|
+
* view intact must not carry these — the claim would be false there. The bare `empty_brain` token
|
|
6
|
+
* is interpolated by renderProtocolBlock; the prose itself stays plain English.
|
|
7
|
+
*/
|
|
8
|
+
export const PI_PRE_RESET_HINTS = `Resetting clears the human's chat view too. Don't put a long explanation right before a reset and assume they'll still be able to read it. Save the handoff in notes; give the explanation after the reset.
|
|
9
|
+
Unless the human explicitly directs otherwise, decide for yourself when to call empty_brain. Don't keep asking them whether to reset.`;
|
|
10
|
+
/** Pi-only nudge: pi's empty_brain persists a parting line; the dsh tool has no such parameter. */
|
|
11
|
+
export const LAST_WORD_HINT = "If you want, pass `empty_brain` a `last_word`: a tiny sticky note (at most 250 characters) slapped on your forehead after the wipe.";
|
|
12
|
+
/**
|
|
13
|
+
* With a prompt attached the close-out is an order rather than a nudge: the human already
|
|
14
|
+
* said when to reset, and a task line for the next window just preceded it. Only Pi has a
|
|
15
|
+
* reset command that takes a prompt, so this lives with the Pi text.
|
|
16
|
+
*/
|
|
17
|
+
export const WARNING_CALL_PROMPTED = "Organize the notes first, then call `empty_brain` right away — do not wait to be cut off.";
|
|
18
|
+
/**
|
|
19
|
+
* The human typed `/empty <prompt>`: the raw command line leads the close-out so the
|
|
20
|
+
* closing model sees what the next window was asked to do, verbatim. The tag names it as the
|
|
21
|
+
* next window's prompt, so no prose has to explain that.
|
|
22
|
+
*/
|
|
23
|
+
export function promptBlock(commandLine) {
|
|
24
|
+
return `<notesoup:next_window_prompt>\n${commandLine}\n</notesoup:next_window_prompt>`;
|
|
25
|
+
}
|
|
26
|
+
/** The hidden checkpoint text for Pi's manual/budget-triggered requests (dsh reads warningPrompt() directly). */
|
|
27
|
+
export function warningContent(commandLine) {
|
|
28
|
+
const closeOut = commandLine ? `${promptBlock(commandLine)}\n${WARNING_CALL_PROMPTED}` : WARNING_CALL;
|
|
29
|
+
return `${GUIDANCE_OPEN_TAG}\n${WARNING_BODY}\n${closeOut}\n${PI_PRE_RESET_HINTS}\n${LAST_WORD_HINT}\n${COUNTDOWN_LINE}\n${GUIDANCE_CLOSE_TAG}`;
|
|
30
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ResolvedThresholds } from "
|
|
1
|
+
import { type ResolvedThresholds } from "../../src/budget/policy.js";
|
|
2
2
|
import { SettingsManager, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
/**
|
|
4
4
|
* Read the active compaction reserve, enablement, and notesoup margin settings. This
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { deriveThresholds } from "
|
|
1
|
+
import { deriveThresholds } from "../../src/budget/policy.js";
|
|
2
2
|
import { SettingsManager } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { DEFAULT_RESERVE_TOKENS } from "
|
|
4
|
-
import { mergeNotesoupSettings } from "
|
|
5
|
-
import { errorMessage } from "
|
|
3
|
+
import { DEFAULT_RESERVE_TOKENS } from "../../src/budget/constants.js";
|
|
4
|
+
import { mergeNotesoupSettings } from "../../src/settings.js";
|
|
5
|
+
import { errorMessage } from "../../src/error-message.js";
|
|
6
6
|
function readThresholdSettingsFromManager(ctx, settingsManager) {
|
|
7
7
|
// Resolve the active provider/model override from the public settings API.
|
|
8
8
|
const model = ctx.model;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Pi transport for host-neutral operations. */
|
|
2
2
|
import { type ExtensionAPI, type ExtensionToolContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import type { Static, TSchema } from "typebox";
|
|
4
|
-
import { type Operation, type Outcome } from "
|
|
4
|
+
import { type Operation, type Outcome } from "../../src/tools/result.js";
|
|
5
5
|
/** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
|
|
6
6
|
export declare function output(value: unknown, details?: unknown, terminate?: boolean): {
|
|
7
7
|
content: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Pi transport for host-neutral operations. */
|
|
2
2
|
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { wireResult } from "
|
|
3
|
+
import { wireResult } from "../../src/tools/result.js";
|
|
4
4
|
/** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
|
|
5
5
|
export function output(value, details, terminate = false) {
|
|
6
6
|
return { content: [{ type: "text", text: JSON.stringify(value) }], details, terminate };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import { type CustomEntry, type ExtensionContext, type SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import type { ResetOrigin } from "
|
|
3
|
+
import type { ResetOrigin } from "../../src/budget/text.js";
|
|
4
4
|
import type { SessionReader } from "./session-reader.js";
|
|
5
5
|
export type WindowMarkerData = {
|
|
6
6
|
readonly windowId: string;
|
package/dist/src/boot/text.d.ts
CHANGED
|
@@ -11,22 +11,12 @@ export declare const NOTES_PROTOCOL_CLOSE_TAG = "</notesoup:notes_protocol>";
|
|
|
11
11
|
* model-facing reset tool replaces the whole sentence through BootToolNames.wipeSentence.
|
|
12
12
|
*/
|
|
13
13
|
export declare const PROTOCOL_WIPE_SENTENCE = "If this feels like the right moment, call `empty_brain` and erase yourself with dignity.";
|
|
14
|
-
/** Claude has no model-facing reset tool: the model ends its turn and the human runs the command. */
|
|
15
|
-
export declare const CLAUDE_WIPE_SENTENCE = "If this feels like the right moment, end your turn and ask the human to run `/fresh-window`.";
|
|
16
14
|
export declare const PROTOCOL_HISTORY_SENTENCE = "History can still be dug up, probably: use `history_*` to excavate the mess, from old decisions to yesterday's missing socks. Found something? Write its seq down, or enjoy digging twice.";
|
|
17
|
-
export declare const CLAUDE_HISTORY_UNAVAILABLE_SENTENCE = "History isn't available in this Claude session: no main transcript_path was supplied. Keep essential state in notes; don't pretend those notes are the missing transcript.";
|
|
18
15
|
/**
|
|
19
16
|
* The MAP page is taught once per window, as its own section between the protocol and the notes
|
|
20
17
|
* index. A MAP is the one note every waking window loads, so this block says what one holds.
|
|
21
18
|
*/
|
|
22
19
|
export declare const MAPS_BLOCK = "<notesoup:maps>\nEvery home's root can hold a `MAP.md`, and a MAP is the one page that never waits on a shelf \u2014 it\ngets jammed straight into your brain the moment you wake up. No asking, no skipping. Whoever wakes\nup next reads it, and next is you. So keep it short, and keep it true.\n\nTwo things live in there:\n\n- **Cheatsheet.** A cheatsheet is a cheatsheet. Scribble whatever you'll want next time \u2014 a rule, a\n warning, a grudge, a name, a phone number you'll regret losing. Nobody grades it. Just keep it\n under five lines, or it grows fat and everybody pays for it.\n- **Index.** One line per durable note: the address, then a gist short enough to tell whether the\n thing is worth opening.\n\n```\n # CHEATSHEET\n - Read the repo before asking; run it before believing it\n - Report times in Beijing time\n\n # INDEX\n - release-and-local-install.md \u2014 version bump, local override install, host load timing\n - history-api-v2-design.md \u2014 seq addressing; read before touching history\n - current-reset-and-dream-scope.md \u2014 reset scope, dream territory, session ownership\n```\n\nEvery home gets one: `@project`, `@human`, `@self`, `@model`. New note, new line. New rule worth\nremembering, new Cheatsheet line. And when a line stops being true, kill it \u2014 every window after you\nreads that page as fact.\n</notesoup:maps>";
|
|
23
|
-
/**
|
|
24
|
-
* Pi-only closing hints. Pi's TUI drops the human's visible transcript when a window resets, and
|
|
25
|
-
* the model, not the human, owns when that reset happens. A host whose reset leaves the human's
|
|
26
|
-
* view intact must not carry these — the claim would be false there. The bare `empty_brain` token
|
|
27
|
-
* is interpolated by renderProtocolBlock; the prose itself stays plain English.
|
|
28
|
-
*/
|
|
29
|
-
export declare const PI_PRE_RESET_HINTS = "Resetting clears the human's chat view too. Don't put a long explanation right before a reset and assume they'll still be able to read it. Save the handoff in notes; give the explanation after the reset.\nUnless the human explicitly directs otherwise, decide for yourself when to call empty_brain. Don't keep asking them whether to reset.";
|
|
30
20
|
/** Logical tool names are supplied by the composing host, not discovered here. */
|
|
31
21
|
export type BootToolNames = Readonly<{
|
|
32
22
|
notes: string;
|
|
@@ -36,14 +26,15 @@ export type BootToolNames = Readonly<{
|
|
|
36
26
|
wipe: string;
|
|
37
27
|
/**
|
|
38
28
|
* Replaces the whole voluntary-wipe sentence (PROTOCOL_WIPE_SENTENCE) when the host has
|
|
39
|
-
* no model-facing reset tool. Absent means
|
|
29
|
+
* no model-facing reset tool. Absent means the shared tool-driven-reset sentence, byte for byte.
|
|
40
30
|
*/
|
|
41
31
|
wipeSentence?: string;
|
|
42
32
|
/** A host without an authoritative history source replaces the entire history advice. */
|
|
43
33
|
historySentence?: string;
|
|
44
34
|
/**
|
|
45
|
-
* Extra protocol prose appended before the closing tag.
|
|
46
|
-
*
|
|
35
|
+
* Extra protocol prose appended before the closing tag. A host whose reset also drops the
|
|
36
|
+
* human's visible transcript supplies its own hints here; a host whose reset leaves that
|
|
37
|
+
* view intact leaves it absent, because the claim would be false there.
|
|
47
38
|
*/
|
|
48
39
|
preResetHints?: string;
|
|
49
40
|
}>;
|