notesoup 0.52.7 → 0.53.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.
Files changed (59) hide show
  1. package/README.md +3 -1
  2. package/dist/plugins/codex/src/cli.d.ts +2 -0
  3. package/dist/plugins/codex/src/cli.js +25 -0
  4. package/dist/plugins/codex/src/history.d.ts +8 -0
  5. package/dist/plugins/codex/src/history.js +238 -0
  6. package/dist/plugins/codex/src/hooks.d.ts +9 -0
  7. package/dist/plugins/codex/src/hooks.js +196 -0
  8. package/dist/plugins/codex/src/identity.d.ts +35 -0
  9. package/dist/plugins/codex/src/identity.js +134 -0
  10. package/dist/plugins/codex/src/mcp.d.ts +7 -0
  11. package/dist/plugins/codex/src/mcp.js +159 -0
  12. package/dist/plugins/codex/src/state.d.ts +23 -0
  13. package/dist/plugins/codex/src/state.js +92 -0
  14. package/dist/plugins/codex/src/text.d.ts +14 -0
  15. package/dist/plugins/codex/src/text.js +25 -0
  16. package/dist/plugins/codex/src/transcript.d.ts +39 -0
  17. package/dist/plugins/codex/src/transcript.js +313 -0
  18. package/dist/src/boot/render.js +11 -10
  19. package/dist/src/boot/text.d.ts +4 -5
  20. package/dist/src/boot/text.js +14 -28
  21. package/dist/src/budget/text.d.ts +1 -1
  22. package/dist/src/budget/text.js +1 -1
  23. package/dist/test/codex-history.test.d.ts +1 -0
  24. package/dist/test/codex-history.test.js +330 -0
  25. package/dist/test/codex-plugin.test.d.ts +1 -0
  26. package/dist/test/codex-plugin.test.js +365 -0
  27. package/dist/test/dependencies.test.js +8 -2
  28. package/dist/test/dsh.test.js +1 -1
  29. package/dist/test/helpers/dependency-graph.js +1 -1
  30. package/dist/test/model-facing-text.test.js +41 -26
  31. package/dist/test/notes.integration.test.js +3 -0
  32. package/docs/codex.md +91 -0
  33. package/docs/dsh.md +1 -1
  34. package/docs/reset-lifecycle.md +1 -1
  35. package/package.json +6 -3
  36. package/playbook.md +1 -1
  37. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  38. package/plugins/claude/dist/claude/helper.js +24 -35
  39. package/plugins/claude/playbook.md +1 -1
  40. package/plugins/claude/skills/dream/SKILL.md +1 -1
  41. package/plugins/claude/skills/memory/SKILL.md +1 -1
  42. package/plugins/codex/README.md +43 -0
  43. package/plugins/codex/dist/codex/notesoup.js +27800 -0
  44. package/plugins/codex/hooks/hooks.json +41 -0
  45. package/plugins/codex/mcp.json +10 -0
  46. package/plugins/codex/plugin.json +6 -0
  47. package/plugins/codex/src/cli.ts +26 -0
  48. package/plugins/codex/src/history.ts +193 -0
  49. package/plugins/codex/src/hooks.ts +190 -0
  50. package/plugins/codex/src/identity.ts +147 -0
  51. package/plugins/codex/src/mcp.ts +171 -0
  52. package/plugins/codex/src/state.ts +102 -0
  53. package/plugins/codex/src/text.ts +31 -0
  54. package/plugins/codex/src/transcript.ts +275 -0
  55. package/skills/dream/SKILL.md +1 -1
  56. package/skills/memory/SKILL.md +1 -1
  57. package/src/boot/render.ts +11 -9
  58. package/src/boot/text.ts +16 -30
  59. package/src/budget/text.ts +1 -1
