@estiva-app/interop 0.48.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,14 +38,15 @@ export interface SearchFileReferencesOptions extends Omit<FileCandidatesOptions,
38
38
  limit?: number;
39
39
  }
40
40
  /**
41
- * The files whose **current** title holds `text`, as the search tier.
41
+ * The files whose **current** title — or, for an issue, current ref (CON-33)
42
+ * — holds `text`, as the search tier.
42
43
  *
43
- * The relay indexes a root's `title` and a rename's `value` (relay ticket
44
- * 6fea004e); neither is the current title on its own — a root keeps the name
45
- * it was created with, and a rename found by an old word may since have been
46
- * renamed again. So a hit is only an address: each is read back as its root
47
- * and changes, folded through its app's manifest, and kept only when what it
48
- * is called now matches what was typed.
44
+ * The relay indexes a root's `title` and `ref` and a change's `value` for those
45
+ * fields (SPEC §5.2); none is the current one on its own — a root keeps the
46
+ * name it was created with, and a rename found by an old word may since have
47
+ * been renamed again. So a hit is only an address: each is read back as its
48
+ * root and changes, folded through its app's manifest, and kept only when what
49
+ * it is called now matches what was typed.
49
50
  *
50
51
  * Roots and renames are asked for separately, so a burst of renames cannot
51
52
  * crowd every root out of the answer, and with buzz's prefix mode, so the word
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAA;AAKxB,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAIxE,CAAA;AAcD,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,0FAA0F;IAC1F,EAAE,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,CAAC,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,EACtD,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,EAAE,KAAK,EAAE,EAAE,EAAE,GAAE,qBAA0B,GACxC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA6B/B;AAED,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC;IACpF,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAWD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,EAAE,KAAU,EAAE,GAAG,OAAO,EAAE,GAAE,2BAAgC,GAC3D,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAqB/B"}
@@ -12,7 +12,7 @@
12
12
  * never a row, so nothing unreadable is offered. An archived file is offered
13
13
  * at the lowest priority, and so is an issue in an archived project.
14
14
  */
15
- import { FILE_TIER, fileReference, KIND_CHANGE, referenceMatch, } from '@estiva-app/conversation';
15
+ import { FILE_TIER, fileReference, KIND_CHANGE, referenceMatch, refMatch, } from '@estiva-app/conversation';
16
16
  import { isClosedStatus, KIND_BARE_FILE, resolveForeignRoots, } from './projection.js';
17
17
  const KIND_PROJECT = 30850;
18
18
  const KIND_ISSUE = 30851;
@@ -29,6 +29,11 @@ const offerable = (object) => !!object &&
29
29
  !object.unreachable &&
30
30
  typeOf(object.kind) !== undefined &&
31
31
  !!object.slots.title?.value.trim();
