@crossworks/client-types 0.232.375 → 0.232.380

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.375",
3
+ "version": "0.232.380",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/access.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  * docs/access-levels.md.
8
8
  */
9
9
  import type { ShareMode } from './rows';
10
+ import type { AccessContactShare } from './contact-shares';
10
11
 
11
12
  /** Highest first: the order the control shows them in. */
12
13
  export const ACCESS_LEVELS = ['admin', 'team', 'client', 'public'] as const;
@@ -82,6 +83,10 @@ export type AccessNodeView = {
82
83
  /** What it is read through by embeds (migration 0208); null when nothing
83
84
  * reaches it. Absent from brains before 0208. */
84
85
  readThrough?: AccessReadThrough | null;
86
+ /** The contacts it is shared with (contact shares, migration 0214): each
87
+ * has its own link, opened with that contact's code. They change no
88
+ * level. Absent from brains before 0214. */
89
+ contactShares?: AccessContactShare[];
85
90
  };
86
91
 
87
92
  /** An item is read through the items that embed it (migration 0208): a
@@ -255,6 +260,12 @@ export type SharedLinkRow = {
255
260
  /** The item's level (client logins C1): `client` marks an old link, from
256
261
  * when client meant an open link. Absent from brains before C1. */
257
262
  level?: AccessLevel;
263
+ /** A contact share (migration 0214): the contact it is for, by id and
264
+ * name. Null or absent on an open link and on brains before 0214. */
265
+ contactId?: string | null;
266
+ contactName?: string | null;
267
+ /** A contact share of an app whose contact may write its data. */
268
+ canWrite?: boolean;
258
269
  };
259
270
 
260
271
  /** An old client link the brain retired (client logins C3, migration 0192):
@@ -79,10 +79,32 @@ export interface ToolDTO {
79
79
  handler: ToolHandler;
80
80
  requiresConfirm: boolean;
81
81
  enabled: boolean;
82
+ /** "Team apps may use" on an outside tool (mcp or http): team members'
83
+ * runs of a team app may call it. Null when off. Absent from servers
84
+ * before it shipped. Set it with `PUT /api/tools/:id/team-apps`. */
85
+ teamApps?: ToolTeamAppsDTO | null;
82
86
  createdAt: string;
83
87
  updatedAt: string;
84
88
  }
85
89
 
90
+ /** The "Team apps may use" switch of one tool, as the server reports it. */
91
+ export interface ToolTeamAppsDTO {
92
+ /** False when the handler changed after the admin confirmed it: the switch
93
+ * no longer counts and must be switched on again. */
94
+ on: boolean;
95
+ /** When the admin confirmed the tool only reads (ISO time). */
96
+ confirmedReadOnlyAt: string;
97
+ /** Who switched it on. */
98
+ by: { via: 'web' | 'mcp' | 'dev-tools'; actorId?: string; actorEmail?: string };
99
+ }
100
+
101
+ /** `PUT /api/tools/:id/team-apps` body. Switching on needs
102
+ * `readOnlyConfirmed: true` (the admin confirms the tool only reads). */
103
+ export interface ToolTeamAppsBody {
104
+ allow: boolean;
105
+ readOnlyConfirmed?: boolean;
106
+ }
107
+
86
108
  /** `GET/PUT /api/tools/settings` — the two owner-level tool policy toggles. */
