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/dist/src/settings.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
/** The one settings key every host reads its own fields from. */
|
|
1
2
|
export const NOTESOUP_SETTINGS_KEY = "notesoup";
|
|
2
|
-
/** Nested under "notesoup": the default dreamer model pattern, overridden by CLI --dreamer. */
|
|
3
|
-
export const NOTESOUP_DREAMER_KEY = "dreamer";
|
|
4
3
|
/** A plain settings object; arrays and null are not one. */
|
|
5
4
|
export function isPlainObject(value) {
|
|
6
5
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -12,13 +11,11 @@ function notesoupSettings(settings) {
|
|
|
12
11
|
const value = settings[NOTESOUP_SETTINGS_KEY];
|
|
13
12
|
return isPlainObject(value) ? value : {};
|
|
14
13
|
}
|
|
15
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Merge the global and project "notesoup" objects per key; project wins, mirroring Pi's deep
|
|
16
|
+
* merge. The record is exactly what the scopes contain: this core module owns the key and the
|
|
17
|
+
* merge, while each host names, reads and validates the fields it consumes.
|
|
18
|
+
*/
|
|
16
19
|
export function mergeNotesoupSettings(globalSettings, projectSettings) {
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
reminderMarginTokens: merged.reminderMarginTokens,
|
|
20
|
-
resetMarginTokens: merged.resetMarginTokens,
|
|
21
|
-
warningRunwayTokens: merged.warningRunwayTokens,
|
|
22
|
-
dreamer: merged.dreamer,
|
|
23
|
-
};
|
|
20
|
+
return { ...notesoupSettings(globalSettings), ...notesoupSettings(projectSettings) };
|
|
24
21
|
}
|
|
@@ -91,7 +91,7 @@ export declare const notesWriteParameters: Type.TObject<{
|
|
|
91
91
|
export declare const notesWrite: {
|
|
92
92
|
readonly name: "notes_write";
|
|
93
93
|
readonly label: "Notes write";
|
|
94
|
-
readonly description: "Create or replace a note. Name it for what it holds and when to use it. Store what git and history can't recover. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>`
|
|
94
|
+
readonly description: "Create or replace a note. Name it for what it holds and when to use it. Store what git and history can't recover. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
95
95
|
readonly parameters: Type.TObject<{
|
|
96
96
|
address: Type.TString;
|
|
97
97
|
content: Type.TString;
|
|
@@ -126,7 +126,7 @@ export declare const DIFF_SHORTENED_MARKER = "[diff truncated; update applied]";
|
|
|
126
126
|
export declare const notesUpdate: {
|
|
127
127
|
readonly name: "notes_update";
|
|
128
128
|
readonly label: "Notes update";
|
|
129
|
-
readonly description: "Edit a note, change its origin or crumpled state, or move it. Each `oldText` must match exactly once unless `replace_all` is true. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>`
|
|
129
|
+
readonly description: "Edit a note, change its origin or crumpled state, or move it. Each `oldText` must match exactly once unless `replace_all` is true. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
130
130
|
readonly parameters: Type.TObject<{
|
|
131
131
|
address: Type.TString;
|
|
132
132
|
edits: Type.TOptional<Type.TArray<Type.TObject<{
|
|
@@ -160,7 +160,7 @@ export declare const notesReadParameters: Type.TObject<{
|
|
|
160
160
|
export declare const notesRead: {
|
|
161
161
|
readonly name: "notes_read";
|
|
162
162
|
readonly label: "Notes read";
|
|
163
|
-
readonly description: "Read a note. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>`
|
|
163
|
+
readonly description: "Read a note. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
164
164
|
readonly parameters: Type.TObject<{
|
|
165
165
|
offset_chars: Type.TOptional<Type.TInteger>;
|
|
166
166
|
max_chars: Type.TOptional<Type.TInteger>;
|
|
@@ -200,7 +200,7 @@ export declare const notesListParameters: Type.TObject<{
|
|
|
200
200
|
export declare const notesList: {
|
|
201
201
|
readonly name: "notes_list";
|
|
202
202
|
readonly label: "Notes list";
|
|
203
|
-
readonly description: "List notes
|
|
203
|
+
readonly description: "List notes, newest first. Not pageable; `more` counts the rest. Omit `glob` or use `@default` for this session and current shared homes; `**` searches all homes, `@sessions/*/**` searches all sessions. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
204
204
|
readonly parameters: Type.TObject<{
|
|
205
205
|
glob: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
206
206
|
limit: Type.TOptional<Type.TInteger>;
|
|
@@ -239,7 +239,7 @@ export declare const MATCH_SHORTENED_MARKER = " [truncated]";
|
|
|
239
239
|
export declare const notesSearch: {
|
|
240
240
|
readonly name: "notes_search";
|
|
241
241
|
readonly label: "Notes search";
|
|
242
|
-
readonly description: "Search note bodies for literal text, case-insensitive. Without a query, lists notes with no match lines. Returns matching lines with offsets for `notes_read`. Not pageable; `more` counts the rest. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>`
|
|
242
|
+
readonly description: "Search note bodies for literal text, case-insensitive. Without a query, lists notes with no match lines. Returns matching lines with offsets for `notes_read`. Not pageable; `more` counts the rest. Omit `glob` or use `@default` for this session and current shared homes; `**` searches all homes, `@sessions/*/**` searches all sessions. Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
243
243
|
readonly parameters: Type.TObject<{
|
|
244
244
|
query: Type.TOptional<Type.TUnion<[Type.TString, Type.TArray<Type.TString>]>>;
|
|
245
245
|
glob: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
package/dist/src/tools/notes.js
CHANGED
|
@@ -12,8 +12,9 @@ const ORIGIN = Type.Optional(Type.Union([...ORIGIN_VALUES], {
|
|
|
12
12
|
const CRUMPLED_PARAMETER = Type.Optional(Type.Boolean({ description: "(optional) true = crumple (hide from list and search, still readable); false = restore." }));
|
|
13
13
|
const CRUMPLED_LIST_PARAMETER = Type.Optional(Type.Boolean({ description: "(optional) true = list only crumpled notes." }));
|
|
14
14
|
const FILE_LIMIT_PARAMETER = Type.Optional(Type.Integer({ minimum: 1, description: "(optional, default as many as fit) Max notes." }));
|
|
15
|
-
const GLOB_PARAMETER = nullableString("(optional) Glob over full addresses.");
|
|
16
|
-
const
|
|
15
|
+
const GLOB_PARAMETER = nullableString("(optional) Glob over full addresses, or @default for the current homes.");
|
|
16
|
+
const QUERY_HOMES_DESCRIPTION = "Omit `glob` or use `@default` for this session and current shared homes; `**` searches all homes, `@sessions/*/**` searches all sessions.";
|
|
17
|
+
const ADDRESS_DESCRIPTION = "Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable homes; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
17
18
|
/**
|
|
18
19
|
* Typed refusal. Every fact a caller needs is already in the message; there is no separate context.
|
|
19
20
|
* Convert expected refusals; unexpected errors propagate unchanged.
|
|
@@ -287,7 +288,7 @@ function renderListData(data) {
|
|
|
287
288
|
}
|
|
288
289
|
export const notesList = {
|
|
289
290
|
name: "notes_list", label: "Notes list",
|
|
290
|
-
description: `List notes
|
|
291
|
+
description: `List notes, newest first. Not pageable; \`more\` counts the rest. ${QUERY_HOMES_DESCRIPTION} ${ADDRESS_DESCRIPTION}`,
|
|
291
292
|
parameters: notesListParameters, outputSchema: resultSchema(NotesListDataSchema),
|
|
292
293
|
async execute(params, identity) {
|
|
293
294
|
try {
|
|
@@ -337,7 +338,7 @@ function fitSearchFile(file, fits) {
|
|
|
337
338
|
}
|
|
338
339
|
export const notesSearch = {
|
|
339
340
|
name: "notes_search", label: "Notes search",
|
|
340
|
-
description: `Search note bodies for literal text, case-insensitive. Without a query, lists notes with no match lines. Returns matching lines with offsets for \`notes_read\`. Not pageable; \`more\` counts the rest. ${ADDRESS_DESCRIPTION}`,
|
|
341
|
+
description: `Search note bodies for literal text, case-insensitive. Without a query, lists notes with no match lines. Returns matching lines with offsets for \`notes_read\`. Not pageable; \`more\` counts the rest. ${QUERY_HOMES_DESCRIPTION} ${ADDRESS_DESCRIPTION}`,
|
|
341
342
|
parameters: notesSearchParameters, outputSchema: resultSchema(NotesSearchDataSchema),
|
|
342
343
|
async execute(params, identity) {
|
|
343
344
|
try {
|
|
@@ -5,12 +5,13 @@ import { join } from "node:path";
|
|
|
5
5
|
import test from "node:test";
|
|
6
6
|
import { createAssistantMessageEventStream, getCurrentSystemMessage } from "@earendil-works/pi-ai";
|
|
7
7
|
import { createAgentSession, createCodemodeExtension, DefaultResourceLoader, ModelRuntime, SessionManager, SettingsManager, } from "@earendil-works/pi-coding-agent";
|
|
8
|
-
import notesoup, { createNotesoup } from "../
|
|
9
|
-
import { BOOT_TYPE, CONTINUATION_TYPE, GUIDANCE_TYPE, MANUAL_WIPE_TYPE, RESET_MARKER_TYPE, WARNING_TYPE } from "../
|
|
10
|
-
import { historyFromSession } from "../
|
|
8
|
+
import notesoup, { createNotesoup } from "../plugins/pi/extension.js";
|
|
9
|
+
import { BOOT_TYPE, CONTINUATION_TYPE, GUIDANCE_TYPE, MANUAL_WIPE_TYPE, RESET_MARKER_TYPE, WARNING_TYPE } from "../plugins/pi/entries.js";
|
|
10
|
+
import { historyFromSession } from "../plugins/pi/history.js";
|
|
11
11
|
import { assertBootHistory } from "./helpers/extension.js";
|
|
12
12
|
import { NOTES_PROTOCOL_OPEN_TAG, WINDOW_IDENTITY_OPEN_TAG } from "../src/boot/text.js";
|
|
13
|
-
import { FORCED_CONTINUATIONS, GUIDANCE_OPEN_TAG, NORMAL_CONTINUATIONS,
|
|
13
|
+
import { FORCED_CONTINUATIONS, GUIDANCE_OPEN_TAG, NORMAL_CONTINUATIONS, warningPrompt } from "../src/budget/text.js";
|
|
14
|
+
import { warningContent } from "../plugins/pi/text.js";
|
|
14
15
|
async function openFixture(options) {
|
|
15
16
|
const dir = options.cwd ?? mkdtempSync(join(tmpdir(), "notesoup-agent-loop-"));
|
|
16
17
|
const ownsDir = options.cwd === undefined;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { resetBoundaryCommitted } from "../
|
|
2
|
-
import { inspectResetTail } from "../
|
|
1
|
+
import { resetBoundaryCommitted } from "../plugins/pi/reset/committed.js";
|
|
2
|
+
import { inspectResetTail } from "../plugins/pi/reset/artifacts.js";
|
|
3
3
|
import assert from "node:assert/strict";
|
|
4
4
|
import { rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import test from "node:test";
|
|
6
|
-
import { historyFromSession } from "../
|
|
7
|
-
import { BOOT_TYPE, GUIDANCE_TYPE, RESET_MARKER_TYPE } from "../
|
|
6
|
+
import { historyFromSession } from "../plugins/pi/history.js";
|
|
7
|
+
import { BOOT_TYPE, GUIDANCE_TYPE, RESET_MARKER_TYPE } from "../plugins/pi/entries.js";
|
|
8
8
|
import { NOTES_PROTOCOL_OPEN_TAG, WINDOW_IDENTITY_CLOSE_TAG, WINDOW_IDENTITY_OPEN_TAG } from "../src/boot/text.js";
|
|
9
9
|
import { FORCED_CONTINUATIONS, NORMAL_CONTINUATIONS } from "../src/budget/text.js";
|
|
10
10
|
import { listNotes } from "./helpers/notes.js";
|
|
11
|
-
import { CONTINUATION_TYPE, MANUAL_WIPE_TYPE } from "../
|
|
11
|
+
import { CONTINUATION_TYPE, MANUAL_WIPE_TYPE } from "../plugins/pi/entries.js";
|
|
12
12
|
import { appendText, assertBootHistory, call, commitTurnEndBoundary, context, makeExtension, manager, noticesOf, resultData, resultJson, resultRead, runContextHook, runContextWithSystemHook, runHandlers, runManualCompact, runCommand, sentOf, } from "./helpers/extension.js";
|
|
13
13
|
import { installExtensionTestHooks } from "./helpers/extension-test-environment.js";
|
|
14
14
|
const testEnvironment = installExtensionTestHooks("notesoup-integration");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
3
|
import { DEFAULT_REMINDER_MARGIN_TOKENS, DEFAULT_RESERVE_TOKENS } from "../src/budget/constants.js";
|
|
4
|
-
import { GUIDANCE_TYPE, WARNING_TYPE } from "../
|
|
4
|
+
import { GUIDANCE_TYPE, WARNING_TYPE } from "../plugins/pi/entries.js";
|
|
5
5
|
import { NOTESOUP_SETTINGS_KEY } from "../src/settings.js";
|
|
6
6
|
import { appendText, call, commitTurnEndBoundary, context, makeExtension, manager, noticesOf, resultJson, runContextHook, runHandlers, sentOf, settingsFixture, } from "./helpers/extension.js";
|
|
7
7
|
import { installExtensionTestHooks } from "./helpers/extension-test-environment.js";
|
|
@@ -3,13 +3,13 @@ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import test from "node:test";
|
|
6
|
-
import { claudeHistoryFromJsonl, readClaudeHistory } from "../
|
|
6
|
+
import { claudeHistoryFromJsonl, readClaudeHistory } from "../plugins/claude/src/history.js";
|
|
7
7
|
import { renderBootBlock } from "../src/boot/render.js";
|
|
8
8
|
import { unavailableNotesSnapshot } from "../src/boot/snapshot.js";
|
|
9
9
|
import { DEFAULT_BOOT_TOOL_NAMES } from "../src/boot/text.js";
|
|
10
10
|
import { allItems, eventDocument } from "../src/history/history.js";
|
|
11
11
|
import { historyList, historyRead, historyWindows } from "../src/tools/history.js";
|
|
12
|
-
import { dispatch } from "../
|
|
12
|
+
import { dispatch } from "../plugins/claude/src/helper.js";
|
|
13
13
|
const sessionId = "synthetic-session";
|
|
14
14
|
function row(uuid, parentUuid, type, content, extra = {}) {
|
|
15
15
|
return { uuid, parentUuid, type, sessionId, timestamp: "2026-01-01T00:00:00Z", isSidechain: false,
|
|
@@ -6,14 +6,15 @@ import { join } from "node:path";
|
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import test from "node:test";
|
|
8
8
|
import { build } from "esbuild";
|
|
9
|
-
import { dispatch, handleLine } from "../
|
|
10
|
-
import { DEFAULT_CLAUDE_RESET_MARGIN_TOKENS, resolveClaudeLimits } from "../
|
|
9
|
+
import { dispatch, handleLine } from "../plugins/claude/src/helper.js";
|
|
10
|
+
import { DEFAULT_CLAUDE_RESET_MARGIN_TOKENS, resolveClaudeLimits } from "../plugins/claude/src/thresholds.js";
|
|
11
11
|
import { WARNING_RUNWAY_TOKENS } from "../src/budget/constants.js";
|
|
12
|
-
import { PROTOCOL_WIPE_SENTENCE,
|
|
13
|
-
import { CLAUDE_WARNING_PROMPT,
|
|
12
|
+
import { PROTOCOL_WIPE_SENTENCE, renderProtocolBlock } from "../src/boot/text.js";
|
|
13
|
+
import { CLAUDE_WARNING_PROMPT, CLAUDE_WIPE_SENTENCE } from "../plugins/claude/src/text.js";
|
|
14
|
+
import { COUNTDOWN_LINE, FORCED_CONTINUATIONS } from "../src/budget/text.js";
|
|
14
15
|
import { createNotesStore } from "../src/notes/index.js";
|
|
15
16
|
import { resolveProjectHome } from "../src/notes/project-home.js";
|
|
16
|
-
import { notesIdentityFromPi } from "../
|
|
17
|
+
import { notesIdentityFromPi } from "../plugins/pi/notes/adapter.js";
|
|
17
18
|
import { context, manager } from "./helpers/extension.js";
|
|
18
19
|
const identity = { home: mkdtempSync(join(tmpdir(), "claude-mod-")), sessionId: "session", cwd: process.cwd(), agent: "claude", model: "claude" };
|
|
19
20
|
async function callTool(tool, params) {
|
|
@@ -25,7 +26,7 @@ async function callTool(tool, params) {
|
|
|
25
26
|
* gets the real one; nothing else about the module is changed.
|
|
26
27
|
*/
|
|
27
28
|
async function loadHookModule(t) {
|
|
28
|
-
const hooksDir = join(process.cwd(), "
|
|
29
|
+
const hooksDir = join(process.cwd(), "plugins/claude/hooks");
|
|
29
30
|
const transpiled = await build({
|
|
30
31
|
stdin: { contents: readFileSync(join(hooksDir, "register.ts"), "utf8"), loader: "ts", resolveDir: hooksDir, sourcefile: "register.ts" },
|
|
31
32
|
bundle: false, format: "esm", platform: "node", target: "node22", write: false,
|
|
@@ -241,7 +242,7 @@ test("Claude Mod helper runs from a standalone copied plugin directory", () => {
|
|
|
241
242
|
const fixture = mkdtempSync(join(tmpdir(), "claude-mod-install-"));
|
|
242
243
|
try {
|
|
243
244
|
const plugin = join(fixture, "notesoup");
|
|
244
|
-
cpSync(join(process.cwd(), "
|
|
245
|
+
cpSync(join(process.cwd(), "plugins/claude"), plugin, { recursive: true });
|
|
245
246
|
const hook = readFileSync(join(plugin, "hooks/register.ts"), "utf8");
|
|
246
247
|
assert.ok(hook.includes('${import.meta.dir}/../dist/claude/helper.js'));
|
|
247
248
|
const helper = join(plugin, "dist/claude/helper.js");
|
|
@@ -666,10 +667,10 @@ test("Claude Mod skips the automatic reset when thresholds cannot be resolved",
|
|
|
666
667
|
assert.equal(notifications.filter((text) => text.includes("Brain size unknown")).length, 1, "one line, not one per turn");
|
|
667
668
|
});
|
|
668
669
|
test("Claude skill projections stay byte-identical to canonical shared files", () => {
|
|
669
|
-
assert.deepEqual(readFileSync(join(process.cwd(), "
|
|
670
|
-
assert.deepEqual(readFileSync(join(process.cwd(), "
|
|
671
|
-
assert.deepEqual(readFileSync(join(process.cwd(), "
|
|
672
|
-
const skill = readFileSync(join(process.cwd(), "
|
|
670
|
+
assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/memory/SKILL.md")), readFileSync(join(process.cwd(), "skills/memory/SKILL.md")));
|
|
671
|
+
assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/dream/SKILL.md")), readFileSync(join(process.cwd(), "skills/dream/SKILL.md")));
|
|
672
|
+
assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/playbook.md")), readFileSync(join(process.cwd(), "playbook.md")));
|
|
673
|
+
const skill = readFileSync(join(process.cwd(), "plugins/claude/skills/dream/SKILL.md"), "utf8");
|
|
673
674
|
assert.match(skill, /\.\.\/\.\.\/playbook\.md/);
|
|
674
675
|
assert.doesNotMatch(skill, /Claude.*runner|dream runner/i);
|
|
675
676
|
});
|
|
@@ -4,7 +4,7 @@ import { cpSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:f
|
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import test from "node:test";
|
|
7
|
-
const plugin = join(process.cwd(), "
|
|
7
|
+
const plugin = join(process.cwd(), "plugins/claude");
|
|
8
8
|
/** Only an absent executable may skip the real loader gate; other failures fail the suite. */
|
|
9
9
|
function validate(t, dir) {
|
|
10
10
|
const result = spawnSync("claude", ["plugin", "validate", dir, "--strict", "--json"], {
|
|
@@ -25,10 +25,10 @@ test("Claude mod passes the installed engine's strict loader validation", (t) =>
|
|
|
25
25
|
return;
|
|
26
26
|
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
27
27
|
assert.equal(result.report.success, true, result.stdout);
|
|
28
|
-
t.diagnostic("claude plugin validate
|
|
28
|
+
t.diagnostic("claude plugin validate plugins/claude --strict: passed");
|
|
29
29
|
});
|
|
30
30
|
test("Claude mod typechecks against the vendored engine contract without Node globals", () => {
|
|
31
|
-
const result = spawnSync(process.execPath, ["node_modules/typescript/bin/tsc", "-p", "
|
|
31
|
+
const result = spawnSync(process.execPath, ["node_modules/typescript/bin/tsc", "-p", "plugins/claude/tsconfig.json"], {
|
|
32
32
|
encoding: "utf8", timeout: 30_000,
|
|
33
33
|
});
|
|
34
34
|
assert.ifError(result.error);
|
|
@@ -7,8 +7,9 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
7
7
|
import test from "node:test";
|
|
8
8
|
import ts from "typescript";
|
|
9
9
|
import { dependencyViolations, moduleReferences } from "./helpers/dependency-graph.js";
|
|
10
|
-
import * as
|
|
11
|
-
import
|
|
10
|
+
import * as core from "../src/index.js";
|
|
11
|
+
import * as pi from "../plugins/pi/index.js";
|
|
12
|
+
import notesoup, { createNotesoup } from "../plugins/pi/index.js";
|
|
12
13
|
function repository() {
|
|
13
14
|
let root = dirname(fileURLToPath(import.meta.url));
|
|
14
15
|
while (!existsSync(join(root, "tsconfig.json")))
|
|
@@ -19,14 +20,14 @@ function sources(directory) {
|
|
|
19
20
|
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => entry.isDirectory() ? sources(join(directory, entry.name)) : entry.name.endsWith(".ts") ? [join(directory, entry.name)] : []);
|
|
20
21
|
}
|
|
21
22
|
const options = { module: ts.ModuleKind.NodeNext, moduleResolution: ts.ModuleResolutionKind.NodeNext, target: ts.ScriptTarget.ES2022 };
|
|
22
|
-
test("
|
|
23
|
+
test("the host-neutral core resolves without any SDK or plugin dependency", () => {
|
|
23
24
|
const root = repository();
|
|
24
25
|
const config = ts.readConfigFile(join(root, "tsconfig.json"), ts.sys.readFile);
|
|
25
26
|
assert.equal(config.error, undefined);
|
|
26
27
|
const parsed = ts.parseJsonConfigFileContent(config.config, ts.sys, root);
|
|
27
28
|
assert.deepEqual(parsed.errors, []);
|
|
28
29
|
const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
29
|
-
const shared = sources(join(root, "src"))
|
|
30
|
+
const shared = sources(join(root, "src"));
|
|
30
31
|
for (const domain of ["notes", "boot", "history", "budget", "tools", "dream"])
|
|
31
32
|
assert.ok(shared.some((file) => file.startsWith(join(root, "src", domain) + "/")), `${domain} is included`);
|
|
32
33
|
assert.deepEqual(dependencyViolations(root, shared, parsed.options, new Set(["typebox"])), []);
|
|
@@ -35,49 +36,48 @@ test("all shared domains resolve without any direct or transitive SDK, Pi adapte
|
|
|
35
36
|
assert.equal(manifest.peerDependencies[name], "*", `${name} follows Pi's host dependency contract`);
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
|
-
test("each
|
|
39
|
+
test("each plugin resolves only its own host, the core, and the public notes entry", () => {
|
|
39
40
|
const root = repository();
|
|
40
|
-
for (const
|
|
41
|
-
const entries = sources(join(root, "
|
|
42
|
-
if (
|
|
43
|
-
entries.push(...sources(join(root, "
|
|
44
|
-
assert.deepEqual(dependencyViolations(root, entries, options, new Set(["typebox"])), [],
|
|
41
|
+
for (const plugin of ["pi", "claude", "dsh"]) {
|
|
42
|
+
const entries = sources(join(root, "plugins", plugin));
|
|
43
|
+
if (plugin === "claude")
|
|
44
|
+
entries.push(...sources(join(root, "plugins/claude/hooks")));
|
|
45
|
+
assert.deepEqual(dependencyViolations(root, entries, options, new Set(["typebox"])), [], plugin);
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
test("dependency guard follows indirect types, re-exports, dynamic imports and import-type edges through resolved aliases", (t) => {
|
|
48
|
-
const root = mkdtempSync(join(tmpdir(), "
|
|
49
|
+
const root = mkdtempSync(join(tmpdir(), "notesoup-dependencies-"));
|
|
49
50
|
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
50
51
|
const put = (path, text) => { mkdirSync(dirname(join(root, path)), { recursive: true }); writeFileSync(join(root, path), text); };
|
|
51
52
|
put("package.json", '{"type":"module"}');
|
|
52
|
-
put("
|
|
53
|
-
put("src/index.ts", 'export * from "./pi/native.js";');
|
|
53
|
+
put("plugins/pi/native.ts", "export type Native = string;");
|
|
54
54
|
put("src/notes/bridge.ts", 'export type { Native } from "@native";');
|
|
55
55
|
put("src/notes/identity.ts", 'import type { Native } from "./bridge.js"; export type Identity = Native;');
|
|
56
|
-
put("src/dream/jail.ts", 'export const backend = () => import("
|
|
57
|
-
put("src/boot/snapshot.ts", 'export type Snapshot = import("
|
|
56
|
+
put("src/dream/jail.ts", 'export const backend = () => import("../../plugins/pi/native.js");');
|
|
57
|
+
put("src/boot/snapshot.ts", 'export type Snapshot = import("../../plugins/pi/native.js").Native;');
|
|
58
58
|
put("src/history/decoder.ts", 'import type { SessionEntry } from "@earendil-works/pi-coding-agent"; export type Entry = SessionEntry;');
|
|
59
59
|
put("src/history/query.ts", 'export type { Entry } from "./decoder.js";');
|
|
60
|
-
const fixtureOptions = { ...options, baseUrl: root, paths: { "@native": ["
|
|
60
|
+
const fixtureOptions = { ...options, baseUrl: root, paths: { "@native": ["plugins/pi/native.ts"] } };
|
|
61
61
|
const violations = dependencyViolations(root, ["src/notes/identity.ts", "src/dream/jail.ts", "src/boot/snapshot.ts", "src/history/query.ts"], fixtureOptions, new Set());
|
|
62
62
|
assert.deepEqual(violations, [
|
|
63
|
-
"src/notes/identity.ts -> src/notes/bridge.ts ->
|
|
64
|
-
"src/dream/jail.ts ->
|
|
65
|
-
"src/boot/snapshot.ts ->
|
|
63
|
+
"src/notes/identity.ts -> src/notes/bridge.ts -> plugins/pi/native.ts",
|
|
64
|
+
"src/dream/jail.ts -> plugins/pi/native.ts",
|
|
65
|
+
"src/boot/snapshot.ts -> plugins/pi/native.ts",
|
|
66
66
|
"src/history/query.ts -> src/history/decoder.ts -> @earendil-works/pi-coding-agent",
|
|
67
67
|
]);
|
|
68
|
-
put("src/boot/snapshot.ts", 'export type Snapshot = import("
|
|
69
|
-
put("
|
|
68
|
+
put("src/boot/snapshot.ts", 'export type Snapshot = import("../../plugins/dsh/native.js").Native;');
|
|
69
|
+
put("plugins/dsh/native.ts", "export type Native = string;");
|
|
70
70
|
put("src/history/query.ts", 'export type { Session } from "@deepseek-ai/dsh-session";');
|
|
71
71
|
assert.deepEqual(dependencyViolations(root, ["src/boot/snapshot.ts", "src/history/query.ts"], fixtureOptions, new Set()), [
|
|
72
|
-
"src/boot/snapshot.ts ->
|
|
72
|
+
"src/boot/snapshot.ts -> plugins/dsh/native.ts",
|
|
73
73
|
"src/history/query.ts -> @deepseek-ai/dsh-session",
|
|
74
74
|
]);
|
|
75
75
|
put("src/notes/bridge.ts", 'export type { Value as Native } from "./safe.js";');
|
|
76
76
|
put("src/notes/safe.ts", "export type Value = string;");
|
|
77
77
|
assert.deepEqual(dependencyViolations(root, ["src/notes/identity.ts"], fixtureOptions, new Set()), [], "a host-neutral type/re-export chain is allowed");
|
|
78
78
|
});
|
|
79
|
-
test("
|
|
80
|
-
const root = mkdtempSync(join(tmpdir(), "
|
|
79
|
+
test("plugin policies reject foreign hosts and notes internals, including reachable Claude hooks", (t) => {
|
|
80
|
+
const root = mkdtempSync(join(tmpdir(), "notesoup-plugins-"));
|
|
81
81
|
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
82
82
|
const put = (path, text) => { mkdirSync(dirname(join(root, path)), { recursive: true }); writeFileSync(join(root, path), text); };
|
|
83
83
|
put("package.json", '{"type":"module"}');
|
|
@@ -86,30 +86,31 @@ test("adapter policies reject foreign hosts and notes internals, including reach
|
|
|
86
86
|
const hosts = ["pi", "claude", "dsh"];
|
|
87
87
|
const sdks = ["@earendil-works/pi-coding-agent", "claude-code", "@deepseek-ai/cordis"];
|
|
88
88
|
for (const host of hosts)
|
|
89
|
-
put(`
|
|
89
|
+
put(`plugins/${host}/native.ts`, "export const value = 1;");
|
|
90
90
|
for (const [index, host] of hosts.entries()) {
|
|
91
|
-
const entry = `
|
|
91
|
+
const entry = `plugins/${host}/entry.ts`;
|
|
92
92
|
const check = () => dependencyViolations(root, [entry], options, new Set());
|
|
93
|
-
put(entry, `export type { Note } from "
|
|
93
|
+
put(entry, `export type { Note } from "../../src/notes/index.js"; import type { Native } from "${sdks[index]}";`);
|
|
94
94
|
assert.deepEqual(check(), [], `${host} may use its SDK and the notes entry`);
|
|
95
|
-
put(entry, 'export type { Note } from "
|
|
95
|
+
put(entry, 'export type { Note } from "../../src/notes/store.js";');
|
|
96
96
|
assert.deepEqual(check(), [`${entry} -> src/notes/store.ts`]);
|
|
97
97
|
const other = (index + 1) % hosts.length;
|
|
98
98
|
put(entry, `export { value } from "../${hosts[other]}/native.js";`);
|
|
99
|
-
assert.deepEqual(check(), [`${entry} ->
|
|
99
|
+
assert.deepEqual(check(), [`${entry} -> plugins/${hosts[other]}/native.ts`]);
|
|
100
100
|
put(entry, `export type { Native } from "${sdks[other]}";`);
|
|
101
101
|
assert.deepEqual(check(), [`${entry} -> ${sdks[other]}`]);
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
put("
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
// The Claude hook module is reachable from the Claude plugin and must obey the same rules.
|
|
104
|
+
put("plugins/claude/src/entry.ts", 'export { value } from "../hooks/register.js";');
|
|
105
|
+
put("plugins/claude/hooks/register.ts", 'export { value } from "../../pi/native.js";');
|
|
106
|
+
assert.deepEqual(dependencyViolations(root, ["plugins/claude/src/entry.ts"], options, new Set()), ["plugins/claude/src/entry.ts -> plugins/claude/hooks/register.ts -> plugins/pi/native.ts"]);
|
|
107
|
+
put("plugins/claude/hooks/register.ts", 'export type { Note } from "../../../src/notes/index.js";');
|
|
108
|
+
assert.deepEqual(dependencyViolations(root, ["plugins/claude/src/entry.ts"], options, new Set()), []);
|
|
109
|
+
put("plugins/pi/entry.ts", 'export type { Note } from "@notes-internal";');
|
|
110
|
+
assert.deepEqual(dependencyViolations(root, ["plugins/pi/entry.ts"], { ...options, baseUrl: root, paths: { "@notes-internal": ["src/notes/store.ts"] } }, new Set()), ["plugins/pi/entry.ts -> src/notes/store.ts"]);
|
|
110
111
|
});
|
|
111
112
|
test("runtime cycles are rejected but explicit and implicitly erased type edges are allowed", (t) => {
|
|
112
|
-
const root = mkdtempSync(join(tmpdir(), "
|
|
113
|
+
const root = mkdtempSync(join(tmpdir(), "notesoup-cycles-"));
|
|
113
114
|
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
114
115
|
mkdirSync(join(root, "src/boot"), { recursive: true });
|
|
115
116
|
writeFileSync(join(root, "package.json"), '{"type":"module"}');
|
|
@@ -136,18 +137,25 @@ test("AST guard sees every literal module edge, not import-like prose or comment
|
|
|
136
137
|
`, ts.ScriptTarget.Latest, true);
|
|
137
138
|
assert.deepEqual(moduleReferences(source), ["type-import", "type-reexport", "reexport", "import-type", "dynamic-import", "import-equals", "require-call"]);
|
|
138
139
|
});
|
|
139
|
-
test("the
|
|
140
|
-
assert.deepEqual(Object.keys(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
test("the core entry is host-neutral and the Pi plugin entry owns the extension", () => {
|
|
141
|
+
assert.deepEqual(Object.keys(core).sort(), [
|
|
142
|
+
"DEFAULT_BOOT_TOOL_NAMES", "NoteError", "createNotesStore", "deriveThresholds", "historyList", "historyRead", "historyWindows",
|
|
143
|
+
"loadNotesSnapshot", "noteIdentity", "notesList", "notesRead", "notesSearch", "notesUpdate", "notesWrite", "projectHistory",
|
|
144
|
+
"projectKey", "remainingBudget", "renderBootBlock", "renderProtocolBlock", "selectContinuation", "slugify",
|
|
145
|
+
"tokenBudgetGuidance", "unavailableNotesSnapshot", "warningPrompt", "WARNING_BODY",
|
|
146
|
+
].sort(), "the core exports a curated host-neutral surface and no extension");
|
|
147
|
+
assert.deepEqual(Object.keys(pi).sort(), ["createNotesoup", "default"], "the Pi plugin entry owns the extension");
|
|
148
|
+
assert.equal(pi.default, notesoup);
|
|
149
|
+
assert.equal(pi.createNotesoup, createNotesoup);
|
|
150
|
+
assert.equal(typeof createNotesoup(), "function");
|
|
144
151
|
});
|
|
145
|
-
test("configured extension source and moved dream CLI are executable current entries", async () => {
|
|
152
|
+
test("the configured extension source and the moved dream CLI are executable current entries", async () => {
|
|
146
153
|
const root = repository();
|
|
147
154
|
const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
155
|
+
assert.deepEqual(manifest.pi.extensions, ["./plugins/pi/index.ts"], "Pi loads the plugin entry from TypeScript source");
|
|
148
156
|
const entrySource = resolve(root, manifest.pi.extensions[0]);
|
|
149
157
|
assert.ok(existsSync(entrySource), "the manifest entry exists as TypeScript source (Pi loads it directly; plain Node cannot)");
|
|
150
|
-
const built = await import(pathToFileURL(resolve(root, "dist/
|
|
158
|
+
const built = await import(pathToFileURL(resolve(root, "dist/plugins/pi/index.js")).href);
|
|
151
159
|
const tools = [];
|
|
152
160
|
const commands = [];
|
|
153
161
|
built.default({
|
package/dist/test/doctor.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { main } from "../
|
|
2
|
+
import { main } from "../plugins/pi/dream/cli.js";
|
|
3
3
|
import { doctor } from "../src/dream/doctor.js";
|
|
4
4
|
import { existsSync, mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import test from "node:test";
|
|
@@ -28,8 +28,8 @@ test("dream skill is publicly discoverable and resolves the CLI's shared playboo
|
|
|
28
28
|
const root = packageRoot();
|
|
29
29
|
const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
30
30
|
assert.deepEqual(manifest.pi.skills, ["./skills"]);
|
|
31
|
-
assert.deepEqual(manifest.pi.extensions, ["./
|
|
32
|
-
assert.equal(manifest.bin.dream, "dist/
|
|
31
|
+
assert.deepEqual(manifest.pi.extensions, ["./plugins/pi/index.ts"]);
|
|
32
|
+
assert.equal(manifest.bin.dream, "dist/plugins/pi/dream/cli.js");
|
|
33
33
|
assert.ok(manifest.files.includes("skills"));
|
|
34
34
|
discoverSkill(join(root, "skills"), "memory");
|
|
35
35
|
const skill = discoverSkill(join(root, "skills"), "dream");
|
|
@@ -52,8 +52,8 @@ test("npm tarball keeps the skill's relative playbook path portable after extrac
|
|
|
52
52
|
assert.ok(packedPaths.includes("skills/dream/SKILL.md"));
|
|
53
53
|
assert.ok(packedPaths.includes("skills/memory/SKILL.md"));
|
|
54
54
|
assert.ok(packedPaths.includes("playbook.md"));
|
|
55
|
-
assert.ok(packedPaths.includes("
|
|
56
|
-
assert.ok(packedPaths.includes("dist/
|
|
55
|
+
assert.ok(packedPaths.includes("plugins/pi/index.ts"));
|
|
56
|
+
assert.ok(packedPaths.includes("dist/plugins/pi/dream/cli.js"));
|
|
57
57
|
const extracted = join(fixture, "extracted");
|
|
58
58
|
execFileSync("mkdir", ["-p", extracted]);
|
|
59
59
|
execFileSync("tar", ["-xzf", join(fixture, packed.filename), "-C", extracted]);
|
package/dist/test/dream.test.js
CHANGED
|
@@ -5,8 +5,8 @@ import test from "node:test";
|
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { basename, join } from "node:path";
|
|
7
7
|
import { acquireLock, releaseLock } from "../src/dream/lock.js";
|
|
8
|
-
import { dreamerDeleteToolDefinition, dreamerWriteToolDefinitions } from "../
|
|
9
|
-
import { main } from "../
|
|
8
|
+
import { dreamerDeleteToolDefinition, dreamerWriteToolDefinitions } from "../plugins/pi/dream/runner.js";
|
|
9
|
+
import { main } from "../plugins/pi/dream/cli.js";
|
|
10
10
|
const fixture = () => mkdtempSync(join(tmpdir(), "dream-test-"));
|
|
11
11
|
function scriptedSession(run) {
|
|
12
12
|
return async ({ cwd }) => {
|
|
@@ -22,8 +22,8 @@ test("dsh profile loads our rows and a second process restores the on-disk windo
|
|
|
22
22
|
await writeFile(join(profile, "package.json"), JSON.stringify({ name: "notesoup-test", private: true, version: "0.0.0", dsh: { profile: { bundles: ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-headless"] } } }));
|
|
23
23
|
const example = await readFile(join(repository, "docs/dsh.profile.patch.yml"), "utf8");
|
|
24
24
|
const patch = example
|
|
25
|
-
.replace("'notesoup/dsh/engine'", `'${pathToFileURL(join(repository, "dist/
|
|
26
|
-
.replace("'notesoup/dsh'", `'${pathToFileURL(join(repository, "dist/
|
|
25
|
+
.replace("'notesoup/dsh/engine'", `'${pathToFileURL(join(repository, "dist/plugins/dsh/engine.js")).href}'`)
|
|
26
|
+
.replace("'notesoup/dsh'", `'${pathToFileURL(join(repository, "dist/plugins/dsh/index.js")).href}'`)
|
|
27
27
|
.replace("# notesHome: /absolute/path/to/notes", `notesHome: ${join(directory, "notes")}`);
|
|
28
28
|
await writeFile(join(profile, "cordis.patch.yml"), patch + "\n- id: session-title-llm\n disabled: true\n");
|
|
29
29
|
const env = { ...process.env, DSH_HOME: home, DEEPSEEK_API_KEY: "mock-key", DEEPSEEK_BASE_URL: mock.url, DSH_TOOLS_MODE: "native" };
|
|
@@ -4,7 +4,7 @@ import { BasicCompactionEngine } from "@deepseek-ai/dsh-compaction-basic";
|
|
|
4
4
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
5
5
|
import { pluginRecordOf } from "@deepseek-ai/dsh-session";
|
|
6
6
|
import { dshFixture } from "./helpers/dsh.js";
|
|
7
|
-
import { WINDOW_RECORD } from "../
|
|
7
|
+
import { WINDOW_RECORD } from "../plugins/dsh/window.js";
|
|
8
8
|
/** Pin the shared host contract while naming our intentional template-vs-LLM differences. */
|
|
9
9
|
function transactionShape(session, from, head, result) {
|
|
10
10
|
const events = session.snapshotEvents().slice(from);
|
package/dist/test/dsh.test.js
CHANGED
|
@@ -14,11 +14,11 @@ import { notesRead } from "../src/tools/notes.js";
|
|
|
14
14
|
import { success } from "../src/tools/result.js";
|
|
15
15
|
import { createNotesStore } from "../src/notes/index.js";
|
|
16
16
|
import { dshFixture } from "./helpers/dsh.js";
|
|
17
|
-
import { decodeHistory } from "../
|
|
18
|
-
import { checkpointSnapshot, notesIdentity, recoverSnapshot, WINDOW_RECORD } from "../
|
|
19
|
-
import { measureBudget } from "../
|
|
17
|
+
import { decodeHistory } from "../plugins/dsh/history.js";
|
|
18
|
+
import { checkpointSnapshot, notesIdentity, recoverSnapshot, WINDOW_RECORD } from "../plugins/dsh/window.js";
|
|
19
|
+
import { measureBudget } from "../plugins/dsh/budget.js";
|
|
20
20
|
import { COUNTDOWN_LINE, FORCED_CONTINUATIONS, NORMAL_CONTINUATIONS } from "../src/budget/text.js";
|
|
21
|
-
import { preflight } from "../
|
|
21
|
+
import { preflight } from "../plugins/dsh/engine.js";
|
|
22
22
|
import { BasicCompactionEngine } from "@deepseek-ai/dsh-compaction-basic";
|
|
23
23
|
function prompt(text) { return createUserMessage({ content: [{ type: "text", text }], source: { kind: "user" } }); }
|
|
24
24
|
async function run(agent, text) { agent.followup(prompt(text)); await agent.whenIdle(); }
|
|
@@ -50,14 +50,15 @@ export function dependencyViolations(root, entries, options, runtimeDependencies
|
|
|
50
50
|
const runtime = new Map();
|
|
51
51
|
const cache = ts.createModuleResolutionCache(root, (path) => path, options);
|
|
52
52
|
const sourceRoot = resolve(root, "src");
|
|
53
|
-
const
|
|
53
|
+
const pluginRoot = resolve(root, "plugins");
|
|
54
|
+
const notesRoot = resolve(sourceRoot, "notes");
|
|
54
55
|
const notesEntry = resolve(sourceRoot, "notes/index.ts");
|
|
55
56
|
const display = (path) => relative(root, path).split(sep).join("/");
|
|
56
|
-
const local = (file) => file.startsWith(sourceRoot + sep) || file.startsWith(
|
|
57
|
+
const local = (file) => file.startsWith(sourceRoot + sep) || file.startsWith(pluginRoot + sep);
|
|
57
58
|
const adapter = (file) => {
|
|
58
59
|
const path = display(file);
|
|
59
|
-
return
|
|
60
|
-
??
|
|
60
|
+
return /^plugins\/(pi|claude|dsh)\//.exec(path)?.[1]
|
|
61
|
+
?? packageAdapter(file.split(sep).join("/").split("/node_modules/").at(-1));
|
|
61
62
|
};
|
|
62
63
|
const walk = (file, chain) => {
|
|
63
64
|
file = realpathSync(file);
|
|
@@ -86,9 +87,10 @@ export function dependencyViolations(root, entries, options, runtimeDependencies
|
|
|
86
87
|
}
|
|
87
88
|
const target = realpathSync(resolution.resolvedFileName);
|
|
88
89
|
const targetOwner = adapter(target);
|
|
89
|
-
if (
|
|
90
|
-
(owner && target.startsWith(
|
|
91
|
-
(owner === "dsh" && target.startsWith(resolve(sourceRoot, "dream") + sep))
|
|
90
|
+
if ((targetOwner && targetOwner !== owner) ||
|
|
91
|
+
(owner && target.startsWith(notesRoot + sep) && target !== notesEntry) ||
|
|
92
|
+
(owner === "dsh" && target.startsWith(resolve(sourceRoot, "dream") + sep)) ||
|
|
93
|
+
(!owner && target.startsWith(pluginRoot + sep))) {
|
|
92
94
|
violations.push([...here, display(target)].join(" -> "));
|
|
93
95
|
continue;
|
|
94
96
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TestContext } from "node:test";
|
|
2
2
|
import { Context } from "@deepseek-ai/cordis";
|
|
3
3
|
import { type SessionEvent } from "@deepseek-ai/dsh-session";
|
|
4
|
-
import NotesoupEngine, { type EngineConfig } from "../../
|
|
4
|
+
import NotesoupEngine, { type EngineConfig } from "../../plugins/dsh/engine.js";
|
|
5
5
|
export declare function dshFixture(t: TestContext, config?: EngineConfig): Promise<{
|
|
6
6
|
ctx: Context;
|
|
7
7
|
engine: NotesoupEngine;
|
package/dist/test/helpers/dsh.js
CHANGED
|
@@ -14,8 +14,8 @@ import Tools from "@deepseek-ai/dsh-tools";
|
|
|
14
14
|
import Meter from "@deepseek-ai/dsh-token-meter";
|
|
15
15
|
import Query from "@deepseek-ai/dsh-session-query-sqlite";
|
|
16
16
|
import { createLaunchEnvironmentSnapshot } from "@deepseek-ai/dsh-launch-environment";
|
|
17
|
-
import NotesoupEngine from "../../
|
|
18
|
-
import notesoup from "../../
|
|
17
|
+
import NotesoupEngine from "../../plugins/dsh/engine.js";
|
|
18
|
+
import notesoup from "../../plugins/dsh/index.js";
|
|
19
19
|
import { messagesServer } from "./dsh-messages.js";
|
|
20
20
|
export async function dshFixture(t, config = {}) {
|
|
21
21
|
const directory = await mkdtemp(join(tmpdir(), "ns-dsh-test-"));
|