32
+ /**
33
+ * An issue's current ref (`CON-33`, SPEC §6.1) — the manifest slot that folds
34
+ * the `ref` field — so typing it finds the issue. Only an issue has one.
35
+ */
36
+ const refOf = (object) => object.kind === KIND_ISSUE ? object.meta.find((slot) => slot.field === 'ref')?.value.trim() || undefined : undefined;
32
37
  /**
33
38
  * Rows for resolved files, all in one tier.
34
39
  *
@@ -57,14 +62,17 @@ export async function fileCandidates(objects, tier, query, { cache, at } = {}) {
57
62
  }
58
63
  return files.map((o) => {
59
64
  const parent = o.kind === KIND_ISSUE && o.parentRef ? parents.get(o.parentRef) : undefined;
65
+ const ref = refOf(o);
60
66
  return {
61
67
  id: o.address,
62
68
  uri: fileReference(o.address),
63
69
  type: typeOf(o.kind),
64
70
  kind: o.kind,
65
71
  title: o.slots.title.value,
66
- caption: parent?.slots.title?.value ?? '',
72
+ // An issue reads "CON-33 · Conversation standard": the ref first, so a hit by ref shows it (Miky, 2026-10-05).
73
+ caption: [ref, parent?.slots.title?.value].filter(Boolean).join(' · '),
67
74
  tier,
75
+ ...(ref ? { search: ref } : {}),
68
76
  ...(isClosedStatus(o.slots.status) ? { closed: true } : {}),
69
77
  ...(o.archived || parent?.archived ? { archived: true } : {}),
70
78
  ...(at?.has(o.address) ? { at: at.get(o.address) } : {}),
@@ -73,14 +81,20 @@ export async function fileCandidates(objects, tier, query, { cache, at } = {}) {
73
81
  }
74
82
  const tagOf = (event, name) => event.tags.find((t) => t[0] === name)?.[1];
75
83
  /**
76
- * The files whose **current** title holds `text`, as the search tier.
84
+ * The file a `kind:1851` hit names, when it is one the relay indexes for `[`
85
+ * (SPEC §5.2): a title change on any file, a ref change only on an issue.
86
+ */
87
+ const searchedChange = (field, address) => field === 'title' || (field === 'ref' && address?.startsWith(`${KIND_ISSUE}:`)) ? address : undefined;
88
+ /**
89
+ * The files whose **current** title — or, for an issue, current ref (CON-33)
90
+ * — holds `text`, as the search tier.
77
91
  *
78
- * The relay indexes a root's `title` and a rename's `value` (relay ticket
79
- * 6fea004e); neither is the current title on its own — a root keeps the name
80
- * it was created with, and a rename found by an old word may since have been
81
- * renamed again. So a hit is only an address: each is read back as its root
82
- * and changes, folded through its app's manifest, and kept only when what it
83
- * is called now matches what was typed.
92
+ * The relay indexes a root's `title` and `ref` and a change's `value` for those
93
+ * fields (SPEC §5.2); none is the current one on its own — a root keeps the
94
+ * name it was created with, and a rename found by an old word may since have
95
+ * been renamed again. So a hit is only an address: each is read back as its
96
+ * root and changes, folded through its app's manifest, and kept only when what
97
+ * it is called now matches what was typed.
84
98
  *
85
99
  * Roots and renames are asked for separately, so a burst of renames cannot
86
100
  * crowd every root out of the answer, and with buzz's prefix mode, so the word
@@ -100,9 +114,7 @@ export async function searchFileReferences(text, query, { limit = 32, ...options
100
114
  const at = new Map();
101
115
  for (const hit of hits) {
102
116
  const address = hit.kind === KIND_CHANGE
103
- ? tagOf(hit, 'field') === 'title'
104
- ? tagOf(hit, 'a')
105
- : undefined
117
+ ? searchedChange(tagOf(hit, 'field'), tagOf(hit, 'a'))
106
118
  : typeOf(hit.kind) && `${hit.kind}:${hit.pubkey}:${tagOf(hit, 'd') ?? ''}`;
107
119
  if (!address || !typeOf(Number(address.split(':')[0])))
108
120
  continue;
@@ -111,7 +123,7 @@ export async function searchFileReferences(text, query, { limit = 32, ...options
111
123
  if (at.size === 0)
112
124
  return [];
113
125
  const objects = await resolveForeignRoots([...at.keys()], query, options.cache);
114
- const matching = objects.filter((o) => o.slots.title && referenceMatch(o.slots.title.value, wanted) > 0);
126
+ const matching = objects.filter((o) => (o.slots.title && referenceMatch(o.slots.title.value, wanted) > 0) || refMatch(refOf(o), wanted) > 0);
115
127
  return fileCandidates(matching, FILE_TIER.search, query, { ...options, at });
116
128
  }
117
129
  //# sourceMappingURL=references.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,GAGf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,GAIpB,MAAM,iBAAiB,CAAA;AAExB,MAAM,YAAY,GAAG,KAAK,CAAA;AAC1B,MAAM,UAAU,GAAG,KAAK,CAAA;AAExB,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC3E,CAAC,YAAY,CAA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C,IAAI,EAAE,EAAE,CAAA;QAC9E,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAAE,SAAQ;QAChE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;IACjE,CAAC;IACD,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IAC/E,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5I,OAAO,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;AAC9E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/interop",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "Render and act on another app's objects from its published NIP-89 manifest. The owner defines the projection; the consumer decides how it looks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,11 +47,11 @@
47
47
  "prepublishOnly": "npm run build"
48
48
  },
49
49
  "peerDependencies": {
50
- "@estiva-app/conversation": ">=0.5.0",
50
+ "@estiva-app/conversation": ">=0.6.1",
51
51
  "@estiva-app/protocol": ">=0.24.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@estiva-app/conversation": ">=0.5.0",
54
+ "@estiva-app/conversation": ">=0.6.1",
55
55
  "@estiva-app/protocol": ">=0.24.0",
56
56
  "typescript": "~5.9.3"
57
57
  }
package/src/folders.ts CHANGED
@@ -62,6 +62,12 @@ export interface FolderRef {
62
62
  * `["private"]`. Only a move *into* the Folder reads it.
63
63
  */
