notesoup 0.57.3 → 0.57.4

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.
@@ -37,7 +37,7 @@ export type EditOptions = {
37
37
  renameTo?: string;
38
38
  };
39
39
  /** Omitted/null/empty glob or bare @default selects current notebooks; explicit globs match full addresses.
40
- * Only the current session also matches its bare-path alias (e.g. *.md or deep/**).
40
+ * A pattern without `@` or `/` matches filenames at any depth; relative paths with `/` match the current session.
41
41
  */
42
42
  export type NotesQuery = {
43
43
  glob?: string | null;
@@ -126,10 +126,12 @@ async function namespacesForPattern(pattern, identity, status) {
126
126
  }
127
127
  return namespaces;
128
128
  }
129
- /** Relative pattern heads resolve to canonical names, so they match canonical addresses. */
129
+ /** Relative pattern heads resolve to canonical names; slashless bare patterns match filenames at any depth. */
130
130
  function normalizePattern(pattern, identity) {
131
131
  if (!pattern)
132
132
  return pattern;
133
+ if (!pattern.startsWith("@") && !pattern.includes("/"))
134
+ return `**/${pattern}`;
133
135
  if (pattern.startsWith("@project/"))
134
136
  return `@projects/${identity.projectKey}/${pattern.slice("@project/".length)}`;
135
137
  if (pattern.startsWith("@self/"))
@@ -38,7 +38,9 @@ test("default spellings stay local while explicit ** lists and searches each not
38
38
  }
39
39
  const rows = await notes.list({ glob: "**" });
40
40
  assert.deepEqual(addresses(rows), all);
41
+ assert.deepEqual(addresses(await notes.list({ glob: "*" })), all);
41
42
  assert.deepEqual(addresses(await notes.search(["needle"], { glob: "**" })), all);
43
+ assert.deepEqual(addresses(await notes.search(["needle"], { glob: "*" })), all);
42
44
  assert.equal(new Set(rows.map(row => row.address)).size, rows.length);
43
45
  for (const row of rows)
44
46
  assert.equal((await notes.read(row.address))?.body.startsWith("needle"), true, "every result is a real readable address");
@@ -48,14 +50,16 @@ test("default spellings stay local while explicit ** lists and searches each not
48
50
  assert.deepEqual(addresses(await notes.list({ glob: "@model/**" })), ["@model/shared.md"]);
49
51
  assert.deepEqual(addresses(await notes.list({ glob: `@projects/${identity.projectKey}/**` })), [`@projects/${identity.projectKey}/shared.md`], "explicit current project stays a named read-only address");
50
52
  });