87
109
  export interface ToolSettings {
88
110
  /** Tools an agent authors (Toolsmith) start confirm-gated until cleared. */
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Contact shares (migration 0214; docs/sharing.md, "Contact shares"): one
3
+ * workspace item shared with one contact. The contact opens the item's own
4
+ * link (`/s/<token>`) with their personal code. The item's level never
5
+ * changes, so the team never sees it. Read only, except an app with
6
+ * "Can write". Never brain tools.
7
+ */
8
+
9
+ /** A contact's sharing (the contact DTO's `sharing`); null: sharing off. */
10
+ export type ContactSharing = {
11
+ /** When the current code was made (Enable or Regenerate). */
12
+ enabledAt: string;
13
+ lastUsedAt: string | null;
14
+ /** 30 wrong codes in a day lock the contact for 24 hours. Regenerate
15
+ * clears the lock. */
16
+ locked: boolean;
17
+ /** Live contact shares of this contact. */
18
+ shareCount: number;
19
+ };
20
+
21
+ /** POST /api/contacts/:id/sharing body. */
22
+ export type ContactSharingAction = 'enable' | 'regenerate' | 'disable';
23
+
24
+ /** POST /api/contacts/:id/sharing answer. `code` comes ONCE (enable and
25
+ * regenerate); `revoked` is how many shares a disable ended. */
26
+ export type ContactSharingResponse = {
27
+ sharing: ContactSharing | null;
28
+ code?: string;
29
+ revoked?: number;
30
+ };
31
+
32
+ /** One row of a contact's "Shared" tab (GET /api/contacts/:id/shares). */
33
+ export type ContactShareRow = {
34
+ shareId: string;
35
+ nodeId: string;
36
+ /** The item's node type ('page', 'app', ...). */
37
+ kind: string;
38
+ icon: string | null;
39
+ title: string;
40
+ canWrite: boolean;
41
+ /** When the item was shared with the contact. */
42
+ sharedAt: string;
43
+ /** When the contact last opened it (null: never). */
44
+ lastOpenedAt: string | null;
45
+ /** Server-relative: `/s/<token>`. */
46
+ path: string;
47
+ };
48
+
49
+ /** GET /api/contacts/:id/shares?cursor= : live shares, newest first, 100 a
50
+ * page. `nextCursor` null: the last page. */
51
+ export type ContactSharesPage = {
52
+ shares: ContactShareRow[];
53
+ nextCursor: string | null;
54
+ };
55
+
56
+ /** DELETE /api/contacts/:id/shares (Revoke all): no level changes, sharing
57
+ * stays on. */
58
+ export type ContactSharesRevokedAll = { revoked: number };
59
+
60
+ /** POST /api/shares/contacts body. `canWrite` only for an app. */
61
+ export type CreateContactSharesBody = {
62
+ nodeId: string;
63
+ contactIds: string[];
64
+ canWrite?: boolean;
65
+ };
66
+
67
+ /** One share POST /api/shares/contacts made (or found: the call is
68
+ * idempotent per item and contact). */
69
+ export type CreatedContactShare = {
70
+ shareId: string;
71
+ contactId: string;
72
+ /** Server-relative: `/s/<token>`. */
73
+ path: string;
74
+ };
75
+
76
+ /** POST /api/shares/contacts answer. */
77
+ export type CreateContactSharesResponse = { shares: CreatedContactShare[] };
78
+
79
+ /** Why POST /api/shares/contacts refused (400 `{ error, reason }`). */
80
+ export type ContactShareRefusedReason =
81
+ 'sharing-off' | 'not-a-contact' | 'not-shareable' | 'folder' | 'write-not-app';
82
+
83
+ /** PATCH /api/shares/:id body for a contact share of an app. */
84
+ export type ContactShareUpdate = { canWrite: boolean };
85
+
86
+ /** One contact an item is shared with (`AccessNodeView.contactShares`). */
87
+ export type AccessContactShare = {
88
+ shareId: string;
89
+ contactId: string;
90
+ name: string;
91
+ canWrite: boolean;
92
+ /** The contact's sharing is on: off means the link opens nothing (a
93
+ * switch off revokes the shares, so this is rarely false). */
94
+ sharingOn: boolean;
95
+ lastOpenedAt: string | null;
96
+ /** Server-relative: `/s/<token>`. */
97
+ path: string;
98
+ };
package/src/dto/rows.ts CHANGED
@@ -609,7 +609,15 @@ export type NeedsYou = {
609
609
  open: number;
610
610
  newest: NeedsYouItem | null;
611
611
  };
612
- /** review.submitted + review.leftBehind + requests.open. */
612
+ /** Contacts whose sharing locked after 30 wrong codes in a day (contact
613
+ * shares, migration 0214): the code opens nothing until the lock lapses
614
+ * or an admin regenerates it. `newest.from` is empty. Absent from brains
615
+ * before 0214. */
616
+ sharing?: {
617
+ locked: number;
618
+ newest: NeedsYouItem | null;
619
+ };
620
+ /** review.submitted + review.leftBehind + requests.open (+ sharing.locked). */
613
621
  total: number;
614
622
  };
615
623
 
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ export * from './dto/turns';
32
32
  export * from './dto/rows';
33
33
  export * from './dto/views';
34
34
  export * from './dto/recall';
35
+ export * from './dto/contact-shares';
35
36
  // Types only; ACCESS_LEVELS (runtime) is the `@mantle/client-types/dto/access` subpath.
36
37
  export type {
37
38
  AccessItemView,