64
64
  private?: boolean
65
+ /**
66
+ * `FolderSummary.addresses`: what its state lists. Only
67
+ * {@link planMoveFromFolders} reads it, to know a source lists the moved
68
+ * file even when the file's row did not resolve.
69
+ */
70
+ addresses?: readonly string[]
65
71
  }
66
72
 
67
73
  /**
@@ -336,3 +342,91 @@ export function planMoveFile(
336
342
  moved,
337
343
  }
338
344
  }
345
+
346
+ export type MoveFromFoldersPlan =
347
+ | {
348
+ ok: true
349
+ /**
350
+ * The one `kind:1852 add` in the target, naming everything moved. Publish
351
+ * it first: refused, nothing has changed. Absent when there is nothing to send.
352
+ */
353
+ add?: UnsignedEvent
354
+ /**
355
+ * A `remove` for each source that lists part of the set, naming what that
356
+ * source lists. Publish them once the add has landed; a refused one leaves
357
+ * its Folder listing the set as well, which moving again fixes.
358
+ */
359
+ removes: { folder: string; event: UnsignedEvent }[]
360
+ /** Every address the add names. */
361
+ moved: string[]
362
+ }
363
+ | { ok: false; reason: MoveRefusal }
364
+
365
+ /**
366
+ * Move a file out of every Folder that lists it, with everything listed
367
+ * beneath it in each: one `kind:1852 add` in the target naming the whole set,
368
+ * then a `remove` in each source — SPEC §3.3.
369
+ *
370
+ * {@link planMoveFile} for each source, and what every consumer did around it
371
+ * (Ship's "Move to Folder…", Peek's Move, the agent's `move-project`), so it is
372
+ * done once:
373
+ *
374
+ * - **One add, not one per source.** A file two Folders list can have a
375
+ * different set beneath it in each. One add naming the union lands whole or
376
+ * not at all, so a refusal never leaves part of the set in the target.
377
+ * - **The file is in a source whose state names it** (`from[i].addresses`),
378
+ * even when its row is missing from that source's listing. A row that did
379
+ * not resolve is still what is being moved.
380
+ * - **Placed, when no source lists any of it.** The file is listed nowhere, or
381
+ * only by containment in a Folder with state, so it is added to the target
382
+ * alone, as {@link planPlaceFile} does. Into a private Folder that is
383
+ * refused unless the file's `h` is that Folder. A project's root carries no
384
+ * `h`, so a project is always refused. A file no Folder should list itself (a
385
+ * Ship issue is listed by its project) is then added too, so only call this
386
+ * for one when something is listed beneath it.
387
+ *
388
+ * `from` is every Folder that lists the file now. The target is ignored if it
389
+ * is one of them, and a file that is already there and nowhere else plans
390
+ * nothing. `listings` holds each source's files (`FolderContents.files`). Read
391
+ * them with `includeArchived`, or an archived file beneath this one stays
392
+ * behind. A source with no entry moves the file alone.
393
+ *
394
+ * Refusals are {@link planMoveFile}'s, and nothing is planned if any source is
395
+ * refused.
396
+ */
397
+ export function planMoveFromFolders(
398
+ pubkey: string,
399
+ createdAtMs: number,
400
+ args: { file: MovableFile; from: readonly FolderRef[]; to: FolderRef; listings: ReadonlyMap<string, readonly MovableFile[] | null> },
401
+ ): MoveFromFoldersPlan {
402
+ const { file, to } = args
403
+ const sources = args.from.filter((folder) => folder.id !== to.id)
404
+ if (sources.length === 0 && args.from.length > 0) return { ok: true, removes: [], moved: [] }
405
+ const removes: { folder: string; event: UnsignedEvent }[] = []
406
+ const moved = new Set<string>()
407
+ for (const from of sources) {
408
+ const listing = args.listings.get(from.id) ?? null
409
+ const unresolved =
410
+ !!listing && !!file.address && !!from.addresses?.includes(file.address) && !listing.some((candidate) => candidate.address === file.address)
411
+ const plan = planMoveFile(pubkey, createdAtMs, {
412
+ file,
413
+ from,
414
+ to,
415
+ // By its address, so the walk finds what the listing draws beneath it.
416
+ listing: unresolved ? [{ ...file, ref: file.address! }, ...listing] : listing,
417
+ })
418
+ if (!plan.ok) return plan
419
+ for (const address of plan.moved) moved.add(address)
420
+ const remove = plan.events[1]
421
+ if (remove) removes.push({ folder: from.id, event: remove })
422
+ }
423
+ if (!to.hasState) return { ok: false, reason: 'target-has-no-state' }
424
+ if (moved.size === 0) {
425
+ if (to.private && file.folder !== to.id) return { ok: false, reason: 'target-is-private' }
426
+ if (!file.address) return { ok: true, removes: [], moved: [] }
427
+ const [add] = planPlaceFile(pubkey, createdAtMs, { folder: to.id, address: file.address, hasState: true })
428
+ return { ok: true, add, removes: [], moved: [file.address] }
429
+ }
430
+ const addresses = [...moved]
431
+ return { ok: true, add: buildFolderCommand(pubkey, createdAtMs, { folder: to.id, op: 'add', addresses }), removes, moved: addresses }
432
+ }
package/src/index.ts CHANGED
@@ -130,11 +130,13 @@ export {
130
130
  planPlaceFile,
131
131
  planUnlistFile,
132
132
  planMoveFile,
133
+ planMoveFromFolders,
133
134
  planArchiveFolder,
134
135
  listedBeneath,
135
136
  type FolderRef,
136
137
  type MovableFile,
137
138
  type MovePlan,
139
+ type MoveFromFoldersPlan,
138
140
  type MoveRefusal,
139
141
  } from './folders.js'
