@xpert-ai/plugin-sdk 3.35.0 → 3.37.0

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.
Files changed (65) hide show
  1. package/agent-results.cjs.js +5 -3
  2. package/agent-results.esm.js +2 -2
  3. package/analytics-result.cjs.js +64 -27
  4. package/analytics-result.esm.js +62 -28
  5. package/analytics.cjs.js +157 -15
  6. package/analytics.esm.js +154 -17
  7. package/artifact-document.cjs.js +9 -3
  8. package/artifact-document.esm.js +9 -3
  9. package/collaboration-client.cjs.js +274 -140
  10. package/collaboration-client.esm.js +273 -141
  11. package/docs/README.md +23 -0
  12. package/index.cjs.js +227 -10
  13. package/index.esm.js +198 -13
  14. package/package.json +8 -2
  15. package/remote-component.cjs.default.js +1 -0
  16. package/remote-component.cjs.js +143 -0
  17. package/remote-component.cjs.mjs +2 -0
  18. package/remote-component.d.ts +1 -0
  19. package/remote-component.esm.js +139 -0
  20. package/results.cjs.js +2 -14
  21. package/results.esm.js +2 -12
  22. package/src/analytics.d.ts +2 -0
  23. package/src/collaboration-client.d.ts +1 -0
  24. package/src/index.d.ts +1 -0
  25. package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +24 -24
  26. package/src/lib/agent/middleware/strategy.interface.d.ts +4 -0
  27. package/src/lib/agent/runtime/capability.d.ts +2 -0
  28. package/src/lib/agent/runtime/cli-model-profile.d.ts +14 -1
  29. package/src/lib/agent/runtime/dispatch.d.ts +79 -79
  30. package/src/lib/agent/runtime/execution-runner.d.ts +19 -10
  31. package/src/lib/agent/runtime/pipeline-scope.d.ts +4 -4
  32. package/src/lib/agent/runtime/results.d.ts +14 -234
  33. package/src/lib/agent/runtime/types.d.ts +19 -0
  34. package/src/lib/agent-event/index.d.ts +89 -0
  35. package/src/lib/agent-event/journal.d.ts +30 -0
  36. package/src/lib/artifact-document/dependencies.d.ts +3 -3
  37. package/src/lib/artifact-document/protocol.d.ts +2 -2
  38. package/src/lib/artifact-document/scheduler.d.ts +3 -0
  39. package/src/lib/artifact-type/definition.schema.d.ts +11 -39
  40. package/src/lib/assistant-capability/middleware.d.ts +2 -1
  41. package/src/lib/channel/strategy.interface.d.ts +20 -0
  42. package/src/lib/collaboration/client.d.ts +6 -59
  43. package/src/lib/collaboration/index.d.ts +1 -0
  44. package/src/lib/collaboration/operations-client.d.ts +23 -0
  45. package/src/lib/collaboration/presence.d.ts +36 -0
  46. package/src/lib/collaboration/provider.registry.d.ts +2 -2
  47. package/src/lib/collaboration/transport.d.ts +24 -0
  48. package/src/lib/collaboration/types.d.ts +57 -5
  49. package/src/lib/content-resource/catalog.d.ts +40 -2
  50. package/src/lib/content-resource/editor.d.ts +36 -1
  51. package/src/lib/data/analytics/analysis-evidence.d.ts +757 -0
  52. package/src/lib/data/analytics/analytics-certification.d.ts +64 -0
  53. package/src/lib/data/analytics/analytics-provider.d.ts +9 -0
  54. package/src/lib/data/analytics/analytics-value.d.ts +5 -0
  55. package/src/lib/data/analytics/index.d.ts +1 -0
  56. package/src/lib/evolution/runtime-capability.d.ts +1 -0
  57. package/src/lib/project-pipeline/adapters.d.ts +9 -2
  58. package/src/lib/project-pipeline/registry.d.ts +59 -48
  59. package/src/lib/project-task/acceptance.d.ts +13 -1
  60. package/src/lib/project-task/index.d.ts +4 -2
  61. package/src/lib/runtime/capabilities/project-configuration.d.ts +2 -0
  62. package/src/lib/view-extension/index.d.ts +1 -0
  63. package/src/lib/view-extension/provider.interface.d.ts +51 -0
  64. package/src/lib/view-extension/workbench-decision.d.ts +10 -0
  65. package/src/remote-component.d.ts +13 -0
