notesoup 0.61.0 → 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.
Files changed (200) hide show
  1. package/.agents/plugins/marketplace.json +15 -0
  2. package/README.md +14 -11
  3. package/dist/plugins/antigravity/src/cli.d.ts +1 -0
  4. package/dist/plugins/antigravity/src/cli.js +23 -0
  5. package/dist/plugins/antigravity/src/hooks.d.ts +18 -0
  6. package/dist/plugins/antigravity/src/hooks.js +53 -0
  7. package/dist/plugins/antigravity/src/identity.d.ts +26 -0
  8. package/dist/plugins/antigravity/src/identity.js +129 -0
  9. package/dist/plugins/claude/src/helper.js +2 -1
  10. package/dist/plugins/codex/src/hooks.js +1 -0
  11. package/dist/plugins/codex/src/identity.d.ts +6 -1
  12. package/dist/plugins/codex/src/identity.js +13 -1
  13. package/dist/plugins/codex/src/mcp.d.ts +35 -7
  14. package/dist/plugins/codex/src/mcp.js +26 -88
  15. package/dist/plugins/codex/src/text.js +3 -3
  16. package/dist/plugins/dsh/tools.js +8 -4
  17. package/dist/plugins/mcp/operations.d.ts +15 -0
  18. package/dist/plugins/mcp/operations.js +43 -0
  19. package/dist/plugins/mcp/server.d.ts +14 -0
  20. package/dist/plugins/mcp/server.js +13 -0
  21. package/dist/plugins/pi/budget.d.ts +1 -1
  22. package/dist/plugins/pi/budget.js +3 -2
  23. package/dist/plugins/pi/entries.d.ts +1 -0
  24. package/dist/plugins/pi/entries.js +1 -0
  25. package/dist/plugins/pi/history-tools.js +2 -1
  26. package/dist/plugins/pi/history.js +18 -1
  27. package/dist/plugins/pi/notes/tools.js +7 -3
  28. package/dist/plugins/pi/render.d.ts +7 -1
  29. package/dist/plugins/pi/render.js +2 -2
  30. package/dist/plugins/pi/reset/lifecycle.d.ts +1 -1
  31. package/dist/plugins/pi/reset/lifecycle.js +8 -9
  32. package/dist/plugins/pi/runtime.js +102 -61
  33. package/dist/plugins/pi/tool-result.js +7 -7
  34. package/dist/plugins/pi/window.d.ts +33 -3
  35. package/dist/plugins/pi/window.js +209 -9
  36. package/dist/src/boot/render.js +18 -15
  37. package/dist/src/boot/text.d.ts +3 -1
  38. package/dist/src/boot/text.js +22 -20
  39. package/dist/src/budget/text.d.ts +2 -2
  40. package/dist/src/budget/text.js +13 -13
  41. package/dist/src/history/claude.d.ts +2 -0
  42. package/dist/src/history/claude.js +46 -0
  43. package/dist/src/history/codex-transcript.js +7 -5
  44. package/dist/src/history/codex.js +3 -0
  45. package/dist/src/history/corpus.d.ts +28 -1
  46. package/dist/src/history/corpus.js +40 -0
  47. package/dist/src/history/history.d.ts +37 -46
  48. package/dist/src/history/history.js +21 -40
  49. package/dist/src/history/local.js +67 -32
  50. package/dist/src/history/pi.d.ts +2 -1
  51. package/dist/src/history/pi.js +122 -48
  52. package/dist/src/history/prefilter.js +76 -19
  53. package/dist/src/history/query.d.ts +28 -49
  54. package/dist/src/history/query.js +83 -68
  55. package/dist/src/history/summary-cache.d.ts +8 -1
  56. package/dist/src/history/summary-cache.js +138 -12
  57. package/dist/src/index.d.ts +1 -1
  58. package/dist/src/index.js +1 -1
  59. package/dist/src/notes/errors.d.ts +1 -1
  60. package/dist/src/notes/frontmatter.d.ts +0 -2
  61. package/dist/src/notes/frontmatter.js +0 -2
  62. package/dist/src/notes/index.d.ts +1 -1
  63. package/dist/src/notes/index.js +1 -1
  64. package/dist/src/notes/policy.d.ts +15 -1
  65. package/dist/src/notes/policy.js +46 -5
  66. package/dist/src/notes/store.d.ts +12 -0
  67. package/dist/src/notes/store.js +16 -20
  68. package/dist/src/text-match.d.ts +10 -1
  69. package/dist/src/text-match.js +42 -3
  70. package/dist/src/tools/dream.d.ts +22 -93
  71. package/dist/src/tools/dream.js +30 -27
  72. package/dist/src/tools/history.d.ts +33 -26
  73. package/dist/src/tools/history.js +257 -163
  74. package/dist/src/tools/notes.d.ts +51 -163
  75. package/dist/src/tools/notes.js +146 -100
  76. package/dist/src/tools/output.d.ts +2 -1
  77. package/dist/src/tools/output.js +2 -1
  78. package/dist/src/tools/result.d.ts +4 -7
  79. package/dist/src/tools/result.js +8 -9
  80. package/dist/src/tools/schema.d.ts +4 -1
  81. package/dist/src/tools/schema.js +25 -1
  82. package/dist/test/agent-loop.test.js +198 -16
  83. package/dist/test/antigravity-live.test.d.ts +1 -0
  84. package/dist/test/antigravity-live.test.js +142 -0
  85. package/dist/test/antigravity-plugin.test.d.ts +1 -0
  86. package/dist/test/antigravity-plugin.test.js +101 -0
  87. package/dist/test/boot.integration.test.js +133 -14
  88. package/dist/test/claude-history.test.js +14 -13
  89. package/dist/test/claude-mod.test.js +9 -6
  90. package/dist/test/codex-history.test.js +15 -3
  91. package/dist/test/codex-plugin.test.js +76 -38
  92. package/dist/test/dependencies.test.js +7 -3
  93. package/dist/test/dream-skill.test.js +3 -3
  94. package/dist/test/dream-tools.test.js +101 -56
  95. package/dist/test/dsh.test.js +34 -19
  96. package/dist/test/helpers/dependency-graph.js +2 -2
  97. package/dist/test/helpers/extension.d.ts +65 -2
  98. package/dist/test/helpers/extension.js +72 -3
  99. package/dist/test/history-corpus.test.js +79 -77
  100. package/dist/test/history-summary-cache.test.js +97 -9
  101. package/dist/test/history.integration.test.js +234 -168
  102. package/dist/test/host-neutral.test.js +69 -19
  103. package/dist/test/marker.test.js +1 -1
  104. package/dist/test/note-policy.test.js +96 -77
  105. package/dist/test/notes.integration.test.js +212 -94
  106. package/dist/test/notes.test.js +184 -113
  107. package/dist/test/pi-render.test.js +20 -12
  108. package/dist/test/project-namespace.test.js +3 -2
  109. package/dist/test/reset-lifecycle.test.js +2 -2
  110. package/docs/antigravity.md +44 -0
  111. package/docs/architecture.md +6 -4
  112. package/docs/claude-code-mod.md +2 -2
  113. package/docs/codex.md +36 -38
  114. package/docs/dsh.md +3 -3
  115. package/docs/history-sessions.md +28 -50
  116. package/docs/notes-library.md +4 -4
  117. package/docs/skills.md +3 -3
  118. package/docs/tool-results.md +47 -28
  119. package/package.json +3 -2
  120. package/playbook.md +1 -1
  121. package/plugins/antigravity/dist/antigravity/notesoup.js +26886 -0
  122. package/plugins/antigravity/hooks.json +7 -0
  123. package/plugins/antigravity/mcp_config.json +8 -0
  124. package/plugins/antigravity/plugin.json +6 -0
  125. package/plugins/antigravity/src/cli.ts +22 -0
  126. package/plugins/antigravity/src/hooks.ts +51 -0
  127. package/plugins/antigravity/src/identity.ts +127 -0
  128. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  129. package/plugins/claude/dist/claude/helper.js +1059 -534
  130. package/plugins/claude/hooks/register.ts +2 -2
  131. package/plugins/claude/playbook.md +1 -1
  132. package/plugins/claude/skills/dream/SKILL.md +1 -1
  133. package/plugins/claude/skills/notesoup/SKILL.md +92 -0
  134. package/plugins/claude/src/helper.ts +2 -1
  135. package/plugins/codex/.codex-plugin/plugin.json +8 -0
  136. package/plugins/codex/.mcp.json +11 -0
  137. package/plugins/codex/README.md +5 -21
  138. package/plugins/codex/dist/codex/notesoup.js +18480 -17946
  139. package/plugins/codex/src/hooks.ts +1 -0
  140. package/plugins/codex/src/identity.ts +14 -1
  141. package/plugins/codex/src/mcp.ts +28 -98
  142. package/plugins/codex/src/text.ts +3 -3
  143. package/plugins/dsh/tools.ts +8 -4
  144. package/plugins/mcp/operations.ts +50 -0
  145. package/plugins/mcp/server.ts +23 -0
  146. package/plugins/paseo/README.md +5 -10
  147. package/plugins/paseo/client/brain-empty-card.tsx +3 -3
  148. package/plugins/paseo/client/markdown.tsx +50 -38
  149. package/plugins/paseo/client/notes-op-card.tsx +12 -9
  150. package/plugins/paseo/client/paper-card.tsx +6 -5
  151. package/plugins/paseo/client/paper-palette.ts +2 -9
  152. package/plugins/paseo/client/sticky-card.tsx +2 -2
  153. package/plugins/paseo/client/tool-result.ts +7 -14
  154. package/plugins/paseo/package-lock.json +3406 -0
  155. package/plugins/paseo/package.json +1 -0
  156. package/plugins/paseo/test/markdown-core.test.ts +73 -66
  157. package/plugins/pi/budget.ts +3 -3
  158. package/plugins/pi/entries.ts +1 -0
  159. package/plugins/pi/history-tools.ts +2 -1
  160. package/plugins/pi/history.ts +30 -1
  161. package/plugins/pi/notes/tools.ts +7 -3
  162. package/plugins/pi/render.ts +6 -6
  163. package/plugins/pi/reset/lifecycle.ts +9 -10
  164. package/plugins/pi/runtime.ts +96 -60
  165. package/plugins/pi/tool-result.ts +8 -8
  166. package/plugins/pi/window.ts +198 -9
  167. package/skills/dream/SKILL.md +1 -1
  168. package/skills/notesoup/SKILL.md +92 -0
  169. package/src/boot/render.ts +18 -15
  170. package/src/boot/text.ts +23 -19
  171. package/src/budget/text.ts +13 -13
  172. package/src/history/claude.ts +41 -0
  173. package/src/history/codex-transcript.ts +6 -4
  174. package/src/history/codex.ts +2 -0
  175. package/src/history/corpus.ts +51 -2
  176. package/src/history/history.ts +35 -44
  177. package/src/history/local.ts +67 -27
  178. package/src/history/pi.ts +113 -35
  179. package/src/history/prefilter.ts +73 -15
  180. package/src/history/query.ts +93 -73
  181. package/src/history/summary-cache.ts +142 -17
  182. package/src/index.ts +1 -1
  183. package/src/notes/errors.ts +1 -1
  184. package/src/notes/frontmatter.ts +0 -3
  185. package/src/notes/index.ts +1 -1
  186. package/src/notes/policy.ts +44 -5
  187. package/src/notes/store.ts +17 -20
  188. package/src/text-match.ts +46 -4
  189. package/src/tools/dream.ts +29 -31
  190. package/src/tools/history.ts +249 -142
  191. package/src/tools/notes.ts +145 -113
  192. package/src/tools/output.ts +2 -1
  193. package/src/tools/result.ts +12 -11
  194. package/src/tools/schema.ts +24 -1
  195. package/plugins/claude/skills/memory/SKILL.md +0 -69
  196. package/plugins/codex/mcp.json +0 -10
  197. package/plugins/codex/plugin.json +0 -6
  198. package/plugins/paseo/client/markdown-core.tsx +0 -189
  199. package/plugins/paseo/client/typography.ts +0 -24
  200. package/skills/memory/SKILL.md +0 -69
