@crossworks/client-types 0.232.354 → 0.232.362

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossworks/client-types",
3
- "version": "0.232.354",
3
+ "version": "0.232.362",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/access.ts CHANGED
@@ -77,6 +77,30 @@ export type AccessNodeView = {
77
77
  /** The shared folder it takes its share from (folder sharing); null when
78
78
  * none. Absent from brains before folder sharing. */
79
79
  sharedVia?: AccessSharedVia | null;
80
+ /** What it is read through by embeds (migration 0208); null when nothing
81
+ * reaches it. Absent from brains before 0208. */
82
+ readThrough?: AccessReadThrough | null;
83
+ };
84
+
85
+ /** An item is read through the items that embed it (migration 0208): a
86
+ * shared note makes its image readable wherever the image lives. The item
87
+ * is read at least at `level`, whatever its own level says, so the control
88
+ * offers nothing above it: take the embed out, or move the embedder out of
89
+ * its shared folder, to hide it. */
90
+ export type AccessReadThrough = {
91
+ level: 'team' | 'client';
92
+ /** The nearest items that embed it and carry a share, most open first
93
+ * (at most five). */
94
+ via: Array<{
95
+ id: string;
96
+ title: string;
97
+ /** The node type ('note', 'page', 'draw', ...). */
98
+ type: string;
99
+ level: 'team' | 'client';
100
+ /** 'folder': shared by its own folder; 'embed': itself read through
101
+ * another embed. */
102
+ through: 'folder' | 'embed';
103
+ }>;
80
104
  };
81
105
 
82
106
  /** The nearest shared folder holding an item (folder sharing, phase 4). The
package/src/dto/review.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * the wire, so an older brain or an older client keeps working.
6
6
  */
7
7
  import type { AccessItemView, AccessLevel } from './access';
8
- import type { TreeCrumb, TreeKind } from '../tree';
8
+ import type { TreeCrumb, TreeKind, TreeShareLevel, TreeVisibilityChange } from '../tree';
9
9
 
10
10
  /** Who wrote a reviewable item: a member or a client login. */
11
11
  export type ReviewAuthorRole = 'member' | 'client';
@@ -43,6 +43,10 @@ export type AcceptPlace = {
43
43
  /** The folder's crumbs, top-down, itself included. */
44
44
  crumbs: TreeCrumb[];
45
45
  creates: string[];
46
+ /** The share it is read at there through a shared folder (null: none):
47
+ * the item is read at the more open of this and the chosen level. Absent
48
+ * from brains before the Accept visibility check. */
49
+ share?: TreeShareLevel | null;
46
50
  };
47
51
 
48
52
  /** POST /api/team-admin/submissions/:id/accept and
@@ -61,6 +65,25 @@ export type AcceptRequest = {
61
65
  * For a client's item at client or public every closure item that goes
62
66
  * down must be here. */
63
67
  confirmedIds?: string[];
68
+ /** The admin saw the `visibility` refusal's list and accepts that those
69
+ * items are read above the chosen level where they land. */
70
+ visibilityConfirmed?: boolean;
71
+ };
72
+
73
+ /** 409 from either Accept (brains with the Accept visibility check): the item, or something of its
74
+ * bundle, lands in a shared folder and would be read above the chosen
75
+ * level there. Nothing moved; repeat with `visibilityConfirmed: true`. */
76
+ export type AcceptVisibilityRefusal = {
77
+ error: string;
78
+ reason: 'visibility';
79
+ /** The first changes (at most TREE_VISIBILITY_LIST_MAX): `from` the
80
+ * chosen level, `to` the level it would be read at. */
81
+ changes: TreeVisibilityChange[];
82
+ total: number;
83
+ /** Brain items the bundle embeds that would be read through it at the
84
+ * folder's share (migration 0208), `from` now, `to` then. Absent when
85
+ * there are none, and from brains before it was listed. */
86
+ alsoEmbeds?: TreeVisibilityChange[];
64
87
  };
65
88
 
66
89
  /** 409 from either Accept: a client's item at client or public without the
package/src/dto/rows.ts CHANGED
@@ -175,6 +175,13 @@ export type AppRow = {
175
175
  isHub: boolean;
176
176
  /** Access level (admin > team > client > public); the owner UI's badge. */
