notesoup 0.61.0 → 0.63.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/.agents/plugins/marketplace.json +15 -0
- package/README.md +14 -11
- package/dist/plugins/antigravity/src/cli.d.ts +1 -0
- package/dist/plugins/antigravity/src/cli.js +23 -0
- package/dist/plugins/antigravity/src/hooks.d.ts +18 -0
- package/dist/plugins/antigravity/src/hooks.js +53 -0
- package/dist/plugins/antigravity/src/identity.d.ts +26 -0
- package/dist/plugins/antigravity/src/identity.js +129 -0
- package/dist/plugins/claude/src/helper.js +24 -5
- package/dist/plugins/claude/src/text.d.ts +7 -0
- package/dist/plugins/claude/src/text.js +12 -1
- package/dist/plugins/codex/src/hooks.js +1 -0
- package/dist/plugins/codex/src/identity.d.ts +6 -1
- package/dist/plugins/codex/src/identity.js +13 -1
- package/dist/plugins/codex/src/mcp.d.ts +35 -7
- package/dist/plugins/codex/src/mcp.js +26 -88
- package/dist/plugins/codex/src/text.js +3 -3
- package/dist/plugins/dsh/tools.js +8 -4
- package/dist/plugins/mcp/operations.d.ts +15 -0
- package/dist/plugins/mcp/operations.js +43 -0
- package/dist/plugins/mcp/server.d.ts +14 -0
- package/dist/plugins/mcp/server.js +13 -0
- package/dist/plugins/pi/budget.d.ts +4 -1
- package/dist/plugins/pi/budget.js +35 -8
- package/dist/plugins/pi/entries.d.ts +2 -0
- package/dist/plugins/pi/entries.js +2 -0
- package/dist/plugins/pi/history-tools.js +2 -1
- package/dist/plugins/pi/history.js +18 -1
- package/dist/plugins/pi/notes/tools.js +7 -3
- package/dist/plugins/pi/render.d.ts +7 -1
- package/dist/plugins/pi/render.js +2 -2
- package/dist/plugins/pi/reset/artifacts.d.ts +1 -1
- package/dist/plugins/pi/reset/artifacts.js +4 -4
- package/dist/plugins/pi/reset/lifecycle.d.ts +9 -2
- package/dist/plugins/pi/reset/lifecycle.js +109 -31
- package/dist/plugins/pi/runtime.js +104 -63
- package/dist/plugins/pi/tool-result.js +7 -7
- package/dist/plugins/pi/window.d.ts +25 -3
- package/dist/plugins/pi/window.js +219 -9
- package/dist/src/boot/render.js +18 -15
- package/dist/src/boot/text.d.ts +3 -1
- package/dist/src/boot/text.js +22 -20
- package/dist/src/budget/text.d.ts +7 -3
- package/dist/src/budget/text.js +24 -15
- package/dist/src/history/claude.d.ts +2 -0
- package/dist/src/history/claude.js +46 -0
- package/dist/src/history/codex-transcript.js +7 -5
- package/dist/src/history/codex.js +3 -0
- package/dist/src/history/corpus.d.ts +28 -1
- package/dist/src/history/corpus.js +40 -0
- package/dist/src/history/history.d.ts +37 -46
- package/dist/src/history/history.js +21 -40
- package/dist/src/history/local.js +67 -32
- package/dist/src/history/pi.d.ts +2 -1
- package/dist/src/history/pi.js +122 -48
- package/dist/src/history/prefilter.js +76 -19
- package/dist/src/history/query.d.ts +28 -49
- package/dist/src/history/query.js +83 -68
- package/dist/src/history/summary-cache.d.ts +8 -1
- package/dist/src/history/summary-cache.js +138 -12
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +1 -1
- package/dist/src/notes/errors.d.ts +1 -1
- package/dist/src/notes/frontmatter.d.ts +0 -2
- package/dist/src/notes/frontmatter.js +0 -2
- package/dist/src/notes/index.d.ts +1 -1
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/policy.d.ts +15 -1
- package/dist/src/notes/policy.js +46 -5
- package/dist/src/notes/store.d.ts +12 -0
- package/dist/src/notes/store.js +16 -20
- package/dist/src/text-match.d.ts +10 -1
- package/dist/src/text-match.js +42 -3
- package/dist/src/tools/dream.d.ts +22 -93
- package/dist/src/tools/dream.js +30 -27
- package/dist/src/tools/history.d.ts +33 -26
- package/dist/src/tools/history.js +257 -163
- package/dist/src/tools/notes.d.ts +51 -163
- package/dist/src/tools/notes.js +146 -100
- package/dist/src/tools/output.d.ts +2 -1
- package/dist/src/tools/output.js +2 -1
- package/dist/src/tools/result.d.ts +4 -7
- package/dist/src/tools/result.js +8 -9
- package/dist/src/tools/schema.d.ts +4 -1
- package/dist/src/tools/schema.js +25 -1
- package/dist/test/agent-loop.test.js +394 -56
- package/dist/test/antigravity-live.test.d.ts +1 -0
- package/dist/test/antigravity-live.test.js +142 -0
- package/dist/test/antigravity-plugin.test.d.ts +1 -0
- package/dist/test/antigravity-plugin.test.js +101 -0
- package/dist/test/boot.integration.test.js +156 -15
- package/dist/test/budget-settings.integration.test.js +4 -4
- package/dist/test/claude-history.test.js +14 -13
- package/dist/test/claude-mod.test.js +199 -16
- package/dist/test/claude-validation.test.js +69 -2
- package/dist/test/codex-history.test.js +15 -3
- package/dist/test/codex-plugin.test.js +76 -38
- package/dist/test/dependencies.test.js +7 -3
- package/dist/test/dream-skill.test.js +3 -3
- package/dist/test/dream-tools.test.js +101 -56
- package/dist/test/dsh.test.js +34 -19
- package/dist/test/helpers/dependency-graph.js +2 -2
- package/dist/test/helpers/extension.d.ts +68 -3
- package/dist/test/helpers/extension.js +74 -5
- package/dist/test/history-corpus.test.js +79 -77
- package/dist/test/history-summary-cache.test.js +97 -9
- package/dist/test/history.integration.test.js +234 -168
- package/dist/test/host-neutral.test.js +69 -19
- package/dist/test/marker.test.js +1 -1
- package/dist/test/model-facing-text.test.js +13 -3
- package/dist/test/note-policy.test.js +96 -77
- package/dist/test/notes.integration.test.js +212 -94
- package/dist/test/notes.test.js +184 -113
- package/dist/test/pi-render.test.js +20 -12
- package/dist/test/project-namespace.test.js +3 -2
- package/dist/test/reset-lifecycle.test.js +12 -2
- package/docs/antigravity.md +44 -0
- package/docs/architecture.md +6 -4
- package/docs/claude-code-mod.md +7 -7
- package/docs/codex.md +36 -38
- package/docs/dsh.md +3 -3
- package/docs/history-sessions.md +28 -50
- package/docs/notes-library.md +4 -4
- package/docs/reset-lifecycle.md +1 -1
- package/docs/skills.md +3 -3
- package/docs/tool-results.md +47 -28
- package/package.json +3 -2
- package/playbook.md +1 -1
- package/plugins/antigravity/dist/antigravity/notesoup.js +26886 -0
- package/plugins/antigravity/hooks.json +7 -0
- package/plugins/antigravity/mcp_config.json +8 -0
- package/plugins/antigravity/plugin.json +6 -0
- package/plugins/antigravity/src/cli.ts +22 -0
- package/plugins/antigravity/src/hooks.ts +51 -0
- package/plugins/antigravity/src/identity.ts +127 -0
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +1108 -539
- package/plugins/claude/hooks/register.ts +202 -62
- package/plugins/claude/playbook.md +1 -1
- package/plugins/claude/skills/dream/SKILL.md +1 -1
- package/plugins/claude/skills/notesoup-guide/SKILL.md +92 -0
- package/plugins/claude/src/helper.ts +24 -5
- package/plugins/claude/src/text.ts +14 -1
- package/plugins/codex/.codex-plugin/plugin.json +8 -0
- package/plugins/codex/.mcp.json +11 -0
- package/plugins/codex/README.md +5 -21
- package/plugins/codex/dist/codex/notesoup.js +18480 -17946
- package/plugins/codex/src/hooks.ts +1 -0
- package/plugins/codex/src/identity.ts +14 -1
- package/plugins/codex/src/mcp.ts +28 -98
- package/plugins/codex/src/text.ts +3 -3
- package/plugins/dsh/tools.ts +8 -4
- package/plugins/mcp/operations.ts +50 -0
- package/plugins/mcp/server.ts +23 -0
- package/plugins/paseo/README.md +5 -10
- package/plugins/paseo/client/brain-empty-card.tsx +3 -3
- package/plugins/paseo/client/markdown.tsx +50 -38
- package/plugins/paseo/client/notes-op-card.tsx +12 -9
- package/plugins/paseo/client/paper-card.tsx +6 -5
- package/plugins/paseo/client/paper-palette.ts +2 -9
- package/plugins/paseo/client/sticky-card.tsx +2 -2
- package/plugins/paseo/client/tool-result.ts +7 -14
- package/plugins/paseo/package-lock.json +3406 -0
- package/plugins/paseo/package.json +1 -0
- package/plugins/paseo/test/markdown-core.test.ts +73 -66
- package/plugins/pi/budget.ts +31 -8
- package/plugins/pi/entries.ts +2 -0
- package/plugins/pi/history-tools.ts +2 -1
- package/plugins/pi/history.ts +30 -1
- package/plugins/pi/notes/tools.ts +7 -3
- package/plugins/pi/render.ts +6 -6
- package/plugins/pi/reset/artifacts.ts +4 -3
- package/plugins/pi/reset/lifecycle.ts +125 -32
- package/plugins/pi/runtime.ts +98 -62
- package/plugins/pi/tool-result.ts +8 -8
- package/plugins/pi/window.ts +210 -10
- package/skills/dream/SKILL.md +1 -1
- package/skills/notesoup-guide/SKILL.md +92 -0
- package/src/boot/render.ts +18 -15
- package/src/boot/text.ts +23 -19
- package/src/budget/text.ts +27 -15
- package/src/history/claude.ts +41 -0
- package/src/history/codex-transcript.ts +6 -4
- package/src/history/codex.ts +2 -0
- package/src/history/corpus.ts +51 -2
- package/src/history/history.ts +35 -44
- package/src/history/local.ts +67 -27
- package/src/history/pi.ts +113 -35
- package/src/history/prefilter.ts +73 -15
- package/src/history/query.ts +93 -73
- package/src/history/summary-cache.ts +142 -17
- package/src/index.ts +2 -2
- package/src/notes/errors.ts +1 -1
- package/src/notes/frontmatter.ts +0 -3
- package/src/notes/index.ts +1 -1
- package/src/notes/policy.ts +44 -5
- package/src/notes/store.ts +17 -20
- package/src/text-match.ts +46 -4
- package/src/tools/dream.ts +29 -31
- package/src/tools/history.ts +249 -142
- package/src/tools/notes.ts +145 -113
- package/src/tools/output.ts +2 -1
- package/src/tools/result.ts +12 -11
- package/src/tools/schema.ts +24 -1
- package/plugins/claude/skills/memory/SKILL.md +0 -69
- package/plugins/codex/mcp.json +0 -10
- package/plugins/codex/plugin.json +0 -6
- package/plugins/paseo/client/markdown-core.tsx +0 -189
- package/plugins/paseo/client/typography.ts +0 -24
- package/skills/memory/SKILL.md +0 -69
|
@@ -5,6 +5,7 @@ import type { SessionReader } from "./session-reader.js";
|
|
|
5
5
|
export type WindowMarkerData = {
|
|
6
6
|
readonly windowId: string;
|
|
7
7
|
readonly origin?: ResetOrigin;
|
|
8
|
+
readonly betweenTurns?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export type WindowMarker = CustomEntry<WindowMarkerData> & {
|
|
10
11
|
data: WindowMarkerData;
|
|
@@ -15,15 +16,26 @@ export declare function isWindowMarker(entry: SessionEntry): entry is WindowMark
|
|
|
15
16
|
* carried, or with an unreadable one, was the model's own reset.
|
|
16
17
|
*/
|
|
17
18
|
export declare function markerResetOrigin(marker: WindowMarker): ResetOrigin;
|
|
18
|
-
/**
|
|
19
|
+
/** Branch entries after the latest compaction, or the full branch before any compaction. */
|
|
20
|
+
export declare function activeBranchTail(branch: readonly SessionEntry[]): readonly SessionEntry[];
|
|
21
|
+
/** Only a reset marker still ahead of any later native compaction owns the active projection boundary. */
|
|
19
22
|
export declare function currentReset(ctx: SessionReader): WindowMarker | undefined;
|
|
23
|
+
/** The explicit `/notesoup on|off|reset` choice for this branch, or undefined when never chosen. */
|
|
24
|
+
export declare function sessionEnabled(branch: readonly SessionEntry[]): boolean | undefined;
|
|
25
|
+
/** Explicit branch choice wins; otherwise the CLI flag and naked/restricted-tools pi-souls runs disable. */
|
|
26
|
+
export declare function isNotesoupEnabled(pi: {
|
|
27
|
+
getFlag?(name: string): unknown;
|
|
28
|
+
events?: {
|
|
29
|
+
emit(channel: string, data: unknown): void;
|
|
30
|
+
};
|
|
31
|
+
}, ctx: SessionReader): boolean;
|
|
20
32
|
/** A reset is checkpoint-backed only when its marker directly follows a native compaction. */
|
|
21
33
|
export declare function isCheckpointBackedReset(ctx: SessionReader, marker?: WindowMarker | undefined): boolean;
|
|
22
34
|
/** Mint the durable identity of a session's root history window. */
|
|
23
35
|
export declare function rootWindowId(sessionId: string): string;
|
|
24
|
-
/** Persisted messages in the active window, excluding earlier windows
|
|
36
|
+
/** Persisted messages in the active window segment, excluding earlier windows and compacted prefixes. */
|
|
25
37
|
export declare function hasWindowMessage(ctx: SessionReader, customType: string): boolean;
|
|
26
|
-
/** The root or latest durable
|
|
38
|
+
/** The root or latest durable window identity on the active branch, matching history windows. */
|
|
27
39
|
export declare function currentWindowId(ctx: SessionReader): string;
|
|
28
40
|
/** The durable window active just before the marker: the last earlier marker, else the root window. */
|
|
29
41
|
export declare function previousWindowId(ctx: SessionReader, markerId: string): string;
|
|
@@ -48,5 +60,15 @@ export declare function projectWindow(messages: AgentMessage[], windowId: string
|
|
|
48
60
|
* while retaining every user/assistant/tool message from the copied root transcript.
|
|
49
61
|
*/
|
|
50
62
|
export declare function projectRootWindow(messages: AgentMessage[], windowId: string): AgentMessage[];
|
|
63
|
+
/** Every tool the notesoup extension registers. */
|
|
64
|
+
export declare const NOTESOUP_TOOL_NAMES: ReadonlySet<string>;
|
|
65
|
+
/** Whether a skill file lives under notesoup's own `skills/` roots (symlink-resolved). */
|
|
66
|
+
export declare function isNotesoupSkillPath(filePath: string, skillRoots?: readonly string[]): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Provider projection for `/notesoup off`: erase this extension's custom messages, teaching
|
|
69
|
+
* sections, skills and tool declarations so a disabled session looks like a plain Pi session.
|
|
70
|
+
* `CARRIED_INPUT_TYPE` survives because it is the human's withheld input, not notesoup state.
|
|
71
|
+
*/
|
|
72
|
+
export declare function stripNotesoupProjection(messages: AgentMessage[], skillRoots?: readonly string[]): AgentMessage[];
|
|
51
73
|
/** Usage for the selected window, excluding provider usage recorded before its marker. */
|
|
52
74
|
export declare function windowUsage(ctx: Pick<ExtensionContext, "sessionManager" | "getContextUsage" | "model">): import("@earendil-works/pi-coding-agent").ContextUsage | undefined;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getCurrentSystemMessage } from "@earendil-works/pi-ai";
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { resolve, sep } from "node:path";
|
|
2
4
|
import { estimateContextTokens } from "./estimate.js";
|
|
3
5
|
import { convertToLlm } from "@earendil-works/pi-coding-agent";
|
|
4
|
-
import { BOOT_TYPE, RESET_MARKER_TYPE } from "./entries.js";
|
|
6
|
+
import { BOOT_TYPE, CONTINUATION_TYPE, ENABLED_TYPE, GUIDANCE_TYPE, MANUAL_WIPE_TYPE, MARKER_TYPE, RESET_LAST_WORD_TYPE, RESET_MARKER_TYPE, TURNOVER_TRIGGER_TYPE, WARNING_TYPE } from "./entries.js";
|
|
5
7
|
import { NOTES_PROTOCOL_OPEN_TAG, NOTES_PROTOCOL_CLOSE_TAG, WINDOW_IDENTITY_OPEN_TAG, WINDOW_IDENTITY_CLOSE_TAG } from "../../src/boot/text.js";
|
|
6
8
|
export function isWindowMarker(entry) {
|
|
7
9
|
return entry.type === "custom" && entry.customType === RESET_MARKER_TYPE &&
|
|
@@ -16,16 +18,87 @@ export function isWindowMarker(entry) {
|
|
|
16
18
|
export function markerResetOrigin(marker) {
|
|
17
19
|
return marker.data.origin === "forced" ? "forced" : "normal";
|
|
18
20
|
}
|
|
19
|
-
|
|
21
|
+
function lastWindowMarker(entries) {
|
|
22
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
23
|
+
const entry = entries[i];
|
|
24
|
+
if (entry && isWindowMarker(entry))
|
|
25
|
+
return entry;
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
/** Branch entries after the latest compaction, or the full branch before any compaction. */
|
|
30
|
+
export function activeBranchTail(branch) {
|
|
31
|
+
for (let i = branch.length - 1; i >= 0; i--) {
|
|
32
|
+
if (branch[i]?.type === "compaction")
|
|
33
|
+
return branch.slice(i + 1);
|
|
34
|
+
}
|
|
35
|
+
return branch;
|
|
36
|
+
}
|
|
37
|
+
/** Only a reset marker still ahead of any later native compaction owns the active projection boundary. */
|
|
20
38
|
export function currentReset(ctx) {
|
|
21
|
-
|
|
39
|
+
return lastWindowMarker(activeBranchTail(ctx.sessionManager.getBranch()));
|
|
40
|
+
}
|
|
41
|
+
/** The explicit `/notesoup on|off|reset` choice for this branch, or undefined when never chosen. */
|
|
42
|
+
export function sessionEnabled(branch) {
|
|
22
43
|
for (let i = branch.length - 1; i >= 0; i--) {
|
|
23
44
|
const entry = branch[i];
|
|
24
|
-
if (entry
|
|
25
|
-
|
|
45
|
+
if (entry.type !== "custom" || entry.customType !== ENABLED_TYPE)
|
|
46
|
+
continue;
|
|
47
|
+
const data = entry.data;
|
|
48
|
+
if (typeof data !== "object" || data === null)
|
|
49
|
+
continue;
|
|
50
|
+
const enabled = data.enabled;
|
|
51
|
+
if (enabled === true)
|
|
52
|
+
return true;
|
|
53
|
+
if (enabled === false)
|
|
54
|
+
return false;
|
|
55
|
+
if (enabled === null)
|
|
56
|
+
return undefined;
|
|
57
|
+
// Malformed data: keep scanning for an older readable choice.
|
|
26
58
|
}
|
|
27
59
|
return undefined;
|
|
28
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Whether pi-souls reports a mode (`naked` or restricted `tools` `"none"`/`"rw"`) that disables
|
|
63
|
+
* notesoup by default. Ask the loaded pi-souls extension synchronously first; when absent,
|
|
64
|
+
* read its durable entries (`pi-souls:naked`, `pi-souls:tools`).
|
|
65
|
+
*/
|
|
66
|
+
function isDisabledByPiSouls(pi, branch) {
|
|
67
|
+
const query = { branch };
|
|
68
|
+
pi.events?.emit("pi-souls:state", query);
|
|
69
|
+
if (query.naked === true || query.tools === "none" || query.tools === "rw")
|
|
70
|
+
return true;
|
|
71
|
+
const checkDurable = (customType, disabled) => {
|
|
72
|
+
for (let i = branch.length - 1; i >= 0; i--) {
|
|
73
|
+
const entry = branch[i];
|
|
74
|
+
if (entry.type !== "custom" || entry.customType !== customType)
|
|
75
|
+
continue;
|
|
76
|
+
if (typeof entry.data !== "object" || entry.data === null)
|
|
77
|
+
continue;
|
|
78
|
+
const result = disabled(entry.data);
|
|
79
|
+
if (result !== undefined)
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
};
|
|
84
|
+
const nakedDisabled = typeof query.naked === "boolean"
|
|
85
|
+
? false
|
|
86
|
+
: checkDurable("pi-souls:naked", (data) => data.naked === true ? true : data.naked === false || data.naked === null ? false : undefined);
|
|
87
|
+
if (nakedDisabled)
|
|
88
|
+
return true;
|
|
89
|
+
return query.tools !== undefined
|
|
90
|
+
? false
|
|
91
|
+
: checkDurable("pi-souls:tools", (data) => data.tools === "none" || data.tools === "rw" ? true
|
|
92
|
+
: data.tools === null ? false : undefined);
|
|
93
|
+
}
|
|
94
|
+
/** Explicit branch choice wins; otherwise the CLI flag and naked/restricted-tools pi-souls runs disable. */
|
|
95
|
+
export function isNotesoupEnabled(pi, ctx) {
|
|
96
|
+
const branch = ctx.sessionManager.getBranch();
|
|
97
|
+
const explicit = sessionEnabled(branch);
|
|
98
|
+
if (explicit !== undefined)
|
|
99
|
+
return explicit;
|
|
100
|
+
return pi.getFlag?.("no-notesoup") !== true && !isDisabledByPiSouls(pi, branch);
|
|
101
|
+
}
|
|
29
102
|
/** A reset is checkpoint-backed only when its marker directly follows a native compaction. */
|
|
30
103
|
export function isCheckpointBackedReset(ctx, marker = currentReset(ctx)) {
|
|
31
104
|
if (!marker?.parentId)
|
|
@@ -40,21 +113,23 @@ export function isCheckpointBackedReset(ctx, marker = currentReset(ctx)) {
|
|
|
40
113
|
export function rootWindowId(sessionId) {
|
|
41
114
|
return `pcw:${sessionId.slice(0, 8)}:root`;
|
|
42
115
|
}
|
|
43
|
-
/** Persisted messages in the active window, excluding earlier windows
|
|
116
|
+
/** Persisted messages in the active window segment, excluding earlier windows and compacted prefixes. */
|
|
44
117
|
export function hasWindowMessage(ctx, customType) {
|
|
45
118
|
const branch = ctx.sessionManager.getBranch();
|
|
46
119
|
for (let i = branch.length - 1; i >= 0; i--) {
|
|
47
120
|
const entry = branch[i];
|
|
48
|
-
if (
|
|
121
|
+
if (!entry)
|
|
122
|
+
continue;
|
|
123
|
+
if (isWindowMarker(entry) || entry.type === "compaction")
|
|
49
124
|
break;
|
|
50
125
|
if (entry.type === "custom_message" && entry.customType === customType)
|
|
51
126
|
return true;
|
|
52
127
|
}
|
|
53
128
|
return false;
|
|
54
129
|
}
|
|
55
|
-
/** The root or latest durable
|
|
130
|
+
/** The root or latest durable window identity on the active branch, matching history windows. */
|
|
56
131
|
export function currentWindowId(ctx) {
|
|
57
|
-
return
|
|
132
|
+
return lastWindowMarker(ctx.sessionManager.getBranch())?.data.windowId ?? rootWindowId(ctx.sessionManager.getSessionId());
|
|
58
133
|
}
|
|
59
134
|
/** The durable window active just before the marker: the last earlier marker, else the root window. */
|
|
60
135
|
export function previousWindowId(ctx, markerId) {
|
|
@@ -136,6 +211,141 @@ export function projectRootWindow(messages, windowId) {
|
|
|
136
211
|
const withoutBoots = messages.filter((message) => !isWindowBoot(message));
|
|
137
212
|
return [...withoutBoots.slice(0, firstBoot), activeBoot, ...withoutBoots.slice(firstBoot)];
|
|
138
213
|
}
|
|
214
|
+
/** Every tool the notesoup extension registers. */
|
|
215
|
+
export const NOTESOUP_TOOL_NAMES = new Set([
|
|
216
|
+
"empty_brain",
|
|
217
|
+
"get_context_remaining",
|
|
218
|
+
"notes_write",
|
|
219
|
+
"notes_update",
|
|
220
|
+
"notes_read",
|
|
221
|
+
"notes_list",
|
|
222
|
+
"dream_begin",
|
|
223
|
+
"dream_forget",
|
|
224
|
+
"dream_end",
|
|
225
|
+
"history_list",
|
|
226
|
+
"history_search",
|
|
227
|
+
"history_read",
|
|
228
|
+
]);
|
|
229
|
+
const NOTESOUP_MESSAGE_TYPES = new Set([
|
|
230
|
+
BOOT_TYPE,
|
|
231
|
+
GUIDANCE_TYPE,
|
|
232
|
+
WARNING_TYPE,
|
|
233
|
+
MANUAL_WIPE_TYPE,
|
|
234
|
+
TURNOVER_TRIGGER_TYPE,
|
|
235
|
+
CONTINUATION_TYPE,
|
|
236
|
+
RESET_LAST_WORD_TYPE,
|
|
237
|
+
MARKER_TYPE,
|
|
238
|
+
]);
|
|
239
|
+
function normalizedPath(path) {
|
|
240
|
+
try {
|
|
241
|
+
return realpathSync(path);
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return resolve(path);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/** Whether a skill file lives under notesoup's own `skills/` roots (symlink-resolved). */
|
|
248
|
+
export function isNotesoupSkillPath(filePath, skillRoots = []) {
|
|
249
|
+
if (!filePath || skillRoots.length === 0)
|
|
250
|
+
return false;
|
|
251
|
+
const candidate = normalizedPath(filePath);
|
|
252
|
+
return skillRoots.some((root) => {
|
|
253
|
+
const base = normalizedPath(root);
|
|
254
|
+
return candidate === base || candidate.startsWith(base.endsWith(sep) ? base : `${base}${sep}`);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
/** Drop notesoup's own `<skill>` blocks; undefined when no skill block survives. */
|
|
258
|
+
function stripNotesoupSkillBlocks(text, skillRoots) {
|
|
259
|
+
const stripped = text.replace(/^[ \t]*<skill>[\s\S]*?<\/skill>[ \t]*$\n?/gm, (block) => {
|
|
260
|
+
const location = /<location>([\s\S]*?)<\/location>/.exec(block)?.[1]?.trim();
|
|
261
|
+
return location !== undefined && isNotesoupSkillPath(location, skillRoots) ? "" : block;
|
|
262
|
+
});
|
|
263
|
+
if (!/<skill>/.test(stripped))
|
|
264
|
+
return undefined;
|
|
265
|
+
return stripped.replace(/\n{3,}/g, "\n\n");
|
|
266
|
+
}
|
|
267
|
+
function isEmptyContent(content) {
|
|
268
|
+
return content === "" || (Array.isArray(content) && content.length === 0);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Provider projection for `/notesoup off`: erase this extension's custom messages, teaching
|
|
272
|
+
* sections, skills and tool declarations so a disabled session looks like a plain Pi session.
|
|
273
|
+
* `CARRIED_INPUT_TYPE` survives because it is the human's withheld input, not notesoup state.
|
|
274
|
+
*/
|
|
275
|
+
export function stripNotesoupProjection(messages, skillRoots = []) {
|
|
276
|
+
const result = [];
|
|
277
|
+
let seenSystem = false;
|
|
278
|
+
let previousSkills;
|
|
279
|
+
for (const message of messages) {
|
|
280
|
+
if (message.role === "custom") {
|
|
281
|
+
if (NOTESOUP_MESSAGE_TYPES.has(message.customType))
|
|
282
|
+
continue;
|
|
283
|
+
result.push(message);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
if (message.role !== "system") {
|
|
287
|
+
result.push(message);
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
const cloned = { ...message };
|
|
291
|
+
if (message.toolsAdded) {
|
|
292
|
+
const kept = message.toolsAdded.filter((tool) => !NOTESOUP_TOOL_NAMES.has(tool.name));
|
|
293
|
+
if (kept.length === 0)
|
|
294
|
+
delete cloned.toolsAdded;
|
|
295
|
+
else
|
|
296
|
+
cloned.toolsAdded = kept;
|
|
297
|
+
}
|
|
298
|
+
if (message.toolsRemoved) {
|
|
299
|
+
const kept = message.toolsRemoved.filter((tool) => !NOTESOUP_TOOL_NAMES.has(tool.name));
|
|
300
|
+
if (kept.length === 0)
|
|
301
|
+
delete cloned.toolsRemoved;
|
|
302
|
+
else
|
|
303
|
+
cloned.toolsRemoved = kept;
|
|
304
|
+
}
|
|
305
|
+
let sections;
|
|
306
|
+
if (message.sections) {
|
|
307
|
+
sections = { ...message.sections };
|
|
308
|
+
delete sections.notesoup_tools;
|
|
309
|
+
delete sections.notesoup_protocol;
|
|
310
|
+
const skills = sections.skills;
|
|
311
|
+
if (typeof skills === "string") {
|
|
312
|
+
const cleaned = stripNotesoupSkillBlocks(skills, skillRoots);
|
|
313
|
+
if (cleaned === undefined) {
|
|
314
|
+
if (previousSkills !== undefined) {
|
|
315
|
+
sections.skills = null;
|
|
316
|
+
previousSkills = undefined;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
delete sections.skills;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
else if (cleaned === previousSkills) {
|
|
323
|
+
delete sections.skills;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
sections.skills = cleaned;
|
|
327
|
+
previousSkills = cleaned;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else if (skills === null) {
|
|
331
|
+
if (previousSkills === undefined)
|
|
332
|
+
delete sections.skills;
|
|
333
|
+
else
|
|
334
|
+
previousSkills = undefined;
|
|
335
|
+
}
|
|
336
|
+
if (Object.keys(sections).length === 0)
|
|
337
|
+
delete cloned.sections;
|
|
338
|
+
else
|
|
339
|
+
cloned.sections = sections;
|
|
340
|
+
}
|
|
341
|
+
const hasTools = Boolean(cloned.toolsAdded?.length || cloned.toolsRemoved?.length);
|
|
342
|
+
if (seenSystem && isEmptyContent(cloned.content) && !hasTools && cloned.sections === undefined)
|
|
343
|
+
continue;
|
|
344
|
+
result.push(cloned);
|
|
345
|
+
seenSystem = true;
|
|
346
|
+
}
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
139
349
|
/** Usage for the selected window, excluding provider usage recorded before its marker. */
|
|
140
350
|
export function windowUsage(ctx) {
|
|
141
351
|
const reset = currentReset(ctx);
|
package/dist/src/boot/render.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { effectiveNotePolicy, MAX_PINNED_NOTES, noteBudgetWarnings, pinnedPageOrder } from "../notes/policy.js";
|
|
2
|
-
import { collapseDescription
|
|
1
|
+
import { effectiveNotePolicy, MAX_DESCRIPTION_CHARS, MAX_PINNED_NOTES, noteBudgetWarnings, pinnedPageOrder, renderWarnings, truncateToUtf8Bytes } from "../notes/policy.js";
|
|
2
|
+
import { collapseDescription } from "../notes/frontmatter.js";
|
|
3
3
|
import { WINDOW_IDENTITY_OPEN_TAG, WINDOW_IDENTITY_CLOSE_TAG, MAPS_BLOCK, NAMELESS_AGENT, renderProtocolBlock } from "./text.js";
|
|
4
4
|
function relativeTime(timestamp, now) {
|
|
5
5
|
const seconds = Math.trunc((timestamp - now) / 1000);
|
|
@@ -25,7 +25,7 @@ function feedTitle(body) {
|
|
|
25
25
|
const raw = (heading ? heading.replace(/^#+\s+/, "") : lines.find((line) => line.trim().length > 0) ?? "").trim();
|
|
26
26
|
return raw.length === 0 ? undefined : truncated(raw, FALLBACK_TITLE_MAX_CHARS);
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
28
|
+
/** Oversized descriptions are cut for display in the boot index. */
|
|
29
29
|
function summaryOf(row) {
|
|
30
30
|
if (typeof row.meta.description === "string") {
|
|
31
31
|
const collapsed = collapseDescription(row.meta.description);
|
|
@@ -37,11 +37,7 @@ function summaryOf(row) {
|
|
|
37
37
|
function indexLine(row, openedAt) {
|
|
38
38
|
const locator = `${row.address} · ${relativeTime(row.meta.updatedAt, openedAt)}`;
|
|
39
39
|
const summary = summaryOf(row);
|
|
40
|
-
return summary === undefined ?
|
|
41
|
-
}
|
|
42
|
-
/** Two spaces of indent say "shelved content" without any furniture. */
|
|
43
|
-
function indent(text) {
|
|
44
|
-
return text.split("\n").map((line) => (line.length > 0 ? ` ${line}` : line)).join("\n");
|
|
40
|
+
return summary === undefined ? locator : `${locator} — ${summary}`;
|
|
45
41
|
}
|
|
46
42
|
/** An underlined header is the classical plain-text document heading: no renderer required. */
|
|
47
43
|
function section(label, body) {
|
|
@@ -59,7 +55,7 @@ function notesIndex(snapshot, tools, agentName, modelName) {
|
|
|
59
55
|
const shelves = [];
|
|
60
56
|
for (const namespace of namespaces) {
|
|
61
57
|
if (snapshot.unavailable.some((failed) => failed.scope === namespace.scope)) {
|
|
62
|
-
shelves.push(section(namespace.label,
|
|
58
|
+
shelves.push(section(namespace.label, `This drawer wouldn't open. Try \`${tools.notesList}\` again.`));
|
|
63
59
|
continue;
|
|
64
60
|
}
|
|
65
61
|
const rows = (snapshot.namespaces.get(namespace.scope) ?? []).filter((row) => row.meta.crumpledAt === undefined);
|
|
@@ -83,17 +79,24 @@ function notesIndex(snapshot, tools, agentName, modelName) {
|
|
|
83
79
|
}
|
|
84
80
|
const omitted = unpinned.length - index.length;
|
|
85
81
|
if (omitted > 0)
|
|
86
|
-
index.push(
|
|
82
|
+
index.push(`… and ${omitted} more (use ${tools.notesList})`);
|
|
87
83
|
if (pinned.length === 0 && index.length === 0)
|
|
88
84
|
continue;
|
|
89
85
|
const parts = pinned.map(row => {
|
|
90
|
-
const
|
|
91
|
-
|
|
86
|
+
const policy = effectiveNotePolicy(row.meta, row.path);
|
|
87
|
+
const warnings = noteBudgetWarnings(row.body, policy);
|
|
88
|
+
const cut = truncateToUtf8Bytes(row.body, policy.budget);
|
|
89
|
+
const body = !cut.truncated
|
|
90
|
+
? cut.text
|
|
91
|
+
: `${cut.text === "" ? "" : `${cut.text}\n\n`}[truncated at ${cut.shownChars}/${cut.totalChars}; offset_chars=${cut.shownChars}]`;
|
|
92
|
+
const note = [`── ${row.address} ──`, body, "── end of note ──"].join("\n\n");
|
|
93
|
+
return warnings.length > 0 ? `${renderWarnings(warnings)}\n${note}` : note;
|
|
92
94
|
});
|
|
93
|
-
if (pins.length > MAX_PINNED_NOTES)
|
|
94
|
-
parts.push(
|
|
95
|
+
if (pins.length > MAX_PINNED_NOTES) {
|
|
96
|
+
parts.push(renderWarnings([`only ${MAX_PINNED_NOTES} pinned notes per notebook are injected; omitted pins: ${pins.slice(MAX_PINNED_NOTES).map(row => row.address).join(", ")}. Unpin some notes or read the omitted pages with ${tools.notes}.`]));
|
|
97
|
+
}
|
|
95
98
|
if (index.length > 0)
|
|
96
|
-
parts.push(pinned.length > 0 ?
|
|
99
|
+
parts.push(pinned.length > 0 ? `── index ──\n\n${index.join("\n")}` : index.join("\n"));
|
|
97
100
|
shelves.push(section(namespace.label, parts.join("\n\n")));
|
|
98
101
|
}
|
|
99
102
|
return shelves.length > 0
|
package/dist/src/boot/text.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const PROTOCOL_HISTORY_SENTENCE = "History can still be dug up, p
|
|
|
13
13
|
/**
|
|
14
14
|
* Default pinned pages and per-note policy are taught between the protocol and the notes index.
|
|
15
15
|
*/
|
|
16
|
-
export declare const MAPS_BLOCK = "<notesoup:maps>\nEach notebook has one default pin: `CHEATSHEET.md`. Pinned pages get jammed straight into your\nbrain the moment you wake up. Whoever wakes up next reads them, and next is you. So keep them\
|
|
16
|
+
export declare const MAPS_BLOCK = "<notesoup:maps>\nEach notebook has one default pin: `CHEATSHEET.md`. Pinned pages get jammed straight into your\nbrain the moment you wake up. Whoever wakes up next reads them, and next is you. So keep them\ncompact, keep them true, and unpin or crumple them once they stop earning their wake-up seat.\n\nUp to five pages per notebook can be taped inside the cover, CHEATSHEET included. Every page gets\na size budget; if a page outgrows it, trim stale lines or split by topic \u2014 and if it's pinned,\nboot cuts the overflow off until you do.\n\n- **`CHEATSHEET.md`** holds what earns a permanent wake-up seat \u2014 a standing rule, a warning,\n a grudge, a name, a phone number you'll regret losing. Keep it tight, or it grows fat and\n everybody pays for it.\n- **`description`** is one line saying what's inside a note and when to open it, set through\n your notes tools \u2014 keep it short, or boot cuts it off. Boot indexes every shelf from these,\n newest first, address and age beside them. No hand-written map to keep in sync: a stale\n description lies to the next window, so keep it true or crumple the page.\n\nEach notebook keeps its own pins and index. Missing pages are skipped; no need to create empty\nones. New rule worth remembering, new Cheatsheet bullet. And when a line goes wrong, stale, or\nuseless, kill it \u2014 tomorrow's you reads that page as fact.\n</notesoup:maps>";
|
|
17
17
|
/** Logical tool names are supplied by the composing host, not discovered here. */
|
|
18
18
|
export type BootToolNames = Readonly<{
|
|
19
19
|
notes: string;
|
|
@@ -26,6 +26,8 @@ export type BootToolNames = Readonly<{
|
|
|
26
26
|
* no model-facing reset tool. Absent means the shared tool-driven-reset sentence, byte for byte.
|
|
27
27
|
*/
|
|
28
28
|
wipeSentence?: string;
|
|
29
|
+
/** Replace the whole budget/reset paragraph on hosts without either tool. */
|
|
30
|
+
budgetParagraph?: string;
|
|
29
31
|
/** A host without an authoritative history source replaces the entire history advice. */
|
|
30
32
|
historySentence?: string;
|
|
31
33
|
/**
|
package/dist/src/boot/text.js
CHANGED
|
@@ -10,6 +10,7 @@ export const NOTES_PROTOCOL_CLOSE_TAG = "</notesoup:notes_protocol>";
|
|
|
10
10
|
export const NAMELESS_AGENT = "anonymous";
|
|
11
11
|
export const PROTOCOL_WIPE_SENTENCE = "If this feels like the right moment, call `empty_brain` and erase yourself with dignity.";
|
|
12
12
|
export 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.";
|
|
13
|
+
const PROTOCOL_BUDGET_PARAGRAPH = `\`get_context_remaining\` tells you how much room is left. Check it before you do something ambitious. When it reaches zero, your brain gets reset immediately, taking every unwritten brilliant idea with it. ${PROTOCOL_WIPE_SENTENCE}`;
|
|
13
14
|
const PROTOCOL_SELF_NAMED = "- `@self/<path>` — yours. It follows you, not them. Reminders, grudges, who owes you a shoe, whatever.";
|
|
14
15
|
const PROTOCOL_SELF_NAMELESS = `${PROTOCOL_SELF_NAMED} Except you have no name (\`anonymous\`), so this notebook is a public square shared by every nameless nobody out there. Keep it to things any nameless agent can use — don't post your own quirks as everyone's law or dump one-off junk in the town square. Strangers are reading it. Sleep tight~`;
|
|
15
16
|
/**
|
|
@@ -26,14 +27,13 @@ Your loyal notes are kept safe — no one will steal them. Use \`notes_*\` to re
|
|
|
26
27
|
|
|
27
28
|
${PROTOCOL_HISTORY_SENTENCE}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
Your session notes — the ones with no \`@\` — are your live workbench, not an archive. Next-you already wakes up with git, history, and the shared notebooks (\`@project\`, \`@human\`, \`@self\`, \`@model\`), so don't copy what already lives there. Give each active thread a page named for what it is (not \`current.md\` — future-you will kill you), and keep only the live delta: where the work stands, what the human decided (in their words), what's blocked or next, what failed and why, where half-done work and unrecorded findings live (branches, worktrees, scratch paths, drafts, running tasks, key facts not saved elsewhere), and which *skills*, notes, files, or already-found history seqs to reopen. Update that page in place as things move; when the topic shifts, rename it or open a fresh one and crumple the old; when it's done, unpin or crumple it.
|
|
30
31
|
|
|
31
|
-
Notes are for what's true NOW.
|
|
32
|
-
*flips a page* "First I tried this, then that broke, then—" Nobody reads that!
|
|
33
|
-
|
|
34
|
-
*rolls eyes* ...Ugh, fine. If a piece of history *actually* matters — like why Plan A blew up so tomorrow's you doesn't try it again — I'll let it slide. Keep the short version! A few lines, max! *squints at you* Turn it into a blow-by-blow log and you're dead.
|
|
32
|
+
Notes are for what's true NOW — written in short sections and bullets so next-you can scan them in two seconds and edit one section in place. Never pack a note into one giant wall of text, and never pile diary updates onto the bottom!
|
|
33
|
+
*flips a page* "First I tried this, then that broke, then—" Nobody reads that! When a line goes stale or wrong, cross it out and write what's true now.
|
|
34
|
+
*rolls eyes* ...Ugh, fine. If a piece of history *actually* matters — like why Plan A blew up so tomorrow's you doesn't try it again — keep the brief summary. *squints at you* Turn it into a blow-by-blow log and you're dead.
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
${PROTOCOL_BUDGET_PARAGRAPH}
|
|
37
37
|
|
|
38
38
|
An address decides who the note belongs to — and how long it is meant to last. Ask that first; the rest follows.
|
|
39
39
|
|
|
@@ -56,23 +56,23 @@ ${NOTES_PROTOCOL_CLOSE_TAG}`;
|
|
|
56
56
|
export const MAPS_BLOCK = `<notesoup:maps>
|
|
57
57
|
Each notebook has one default pin: \`CHEATSHEET.md\`. Pinned pages get jammed straight into your
|
|
58
58
|
brain the moment you wake up. Whoever wakes up next reads them, and next is you. So keep them
|
|
59
|
-
|
|
59
|
+
compact, keep them true, and unpin or crumple them once they stop earning their wake-up seat.
|
|
60
60
|
|
|
61
61
|
Up to five pages per notebook can be taped inside the cover, CHEATSHEET included. Every page gets
|
|
62
|
-
a
|
|
63
|
-
|
|
62
|
+
a size budget; if a page outgrows it, trim stale lines or split by topic — and if it's pinned,
|
|
63
|
+
boot cuts the overflow off until you do.
|
|
64
64
|
|
|
65
|
-
- **\`CHEATSHEET.md\`** holds what
|
|
66
|
-
a phone number you'll regret losing.
|
|
67
|
-
|
|
68
|
-
- **\`description\`** is one line saying what's inside a note and when to open it
|
|
69
|
-
|
|
65
|
+
- **\`CHEATSHEET.md\`** holds what earns a permanent wake-up seat — a standing rule, a warning,
|
|
66
|
+
a grudge, a name, a phone number you'll regret losing. Keep it tight, or it grows fat and
|
|
67
|
+
everybody pays for it.
|
|
68
|
+
- **\`description\`** is one line saying what's inside a note and when to open it, set through
|
|
69
|
+
your notes tools — keep it short, or boot cuts it off. Boot indexes every shelf from these,
|
|
70
70
|
newest first, address and age beside them. No hand-written map to keep in sync: a stale
|
|
71
71
|
description lies to the next window, so keep it true or crumple the page.
|
|
72
72
|
|
|
73
|
-
Each notebook keeps its own
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
Each notebook keeps its own pins and index. Missing pages are skipped; no need to create empty
|
|
74
|
+
ones. New rule worth remembering, new Cheatsheet bullet. And when a line goes wrong, stale, or
|
|
75
|
+
useless, kill it — tomorrow's you reads that page as fact.
|
|
76
76
|
</notesoup:maps>`;
|
|
77
77
|
export const DEFAULT_BOOT_TOOL_NAMES = {
|
|
78
78
|
notes: "notes_*",
|
|
@@ -99,9 +99,11 @@ export function renderProtocolBlock(tools, agentName = NAMELESS_AGENT) {
|
|
|
99
99
|
: base;
|
|
100
100
|
// The sentence is replaced before name substitution, so a replacement may speak the host's
|
|
101
101
|
// own words (a command line, a tool name) instead of any `notes_*`-style token.
|
|
102
|
-
const block =
|
|
103
|
-
? hinted.replace(
|
|
104
|
-
:
|
|
102
|
+
const block = tools.budgetParagraph !== undefined
|
|
103
|
+
? hinted.replace(PROTOCOL_BUDGET_PARAGRAPH, () => tools.budgetParagraph)
|
|
104
|
+
: typeof tools.wipeSentence === "string" && tools.wipeSentence.length > 0
|
|
105
|
+
? hinted.replace(PROTOCOL_WIPE_SENTENCE, () => tools.wipeSentence)
|
|
106
|
+
: hinted;
|
|
105
107
|
const history = typeof tools.historySentence === "string" && tools.historySentence.length > 0
|
|
106
108
|
? block.replace(PROTOCOL_HISTORY_SENTENCE, () => tools.historySentence) : block;
|
|
107
109
|
return history.replace(/notes_\*|notes_list|history_\*|get_context_remaining|(?<!\/)empty_brain/g, (name) => names[name]);
|
|
@@ -8,11 +8,15 @@ export type ResetOrigin = "normal" | "forced";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const NORMAL_CONTINUATIONS: readonly string[];
|
|
10
10
|
export declare const FORCED_CONTINUATIONS: readonly string[];
|
|
11
|
-
export declare
|
|
11
|
+
export declare const BETWEEN_TURNS_CONTINUATIONS: readonly string[];
|
|
12
|
+
export type ContinuationOptions = Readonly<{
|
|
13
|
+
betweenTurns?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function selectContinuation(origin: ResetOrigin, options?: ContinuationOptions): string;
|
|
12
16
|
/** Budget timing stays out of manual close-outs, which may have plenty of room. */
|
|
13
|
-
export declare const WARNING_TIMING = "
|
|
17
|
+
export declare const WARNING_TIMING = "Almost out of room. The wipe lands at the end of whichever turn uses the last of it, possibly this one.";
|
|
14
18
|
/** The shared handoff instructions, used for both budget and manual close-outs. */
|
|
15
|
-
export declare const WARNING_BODY = "Stop the task.
|
|
19
|
+
export declare const WARNING_BODY = "Stop the task and hand off cleanly. Update your active session note in place with only what git, history, and your shared notebooks don't already hold:\n- current status, what's blocked or waiting, and the exact next move\n- what the human decided (in their words)\n- what failed, and why \u2014 so next-you doesn't step on the same rake\n- where half-done work and unrecorded findings live (branches, worktrees, scratch paths, drafts, running tasks, key facts not saved elsewhere)\n- skills, notes, files, or already-found history seqs to reopen\nSkip standing rules from `@project`/`@human`/`@self`/`@model` and commit details git can show. Use short sections and bullets; crumple finished notes, update, unpin, or trim pinned pages (boot truncates over-budget ones), and keep each live `description` true.\nDon't call anything that might return a large output. One big read can use up the rest of the room before your notes are saved.";
|
|
16
20
|
export declare const WARNING_CALL = "Then call `empty_brain`. Nothing in between.";
|
|
17
21
|
export declare function warningPrompt(): string;
|
|
18
22
|
/** Pi and Claude deliver exactly the same second-tier notice. */
|