@@ -1,6 +1,9 @@
1
1
  import { Type, type Static } from "typebox";
2
- import { type NotesIdentity } from "../notes/index.js";
2
+ import { noteIdentity, type NotesIdentity } from "../notes/index.js";
3
+ import { type ProjectReceipt } from "../notes/project-namespace.js";
3
4
  import { type Outcome } from "../result.js";
5
+ import { type ListedFile, type Snapshot } from "./notes.js";
6
+ import { type NotesToolContext } from "./notes-context.js";
4
7
  /** The one open dream per session; the host owns where it lives. */
5
8
  type DreamOpening = {
6
9
  project: string;
@@ -18,123 +21,49 @@ export declare function abandonDream(state: DreamState): void;
18
21
  /** The identity a store uses while `state` holds an open dream. */
19
22
  export declare function dreamingIdentity(identity: NotesIdentity, state: DreamState): NotesIdentity;
20
23
  export declare const dreamBeginParameters: Type.TObject<{
21
- project: Type.TOptional<Type.TString>;
24
+ cwd: Type.TOptional<Type.TString>;
22
25
  }>;
23
- export declare const DreamBeginDataSchema: Type.TObject<{
24
- more: Type.TInteger;
25
- namespaces_unavailable: Type.TArray<Type.TString>;
26
- project: Type.TString;
27
- baseline: Type.TString;
28
- files: Type.TArray<Type.TObject<{
29
- last_accessed: Type.TString;
30
- updated_at: Type.TString;
31
- crumpled_at: Type.TOptional<Type.TString>;
32
- description: Type.TOptional<Type.TString>;
33
- warnings: Type.TArray<Type.TString>;
34
- pinned: Type.TBoolean;
35
- budget: Type.TInteger;
36
- readonly: Type.TBoolean;
37
- project_root: Type.TOptional<Type.TString>;
38
- project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
39
- name: Type.TString;
40
- path: Type.TString;
41
- }>>>;
42
- address: Type.TString;
43
- project_key: Type.TOptional<Type.TString>;
44
- }>>;
45
- }>;
46
- export type DreamBeginData = Static<typeof DreamBeginDataSchema>;
26
+ export type DreamBeginData = Snapshot<ListedFile & {
27
+ last_accessed: string;
28
+ }> & {
29
+ project: string;
30
+ baseline: string;
31
+ } & ProjectReceipt;
47
32
  export declare const dreamBegin: {
48
33
  readonly name: "dream_begin";
49
34
  readonly label: "Dream begin";
50
- readonly description: "Spread one project's pages across the table — its project shelf, every session page born there, crumpled balls included. Until `dream_end` your pen works on all of them; other sessions' pages can be rewritten, not added to.";
35
+ readonly description: "Open a project's notes and its session notes for consolidation after committing a Git baseline; unlocks writes until `dream_end`.";
51
36
  readonly parameters: Type.TObject<{
52
- project: Type.TOptional<Type.TString>;
37
+ cwd: Type.TOptional<Type.TString>;
53
38
  }>;
54
- readonly outputSchema: Type.TUnion<[Type.TObject<{
55
- more: Type.TInteger;
56
- namespaces_unavailable: Type.TArray<Type.TString>;
57
- project: Type.TString;
58
- baseline: Type.TString;
59
- files: Type.TArray<Type.TObject<{
60
- last_accessed: Type.TString;
61
- updated_at: Type.TString;
62
- crumpled_at: Type.TOptional<Type.TString>;
63
- description: Type.TOptional<Type.TString>;
64
- warnings: Type.TArray<Type.TString>;
65
- pinned: Type.TBoolean;
66
- budget: Type.TInteger;
67
- readonly: Type.TBoolean;
68
- project_root: Type.TOptional<Type.TString>;
69
- project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
70
- name: Type.TString;
71
- path: Type.TString;
72
- }>>>;
73
- address: Type.TString;
74
- project_key: Type.TOptional<Type.TString>;
75
- }>>;
76
- }>, Type.TObject<{
77
- error: Type.TString;
78
- code: Type.TString;
79
- }>]>;
80
- readonly execute: (params: Static<typeof dreamBeginParameters>, identity: NotesIdentity, state: DreamState) => Promise<Outcome<DreamBeginData>>;
39
+ readonly execute: (params: Static<typeof dreamBeginParameters>, context: NotesToolContext, state: DreamState) => Promise<Outcome<DreamBeginData>>;
81
40
  readonly render: (result: Outcome<DreamBeginData>) => string;