@@ -2,47 +2,7 @@
2
2
 
3
3
  var _extends = require('./_extends.cjs.js');
4
4
 
5
- function createSocketIoTransportAdapter(socket) {
6
- return {
7
- get connected () {
8
- return socket.connected;
9
- },
10
- get clientId () {
11
- var _socket_id;
12
- return (_socket_id = socket.id) != null ? _socket_id : null;
13
- },
14
- connect: ()=>{
15
- socket.connect();
16
- },
17
- disconnect: ()=>{
18
- socket.disconnect();
19
- },
20
- emit: (event, payload = {})=>{
21
- socket.emit(event, payload);
22
- },
23
- on: (event, handler)=>{
24
- socket.on(event, handler);
25
- return ()=>{
26
- socket.off(event, handler);
27
- };
28
- }
29
- };
30
- }
31
- /** Wrap a caller-owned `Y.Doc` without passing it across the runtime capability boundary. */ function createYjsDocumentAdapter(document, yjs) {
32
- return {
33
- applyUpdate: (update, origin)=>yjs.applyUpdate(document, update, origin),
34
- encodeStateVector: ()=>yjs.encodeStateVector(document),
35
- mergeUpdates: (updates)=>yjs.mergeUpdates(updates),
36
- onUpdate: (handler)=>{
37
- document.on('update', handler);
38
- return ()=>document.off('update', handler);
39
- }
40
- };
41
- }
42
- /**
43
- * Keep per-client sessions for cursors while exposing one collaborator per stable actor identity.
44
- * This prevents a second tab owned by the same user from either duplicating or hiding that user.
45
- */ function createCollaborationPresenceStore(options = {}) {
5
+ function createCollaborationPresenceStore(options = {}) {
46
6
  let selfClientId = null;
47
7
  let sessions = new Map();
48
8
  const readSnapshot = ()=>{
@@ -99,10 +59,179 @@ function createSocketIoTransportAdapter(socket) {
99
59
  snapshot: readSnapshot
100
60
  };
101
61
  }
62
+ function actorPresence(actor, clientId) {
63
+ return _extends._extends({}, actor, {
64
+ clientId: clientId != null ? clientId : `self:${actor.presenceId}`,
65
+ pageId: null,
66
+ pointer: null,
67
+ focus: null,
68
+ selection: null,
69
+ viewport: null,
70
+ mode: null,
71
+ status: null,
72
+ toolName: null,
73
+ operationLabel: null,
74
+ updatedAt: Date.now()
75
+ });
76
+ }
77
+ /** Parse untrusted presence payloads shared by both engines; document content is ignored. */ function parseCollaborationPresence(value) {
78
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
79
+ const item = value;
80
+ const clientId = stringValue$1('clientId' in item ? item.clientId : undefined);
81
+ const presenceId = stringValue$1('presenceId' in item ? item.presenceId : undefined);
82
+ const displayName = stringValue$1('displayName' in item ? item.displayName : undefined);
83
+ const color = stringValue$1('color' in item ? item.color : undefined);
84
+ const actorType = 'actorType' in item ? item.actorType : undefined;
85
+ if (!clientId || !presenceId || !displayName || !color || actorType !== 'user' && actorType !== 'agent' && actorType !== 'system') return null;
86
+ return {
87
+ clientId,
88
+ presenceId,
89
+ displayName,
90
+ color,
91
+ actorType,
92
+ avatarUrl: nullableString('avatarUrl' in item ? item.avatarUrl : undefined),
93
+ pageId: nullableString('pageId' in item ? item.pageId : undefined),
94
+ pointer: parsePointer('pointer' in item ? item.pointer : undefined),
95
+ focus: parseFocus('focus' in item ? item.focus : undefined),
96
+ selection: parseSelection('selection' in item ? item.selection : undefined),
97
+ viewport: parseViewport('viewport' in item ? item.viewport : undefined),
98
+ mode: nullableString('mode' in item ? item.mode : undefined),
99
+ status: actorStatus('status' in item ? item.status : undefined),
100
+ toolName: nullableString('toolName' in item ? item.toolName : undefined),
101
+ operationLabel: nullableString('operationLabel' in item ? item.operationLabel : undefined),
102
+ updatedAt: 'updatedAt' in item && typeof item.updatedAt === 'number' ? item.updatedAt : Date.now()
103
+ };
104
+ }
105
+ function parsePointer(value) {
106
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
107
+ const item = value;
108
+ if (!('x' in item) || typeof item.x !== 'number' || !('y' in item) || typeof item.y !== 'number') return null;
109
+ return {
110
+ pageId: nullableString('pageId' in item ? item.pageId : undefined),
111
+ x: item.x,
112
+ y: item.y,
113
+ visible: ('visible' in item ? item.visible : undefined) !== false
114
+ };
115
+ }
116
+ function parseFocus(value) {
117
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
118
+ const item = value;
119
+ const kind = stringValue$1('kind' in item ? item.kind : undefined);
120
+ if (!kind) return null;
121
+ return {
122
+ kind,
123
+ key: nullableString('key' in item ? item.key : undefined),
124
+ pageId: nullableString('pageId' in item ? item.pageId : undefined),
125
+ elementId: nullableString('elementId' in item ? item.elementId : undefined),
126
+ fieldKey: nullableString('fieldKey' in item ? item.fieldKey : undefined)
127
+ };
128
+ }
129
+ function parseSelection(value) {
130
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
131
+ const item = value;
132
+ const kind = 'kind' in item ? item.kind : undefined;
133
+ if (kind === 'cells') {
134
+ const cells = 'cells' in item ? item.cells : undefined;
135
+ if (!cells || typeof cells !== 'object' || !('sheetId' in cells) || typeof cells.sheetId !== 'string' || !cells.sheetId || cells.sheetId.length > 256 || !('startRow' in cells) || !('endRow' in cells) || !('startColumn' in cells) || !('endColumn' in cells)) return null;
136
+ const { sheetId, startRow, endRow, startColumn, endColumn } = cells;
137
+ if (typeof startRow !== 'number' || typeof endRow !== 'number' || typeof startColumn !== 'number' || typeof endColumn !== 'number' || ![
138
+ startRow,
139
+ endRow,
140
+ startColumn,
141
+ endColumn
142
+ ].every(Number.isSafeInteger) || startRow < 0 || startColumn < 0 || endRow < startRow || endColumn < startColumn || endRow > 1048575 || endColumn > 16383) return null;
143
+ const baseRevision = 'baseRevision' in cells ? cells.baseRevision : undefined;
144
+ if (baseRevision !== undefined && (typeof baseRevision !== 'number' || !Number.isSafeInteger(baseRevision) || baseRevision < 1)) return null;
145
+ return {
146
+ kind,
147
+ cells: _extends._extends({
148
+ sheetId,
149
+ startRow,
150
+ endRow,
151
+ startColumn,
152
+ endColumn
153
+ }, typeof baseRevision === 'number' ? {
154
+ baseRevision
155
+ } : {})
156
+ };
157
+ }
158
+ if (kind !== 'text' && kind !== 'elements') return null;
159
+ const elementIds = 'elementIds' in item ? item.elementIds : undefined;
160
+ return {
161
+ kind,
162
+ fieldKey: nullableString('fieldKey' in item ? item.fieldKey : undefined),
163
+ elementIds: Array.isArray(elementIds) ? elementIds.filter((entry)=>typeof entry === 'string') : null,
164
+ anchorRelativeBase64: nullableString('anchorRelativeBase64' in item ? item.anchorRelativeBase64 : undefined),
165
+ headRelativeBase64: nullableString('headRelativeBase64' in item ? item.headRelativeBase64 : undefined)
166
+ };
167
+ }
168
+ function parseViewport(value) {
169
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
170
+ const item = value;
171
+ if (!('zoom' in item) || typeof item.zoom !== 'number' || !('width' in item) || typeof item.width !== 'number' || !('height' in item) || typeof item.height !== 'number') return null;
172
+ return {
173
+ zoom: item.zoom,
174
+ width: item.width,
175
+ height: item.height
176
+ };
177
+ }
178
+ function stringValue$1(value) {
179
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
180
+ }
181
+ function nullableString(value) {
182
+ var _stringValue;
183
+ return (_stringValue = stringValue$1(value)) != null ? _stringValue : null;
184
+ }
185
+ function actorStatus(value) {
186
+ return value === 'thinking' || value === 'editing' || value === 'done' || value === 'failed' ? value : null;
187
+ }
188
+
189
+ /** Adapt a caller-owned Socket.IO client to the SDK's framework-neutral transport. */ function createSocketIoTransportAdapter(socket) {
190
+ return {
191
+ get connected () {
192
+ return socket.connected;
193
+ },
194
+ get clientId () {
195
+ var _socket_id;
196
+ return (_socket_id = socket.id) != null ? _socket_id : null;
197
+ },
198
+ connect: ()=>{
199
+ socket.connect();
200
+ },
201
+ disconnect: ()=>{
202
+ socket.disconnect();
203
+ },
204
+ emit: (event, payload = {})=>{
205
+ socket.emit(event, payload);
206
+ },
207
+ on: (event, handler)=>{
208
+ socket.on(event, handler);
209
+ return ()=>{
210
+ socket.off(event, handler);
211
+ };
212
+ }
213
+ };
214
+ }
215
+
216
+ /** Wrap a caller-owned `Y.Doc` without passing it across the runtime capability boundary. */ function createYjsDocumentAdapter(document, yjs) {
217
+ return {
218
+ applyUpdate: (update, origin)=>yjs.applyUpdate(document, update, origin),
219
+ encodeStateVector: ()=>yjs.encodeStateVector(document),
220
+ mergeUpdates: (updates)=>yjs.mergeUpdates(updates),
221
+ onUpdate: (handler)=>{
222
+ document.on('update', handler);
223
+ return ()=>document.off('update', handler);
224
+ }
225
+ };
226
+ }
102
227
  /**
103
- * Create a collaboration client with update batching, state-vector repair, presence heartbeat,
228
+ * Create a Yjs collaboration client with update batching, state-vector repair, presence heartbeat,
104
229
  * and reconnect synchronization. The caller retains ownership of the document and transport.
105
230
  */ function createCollaborationClient(options) {
231
+ // Legacy sessions omit engine and use Yjs; operations must use its notification client.
232
+ if (options.session.engine && options.session.engine !== 'yjs') {
233
+ throw new Error('Yjs collaboration protocol required');
234
+ }
106
235
  const remoteOrigin = Object.freeze({
107
236
  kind: 'platform.collaboration.remote'
108
237
  });
@@ -204,7 +333,7 @@ function createSocketIoTransportAdapter(socket) {
204
333
  }
205
334
  }));