@@ -35,7 +35,7 @@ function section(label: string, body: string): string {
35
35
  /** Pi's default agent slug: an unnamed agent shares its `@self` shelf with every other nameless one. */
36
36
  const NAMELESS_AGENT = "anonymous";
37
37
 
38
- /** One closed boot snapshot: five tabbed shelves, current hands first, durable last; each shelf keeps its map and its own freshest pages. */
38
+ /** One closed boot snapshot: five tabbed shelves, current hands first, durable last; each shelf keeps its pinned pages and its own freshest pages. */
39
39
  function notesIndex(snapshot: NotesSnapshot, tools: BootToolNames, agentName: string, modelName: string): string {
40
40
  const homes: ReadonlyArray<{ scope: NotesHome["scope"]; label: string }> = [
41
41
  { scope: "session", label: "no @ — this session" },
@@ -52,18 +52,20 @@ function notesIndex(snapshot: NotesSnapshot, tools: BootToolNames, agentName: st
52
52
  continue;
53
53
  }
54
54
  const rows = (snapshot.homes.get(home.scope) ?? []).filter((row) => row.meta.crumpledAt === undefined);
55
- const map = rows.find((row) => row.path === "MAP.md");
55
+ const pinned = ["CHEATSHEET.md", "MAP.md"].flatMap((path) => {
56
+ const row = rows.find((row) => row.path === path);
57
+ return row?.body ? [row] : [];
58
+ });
56
59
  const fresh = rows
57
- .filter((row) => row.path !== "MAP.md")
60
+ .filter((row) => row.path !== "MAP.md" && row.path !== "CHEATSHEET.md")
58
61
  .slice(0, SHELF_FRESH_LIMIT)
59
62
  .map((row) => {
60
63
  const locator = `${row.address} · ${relativeTime(row.meta.updatedAt, snapshot.openedAt)}`;
61
64
  const title = feedTitle(row.body);
62
65
  return title === undefined ? ` ${locator}` : ` ${title}\n ${locator}`;
63
66
  });
64
- if (!map?.body && fresh.length === 0) continue;
65
- const parts: string[] = [];
66
- if (map?.body) parts.push(`map\n\n${indent(mapBodyForBoot(map.address, map.body))}`);
67
+ if (pinned.length === 0 && fresh.length === 0) continue;
68
+ const parts = pinned.map((row) => `${row.path === "MAP.md" ? "map" : "cheatsheet"}\n\n${indent(pinnedBodyForBoot(row.address, row.body))}`);
67
69
  if (fresh.length > 0) parts.push(`recent\n\n${fresh.join("\n\n")}`);
68
70
  shelves.push(section(home.label, parts.join("\n\n")));
69
71
  }
@@ -73,11 +75,11 @@ function notesIndex(snapshot: NotesSnapshot, tools: BootToolNames, agentName: st
73
75
  : "YOUR NOTES\n──────────\n\nNone yet. A blank slate is a fine place to start — just don't finish there.";
74
76
  }
75
77
 
76
- /** One unbounded MAP body fits the boot only up to the cap; the cut names where the rest lives. */
77
- function mapBodyForBoot(address: string, body: string): string {
78
+ /** Each pinned page is bounded; the cut names where the rest lives. */
79
+ function pinnedBodyForBoot(address: string, body: string): string {
78
80
  const chars = Array.from(body);
79
81
  if (chars.length <= MAP_BOOT_MAX_CHARS) return body;
80
- return `${chars.slice(0, MAP_BOOT_MAX_CHARS).join("")}\n[truncated at ${MAP_BOOT_MAX_CHARS} chars; slim this MAP down, full body at \`${address}\`]`;
82
+ return `${chars.slice(0, MAP_BOOT_MAX_CHARS).join("")}\n[truncated at ${MAP_BOOT_MAX_CHARS} chars; slim this page down, full body at \`${address}\`]`;
81
83
  }
82
84
 
83
85
  export type BootWindowTree = {
package/src/boot/text.ts CHANGED
@@ -1,6 +1,6 @@
1
- /** Each shelf shows this many of its own freshest pages beneath the map. */
1
+ /** Each shelf shows this many of its own freshest pages beneath its pinned pages. */
2
2
  export const SHELF_FRESH_LIMIT = 3;
3
- /** One MAP body is inlined per home; past this many code points the boot shows a fitting prefix plus a pointer. */
3
+ /** Each pinned page is inlined per home up to this many code points, then a lookup pointer. */
4
4
  export const MAP_BOOT_MAX_CHARS = 4096;
5
5
  export const WINDOW_IDENTITY_OPEN_TAG = "<notesoup:window_identity>";
6
6
  export const WINDOW_IDENTITY_CLOSE_TAG = "</notesoup:window_identity>";
@@ -54,36 +54,22 @@ Any other @ address is fake. End of discussion. @ addresses are not file paths:
54
54
  ${NOTES_PROTOCOL_CLOSE_TAG}`;
55
55
 
56
56
  /**
57
- * The MAP page is taught once per window, as its own section between the protocol and the notes
58
- * index. A MAP is the one note every waking window loads, so this block says what one holds.
57
+ * The two pinned pages are taught once per window between the protocol and the notes index.
59
58
  */
60
59
  export const MAPS_BLOCK = `<notesoup:maps>
61
- Every home's root can hold a \`MAP.md\`, and a MAP is the one page that never waits on a shelf — it
62
- gets jammed straight into your brain the moment you wake up. No asking, no skipping. Whoever wakes
63
- up next reads it, and next is you. So keep it short, and keep it true.
64
-
65
- Two things live in there:
66
-
67
- - **Cheatsheet.** A cheatsheet is a cheatsheet. Scribble whatever you'll want next time — a rule, a
68
- warning, a grudge, a name, a phone number you'll regret losing. Nobody grades it. Just keep it
69
- under five lines, or it grows fat and everybody pays for it.
70
- - **Index.** One line per durable note: the address, then a gist short enough to tell whether the
71
- thing is worth opening.
72
-
73
- \`\`\`
74
- # CHEATSHEET
75
- - Read the repo before asking; run it before believing it
76
- - Report times in Beijing time
77
-
78
- # INDEX
79
- - release-and-local-install.md — version bump, local override install, host load timing
80
- - history-api-v2-design.md — seq addressing; read before touching history
81
- - current-reset-and-dream-scope.md — reset scope, dream territory, session ownership
82
- \`\`\`
83
-
84
- Every home gets one: \`@project\`, \`@human\`, \`@self\`, \`@model\`. New note, new line. New rule worth
85
- remembering, new Cheatsheet line. And when a line stops being true, kill it — every window after you
86
- reads that page as fact.
60
+ Every home's root can hold two pages that never wait on a shelf: \`CHEATSHEET.md\` and \`MAP.md\`.
61
+ Both get jammed straight into your brain the moment you wake up. No asking, no skipping. Whoever
62
+ wakes up next reads them, and next is you. So keep them short, and keep them true.
63
+
64
+ - **\`CHEATSHEET.md\`** holds what you'll want next time — a rule, a warning, a grudge, a name,
65
+ a phone number you'll regret losing. Nobody grades it. Keep it to five lines, or it grows fat
66
+ and everybody pays for it.
67
+ - **\`MAP.md\`** is only the note index. One line per durable note: the address, then a gist short
68
+ enough to tell whether the thing is worth opening. Rules belong in \`CHEATSHEET.md\`, not here.
69
+
70
+ Each home keeps its own: \`@project\`, \`@human\`, \`@self\`, \`@model\`. Missing pages are skipped;
71
+ no need to create empty ones. New note, new MAP line. New rule worth remembering, new Cheatsheet
72
+ line. And when a line stops being true, kill it — every window after you reads that page as fact.
87
73
  </notesoup:maps>`;
88
74
 
89
75
  /** Logical tool names are supplied by the composing host, not discovered here. */
@@ -33,7 +33,7 @@ export const WARNING_TIMING = "The reserve is nearly spent. The wipe lands at th
33
33
 
34
34
  /** The shared handoff instructions, used for both budget and manual close-outs. */
35
35
  export const WARNING_BODY =
36
- "Stop the task. Write down what git and history can't give back:\n- where you are, and how far you got\n- what the human decided, in their words\n- what's blocked or waiting\n- the next move\n- where the half-done work sits\n- what failed, and why\n- which skills, seqs, notes, or files to reopen\n- anything else worth noting\nThen leave the shelf current: replace what's stale, a whole note or a section inside one, and crumple the dead ones. Update and trim the MAP files; every new window loads them. The next window gets whatever you leave, dead notes and dead sections alike.\nDon't call anything that might return a large output. One big read can spend the rest of the reserve before your notes are saved.";
36
+ "Stop the task. Write down what git and history can't give back:\n- where you are, and how far you got\n- what the human decided, in their words\n- what's blocked or waiting\n- the next move\n- where the half-done work sits\n- what failed, and why\n- which skills, seqs, notes, or files to reopen\n- anything else worth noting\nThen leave the shelf current: replace what's stale, a whole note or a section inside one, and crumple the dead ones. Update and trim CHEATSHEET.md and MAP.md; every new window loads them. The next window gets whatever you leave, dead notes and dead sections alike.\nDon't call anything that might return a large output. One big read can spend the rest of the reserve before your notes are saved.";
37
37
 
38
38
  export const WARNING_CALL = "Then call `empty_brain`. Nothing in between.";
39
39