82
41
  };
83
42
  export declare const dreamForgetParameters: Type.TObject<{
84
43
  address: Type.TString;
85
44
  }>;
86
- export declare const DreamForgetDataSchema: Type.TObject<{
87
- project_root: Type.TOptional<Type.TString>;
88
- project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
89
- name: Type.TString;
90
- path: Type.TString;
91
- }>>>;
92
- address: Type.TString;
93
- project_key: Type.TOptional<Type.TString>;
94
- }>;
95
- export type DreamForgetData = Static<typeof DreamForgetDataSchema>;
45
+ export type DreamForgetData = ReturnType<typeof noteIdentity>;
96
46
  export declare const dreamForget: {
97
47
  readonly name: "dream_forget";
98
48
  readonly label: "Dream forget";
99
- readonly description: "Throw a crumpled page in the bin for good. Only crumpled pages go.";
49
+ readonly description: "Permanently delete a crumpled note in the open dream.";
100
50
  readonly parameters: Type.TObject<{
101
51
  address: Type.TString;
102
52
  }>;
103
- readonly outputSchema: Type.TUnion<[Type.TObject<{
104
- project_root: Type.TOptional<Type.TString>;
105
- project_siblings: Type.TOptional<Type.TArray<Type.TObject<{
106
- name: Type.TString;
107
- path: Type.TString;
108
- }>>>;
109
- address: Type.TString;
110
- project_key: Type.TOptional<Type.TString>;
111
- }>, Type.TObject<{
112
- error: Type.TString;
113
- code: Type.TString;
114
- }>]>;
115
53
  readonly execute: (params: Static<typeof dreamForgetParameters>, identity: NotesIdentity, state: DreamState) => Promise<Outcome<DreamForgetData>>;
116
54
  readonly render: (result: Outcome<DreamForgetData>) => string;
117
55
  };
