notesoup 0.59.0 → 0.59.2
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/claude/src/helper.js +2 -2
- package/dist/plugins/dsh/tools.js +0 -3
- package/dist/src/boot/text.d.ts +1 -1
- package/dist/src/boot/text.js +6 -10
- package/dist/src/history/claude.d.ts +3 -1
- package/dist/src/history/claude.js +40 -4
- package/dist/src/history/prefilter.d.ts +1 -1
- package/dist/src/history/prefilter.js +14 -9
- package/dist/src/notes/address.d.ts +1 -1
- package/dist/src/notes/address.js +1 -1
- package/dist/src/notes/policy.js +1 -1
- package/dist/src/tools/dream.d.ts +3 -3
- package/dist/src/tools/dream.js +5 -5
- package/dist/src/tools/history.js +12 -13
- package/dist/src/tools/notes.d.ts +7 -5
- package/dist/src/tools/notes.js +35 -34
- package/dist/src/tools/result.js +2 -2
- package/dist/src/tools/schema.js +2 -2
- package/dist/test/claude-history.test.js +22 -0
- package/dist/test/claude-mod.test.js +13 -1
- package/dist/test/dsh.test.js +13 -1
- package/dist/test/history-prefilter.test.js +5 -0
- package/dist/test/note-policy.test.js +6 -1
- package/dist/test/notes.integration.test.js +28 -0
- package/docs/claude-code-mod.md +3 -1
- package/docs/history-sessions.md +1 -1
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +111 -81
- package/plugins/claude/hooks/register.ts +14 -10
- package/plugins/claude/src/helper.ts +2 -2
- package/plugins/codex/dist/codex/notesoup.js +74 -69
- package/plugins/dsh/tools.ts +0 -2
- package/plugins/paseo/README.md +16 -0
- package/plugins/paseo/client/brain-empty-card.tsx +5 -3
- package/plugins/paseo/client/markdown-core.tsx +189 -0
- package/plugins/paseo/client/markdown.tsx +38 -135
- package/plugins/paseo/client/notes-op-card.tsx +15 -12
- package/plugins/paseo/client/paper-card.tsx +1 -3
- package/plugins/paseo/client/sticky-card.tsx +2 -1
- package/plugins/paseo/client/typography.ts +24 -0
- package/plugins/paseo/test/markdown-core.test.ts +75 -0
- package/src/boot/text.ts +6 -10
- package/src/history/claude.ts +31 -4
- package/src/history/prefilter.ts +13 -9
- package/src/notes/address.ts +1 -1
- package/src/notes/policy.ts +1 -1
- package/src/tools/dream.ts +5 -5
- package/src/tools/history.ts +12 -14
- package/src/tools/notes.ts +35 -33
- package/src/tools/result.ts +2 -2
- package/src/tools/schema.ts +2 -2
|
@@ -24990,7 +24990,7 @@ function filteredItems(projection, params) {
|
|
|
24990
24990
|
|
|
24991
24991
|
// src/tools/schema.ts
|
|
24992
24992
|
var nullableString = (description) => typebox_exports.Optional(typebox_exports.Union([typebox_exports.String(), typebox_exports.Null()], description === void 0 ? {} : { description }));
|
|
24993
|
-
var historyRoles = () => typebox_exports.Optional(typebox_exports.Array(HistoryRoleSchema, { minItems: 1, description: "
|
|
24993
|
+
var historyRoles = () => typebox_exports.Optional(typebox_exports.Array(HistoryRoleSchema, { minItems: 1, description: "Only these voices: user, assistant, tool, context. Without roles or query, tool and context runs fold into one line." }));
|
|
24994
24994
|
function paramProblem(schema, params) {
|
|
24995
24995
|
const first = Errors2(schema, params).find((error2) => error2.keyword !== "boolean");
|
|
24996
24996
|
if (!first) return "unrecognized shape";
|
|
@@ -24998,7 +24998,7 @@ function paramProblem(schema, params) {
|
|
|
24998
24998
|
const field = first.instancePath.replace(/^\//, "").replaceAll("/", ".");
|
|
24999
24999
|
return `${field ? `${field} ` : ""}${first.message}${extra}`;
|
|
25000
25000
|
}
|
|
25001
|
-
var searchQuery = (description = "
|
|
25001
|
+
var searchQuery = (description = "Text to look for, or a list (any match). Leave it out to just list the pages.") => typebox_exports.Union([typebox_exports.String(), typebox_exports.Array(typebox_exports.String())], { description });
|
|
25002
25002
|
|
|
25003
25003
|
// src/notes/errors.ts
|
|
25004
25004
|
var NoteError = class extends Error {
|
|
@@ -25065,7 +25065,7 @@ function physicalPath(scope, vpath, identity, who) {
|
|
|
25065
25065
|
}
|
|
25066
25066
|
|
|
25067
25067
|
// src/notes/address.ts
|
|
25068
|
-
var ADDRESS_FORMS = "Use <path> for this session, or @project/, @human/, @self/, or @model/ followed by a path; @projects/<name>/<path
|
|
25068
|
+
var ADDRESS_FORMS = "Use <path> for this session, or @project/, @human/, @self/, or @model/ followed by a path; @projects/<name>/<path>, @sessions/<id>/<path>, @agents/<name>/<path>, and @models/<name>/<path> read named notebooks.";
|
|
25069
25069
|
var NAMESPACE_HEADS = /* @__PURE__ */ new Map([
|
|
25070
25070
|
["project", { scope: "project" }],
|
|
25071
25071
|
["human", { scope: "human" }],
|
|
@@ -25166,7 +25166,7 @@ function pinnedPageOrder(path) {
|
|
|
25166
25166
|
}
|
|
25167
25167
|
function noteBudgetWarnings(body, policy) {
|
|
25168
25168
|
const count = Array.from(body).length;
|
|
25169
|
-
return count > policy.budget ? [`Warning: note body is ${count} Unicode code points, over budget ${policy.budget}
|
|
25169
|
+
return count > policy.budget ? [`Warning: note body is ${count} Unicode code points, over budget ${policy.budget} \u2014 boil it down.`] : [];
|
|
25170
25170
|
}
|
|
25171
25171
|
function assertNoteUnlocked(fields, unlock) {
|
|
25172
25172
|
if (fields.readonly === true && unlock !== false) throw new NoteError("readonly", "This note has a soft readonly lock; explicitly set readonly:false to unlock before changing it (or in the same call).");
|
|
@@ -26083,8 +26083,8 @@ var TextWindowSchema = typebox_exports.Object({
|
|
|
26083
26083
|
next_offset_chars: typebox_exports.Union([typebox_exports.Integer({ minimum: 0 }), typebox_exports.Null()], { description: "Pass as `offset_chars` to continue; null at the end." })
|
|
26084
26084
|
}, { additionalProperties: false });
|
|
26085
26085
|
var TextWindowRequestSchema = {
|
|
26086
|
-
offset_chars: typebox_exports.Optional(typebox_exports.Integer({ description: "
|
|
26087
|
-
max_chars: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description:
|
|
26086
|
+
offset_chars: typebox_exports.Optional(typebox_exports.Integer({ description: "Where on the page to start reading; negative counts from the end." })),
|
|
26087
|
+
max_chars: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description: "How much to read at once." }))
|
|
26088
26088
|
};
|
|
26089
26089
|
function readTextWindow(text2, offset, limit, makeData, render) {
|
|
26090
26090
|
const chars = Array.from(text2);
|
|
@@ -26138,12 +26138,12 @@ function notesIdentityForCall(context2, cwd) {
|
|
|
26138
26138
|
// src/tools/notes.ts
|
|
26139
26139
|
var ORIGIN_VALUES = [typebox_exports.Literal("user"), typebox_exports.Literal("self"), typebox_exports.Literal("external")];
|
|
26140
26140
|
var ORIGIN = typebox_exports.Optional(typebox_exports.Union([...ORIGIN_VALUES], {
|
|
26141
|
-
description: "
|
|
26141
|
+
description: "Whose handwriting: user, self, or external. Leave it out to keep what's there."
|
|
26142
26142
|
}));
|
|
26143
26143
|
var POLICY_PARAMETERS = {
|
|
26144
|
-
pinned: typebox_exports.Optional(typebox_exports.Boolean({ description: "
|
|
26145
|
-
budget: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER, description: "
|
|
26146
|
-
readonly: typebox_exports.Optional(typebox_exports.Boolean({ description: "
|
|
26144
|
+
pinned: typebox_exports.Optional(typebox_exports.Boolean({ description: "Tape the page inside the cover: read whole at every wake-up. Five per notebook, CHEATSHEET and MAP included." })),
|
|
26145
|
+
budget: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER, description: "How much paper the page gets. Writing past it still saves, with a warning. A page over budget gets boiled down: stale lines out, repeats merged, the rest said shorter. More paper is for a page already boiled down that still needs the room." })),
|
|
26146
|
+
readonly: typebox_exports.Optional(typebox_exports.Boolean({ description: "A paperclip that keeps your own hands off. `false` takes it off \u2014 same call is fine." }))
|
|
26147
26147
|
};
|
|
26148
26148
|
var PolicySchema = {
|
|
26149
26149
|
pinned: typebox_exports.Boolean(),
|
|
@@ -26160,13 +26160,12 @@ function renderPolicy(policy) {
|
|
|
26160
26160
|
function withWarnings(text2, data) {
|
|
26161
26161
|
return [text2, ...data.warnings].join("\n");
|
|
26162
26162
|
}
|
|
26163
|
-
var CRUMPLED_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "
|
|
26164
|
-
var CRUMPLED_LIST_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "
|
|
26165
|
-
var FILE_LIMIT_PARAMETER = typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "
|
|
26166
|
-
var GLOB_PARAMETER = nullableString("
|
|
26167
|
-
var CWD_PARAMETER = typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "
|
|
26168
|
-
var
|
|
26169
|
-
var ADDRESS_DESCRIPTION = "Addresses: a bare path is this session's note; `@project/`, `@human/`, `@self/`, `@model/` are durable notebooks; `@projects/<name>/<path>` and `@sessions/<id>/<path>` read named project and session notes (read-only). Not file paths: never pass them to file tools.";
|
|
26163
|
+
var CRUMPLED_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "`true` balls the page up: gone from list and search, still readable. `false` smooths it flat again." }));
|
|
26164
|
+
var CRUMPLED_LIST_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "Only the crumpled balls." }));
|
|
26165
|
+
var FILE_LIMIT_PARAMETER = typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "How many pages at most." }));
|
|
26166
|
+
var GLOB_PARAMETER = nullableString("Which drawers to open. Leave it out for this session and your current notebooks. `@project/**` one shelf \xB7 `MAP.md` that page in every notebook \xB7 `**` everything \xB7 `@sessions/*/**` every session.");
|
|
26167
|
+
var CWD_PARAMETER = typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Treat this directory's project as `@project/`." }));
|
|
26168
|
+
var ADDRESS_PARAMETER = typebox_exports.String({ description: "Which drawer the page sits in. `plan.md` \u2014 this session's desk, cleared when it ends. `@project/` this project's shelf \xB7 `@human/` your human's file \xB7 `@self/` your own notebook \xB7 `@model/` your brain's. `@projects/<name>/`, `@sessions/<id>/`, `@agents/<name>/`, `@models/<name>/` \u2014 someone else's shelf: read only. Paper, not files: hand one to read/write/edit/bash and a real `@project` folder is born." });
|
|
26170
26169
|
function failureOf(error2) {
|
|
26171
26170
|
if (error2 instanceof NoteError) return failure2(error2.code, error2.message);
|
|
26172
26171
|
if (error2 instanceof InvalidQueryError) return failure2("invalid_query", error2.message);
|
|
@@ -26256,7 +26255,8 @@ var MatchSchema = typebox_exports.Object({
|
|
|
26256
26255
|
}, { additionalProperties: false });
|
|
26257
26256
|
var SearchedFileSchema = typebox_exports.Object({
|
|
26258
26257
|
...ListedFileSchema.properties,
|
|
26259
|
-
matches: typebox_exports.Array(MatchSchema)
|
|
26258
|
+
matches: typebox_exports.Array(MatchSchema),
|
|
26259
|
+
more_matches: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1 }))
|
|
26260
26260
|
}, { additionalProperties: false });
|
|
26261
26261
|
var SnapshotSchema = {
|
|
26262
26262
|
more: typebox_exports.Integer({ description: "How many more were left out." }),
|
|
@@ -26313,14 +26313,14 @@ function listedFile(row, identity) {
|
|
|
26313
26313
|
const policy = policyAt(row.meta, row.address);
|
|
26314
26314
|
return { ...noteIdentity(identity, row.address), ...policy, warnings: row.warnings ?? (row.body === void 0 ? [] : noteBudgetWarnings(row.body, policy)), updated_at: localIso(row.meta.updatedAt), ...row.meta.crumpledAt === void 0 ? {} : { crumpled_at: row.meta.crumpledAt } };
|
|
26315
26315
|
}
|
|
26316
|
-
var notesWriteParameters = typebox_exports.Object({ address:
|
|
26316
|
+
var notesWriteParameters = typebox_exports.Object({ address: ADDRESS_PARAMETER, content: typebox_exports.String({ description: "The whole page." }), origin: ORIGIN, ...POLICY_PARAMETERS, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
26317
26317
|
function renderWriteData(data) {
|
|
26318
26318
|
return withWarnings(`${data.outcome} ${renderIdentity(data)} | ${renderPolicy(data)}`, data);
|
|
26319
26319
|
}
|
|
26320
26320
|
var notesWrite = {
|
|
26321
26321
|
name: "notes_write",
|
|
26322
26322
|
label: "Notes write",
|
|
26323
|
-
description:
|
|
26323
|
+
description: "Take a fresh page and write it \u2014 or rip out the old one and write it again. Title it for what's inside and when you'll reach for it.",
|
|
26324
26324
|
parameters: notesWriteParameters,
|
|
26325
26325
|
outputSchema: resultSchema(NotesWriteDataSchema),
|
|
26326
26326
|
executionMode: "sequential",
|
|
@@ -26336,13 +26336,13 @@ var notesWrite = {
|
|
|
26336
26336
|
render: (result) => renderOutcome(result, renderWriteData)
|
|
26337
26337
|
};
|
|
26338
26338
|
var notesUpdateParameters = typebox_exports.Object({
|
|
26339
|
-
address:
|
|
26340
|
-
edits: typebox_exports.Optional(typebox_exports.Array(typebox_exports.Object({ oldText: typebox_exports.String(), newText: typebox_exports.String() }, { additionalProperties: false }))),
|
|
26339
|
+
address: ADDRESS_PARAMETER,
|
|
26340
|
+
edits: typebox_exports.Optional(typebox_exports.Array(typebox_exports.Object({ oldText: typebox_exports.String({ description: "The passage as it stands on the page." }), newText: typebox_exports.String({ description: "What goes in its place." }) }, { additionalProperties: false }), { description: "Pen strokes, in order. Each `oldText` is the exact passage \u2014 same case, found once \u2014 and `newText` is what goes in its place." })),
|
|
26341
26341
|
origin: ORIGIN,
|
|
26342
26342
|
...POLICY_PARAMETERS,
|
|
26343
26343
|
crumpled: CRUMPLED_PARAMETER,
|
|
26344
|
-
replace_all: typebox_exports.Optional(typebox_exports.Boolean({ description: "
|
|
26345
|
-
rename_to: typebox_exports.Optional(typebox_exports.String({ description: "
|
|
26344
|
+
replace_all: typebox_exports.Optional(typebox_exports.Boolean({ description: "Strike every copy of `oldText`, not just one." })),
|
|
26345
|
+
rename_to: typebox_exports.Optional(typebox_exports.String({ description: "Move the page to another address. Never lands on top of a live page; nothing pointing at it follows." })),
|
|
26346
26346
|
cwd: CWD_PARAMETER
|
|
26347
26347
|
}, { additionalProperties: false });
|
|
26348
26348
|
function renderUpdateData(data) {
|
|
@@ -26352,7 +26352,7 @@ function renderUpdateData(data) {
|
|
|
26352
26352
|
var notesUpdate = {
|
|
26353
26353
|
name: "notes_update",
|
|
26354
26354
|
label: "Notes update",
|
|
26355
|
-
description:
|
|
26355
|
+
description: "Work on a page you already have: cross out and rewrite lines, move it, pin it, lock it, give it more paper, crumple it. Keep every page true to now: wrong, stale, or no-longer-mattering lines get rewritten or struck where they stand. The page stays one page.",
|
|
26356
26356
|
parameters: notesUpdateParameters,
|
|
26357
26357
|
outputSchema: resultSchema(NotesUpdateDataSchema),
|
|
26358
26358
|
executionMode: "sequential",
|
|
@@ -26372,7 +26372,7 @@ var notesUpdate = {
|
|
|
26372
26372
|
},
|
|
26373
26373
|
render: (result) => renderOutcome(result, renderUpdateData)
|
|
26374
26374
|
};
|
|
26375
|
-
var notesReadParameters = typebox_exports.Object({ address:
|
|
26375
|
+
var notesReadParameters = typebox_exports.Object({ address: ADDRESS_PARAMETER, ...TextWindowRequestSchema, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
26376
26376
|
function renderReadData(data) {
|
|
26377
26377
|
return withWarnings(`${renderIdentity(data)}
|
|
26378
26378
|
${renderMetadata(data.metadata)}`, data) + `
|
|
@@ -26382,7 +26382,7 @@ ${renderTextWindow(data)}`;
|
|
|
26382
26382
|
var notesRead = {
|
|
26383
26383
|
name: "notes_read",
|
|
26384
26384
|
label: "Notes read",
|
|
26385
|
-
description:
|
|
26385
|
+
description: "Read a page. Long ones come a stretch at a time; follow `next_offset_chars`.",
|
|
26386
26386
|
parameters: notesReadParameters,
|
|
26387
26387
|
outputSchema: resultSchema(NotesReadDataSchema),
|
|
26388
26388
|
async execute(params, context2) {
|
|
@@ -26416,7 +26416,7 @@ function renderListData(data) {
|
|
|
26416
26416
|
var notesList = {
|
|
26417
26417
|
name: "notes_list",
|
|
26418
26418
|
label: "Notes list",
|
|
26419
|
-
description:
|
|
26419
|
+
description: "Leaf through the drawers, newest pages on top. One pass; `more` counts pages left on the pile \u2014 narrow `glob`.",
|
|
26420
26420
|
parameters: notesListParameters,
|
|
26421
26421
|
outputSchema: resultSchema(NotesListDataSchema),
|
|
26422
26422
|
async execute(params, context2) {
|
|
@@ -26430,11 +26430,11 @@ var notesList = {
|
|
|
26430
26430
|
},
|
|
26431
26431
|
render: (result) => renderOutcome(result, renderListData)
|
|
26432
26432
|
};
|
|
26433
|
-
var notesSearchParameters = typebox_exports.Object({ query: typebox_exports.Optional(searchQuery()), glob: GLOB_PARAMETER, limit: FILE_LIMIT_PARAMETER, max_matches_per_file: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "
|
|
26433
|
+
var notesSearchParameters = typebox_exports.Object({ query: typebox_exports.Optional(searchQuery()), glob: GLOB_PARAMETER, limit: FILE_LIMIT_PARAMETER, max_matches_per_file: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "How many hit lines per page at most." })), crumpled: CRUMPLED_LIST_PARAMETER, cwd: CWD_PARAMETER }, { additionalProperties: false });
|
|
26434
26434
|
function renderSearchData(data) {
|
|
26435
26435
|
const lines = [`${data.files.length} ${data.files.length === 1 ? "note" : "notes"}`];
|
|
26436
26436
|
for (const file of data.files) {
|
|
26437
|
-
lines.push(`- ${renderIdentity(file)} | ${renderPolicy(file)} | updated ${file.updated_at} | ${file.matches.length} ${file.matches.length === 1 ? "match" : "matches"}`);
|
|
26437
|
+
lines.push(`- ${renderIdentity(file)} | ${renderPolicy(file)} | updated ${file.updated_at} | ${file.matches.length} ${file.matches.length === 1 ? "match" : "matches"}${file.more_matches ? `, ${file.more_matches} more lines` : ""}`);
|
|
26438
26438
|
lines.push(...file.warnings.map((warning) => ` ${warning}`));
|
|
26439
26439
|
for (const match of file.matches) lines.push(` line ${match.line} at offset_chars ${match.offset_chars}: ${match.text}`);
|
|
26440
26440
|
}
|
|
@@ -26442,35 +26442,38 @@ function renderSearchData(data) {
|
|
|
26442
26442
|
for (const namespace of data.namespaces_unavailable) lines.push(`${namespace} could not be read`);
|
|
26443
26443
|
return lines.join("\n");
|
|
26444
26444
|
}
|
|
26445
|
+
function keepMatches(file, count = file.matches.length) {
|
|
26446
|
+
const more = (file.more_matches ?? 0) + Math.max(0, file.matches.length - count);
|
|
26447
|
+
return { ...file, matches: file.matches.slice(0, count), ...more ? { more_matches: more } : {} };
|
|
26448
|
+
}
|
|
26445
26449
|
var MATCH_SHORTENED_MARKER = " [truncated]";
|
|
26446
26450
|
function fitSearchFile(file, fits) {
|
|
26447
26451
|
let low = 0;
|
|
26448
26452
|
let high = file.matches.length;
|
|
26449
26453
|
while (low < high) {
|
|
26450
26454
|
const mid = Math.ceil((low + high) / 2);
|
|
26451
|
-
if (fits(
|
|
26455
|
+
if (fits(keepMatches(file, mid))) low = mid;
|
|
26452
26456
|
else high = mid - 1;
|
|
26453
26457
|
}
|
|
26454
|
-
if (low > 0
|
|
26458
|
+
if (low > 0 || file.matches.length === 0) return keepMatches(file, low);
|
|
26455
26459
|
const first = file.matches[0];
|
|
26456
|
-
|
|
26457
|
-
const withText = (text2) => ({ ...file, matches: [{ ...first, text: `${text2}${MATCH_SHORTENED_MARKER}` }] });
|
|
26460
|
+
const withText = (text2) => ({ ...keepMatches(file, 1), matches: [{ ...first, text: `${text2}${MATCH_SHORTENED_MARKER}` }] });
|
|
26458
26461
|
return withText(prefixFit(first.text, (text2) => fits(withText(text2))));
|
|
26459
26462
|
}
|
|
26460
26463
|
var notesSearch = {
|
|
26461
26464
|
name: "notes_search",
|
|
26462
26465
|
label: "Notes search",
|
|
26463
|
-
description:
|
|
26466
|
+
description: "Run a finger down every page for some text, case doesn't matter. Returns the lines it hits and where they sit; no query just lists the pages. One pass; `more` counts pages left on the pile \u2014 narrow `glob`.",
|
|
26464
26467
|
parameters: notesSearchParameters,
|
|
26465
26468
|
outputSchema: resultSchema(NotesSearchDataSchema),
|
|
26466
26469
|
async execute(params, context2) {
|
|
26467
26470
|
try {
|
|
26468
26471
|
const identity = notesIdentityForCall(context2, params.cwd);
|
|
26469
26472
|
const { rows, status } = await createNotesStore(identity).searchWithStatus(searchQueries(params.query), { glob: params.glob ?? void 0, crumpled: params.crumpled });
|
|
26470
|
-
const files = rows.sort((a, b) => b.meta.updatedAt - a.meta.updatedAt || a.address.localeCompare(b.address)).map((row) => ({
|
|
26473
|
+
const files = rows.sort((a, b) => b.meta.updatedAt - a.meta.updatedAt || a.address.localeCompare(b.address)).map((row) => keepMatches({
|
|
26471
26474
|
...listedFile(row, identity),
|
|
26472
|
-
matches: row.matches.
|
|
26473
|
-
}));
|
|
26475
|
+
matches: row.matches.map((match) => ({ line: match.line, text: match.text, offset_chars: match.offsetChars }))
|
|
26476
|
+
}, params.max_matches_per_file));
|
|
26474
26477
|
return snapshot(files, params.limit, status, renderSearchData, fitSearchFile);
|
|
26475
26478
|
} catch (error2) {
|
|
26476
26479
|
return failureOf(error2);
|
|
@@ -26805,23 +26808,22 @@ function pageOutcome(result) {
|
|
|
26805
26808
|
const narrow = multi ? "narrow the session pattern, query, roles or `since`/`until`, or read one session/seq with `history_read`" : "narrow with `before_seq`/`after_seq` or `since`/`until`, pass `roles` to skip folding, or `history_read` one seq";
|
|
26806
26809
|
return failure2("page_too_large", `Even trimmed to their shortest, these ${count} rows${multi ? "" : " and their folded runs"} fill the ${TOOL_OUTPUT_LIMIT} a call can carry; ${narrow}.`);
|
|
26807
26810
|
}
|
|
26808
|
-
var sessionParameter = typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "(optional) Session ID or unique prefix, optionally pi:, claude:, codex:, or dsh:. Omit for this session. In history_list, * searches sessions with query or lists recent sessions without it; history_read needs one session." }));
|
|
26809
26811
|
var historyListParameters = typebox_exports.Object({
|
|
26810
|
-
session:
|
|
26811
|
-
query: typebox_exports.Optional(searchQuery("
|
|
26812
|
+
session: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Whose record: a session ID or prefix (pi:, claude:, codex:, dsh: allowed). Leave it out for this one. `*` means every recent session." })),
|
|
26813
|
+
query: typebox_exports.Optional(searchQuery("Text to look for, or a list (any match). Searches what was said, tool arguments and output.")),
|
|
26812
26814
|
roles: historyRoles(),
|
|
26813
|
-
before_seq: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "
|
|
26814
|
-
after_seq: typebox_exports.Optional(typebox_exports.Integer({ minimum: 0, description: "
|
|
26815
|
-
since: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "
|
|
26816
|
-
until: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "
|
|
26817
|
-
from: typebox_exports.Optional(typebox_exports.Union([typebox_exports.Literal("newest"), typebox_exports.Literal("oldest")], { description: "
|
|
26818
|
-
limit: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: 500, description: "
|
|
26819
|
-
max_chars_per_item: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description:
|
|
26815
|
+
before_seq: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "Only entries before this seq." })),
|
|
26816
|
+
after_seq: typebox_exports.Optional(typebox_exports.Integer({ minimum: 0, description: "Only entries after this seq; 0 starts from the first page." })),
|
|
26817
|
+
since: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Only entries at or after this time (ISO 8601; UTC without an offset)." })),
|
|
26818
|
+
until: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Only entries before this time (ISO 8601; UTC without an offset)." })),
|
|
26819
|
+
from: typebox_exports.Optional(typebox_exports.Union([typebox_exports.Literal("newest"), typebox_exports.Literal("oldest")], { description: "Which end `limit` counts from: newest or oldest. Entries still read oldest first." })),
|
|
26820
|
+
limit: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: 500, description: "How many entries per page; folded runs don't count." })),
|
|
26821
|
+
max_chars_per_item: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: MAX_READ_WINDOW_CHARS, description: "How much of each entry to show." }))
|
|
26820
26822
|
}, { additionalProperties: false });
|
|
26821
26823
|
var historyList = {
|
|
26822
26824
|
name: "history_list",
|
|
26823
26825
|
label: "History list items",
|
|
26824
|
-
description: "
|
|
26826
|
+
description: "Flip back through the record, a page at a time. Another session: its ID. `*` pulls every recent session off the shelf; add `query` to search them.",
|
|
26825
26827
|
parameters: historyListParameters,
|
|
26826
26828
|
outputSchema: resultSchema(HistoryPageSchema),
|
|
26827
26829
|
async execute(params, context2, wrapText = plainText) {
|
|
@@ -26869,11 +26871,11 @@ var historyList = {
|
|
|
26869
26871
|
},
|
|
26870
26872
|
render: (result) => renderOutcome(result, renderPage)
|
|
26871
26873
|
};
|
|
26872
|
-
var historyReadParameters = typebox_exports.Object({ session:
|
|
26874
|
+
var historyReadParameters = typebox_exports.Object({ session: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Whose record: a session ID or prefix. Leave it out for this one." })), seq: typebox_exports.Integer({ minimum: 1, description: "Which entry, by its seq from `history_list`; bring its session along if it had one." }), ...TextWindowRequestSchema }, { additionalProperties: false });
|
|
26873
26875
|
var historyRead = {
|
|
26874
26876
|
name: "history_read",
|
|
26875
26877
|
label: "History read item",
|
|
26876
|
-
description: "
|
|
26878
|
+
description: "Open one entry: what was called, what came back, the calls nested inside. Long entries come in slices; follow `next_offset_chars`.",
|
|
26877
26879
|
parameters: historyReadParameters,
|
|
26878
26880
|
outputSchema: resultSchema(HistoryReadDataSchema),
|
|
26879
26881
|
async execute(params, context2, wrapText = plainText) {
|
|
@@ -27682,6 +27684,11 @@ function piHistoryFromJsonl(text2, sessionId) {
|
|
|
27682
27684
|
|
|
27683
27685
|
// src/history/claude.ts
|
|
27684
27686
|
import { isDeepStrictEqual } from "node:util";
|
|
27687
|
+
var UnpersistedClaudeHead = class extends Error {
|
|
27688
|
+
constructor() {
|
|
27689
|
+
super("Claude history active head is not persisted yet; retry after the transcript write");
|
|
27690
|
+
}
|
|
27691
|
+
};
|
|
27685
27692
|
var MESSAGE_TYPES = /* @__PURE__ */ new Set(["user", "assistant", "system", "attachment"]);
|
|
27686
27693
|
var NON_TEXT_BLOCKS = /* @__PURE__ */ new Set(["thinking", "redacted_thinking", "image", "document", "audio", "video", "server_tool_use", "web_search_tool_result", "tool_reference"]);
|
|
27687
27694
|
function object3(value) {
|
|
@@ -27824,7 +27831,7 @@ function claudeHistoryFromRows(rows, source) {
|
|
|
27824
27831
|
return version2.position;
|
|
27825
27832
|
}
|
|
27826
27833
|
if (!source.headUuid) throw new Error("Claude history has no confirmed active head yet; wait for a main-session append after startup/resume");
|
|
27827
|
-
if (!nodes.has(source.headUuid)) throw new
|
|
27834
|
+
if (!nodes.has(source.headUuid)) throw new UnpersistedClaudeHead();
|
|
27828
27835
|
const selected = /* @__PURE__ */ new Set(), visited = /* @__PURE__ */ new Set(), visiting = /* @__PURE__ */ new Set();
|
|
27829
27836
|
const stack = [{ uuid: source.headUuid, historical: false }];
|
|
27830
27837
|
while (stack.length > 0) {
|
|
@@ -27957,7 +27964,7 @@ function createHistoryPrefilter(queries) {
|
|
|
27957
27964
|
}).filter((literal2) => !literal2.test(PRESENTATION));
|
|
27958
27965
|
}));
|
|
27959
27966
|
const fallback = !alternatives.length || alternatives.some((tokens) => tokens.length === 0);
|
|
27960
|
-
return async (chunks, codex = false) => {
|
|
27967
|
+
return async (chunks, codex = false, stopOnHit = false) => {
|
|
27961
27968
|
const decoder = new StringDecoder("utf8");
|
|
27962
27969
|
const seen = alternatives.map((tokens) => tokens.map(() => false));
|
|
27963
27970
|
let rawTail = "", normalizedTail = "", pending = "", possible = fallback;
|
|
@@ -27985,17 +27992,19 @@ function createHistoryPrefilter(queries) {
|
|
|
27985
27992
|
rawTail = raw.slice(-overlap);
|
|
27986
27993
|
normalizedTail = normalized.slice(-overlap);
|
|
27987
27994
|
};
|
|
27988
|
-
for await (const chunk of chunks)
|
|
27995
|
+
for await (const chunk of chunks) {
|
|
27996
|
+
if (!possible) scan(decoder.write(chunk));
|
|
27997
|
+
if (possible && stopOnHit) return true;
|
|
27998
|
+
}
|
|
27989
27999
|
if (!possible) scan(decoder.end(), true);
|
|
27990
28000
|
return possible;
|
|
27991
28001
|
};
|
|
27992
28002
|
}
|
|
27993
28003
|
async function historyFileMayMatch(path, prefilter, codex = false, maxBytes = codex ? CODEX_TRANSCRIPT_MAX_BYTES : Infinity) {
|
|
27994
|
-
if (codex)
|
|
27995
|
-
|
|
27996
|
-
|
|
27997
|
-
|
|
27998
|
-
const compressed = codex && path.endsWith(".jsonl.zst");
|
|
28004
|
+
if (!codex) return prefilter(createReadStream(path), false, true);
|
|
28005
|
+
const info = await stat2(path);
|
|
28006
|
+
if (!info.isFile() || info.size > maxBytes) throw new Error("Unavailable Codex transcript: read size limit exceeded or not a regular file");
|
|
28007
|
+
const compressed = path.endsWith(".jsonl.zst");
|
|
27999
28008
|
if (compressed && typeof zlib2.createZstdDecompress !== "function") throw new Error("Compressed Codex rollouts require Node >=22.15 (createZstdDecompress)");
|
|
28000
28009
|
const input = createReadStream(path);
|
|
28001
28010
|
const consume = async (chunks) => {
|
|
@@ -28258,7 +28267,7 @@ While you're doing that... thing you're doing, don't make the poor future you gu
|
|
|
28258
28267
|
|
|
28259
28268
|
Notes are for what's true NOW. Not a diary of every dumb thing you did on the way here.
|
|
28260
28269
|
*flips a page* "First I tried this, then that broke, then\u2014" Nobody reads that!
|
|
28261
|
-
|
|
28270
|
+
When a line goes wrong, stale, or beside the point \u2014 cross it out! Write what's true now, and never pile updates onto the bottom!
|
|
28262
28271
|
*rolls eyes* ...Ugh, fine. If a piece of history *actually* matters \u2014 like why Plan A blew up so tomorrow's you doesn't try it again \u2014 I'll let it slide. Keep the short version! A few lines, max! *squints at you* Turn it into a blow-by-blow log and you're dead.
|
|
28263
28272
|
|
|
28264
28273
|
\`get_context_remaining\` tells you how much room is left. Check it before you do something ambitious. When it reaches zero, your brain gets reset immediately, taking every unwritten brilliant idea with it. ${PROTOCOL_WIPE_SENTENCE}
|
|
@@ -28270,8 +28279,7 @@ An address decides who the note belongs to \u2014 and how long it is meant to la
|
|
|
28270
28279
|
- \`@human/<path>\` \u2014 the long-term manual for your troublesome human, and only what stays true in EVERY project: how to deal with them, which lines not to cross, and what will make them accept the result. "The human said it" is not enough \u2014 if it stops being true the moment you switch projects, it was never theirs; it belongs to that project's notes. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
|
|
28271
28280
|
${PROTOCOL_SELF_NAMELESS}
|
|
28272
28281
|
- \`@model/<path>\` \u2014 different brains get different notes: big brains, small brains, careful ones, careless ones. They don't share homework. When a fallback swaps brains mid-window, the notebook swaps too.
|
|
28273
|
-
- \`@projects/<name>/<path>\` \u2014
|
|
28274
|
-
- \`@sessions/<id>/<path>\` \u2014 read-only notes from a named session; find them with glob \`@sessions/*/**\`.
|
|
28282
|
+
- \`@projects/<name>/<path>\`, \`@sessions/<id>/<path>\`, \`@agents/<name>/<path>\`, \`@models/<name>/<path>\` \u2014 someone else's shelf, by name. Look, don't touch; \`notes_list\` with a glob like \`@projects/*/**\` shows what's there.
|
|
28275
28283
|
|
|
28276
28284
|
Notes fighting?! HAH! Let them brawl!
|
|
28277
28285
|
Whichever one is actually about what you're doing wins.
|
|
@@ -28284,12 +28292,9 @@ Every notebook's root has two default pins: \`CHEATSHEET.md\` and \`MAP.md\`.
|
|
|
28284
28292
|
Pinned pages get jammed straight into your brain the moment you wake up. Whoever wakes up next
|
|
28285
28293
|
reads them, and next is you. So keep them short, and keep them true.
|
|
28286
28294
|
|
|
28287
|
-
|
|
28288
|
-
|
|
28289
|
-
|
|
28290
|
-
change one. Going over warns but saves, and pinned bodies arrive whole, not cut short.
|
|
28291
|
-
\`readonly:true\` is a soft lock, not security; explicitly set \`readonly:false\` to unlock,
|
|
28292
|
-
on its own or with your changes.
|
|
28295
|
+
Up to five pages per notebook can be taped inside the cover, these two included. Every page gets
|
|
28296
|
+
a paper budget; when a page outgrows it, boil it down \u2014 stale lines out, repeats merged, the rest
|
|
28297
|
+
said shorter \u2014 instead of giving it more paper.
|
|
28293
28298
|
|
|
28294
28299
|
- **\`CHEATSHEET.md\`** holds what you'll want next time \u2014 a rule, a warning, a grudge, a name,
|
|
28295
28300
|
a phone number you'll regret losing. Nobody grades it. Keep it to five lines, or it grows fat
|
|
@@ -28300,7 +28305,7 @@ on its own or with your changes.
|
|
|
28300
28305
|
|
|
28301
28306
|
Each notebook keeps its own: \`@project\`, \`@human\`, \`@self\`, \`@model\`. Missing pages are skipped;
|
|
28302
28307
|
no need to create empty ones. New note, new MAP line. New rule worth remembering, new Cheatsheet
|
|
28303
|
-
line. And when a line
|
|
28308
|
+
line. And when a line goes wrong, stale, or useless, kill it \u2014 tomorrow's you reads that page as fact.
|
|
28304
28309
|
</notesoup:maps>`;
|
|
28305
28310
|
var DEFAULT_BOOT_TOOL_NAMES = {
|
|
28306
28311
|
notes: "notes_*",
|
package/plugins/dsh/tools.ts
CHANGED
|
@@ -19,8 +19,6 @@ function hostSchema(schema: TSchema): JsonSchemaNode {
|
|
|
19
19
|
const value = JSON.parse(JSON.stringify(schema)) as Record<string, unknown>;
|
|
20
20
|
const result: Record<string, unknown> = {};
|
|
21
21
|
for (const key of ["type", "required", "additionalProperties", "enum", "const", "description", "title", "default", "examples"]) if (value[key] !== undefined) result[key] = value[key];
|
|
22
|
-
const bounds = ["minimum", "maximum", "minLength", "maxLength", "minItems", "maxItems"].filter((key) => value[key] !== undefined).map((key) => `${key}=${value[key]}`);
|
|
23
|
-
if (bounds.length) result.description = [value.description, bounds.join(", ")].filter(Boolean).join("; ");
|
|
24
22
|
if (Array.isArray(value.anyOf)) result.oneOf = value.anyOf.map((branch) => hostSchema(branch as TSchema));
|
|
25
23
|
if (value.properties) result.properties = Object.fromEntries(Object.entries(value.properties as Record<string, TSchema>).map(([key, child]) => [key, hostSchema(child)]));
|
|
26
24
|
if (value.items) result.items = hostSchema(value.items as TSchema);
|
package/plugins/paseo/README.md
CHANGED
|
@@ -10,3 +10,19 @@ npm test
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Install this directory with `paseo plugin install /absolute/path/to/plugins/paseo`. Source changes require `paseo plugin reload notesoup`; no daemon restart is needed.
|
|
13
|
+
|
|
14
|
+
## Markdown maintenance
|
|
15
|
+
|
|
16
|
+
`client/markdown-core.tsx` and `test/markdown-core.test.ts` are manually mirrored,
|
|
17
|
+
byte-for-byte, between the Square and pi-context (notesoup) repositories at
|
|
18
|
+
`plugins/paseo/`. No shared package or cross-repository runtime import is needed.
|
|
19
|
+
When changing rendering behavior, copy both files to the other plugin and run
|
|
20
|
+
`npm test && npm run typecheck` in both plugin directories. Compare the files
|
|
21
|
+
with `diff -u` before delivery. Each `client/markdown.tsx` owns its palette and
|
|
22
|
+
wrapper; do not copy those adapters.
|
|
23
|
+
|
|
24
|
+
The core handles inline nesting, block structure, selectable text, safe `http(s)`/`mailto`
|
|
25
|
+
link presses, and horizontal code/table scrolling. Images render as alt text or `[image]`;
|
|
26
|
+
this is not the full Paseo assistant renderer. Tests inspect React elements with RN host
|
|
27
|
+
primitives, not native layout. Verify wrapping, selection and scrolling on iOS
|
|
28
|
+
before claiming visual or gesture correctness.
|
|
@@ -3,6 +3,7 @@ import { Modal } from "@getpaseo/plugin/client/react-native";
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Pressable, Text, View } from "react-native";
|
|
5
5
|
import type { BrainEmpty } from "../shared/brain-empty.ts";
|
|
6
|
+
import { typography } from "./typography.ts";
|
|
6
7
|
|
|
7
8
|
function label(data: BrainEmpty): string {
|
|
8
9
|
if (data.status === "running") return "✂ emptying brain …";
|
|
@@ -27,6 +28,7 @@ function CutLine({ color }: { color: string }) {
|
|
|
27
28
|
export function BrainEmptyDivider({ item, theme }: PluginTimelineItemProps<BrainEmpty>) {
|
|
28
29
|
const [lastWordOpen, setLastWordOpen] = useState(false);
|
|
29
30
|
const data = item.data;
|
|
31
|
+
const type = typography(theme);
|
|
30
32
|
const refused = data.error !== undefined || data.status === "failed";
|
|
31
33
|
const color = refused ? theme.colors.statusDanger : theme.colors.foregroundMuted;
|
|
32
34
|
const hasLastWord = data.outcome === "rollover_requested" && data.lastWord !== undefined;
|
|
@@ -41,17 +43,17 @@ export function BrainEmptyDivider({ item, theme }: PluginTimelineItemProps<Brain
|
|
|
41
43
|
>
|
|
42
44
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
43
45
|
<CutLine color={color} />
|
|
44
|
-
<Text style={{
|
|
46
|
+
<Text style={{ ...type.sm, color, letterSpacing: 0.3 }}>{label(data)}</Text>
|
|
45
47
|
<CutLine color={color} />
|
|
46
48
|
</View>
|
|
47
49
|
{data.error !== undefined && (
|
|
48
|
-
<Text selectable style={{ color: theme.colors.statusDanger,
|
|
50
|
+
<Text selectable style={{ ...type.sm, color: theme.colors.statusDanger, textAlign: "center" }}>{data.error}</Text>
|
|
49
51
|
)}
|
|
50
52
|
</Pressable>
|
|
51
53
|
{hasLastWord && (
|
|
52
54
|
<Modal title="Last word" open={lastWordOpen} onOpenChange={setLastWordOpen}>
|
|
53
55
|
<Modal.Content style={{ backgroundColor: theme.colors.surface2 }}>
|
|
54
|
-
<Text selectable style={{ color: theme.colors.foreground
|
|
56
|
+
<Text selectable style={{ ...type.body, color: theme.colors.foreground }}>{data.lastWord}</Text>
|
|
55
57
|
</Modal.Content>
|
|
56
58
|
</Modal>
|
|
57
59
|
)}
|