@crossworks/client-types 0.400.28 → 0.400.29
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 +1 -1
- package/src/app-nav.ts +5 -5
- package/src/app-viewer.ts +2 -2
- package/src/dto/access-keys.ts +6 -6
- package/src/dto/access.ts +13 -13
- package/src/dto/agent-graph.ts +2 -2
- package/src/dto/calls.ts +6 -6
- package/src/dto/client.ts +4 -4
- package/src/dto/file-deletes.ts +4 -4
- package/src/dto/grants.ts +12 -12
- package/src/dto/heartbeats.ts +2 -2
- package/src/dto/logins.ts +2 -2
- package/src/dto/member-apps.ts +6 -6
- package/src/dto/member-invites.ts +1 -1
- package/src/dto/member-mcp.ts +8 -9
- package/src/dto/member.ts +13 -13
- package/src/dto/messenger.ts +8 -10
- package/src/dto/people.ts +1 -1
- package/src/dto/rows.ts +24 -27
- package/src/dto/shell.ts +6 -7
- package/src/dto/views.ts +21 -22
- package/src/dto/workspace-hits.ts +7 -7
- package/src/dto/workspaces.ts +14 -15
- package/src/index.ts +6 -6
- package/src/kind-lists.ts +3 -4
- package/src/kinds.ts +12 -15
- package/src/member-kinds.ts +3 -4
- package/src/profile-flags.ts +5 -5
- package/src/role-names.ts +8 -11
- package/src/tree.ts +18 -19
- package/src/turn-streaming.ts +4 -4
- package/src/types/recall.ts +3 -7
package/src/dto/rows.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type TaskTodo = {
|
|
|
57
57
|
|
|
58
58
|
/** Mirrors @mantle/db `NodeCommentAuthorKind`. `client` stays for the wire
|
|
59
59
|
* contract (additive only) and for the comments a client login wrote
|
|
60
|
-
* before
|
|
60
|
+
* before the role was removed; no new comment gets it. */
|
|
61
61
|
export type NodeCommentAuthorKind = 'owner' | 'member' | 'agent' | 'client';
|
|
62
62
|
|
|
63
63
|
/**
|
|
@@ -140,8 +140,8 @@ export type PageRow = {
|
|
|
140
140
|
summary: string | null;
|
|
141
141
|
visibility: PageVisibility;
|
|
142
142
|
width: PageWidth;
|
|
143
|
-
/** A read-only snapshot copy of an accepted item (data.snapshot_of
|
|
144
|
-
*
|
|
143
|
+
/** A read-only snapshot copy of an accepted item (data.snapshot_of):
|
|
144
|
+
* nobody edits it, moves it out of its
|
|
145
145
|
* private workspace or shares it; its author may delete it. Absent on
|
|
146
146
|
* every other item. */
|
|
147
147
|
readOnly?: true;
|
|
@@ -162,7 +162,7 @@ export type PageListRow = PageRow & {
|
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
/** A row of GET /api/pages (and of /api/notes, on its note row): the item
|
|
165
|
-
* with its workspace chips and link pill
|
|
165
|
+
* with its workspace chips and link pill.
|
|
166
166
|
* The caller's own private rows carry them too, empty. */
|
|
167
167
|
export type PagesListRow = PageRow & ListChips;
|
|
168
168
|
|
|
@@ -188,25 +188,25 @@ export type AppRow = {
|
|
|
188
188
|
*/
|
|
189
189
|
shareMode: ShareMode | null;
|
|
190
190
|
/** Whether this app is the home app of a workspace the reader sees (its
|
|
191
|
-
* landing page, set on the workspace screen
|
|
191
|
+
* landing page, set on the workspace screen). */
|
|
192
192
|
isHub: boolean;
|
|
193
193
|
/** A live open public link exists (not revoked, not expired): the
|
|
194
|
-
* "Public" pill. Absent from
|
|
194
|
+
* "Public" pill. Absent from an older brain. */
|
|
195
195
|
hasLink?: boolean;
|
|
196
|
-
/** Informational
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
196
|
+
/** Informational: members and clients only read the app's data,
|
|
197
|
+
* whatever the grants' Write says. It changes no grant (contract change
|
|
198
|
+
* 36): off, a member writes where a workspace of theirs holds the app
|
|
199
|
+
* with Write on. Set with PATCH /api/apps/:id
|
|
200
200
|
* `{ dataReadOnly }`. Absent from an older brain: read as false. */
|
|
201
201
|
dataReadOnly?: boolean;
|
|
202
|
-
/** MCP access (
|
|
202
|
+
/** MCP access (migration 0234): a member's or client's
|
|
203
203
|
* MCP connection may reach this app's data (the app_data_* tools), at
|
|
204
204
|
* the app's level, read or write by the login's Write switch and
|
|
205
205
|
* `dataReadOnly`. Off by default. Set with PATCH /api/apps/:id
|
|
206
206
|
* `{ mcpAccess }`. Absent from an older brain: read as false (and the
|
|
207
207
|
* switch is not shown). */
|
|
208
208
|
mcpAccess?: boolean;
|
|
209
|
-
/** The author ceiling (
|
|
209
|
+
/** The author ceiling (migration 0235): 'team' = the
|
|
210
210
|
* app runs its tools at team rules for every runner, admins too (a
|
|
211
211
|
* member wrote it, or its code came from a copy, an import or a
|
|
212
212
|
* member-era restore). An admin lifts it with PATCH /api/apps/:id
|
|
@@ -225,7 +225,7 @@ export type AppRow = {
|
|
|
225
225
|
/** A workspace as a list row's chip names it (the same as ListWorkspace). */
|
|
226
226
|
export type WorkspaceChip = ListWorkspace;
|
|
227
227
|
|
|
228
|
-
/** One row of GET /api/apps
|
|
228
|
+
/** One row of GET /api/apps: the chips every list row
|
|
229
229
|
* carries (ListChips, lib/list-workspaces.ts). */
|
|
230
230
|
export type AppListRow = AppRow & ListChips;
|
|
231
231
|
|
|
@@ -254,7 +254,7 @@ export type AppDetail = AppRow & {
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
* One entry on an app's History line
|
|
257
|
+
* One entry on an app's History line. A VERSION
|
|
258
258
|
* (`trigger` 'publish') is the code a publish made live; a SNAPSHOT (the
|
|
259
259
|
* owner's, or one taken automatically before a restore or a schema change)
|
|
260
260
|
* also holds a copy of the app's database. `seq` is the number the owner sees
|
|
@@ -294,9 +294,9 @@ export type AppSnapshot = {
|
|
|
294
294
|
export type AppRestoreMode = 'code' | 'data' | 'full';
|
|
295
295
|
|
|
296
296
|
/**
|
|
297
|
-
* One entry on a table's History line
|
|
298
|
-
*
|
|
299
|
-
*
|
|
297
|
+
* One entry on a table's History line. A `commit` entry is the published
|
|
298
|
+
* table a commit replaced (kept by itself, the newest 20); a `manual` one
|
|
299
|
+
* the owner took. Each holds a copy
|
|
300
300
|
* of the whole workbook. `seq` is the number the owner sees (v1, v2 …).
|
|
301
301
|
*/
|
|
302
302
|
export type TableSnapshot = {
|
|
@@ -582,7 +582,7 @@ export type ProfilePreferences = {
|
|
|
582
582
|
* group grant, so the switch can't be bypassed by a manifest change. Flip it
|
|
583
583
|
* from the Team admin surface. */
|
|
584
584
|
teamPrivateReads?: boolean;
|
|
585
|
-
/** RETIRED (
|
|
585
|
+
/** RETIRED (migration 0276): the brain-wide members' home
|
|
586
586
|
* app. 0276 made it the Team workspace's home app
|
|
587
587
|
* (workspaces.landing_app_id); nothing reads it any more. It stays in
|
|
588
588
|
* the stored preferences so a rollback finds it. Read via
|
|
@@ -659,10 +659,8 @@ export type CuratedTeamSection = {
|
|
|
659
659
|
};
|
|
660
660
|
|
|
661
661
|
/** One contact's OLD team portal chat (the roster `team_chat_list` reads).
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
* also Team admin's "Chat archive" (GET /api/team-admin/members) until that
|
|
665
|
-
* tab and its route were removed on 2026-10-09; the data stays. */
|
|
662
|
+
* Team codes are retired (migration 0178): the roster is every contact
|
|
663
|
+
* with portal chat, not every code holder. */
|
|
666
664
|
export type TeamMemberActivity = {
|
|
667
665
|
contactId: string;
|
|
668
666
|
/** Contact node title; '(deleted contact)' can't occur here: portal chat
|
|
@@ -1015,7 +1013,7 @@ export interface OnboardingModelChoices {
|
|
|
1015
1013
|
*
|
|
1016
1014
|
* public — anyone with the link (the original model).
|
|
1017
1015
|
*
|
|
1018
|
-
* 'team' is retired
|
|
1016
|
+
* 'team' is retired: members read team items
|
|
1019
1017
|
* by level with their own logins. Migration 0176 revoked every team link, no
|
|
1020
1018
|
* link is created or switched to team (PATCH /api/shares answers 400
|
|
1021
1019
|
* `team-links-retired`), and an old team `/s` link shows a "sign in as a
|
|
@@ -1026,10 +1024,9 @@ export type ShareMode = 'public';
|
|
|
1026
1024
|
|
|
1027
1025
|
/**
|
|
1028
1026
|
* Why a link was refused (the `reason` of a 400 from the share routes):
|
|
1029
|
-
* `team-links-retired` for a team link
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1032
|
-
* with an open link.
|
|
1027
|
+
* `team-links-retired` for a team link, and `client-links-retired` for any
|
|
1028
|
+
* link on an item at client level: client means signed-in clients, and
|
|
1029
|
+
* public is the only level with an open link.
|
|
1033
1030
|
*/
|
|
1034
1031
|
export type ShareRetiredReason = 'team-links-retired' | 'client-links-retired';
|
|
1035
1032
|
|
package/src/dto/shell.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GET /api/shell: the chrome of the one (app) shell, for EVERY login
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* both now answer 410 code gone.
|
|
2
|
+
* GET /api/shell: the chrome of the one (app) shell, for EVERY login. An
|
|
3
|
+
* admin, a member and a client get the same shape; `role` says which. The
|
|
4
|
+
* brand (site name, theme, fonts, logo) is the brain's; the face (avatar,
|
|
5
|
+
* photo, starred screens) is the login's own. /api/member/shell and
|
|
6
|
+
* /api/client/shell answer 410 code gone.
|
|
8
7
|
*/
|
|
9
8
|
import type { TreeKind } from '../tree';
|
|
10
9
|
import type { LoginRole } from '../role-names';
|
|
@@ -27,7 +26,7 @@ export type Shell = {
|
|
|
27
26
|
loginId: string;
|
|
28
27
|
/** Whether this login is the brain's owner (its anchor login): only the
|
|
29
28
|
* owner's app deletes are purged after 30 days; anyone else's stay in the
|
|
30
|
-
* trash until the owner deletes them for good
|
|
29
|
+
* trash until the owner deletes them for good. */
|
|
31
30
|
isOwner: boolean;
|
|
32
31
|
/** Always true for a member or a client: onboarding is an admin's. */
|
|
33
32
|
onboarded: boolean;
|
package/src/dto/views.ts
CHANGED
|
@@ -89,8 +89,8 @@ export type AgentSpend = {
|
|
|
89
89
|
tokensIn: number;
|
|
90
90
|
tokensOut: number;
|
|
91
91
|
cacheReadTokens: number;
|
|
92
|
-
/** Embedding input tokens, apart from the completion tokens above
|
|
93
|
-
* Absent from
|
|
92
|
+
/** Embedding input tokens, apart from the completion tokens above.
|
|
93
|
+
* Absent from an older server. */
|
|
94
94
|
tokensEmbed?: number;
|
|
95
95
|
runs: number;
|
|
96
96
|
};
|
|
@@ -127,8 +127,8 @@ export type DailySpend = {
|
|
|
127
127
|
tokensIn: number;
|
|
128
128
|
tokensOut: number;
|
|
129
129
|
cacheReadTokens: number;
|
|
130
|
-
/** Embedding input tokens, apart from the completion tokens above
|
|
131
|
-
* Absent from
|
|
130
|
+
/** Embedding input tokens, apart from the completion tokens above.
|
|
131
|
+
* Absent from an older server. */
|
|
132
132
|
tokensEmbed?: number;
|
|
133
133
|
runs: number;
|
|
134
134
|
};
|
|
@@ -646,11 +646,10 @@ export type SystemHealth = {
|
|
|
646
646
|
connections: number | null;
|
|
647
647
|
cacheHitPct: number | null;
|
|
648
648
|
topTables: { name: string; bytes: number }[];
|
|
649
|
-
/** Who the app's system pool logs in as
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
* Absent from a server before A9. */
|
|
649
|
+
/** Who the app's system pool logs in as: 'runtime' = mantle_runtime,
|
|
650
|
+
* not a superuser and owning no table (MANTLE_DB_RUNTIME_ROLE=1);
|
|
651
|
+
* 'superuser' = the migrator's superuser; 'other' = anything else.
|
|
652
|
+
* Absent from an older server. */
|
|
654
653
|
role?: { mode: 'runtime' | 'superuser' | 'other'; user: string } | null;
|
|
655
654
|
};
|
|
656
655
|
storage: {
|
|
@@ -783,15 +782,15 @@ export type AgentTelegramChat = {
|
|
|
783
782
|
label: string;
|
|
784
783
|
status: 'pending' | 'allowed' | 'denied';
|
|
785
784
|
lastMessageAt: string | null;
|
|
786
|
-
/** The user the chat is paired to
|
|
785
|
+
/** The user the chat is paired to, null when none
|
|
787
786
|
* (pending, blocked, or its login is gone). */
|
|
788
787
|
loginId: string | null;
|
|
789
788
|
/** That user's name, else email, for the list; null with no login. */
|
|
790
789
|
pairedTo: string | null;
|
|
791
790
|
};
|
|
792
791
|
|
|
793
|
-
/** One of the signed-in user's own paired Telegram chats (
|
|
794
|
-
*
|
|
792
|
+
/** One of the signed-in user's own paired Telegram chats (GET
|
|
793
|
+
* /api/telegram/my-chats). */
|
|
795
794
|
export type MyTelegramChat = {
|
|
796
795
|
id: string;
|
|
797
796
|
telegramChatId: string;
|
|
@@ -803,7 +802,7 @@ export type MyTelegramChat = {
|
|
|
803
802
|
lastMessageAt: string | null;
|
|
804
803
|
};
|
|
805
804
|
|
|
806
|
-
/** A chat on a bot the signed-in user moderates (
|
|
805
|
+
/** A chat on a bot the signed-in user moderates (GET
|
|
807
806
|
* /api/telegram/moderated-chats): a Moderator of the bot's assistant's
|
|
808
807
|
* workspace, or an Admin user with the users area, blocks or unpairs it. */
|
|
809
808
|
export type ModeratedTelegramChat = AgentTelegramChat & {
|
|
@@ -812,8 +811,8 @@ export type ModeratedTelegramChat = AgentTelegramChat & {
|
|
|
812
811
|
agentSlug: string | null;
|
|
813
812
|
};
|
|
814
813
|
|
|
815
|
-
/** What POST /api/telegram/pair answers WITHOUT `confirm
|
|
816
|
-
*
|
|
814
|
+
/** What POST /api/telegram/pair answers WITHOUT `confirm`: what the code
|
|
815
|
+
* would pair, so the user sees whose chat it is before it
|
|
817
816
|
* becomes theirs. Nothing is paired. Confirm with the same code,
|
|
818
817
|
* `confirm: true` and this `previewToken` (a confirm without it is 400). */
|
|
819
818
|
export type TelegramPairPreview = {
|
|
@@ -823,20 +822,20 @@ export type TelegramPairPreview = {
|
|
|
823
822
|
/** True when the chat is already paired to this user. */
|
|
824
823
|
already: boolean;
|
|
825
824
|
/** The Telegram chat: `label` is its checked @username, else "chat <id>"
|
|
826
|
-
* (
|
|
825
|
+
* (never the free title); `title` is its free title, at most 64
|
|
827
826
|
* characters, or null: show it as plain text only, never as markup or a
|
|
828
827
|
* link; and its id. */
|
|
829
828
|
chat: { label: string; title: string | null; telegramChatId: string };
|
|
830
829
|
/** The bot the chat is on (its @username). */
|
|
831
830
|
bot: { name: string };
|
|
832
831
|
agentName: string | null;
|
|
833
|
-
/** Send back with the confirm (required
|
|
832
|
+
/** Send back with the confirm (required): it then pairs this
|
|
834
833
|
* chat and no other, for this code, within ten minutes of the preview. */
|
|
835
834
|
previewToken: string;
|
|
836
835
|
};
|
|
837
836
|
|
|
838
|
-
/** What POST /api/telegram/pair answers with `confirm: true
|
|
839
|
-
*
|
|
837
|
+
/** What POST /api/telegram/pair answers with `confirm: true`: the chat is
|
|
838
|
+
* paired to this user. */
|
|
840
839
|
export type TelegramPairResult = {
|
|
841
840
|
ok: true;
|
|
842
841
|
/** True when the chat was already paired to this user (no change). */
|
|
@@ -1003,8 +1002,8 @@ export type Traffic = {
|
|
|
1003
1002
|
tokensIn: number;
|
|
1004
1003
|
tokensOut: number;
|
|
1005
1004
|
tokensCacheRead: number;
|
|
1006
|
-
/** Embedding input tokens, apart from the completion tokens above
|
|
1007
|
-
* Absent from
|
|
1005
|
+
/** Embedding input tokens, apart from the completion tokens above.
|
|
1006
|
+
* Absent from an older server. */
|
|
1008
1007
|
tokensEmbed?: number;
|
|
1009
1008
|
};
|
|
1010
1009
|
|
|
@@ -1044,7 +1043,7 @@ export type StudioAgentDetail = {
|
|
|
1044
1043
|
maxIterations?: number;
|
|
1045
1044
|
/** Whether this is a manifest agent that can be reset to its canonical default. */
|
|
1046
1045
|
resettable: boolean;
|
|
1047
|
-
/** The base system prompt (editable prose
|
|
1046
|
+
/** The base system prompt (editable prose). */
|
|
1048
1047
|
systemPrompt: string;
|
|
1049
1048
|
/** The enabled, attached skills in composition order. */
|
|
1050
1049
|
skillBlocks: ComposedSkillBlock[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Search across workspaces (
|
|
3
|
-
* GET /api/tree/:kind/search asked with `across=1`) looks
|
|
4
|
-
* workspace the caller reads, not only the one picked in the
|
|
5
|
-
* database's row rules decide what the caller reads; the
|
|
6
|
-
* workspace (`ws`) only orders the hits: its own come first.
|
|
7
|
-
* the workspace it opens in, so a client tags a hit from
|
|
8
|
-
* and switches there before it opens it.
|
|
2
|
+
* Search across workspaces (docs/folder-tree.md). A search (GET
|
|
3
|
+
* /api/search, and GET /api/tree/:kind/search asked with `across=1`) looks
|
|
4
|
+
* in every workspace the caller reads, not only the one picked in the
|
|
5
|
+
* switcher. The database's row rules decide what the caller reads; the
|
|
6
|
+
* switcher's workspace (`ws`) only orders the hits: its own come first.
|
|
7
|
+
* Each hit names the workspace it opens in, so a client tags a hit from
|
|
8
|
+
* another workspace and switches there before it opens it.
|
|
9
9
|
*
|
|
10
10
|
* Every field here is optional on the wire: a brain before it sends none,
|
|
11
11
|
* and a client then shows no tag and does not switch.
|
package/src/dto/workspaces.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Workspace management on the wire (workspaces
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Workspace management on the wire (docs/workspaces.md): /api/workspaces
|
|
3
|
+
* and the two fields /api/shell adds. Users are flat; every permission is
|
|
4
|
+
* set on a workspace screen (users, Moderator ticks, resources) or on an
|
|
5
|
+
* item's Grant Access panel.
|
|
6
6
|
*
|
|
7
7
|
* Every refusal is `{ error, code }` with 400, 403, 404 or 409. A workspace
|
|
8
8
|
* or login the caller may not see answers 404, never 403.
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
import type { AppTint } from '../app-nav';
|
|
11
11
|
import type { LoginRole } from '../role-names';
|
|
12
12
|
|
|
13
|
-
/** The Admin areas
|
|
14
|
-
*
|
|
13
|
+
/** The Admin areas, the one list of them (the brain's SCOPE_AREAS,
|
|
14
|
+
* adminUserSql and the route classes read it). An Admin
|
|
15
15
|
* workspace user has all of them unless a per-user switch turns one off
|
|
16
16
|
* (none can be switched off yet). In this order on the wire (the shell's
|
|
17
17
|
* `areas`). */
|
|
@@ -30,7 +30,7 @@ export function isWorkspaceArea(v: unknown): v is WorkspaceArea {
|
|
|
30
30
|
export type WorkspaceKind = 'admin' | 'team' | 'private' | 'other';
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* A workspace's look
|
|
33
|
+
* A workspace's look: on every workspace the brain lists
|
|
34
34
|
* (this list and screen, /api/shell's switcher list, and the chips of the
|
|
35
35
|
* lists and the tree). `color` is a tint key of the folder palette, `icon`
|
|
36
36
|
* an emoji or `lucide:<name>`, the folder vocabulary; null = the default:
|
|
@@ -56,8 +56,7 @@ export type Workspace = WorkspaceLook & {
|
|
|
56
56
|
isAdmin: boolean;
|
|
57
57
|
/** The built-in workspace: Admin only since migration 0286 (Team too
|
|
58
58
|
* before). It cannot be renamed or archived (hide Rename and Archive
|
|
59
|
-
* there). Its connectors are attached here like any workspace's
|
|
60
|
-
* W5b2. */
|
|
59
|
+
* there). Its connectors are attached here like any workspace's. */
|
|
61
60
|
builtIn: boolean;
|
|
62
61
|
/** Always false since migration 0286 (it marked the built-in Team
|
|
63
62
|
* workspace, where every Admin workspace user was a Moderator). */
|
|
@@ -87,7 +86,7 @@ export type WorkspaceUser = {
|
|
|
87
86
|
* Team workspace by being an Admin user). Only an Admin user ticks or
|
|
88
87
|
* clears Moderator now (403 admin_only for anyone else). */
|
|
89
88
|
adminViaArea: boolean;
|
|
90
|
-
/** Who added them ("Added by NAME on DATE"
|
|
89
|
+
/** Who added them ("Added by NAME on DATE"): `name` is the
|
|
91
90
|
* display name or else the email. null when unknown (the adder's login
|
|
92
91
|
* is gone, or a migration or bridge added them). */
|
|
93
92
|
addedBy: { loginId: string; name: string } | null;
|
|
@@ -116,7 +115,7 @@ export type WorkspaceDetailResponse = {
|
|
|
116
115
|
/** The assistant has history (threads or messages): it cannot be swapped
|
|
117
116
|
* or removed, only cloned to use elsewhere. */
|
|
118
117
|
hasHistory: boolean;
|
|
119
|
-
/** The workspace's landing page
|
|
118
|
+
/** The workspace's landing page: its home app, or null
|
|
120
119
|
* for the built-in Desk. Absent from an older brain. */
|
|
121
120
|
landingApp?: WorkspaceLandingApp | null;
|
|
122
121
|
};
|
|
@@ -224,15 +223,15 @@ export type ShellWorkspace = WorkspaceLook & {
|
|
|
224
223
|
name: string;
|
|
225
224
|
isAdmin: boolean;
|
|
226
225
|
moderator: boolean;
|
|
227
|
-
/** The login's own private workspace ("<name> (only you)"
|
|
228
|
-
*
|
|
226
|
+
/** The login's own private workspace ("<name> (only you)"): match on
|
|
227
|
+
* this, never on the name. Absent on any other. */
|
|
229
228
|
private?: true;
|
|
230
229
|
};
|
|
231
230
|
export type ShellWorkspaces = { workspaces: ShellWorkspace[]; areas: WorkspaceArea[] };
|
|
232
231
|
|
|
233
232
|
/**
|
|
234
|
-
* GET /api/auth/whoami (the phone app's first call with a bearer
|
|
235
|
-
*
|
|
233
|
+
* GET /api/auth/whoami (the phone app's first call with a bearer): who the
|
|
234
|
+
* credential is, and the same workspaces, areas and owner
|
|
236
235
|
* flag GET /api/shell gives (its builder). `areas` is empty for a login
|
|
237
236
|
* outside the Admin workspace; `isOwner` is the brain's anchor login.
|
|
238
237
|
* `brainId` is left out only while the database is behind the code.
|
package/src/index.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* Pure types: ZERO runtime, ZERO dependencies. That's the whole point — a client
|
|
7
7
|
* component can name a row shape without importing `@mantle/db` (which drags
|
|
8
8
|
* `postgres` into the browser bundle). This is the single source of truth for the
|
|
9
|
-
* frontend/backend contract as screens move to client data-fetching
|
|
10
|
-
*
|
|
9
|
+
* frontend/backend contract as screens move to client data-fetching; the
|
|
10
|
+
* server aliases its summary types to these so drift is a type error.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* This package is the CONTRACT package: subpath
|
|
13
13
|
* modules (`version`, `turn-streaming`, `traces-format`, `types/*`, `lib/*`, …)
|
|
14
14
|
* carry the small dependency-free constants and helpers both sides of the wire
|
|
15
15
|
* share. This root index stays types-only; subpaths may hold runtime code but
|
|
@@ -228,7 +228,7 @@ export type {
|
|
|
228
228
|
TreeVisibilityRefusal,
|
|
229
229
|
TreeWorkspaceChange,
|
|
230
230
|
} from './tree';
|
|
231
|
-
// Role and actor names
|
|
231
|
+
// Role and actor names. Types only; the lists (LOGIN_ROLES,
|
|
232
232
|
// HISTORY_ACTORS, RECALL_ACTOR_KINDS) are the `@mantle/client-types/role-names`
|
|
233
233
|
// subpath. RecallActorKind comes through ./dto/recall.
|
|
234
234
|
export type { HistoryActor, LoginRole } from './role-names';
|
|
@@ -264,7 +264,7 @@ export type {
|
|
|
264
264
|
WorkspaceUserSearchResponse,
|
|
265
265
|
WorkspaceUsersResponse,
|
|
266
266
|
} from './dto/workspaces';
|
|
267
|
-
// GET /api/shell: the one shell, for every login
|
|
267
|
+
// GET /api/shell: the one shell, for every login.
|
|
268
268
|
export type { Shell, ShellFeatures, ShellRole } from './dto/shell';
|
|
269
269
|
// GET and PUT /api/profile/home-desk: the login's Desk, compare-and-set.
|
|
270
270
|
export type { HomeDesk, HomeDeskItem, HomeDeskPutBody, HomeDeskState } from './dto/home-desk';
|
|
@@ -292,7 +292,7 @@ export type {
|
|
|
292
292
|
ListWorkspace,
|
|
293
293
|
ListWsEcho,
|
|
294
294
|
} from './dto/grants';
|
|
295
|
-
// Search across workspaces
|
|
295
|
+
// Search across workspaces.
|
|
296
296
|
export type {
|
|
297
297
|
ElsewhereCount,
|
|
298
298
|
HitWorkspace,
|
package/src/kind-lists.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The kind lists
|
|
3
|
-
*
|
|
2
|
+
* The kind lists of the repo, each a filter over one field of the kind
|
|
3
|
+
* registry (./kinds).
|
|
4
4
|
* Every list is in registry order (the Drizzle enum's) unless it says
|
|
5
5
|
* otherwise; the code asks each one for membership only.
|
|
6
6
|
*
|
|
7
|
-
* kind-lists.test.ts pins every list
|
|
8
|
-
* names, cell by cell, the few that changed with the move.
|
|
7
|
+
* kind-lists.test.ts pins every list's value.
|
|
9
8
|
*
|
|
10
9
|
* Pure and dependency free: the `@mantle/client-types/kind-lists` subpath.
|
|
11
10
|
*/
|
package/src/kinds.ts
CHANGED
|
@@ -14,15 +14,14 @@
|
|
|
14
14
|
* (@mantle/content-core/profile-projections), teamHidden;
|
|
15
15
|
* - MEMBER_ITEM_KINDS and CLIENT_ITEM_KINDS (./member-kinds), library: kept
|
|
16
16
|
* one pair release, then they go with the field;
|
|
17
|
-
* - the lists of ./kind-lists
|
|
17
|
+
* - the lists of ./kind-lists: extract, corpusMap, contextRef,
|
|
18
18
|
* embeds, mentionTarget, linkServes, exportAs, accepted, searchTool,
|
|
19
19
|
* peerPick, documentTitle. A literal list of kind names anywhere else is
|
|
20
20
|
* an arch count pinned at 0 (eslint-rules/arch-counts.mjs handKindLists);
|
|
21
|
-
* - what a write re-indexes
|
|
21
|
+
* - what a write re-indexes: `indexed`, read by markContentChanged
|
|
22
22
|
* (@mantle/db) and indexWorkFor below; a hand re-index anywhere else is
|
|
23
23
|
* an arch count pinned at 0 (eslint-rules/no-hand-reindex.mjs).
|
|
24
24
|
*
|
|
25
|
-
* Each field holds the value the code had when the registry came in (A1).
|
|
26
25
|
* Who may share or see a kind changes here only as a reviewed diff of the
|
|
27
26
|
* snapshot tests (kinds.test.ts and the tests next to each derived list),
|
|
28
27
|
* never as a side effect of another list.
|
|
@@ -75,20 +74,19 @@ export type KindSpec = {
|
|
|
75
74
|
/** The kind's item routes: the content prefix (`:id` follows it; the
|
|
76
75
|
* member route lists are generated from it, route-scope.ts) and the
|
|
77
76
|
* public API v1 prefix. Null where the kind has none. Nothing reads `v1`
|
|
78
|
-
* yet
|
|
79
|
-
* section 7; D3, v1 answers as its base route). */
|
|
77
|
+
* yet. */
|
|
80
78
|
readonly route: { readonly content: string | null; readonly v1: string | null };
|
|
81
79
|
/** Hidden from a team surface: 'never' (opt-in or not), 'private-corpus'
|
|
82
80
|
* (unless the owner opted in, teamPrivateReads), or not. */
|
|
83
81
|
readonly teamHidden: 'never' | 'private-corpus' | false;
|
|
84
82
|
/** The old Library lists: in MEMBER_ITEM_KINDS at `order`, and in
|
|
85
|
-
* CLIENT_ITEM_KINDS too when `client`. Kept one pair release
|
|
83
|
+
* CLIENT_ITEM_KINDS too when `client`. Kept one pair release, then
|
|
86
84
|
* removed with them. */
|
|
87
85
|
readonly library: { readonly order: number; readonly client: boolean } | false;
|
|
88
86
|
|
|
89
|
-
// ──
|
|
90
|
-
// Each holds the value
|
|
91
|
-
//
|
|
87
|
+
// ── The kind lists, as fields (./kind-lists derives them).
|
|
88
|
+
// Each holds the value kind-lists.test.ts RECORDED, except the changes
|
|
89
|
+
// that test names.
|
|
92
90
|
|
|
93
91
|
/** The extractor reads it by default (DEFAULT_EXTRACT_TYPES, a worker's
|
|
94
92
|
* `target_types` overrides), and the integrity view lists it
|
|
@@ -123,20 +121,19 @@ export type KindSpec = {
|
|
|
123
121
|
/** Its title names a document, not a thing the user does (entity-names). */
|
|
124
122
|
readonly documentTitle: boolean;
|
|
125
123
|
|
|
126
|
-
// ──
|
|
124
|
+
// ── What a write re-indexes.
|
|
127
125
|
|
|
128
126
|
/** Every field a write of this kind may change, with the index work its
|
|
129
127
|
* change redoes (markContentChanged, @mantle/db): 'embed', 'extract', or
|
|
130
128
|
* false (the field feeds no index). A write names the fields it changed;
|
|
131
129
|
* the most work any of them asks for is done once. Each value holds what
|
|
132
|
-
*
|
|
133
|
-
* recorded, except the cells
|
|
130
|
+
* a10-content-changed.main.json recorded, except the cells
|
|
134
131
|
* a10-content-changed.changes.json names. Turning a field to 'extract'
|
|
135
132
|
* makes every save of it a model call: a cost decision, never a tidy-up. */
|
|
136
133
|
readonly indexed: Readonly<Record<string, IndexWork | false>>;
|
|
137
134
|
};
|
|
138
135
|
|
|
139
|
-
/** What a change of an indexed field makes the extractor redo
|
|
136
|
+
/** What a change of an indexed field makes the extractor redo.
|
|
140
137
|
* 'embed': the vector only, rebuilt from the title and the summary the item
|
|
141
138
|
* keeps, or with none from the title and the text read locally (one
|
|
142
139
|
* embedding on the local embedder, never a model call; a table also
|
|
@@ -840,7 +837,7 @@ export type KindsWhere<P> = { [K in ItemKind]: Kinds[K] extends P ? K : never }[
|
|
|
840
837
|
* the lists derived here (their snapshot tests say so). Frozen: several
|
|
841
838
|
* names share one list (DEFAULT_EXTRACT_TYPES and LANDED_TYPES are both
|
|
842
839
|
* EXTRACT_KINDS), so a caller that sorted or pushed onto its own would
|
|
843
|
-
* change every other's
|
|
840
|
+
* change every other's. */
|
|
844
841
|
export function kindsWhere<K extends ItemKind = ItemKind>(
|
|
845
842
|
pick: (spec: KindSpec, type: ItemKind) => boolean,
|
|
846
843
|
): readonly [K, ...K[]] {
|
|
@@ -900,7 +897,7 @@ export function treeKindsBy(key: 'order' | 'liveOrder'): readonly RegistryTreeKi
|
|
|
900
897
|
.map((t) => t.kind as RegistryTreeKind);
|
|
901
898
|
}
|
|
902
899
|
|
|
903
|
-
// ──
|
|
900
|
+
// ── What a write re-indexes ─────────────────────────────────────────────────
|
|
904
901
|
|
|
905
902
|
/** The fields a write of kind `K` may name (its `indexed` keys). */
|
|
906
903
|
export type IndexedField<K extends ItemKind> = keyof Kinds[K]['indexed'] & string;
|
package/src/member-kinds.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The kinds of item a member works with: what a personal space holds and
|
|
3
3
|
* what the Library lists. The ONE list, for the brain (member-space.ts,
|
|
4
|
-
* member-library.ts) and the client alike
|
|
4
|
+
* member-library.ts) and the client alike; a runtime constant, so
|
|
5
5
|
* it is the `@mantle/client-types/member-kinds` subpath.
|
|
6
6
|
*
|
|
7
|
-
* DEPRECATED
|
|
8
|
-
*
|
|
9
|
-
* the registry.
|
|
7
|
+
* DEPRECATED: derived from the kind registry's `library` field (./kinds)
|
|
8
|
+
* and kept exported for one pair release, then removed. Use the registry.
|
|
10
9
|
*/
|
|
11
10
|
import {
|
|
12
11
|
ITEM_KINDS,
|
package/src/profile-flags.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The profile booleans and their defaults, in one table
|
|
3
|
-
* docs/configuration.md, "Flags and env"). A preference the owner never
|
|
4
|
-
* is absent from the stored jsonb, so every reader has to supply the
|
|
5
|
-
* default;
|
|
6
|
-
*
|
|
2
|
+
* The profile booleans and their defaults, in one table
|
|
3
|
+
* (docs/configuration.md, "Flags and env"). A preference the owner never
|
|
4
|
+
* set is absent from the stored jsonb, so every reader has to supply the
|
|
5
|
+
* default; this table is the one place it comes from. Read one with
|
|
6
|
+
* {@link profileFlag}; the brain's preferences loader, its routes
|
|
7
7
|
* and the feature registry (@mantle/config FEATURES) all do.
|
|
8
8
|
*
|
|
9
9
|
* Browser-safe and dependency-free: the client reads the same table.
|
package/src/role-names.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Role and actor names
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* times; a role added to one copy would have been missing from the rest.
|
|
2
|
+
* Role and actor names: each list is written here once, and every type,
|
|
3
|
+
* zod enum, Set and membership test elsewhere reads it, so a role added
|
|
4
|
+
* here reaches every reader.
|
|
6
5
|
*
|
|
7
6
|
* The other name lists already had a source in this package and stay there
|
|
8
7
|
* (one source each, read the same way): the Admin areas WORKSPACE_AREAS
|
|
9
8
|
* (./dto/workspaces), the access levels ACCESS_LEVELS (./dto/access) and the
|
|
10
|
-
* key areas ACCESS_KEY_AREAS (./dto/access-keys).
|
|
11
|
-
* area names", lists them all with what reads each.
|
|
9
|
+
* key areas ACCESS_KEY_AREAS (./dto/access-keys).
|
|
12
10
|
*
|
|
13
11
|
* Each list is a non-empty `as const` tuple, so it is its own zod enum:
|
|
14
12
|
* `z.enum(LOGIN_ROLES)`. Zero dependency and browser safe, as every
|
|
15
13
|
* subpath of this package is.
|
|
16
14
|
*/
|
|
17
15
|
|
|
18
|
-
/** Every role a login can hold (
|
|
19
|
-
*
|
|
20
|
-
* from its workspaces. The SQL CHECK users_role_ck admits the same values
|
|
16
|
+
/** Every role a login can hold (there is no client role). A role grants
|
|
17
|
+
* nothing: what a login reads and may do comes from its workspaces. The SQL CHECK users_role_ck admits the same values
|
|
21
18
|
* (role-names.test.ts pins it). A row whose role is not one of these is no
|
|
22
19
|
* login (fail closed). */
|
|
23
20
|
export const LOGIN_ROLES = ['admin', 'member'] as const;
|
|
@@ -29,8 +26,8 @@ export function isLoginRole(v: unknown): v is LoginRole {
|
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
/** Who a version or snapshot row of an app or a table names
|
|
32
|
-
* (node_snapshots.actor): 'member' is a member author's own act
|
|
33
|
-
*
|
|
29
|
+
* (node_snapshots.actor): 'member' is a member author's own act, and the
|
|
30
|
+
* row then names the login too. */
|
|
34
31
|
export const HISTORY_ACTORS = ['owner', 'agent', 'mcp', 'system', 'member'] as const;
|
|
35
32
|
export type HistoryActor = (typeof HISTORY_ACTORS)[number];
|
|
36
33
|
|