118
56
  export declare const dreamEndParameters: Type.TObject<{}>;
119
- export declare const DreamEndDataSchema: Type.TObject<{
120
- project: Type.TString;
121
- commit: Type.TOptional<Type.TString>;
122
- audit_error: Type.TOptional<Type.TString>;
123
- }>;
124
- export type DreamEndData = Static<typeof DreamEndDataSchema>;
57
+ export type DreamEndData = {
58
+ project: string;
59
+ commit?: string;
60
+ audit_error?: string;
61
+ };
125
62
  export declare const dreamEnd: {
126
63
  readonly name: "dream_end";
127
64
  readonly label: "Dream end";
128
- readonly description: "Stack the pages, file them, close the drawer.";
65
+ readonly description: "Commit dream changes to the notes Git repo and close the open dream.";
129
66
  readonly parameters: Type.TObject<{}>;
130
- readonly outputSchema: Type.TUnion<[Type.TObject<{
131
- project: Type.TString;
132
- commit: Type.TOptional<Type.TString>;
133
- audit_error: Type.TOptional<Type.TString>;
134
- }>, Type.TObject<{
135
- error: Type.TString;
136
- code: Type.TString;
137
- }>]>;
138
67
  readonly execute: (_params: Static<typeof dreamEndParameters>, identity: NotesIdentity, state: DreamState) => Promise<Outcome<DreamEndData>>;
139
68
  readonly render: (result: Outcome<DreamEndData>) => string;
140
69
  };