51
- test("explicit patterns use canonical addresses, with bare-path matching only for the current session", async (t) => {
53
+ test("slashless patterns match filenames at any depth while slash-qualified bare paths match the current session", async (t) => {
52
54
  const { notes, identity, foreignIdentity, foreign, all } = await populate(t);
53
55
  await notes.write("deep/nested.md", "needle nested");
54
56
  await foreign.write("deep/nested.md", "needle elsewhere");
55
57
  await foreign.write("only-foreign.md", "needle foreign only");
56
- assert.deepEqual(addresses(await notes.list({ glob: "*.md" })), ["shared.md"]);
58
+ const everyNote = [...all, "deep/nested.md", `@sessions/${foreignIdentity.sessionId}/deep/nested.md`, `@sessions/${foreignIdentity.sessionId}/only-foreign.md`].sort();
59
+ assert.deepEqual(addresses(await notes.list({ glob: "*.md" })), everyNote);
60
+ assert.deepEqual(addresses(await notes.list({ glob: "nested.md" })), [`@sessions/${foreignIdentity.sessionId}/deep/nested.md`, "deep/nested.md"]);
57
61
  assert.deepEqual(addresses(await notes.list({ glob: "deep/**" })), ["deep/nested.md"]);
58
- assert.deepEqual(await notes.search(["needle"], { glob: "only-foreign.md" }), [], "foreign sessions get no implicit basename alias");
62
+ assert.deepEqual(addresses(await notes.search(["needle"], { glob: "only-foreign.md" })), [`@sessions/${foreignIdentity.sessionId}/only-foreign.md`]);
59
63
  assert.deepEqual(addresses(await notes.list({ glob: "**/shared.md" })), all);
60
64
  assert.deepEqual(addresses(await notes.list({ glob: "@*/**/shared.md" })), all, "a wildcard head is not mistaken for an unknown reserved head");
61
65
  assert.deepEqual(addresses(await notes.list({ glob: `@sessions/${identity.sessionId}/**` })), [
@@ -153,7 +153,7 @@ test("notes_list is most-recently-updated first across merged scopes", async ()
153
153
  // A same-path pair in two scopes keeps both rows; equal timestamps tie-break by scope name.
154
154
  put("human", "a.md", base + 10);
155
155
  assert.deepEqual((await files({})).filter((file) => file.address.endsWith("a.md")).map((file) => file.address), ["@human/a.md", "a.md"], "equal timestamps tie-break by full address");
156
- assert.deepEqual((await files({ glob: "*.md" })).map((file) => file.address), ["a.md", "b.md"], "a bare glob narrows to the session notebook");
156
+ assert.deepEqual((await files({ glob: "*.md" })).map((file) => file.address), ["@human/e.md", "@human/a.md", "a.md", "b.md", "@project/c.md"], "a slashless glob matches filenames across notebooks");
157
157
  });
158
158
  test("notes are real files that persist across sessions and round-trip Unicode", async () => {
159
159
  const original = manager();
@@ -41,7 +41,7 @@ The standalone store does **not** accept `cwd`: its `projectKey` is already the
41
41
  - `list({ glob?, crumpled? }?)` returns `Promise<NoteRow[]>`, sorted by update time descending with address tie-breaking. Rows contain address, scope, virtual path, metadata, body, and body byte size. Crumpled notes are excluded by default; `crumpled: true` returns only crumpled notes.
42
42
  - `search(queries: string[], { glob?, crumpled? }?)` returns `Promise<NoteSearchRow[]>`, sorted by address, with the same selection and crumpled-note rules. An empty queries array returns matching notes with empty `matches`. Otherwise search is case-insensitive literal OR over body lines; matches contain one-based `line`, `text`, and code-point `offsetChars` into the body. Neither listing nor search increments access metadata.
43
43
 
44
- `list` and `search` share `NotesQuery`: **glob is the only notebook/path selector**. Omit it or use the bare collection alias `@default` for the five current notebooks. Explicit `**` searches all notebooks, including other sessions, projects, agents and models; `@sessions/*/**` selects all session notebooks. Use `@project/**`, `@self/**`, or `@projects/<name>/**` to select a notebook. `@default` is query-only, not a directory or a read/write address; `@default/**` is not its spelling. The former `scope`/`who` query parameters are removed, without compatibility aliases. Row metadata still includes scope.
44
+ `list` and `search` share `NotesQuery`: **glob is the only notebook/path selector**. Omit it or use the bare collection alias `@default` for the five current notebooks. Explicit `*` or `**` searches all notebooks, including other sessions, projects, agents and models (any pattern without `@` or `/` matches note filenames at any depth as `**/<pattern>`); `@sessions/*/**` selects all session notebooks. Use `@project/**`, `@self/**`, or `@projects/<name>/**` to select a notebook. `@default` is query-only, not a directory or a read/write address; `@default/**` is not its spelling. The former `scope`/`who` query parameters are removed, without compatibility aliases. Row metadata still includes scope.
45
45
 
46
46
  The library returns full data, not tool envelopes or paginated/truncated output. `NoteError` exposes the existing named store refusals through `code`, with `lineNumbers` for ambiguous edits and `editIndex` for a failed edit. Runtime API fields and known persisted note metadata use camelCase; Pi tool wire fields such as `updated_at`, `offset_chars`, and `replace_all` retain their established names. The notes partition status field is `NoteQueryStatus.namespacesUnavailable` in the library and `namespaces_unavailable` on the `notes_list`/`notes_search` wire; both replace `NoteQueryStatus.homesUnavailable` and `homes_unavailable` with no compatibility alias, and the on-disk layout is unchanged. Unrecognized frontmatter keys, including old snake_case metadata, are preserved as ordinary extras; they are not interpreted as current camelCase fields or migrated automatically. Invalid addresses/identities and filesystem failures reject; only a missing `read` returns `undefined`. Notes remain markdown files with the existing size limits and same-directory atomic rename. Same-file read/modify/write work is serialized by absolute physical filename across all store instances in this process (including `.md` address aliases); symlink/case aliases and cross-process locking are not guaranteed. `list` and `search` asynchronously traverse notebooks and serialize each discovered file read against pending mutations, but are not global snapshots and may not discover a file created after traversal. Foreign named notebooks can be read, but their bodies cannot be written or edited through the store. Named project and session reads do not update access metadata. These are cooperative address rules, not an OS security sandbox.
47
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notesoup",
3
- "version": "0.57.3",
3
+ "version": "0.57.4",
4
4
  "type": "module",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notesoup",
3
- "version": "0.57.3",
3
+ "version": "0.57.4",
4
4
  "description": "Durable notes and a host-scoped notes boot section for Claude Code.",
5
5
  "author": {
6
6
  "name": "AstroSheep"
@@ -8475,6 +8475,7 @@ async function namespacesForPattern(pattern, identity2, status) {
8475
8475
  }
8476
8476
  function normalizePattern(pattern, identity2) {
8477
8477
  if (!pattern) return pattern;
8478
+ if (!pattern.startsWith("@") && !pattern.includes("/")) return `**/${pattern}`;
8478
8479
  if (pattern.startsWith("@project/")) return `@projects/${identity2.projectKey}/${pattern.slice("@project/".length)}`;
8479
8480
  if (pattern.startsWith("@self/")) return `@agents/${identity2.agent}/${pattern.slice("@self/".length)}`;
8480
8481
  if (pattern.startsWith("@model/")) return `@models/${identity2.model}/${pattern.slice("@model/".length)}`;
@@ -25450,6 +25450,7 @@ async function namespacesForPattern(pattern, identity, status) {
25450
25450
  }
25451
25451
  function normalizePattern(pattern, identity) {
25452
25452
  if (!pattern) return pattern;
25453
+ if (!pattern.startsWith("@") && !pattern.includes("/")) return `**/${pattern}`;
25453
25454
  if (pattern.startsWith("@project/")) return `@projects/${identity.projectKey}/${pattern.slice("@project/".length)}`;
25454
25455
  if (pattern.startsWith("@self/")) return `@agents/${identity.agent}/${pattern.slice("@self/".length)}`;
25455
25456
  if (pattern.startsWith("@model/")) return `@models/${identity.model}/${pattern.slice("@model/".length)}`;
@@ -29,7 +29,7 @@ export type EditOperation = { oldText: string; newText: string };
29
29
  export type WriteOptions = { origin?: Origin };
30
30
  export type EditOptions = { origin?: Origin; crumpled?: boolean; replaceAll?: boolean; renameTo?: string };
31
31
  /** Omitted/null/empty glob or bare @default selects current notebooks; explicit globs match full addresses.
32
- * Only the current session also matches its bare-path alias (e.g. *.md or deep/**).
32
+ * A pattern without `@` or `/` matches filenames at any depth; relative paths with `/` match the current session.
33
33
  */
34
34
  export type NotesQuery = { glob?: string | null; crumpled?: boolean };
35
35
  /** A read exposes metadata and the pure body; the serialized frontmatter is never part of the body. */
@@ -165,9 +165,10 @@ async function namespacesForPattern(pattern: string | undefined, identity: Notes
165
165
  return namespaces;
166
166
  }
167
167
 
168
- /** Relative pattern heads resolve to canonical names, so they match canonical addresses. */
168
+ /** Relative pattern heads resolve to canonical names; slashless bare patterns match filenames at any depth. */
169
169
  function normalizePattern(pattern: string | undefined, identity: NotesIdentity): string | undefined {
170
170
  if (!pattern) return pattern;
171
+ if (!pattern.startsWith("@") && !pattern.includes("/")) return `**/${pattern}`;
171
172
  if (pattern.startsWith("@project/")) return `@projects/${identity.projectKey}/${pattern.slice("@project/".length)}`;
172
173
  if (pattern.startsWith("@self/")) return `@agents/${identity.agent}/${pattern.slice("@self/".length)}`;
173
174
  if (pattern.startsWith("@model/")) return `@models/${identity.model}/${pattern.slice("@model/".length)}`;