177
177
  audience: AccessLevel;
178
+ /** The share it inherits from a folder above it (team or client), or
179
+ * null; it is read at the more open of this and `audience`. Optional:
180
+ * absent from brains before the folder audit fixes. */
181
+ inherited?: 'team' | 'client' | null;
182
+ /** The share it is read at through something that embeds it (migration
183
+ * 0208), or null. Optional: absent from brains before it. */
184
+ embedded?: 'team' | 'client' | null;
178
185
  /** Informational (client logins C6): members and clients only read the
179
186
  * app's data. Off, an app at team or client level is a shared workspace
180
187
  * everyone who runs it writes. Set with PATCH /api/apps/:id
package/src/index.ts CHANGED
@@ -41,6 +41,7 @@ export type {
41
41
  AccessNodeUpdate,
42
42
  AccessNodeView,
43
43
  AccessSharedVia,
44
+ AccessReadThrough,
44
45
  ClientOldLinkAbove,
45
46
  ClientReport,
46
47
  ClientReportAck,
@@ -56,6 +57,7 @@ export type {
56
57
  AcceptPlace,
57
58
  AcceptPreview,
58
59
  AcceptRequest,
60
+ AcceptVisibilityRefusal,
59
61
  ReviewAuthorRole,
60
62
  ReviewAuthorView,
61
63
  } from './dto/review';
package/src/tree.ts CHANGED
@@ -28,7 +28,7 @@ export const TREE_KINDS = [
28
28
  'contacts',
29
29
  'secrets',
30
30
  // Recall v2's maps (its own content type, not pages). Appended last so no
31
- // earlier kind's index moves. Not served until the Recall screen ships.
31
+ // earlier kind's index moves. Served since the Recall screen (R3).
32
32
  'recall',
33
33
  ] as const;
34
34
  export type TreeKind = (typeof TREE_KINDS)[number];
@@ -160,11 +160,14 @@ export const TREE_KIND_SPECS: Readonly<Record<TreeKind, TreeKindSpec>> = {
160
160
  },
161
161
  // The tree lists maps only; a map's cards are recall_nodes rows, never
162
162
  // nodes, so they never appear as items.
163
+ // Not shareable YET: team sharing is Recall R6, which adds the recall root
164
+ // to nodes_share_level_ck and the type to mantle_workspace_kind(). Until
165
+ // then the database refuses the share, so the tree must not offer it.
163
166
  recall: {
164
167
  kind: 'recall',
165
168
  root: 'recall',
166
169
  nodeType: 'recall',
167
- shareable: true,
170
+ shareable: false,
168
171
  shareLevels: ['team'],
169
172
  sorts: ['name', 'updated'],
170
173
  },
@@ -222,12 +225,16 @@ export type TreeItem = {
222
225
  /** A short kind-specific token for the status slot: a file's extension, a
223
226
  * secret's kind, an event's start. Null when the kind has none. */
224
227
  subtype: string | null;
225
- /** Who can read it: its own level, or its folder's share when that is more
226
- * open. */
228
+ /** Who can read it: the most open of its own level, its folder's share and
229
+ * the share of something that embeds it. */
227
230
  level: AccessLevel;
228
231
  /** The share it takes from the nearest shared folder holding it (what
229
232
  * "Shared via" names); null = none. `level` already counts it. */
230
233
  inherited?: TreeShareLevel | null;
234
+ /** The share it is read at through something that embeds it (a shared
235
+ * note's image), kept by the brain; absent = none. `level` already
236
+ * counts it. */
237
+ embedded?: TreeShareLevel | null;
231
238
  state: TreeItemState | null;
232
239
  updatedAt: string;
233
240
  meta?: TreeItemMeta;
@@ -299,6 +306,10 @@ export type TreeVisibilityChange = {
299
306
  title: string;
300
307
  from: AccessLevel;
301
308
  to: AccessLevel;
309
+ /** The item's node type ('file', 'table', 'note', 'branch', ...), sent in
310
+ * `alsoEmbeds`: an embed may open any workspace item, and a table
311
+ * opening is more than an image. Absent elsewhere. */
312
+ type?: string;
302
313
  };