@@ -2,13 +2,14 @@
2
2
  import { join } from "node:path";
3
3
  import { Type } from "typebox";
4
4
  import { localIso } from "../notes/frontmatter.js";
5
- import { createNotesStore, noteIdentity } from "../notes/index.js";
6
- import { projectNamespaces } from "../notes/project-namespace.js";
5
+ import { compareNoteRows, createNotesStore, noteIdentity } from "../notes/index.js";
6
+ import { projectReceipt } from "../notes/project-namespace.js";
7
7
  import { gitCommit } from "../dream/git.js";
8
8
  import { trySqliteLock } from "../sqlite-lock.js";
9
9
  import { failure, success } from "../result.js";
10
- import { renderOutcome, resultSchema } from "./result.js";
11
- import { failureOf, listedFile, ListedFileSchema, NoteIdentitySchema, renderListData, snapshot, SnapshotSchema } from "./notes.js";
10
+ import { renderOutcome } from "./result.js";
11
+ import { failureOf, listedFile, renderListData, snapshot } from "./notes.js";
12
+ import { notesIdentityForCall } from "./notes-context.js";
12
13
  function currentOpening(state, opening) {
13
14
  return state.pending === opening && state.generation === opening.generation;
14
15
  }
@@ -43,29 +44,31 @@ export function dreamingIdentity(identity, state) {
43
44
  }