140
142
 
package/src/projection.ts CHANGED
@@ -5940,7 +5940,9 @@ export async function resolveFolderContents(
5940
5940
  /**
5941
5941
  * Return archived files — and files hidden with an archived parent — each
5942
5942
  * carrying its {@link Archive}, instead of leaving them out. For a view
5943
- * that lists what was archived; every other list wants the default.
5943
+ * that lists what was archived, and for the listings a move plans from
5944
+ * (`planMoveFromFolders`): what is archived beneath a file moves with it.
5945
+ * Every other list wants the default.
5944
5946
  */
5945
5947
  includeArchived?: boolean
5946
5948
  } = {},
package/src/references.ts CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  fileReference,
18
18
  KIND_CHANGE,
19
19
  referenceMatch,
20
+ refMatch,
20
21
  type ReferenceCandidate,
21
22
  type ReferenceType,
22
23
  } from '@estiva-app/conversation'
@@ -51,6 +52,13 @@ const offerable = (object: ForeignObject | null | undefined): object is Addresse
51
52
  typeOf(object.kind) !== undefined &&
52
53
  !!object.slots.title?.value.trim()
53
54
 
55
+ /**
56
+ * An issue's current ref (`CON-33`, SPEC §6.1) — the manifest slot that folds
57
+ * the `ref` field — so typing it finds the issue. Only an issue has one.
58
+ */
59
+ const refOf = (object: ForeignObject): string | undefined =>
60
+ object.kind === KIND_ISSUE ? object.meta.find((slot) => slot.field === 'ref')?.value.trim() || undefined : undefined
61
+
54
62
  export interface FileCandidatesOptions {
55
63
  cache?: ProjectionCache
56
64
  /** When each address was last written or read, in seconds — newer first within a tier. */
@@ -86,14 +94,17 @@ export async function fileCandidates(
86
94
  }
87
95
  return files.map((o) => {
88
96
  const parent = o.kind === KIND_ISSUE && o.parentRef ? parents.get(o.parentRef) : undefined
97
+ const ref = refOf(o)
89
98
  return {
90
99
  id: o.address,
91
100
  uri: fileReference(o.address),
92
101
  type: typeOf(o.kind)!,
93
102
  kind: o.kind,
94
103
  title: o.slots.title!.value,
95
- caption: parent?.slots.title?.value ?? '',
104
+ // An issue reads "CON-33 · Conversation standard": the ref first, so a hit by ref shows it (Miky, 2026-10-05).
105
+ caption: [ref, parent?.slots.title?.value].filter(Boolean).join(' · '),
96
106
  tier,
107
+ ...(ref ? { search: ref } : {}),
97
108
  ...(isClosedStatus(o.slots.status) ? { closed: true } : {}),
98
109
  ...(o.archived || parent?.archived ? { archived: true } : {}),
99
110
  ...(at?.has(o.address) ? { at: at.get(o.address) } : {}),
@@ -109,14 +120,22 @@ export interface SearchFileReferencesOptions extends Omit<FileCandidatesOptions,
109
120
  const tagOf = (event: { tags: string[][] }, name: string) => event.tags.find((t) => t[0] === name)?.[1]
110
121
 
111
122
  /**
112
- * The files whose **current** title holds `text`, as the search tier.
123
+ * The file a `kind:1851` hit names, when it is one the relay indexes for `[`
124
+ * (SPEC §5.2): a title change on any file, a ref change only on an issue.
125
+ */
126
+ const searchedChange = (field: string | undefined, address: string | undefined) =>
127
+ field === 'title' || (field === 'ref' && address?.startsWith(`${KIND_ISSUE}:`)) ? address : undefined
128
+
129
+ /**
130
+ * The files whose **current** title — or, for an issue, current ref (CON-33)
131
+ * — holds `text`, as the search tier.
113
132
  *
114
- * The relay indexes a root's `title` and a rename's `value` (relay ticket
115
- * 6fea004e); neither is the current title on its own — a root keeps the name
116
- * it was created with, and a rename found by an old word may since have been
117
- * renamed again. So a hit is only an address: each is read back as its root
118
- * and changes, folded through its app's manifest, and kept only when what it
119
- * is called now matches what was typed.
133
+ * The relay indexes a root's `title` and `ref` and a change's `value` for those
134
+ * fields (SPEC §5.2); none is the current one on its own — a root keeps the
135
+ * name it was created with, and a rename found by an old word may since have
136
+ * been renamed again. So a hit is only an address: each is read back as its
137
+ * root and changes, folded through its app's manifest, and kept only when what
138
+ * it is called now matches what was typed.
120
139
  *
121
140
  * Roots and renames are asked for separately, so a burst of renames cannot
122
141
  * crowd every root out of the answer, and with buzz's prefix mode, so the word
@@ -140,15 +159,13 @@ export async function searchFileReferences(
140
159
  for (const hit of hits) {
141
160
  const address =
142
161
  hit.kind === KIND_CHANGE
143
- ? tagOf(hit, 'field') === 'title'
144
- ? tagOf(hit, 'a')
145
- : undefined
162
+ ? searchedChange(tagOf(hit, 'field'), tagOf(hit, 'a'))
146
163
  : typeOf(hit.kind) && `${hit.kind}:${hit.pubkey}:${tagOf(hit, 'd') ?? ''}`
147
164
  if (!address || !typeOf(Number(address.split(':')[0]))) continue
148
165
  at.set(address, Math.max(at.get(address) ?? 0, hit.created_at))
149
166
  }
150
167
  if (at.size === 0) return []
151
168
  const objects = await resolveForeignRoots([...at.keys()], query, options.cache)
152
- const matching = objects.filter((o) => o.slots.title && referenceMatch(o.slots.title.value, wanted) > 0)
169
+ const matching = objects.filter((o) => (o.slots.title && referenceMatch(o.slots.title.value, wanted) > 0) || refMatch(refOf(o), wanted) > 0)
153
170
  return fileCandidates(matching, FILE_TIER.search, query, { ...options, at })
154
171
  }