notesoup 0.60.1 → 0.62.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 -10
- 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 +2 -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 +1 -1
- package/dist/plugins/pi/budget.js +3 -2
- package/dist/plugins/pi/entries.d.ts +1 -0
- package/dist/plugins/pi/entries.js +1 -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/lifecycle.d.ts +1 -1
- package/dist/plugins/pi/reset/lifecycle.js +8 -9
- package/dist/plugins/pi/runtime.js +102 -61
- package/dist/plugins/pi/tool-result.js +7 -7
- package/dist/plugins/pi/window.d.ts +33 -3
- package/dist/plugins/pi/window.js +209 -9
- package/dist/src/boot/render.d.ts +5 -0
- package/dist/src/boot/render.js +60 -28
- package/dist/src/boot/text.d.ts +3 -3
- package/dist/src/boot/text.js +27 -26
- package/dist/src/budget/text.d.ts +2 -2
- package/dist/src/budget/text.js +13 -13
- 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 +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/notes/frontmatter.d.ts +4 -0
- package/dist/src/notes/frontmatter.js +15 -1
- 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 +47 -6
- package/dist/src/notes/store.d.ts +14 -0
- package/dist/src/notes/store.js +33 -12
- 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 -91
- 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 +58 -160
- package/dist/src/tools/notes.js +151 -99
- 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 +198 -16
- 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 +133 -14
- package/dist/test/claude-history.test.js +14 -13
- package/dist/test/claude-mod.test.js +9 -6
- 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 +65 -2
- package/dist/test/helpers/extension.js +72 -3
- 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/note-policy.test.js +189 -56
- 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 +2 -2
- package/docs/antigravity.md +44 -0
- package/docs/architecture.md +6 -4
- package/docs/claude-code-mod.md +2 -2
- package/docs/codex.md +36 -38
- package/docs/dsh.md +4 -4
- package/docs/history-sessions.md +28 -50
- package/docs/notes-library.md +6 -6
- 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 +3 -3
- 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 +1129 -549
- package/plugins/claude/hooks/register.ts +2 -2
- package/plugins/claude/playbook.md +3 -3
- package/plugins/claude/skills/dream/SKILL.md +2 -2
- package/plugins/claude/skills/notesoup/SKILL.md +92 -0
- package/plugins/claude/src/helper.ts +2 -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 +18494 -17905
- 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 +3 -3
- package/plugins/pi/entries.ts +1 -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/lifecycle.ts +9 -10
- package/plugins/pi/runtime.ts +96 -60
- package/plugins/pi/tool-result.ts +8 -8
- package/plugins/pi/window.ts +198 -9
- package/skills/dream/SKILL.md +2 -2
- package/skills/notesoup/SKILL.md +92 -0
- package/src/boot/render.ts +59 -25
- package/src/boot/text.ts +30 -27
- package/src/budget/text.ts +13 -13
- 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 +1 -1
- package/src/notes/frontmatter.ts +16 -1
- package/src/notes/index.ts +1 -1
- package/src/notes/policy.ts +45 -6
- package/src/notes/store.ts +30 -15
- 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 +150 -112
- 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
|
@@ -8,7 +8,6 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
import test from "node:test";
|
|
9
9
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
10
10
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
11
|
-
import { Check } from "typebox/value";
|
|
12
11
|
import { runHook } from "../plugins/codex/src/hooks.js";
|
|
13
12
|
import { writeBinding } from "../plugins/codex/src/identity.js";
|
|
14
13
|
import { isolateHistoryRoots, writePiTranscript } from "./helpers/history-corpus.js";
|
|
@@ -83,11 +82,16 @@ function metaFor(threadId, rootSessionId, model = "gpt-5.1-codex", windowId = W0
|
|
|
83
82
|
async function call(client, params) {
|
|
84
83
|
return await client.callTool(params);
|
|
85
84
|
}
|
|
86
|
-
async function connect(t, data, cli = CLI, notes) {
|
|
85
|
+
async function connect(t, data, cli = CLI, notes, codexHome) {
|
|
86
|
+
const env = { ...process.env, ...(notes === undefined ? {} : { NOTESOUP_HOME: notes }), ...(codexHome === undefined ? {} : { CODEX_HOME: codexHome }) };
|
|
87
|
+
if (data === undefined)
|
|
88
|
+
delete env.PLUGIN_DATA;
|
|
89
|
+
else
|
|
90
|
+
env.PLUGIN_DATA = data;
|
|
87
91
|
const transport = new StdioClientTransport({
|
|
88
92
|
command: process.execPath,
|
|
89
93
|
args: [cli, "mcp"],
|
|
90
|
-
env
|
|
94
|
+
env,
|
|
91
95
|
stderr: "pipe",
|
|
92
96
|
});
|
|
93
97
|
const client = new Client({ name: "notesoup-test", version: "1.0.0" }, { capabilities: {} });
|
|
@@ -99,21 +103,30 @@ function textOf(result) {
|
|
|
99
103
|
return (result.content ?? []).filter((part) => part.type === "text").map((part) => part.text ?? "").join("\n");
|
|
100
104
|
}
|
|
101
105
|
function errorCode(result) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
if (result.isError !== true)
|
|
107
|
+
return undefined;
|
|
108
|
+
if (result.structuredContent !== undefined)
|
|
109
|
+
return result.structuredContent.code;
|
|
110
|
+
return /^error: ([^:]+): /.exec(textOf(result))?.[1];
|
|
111
|
+
}
|
|
112
|
+
function plainText(result) {
|
|
113
|
+
assert.notEqual(result.isError, true, textOf(result));
|
|
114
|
+
assert.equal(result.structuredContent, undefined);
|
|
115
|
+
return textOf(result);
|
|
105
116
|
}
|
|
106
117
|
/* ---------------------------------------------------------------- manifests */
|
|
107
|
-
test("
|
|
108
|
-
const plugin = JSON.parse(readFileSync(join(REPO, "plugins/codex/plugin.json"), "utf8"));
|
|
109
|
-
assert.equal(plugin.$schema, "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json");
|
|
118
|
+
test("native Codex manifest discovers hooks and the bundled stdio helper", () => {
|
|
119
|
+
const plugin = JSON.parse(readFileSync(join(REPO, "plugins/codex/.codex-plugin/plugin.json"), "utf8"));
|
|
110
120
|
assert.equal(plugin.name, "notesoup");
|
|
111
|
-
|
|
112
|
-
assert.equal(
|
|
121
|
+
assert.equal(plugin.hooks, "./hooks/hooks.json");
|
|
122
|
+
assert.equal(plugin.mcpServers, "./.mcp.json");
|
|
123
|
+
const mcp = JSON.parse(readFileSync(join(REPO, "plugins/codex/.mcp.json"), "utf8"));
|
|
113
124
|
const server = mcp.mcpServers.notesoup;
|
|
114
125
|
assert.equal(server.type, "stdio");
|
|
115
126
|
assert.equal(server.command, "node");
|
|
116
|
-
assert.deepEqual(server.args, ["
|
|
127
|
+
assert.deepEqual(server.args, ["dist/codex/notesoup.js", "mcp"]);
|
|
128
|
+
assert.equal(server.cwd, ".");
|
|
129
|
+
assert.ok(server.env_vars.includes("CODEX_HOME"));
|
|
117
130
|
const hooks = JSON.parse(readFileSync(join(REPO, "plugins/codex/hooks/hooks.json"), "utf8")).hooks;
|
|
118
131
|
for (const event of ["SessionStart", "SubagentStart"]) {
|
|
119
132
|
const handler = hooks[event][0].hooks[0];
|
|
@@ -128,8 +141,8 @@ test("portable manifests name the Agent Plugins schema and the bundled stdio hel
|
|
|
128
141
|
const source = marketplace.plugins[0].source;
|
|
129
142
|
assert.equal(source.source, "local");
|
|
130
143
|
const root = resolve(REPO, source.path);
|
|
131
|
-
assert.equal(JSON.parse(readFileSync(join(root, "plugin.json"), "utf8")).name, "notesoup");
|
|
132
|
-
assert.ok(existsSync(join(root, "mcp.json")));
|
|
144
|
+
assert.equal(JSON.parse(readFileSync(join(root, ".codex-plugin/plugin.json"), "utf8")).name, "notesoup");
|
|
145
|
+
assert.ok(existsSync(join(root, ".mcp.json")));
|
|
133
146
|
});
|
|
134
147
|
test("a copied plugin without src or node_modules still initializes and lists all operations", async (t) => {
|
|
135
148
|
const copy = await mkdtemp(join(tmpdir(), "notesoup-codex-copy-"));
|
|
@@ -148,17 +161,22 @@ test("a copied plugin without src or node_modules still initializes and lists al
|
|
|
148
161
|
const client = await connect(t, data, join(copy, "dist/codex/notesoup.js"));
|
|
149
162
|
const listed = await client.listTools();
|
|
150
163
|
assert.deepEqual(listed.tools.map((tool) => tool.name).sort(), [
|
|
151
|
-
"history_list", "history_read",
|
|
164
|
+
"history_list", "history_read", "history_search",
|
|
152
165
|
"notes_list", "notes_read", "notes_update", "notes_write",
|
|
153
166
|
]);
|
|
154
167
|
for (const tool of listed.tools) {
|
|
155
168
|
const schema = tool.outputSchema;
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
if (tool.name === "notes_read") {
|
|
170
|
+
assert.equal(schema?.type, "object");
|
|
171
|
+
assert.ok(Array.isArray(schema?.anyOf));
|
|
172
|
+
}
|
|
173
|
+
else
|
|
174
|
+
assert.equal(schema, undefined, `${tool.name} has no output schema`);
|
|
158
175
|
}
|
|
159
176
|
const denied = await call(client, { name: "notes_list", arguments: {}, _meta: metaFor(ROOT, ROOT) });
|
|
160
177
|
assert.equal(denied.isError, true);
|
|
161
178
|
assert.equal(errorCode(denied), "unknown_thread");
|
|
179
|
+
assert.equal(denied.structuredContent, undefined);
|
|
162
180
|
const refusal = await runHookCli(join(copy, "dist/codex/notesoup.js"), "PreCompact", { session_id: ROOT, agent_id: CHILD, transcript_path: null, cwd: "/workspace/native", model: "gpt-5.4", trigger: "manual" }, { ...process.env, PLUGIN_DATA: data });
|
|
163
181
|
assert.match(refusal, /"continue":false/);
|
|
164
182
|
assert.match(refusal, /child post-compact boot/);
|
|
@@ -173,17 +191,15 @@ test("bundled Codex MCP reads another harness and wildcard results retain their
|
|
|
173
191
|
const client = await connect(t, f.data, CLI, f.home);
|
|
174
192
|
const read = await call(client, { name: "history_read", arguments: { session: "pi:foreign", seq: 1 }, _meta: metaFor(ROOT, ROOT) });
|
|
175
193
|
assert.equal(read.isError, undefined, textOf(read));
|
|
176
|
-
assert.
|
|
177
|
-
|
|
178
|
-
const list = await call(client, { name: "history_list", arguments: { session: "*", query: "needle" }, _meta: metaFor(ROOT, ROOT) });
|
|
194
|
+
assert.match(plainText(read), /^session pi:foreign-pi \| seq 1 \| user/);
|
|
195
|
+
const list = await call(client, { name: "history_search", arguments: { session: "*", query: "needle" }, _meta: metaFor(ROOT, ROOT) });
|
|
179
196
|
assert.equal(list.isError, undefined, textOf(list));
|
|
180
|
-
|
|
181
|
-
assert.
|
|
182
|
-
assert.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
assert.equal(limited.
|
|
186
|
-
assert.equal(limited.structuredContent.items.length, 1, "the limit bounds the page to one item");
|
|
197
|
+
assert.match(plainText(list), new RegExp(`=== session codex:${ROOT} ===\\nseq`));
|
|
198
|
+
assert.match(plainText(list), /=== session pi:foreign-pi ===\nseq/);
|
|
199
|
+
assert.doesNotMatch(plainText(list), /→ more (older|newer)/);
|
|
200
|
+
const limited = await call(client, { name: "history_search", arguments: { session: "*", query: "needle", limit: 1 }, _meta: metaFor(ROOT, ROOT) });
|
|
201
|
+
assert.match(plainText(limited), /→ more older results/);
|
|
202
|
+
assert.equal((plainText(limited).match(/^seq \d+ \|/gm) ?? []).length, 1, "the limit bounds the page to one item");
|
|
187
203
|
const invalid = await call(client, { name: "history_read", arguments: { session: "*", seq: 1 }, _meta: metaFor(ROOT, ROOT) });
|
|
188
204
|
assert.equal(errorCode(invalid), "invalid_session");
|
|
189
205
|
});
|
|
@@ -221,7 +237,7 @@ test("Codex resolves relative cwd against the verified binding, not the MCP proc
|
|
|
221
237
|
const meta = metaFor(ROOT, ROOT);
|
|
222
238
|
const written = await call(client, { name: "notes_write", arguments: { address: "@project/selected", content: "from Codex", cwd: "../other" }, _meta: meta });
|
|
223
239
|
assert.equal(written.isError, undefined, textOf(written));
|
|
224
|
-
assert.
|
|
240
|
+
assert.match(plainText(written), /project other/);
|
|
225
241
|
assert.match(readFileSync(join(f.home, "project", "other", "selected.md"), "utf8"), /from Codex/);
|
|
226
242
|
const read = await call(client, { name: "notes_read", arguments: { address: "@project/selected", cwd: "../other" }, _meta: meta });
|
|
227
243
|
assert.equal(read.isError, undefined, textOf(read));
|
|
@@ -242,7 +258,29 @@ test("refusals precede reads and writes: unknown thread, stale root, bad model,
|
|
|
242
258
|
assert.equal(errorCode(noModel), "missing_model");
|
|
243
259
|
const badParams = await call(client, { name: "notes_read", arguments: { address: 5 }, _meta: metaFor(ROOT, ROOT) });
|
|
244
260
|
assert.equal(errorCode(badParams), "invalid_params");
|
|
245
|
-
assert.
|
|
261
|
+
assert.equal(badParams.structuredContent.code, "invalid_params");
|
|
262
|
+
assert.match(textOf(badParams), /^error: invalid_params: .*address/);
|
|
263
|
+
const badWrite = await call(client, { name: "notes_write", arguments: { address: 5, content: "x" }, _meta: metaFor(ROOT, ROOT) });
|
|
264
|
+
assert.equal(errorCode(badWrite), "invalid_params");
|
|
265
|
+
assert.equal(badWrite.structuredContent, undefined);
|
|
266
|
+
assert.match(textOf(badWrite), /^error: invalid_params: .*address/);
|
|
267
|
+
const unknownTool = await call(client, { name: "no_such_tool", arguments: {}, _meta: metaFor(ROOT, ROOT) });
|
|
268
|
+
assert.equal(errorCode(unknownTool), "unknown_tool");
|
|
269
|
+
assert.equal(unknownTool.structuredContent, undefined);
|
|
270
|
+
});
|
|
271
|
+
test("native child hook and MCP launcher share the data directory and numbered window identity", async (t) => {
|
|
272
|
+
const f = await fixture(t, CHILD);
|
|
273
|
+
const data = join(f.home, "plugins", "data", "notesoup-notesoup");
|
|
274
|
+
await writeFile(f.transcript, jsonl([row("session_meta", sessionMeta(CHILD, { cli_version: "0.171.0", parent_thread_id: ROOT })), row("response_item", message("user", "child task"))]));
|
|
275
|
+
const output = JSON.parse(await runHook("SubagentStart", startPayload(f, { agent_id: CHILD, agent_type: "worker", hook_event_name: "SubagentStart" }), { ...process.env, PLUGIN_DATA: data, NOTESOUP_HOME: f.home }));
|
|
276
|
+
assert.match(output.hookSpecificOutput.additionalContext, /Agent name: worker/);
|
|
277
|
+
const client = await connect(t, undefined, CLI, f.home, f.home);
|
|
278
|
+
const meta = metaFor(CHILD, ROOT, "gpt-5.4", `${CHILD}:0`);
|
|
279
|
+
const result = await call(client, { name: "history_list", arguments: {}, _meta: meta });
|
|
280
|
+
assert.equal(result.isError, undefined, textOf(result));
|
|
281
|
+
assert.match(textOf(result), /child task/);
|
|
282
|
+
const stale = await call(client, { name: "notes_list", arguments: {}, _meta: { ...meta, windowId: `${ROOT}:0` } });
|
|
283
|
+
assert.equal(errorCode(stale), "stale_thread_binding");
|
|
246
284
|
});
|
|
247
285
|
test("notes refuse stale native windows before any read or write side effect", async (t) => {
|
|
248
286
|
const f = await fixture(t);
|
|
@@ -250,24 +288,24 @@ test("notes refuse stale native windows before any read or write side effect", a
|
|
|
250
288
|
const env = { ...process.env, PLUGIN_DATA: f.data, NOTESOUP_HOME: f.home };
|
|
251
289
|
await runHook("SessionStart", startPayload(f), env);
|
|
252
290
|
const client = await connect(t, f.data, CLI, f.home);
|
|
253
|
-
const meta = metaFor(ROOT, ROOT, "gpt-5.1-codex",
|
|
291
|
+
const meta = metaFor(ROOT, ROOT, "gpt-5.1-codex", `${ROOT}:0`);
|
|
254
292
|
const first = await call(client, { name: "notes_write", arguments: { address: "before.md", content: "kept" }, _meta: meta });
|
|
255
293
|
assert.equal(first.isError, undefined);
|
|
256
294
|
assert.ok(existsSync(join(f.home, "pi", "session", ROOT, "before.md")));
|
|
257
|
-
|
|
258
|
-
assert.equal(Check(writeSchema, first.structuredContent), true, "a success matches the declared output schema");
|
|
295
|
+
assert.match(plainText(first), /before\.md/);
|
|
259
296
|
// The native checkpoint advances the window while the hook binding and MCP
|
|
260
297
|
// metadata still name W0. Every operation must read the transcript fact.
|
|
261
298
|
appendFileSync(f.transcript, jsonl([row("compacted", compact(W1, W0, 1))]));
|
|
262
299
|
const staleWrite = await call(client, { name: "notes_write", arguments: { address: "after.md", content: "must not land" }, _meta: meta });
|
|
263
300
|
assert.equal(staleWrite.isError, true);
|
|
264
301
|
assert.equal(errorCode(staleWrite), "stale_native_state");
|
|
265
|
-
assert.equal(
|
|
266
|
-
assert.
|
|
302
|
+
assert.equal(staleWrite.structuredContent, undefined);
|
|
303
|
+
assert.match(textOf(staleWrite), /^error: stale_native_state: /);
|
|
267
304
|
assert.equal(existsSync(join(f.home, "pi", "session", ROOT, "after.md")), false);
|
|
268
305
|
const staleRead = await call(client, { name: "notes_read", arguments: { address: "before.md" }, _meta: meta });
|
|
269
306
|
assert.equal(staleRead.isError, true);
|
|
270
307
|
assert.equal(errorCode(staleRead), "stale_native_state");
|
|
308
|
+
assert.equal(staleRead.structuredContent.code, "stale_native_state");
|
|
271
309
|
assert.doesNotMatch(textOf(staleRead), /kept/);
|
|
272
310
|
});
|
|
273
311
|
test("history tools serve root and child native ancestry, and refuse stale native facts", async (t) => {
|
|
@@ -283,8 +321,8 @@ test("history tools serve root and child native ancestry, and refuse stale nativ
|
|
|
283
321
|
const meta = metaFor(ROOT, ROOT, "gpt-5.1-codex", W1);
|
|
284
322
|
const page = await call(client, { name: "history_list", arguments: {}, _meta: meta });
|
|
285
323
|
assert.equal(page.isError, undefined);
|
|
286
|
-
assert.match(textOf(page), /seq 2 \| user
|
|
287
|
-
assert.match(textOf(page), /seq 4 \| user
|
|
324
|
+
assert.match(textOf(page), /seq 2 \| user(?: \| [^|\n]+)?\nroot before/);
|
|
325
|
+
assert.match(textOf(page), /seq 4 \| user(?: \| [^|\n]+)?\nroot after/);
|
|
288
326
|
const read = await call(client, { name: "history_read", arguments: { seq: 4 }, _meta: meta });
|
|
289
327
|
assert.match(textOf(read), /root after/);
|
|
290
328
|
const childPath = join(dirname(f.transcript), nativeName(CHILD));
|
|
@@ -297,7 +335,7 @@ test("history tools serve root and child native ancestry, and refuse stale nativ
|
|
|
297
335
|
assert.equal(errorCode(invalidFilter), "invalid_params");
|
|
298
336
|
const childHistory = await call(client, { name: "history_list", arguments: {}, _meta: metaFor(CHILD, ROOT) });
|
|
299
337
|
assert.equal(childHistory.isError, undefined);
|
|
300
|
-
assert.match(textOf(childHistory), /^seq 2 \| user
|
|
338
|
+
assert.match(textOf(childHistory), /^seq 2 \| user(?: \| [^|\n]+)?\nchild task$/);
|
|
301
339
|
assert.doesNotMatch(textOf(childHistory), /root before|root after/);
|
|
302
340
|
const other = join(dirname(f.transcript), nativeName("019a0000-0000-7000-8000-000000000077"));
|
|
303
341
|
await writeFile(other, jsonl([row("session_meta", sessionMeta(CHILD, { session_id: "019a0000-0000-7000-8000-000000000088" })), row("response_item", message("user", "elsewhere"))]));
|
|
@@ -395,7 +433,7 @@ test("missing native facts or plugin data produce an actionable warning, never a
|
|
|
395
433
|
const env = { ...process.env, PLUGIN_DATA: f.data, NOTESOUP_HOME: f.home };
|
|
396
434
|
const warning = JSON.parse(await runHook("SessionStart", startPayload(f), env));
|
|
397
435
|
assert.match(warning.systemMessage ?? "", /no boot injected/);
|
|
398
|
-
assert.match(warning.systemMessage ?? "", /
|
|
436
|
+
assert.match(warning.systemMessage ?? "", /supported native transcript shape/);
|
|
399
437
|
const noData = JSON.parse(await runHook("SessionStart", startPayload(f), { ...process.env, NOTESOUP_HOME: f.home }));
|
|
400
438
|
assert.match(noData.systemMessage ?? "", /PLUGIN_DATA/);
|
|
401
439
|
await writeFile(f.transcript, "not json\n");
|
|
@@ -143,6 +143,8 @@ test("each plugin resolves only its own host, the core, and the public notes ent
|
|
|
143
143
|
["claude", new Set(["typebox"])],
|
|
144
144
|
["dsh", new Set(["typebox"])],
|
|
145
145
|
["codex", new Set(["typebox", "@modelcontextprotocol/sdk"])],
|
|
146
|
+
["antigravity", new Set(["typebox", "@modelcontextprotocol/sdk"])],
|
|
147
|
+
["mcp", new Set(["typebox", "@modelcontextprotocol/sdk"])],
|
|
146
148
|
];
|
|
147
149
|
for (const [plugin, allowed] of plugins) {
|
|
148
150
|
const entries = sources(join(root, "plugins", plugin));
|
|
@@ -245,7 +247,7 @@ test("AST guard sees every literal module edge, not import-like prose or comment
|
|
|
245
247
|
});
|
|
246
248
|
test("the core entry is host-neutral and the Pi plugin entry owns the extension", () => {
|
|
247
249
|
assert.deepEqual(Object.keys(core).sort(), [
|
|
248
|
-
"DEFAULT_BOOT_TOOL_NAMES", "NoteError", "createNotesStore", "deriveThresholds", "effectiveNotePolicy", "historyList", "historyRead",
|
|
250
|
+
"DEFAULT_BOOT_TOOL_NAMES", "NoteError", "createNotesStore", "deriveThresholds", "effectiveNotePolicy", "historyList", "historyRead", "historySearch",
|
|
249
251
|
"loadNotesSnapshot", "noteIdentity", "notesIdentityForCall", "notesList", "notesRead", "notesToolContext", "notesUpdate", "notesWrite", "projectHistory",
|
|
250
252
|
"projectKey", "remainingBudget", "renderBootBlock", "renderProtocolBlock", "selectContinuation", "slugify",
|
|
251
253
|
"tokenBudgetGuidance", "unavailableNotesSnapshot", "warningPrompt", "WARNING_BODY",
|
|
@@ -266,11 +268,12 @@ test("the configured extension source is the executable current entry", async ()
|
|
|
266
268
|
const commands = [];
|
|
267
269
|
built.default({
|
|
268
270
|
on() { },
|
|
271
|
+
registerFlag() { },
|
|
269
272
|
registerTool(tool) { tools.push(tool); },
|
|
270
273
|
registerCommand(name) { commands.push(name); },
|
|
271
274
|
});
|
|
272
|
-
assert.deepEqual(tools.map((tool) => tool.name).sort(), ["dream_begin", "dream_end", "dream_forget", "empty_brain", "get_context_remaining", "history_list", "history_read", "notes_list", "notes_read", "notes_update", "notes_write"]);
|
|
273
|
-
assert.deepEqual(tools.filter((tool) => tool.exposure === "deferred").map((tool) => tool.name).sort(), ["dream_begin", "dream_end", "dream_forget", "history_list", "history_read"], "dream and history tools stay hidden until searched");
|
|
275
|
+
assert.deepEqual(tools.map((tool) => tool.name).sort(), ["dream_begin", "dream_end", "dream_forget", "empty_brain", "get_context_remaining", "history_list", "history_read", "history_search", "notes_list", "notes_read", "notes_update", "notes_write"]);
|
|
276
|
+
assert.deepEqual(tools.filter((tool) => tool.exposure === "deferred").map((tool) => tool.name).sort(), ["dream_begin", "dream_end", "dream_forget", "history_list", "history_read", "history_search"], "dream and history tools stay hidden until searched");
|
|
274
277
|
assert.deepEqual(commands.sort(), ["empty", "fresh-window", "notesoup"]);
|
|
275
278
|
});
|
|
276
279
|
test("NOTESOUP_DISABLED turns the Pi extension fully off", async () => {
|
|
@@ -281,6 +284,7 @@ test("NOTESOUP_DISABLED turns the Pi extension fully off", async () => {
|
|
|
281
284
|
const events = [];
|
|
282
285
|
built.default({
|
|
283
286
|
on(event) { events.push(event); },
|
|
287
|
+
registerFlag() { },
|
|
284
288
|
registerTool(tool) { tools.push(tool); },
|
|
285
289
|
registerCommand(name) { commands.push(name); },
|
|
286
290
|
});
|
|
@@ -29,7 +29,7 @@ test("dream skill is publicly discoverable and resolves the shared playbook", ()
|
|
|
29
29
|
const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
30
30
|
assert.deepEqual(manifest.pi.skills, ["./skills"]);
|
|
31
31
|
assert.ok(manifest.files.includes("skills"));
|
|
32
|
-
discoverSkill(join(root, "skills"), "
|
|
32
|
+
discoverSkill(join(root, "skills"), "notesoup");
|
|
33
33
|
const skill = discoverSkill(join(root, "skills"), "dream");
|
|
34
34
|
const reference = readFileSync(join(skill.baseDir, "SKILL.md"), "utf8").match(/`([^`]+playbook\.md)`/)?.[1];
|
|
35
35
|
assert.ok(reference, "the skill links its playbook");
|
|
@@ -50,13 +50,13 @@ test("npm tarball keeps the skill's relative playbook path portable after extrac
|
|
|
50
50
|
}))[0];
|
|
51
51
|
const packedPaths = packed.files.map((file) => file.path);
|
|
52
52
|
assert.ok(packedPaths.includes("skills/dream/SKILL.md"));
|
|
53
|
-
assert.ok(packedPaths.includes("skills/
|
|
53
|
+
assert.ok(packedPaths.includes("skills/notesoup/SKILL.md"));
|
|
54
54
|
assert.ok(packedPaths.includes("playbook.md"));
|
|
55
55
|
const extracted = join(fixture, "extracted");
|
|
56
56
|
execFileSync("mkdir", ["-p", extracted]);
|
|
57
57
|
execFileSync("tar", ["-xzf", join(fixture, packed.filename), "-C", extracted]);
|
|
58
58
|
const installedRoot = join(extracted, "package");
|
|
59
|
-
discoverSkill(join(installedRoot, "skills"), "
|
|
59
|
+
discoverSkill(join(installedRoot, "skills"), "notesoup");
|
|
60
60
|
const installedSkill = discoverSkill(join(installedRoot, "skills"), "dream");
|
|
61
61
|
const reference = readFileSync(join(installedSkill.baseDir, "SKILL.md"), "utf8").match(/`([^`]+playbook\.md)`/)?.[1];
|
|
62
62
|
assert.ok(reference, "the installed skill links its playbook");
|