44
45
  const NOT_DREAMING = "No dream is open; call dream_begin first.";
45
46
  export const dreamBeginParameters = Type.Object({
46
- project: Type.Optional(Type.String({ description: "Which project's pages; leave it out for this one." })),
47
- }, { additionalProperties: false });
48
- export const DreamBeginDataSchema = Type.Object({
49
- project: Type.String(), baseline: Type.String(),
50
- files: Type.Array(Type.Object({ ...ListedFileSchema.properties, last_accessed: Type.String() }, { additionalProperties: false })),
51
- ...SnapshotSchema,
47
+ cwd: Type.Optional(Type.String({ minLength: 1, description: "Treat this directory's project as current." })),
52
48
  }, { additionalProperties: false });
53
49
  function renderBeginData(data) {
54
- return `dreaming over ${data.project} (baseline ${data.baseline})\n${renderListData(data)}`;
50
+ const header = `dreaming over ${data.project} (baseline ${data.baseline}${data.project_root === undefined ? "" : `, project_root ${data.project_root}`})`;
51
+ const siblings = data.project_siblings === undefined ? "" : `\n Same-basename projects: ${data.project_siblings.map(sibling => `${sibling.name} (${sibling.path})`).join(", ")}`;
52
+ return `${header}${siblings}\n${renderListData(data, undefined, { omitNamedProjectContext: true })}`;
55
53
  }
