@plitzi/sdk-shared 0.38.15 → 0.38.16

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.
@@ -20,4 +20,12 @@ export type SubscriptionCollaborator = {
20
20
  };
21
21
  instanceId: string;
22
22
  elementState?: SubscriptionCollaboratorElementState;
23
+ /**
24
+ * Present when the collaborator is an agent writing over the MCP — `user.firstName` is then the application
25
+ * (`Claude`) and `for` the member it acts for. It has no cursor: what it changed last is what it has selected, and it
26
+ * leaves once it has written nothing for a while.
27
+ */
28
+ agent?: {
29
+ for: string;
30
+ };
23
31
  };
@@ -8,6 +8,7 @@ import { SSRRealtimeConfig } from './RealtimeTypes';
8
8
  import { Schema } from './SchemaTypes';
9
9
  import { AnalyticsConfig, OfflineDataRaw } from './SdkTypes';
10
10
  import { FontHead, Style } from './StyleTypes';
11
+ import { ActivityReader, SpaceActivityPage, SpaceActivityQuery } from '../activity/types';
11
12
  import { FlagOverrides } from '../flags/resolveFlags';
12
13
  import { SpaceChange } from '../history/types';
13
14
  import { IncomingHttpHeaders } from 'node:http';
@@ -223,6 +224,8 @@ export type SSRGrant = {
223
224
  spaceId: number;
224
225
  scope: SpaceScope;
225
226
  userId?: number;
227
+ /** For an `agent` grant, the application the member connected (`Claude`): what its writes are recorded and shown as. */
228
+ client?: string;
226
229
  canWrite: boolean;
227
230
  };
228
231
  /** A page of a space's change history, newest first; `nextBefore` reads further back, null at the end. */
@@ -237,10 +240,12 @@ export type SSRChangeQuery = {
237
240
  limit: number;
238
241
  };
239
242
  /** Who a write is made for and which request made it, for a consumer that records its changes. Every document one
240
- * request writes shares its `batch`: one `plitzi_apply`, read back as one change. */
243
+ * request writes shares its `batch`: one `plitzi_apply`, read back as one change. `client` is the application that
244
+ * wrote it for them (`SSRGrant.client`). */
241
245
  export type SSRWriteContext = {
242
246
  userId?: number;
243
247
  batch: string;
248
+ client?: string;
244
249
  };
245
250
  /**
246
251
  * A session, as the thing that issued it describes it. Deliberately free of transport: whoever mints one says what
@@ -432,6 +437,10 @@ export type SSRAdapters = {
432
437
  /** The space's change history, read-only: what every writer saved, and for whom. When omitted, the MCP offers no
433
438
  * history resource. */
434
439
  getChanges?: (spaceId: number, environment: Environment, query: SSRChangeQuery) => Promise<SSRChangePage>;
440
+ /** What happened on the space after a cursor — the draft changed, a version went out, an action failed — waiting up
441
+ * to `query.wait` seconds when nothing has yet. `reader` is who asks, so their own writes can be left out; `signal`
442
+ * ends the wait when the client goes. When omitted, the MCP offers no `plitzi_activity`. */
443
+ getActivity?: (spaceId: number, query: SpaceActivityQuery, reader: ActivityReader, signal?: AbortSignal) => Promise<SpaceActivityPage>;
435
444
  /** Who this request carries, if anyone. The adapter reads the credential and resolves it; the cookie it arrived
436
445
  * in was written by the server, from {@link SSRAuthCookie}. */
437
446
  getUser?: (req: SSRRequest) => Promise<SSRUser | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-shared",
3
- "version": "0.38.15",
3
+ "version": "0.38.16",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -54,6 +54,26 @@
54
54
  "types": "./dist/actions/validateDocument.d.ts",
55
55
  "import": "./dist/actions/validateDocument.mjs"
56
56
  },
57
+ "./activity": {
58
+ "types": "./dist/activity/index.d.ts",
59
+ "import": "./dist/activity/index.mjs"
60
+ },
61
+ "./activity/describe": {
62
+ "types": "./dist/activity/describe.d.ts",
63
+ "import": "./dist/activity/describe.mjs"
64
+ },
65
+ "./activity/guard": {
66
+ "types": "./dist/activity/guard.d.ts",
67
+ "import": "./dist/activity/guard.mjs"
68
+ },
69
+ "./activity/index": {
70
+ "types": "./dist/activity/index.d.ts",
71
+ "import": "./dist/activity/index.mjs"
72
+ },
73
+ "./activity/types": {
74
+ "types": "./dist/activity/types.d.ts",
75
+ "import": "./dist/activity/types.mjs"
76
+ },
57
77
  "./auth": {
58
78
  "types": "./dist/auth/index.d.ts",
59
79
  "import": "./dist/auth/index.mjs"