notesoup 0.55.2 → 0.56.1
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/dist/plugins/pi/budget.d.ts +4 -0
- package/dist/plugins/pi/budget.js +6 -1
- package/dist/plugins/pi/marker.d.ts +4 -2
- package/dist/plugins/pi/marker.js +18 -8
- package/dist/plugins/pi/reset/lifecycle.js +6 -0
- package/dist/src/history/query.d.ts +0 -2
- package/dist/src/history/query.js +2 -4
- package/dist/src/notes/store.d.ts +0 -2
- package/dist/src/notes/store.js +2 -2
- package/dist/src/tools/dream.d.ts +6 -6
- package/dist/src/tools/dream.js +8 -3
- package/dist/src/tools/notes.d.ts +18 -8
- package/dist/src/tools/notes.js +6 -11
- package/dist/test/agent-loop.test.js +44 -1
- package/dist/test/budget-settings.integration.test.js +18 -0
- package/dist/test/dream-tools.test.js +26 -7
- package/dist/test/marker.test.js +46 -15
- package/dist/test/notes-library.test.js +1 -1
- package/dist/test/notes.test.js +5 -4
- package/dist/test/pi-render.test.js +2 -2
- package/docs/architecture.md +1 -1
- package/docs/tool-results.md +2 -2
- package/package.json +1 -1
- package/playbook.md +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +8 -12
- package/plugins/claude/playbook.md +1 -1
- package/plugins/codex/dist/codex/notesoup.js +8 -12
- package/plugins/paseo/OVERVIEW.md +1 -1
- package/plugins/paseo/client/brain-empty-card.tsx +28 -9
- package/plugins/paseo/client/brain-empty-transformer.ts +5 -1
- package/plugins/paseo/client/markdown.tsx +14 -13
- package/plugins/paseo/client/notes-op-card.tsx +6 -6
- package/plugins/paseo/client/paper-card.tsx +20 -18
- package/plugins/paseo/client/paper-palette.ts +12 -9
- package/plugins/paseo/shared/brain-empty.ts +1 -0
- package/plugins/paseo/test/brain-empty.test.ts +8 -0
- package/plugins/pi/budget.ts +7 -1
- package/plugins/pi/marker.ts +18 -12
- package/plugins/pi/reset/lifecycle.ts +5 -0
- package/src/history/query.ts +2 -4
- package/src/notes/store.ts +3 -4
- package/src/tools/dream.ts +8 -3
- package/src/tools/notes.ts +7 -12
package/dist/test/marker.test.js
CHANGED
|
@@ -3,8 +3,8 @@ import test from "node:test";
|
|
|
3
3
|
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import { BOOT_TYPE, CONTINUATION_TYPE, MARKER_TYPE, RESET_MARKER_TYPE } from "../plugins/pi/entries.js";
|
|
5
5
|
import { nextHistorySeq } from "../plugins/pi/history.js";
|
|
6
|
-
import { MARKER_INTERVAL } from "../plugins/pi/marker.js";
|
|
7
|
-
import { appendText, context, installExtensionTestEnvironment, makeExtension, runCommand, runHandlers, sentOf } from "./helpers/extension.js";
|
|
6
|
+
import { buildMarkerDraft, MARKER_INTERVAL } from "../plugins/pi/marker.js";
|
|
7
|
+
import { appendText, call, commitTurnEndBoundary, context, installExtensionTestEnvironment, makeExtension, runCommand, runHandlers, sentOf } from "./helpers/extension.js";
|
|
8
8
|
const env = installExtensionTestEnvironment("notesoup-marker-test");
|
|
9
9
|
test.beforeEach(env.beforeEach);
|
|
10
10
|
test.afterEach(env.afterEach);
|
|
@@ -13,7 +13,7 @@ function beforeAgentStart(captured, ctx) {
|
|
|
13
13
|
return runHandlers(captured, "before_agent_start", { type: "before_agent_start" }, ctx);
|
|
14
14
|
}
|
|
15
15
|
test("marker stamps its own seq at run start once the interval is reached, never mid-turn", async () => {
|
|
16
|
-
const sessionManager = managerWithMessages(
|
|
16
|
+
const sessionManager = managerWithMessages(99);
|
|
17
17
|
const captured = makeExtension(sessionManager);
|
|
18
18
|
const ctx = context(sessionManager);
|
|
19
19
|
// Mid-run tool turns never inject a standalone marker message.
|
|
@@ -22,32 +22,61 @@ test("marker stamps its own seq at run start once the interval is reached, never
|
|
|
22
22
|
await beforeAgentStart(captured, ctx);
|
|
23
23
|
const sent = sentOf(captured, MARKER_TYPE);
|
|
24
24
|
assert.equal(sent.length, 1);
|
|
25
|
-
assert.deepEqual(sent[0].message.details, { seq:
|
|
25
|
+
assert.deepEqual(sent[0].message.details, { seq: 100 });
|
|
26
26
|
assert.equal(sent[0].message.display, false);
|
|
27
27
|
assert.equal(sent[0].options?.triggerTurn, false);
|
|
28
|
-
assert.equal(sent[0].message.content, '<notesoup:marker seq="
|
|
29
|
-
assert.equal(nextHistorySeq(ctx),
|
|
28
|
+
assert.equal(sent[0].message.content, '<notesoup:marker seq="100" />');
|
|
29
|
+
assert.equal(nextHistorySeq(ctx), 101, "the marker occupies the seq it names");
|
|
30
30
|
// An immediate second run is only one seq later: no new marker.
|
|
31
31
|
await beforeAgentStart(captured, ctx);
|
|
32
32
|
assert.equal(sentOf(captured, MARKER_TYPE).length, 1);
|
|
33
33
|
// The next marker lands one interval after the last.
|
|
34
34
|
appendText(sessionManager, "user", "x");
|
|
35
|
-
for (let i = 0; i <
|
|
35
|
+
for (let i = 0; i < 98; i++)
|
|
36
36
|
appendText(sessionManager, "assistant", "y");
|
|
37
37
|
await beforeAgentStart(captured, ctx);
|
|
38
38
|
const all = sentOf(captured, MARKER_TYPE);
|
|
39
39
|
assert.equal(all.length, 2);
|
|
40
|
-
assert.deepEqual(all[1].message.details, { seq:
|
|
40
|
+
assert.deepEqual(all[1].message.details, { seq: 200 });
|
|
41
|
+
});
|
|
42
|
+
test("turn-end appends a due marker without requesting continuation or duplicating it at run start", async () => {
|
|
43
|
+
const sessionManager = managerWithMessages(99);
|
|
44
|
+
const captured = makeExtension(sessionManager);
|
|
45
|
+
const ctx = context(sessionManager);
|
|
46
|
+
const boundary = await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
47
|
+
assert.equal(boundary.continue, false);
|
|
48
|
+
assert.deepEqual(boundary.entries, [{ type: "custom_message", customType: MARKER_TYPE, content: '<notesoup:marker seq="100" />', display: false, details: { seq: 100 } }]);
|
|
49
|
+
assert.equal(nextHistorySeq(ctx), 101);
|
|
50
|
+
await beforeAgentStart(captured, ctx);
|
|
51
|
+
assert.equal(sentOf(captured, MARKER_TYPE).length, 0, "the committed turn-end marker already anchored this interval");
|
|
52
|
+
});
|
|
53
|
+
test("marker seq includes incoming boundary drafts, and a drafted reset or boot suppresses another marker", () => {
|
|
54
|
+
const ctx = context(managerWithMessages(98));
|
|
55
|
+
const incoming = [{ type: "custom_message", customType: "other/context", content: "context", display: false }];
|
|
56
|
+
assert.deepEqual(buildMarkerDraft(ctx, incoming)?.details, { seq: 100 });
|
|
57
|
+
assert.equal(buildMarkerDraft(ctx, [{ type: "custom", customType: RESET_MARKER_TYPE, data: { windowId: "pcw:new" } }]), undefined);
|
|
58
|
+
assert.equal(buildMarkerDraft(ctx, [{ type: "custom_message", customType: BOOT_TYPE, content: "boot", display: false }]), undefined);
|
|
59
|
+
});
|
|
60
|
+
test("a due tool reset uses its boot instead of inserting a marker in the reset boundary", async () => {
|
|
61
|
+
const sessionManager = managerWithMessages(99);
|
|
62
|
+
const captured = makeExtension(sessionManager);
|
|
63
|
+
const ctx = context(sessionManager);
|
|
64
|
+
await call(captured, "empty_brain", {}, ctx);
|
|
65
|
+
const boundary = await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
66
|
+
assert.ok(boundary.entries.some((entry) => entry.type === "custom_message" && entry.customType === BOOT_TYPE));
|
|
67
|
+
assert.equal(boundary.entries.some((entry) => entry.type === "custom_message" && entry.customType === MARKER_TYPE), false);
|
|
68
|
+
await beforeAgentStart(captured, ctx);
|
|
69
|
+
assert.equal(sentOf(captured, MARKER_TYPE).length, 0);
|
|
41
70
|
});
|
|
42
71
|
test("no marker before the interval", async () => {
|
|
43
|
-
const sessionManager = managerWithMessages(
|
|
72
|
+
const sessionManager = managerWithMessages(98);
|
|
44
73
|
const captured = makeExtension(sessionManager);
|
|
45
74
|
await beforeAgentStart(captured, context(sessionManager));
|
|
46
75
|
assert.equal(sentOf(captured, MARKER_TYPE).length, 0);
|
|
47
|
-
assert.equal(MARKER_INTERVAL,
|
|
76
|
+
assert.equal(MARKER_INTERVAL, 100);
|
|
48
77
|
});
|
|
49
78
|
test("a reset tail awaiting repair blocks markers, and boot anchors the new window's interval", async () => {
|
|
50
|
-
const sessionManager = managerWithMessages(
|
|
79
|
+
const sessionManager = managerWithMessages(99);
|
|
51
80
|
const captured = makeExtension(sessionManager);
|
|
52
81
|
const ctx = context(sessionManager);
|
|
53
82
|
// A marker with neither boot nor continuation still expects repair; stay out of its tail.
|
|
@@ -58,23 +87,25 @@ test("a reset tail awaiting repair blocks markers, and boot anchors the new wind
|
|
|
58
87
|
sessionManager.appendCustomMessageEntry(BOOT_TYPE, "boot", false, { windowId: "pcw:test:w1" });
|
|
59
88
|
await beforeAgentStart(captured, ctx);
|
|
60
89
|
assert.equal(sentOf(captured, MARKER_TYPE).length, 0);
|
|
61
|
-
// Once the reset tail is closed, boot (seq
|
|
90
|
+
// Once the reset tail is closed, boot (seq 100) already anchored the window's start seq.
|
|
62
91
|
sessionManager.appendCustomMessageEntry(CONTINUATION_TYPE, "continued", false);
|
|
63
92
|
await beforeAgentStart(captured, ctx);
|
|
64
93
|
assert.equal(sentOf(captured, MARKER_TYPE).length, 0);
|
|
65
|
-
for (let i = 0; i <
|
|
94
|
+
for (let i = 0; i < 98; i++)
|
|
66
95
|
appendText(sessionManager, "assistant", "y");
|
|
67
96
|
await beforeAgentStart(captured, ctx);
|
|
68
97
|
const sent = sentOf(captured, MARKER_TYPE);
|
|
69
98
|
assert.equal(sent.length, 1);
|
|
70
|
-
assert.deepEqual(sent[0].message.details, { seq:
|
|
99
|
+
assert.deepEqual(sent[0].message.details, { seq: 200 });
|
|
71
100
|
});
|
|
72
101
|
test("notesoup off silences the odometer", async () => {
|
|
73
|
-
const sessionManager = managerWithMessages(
|
|
102
|
+
const sessionManager = managerWithMessages(99);
|
|
74
103
|
const captured = makeExtension(sessionManager);
|
|
75
104
|
const ctx = context(sessionManager);
|
|
76
105
|
await runCommand(captured, "notesoup", "off", ctx);
|
|
77
106
|
await beforeAgentStart(captured, ctx);
|
|
107
|
+
const boundary = await commitTurnEndBoundary(captured, sessionManager, ctx);
|
|
108
|
+
assert.equal(boundary.entries.length, 0);
|
|
78
109
|
assert.equal(sentOf(captured, MARKER_TYPE).length, 0);
|
|
79
110
|
});
|
|
80
111
|
function managerWithMessages(count) {
|
|
@@ -139,7 +139,7 @@ test("search offsets address the body and never move when access metadata grows"
|
|
|
139
139
|
assert.equal(frontBody, "needle later");
|
|
140
140
|
assert.equal(frontMatch.offsetChars, 0, "frontmatter length is not part of the body offset");
|
|
141
141
|
assert.equal(Array.from(frontBody).slice(frontMatch.offsetChars).join(""), "needle later");
|
|
142
|
-
assert.deepEqual(Object.keys((await notes.read("counted.md"))).sort(), ["
|
|
142
|
+
assert.deepEqual(Object.keys((await notes.read("counted.md"))).sort(), ["body", "meta", "resolvedScope"], "a read exposes metadata and the body, never a serialized rendering");
|
|
143
143
|
});
|
|
144
144
|
test("invalid addressing and failed edits leave stored bytes untouched without poisoning the queue", async (t) => {
|
|
145
145
|
const { home, context, notes } = fixture(t);
|
package/dist/test/notes.test.js
CHANGED
|
@@ -222,7 +222,9 @@ legacy body`);
|
|
|
222
222
|
assert.equal(parsed.meta.createdAt, Date.parse("2026-02-01T00:00:00Z"), "missing canonical timestamp takes the normal default");
|
|
223
223
|
assert.equal(parsed.meta.created_at, "2026-01-01T00:00:00.000+00:00", "unrecognized fields remain ordinary extras");
|
|
224
224
|
assert.equal((await listNotes(ctx))[0]?.address, "legacy.md");
|
|
225
|
-
|
|
225
|
+
const legacyRead = await call(captured, "notes_read", { address: "legacy.md" }, ctx);
|
|
226
|
+
assert.match(resultRead(legacyRead).content, /legacy body$/);
|
|
227
|
+
assert.equal(resultData(legacyRead).metadata.extra.last_accessed, parsed.meta.last_accessed, "a literal legacy last_accessed remains ordinary extra frontmatter");
|
|
226
228
|
await call(captured, "notes_update", { address: "legacy.md", edits: [{ oldText: "legacy body", newText: "edited body" }] }, ctx);
|
|
227
229
|
await call(captured, "notes_write", { address: "legacy.md", content: "overwritten body" }, ctx);
|
|
228
230
|
const rewritten = parseNote(readFileSync(legacyFile, "utf8"));
|
|
@@ -434,9 +436,8 @@ test("list and search merge scopes and carry addresses; the path jail rejects es
|
|
|
434
436
|
await call(captured, "notes_write", { address: "@human/three.md", content: "needle three" }, ctx);
|
|
435
437
|
const listed = resultData(await call(captured, "notes_list", {}, ctx));
|
|
436
438
|
assert.deepEqual([...listed.files].map((file) => file.address).sort(), ["@human/three.md", "@project/two.md", "one.md"], "every merged row carries its full address");
|
|
437
|
-
for (const row of listed.files)
|
|
438
|
-
assert.
|
|
439
|
-
}
|
|
439
|
+
for (const row of listed.files)
|
|
440
|
+
assert.equal(typeof row.updated_at, "string");
|
|
440
441
|
const scoped = resultData(await call(captured, "notes_list", { glob: "@human/**" }, ctx));
|
|
441
442
|
assert.deepEqual(scoped.files.map((file) => file.address), ["@human/three.md"], "an address glob filter narrows the set");
|
|
442
443
|
const searched = resultData(await call(captured, "notes_search", { query: "needle" }, ctx));
|
|
@@ -51,12 +51,12 @@ test("notes_update unchanged keeps quiet", () => {
|
|
|
51
51
|
assert.equal(lines(component), "unchanged a.md");
|
|
52
52
|
});
|
|
53
53
|
test("notes_read collapsed: size and a peek at the first line", () => {
|
|
54
|
-
const result = toolResult(success({ address: "@project/MAP.md", metadata: { origin: "self", created_at: "x", updated_at: "y",
|
|
54
|
+
const result = toolResult(success({ address: "@project/MAP.md", metadata: { origin: "self", created_at: "x", updated_at: "y", extra: {} }, text: "# MAP\n\nbody", total_chars: 11, next_offset_chars: null }));
|
|
55
55
|
const component = notesReadRenderers.renderResult(result, { expanded: false }, flatTheme);
|
|
56
56
|
assert.equal(lines(component), "read @project/MAP.md · 11 chars — # MAP");
|
|
57
57
|
});
|
|
58
58
|
test("notes_read expanded: truncation points at the next offset", () => {
|
|
59
|
-
const result = toolResult(success({ address: "a.md", metadata: { origin: "self", created_at: "x", updated_at: "y",
|
|
59
|
+
const result = toolResult(success({ address: "a.md", metadata: { origin: "self", created_at: "x", updated_at: "y", extra: {} }, text: "part", total_chars: 10, next_offset_chars: 4 }));
|
|
60
60
|
const component = notesReadRenderers.renderResult(result, { expanded: true }, flatTheme);
|
|
61
61
|
assert.equal(lines(component), "read a.md · 10 chars · truncated — part\n\npart\n… continue at offset_chars=4");
|
|
62
62
|
});
|
package/docs/architecture.md
CHANGED
|
@@ -43,7 +43,7 @@ For the native dsh reset transaction, prompt ordering, capability checks and lim
|
|
|
43
43
|
|
|
44
44
|
## State and persistence
|
|
45
45
|
|
|
46
|
-
`plugins/pi/reset/lifecycle.ts` is the sole `turn_end` composer: it accepts incoming drafts, drains budget-owned guidance/warning drafts, and appends a reset boundary for an explicit tool request or the hard-reserve safety path. Manual and budget close-outs stay armed across note/tool turns and commit from `agent_before_settle` after a successful stop with queued work drained; a manual close-out stops the run while a budget close-out continues in the fresh window. Repeated requests for the same window deduplicate. See [reset lifecycle](reset-lifecycle.md).
|
|
46
|
+
`plugins/pi/reset/lifecycle.ts` is the sole `turn_end` composer: it accepts incoming drafts, drains budget-owned guidance/warning drafts, and appends a reset boundary for an explicit tool request or the hard-reserve safety path. Successful non-reset turns also append a hidden seq marker once at least 100 projected seqs have elapsed since the latest boot or marker, counting incoming boundary drafts; run-start checking remains as a fallback. Markers do not request continuation or split a tool batch. Queued user messages are delivered after this boundary, so a threshold crossed only by such input is marked after its response, not before. A reset's boot anchors its interval instead of adding an old-window marker. Manual and budget close-outs stay armed across note/tool turns and commit from `agent_before_settle` after a successful stop with queued work drained; a manual close-out stops the run while a budget close-out continues in the fresh window. Repeated requests for the same window deduplicate. See [reset lifecycle](reset-lifecycle.md).
|
|
47
47
|
|
|
48
48
|
A new reset is a native empty-summary compaction checkpoint configured to retain none, followed by one `notesoup/reset-marker` custom entry with `{ windowId: string, origin: "normal" | "forced" }`, a hidden `notesoup/boot` whose `details.windowId` matches, and a hidden continuation. The checkpoint is the canonical-history cut; the marker is the durable logical window identity. Raw session entries remain available to history tools. Legacy marker-only branches keep a narrow projection fallback. `plugins/pi/window.ts` owns marker/checkpoint validation, active-branch scan, root/current IDs, and per-window message lookup; `plugins/pi/history.ts` supplies append entries and the active branch to `src/history/pi.ts`, whose structural wire decoder recognizes persisted reset markers; shared `history/history.ts` pairs only decoded, addressed data. The live scan never uses a global entry tail.
|
|
49
49
|
|
package/docs/tool-results.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The seven notes/history tools have one business result model. Pi exposes compact results as `structuredContent` to codemode and renders them as `content` for ordinary model calls. Claude uses the same business handlers and text rendering. Neither host re-runs a query, truncates a different page, or parses formatted text to recover data.
|
|
4
4
|
|
|
5
|
-
This is a breaking tool protocol change: successes no longer have `ok/data` wrappers, errors are flat, and read fields no longer sit under `window`. History execution details live once in the pageable document. Stored notes and raw Pi session entries are not deleted or rewritten by this change. `
|
|
5
|
+
This is a breaking tool protocol change: successes no longer have `ok/data` wrappers, errors are flat, and read fields no longer sit under `window`. History execution details live once in the pageable document. Stored notes and raw Pi session entries are not deleted or rewritten by this change. In Pi, `get_context_remaining` independently declares `{ remaining_tokens }` as its output schema; `empty_brain` remains outside this protocol.
|
|
6
6
|
|
|
7
7
|
## Results
|
|
8
8
|
|
|
@@ -38,7 +38,7 @@ Both read operations return these fields at the result root, alongside identity
|
|
|
38
38
|
|
|
39
39
|
Positions count Unicode code points, not UTF-16 units or UTF-8 bytes. The returned text is a contiguous unmodified prefix of the requested range, without ellipsis markers. `next_offset_chars` names the first undelivered character, or is null at the true end. A negative input offset selects a tail; the delivered window does not echo the offset it resolved.
|
|
40
40
|
|
|
41
|
-
- `notes_read`: `address`, optional `project_key`, and `metadata` accompany the text fields. Positions address only the note **body**. Access counts and last-access times remain stored
|
|
41
|
+
- `notes_read`: `address`, optional `project_key`, and `metadata` accompany the text fields. Positions address only the note **body**. Access counts and last-access times remain stored; only `dream_begin` rows report last access.
|
|
42
42
|
- `history_read`: `seq`, `role`, `created_at`, and a tool summary accompany the text fields. Explicit session targeting also carries canonical `session`. Positions address one deterministic document derived from the event's facts. Query matches address that same document, not its decorated presentation.
|
|
43
43
|
|
|
44
44
|
Repeated note reads observe the current file; this is not a retained snapshot service. A concurrent body edit can change positions. History reflects the active branch and recorded facts, including a result that may arrive after a pending call was first observed.
|
package/package.json
CHANGED
package/playbook.md
CHANGED
|
@@ -22,7 +22,7 @@ Durable notes hold decisions, constraints, and lessons that stay true after the
|
|
|
22
22
|
|
|
23
23
|
1. **Leave stable notes alone.** Change a note to incorporate new evidence, fix a verified error, retire a stale claim, merge a genuine duplicate, trim diary content, or split an oversized file, not merely to shorten or rephrase it. No change is a valid outcome.
|
|
24
24
|
2. **Verify only what the proposed change depends on.** Before correcting, retiring, or promoting a conclusion, check the relevant evidence as needed. Do not revalidate every stable note or turn dream into a source-code audit. An unavailable referent is unverified, not proof that it is dead.
|
|
25
|
-
3. **Retire what is no longer true.** When evidence shows a durable note is stale, correct it in place; if nothing true remains, crumple it. Remove or fix its MAP line either way. A note's last access is a hint, not evidence: long-unread notes are candidates to check, not to crumple on sight.
|
|
25
|
+
3. **Retire what is no longer true.** When evidence shows a durable note is stale, correct it in place; if nothing true remains, crumple it. Remove or fix its MAP line either way. A note's last access is a hint, not evidence: long-unread notes are candidates to check, not to crumple on sight. `dream_begin` lists each note's last access; reads during a dream leave no stamp, so reviewing a note does not make it look fresh.
|
|
26
26
|
4. **Merge only genuine duplicates.** Merge two notes only when they share a topic and kind (checkpoint, design, log). First carry every fact, condition, and exception unique to the absorbed note into the survivor, then crumple the absorbed note. Otherwise keep both and record any unresolved conflict.
|
|
27
27
|
5. **Relocate misfiled notes.** When a standing ruling or the note's own MAP already names its proper notebook, move it there, preserving its metadata, and update both notebooks' maps. Do it, don't propose it. Propose only when the destination notebook itself is unclear.
|
|
28
28
|
6. **Preserve meaning and provenance.** Keep facts, conditions, exceptions, uncertainty, authorship, and sources. When promoting a finding, cite its source. Do not relabel agent-authored material as human-authored. If its destination or authority is unclear, propose the promotion instead.
|
|
@@ -8601,10 +8601,10 @@ function createNotesStore(input) {
|
|
|
8601
8601
|
if (raw === void 0) return void 0;
|
|
8602
8602
|
const now = Date.now();
|
|
8603
8603
|
const parsed = parseNote(raw, now);
|
|
8604
|
-
if (identity2.dreaming !== void 0 || (scope === "project" || scope === "session") && destination.who !== void 0) return { meta: { ...parsed.meta, scope }, body: parsed.body, resolvedScope: scope
|
|
8604
|
+
if (identity2.dreaming !== void 0 || (scope === "project" || scope === "session") && destination.who !== void 0) return { meta: { ...parsed.meta, scope }, body: parsed.body, resolvedScope: scope };
|
|
8605
8605
|
const meta = { ...parsed.meta, scope, lastAccessed: now, accessCount: (typeof parsed.meta.accessCount === "number" ? parsed.meta.accessCount : 0) + 1 };
|
|
8606
8606
|
await atomicWrite(path, serializeNote(meta, parsed.body));
|
|
8607
|
-
return { meta, body: parsed.body, resolvedScope: scope
|
|
8607
|
+
return { meta, body: parsed.body, resolvedScope: scope };
|
|
8608
8608
|
});
|
|
8609
8609
|
}
|
|
8610
8610
|
async function update(address, edits, options = {}) {
|
|
@@ -9102,7 +9102,6 @@ var NoteMetadataSchema = typebox_exports.Object({
|
|
|
9102
9102
|
origin: typebox_exports.Union([...ORIGIN_VALUES]),
|
|
9103
9103
|
created_at: typebox_exports.String(),
|
|
9104
9104
|
updated_at: typebox_exports.String(),
|
|
9105
|
-
last_accessed: typebox_exports.String(),
|
|
9106
9105
|
crumpled_at: typebox_exports.Optional(typebox_exports.String()),
|
|
9107
9106
|
project: typebox_exports.Optional(typebox_exports.String()),
|
|
9108
9107
|
extra: typebox_exports.Record(typebox_exports.String(), typebox_exports.Unknown())
|
|
@@ -9128,7 +9127,6 @@ function noteMetadata(meta) {
|
|
|
9128
9127
|
origin: meta.origin,
|
|
9129
9128
|
created_at: localIso(meta.createdAt),
|
|
9130
9129
|
updated_at: localIso(meta.updatedAt),
|
|
9131
|
-
last_accessed: localIso(meta.lastAccessed),
|
|
9132
9130
|
...typeof meta.crumpledAt === "string" ? { crumpled_at: meta.crumpledAt } : {},
|
|
9133
9131
|
...typeof meta.project === "string" ? { project: meta.project } : {},
|
|
9134
9132
|
extra
|
|
@@ -9139,7 +9137,6 @@ function renderMetadata(metadata) {
|
|
|
9139
9137
|
`origin ${metadata.origin}`,
|
|
9140
9138
|
`created ${metadata.created_at}`,
|
|
9141
9139
|
`updated ${metadata.updated_at}`,
|
|
9142
|
-
`accessed ${metadata.last_accessed}`,
|
|
9143
9140
|
...metadata.crumpled_at === void 0 ? [] : [`crumpled ${metadata.crumpled_at}`],
|
|
9144
9141
|
...metadata.project === void 0 ? [] : [`project ${metadata.project}`]
|
|
9145
9142
|
];
|
|
@@ -9166,7 +9163,6 @@ var NoteIdentitySchema = {
|
|
|
9166
9163
|
var ListedFileSchema = typebox_exports.Object({
|
|
9167
9164
|
...NoteIdentitySchema,
|
|
9168
9165
|
updated_at: typebox_exports.String(),
|
|
9169
|
-
last_accessed: typebox_exports.String(),
|
|
9170
9166
|
crumpled_at: typebox_exports.Optional(typebox_exports.String())
|
|
9171
9167
|
}, { additionalProperties: false });
|
|
9172
9168
|
var MatchSchema = typebox_exports.Object({
|
|
@@ -9180,7 +9176,7 @@ var SearchedFileSchema = typebox_exports.Object({
|
|
|
9180
9176
|
}, { additionalProperties: false });
|
|
9181
9177
|
var SnapshotSchema = {
|
|
9182
9178
|
more: typebox_exports.Integer({ description: "How many more were left out." }),
|
|
9183
|
-
namespaces_unavailable: typebox_exports.Array(typebox_exports.String())
|
|
9179
|
+
namespaces_unavailable: typebox_exports.Array(typebox_exports.String(), { description: "Unreadable notebooks or notes." })
|
|
9184
9180
|
};
|
|
9185
9181
|
var NotesWriteDataSchema = typebox_exports.Object({
|
|
9186
9182
|
...NoteIdentitySchema,
|
|
@@ -9225,7 +9221,7 @@ function snapshot(rows, limit, status, renderData, shrink) {
|
|
|
9225
9221
|
return fitsResult(outcome, render) ? outcome : failure("output_too_large", `The list of unreachable notebooks is itself over ${TOOL_OUTPUT_LIMIT}; narrow \`glob\` to fewer notebooks.`);
|
|
9226
9222
|
}
|
|
9227
9223
|
function listedFile(row, identity2) {
|
|
9228
|
-
return { ...noteIdentity(identity2, row.address), updated_at: localIso(row.meta.updatedAt),
|
|
9224
|
+
return { ...noteIdentity(identity2, row.address), updated_at: localIso(row.meta.updatedAt), ...row.meta.crumpledAt === void 0 ? {} : { crumpled_at: row.meta.crumpledAt } };
|
|
9229
9225
|
}
|
|
9230
9226
|
var notesWriteParameters = typebox_exports.Object({ address: typebox_exports.String(), content: typebox_exports.String(), origin: ORIGIN, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
9231
9227
|
function renderWriteData(data) {
|
|
@@ -9305,7 +9301,7 @@ var notesRead = {
|
|
|
9305
9301
|
if (!note) return failure("not_found", `No note at ${resolved.address}.`);
|
|
9306
9302
|
const totalChars = Array.from(note.body).length;
|
|
9307
9303
|
if (params.offset_chars !== void 0 && params.offset_chars > totalChars) return failure("invalid_offset", `This note ends at char ${totalChars}; offset_chars ${params.offset_chars} is past the last word.`);
|
|
9308
|
-
const metadata = noteMetadata(
|
|
9304
|
+
const metadata = noteMetadata(note.meta);
|
|
9309
9305
|
return readTextWindow(note.body, params.offset_chars, params.max_chars, (window) => ({ ...resolved, metadata, ...window }), (result) => renderOutcome(result, renderReadData));
|
|
9310
9306
|
} catch (error) {
|
|
9311
9307
|
return failureOf(error);
|
|
@@ -9317,7 +9313,7 @@ var notesListParameters = typebox_exports.Object({ glob: GLOB_PARAMETER, limit:
|
|
|
9317
9313
|
function renderListData(data) {
|
|
9318
9314
|
const lines = [`${data.files.length} ${data.files.length === 1 ? "note" : "notes"}`];
|
|
9319
9315
|
for (const file of data.files) {
|
|
9320
|
-
lines.push(`- ${renderIdentity(file)} | updated ${file.updated_at} | accessed ${file.last_accessed}${file.crumpled_at === void 0 ? "" : ` | crumpled ${file.crumpled_at}`}`);
|
|
9316
|
+
lines.push(`- ${renderIdentity(file)} | updated ${file.updated_at}${file.last_accessed === void 0 ? "" : ` | accessed ${file.last_accessed}`}${file.crumpled_at === void 0 ? "" : ` | crumpled ${file.crumpled_at}`}`);
|
|
9321
9317
|
}
|
|
9322
9318
|
if (data.more > 0) lines.push(`${data.more} more matching notes omitted; narrow with glob`);
|
|
9323
9319
|
for (const namespace of data.namespaces_unavailable) lines.push(`${namespace} could not be read`);
|
|
@@ -9418,8 +9414,8 @@ var HistoryNewerSchema = typebox_exports.Object({
|
|
|
9418
9414
|
var HistoryPageSchema = typebox_exports.Object({
|
|
9419
9415
|
notice: typebox_exports.Optional(typebox_exports.String()),
|
|
9420
9416
|
items: typebox_exports.Array(typebox_exports.Union([HistoryPageItemSchema, HistoryFoldedRowSchema])),
|
|
9421
|
-
page_older: typebox_exports.Union([HistoryOlderSchema, typebox_exports.Null()]),
|
|
9422
|
-
page_newer: typebox_exports.Union([HistoryNewerSchema, typebox_exports.Null()])
|
|
9417
|
+
page_older: typebox_exports.Union([HistoryOlderSchema, typebox_exports.Null()], { description: "Args to merge into `history_list` for older events." }),
|
|
9418
|
+
page_newer: typebox_exports.Union([HistoryNewerSchema, typebox_exports.Null()], { description: "Args to merge into `history_list` for newer events." })
|
|
9423
9419
|
}, { additionalProperties: false });
|
|
9424
9420
|
function truncateHistoryItem(item, fits) {
|
|
9425
9421
|
if (fits(item)) return item;
|
|
@@ -22,7 +22,7 @@ Durable notes hold decisions, constraints, and lessons that stay true after the
|
|
|
22
22
|
|
|
23
23
|
1. **Leave stable notes alone.** Change a note to incorporate new evidence, fix a verified error, retire a stale claim, merge a genuine duplicate, trim diary content, or split an oversized file, not merely to shorten or rephrase it. No change is a valid outcome.
|
|
24
24
|
2. **Verify only what the proposed change depends on.** Before correcting, retiring, or promoting a conclusion, check the relevant evidence as needed. Do not revalidate every stable note or turn dream into a source-code audit. An unavailable referent is unverified, not proof that it is dead.
|
|
25
|
-
3. **Retire what is no longer true.** When evidence shows a durable note is stale, correct it in place; if nothing true remains, crumple it. Remove or fix its MAP line either way. A note's last access is a hint, not evidence: long-unread notes are candidates to check, not to crumple on sight.
|
|
25
|
+
3. **Retire what is no longer true.** When evidence shows a durable note is stale, correct it in place; if nothing true remains, crumple it. Remove or fix its MAP line either way. A note's last access is a hint, not evidence: long-unread notes are candidates to check, not to crumple on sight. `dream_begin` lists each note's last access; reads during a dream leave no stamp, so reviewing a note does not make it look fresh.
|
|
26
26
|
4. **Merge only genuine duplicates.** Merge two notes only when they share a topic and kind (checkpoint, design, log). First carry every fact, condition, and exception unique to the absorbed note into the survivor, then crumple the absorbed note. Otherwise keep both and record any unresolved conflict.
|
|
27
27
|
5. **Relocate misfiled notes.** When a standing ruling or the note's own MAP already names its proper notebook, move it there, preserving its metadata, and update both notebooks' maps. Do it, don't propose it. Propose only when the destination notebook itself is unclear.
|
|
28
28
|
6. **Preserve meaning and provenance.** Keep facts, conditions, exceptions, uncertainty, authorship, and sources. When promoting a finding, cite its source. Do not relabel agent-authored material as human-authored. If its destination or authority is unclear, propose the promotion instead.
|
|
@@ -25576,10 +25576,10 @@ function createNotesStore(input) {
|
|
|
25576
25576
|
if (raw === void 0) return void 0;
|
|
25577
25577
|
const now = Date.now();
|
|
25578
25578
|
const parsed = parseNote(raw, now);
|
|
25579
|
-
if (identity.dreaming !== void 0 || (scope === "project" || scope === "session") && destination.who !== void 0) return { meta: { ...parsed.meta, scope }, body: parsed.body, resolvedScope: scope
|
|
25579
|
+
if (identity.dreaming !== void 0 || (scope === "project" || scope === "session") && destination.who !== void 0) return { meta: { ...parsed.meta, scope }, body: parsed.body, resolvedScope: scope };
|
|
25580
25580
|
const meta2 = { ...parsed.meta, scope, lastAccessed: now, accessCount: (typeof parsed.meta.accessCount === "number" ? parsed.meta.accessCount : 0) + 1 };
|
|
25581
25581
|
await atomicWrite(path, serializeNote(meta2, parsed.body));
|
|
25582
|
-
return { meta: meta2, body: parsed.body, resolvedScope: scope
|
|
25582
|
+
return { meta: meta2, body: parsed.body, resolvedScope: scope };
|
|
25583
25583
|
});
|
|
25584
25584
|
}
|
|
25585
25585
|
async function update(address, edits, options = {}) {
|
|
@@ -26077,7 +26077,6 @@ var NoteMetadataSchema = typebox_exports.Object({
|
|
|
26077
26077
|
origin: typebox_exports.Union([...ORIGIN_VALUES]),
|
|
26078
26078
|
created_at: typebox_exports.String(),
|
|
26079
26079
|
updated_at: typebox_exports.String(),
|
|
26080
|
-
last_accessed: typebox_exports.String(),
|
|
26081
26080
|
crumpled_at: typebox_exports.Optional(typebox_exports.String()),
|
|
26082
26081
|
project: typebox_exports.Optional(typebox_exports.String()),
|
|
26083
26082
|
extra: typebox_exports.Record(typebox_exports.String(), typebox_exports.Unknown())
|
|
@@ -26103,7 +26102,6 @@ function noteMetadata(meta2) {
|
|
|
26103
26102
|
origin: meta2.origin,
|
|
26104
26103
|
created_at: localIso(meta2.createdAt),
|
|
26105
26104
|
updated_at: localIso(meta2.updatedAt),
|
|
26106
|
-
last_accessed: localIso(meta2.lastAccessed),
|
|
26107
26105
|
...typeof meta2.crumpledAt === "string" ? { crumpled_at: meta2.crumpledAt } : {},
|
|
26108
26106
|
...typeof meta2.project === "string" ? { project: meta2.project } : {},
|
|
26109
26107
|
extra
|
|
@@ -26114,7 +26112,6 @@ function renderMetadata(metadata) {
|
|
|
26114
26112
|
`origin ${metadata.origin}`,
|
|
26115
26113
|
`created ${metadata.created_at}`,
|
|
26116
26114
|
`updated ${metadata.updated_at}`,
|
|
26117
|
-
`accessed ${metadata.last_accessed}`,
|
|
26118
26115
|
...metadata.crumpled_at === void 0 ? [] : [`crumpled ${metadata.crumpled_at}`],
|
|
26119
26116
|
...metadata.project === void 0 ? [] : [`project ${metadata.project}`]
|
|
26120
26117
|
];
|
|
@@ -26141,7 +26138,6 @@ var NoteIdentitySchema = {
|
|
|
26141
26138
|
var ListedFileSchema = typebox_exports.Object({
|
|
26142
26139
|
...NoteIdentitySchema,
|
|
26143
26140
|
updated_at: typebox_exports.String(),
|
|
26144
|
-
last_accessed: typebox_exports.String(),
|
|
26145
26141
|
crumpled_at: typebox_exports.Optional(typebox_exports.String())
|
|
26146
26142
|
}, { additionalProperties: false });
|
|
26147
26143
|
var MatchSchema = typebox_exports.Object({
|
|
@@ -26155,7 +26151,7 @@ var SearchedFileSchema = typebox_exports.Object({
|
|
|
26155
26151
|
}, { additionalProperties: false });
|
|
26156
26152
|
var SnapshotSchema = {
|
|
26157
26153
|
more: typebox_exports.Integer({ description: "How many more were left out." }),
|
|
26158
|
-
namespaces_unavailable: typebox_exports.Array(typebox_exports.String())
|
|
26154
|
+
namespaces_unavailable: typebox_exports.Array(typebox_exports.String(), { description: "Unreadable notebooks or notes." })
|
|
26159
26155
|
};
|
|
26160
26156
|
var NotesWriteDataSchema = typebox_exports.Object({
|
|
26161
26157
|
...NoteIdentitySchema,
|
|
@@ -26200,7 +26196,7 @@ function snapshot(rows, limit, status, renderData, shrink) {
|
|
|
26200
26196
|
return fitsResult(outcome, render) ? outcome : failure2("output_too_large", `The list of unreachable notebooks is itself over ${TOOL_OUTPUT_LIMIT}; narrow \`glob\` to fewer notebooks.`);
|
|
26201
26197
|
}
|
|
26202
26198
|
function listedFile(row, identity) {
|
|
26203
|
-
return { ...noteIdentity(identity, row.address), updated_at: localIso(row.meta.updatedAt),
|
|
26199
|
+
return { ...noteIdentity(identity, row.address), updated_at: localIso(row.meta.updatedAt), ...row.meta.crumpledAt === void 0 ? {} : { crumpled_at: row.meta.crumpledAt } };
|
|
26204
26200
|
}
|
|
26205
26201
|
var notesWriteParameters = typebox_exports.Object({ address: typebox_exports.String(), content: typebox_exports.String(), origin: ORIGIN, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
26206
26202
|
function renderWriteData(data) {
|
|
@@ -26280,7 +26276,7 @@ var notesRead = {
|
|
|
26280
26276
|
if (!note) return failure2("not_found", `No note at ${resolved.address}.`);
|
|
26281
26277
|
const totalChars = Array.from(note.body).length;
|
|
26282
26278
|
if (params.offset_chars !== void 0 && params.offset_chars > totalChars) return failure2("invalid_offset", `This note ends at char ${totalChars}; offset_chars ${params.offset_chars} is past the last word.`);
|
|
26283
|
-
const metadata = noteMetadata(
|
|
26279
|
+
const metadata = noteMetadata(note.meta);
|
|
26284
26280
|
return readTextWindow(note.body, params.offset_chars, params.max_chars, (window) => ({ ...resolved, metadata, ...window }), (result) => renderOutcome(result, renderReadData));
|
|
26285
26281
|
} catch (error2) {
|
|
26286
26282
|
return failureOf(error2);
|
|
@@ -26292,7 +26288,7 @@ var notesListParameters = typebox_exports.Object({ glob: GLOB_PARAMETER, limit:
|
|
|
26292
26288
|
function renderListData(data) {
|
|
26293
26289
|
const lines = [`${data.files.length} ${data.files.length === 1 ? "note" : "notes"}`];
|
|
26294
26290
|
for (const file of data.files) {
|
|
26295
|
-
lines.push(`- ${renderIdentity(file)} | updated ${file.updated_at} | accessed ${file.last_accessed}${file.crumpled_at === void 0 ? "" : ` | crumpled ${file.crumpled_at}`}`);
|
|
26291
|
+
lines.push(`- ${renderIdentity(file)} | updated ${file.updated_at}${file.last_accessed === void 0 ? "" : ` | accessed ${file.last_accessed}`}${file.crumpled_at === void 0 ? "" : ` | crumpled ${file.crumpled_at}`}`);
|
|
26296
26292
|
}
|
|
26297
26293
|
if (data.more > 0) lines.push(`${data.more} more matching notes omitted; narrow with glob`);
|
|
26298
26294
|
for (const namespace of data.namespaces_unavailable) lines.push(`${namespace} could not be read`);
|
|
@@ -26393,8 +26389,8 @@ var HistoryNewerSchema = typebox_exports.Object({
|
|
|
26393
26389
|
var HistoryPageSchema = typebox_exports.Object({
|
|
26394
26390
|
notice: typebox_exports.Optional(typebox_exports.String()),
|
|
26395
26391
|
items: typebox_exports.Array(typebox_exports.Union([HistoryPageItemSchema, HistoryFoldedRowSchema])),
|
|
26396
|
-
page_older: typebox_exports.Union([HistoryOlderSchema, typebox_exports.Null()]),
|
|
26397
|
-
page_newer: typebox_exports.Union([HistoryNewerSchema, typebox_exports.Null()])
|
|
26392
|
+
page_older: typebox_exports.Union([HistoryOlderSchema, typebox_exports.Null()], { description: "Args to merge into `history_list` for older events." }),
|
|
26393
|
+
page_newer: typebox_exports.Union([HistoryNewerSchema, typebox_exports.Null()], { description: "Args to merge into `history_list` for newer events." })
|
|
26398
26394
|
}, { additionalProperties: false });
|
|
26399
26395
|
function truncateHistoryItem(item, fits) {
|
|
26400
26396
|
if (fits(item)) return item;
|
|
@@ -8,7 +8,7 @@ Notes cards start collapsed; update cards also show the sentence just added. The
|
|
|
8
8
|
|
|
9
9
|
Notes cards use the same projection for Pi live events and replayed history; Claude supplies its receipt text under the adapter's `output` field and its edits under `input.edits`. The UI does not depend on Pi's live-only `structuredContent`. Failed calls also read the adapter's error content (string or text blocks) or transport message when no result is available.
|
|
10
10
|
|
|
11
|
-
`empty_brain` (including `mcp__notesoup__empty_brain`) becomes a divider for running, completed and failed calls. Pi's JSON rollover outcomes are preserved. Claude's plain acknowledgement only completes the tool call; it does not invent a Pi outcome or assert that the deferred reset has committed.
|
|
11
|
+
`empty_brain` (including `mcp__notesoup__empty_brain`) becomes a divider for running, completed and failed calls. Pi's JSON rollover outcomes are preserved. A successful `brain emptied` divider with a `last_word` argument opens a selectable last-word modal when clicked. Claude's plain acknowledgement only completes the tool call; it does not invent a Pi outcome or assert that the deferred reset has committed.
|
|
12
12
|
|
|
13
13
|
Automated tests check transformer payloads with source-derived adapter fixtures, not a live Paseo UI session.
|
|
14
14
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
2
|
-
import {
|
|
2
|
+
import { Modal } from "@getpaseo/plugin/client/react-native";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Pressable, Text, View } from "react-native";
|
|
3
5
|
import type { BrainEmpty } from "../shared/brain-empty.ts";
|
|
4
6
|
|
|
5
7
|
function label(data: BrainEmpty): string {
|
|
@@ -23,18 +25,35 @@ function CutLine({ color }: { color: string }) {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export function BrainEmptyDivider({ item, theme }: PluginTimelineItemProps<BrainEmpty>) {
|
|
28
|
+
const [lastWordOpen, setLastWordOpen] = useState(false);
|
|
26
29
|
const data = item.data;
|
|
27
30
|
const refused = data.error !== undefined || data.status === "failed";
|
|
28
31
|
const color = refused ? theme.colors.statusDanger : theme.colors.foregroundMuted;
|
|
32
|
+
const hasLastWord = data.outcome === "rollover_requested" && data.lastWord !== undefined;
|
|
29
33
|
return (
|
|
30
|
-
<View style={{ paddingVertical: 6
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
<View style={{ paddingVertical: 6 }}>
|
|
35
|
+
<Pressable
|
|
36
|
+
accessibilityRole={hasLastWord ? "button" : undefined}
|
|
37
|
+
accessibilityLabel={hasLastWord ? "Show last word" : undefined}
|
|
38
|
+
disabled={!hasLastWord}
|
|
39
|
+
onPress={hasLastWord ? () => setLastWordOpen(true) : undefined}
|
|
40
|
+
style={({ pressed }) => ({ gap: 3, opacity: pressed ? 0.7 : 1 })}
|
|
41
|
+
>
|
|
42
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
43
|
+
<CutLine color={color} />
|
|
44
|
+
<Text style={{ color, fontSize: 11.5, letterSpacing: 0.3 }}>{label(data)}</Text>
|
|
45
|
+
<CutLine color={color} />
|
|
46
|
+
</View>
|
|
47
|
+
{data.error !== undefined && (
|
|
48
|
+
<Text selectable style={{ color: theme.colors.statusDanger, fontSize: 12, textAlign: "center" }}>{data.error}</Text>
|
|
49
|
+
)}
|
|
50
|
+
</Pressable>
|
|
51
|
+
{hasLastWord && (
|
|
52
|
+
<Modal title="Last word" open={lastWordOpen} onOpenChange={setLastWordOpen}>
|
|
53
|
+
<Modal.Content style={{ backgroundColor: theme.colors.surface2 }}>
|
|
54
|
+
<Text selectable style={{ color: theme.colors.foreground, fontSize: 14, lineHeight: 21 }}>{data.lastWord}</Text>
|
|
55
|
+
</Modal.Content>
|
|
56
|
+
</Modal>
|
|
38
57
|
)}
|
|
39
58
|
</View>
|
|
40
59
|
);
|
|
@@ -20,11 +20,15 @@ function resultJson(output: unknown): Record<string, unknown> | undefined {
|
|
|
20
20
|
|
|
21
21
|
function brainEmptyData(item: ToolCallItem): BrainEmpty | undefined {
|
|
22
22
|
if (item.detail.type !== "unknown") return undefined;
|
|
23
|
+
const input = isRecord(item.detail.input) ? item.detail.input : undefined;
|
|
24
|
+
const rawLastWord = input?.last_word;
|
|
25
|
+
const lastWord = typeof rawLastWord === "string" ? rawLastWord.trim() : "";
|
|
26
|
+
const base = lastWord ? { lastWord } : {};
|
|
23
27
|
if (item.status === "running") return { status: "running" };
|
|
24
28
|
const wire = resultJson(item.detail.output);
|
|
25
29
|
if (wire && typeof wire.error === "string") return { status: item.status === "failed" ? "failed" : "completed", error: wire.error };
|
|
26
30
|
if (item.status === "failed") return { status: "failed", error: resultError(item.detail.output, item.error) };
|
|
27
|
-
if (wire && typeof wire.status === "string") return { status: "completed", outcome: wire.status };
|
|
31
|
+
if (wire && typeof wire.status === "string") return { status: "completed", outcome: wire.status, ...(wire.status === "rollover_requested" ? base : {}) };
|
|
28
32
|
return { status: "completed" };
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -15,25 +15,25 @@ type Styles = {
|
|
|
15
15
|
|
|
16
16
|
function markdownStyles(paper: PaperPalette): Styles {
|
|
17
17
|
return {
|
|
18
|
-
block: { gap:
|
|
19
|
-
text: { color: paper.ink, fontSize:
|
|
20
|
-
muted: { color: paper.inkMuted, fontSize:
|
|
21
|
-
strong: { fontWeight: "
|
|
18
|
+
block: { gap: 8 },
|
|
19
|
+
text: { color: paper.ink, fontSize: 12, lineHeight: 19 },
|
|
20
|
+
muted: { color: paper.inkMuted, fontSize: 12, lineHeight: 19 },
|
|
21
|
+
strong: { fontWeight: "600" },
|
|
22
22
|
em: { color: paper.inkMuted, fontStyle: "italic" },
|
|
23
23
|
del: { color: paper.inkMuted, textDecorationLine: "line-through" },
|
|
24
|
-
codespan: { fontFamily: MONO },
|
|
24
|
+
codespan: { fontFamily: MONO, fontSize: 12, backgroundColor: paper.crumpled },
|
|
25
25
|
link: { color: paper.added, textDecorationLine: "underline" },
|
|
26
|
-
heading: { fontWeight: "
|
|
27
|
-
quote: { borderLeftWidth: 2, borderLeftColor: paper.edge, paddingLeft:
|
|
28
|
-
quoteText: { color: paper.inkMuted, fontSize:
|
|
26
|
+
heading: { fontWeight: "600" },
|
|
27
|
+
quote: { borderLeftWidth: 2, borderLeftColor: paper.edge, paddingLeft: 10, gap: 4, marginTop: 4 },
|
|
28
|
+
quoteText: { color: paper.inkMuted, fontSize: 12, lineHeight: 19 },
|
|
29
29
|
code: {
|
|
30
|
-
fontFamily: MONO, fontSize:
|
|
30
|
+
fontFamily: MONO, fontSize: 12, lineHeight: 18, color: paper.ink,
|
|
31
31
|
backgroundColor: paper.crumpled, borderRadius: 3, paddingVertical: 6, paddingHorizontal: 8,
|
|
32
32
|
},
|
|
33
33
|
hr: { height: StyleSheet.hairlineWidth, backgroundColor: paper.edge },
|
|
34
|
-
list: { gap:
|
|
35
|
-
listItem: { flexDirection: "row"
|
|
36
|
-
marker: { color: paper.inkMuted, minWidth: 14 },
|
|
34
|
+
list: { gap: 8 },
|
|
35
|
+
listItem: { flexDirection: "row" },
|
|
36
|
+
marker: { color: paper.inkMuted, minWidth: 14, paddingRight: 4 },
|
|
37
37
|
table: { gap: 2 },
|
|
38
38
|
tableRow: { flexDirection: "row", gap: 8 },
|
|
39
39
|
tableCell: { flex: 1 },
|
|
@@ -93,7 +93,8 @@ function renderBlocks(tokens: Token[] | undefined, styles: Styles, keyPrefix: st
|
|
|
93
93
|
case "code":
|
|
94
94
|
return <Text key={key} selectable style={styles.code}>{token.text}</Text>;
|
|
95
95
|
case "heading":
|
|
96
|
-
return <Text key={key} selectable style={[textStyle, styles.heading
|
|
96
|
+
return <Text key={key} selectable style={[textStyle, styles.heading,
|
|
97
|
+
{ marginTop: index === 0 ? 2 : token.depth === 1 ? 2 : 6 }]}>{renderInlines(token.tokens, styles, key)}</Text>;
|
|
97
98
|
case "blockquote":
|
|
98
99
|
return <View key={key} style={styles.quote}>{renderBlocks(token.tokens, styles, key, styles.quoteText)}</View>;
|
|
99
100
|
case "list": {
|
|
@@ -50,11 +50,11 @@ export function NotesOpCard({ item, layout, theme }: PluginTimelineItemProps<Not
|
|
|
50
50
|
disabled={!hasBody}
|
|
51
51
|
style={({ pressed }) => ({ gap: 4, opacity: pressed && hasBody ? 0.7 : 1 })}
|
|
52
52
|
>
|
|
53
|
-
<View style={{ flexDirection: "row", alignItems: "center", gap: 8
|
|
54
|
-
<Text style={{ color: paper.inkMuted, fontSize:
|
|
53
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
54
|
+
<Text style={{ color: paper.inkMuted, fontSize: 12 }}>
|
|
55
55
|
{data.crumpled ? "crumpled" : title}{data.status === "running" ? " …" : ""}
|
|
56
56
|
</Text>
|
|
57
|
-
<Text numberOfLines={1} style={{ color: data.crumpled ? paper.inkMuted : paper.ink, fontSize:
|
|
57
|
+
<Text numberOfLines={1} style={{ color: data.crumpled ? paper.inkMuted : paper.ink, fontSize: 12, flex: 1, textDecorationLine: data.crumpled ? "line-through" : "none" }}>
|
|
58
58
|
{data.address}
|
|
59
59
|
</Text>
|
|
60
60
|
{hasBody && <Icon name={expanded ? "ChevronUp" : "ChevronDown"} size={16} color={paper.inkMuted} />}
|
|
@@ -67,14 +67,14 @@ export function NotesOpCard({ item, layout, theme }: PluginTimelineItemProps<Not
|
|
|
67
67
|
numberOfLines={2}
|
|
68
68
|
/>
|
|
69
69
|
)}
|
|
70
|
-
{data.error !== undefined && <Text selectable style={{ color: paper.removed, fontSize:
|
|
70
|
+
{data.error !== undefined && <Text selectable style={{ color: paper.removed, fontSize: 12, lineHeight: 18 }}>{data.error}</Text>}
|
|
71
71
|
</Pressable>
|
|
72
72
|
{expanded && hasBody && (
|
|
73
73
|
<ScrollView style={{ maxHeight: layout.compact ? 280 : 400, marginTop: 2, borderTopWidth: 1, borderTopColor: paper.edge }} contentContainerStyle={{ gap: 5, paddingTop: 8 }} nestedScrollEnabled>
|
|
74
74
|
{data.text !== undefined && <NoteMarkdown text={outputPreview(data.text)} paper={paper} />}
|
|
75
|
-
{data.preview !== undefined && <NoteMarkdown text={outputPreview(data.preview)} paper={paper}
|
|
75
|
+
{data.preview !== undefined && <NoteMarkdown text={outputPreview(data.preview)} paper={paper} />}
|
|
76
76
|
{data.diff !== undefined && <DiffBody diff={outputPreview(data.diff)} paper={paper} />}
|
|
77
|
-
{data.renamedFrom !== undefined && <Text style={{ color: paper.inkMuted, fontSize:
|
|
77
|
+
{data.renamedFrom !== undefined && <Text style={{ color: paper.inkMuted, fontSize: 12 }}>renamed from {data.renamedFrom}</Text>}
|
|
78
78
|
</ScrollView>
|
|
79
79
|
)}
|
|
80
80
|
</PaperCard>
|