56
54
  export const dreamBegin = {
57
55
  name: "dream_begin", label: "Dream begin",
58
- description: "Spread one project's pages across the table — its project shelf, every session page born there, crumpled balls included. Until `dream_end` your pen works on all of them; other sessions' pages can be rewritten, not added to.",
59
- parameters: dreamBeginParameters, outputSchema: resultSchema(DreamBeginDataSchema),
60
- async execute(params, identity, state) {
56
+ description: "Open a project's notes and its session notes for consolidation after committing a Git baseline; unlocks writes until `dream_end`.",
57
+ parameters: dreamBeginParameters,
58
+ async execute(params, context, state) {
61
59
  if (state.project !== undefined || state.pending !== undefined) {
62
60
  const project = state.project ?? state.pending?.project;
63
61
  return failure("already_dreaming", `Already dreaming over ${project}; call dream_end before opening another project.`);
64
62
  }
65
- const project = params.project ?? identity.projectKey;
66
- if (project !== identity.projectKey && !projectNamespaces(identity.home).some(namespace => namespace.name === project)) {
67
- return failure("not_found", `No project named ${JSON.stringify(project)}; notes_list with glob @projects/*/** shows the names.`);
63
+ let identity;
64
+ try {
65
+ identity = notesIdentityForCall(context, params.cwd);
66
+ }
67
+ catch (error) {
68
+ return failureOf(error);
68
69
  }
70
+ const project = identity.projectKey;
71
+ const receipt = projectReceipt(identity.home, project);
69
72
  const release = trySqliteLock(join(identity.home, ".dream.lock.sqlite"), 0);
70
73
  if (!release)
71
74
  return failure("already_dreaming", "Another dream is open in this notes home.");
@@ -85,8 +88,10 @@ export const dreamBegin = {
85
88
  unavailable.push(...result.status.namespacesUnavailable);
86
89
  }
87
90
  }
88
- rows.sort((a, b) => b.meta.updatedAt - a.meta.updatedAt || a.address.localeCompare(b.address));
89
- const listed = snapshot(rows.map(row => ({ ...listedFile(row, identity), last_accessed: localIso(row.meta.lastAccessed) })), undefined, { namespacesUnavailable: unavailable }, renderListData);
91
+ rows.sort(compareNoteRows);
92
+ const listed = snapshot(rows.map(row => ({ ...listedFile(row, identity), last_accessed: localIso(row.meta.lastAccessed) })), undefined, { namespacesUnavailable: unavailable },
93
+ // Reserve the header before committing; Git object IDs are at most 64 hex digits.
94
+ (data) => renderBeginData({ ...data, project, baseline: "0".repeat(64), ...receipt }));
90
95
  if (!listed.ok) {
91
96
  releaseOpening(state, opening);
92
97
  return listed;
@@ -103,7 +108,7 @@ export const dreamBegin = {
103
108
  state.project = opening.project;
104
109
  state.release = opening.release;
105
110
  delete state.pending;
106
- return success({ project, baseline: baseline.commit, ...listed.data });
111
+ return success({ project, baseline: baseline.commit, ...receipt, ...listed.data });
107
112
  }
108
113
  catch (error) {
109
114
  if (!currentOpening(state, opening))
@@ -114,12 +119,11 @@ export const dreamBegin = {
114
119
  },
115
120
  render: (result) => renderOutcome(result, renderBeginData),
116
121
  };
117
- export const dreamForgetParameters = Type.Object({ address: Type.String({ description: "Which crumpled page goes in the bin." }) }, { additionalProperties: false });
118
- export const DreamForgetDataSchema = Type.Object({ ...NoteIdentitySchema }, { additionalProperties: false });
122
+ export const dreamForgetParameters = Type.Object({ address: Type.String({ description: "Address of the crumpled note to delete." }) }, { additionalProperties: false });
119
123
  export const dreamForget = {
120
124
  name: "dream_forget", label: "Dream forget",
121
- description: "Throw a crumpled page in the bin for good. Only crumpled pages go.",
122
- parameters: dreamForgetParameters, outputSchema: resultSchema(DreamForgetDataSchema),
125
+ description: "Permanently delete a crumpled note in the open dream.",
126
+ parameters: dreamForgetParameters,
123
127
  async execute(params, identity, state) {
124
128
  if (state.project === undefined)
125
129
  return failure("not_dreaming", NOT_DREAMING);
@@ -135,11 +139,10 @@ export const dreamForget = {
135
139
  render: (result) => renderOutcome(result, data => `forgot ${data.address}`),
136
140
  };
137
141
  export const dreamEndParameters = Type.Object({}, { additionalProperties: false });
138
- export const DreamEndDataSchema = Type.Object({ project: Type.String(), commit: Type.Optional(Type.String()), audit_error: Type.Optional(Type.String()) }, { additionalProperties: false });
139
142
  export const dreamEnd = {
140
143
  name: "dream_end", label: "Dream end",
141
- description: "Stack the pages, file them, close the drawer.",
142
- parameters: dreamEndParameters, outputSchema: resultSchema(DreamEndDataSchema),
144
+ description: "Commit dream changes to the notes Git repo and close the open dream.",
145
+ parameters: dreamEndParameters,
143
146
  async execute(_params, identity, state) {
144
147
  const project = state.project;
145
148
  if (project === undefined)
@@ -1,41 +1,48 @@
1
- /** Host-neutral history operations: one bounded payload for text and structured results. */
1
+ /** Host-neutral history operations: bounded plain-text output. */
2
2
  import { Type, type Static } from "typebox";
3
- import { type Operation } from "./result.js";
3
+ import { type TextWindow, type Operation } from "./result.js";
4
4
  import { type HistoryPage } from "../history/query.js";
5
5
  import { type HistoryContext } from "../history/corpus.js";
6
+ import { type HistoryRole, type NestedCallSummary, type ToolSummary } from "../history/history.js";
6
7
  /** One read: identity, tool summary and a flat document slice. */
7
- declare const HistoryReadDataSchema: Type.TObject<{
8
- text: Type.TString;
9
- total_chars: Type.TInteger;
10
- next_offset_chars: Type.TUnion<[Type.TInteger, Type.TNull]>;
11
- nested_calls: Type.TOptional<Type.TObject<{
12
- call_count: Type.TInteger;
13
- complete: Type.TBoolean;
14
- }>>;
15
- tool: Type.TOptional<Type.TString>;
16
- tool_status: Type.TOptional<Type.TUnion<[Type.TLiteral<"ok">, Type.TLiteral<"error">, Type.TLiteral<"unfinished">]>>;
17
- output_truncated: Type.TOptional<Type.TLiteral<true>>;
18
- full_output_path: Type.TOptional<Type.TString>;
19
- session: Type.TOptional<Type.TString>;
20
- notice: Type.TOptional<Type.TString>;
21
- seq: Type.TInteger;
22
- role: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"assistant">, Type.TLiteral<"tool">, Type.TLiteral<"context">]>;
23
- created_at: Type.TUnion<[Type.TString, Type.TNull]>;
24
- }>;
25
- type HistoryReadData = Static<typeof HistoryReadDataSchema>;
8
+ type HistoryReadData = ToolSummary & TextWindow & {
9
+ session?: string;
10
+ notice?: string;
11
+ seq: number;
12
+ role: HistoryRole;
13
+ created_at: string | null;
14
+ nested_calls?: NestedCallSummary;
15
+ };
16
+ type TimelinePage = HistoryPage & {
17
+ paging: Omit<Static<typeof historyListParameters>, "after" | "before">;
18
+ };
19
+ type SearchPage = HistoryPage & {
20
+ session?: string;
21
+ };
26
22
  /** Pure host decoration, measured during selection and applied unchanged by the caller at delivery. */
27
23
  export type HistoryTextWrapper = (text: string) => string;
28
24
  export declare const historyListParameters: Type.TObject<{
29
25
  session: Type.TOptional<Type.TString>;
30
- roles: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"assistant">, Type.TLiteral<"tool">, Type.TLiteral<"context">]>>>;
31
- query: Type.TOptional<Type.TUnion<[Type.TString, Type.TArray<Type.TString>]>>;
32
- after: Type.TOptional<Type.TUnion<[Type.TString, Type.TNumber]>>;
33
- before: Type.TOptional<Type.TUnion<[Type.TString, Type.TNumber]>>;
26
+ roles: Type.TOptional<Type.TArray<Type.TUnsafe<"user" | "assistant" | "tool" | "context">>>;
27
+ after: Type.TOptional<Type.TInteger>;
28
+ before: Type.TOptional<Type.TInteger>;
29
+ since: Type.TOptional<Type.TString>;
30
+ until: Type.TOptional<Type.TString>;
31
+ limit: Type.TOptional<Type.TInteger>;
32
+ max_chars_per_item: Type.TOptional<Type.TInteger>;
33
+ }>;
34
+ export declare const historyList: Operation<typeof historyListParameters, TimelinePage | SearchPage, [HistoryContext, HistoryTextWrapper?]>;
35
+ export declare const historySearchParameters: Type.TObject<{
36
+ session: Type.TOptional<Type.TString>;
37
+ query: Type.TUnion<[Type.TString, Type.TArray<Type.TString>]>;
38
+ since: Type.TOptional<Type.TString>;
39
+ until: Type.TOptional<Type.TString>;
40
+ roles: Type.TOptional<Type.TArray<Type.TUnsafe<"user" | "assistant" | "tool" | "context">>>;
34
41
  context: Type.TOptional<Type.TInteger>;
35
42
  limit: Type.TOptional<Type.TInteger>;
36
43
  max_chars_per_item: Type.TOptional<Type.TInteger>;
37
44
  }>;
38
- export declare const historyList: Operation<typeof historyListParameters, HistoryPage, [HistoryContext, HistoryTextWrapper?]>;
45
+ export declare const historySearch: Operation<typeof historySearchParameters, SearchPage, [HistoryContext, HistoryTextWrapper?]>;
39
46
  export declare const historyReadParameters: Type.TObject<{
40
47
  offset_chars: Type.TOptional<Type.TInteger>;
41
48
  max_chars: Type.TOptional<Type.TInteger>;