@crossworks/client-types 0.239.45 → 0.239.49

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.239.45",
3
+ "version": "0.239.49",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/app-nav.ts CHANGED
@@ -100,6 +100,13 @@ export type AppOpenStat = { n: number; at: string };
100
100
 
101
101
  /** Slim app row for navigation surfaces: everything the tree needs to render
102
102
  * and search, nothing it doesn't. */
103
+ /**
104
+ * What the VIEWER may do with an app's data (team apps Phase 3): read only,
105
+ * or read and change. The brain works it out per viewer with the same rule
106
+ * its database brokers apply; a client only shows it (the R and R/W pill).
107
+ */
108
+ export type AppDataAccess = 'read' | 'read_write';
109
+
103
110
  export type AppNavItem = {
104
111
  id: string;
105
112
  title: string;
@@ -111,6 +118,13 @@ export type AppNavItem = {
111
118
  * Differs from AppRow.hasBuild, which is published-only. */
112
119
  hasBuild: boolean;
113
120
  updatedAt: string;
121
+ /** What the admin viewing the sidebar may do with the app's data: the
122
+ * owner broker always writes, so 'read_write'. Absent from an older brain
123
+ * (show no pill). */
124
+ dataAccess?: AppDataAccess;
125
+ /** The app's MCP access switch (team apps Phase 1): members' and clients'
126
+ * MCP may reach its data. Absent from an older brain. */
127
+ mcpAccess?: boolean;
114
128
  };
115
129
 
116
130
  /** GET /api/app-nav — the whole sidebar in one round-trip. `nav` is already
@@ -24,6 +24,8 @@ export const ACCESS_KEY_AREAS = [
24
24
  'contacts',
25
25
  'journal',
26
26
  'apps',
27
+ // The data of mini apps opened to MCP (team apps Phase 1, app_data_*).
28
+ 'app_data',
27
29
  ] as const;
28
30
  export type AccessKeyArea = (typeof ACCESS_KEY_AREAS)[number];
29
31
 
@@ -84,7 +84,10 @@ export interface ToolDTO {
84
84
  /** "External access" on an outside tool (mcp or http): everyone a shared
85
85
  * app that declares it reaches (members, clients, contacts on a contact
86
86
  * link) may call it. Null when off. Set it with
87
- * `PUT /api/tools/:id/external-access`. */
87
+ * `PUT /api/tools/:id/external-access`. On a CONNECTOR tool (mcp) since
88
+ * team apps Phase 2 it is the READ-ONLY MARK: the connector's level
89
+ * decides who may use the tool, and on = a read, off = a write (apps
90
+ * may write; a login's MCP needs its Write switch). */
88
91
  externalAccess?: ToolExternalAccessDTO | null;
89
92
  createdAt: string;
90
93
  updatedAt: string;
@@ -196,7 +199,11 @@ export interface ToolGroupDTO {
196
199
  enabled: boolean;
197
200
  /** The group's level: an agent or a team app may hold it only at or above
198
201
  * it, and team apps call only built-in tools in an enabled group at team
199
- * level or below (outside tools follow External access instead). Absent from servers before it shipped. Set it with
202
+ * level or below. A CONNECTOR group's level also decides who may use its
203
+ * tools in apps and over their own MCP (team apps Phase 2): members at
204
+ * team level or lower, clients at client level, contact links at
205
+ * public; single http tools follow External access. Absent from servers
206
+ * before it shipped. Set it with
200
207
  * `PATCH /api/access/tool-groups/:slug { audience }`. */
201
208
  audience?: AccessLevel;
202
209
  createdAt: string;
@@ -6,7 +6,7 @@
6
6
  * shares one. A CLIENT login runs apps at client level only (client logins
7
7
  * C6, /api/client/apps).
8
8
  */
9
- import type { AppTint } from '../app-nav';
9
+ import type { AppDataAccess, AppTint } from '../app-nav';
10
10
  import type { AccessLevel } from './access';
11
11
 
12
12
  /** The app levels a member may run: team and below (never admin). */
@@ -27,6 +27,9 @@ export type MemberAppCard = {
27
27
  * app answers 403 `{ ok: false, error, reason: 'read-only' }`. Absent from
28
28
  * an older brain: read as `audience !== 'team'`. */
29
29
  dataReadOnly?: boolean;
30
+ /** The same, as the R and R/W pill shows it (team apps Phase 3). Absent
31
+ * from an older brain: show no pill. */
32
+ dataAccess?: AppDataAccess;
30
33
  };
31
34
 
32
35
  /**
@@ -71,6 +74,9 @@ export type ClientAppCard = {
71
74
  description: string | null;
72
75
  updatedAt: string;
73
76
  dataReadOnly: boolean;
77
+ /** What the client may do with the app's data, as the R and R/W pill
78
+ * shows it (team apps Phase 3). Absent from an older brain. */
79
+ dataAccess?: AppDataAccess;
74
80
  };
75
81
 
76
82
  /** GET /api/client/apps: the apps a client may run, by title. The run routes
@@ -0,0 +1,45 @@
1
+ /**
2
+ * A member's own view of Settings > MCP (team apps Phase 1): GET
3
+ * /api/member/mcp. The member reads their access here; an admin sets it.
4
+ * The only thing a member changes is their own connected clients
5
+ * (DELETE /api/member/mcp/clients/:id).
6
+ */
7
+
8
+ /** One MCP client the member connected: their live OAuth grants on it. */
9
+ export type MemberMcpClient = {
10
+ id: string;
11
+ /** The name the client registered with (e.g. "Claude"); null if none. */
12
+ clientName: string | null;
13
+ /** ISO: the earliest of this member's live grants on it. */
14
+ connectedAt: string;
15
+ /** ISO: the last call, null when never used. */
16
+ lastUsedAt: string | null;
17
+ activeTokens: number;
18
+ };
19
+
20
+ export type MemberMcpView = {
21
+ /** The box-level remote MCP switch (an admin's). Off, no MCP works. */
22
+ remoteEnabled: boolean;
23
+ /** The URL to paste into an MCP client. */
24
+ connectorUrl: string;
25
+ /** The member's own switches, set by an admin: MCP at all, and Write
26
+ * (drafts in their own space, and rows of apps opened to MCP). */
27
+ access: { enabled: boolean; writeEnabled: boolean };
28
+ /** The clients this member connected, never another login's. */
29
+ clients: MemberMcpClient[];
30
+ /** The connectors (outside data sources) open at the member's level (team
31
+ * apps Phase 2): their MCP and their apps may use these tools. Read
32
+ * tools carry the admin's read-only mark; write tools need Write on
33
+ * over MCP. Absent from a brain before Phase 2. */
34
+ connectors?: MemberMcpConnector[];
35
+ };
36
+
37
+ /** One connector open to the member. */
38
+ export type MemberMcpConnector = {
39
+ id: string;
40
+ name: string;
41
+ /** The connector's level: team, client or public. */
42
+ level: string;
43
+ readTools: number;
44
+ writeTools: number;
45
+ };
package/src/dto/rows.ts CHANGED
@@ -191,6 +191,25 @@ export type AppRow = {
191
191
  * everyone who runs it writes. Set with PATCH /api/apps/:id
192
192
  * `{ dataReadOnly }`. Absent from an older brain: read as false. */
193
193
  dataReadOnly?: boolean;
194
+ /** MCP access (team apps Phase 1, migration 0234): a member's or client's
195
+ * MCP connection may reach this app's data (the app_data_* tools), at
196
+ * the app's level, read or write by the login's Write switch and
197
+ * `dataReadOnly`. Off by default. Set with PATCH /api/apps/:id
198
+ * `{ mcpAccess }`. Absent from an older brain: read as false (and the
199
+ * switch is not shown). */
200
+ mcpAccess?: boolean;
201
+ /** The author ceiling (team apps Phase 3, migration 0235): 'team' = the
202
+ * app runs its tools at team rules for every runner, admins too (a
203
+ * member wrote it, or its code came from a copy, an import or a
204
+ * member-era restore). An admin lifts it with PATCH /api/apps/:id
205
+ * `{ trustTools: true }` after reading its tools. Absent from an older
206
+ * brain: read as 'admin'. */
207
+ authorLevel?: 'admin' | 'team';
208
+ /** True once the app ever ran at the ceiling (a member built it, or a
209
+ * copy, an import or a restore capped it): the admin's "Trust its tools"
210
+ * switch shows on its page, on or off (migration 0236). Absent from an
211
+ * older brain. */
212
+ authorCeilingSeen?: boolean;
194
213
  createdAt: string;
195
214
  updatedAt: string;
196
215
  };
@@ -218,11 +237,20 @@ export type AppDetail = AppRow & {
218
237
  export type AppSnapshot = {
219
238
  id: string;
220
239
  seq: number;
240
+ /** `pre_mcp_write` (0234): taken before the first MCP write to the app
241
+ * in an hour. */
221
242
  trigger:
222
- 'publish' | 'manual' | 'pre_restore' | 'pre_schema' | 'pre_delete' | 'pre_import' | 'nightly';
243
+ | 'publish'
244
+ | 'manual'
245
+ | 'pre_restore'
246
+ | 'pre_schema'
247
+ | 'pre_delete'
248
+ | 'pre_import'
249
+ | 'nightly'
250
+ | 'pre_mcp_write';
223
251
  kind: 'version' | 'snapshot';
224
252
  note: string | null;
225
- actor: 'owner' | 'agent' | 'mcp' | 'system';
253
+ actor: 'owner' | 'agent' | 'mcp' | 'system' | 'member';
226
254
  createdAt: string;
227
255
  /** The seq this one's content was restored from, when it was. */
228
256
  restoredFrom: number | null;
@@ -250,7 +278,7 @@ export type TableSnapshot = {
250
278
  seq: number;
251
279
  trigger: 'commit' | 'manual';
252
280
  note: string | null;
253
- actor: 'owner' | 'agent' | 'mcp' | 'system';
281
+ actor: 'owner' | 'agent' | 'mcp' | 'system' | 'member';
254
282
  createdAt: string;
255
283
  /** The table's version the copy holds (it counts commits). */
256
284
  tableVersion: number | null;
package/src/index.ts CHANGED
@@ -120,6 +120,7 @@ export type {
120
120
  MemberInviteRow,
121
121
  MemberInviteState,
122
122
  } from './dto/member-invites';
123
+ export type { MemberMcpClient, MemberMcpConnector, MemberMcpView } from './dto/member-mcp';
123
124
  export type { MemberItemKind, ClientItemKind, ClientItemFilter } from './member-kinds';
124
125
  export type {
125
126
  LoginKind,