303
314
  export type TreeVisibilityRefusal = {
304
315
  error: 'visibility';
@@ -306,6 +317,18 @@ export type TreeVisibilityRefusal = {
306
317
  changes: TreeVisibilityChange[];
307
318
  /** How many items change in all. */
308
319
  total: number;
320
+ /** Items elsewhere that pages, drawings and notes in `changes` embed,
321
+ * whose access changes with them: `to` more open when they become
322
+ * readable through them, less open when an unshare or a move out takes
323
+ * that away (nothing's own level changes; migration 0208). Absent when
324
+ * there are none, and from brains before it was listed. */
325
+ alsoEmbeds?: TreeVisibilityChange[];
326
+ /** How many embedded items change in all (`alsoEmbeds` holds the first
327
+ * TREE_VISIBILITY_LIST_MAX). A confirm's `seen` is `total` plus this. */
328
+ embedsTotal?: number;
329
+ /** @deprecated Never sent: an unreleased first form of `alsoEmbeds`, when
330
+ * a share still lowered embeds for good. */
331
+ alsoLowered?: TreeVisibilityChange[];
309
332
  };
310
333
  export const TREE_VISIBILITY_LIST_MAX = 100;
311
334
 
@@ -321,7 +344,10 @@ export const TREE_VISIBILITY_LIST_MAX = 100;
321
344
  /** A folder as a client login's tree shows it. */
322
345
  export type ClientTreeFolder = Omit<TreeFolder, 'share' | 'inherited' | 'system' | 'own'>;
323
346
  /** An item as a client login's tree shows it. */
324
- export type ClientTreeItem = Omit<TreeItem, 'level' | 'inherited' | 'state' | 'source' | 'author'>;
347
+ export type ClientTreeItem = Omit<
348
+ TreeItem,
349
+ 'level' | 'inherited' | 'embedded' | 'state' | 'source' | 'author'
350
+ >;
325
351
 
326
352
  export type ClientTreeFolderPage = Omit<TreeFolderPage, 'folder' | 'folders' | 'items'> & {
327
353
  folder: ClientTreeFolder | null;
@@ -112,9 +112,9 @@ export interface RecallNodeDTO {
112
112
  updatedAt: string;
113
113
  }
114
114
 
115
- /** One card with its body — `GET /api/recall/maps/:id/cards/:cardId`, what
116
- * the editor opens. Separate from the list shape on purpose (see
117
- * `bodyChars`). */
115
+ /** One card with its body, `GET /api/recall/maps/:id/cards/:slug`: what
116
+ * the editor opens. A slug the card had before an explicit slug change still
117
+ * finds it. Separate from the list shape on purpose (see `bodyChars`). */
118
118
  export interface RecallCardDetailDTO extends RecallNodeDTO {
119
119
  /** The markdown the owner edits, at most RECALL_BODY_CHAR_BUDGET characters
120
120
  * (`@mantle/content-core/recall-compile`). */
@@ -179,8 +179,10 @@ export interface RecallMapCreateResultDTO {
179
179
  /** The body of every refused Recall write. `error` is a sentence written to be
180
180
  * shown as is: what failed and what to do. `code` is stable and absent only on
181
181
  * a malformed request (a body that failed validation). A stale `version` is
182
- * 409 with code `version_stale`; any code ending `_not_found` is 404; every
183
- * other refusal is 400. */
182
+ * 409 with code `version_stale`; `map_not_found`, `card_not_found` and
183
+ * `revision_not_found` are 404; every other refusal is 400, including a bad
184
+ * reference inside the body (`cross_map_not_found`, `folder_not_found`) and a
185
+ * revision that has nothing to put back (`revision_not_restorable`). */
184
186
  export interface RecallWriteErrorDTO {
185
187
  error: string;
186
188
  code?: string;
@@ -199,28 +201,44 @@ export interface RecallMapPatchDTO {
199
201
  version: number;
200
202
  }
201
203
 
202
- /** `PUT /api/recall/maps/:id/cards/:cardId` — create or replace one card.
203
- * `options` replaces the card's whole list, so read-modify-write it. */
204
+ /** A card write. `POST /api/recall/maps/:id/cards` adds one;
205
+ * `PUT /api/recall/maps/:id/cards/:slug` replaces an existing one (an unknown
206
+ * slug is 404, not a create).
207
+ *
208
+ * `title` and `bodyMd` always replace. `useWhen`, `options` and `prompt` are
209
+ * STICKY on a replace: leave one out and the card keeps its value. So send
210
+ * `prompt` only when the owner changed the Prompt switch: a save that sends
211
+ * `prompt: false` for a card with a pending request drops the request. When
212
+ * `options` is sent it replaces the card's whole list: read-modify-write it. */
204
213
  export interface RecallCardWriteDTO {
205
214
  title: string;
206
215
  /** Markdown, at most RECALL_BODY_CHAR_BUDGET characters. */
207
216
  bodyMd: string;
208
- /** The matcher line. Required when `prompt` is true: a prompt without one
209
- * cannot be matched by meaning, which is the only thing prompts are for. */
217
+ /** The matcher line. Required when the card is or asks to be a prompt: a
218
+ * prompt without one cannot be matched by meaning, which is the only thing
219
+ * prompts are for. */
210
220
  useWhen?: string;
211
- /** Ask for this card to be a prompt. From the OWNER this makes it one; from
212
- * an agent it only records the request (`promptPending`). */
221
+ /** From the OWNER: true makes the card a prompt (confirming any pending
222
+ * request), false makes it knowledge (demoting a prompt, or dropping a
223
+ * request). From an agent, true only records a request (`promptPending`). */
213
224
  prompt?: boolean;
214
225
  options?: RecallOptionDTO[];
215
- /** Slug of the card to place this one after, for a new card. */
226
+ /** POST only: the slug of the card to place the new one after. A slug that
227
+ * names no card is refused (`after_not_found`). */
216
228
  after?: string;
229
+ /** PUT only, owner only: an explicit slug change. The old slug keeps
230
+ * resolving (recall_go, the card GET), and options in this map that led to
231
+ * it follow the card. */
232
+ slug?: string;
217
233
  version: number;
218
234
  }
219
235
 
220
236
  /** One advisory warning from a native write. Never blocks: an orphan card is
221
237
  * a normal intermediate state while a map is being built. No `severity`,
222
238
  * because a native write has only one kind of issue it reports rather than
223
- * refuses. Codes today: `orphan_card`, `entry_without_options`. */
239
+ * refuses. Codes today: `orphan_card`, `entry_without_options`,
240
+ * `cross_map_target_gone` (an option to a map no longer published, hidden
241
+ * from agents), `prompt_kept` (an agent tried to demote a prompt). */
224
242
  export interface RecallWarningDTO {
225
243
  code: string;
226
244
  message: string;
@@ -242,7 +260,13 @@ export interface RecallWriteResultDTO {
242
260
  }
243
261
 
244
262
  /** One entry in a map's revision log (`GET /api/recall/maps/:id/revisions`),
245
- * newest first. Restore one with `POST /api/recall/revisions/:id/restore`. */
263
+ * newest first. Restore one with `POST /api/recall/revisions/:id/restore`,
264
+ * which puts back what that write replaced: a card's content (and its slug,
265
+ * if that write moved it); a deleted card under its old slug, at its old
266
+ * place, with the options other cards had to it; the old order for a
267
+ * reorder; the map fields that write changed. Undoing "card added" deletes
268
+ * the card. "map created" cannot be restored (`revision_not_restorable`), nor
269
+ * can a reorder logged before its old order was kept. */
246
270
  export interface RecallRevisionDTO {
247
271
  id: string;
248
272
  /** The card this touched; null for a map-level change. */
@@ -250,9 +274,12 @@ export interface RecallRevisionDTO {
250
274
  /** The card's slug at the time, for display when the card is gone. */
251
275
  cardSlug: string | null;
252
276
  actorKind: RecallActorKind;
253
- /** The agent's slug or the admin's display name, when known. */
277
+ /** The agent's slug, 'mcp' for an external MCP client, or the admin's
278
+ * display name, stored with the revision. Null on rows written before
279
+ * brain v0.232.357. */
254
280
  actorName: string | null;
255
- /** One line on what changed ("body edited", "card added", "published"). */
281
+ /** One line on what changed: "card added", "card edited", "card deleted",
282
+ * "cards reordered", "prompt confirmed", "renamed, published", and so on. */
256
283
  summary: string;
257
284
  createdAt: string;
258
285
  }