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.
- package/.agents/plugins/marketplace.json +15 -0
- package/README.md +14 -11
- package/dist/plugins/antigravity/src/cli.d.ts +1 -0
- package/dist/plugins/antigravity/src/cli.js +23 -0
- package/dist/plugins/antigravity/src/hooks.d.ts +18 -0
- package/dist/plugins/antigravity/src/hooks.js +53 -0
- package/dist/plugins/antigravity/src/identity.d.ts +26 -0
- package/dist/plugins/antigravity/src/identity.js +129 -0
- package/dist/plugins/claude/src/helper.js +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.js +18 -15
- package/dist/src/boot/text.d.ts +3 -1
- package/dist/src/boot/text.js +22 -20
- package/dist/src/budget/text.d.ts +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/errors.d.ts +1 -1
- package/dist/src/notes/frontmatter.d.ts +0 -2
- package/dist/src/notes/frontmatter.js +0 -2
- package/dist/src/notes/index.d.ts +1 -1
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/policy.d.ts +15 -1
- package/dist/src/notes/policy.js +46 -5
- package/dist/src/notes/store.d.ts +12 -0
- package/dist/src/notes/store.js +16 -20
- package/dist/src/text-match.d.ts +10 -1
- package/dist/src/text-match.js +42 -3
- package/dist/src/tools/dream.d.ts +22 -93
- package/dist/src/tools/dream.js +30 -27
- package/dist/src/tools/history.d.ts +33 -26
- package/dist/src/tools/history.js +257 -163
- package/dist/src/tools/notes.d.ts +51 -163
- package/dist/src/tools/notes.js +146 -100
- package/dist/src/tools/output.d.ts +2 -1
- package/dist/src/tools/output.js +2 -1
- package/dist/src/tools/result.d.ts +4 -7
- package/dist/src/tools/result.js +8 -9
- package/dist/src/tools/schema.d.ts +4 -1
- package/dist/src/tools/schema.js +25 -1
- package/dist/test/agent-loop.test.js +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 +96 -77
- package/dist/test/notes.integration.test.js +212 -94
- package/dist/test/notes.test.js +184 -113
- package/dist/test/pi-render.test.js +20 -12
- package/dist/test/project-namespace.test.js +3 -2
- package/dist/test/reset-lifecycle.test.js +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 +3 -3
- package/docs/history-sessions.md +28 -50
- package/docs/notes-library.md +4 -4
- package/docs/skills.md +3 -3
- package/docs/tool-results.md +47 -28
- package/package.json +3 -2
- package/playbook.md +1 -1
- package/plugins/antigravity/dist/antigravity/notesoup.js +26886 -0
- package/plugins/antigravity/hooks.json +7 -0
- package/plugins/antigravity/mcp_config.json +8 -0
- package/plugins/antigravity/plugin.json +6 -0
- package/plugins/antigravity/src/cli.ts +22 -0
- package/plugins/antigravity/src/hooks.ts +51 -0
- package/plugins/antigravity/src/identity.ts +127 -0
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +1059 -534
- package/plugins/claude/hooks/register.ts +2 -2
- package/plugins/claude/playbook.md +1 -1
- package/plugins/claude/skills/dream/SKILL.md +1 -1
- 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 +18480 -17946
- package/plugins/codex/src/hooks.ts +1 -0
- package/plugins/codex/src/identity.ts +14 -1
- package/plugins/codex/src/mcp.ts +28 -98
- package/plugins/codex/src/text.ts +3 -3
- package/plugins/dsh/tools.ts +8 -4
- package/plugins/mcp/operations.ts +50 -0
- package/plugins/mcp/server.ts +23 -0
- package/plugins/paseo/README.md +5 -10
- package/plugins/paseo/client/brain-empty-card.tsx +3 -3
- package/plugins/paseo/client/markdown.tsx +50 -38
- package/plugins/paseo/client/notes-op-card.tsx +12 -9
- package/plugins/paseo/client/paper-card.tsx +6 -5
- package/plugins/paseo/client/paper-palette.ts +2 -9
- package/plugins/paseo/client/sticky-card.tsx +2 -2
- package/plugins/paseo/client/tool-result.ts +7 -14
- package/plugins/paseo/package-lock.json +3406 -0
- package/plugins/paseo/package.json +1 -0
- package/plugins/paseo/test/markdown-core.test.ts +73 -66
- package/plugins/pi/budget.ts +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 +1 -1
- package/skills/notesoup/SKILL.md +92 -0
- package/src/boot/render.ts +18 -15
- package/src/boot/text.ts +23 -19
- 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/errors.ts +1 -1
- package/src/notes/frontmatter.ts +0 -3
- package/src/notes/index.ts +1 -1
- package/src/notes/policy.ts +44 -5
- package/src/notes/store.ts +17 -20
- package/src/text-match.ts +46 -4
- package/src/tools/dream.ts +29 -31
- package/src/tools/history.ts +249 -142
- package/src/tools/notes.ts +145 -113
- package/src/tools/output.ts +2 -1
- package/src/tools/result.ts +12 -11
- package/src/tools/schema.ts +24 -1
- package/plugins/claude/skills/memory/SKILL.md +0 -69
- package/plugins/codex/mcp.json +0 -10
- package/plugins/codex/plugin.json +0 -6
- package/plugins/paseo/client/markdown-core.tsx +0 -189
- package/plugins/paseo/client/typography.ts +0 -24
- package/skills/memory/SKILL.md +0 -69
|
@@ -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
|
-
|
|
24
|
+
cwd: Type.TOptional<Type.TString>;
|
|
22
25
|
}>;
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
project:
|
|
27
|
-
baseline:
|
|
28
|
-
|
|
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: "
|
|
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
|
-
|
|
37
|
+
cwd: Type.TOptional<Type.TString>;
|
|
53
38
|
}>;
|
|
54
|
-
readonly
|
|
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
|
|
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: "
|
|
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
|
|
120
|
-
project:
|
|
121
|
-
commit
|
|
122
|
-
audit_error
|
|
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: "
|
|
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
|
};
|
package/dist/src/tools/dream.js
CHANGED
|
@@ -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 {
|
|
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
|
|
11
|
-
import { failureOf, listedFile,
|
|
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
|
-
|
|
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
|
-
|
|
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: "
|
|
59
|
-
parameters: dreamBeginParameters,
|
|
60
|
-
async execute(params,
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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(
|
|
89
|
-
const listed = snapshot(rows.map(row => ({ ...listedFile(row, identity), last_accessed: localIso(row.meta.lastAccessed) })), undefined, { namespacesUnavailable: unavailable },
|
|
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: "
|
|
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: "
|
|
122
|
-
parameters: dreamForgetParameters,
|
|
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: "
|
|
142
|
-
parameters: dreamEndParameters,
|
|
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:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
session
|
|
20
|
-
|
|
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.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
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>;
|