206
335
  cleanups.push(options.transport.on('presence', (payload)=>{
207
- const item = parsePresence(payload);
336
+ const item = parseCollaborationPresence(payload);
208
337
  if (item) {
209
338
  presenceSeenAt.set(item.clientId, Date.now());
210
339
  options.onPresence == null ? void 0 : options.onPresence.call(options, item);
@@ -212,7 +341,7 @@ function createSocketIoTransportAdapter(socket) {
212
341
  }));
213
342
  cleanups.push(options.transport.on('presence-snapshot', (payload)=>{
214
343
  const rawItems = payload['items'];
215
- const items = Array.isArray(rawItems) ? rawItems.map(parsePresence).filter(isPresence) : [];
344
+ const items = Array.isArray(rawItems) ? rawItems.map(parseCollaborationPresence).filter(isPresence) : [];
216
345
  var _stringValue, _ref;
217
346
  selfClientId = (_ref = (_stringValue = stringValue(payload['selfClientId'])) != null ? _stringValue : options.transport.clientId) != null ? _ref : selfClientId;
218
347
  presenceSeenAt.clear();
@@ -278,21 +407,6 @@ function createSocketIoTransportAdapter(socket) {
278
407
  }
279
408
  };
280
409
  }
281
- function actorPresence(actor, clientId) {
282
- return _extends._extends({}, actor, {
283
- clientId: clientId != null ? clientId : `self:${actor.presenceId}`,
284
- pageId: null,
285
- pointer: null,
286
- focus: null,
287
- selection: null,
288
- viewport: null,
289
- mode: null,
290
- status: null,
291
- toolName: null,
292
- operationLabel: null,
293
- updatedAt: Date.now()
294
- });
295
- }
296
410
  /** Encode bytes in browsers without Node.js `Buffer`; chunks avoid argument-size limits. */ function bytesToBase64(bytes) {
297
411
  let binary = '';
298
412
  const chunkSize = 0x8000;
@@ -323,100 +437,120 @@ function parseAck(payload) {
323
437
  materializationStatus
324
438
  };
325
439
  }
326
- function parsePresence(value) {
327
- if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
328
- const item = value;
329
- const clientId = stringValue(item['clientId']);
330
- const presenceId = stringValue(item['presenceId']);
331
- const displayName = stringValue(item['displayName']);
332
- const color = stringValue(item['color']);
333
- const actorType = item['actorType'];
334
- if (!clientId || !presenceId || !displayName || !color || actorType !== 'user' && actorType !== 'agent' && actorType !== 'system') return null;
335
- return {
336
- clientId,
337
- presenceId,
338
- displayName,
339
- color,
340
- actorType,
341
- avatarUrl: nullableString(item['avatarUrl']),
342
- pageId: nullableString(item['pageId']),
343
- pointer: parsePointer(item['pointer']),
344
- focus: parseFocus(item['focus']),
345
- selection: parseSelection(item['selection']),
346
- viewport: parseViewport(item['viewport']),
347
- mode: nullableString(item['mode']),
348
- status: actorStatus(item['status']),
349
- toolName: nullableString(item['toolName']),
350
- operationLabel: nullableString(item['operationLabel']),
351
- updatedAt: typeof item['updatedAt'] === 'number' ? item['updatedAt'] : Date.now()
352
- };
353
- }
354
- function parsePointer(value) {
355
- const item = recordValue(value);
356
- if (!item || typeof item['x'] !== 'number' || typeof item['y'] !== 'number') return null;
357
- return {
358
- pageId: nullableString(item['pageId']),
359
- x: item['x'],
360
- y: item['y'],
361
- visible: item['visible'] !== false
362
- };
363
- }
364
- function parseFocus(value) {
365
- const item = recordValue(value);
366
- const kind = item && stringValue(item['kind']);
367
- if (!item || !kind) return null;
368
- return {
369
- kind,
370
- key: nullableString(item['key']),
371
- pageId: nullableString(item['pageId']),
372
- elementId: nullableString(item['elementId']),
373
- fieldKey: nullableString(item['fieldKey'])
374
- };
375
- }
376
- function parseSelection(value) {
377
- const item = recordValue(value);
378
- const kind = item == null ? void 0 : item['kind'];
379
- if (!item || kind !== 'text' && kind !== 'elements') return null;
380
- return {
381
- kind,
382
- fieldKey: nullableString(item['fieldKey']),
383
- elementIds: Array.isArray(item['elementIds']) ? item['elementIds'].filter((entry)=>typeof entry === 'string') : null,
384
- anchorRelativeBase64: nullableString(item['anchorRelativeBase64']),
385
- headRelativeBase64: nullableString(item['headRelativeBase64'])
386
- };
387
- }
388
- function parseViewport(value) {
389
- const item = recordValue(value);
390
- if (!item || typeof item['zoom'] !== 'number' || typeof item['width'] !== 'number' || typeof item['height'] !== 'number') return null;
391
- return {
392
- zoom: item['zoom'],
393
- width: item['width'],
394
- height: item['height']
395
- };
396
- }
397
- function recordValue(value) {
398
- return value && typeof value === 'object' && !Array.isArray(value) ? value : null;
399
- }
400
440
  function isPresence(value) {
401
441
  return value !== null;
402
442
  }
403
443
  function stringValue(value) {
404
444
  return typeof value === 'string' && value.trim() ? value.trim() : undefined;
405
445
  }
406
- function nullableString(value) {
407
- var _stringValue;
408
- return (_stringValue = stringValue(value)) != null ? _stringValue : null;
409
- }
410
- function actorStatus(value) {
411
- return value === 'thinking' || value === 'editing' || value === 'done' || value === 'failed' ? value : null;
412
- }
413
446
  function positiveInteger(value, fallback) {
414
447
  return Number.isFinite(value) && Number(value) > 0 ? Math.trunc(Number(value)) : fallback;
415
448
  }
416
449
 
450
+ /**
451
+ * Notification client for a domain-owned operation log, not an OT/CRDT implementation.
452
+ * The domain API owns writes, validation, conflict handling and persistence. This client
453
+ * only tracks committed revisions and ephemeral presence; it never submits business edits.
454
+ * Revisions coalesce to one high-water mark, so consumers must refetch authoritative state.
455
+ */ function createOperationCollaborationClient(options) {
456
+ if (options.session.engine !== 'operations') throw new Error('Operation collaboration protocol required');
457
+ const { transport, session } = options;
458
+ const presence = new Map();
459
+ let revision = -1, stopped = false, selfClientId = null;
460
+ let patch = {};
461
+ let presenceTimer;
462
+ const changed = ()=>options.onPresence([
463
+ ...presence.values()
464
+ ], selfClientId);
465
+ const addPresence = (value)=>{
466
+ const item = parseCollaborationPresence(value);
467
+ if (!item || presence.size >= 128 && !presence.has(item.clientId)) return;
468
+ presence.set(item.clientId, item);
469
+ };
470
+ // Repair missed invalidations on reconnect/periodic sync; no Yjs state vector is involved.
471
+ const sync = ()=>{
472
+ if (!stopped && transport.connected) transport.emit('sync-request', {});
473
+ };
474
+ const heartbeat = ()=>{
475
+ if (stopped) return;
476
+ if (Date.now() >= session.expiresAt) {
477
+ options.onError(new Error('Collaboration session expired'));
478
+ disconnect();
479
+ return;
480
+ }
481
+ if (transport.connected) transport.emit('presence', patch);
482
+ for (const [id, item] of presence)if (item.updatedAt < Date.now() - 15000) presence.delete(id);
483
+ changed();
484
+ };
485
+ const stops = [
486
+ transport.on('connect', ()=>{
487
+ var _transport_clientId;
488
+ selfClientId = (_transport_clientId = transport.clientId) != null ? _transport_clientId : null;
489
+ options.onConnection('connected');
490
+ sync();
491
+ heartbeat();
492
+ }),
493
+ transport.on('disconnect', ()=>{
494
+ presence.clear();
495
+ changed();
496
+ options.onConnection('disconnected');
497
+ }),
498
+ transport.on('revision', (value)=>{
499
+ if (value['documentId'] !== session.documentId || typeof value['revision'] !== 'number' || !Number.isSafeInteger(value['revision']) || value['revision'] < 0 || value['revision'] <= revision) return;
500
+ revision = value['revision'];
501
+ options.onRevision(revision);
502
+ }),
503
+ transport.on('presence-snapshot', (value)=>{
504
+ presence.clear();
505
+ var _transport_clientId;
506
+ selfClientId = typeof value['selfClientId'] === 'string' ? value['selfClientId'] : (_transport_clientId = transport.clientId) != null ? _transport_clientId : null;
507
+ if (Array.isArray(value['items'])) value['items'].slice(0, 128).forEach(addPresence);
508
+ changed();
509
+ }),
510
+ transport.on('presence', (value)=>{
511
+ addPresence(value);
512
+ changed();
513
+ }),
514
+ transport.on('presence-remove', (value)=>{
515
+ if (typeof value['clientId'] === 'string') presence.delete(value['clientId']);
516
+ changed();
517
+ }),
518
+ transport.on('error', (value)=>options.onError(new Error(typeof value['message'] === 'string' ? value['message'] : 'Collaboration disconnected')))
519
+ ];
520
+ const heartbeatTimer = setInterval(heartbeat, 5000), syncTimer = setInterval(sync, 15000);
521
+ function disconnect() {
522
+ if (stopped) return;
523
+ stopped = true;
524
+ clearInterval(heartbeatTimer);
525
+ clearInterval(syncTimer);
526
+ clearTimeout(presenceTimer);
527
+ stops.forEach((stop)=>stop());
528
+ transport.disconnect();
529
+ presence.clear();
530
+ changed();
531
+ options.onConnection('disconnected');
532
+ }
533
+ return {
534
+ connect () {
535
+ if (!stopped) transport.connect();
536
+ },
537
+ disconnect,
538
+ requestSync: sync,
539
+ setPresence (value) {
540
+ patch = value;
541
+ if (!stopped && !presenceTimer) presenceTimer = setTimeout(()=>{
542
+ presenceTimer = undefined;
543
+ if (transport.connected && !stopped) transport.emit('presence', patch);
544
+ }, 120);
545
+ }
546
+ };
547
+ }
548
+
417
549
  exports.base64ToBytes = base64ToBytes;
418
550
  exports.bytesToBase64 = bytesToBase64;
419
551
  exports.createCollaborationClient = createCollaborationClient;
420
552
  exports.createCollaborationPresenceStore = createCollaborationPresenceStore;
553
+ exports.createOperationCollaborationClient = createOperationCollaborationClient;
421
554
  exports.createSocketIoTransportAdapter = createSocketIoTransportAdapter;
422
555
  exports.createYjsDocumentAdapter = createYjsDocumentAdapter;
556
+ exports.parseCollaborationPresence = parseCollaborationPresence;