@xpert-ai/plugin-sdk 3.15.8 → 3.15.10
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/CHANGELOG.md +16 -0
- package/index.cjs.js +420 -0
- package/index.esm.js +411 -1
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/lib/collaboration/client.d.ts +118 -0
- package/src/lib/collaboration/index.d.ts +5 -0
- package/src/lib/collaboration/provider.decorator.d.ts +3 -0
- package/src/lib/collaboration/provider.registry.d.ts +7 -0
- package/src/lib/collaboration/runtime-capability.d.ts +3 -0
- package/src/lib/collaboration/types.d.ts +190 -0
- package/src/lib/runtime/capabilities/artifacts.d.ts +163 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @xpert-ai/plugin-sdk
|
|
2
2
|
|
|
3
|
+
## 3.15.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c9d8401: collaboration & artifacts
|
|
8
|
+
- Updated dependencies [c9d8401]
|
|
9
|
+
- @xpert-ai/contracts@3.15.10
|
|
10
|
+
|
|
11
|
+
## 3.15.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 601438f: fix org membership plan
|
|
16
|
+
- Updated dependencies [601438f]
|
|
17
|
+
- @xpert-ai/contracts@3.15.9
|
|
18
|
+
|
|
3
19
|
## 3.15.8
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/index.cjs.js
CHANGED
|
@@ -2795,6 +2795,10 @@ const KnowledgebaseDocumentsRuntimeCapability = createRuntimeCapability('platfor
|
|
|
2795
2795
|
description: 'Upload, import, create, process, inspect, and delete persistent knowledgebase documents.'
|
|
2796
2796
|
});
|
|
2797
2797
|
|
|
2798
|
+
const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts', {
|
|
2799
|
+
description: 'Create, version, preview, download, share, archive, and delete platform-managed plugin and Agent artifacts.'
|
|
2800
|
+
});
|
|
2801
|
+
|
|
2798
2802
|
/** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
|
|
2799
2803
|
const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
|
|
2800
2804
|
description: 'Upload, understand, read, and delete raw files in Xpert workspace volumes.'
|
|
@@ -4686,6 +4690,412 @@ function escapeInlineScript(value) {
|
|
|
4686
4690
|
|
|
4687
4691
|
const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
|
|
4688
4692
|
|
|
4693
|
+
/** Platform-owned real-time collaboration capability available to scoped plugin runtimes. */ const CollaborationRuntimeCapability = createRuntimeCapability('platform.collaboration', {
|
|
4694
|
+
description: 'Create, synchronize, persist, authorize, and observe platform-managed real-time collaboration documents.'
|
|
4695
|
+
});
|
|
4696
|
+
|
|
4697
|
+
const COLLABORATION_DOCUMENT_PROVIDER = 'COLLABORATION_DOCUMENT_PROVIDER';
|
|
4698
|
+
/** Register a plugin adapter for one stable collaboration resource type. */ const CollaborationDocumentProvider = (providerKey)=>common.applyDecorators(common.SetMetadata(COLLABORATION_DOCUMENT_PROVIDER, providerKey), common.SetMetadata(STRATEGY_META_KEY, COLLABORATION_DOCUMENT_PROVIDER));
|
|
4699
|
+
|
|
4700
|
+
/** Discovers system and organization-scoped collaboration providers from loaded plugins. */ exports.CollaborationDocumentProviderRegistry = class CollaborationDocumentProviderRegistry extends BaseStrategyRegistry {
|
|
4701
|
+
constructor(discoveryService, reflector){
|
|
4702
|
+
super(COLLABORATION_DOCUMENT_PROVIDER, discoveryService, reflector);
|
|
4703
|
+
}
|
|
4704
|
+
};
|
|
4705
|
+
exports.CollaborationDocumentProviderRegistry = __decorate([
|
|
4706
|
+
common.Injectable(),
|
|
4707
|
+
__metadata("design:paramtypes", [
|
|
4708
|
+
core.DiscoveryService,
|
|
4709
|
+
core.Reflector
|
|
4710
|
+
])
|
|
4711
|
+
], exports.CollaborationDocumentProviderRegistry);
|
|
4712
|
+
|
|
4713
|
+
function createSocketIoTransportAdapter(socket) {
|
|
4714
|
+
return {
|
|
4715
|
+
get connected () {
|
|
4716
|
+
return socket.connected;
|
|
4717
|
+
},
|
|
4718
|
+
get clientId () {
|
|
4719
|
+
var _socket_id;
|
|
4720
|
+
return (_socket_id = socket.id) != null ? _socket_id : null;
|
|
4721
|
+
},
|
|
4722
|
+
connect: ()=>{
|
|
4723
|
+
socket.connect();
|
|
4724
|
+
},
|
|
4725
|
+
disconnect: ()=>{
|
|
4726
|
+
socket.disconnect();
|
|
4727
|
+
},
|
|
4728
|
+
emit: (event, payload = {})=>{
|
|
4729
|
+
socket.emit(event, payload);
|
|
4730
|
+
},
|
|
4731
|
+
on: (event, handler)=>{
|
|
4732
|
+
socket.on(event, handler);
|
|
4733
|
+
return ()=>{
|
|
4734
|
+
socket.off(event, handler);
|
|
4735
|
+
};
|
|
4736
|
+
}
|
|
4737
|
+
};
|
|
4738
|
+
}
|
|
4739
|
+
/** Wrap a caller-owned `Y.Doc` without passing it across the runtime capability boundary. */ function createYjsDocumentAdapter(document, yjs) {
|
|
4740
|
+
return {
|
|
4741
|
+
applyUpdate: (update, origin)=>yjs.applyUpdate(document, update, origin),
|
|
4742
|
+
encodeStateVector: ()=>yjs.encodeStateVector(document),
|
|
4743
|
+
mergeUpdates: (updates)=>yjs.mergeUpdates(updates),
|
|
4744
|
+
onUpdate: (handler)=>{
|
|
4745
|
+
document.on('update', handler);
|
|
4746
|
+
return ()=>document.off('update', handler);
|
|
4747
|
+
}
|
|
4748
|
+
};
|
|
4749
|
+
}
|
|
4750
|
+
/**
|
|
4751
|
+
* Keep per-client sessions for cursors while exposing one collaborator per stable actor identity.
|
|
4752
|
+
* This prevents a second tab owned by the same user from either duplicating or hiding that user.
|
|
4753
|
+
*/ function createCollaborationPresenceStore(options = {}) {
|
|
4754
|
+
let selfClientId = null;
|
|
4755
|
+
let sessions = new Map();
|
|
4756
|
+
const readSnapshot = ()=>{
|
|
4757
|
+
const activeSessions = Array.from(sessions.values()).sort((left, right)=>right.updatedAt - left.updatedAt);
|
|
4758
|
+
const remoteSessions = activeSessions.filter((item)=>item.clientId !== selfClientId);
|
|
4759
|
+
const actors = new Map();
|
|
4760
|
+
for (const item of activeSessions)if (!actors.has(item.presenceId)) actors.set(item.presenceId, item);
|
|
4761
|
+
if (options.includeSelf !== false && options.selfActor) {
|
|
4762
|
+
const existing = activeSessions.find((item)=>{
|
|
4763
|
+
var _options_selfActor;
|
|
4764
|
+
return item.clientId === selfClientId || item.presenceId === ((_options_selfActor = options.selfActor) == null ? void 0 : _options_selfActor.presenceId);
|
|
4765
|
+
});
|
|
4766
|
+
actors.set(options.selfActor.presenceId, existing != null ? existing : actorPresence(options.selfActor, selfClientId));
|
|
4767
|
+
}
|
|
4768
|
+
const collaborators = Array.from(actors.values()).sort((left, right)=>{
|
|
4769
|
+
var _options_selfActor, _options_selfActor1;
|
|
4770
|
+
const leftSelf = left.presenceId === ((_options_selfActor = options.selfActor) == null ? void 0 : _options_selfActor.presenceId) ? 1 : 0;
|
|
4771
|
+
const rightSelf = right.presenceId === ((_options_selfActor1 = options.selfActor) == null ? void 0 : _options_selfActor1.presenceId) ? 1 : 0;
|
|
4772
|
+
return rightSelf - leftSelf || right.updatedAt - left.updatedAt;
|
|
4773
|
+
});
|
|
4774
|
+
return {
|
|
4775
|
+
selfClientId,
|
|
4776
|
+
sessions: activeSessions,
|
|
4777
|
+
remoteSessions,
|
|
4778
|
+
collaborators
|
|
4779
|
+
};
|
|
4780
|
+
};
|
|
4781
|
+
const publish = ()=>options.onChange == null ? void 0 : options.onChange.call(options, readSnapshot());
|
|
4782
|
+
return {
|
|
4783
|
+
setSelfClientId: (clientId)=>{
|
|
4784
|
+
selfClientId = clientId;
|
|
4785
|
+
publish();
|
|
4786
|
+
},
|
|
4787
|
+
replace: (items, clientId = selfClientId)=>{
|
|
4788
|
+
selfClientId = clientId;
|
|
4789
|
+
sessions = new Map(items.map((item)=>[
|
|
4790
|
+
item.clientId,
|
|
4791
|
+
item
|
|
4792
|
+
]));
|
|
4793
|
+
publish();
|
|
4794
|
+
},
|
|
4795
|
+
upsert: (item)=>{
|
|
4796
|
+
sessions.set(item.clientId, item);
|
|
4797
|
+
publish();
|
|
4798
|
+
},
|
|
4799
|
+
remove: (clientId)=>{
|
|
4800
|
+
if (sessions.delete(clientId)) publish();
|
|
4801
|
+
},
|
|
4802
|
+
clear: ()=>{
|
|
4803
|
+
sessions.clear();
|
|
4804
|
+
selfClientId = null;
|
|
4805
|
+
publish();
|
|
4806
|
+
},
|
|
4807
|
+
snapshot: readSnapshot
|
|
4808
|
+
};
|
|
4809
|
+
}
|
|
4810
|
+
/**
|
|
4811
|
+
* Create a collaboration client with update batching, state-vector repair, presence heartbeat,
|
|
4812
|
+
* and reconnect synchronization. The caller retains ownership of the document and transport.
|
|
4813
|
+
*/ function createCollaborationClient(options) {
|
|
4814
|
+
const remoteOrigin = Object.freeze({
|
|
4815
|
+
kind: 'platform.collaboration.remote'
|
|
4816
|
+
});
|
|
4817
|
+
const batchMs = positiveInteger(options.batchMs, 40);
|
|
4818
|
+
const syncIntervalMs = positiveInteger(options.syncIntervalMs, 2000);
|
|
4819
|
+
const presenceHeartbeatMs = positiveInteger(options.presenceHeartbeatMs, 5000);
|
|
4820
|
+
const presenceStaleMs = positiveInteger(options.presenceStaleMs, 15000);
|
|
4821
|
+
var _options_initialPresence;
|
|
4822
|
+
let presence = _extends({}, (_options_initialPresence = options.initialPresence) != null ? _options_initialPresence : {});
|
|
4823
|
+
let pending = [];
|
|
4824
|
+
let flushTimer;
|
|
4825
|
+
let syncTimer;
|
|
4826
|
+
let presenceTimer;
|
|
4827
|
+
let presenceCleanupTimer;
|
|
4828
|
+
var _options_transport_clientId;
|
|
4829
|
+
let selfClientId = (_options_transport_clientId = options.transport.clientId) != null ? _options_transport_clientId : null;
|
|
4830
|
+
let started = false;
|
|
4831
|
+
const cleanups = [];
|
|
4832
|
+
const presenceSeenAt = new Map();
|
|
4833
|
+
const reportError = (error)=>options.onError == null ? void 0 : options.onError.call(options, error instanceof Error ? error : new Error(String(error)));
|
|
4834
|
+
const emitPresence = ()=>options.transport.emit('presence', _extends({}, presence));
|
|
4835
|
+
// Merge the short burst of local Yjs transactions into one network update.
|
|
4836
|
+
const flush = ()=>{
|
|
4837
|
+
if (flushTimer) clearTimeout(flushTimer);
|
|
4838
|
+
flushTimer = undefined;
|
|
4839
|
+
if (!pending.length || !options.transport.connected) return;
|
|
4840
|
+
const updates = pending;
|
|
4841
|
+
pending = [];
|
|
4842
|
+
options.transport.emit('update', {
|
|
4843
|
+
updateBase64: bytesToBase64(options.document.mergeUpdates(updates)),
|
|
4844
|
+
origin: 'plugin-client'
|
|
4845
|
+
});
|
|
4846
|
+
};
|
|
4847
|
+
// A state vector lets the server return only bytes missing from this client.
|
|
4848
|
+
const requestSync = ()=>{
|
|
4849
|
+
if (!options.transport.connected) return;
|
|
4850
|
+
options.transport.emit('sync-request', {
|
|
4851
|
+
stateVectorBase64: bytesToBase64(options.document.encodeStateVector())
|
|
4852
|
+
});
|
|
4853
|
+
};
|
|
4854
|
+
// Mark server updates with `remoteOrigin` so the document observer does not send them back.
|
|
4855
|
+
const applyRemote = (payload)=>{
|
|
4856
|
+
const encoded = stringValue(payload['updateBase64']);
|
|
4857
|
+
if (!encoded) return;
|
|
4858
|
+
try {
|
|
4859
|
+
options.document.applyUpdate(base64ToBytes(encoded), remoteOrigin);
|
|
4860
|
+
} catch (error) {
|
|
4861
|
+
reportError(error);
|
|
4862
|
+
}
|
|
4863
|
+
};
|
|
4864
|
+
// Register listeners once, then start repair and presence heartbeats before opening the socket.
|
|
4865
|
+
const connect = ()=>{
|
|
4866
|
+
if (started) return;
|
|
4867
|
+
started = true;
|
|
4868
|
+
options.onConnectionChange == null ? void 0 : options.onConnectionChange.call(options, 'connecting');
|
|
4869
|
+
cleanups.push(options.document.onUpdate((update, origin)=>{
|
|
4870
|
+
if (origin === remoteOrigin) return;
|
|
4871
|
+
pending.push(update);
|
|
4872
|
+
if (!flushTimer) flushTimer = setTimeout(flush, batchMs);
|
|
4873
|
+
}));
|
|
4874
|
+
cleanups.push(options.transport.on('connect', ()=>{
|
|
4875
|
+
var _options_transport_clientId;
|
|
4876
|
+
selfClientId = (_options_transport_clientId = options.transport.clientId) != null ? _options_transport_clientId : selfClientId;
|
|
4877
|
+
options.onConnectionChange == null ? void 0 : options.onConnectionChange.call(options, 'connected');
|
|
4878
|
+
requestSync();
|
|
4879
|
+
emitPresence();
|
|
4880
|
+
}));
|
|
4881
|
+
cleanups.push(options.transport.on('disconnect', ()=>options.onConnectionChange == null ? void 0 : options.onConnectionChange.call(options, 'disconnected')));
|
|
4882
|
+
cleanups.push(options.transport.on('sync', applyRemote));
|
|
4883
|
+
cleanups.push(options.transport.on('update', applyRemote));
|
|
4884
|
+
cleanups.push(options.transport.on('update-ack', (payload)=>{
|
|
4885
|
+
const ack = parseAck(payload);
|
|
4886
|
+
if (ack) options.onAck == null ? void 0 : options.onAck.call(options, ack);
|
|
4887
|
+
}));
|
|
4888
|
+
cleanups.push(options.transport.on('presence', (payload)=>{
|
|
4889
|
+
const item = parsePresence(payload);
|
|
4890
|
+
if (item) {
|
|
4891
|
+
presenceSeenAt.set(item.clientId, Date.now());
|
|
4892
|
+
options.onPresence == null ? void 0 : options.onPresence.call(options, item);
|
|
4893
|
+
}
|
|
4894
|
+
}));
|
|
4895
|
+
cleanups.push(options.transport.on('presence-snapshot', (payload)=>{
|
|
4896
|
+
const rawItems = payload['items'];
|
|
4897
|
+
const items = Array.isArray(rawItems) ? rawItems.map(parsePresence).filter(isPresence) : [];
|
|
4898
|
+
var _stringValue, _ref;
|
|
4899
|
+
selfClientId = (_ref = (_stringValue = stringValue(payload['selfClientId'])) != null ? _stringValue : options.transport.clientId) != null ? _ref : selfClientId;
|
|
4900
|
+
presenceSeenAt.clear();
|
|
4901
|
+
for (const item of items)presenceSeenAt.set(item.clientId, Date.now());
|
|
4902
|
+
options.onPresenceSnapshot == null ? void 0 : options.onPresenceSnapshot.call(options, items, {
|
|
4903
|
+
selfClientId
|
|
4904
|
+
});
|
|
4905
|
+
}));
|
|
4906
|
+
cleanups.push(options.transport.on('presence-remove', (payload)=>{
|
|
4907
|
+
const clientId = stringValue(payload['clientId']);
|
|
4908
|
+
if (clientId) {
|
|
4909
|
+
presenceSeenAt.delete(clientId);
|
|
4910
|
+
options.onPresenceRemove == null ? void 0 : options.onPresenceRemove.call(options, clientId);
|
|
4911
|
+
}
|
|
4912
|
+
}));
|
|
4913
|
+
cleanups.push(options.transport.on('error', (payload)=>{
|
|
4914
|
+
var _stringValue;
|
|
4915
|
+
return reportError((_stringValue = stringValue(payload['message'])) != null ? _stringValue : 'Collaboration failed.');
|
|
4916
|
+
}));
|
|
4917
|
+
syncTimer = setInterval(requestSync, syncIntervalMs);
|
|
4918
|
+
presenceTimer = setInterval(emitPresence, presenceHeartbeatMs);
|
|
4919
|
+
presenceCleanupTimer = setInterval(()=>{
|
|
4920
|
+
const cutoff = Date.now() - presenceStaleMs;
|
|
4921
|
+
for (const [clientId, seenAt] of presenceSeenAt){
|
|
4922
|
+
if (clientId === selfClientId || seenAt >= cutoff) continue;
|
|
4923
|
+
presenceSeenAt.delete(clientId);
|
|
4924
|
+
options.onPresenceRemove == null ? void 0 : options.onPresenceRemove.call(options, clientId);
|
|
4925
|
+
}
|
|
4926
|
+
}, Math.min(5000, Math.max(1000, Math.floor(presenceStaleMs / 3))));
|
|
4927
|
+
options.transport.connect();
|
|
4928
|
+
};
|
|
4929
|
+
// Flush best-effort pending state and release all timers/listeners owned by this client.
|
|
4930
|
+
const disconnect = ()=>{
|
|
4931
|
+
var _cleanups_pop;
|
|
4932
|
+
if (!started) return;
|
|
4933
|
+
flush();
|
|
4934
|
+
started = false;
|
|
4935
|
+
if (flushTimer) clearTimeout(flushTimer);
|
|
4936
|
+
if (syncTimer) clearInterval(syncTimer);
|
|
4937
|
+
if (presenceTimer) clearInterval(presenceTimer);
|
|
4938
|
+
if (presenceCleanupTimer) clearInterval(presenceCleanupTimer);
|
|
4939
|
+
flushTimer = undefined;
|
|
4940
|
+
syncTimer = undefined;
|
|
4941
|
+
presenceTimer = undefined;
|
|
4942
|
+
presenceCleanupTimer = undefined;
|
|
4943
|
+
presenceSeenAt.clear();
|
|
4944
|
+
while(cleanups.length)(_cleanups_pop = cleanups.pop()) == null ? void 0 : _cleanups_pop();
|
|
4945
|
+
options.transport.disconnect();
|
|
4946
|
+
options.onConnectionChange == null ? void 0 : options.onConnectionChange.call(options, 'disconnected');
|
|
4947
|
+
};
|
|
4948
|
+
return {
|
|
4949
|
+
get selfClientId () {
|
|
4950
|
+
return selfClientId;
|
|
4951
|
+
},
|
|
4952
|
+
remoteOrigin,
|
|
4953
|
+
connect,
|
|
4954
|
+
disconnect,
|
|
4955
|
+
flush,
|
|
4956
|
+
requestSync,
|
|
4957
|
+
setPresence: (patch)=>{
|
|
4958
|
+
presence = _extends({}, presence, patch);
|
|
4959
|
+
if (options.transport.connected) emitPresence();
|
|
4960
|
+
}
|
|
4961
|
+
};
|
|
4962
|
+
}
|
|
4963
|
+
function actorPresence(actor, clientId) {
|
|
4964
|
+
return _extends({}, actor, {
|
|
4965
|
+
clientId: clientId != null ? clientId : `self:${actor.presenceId}`,
|
|
4966
|
+
pageId: null,
|
|
4967
|
+
pointer: null,
|
|
4968
|
+
focus: null,
|
|
4969
|
+
selection: null,
|
|
4970
|
+
viewport: null,
|
|
4971
|
+
mode: null,
|
|
4972
|
+
status: null,
|
|
4973
|
+
toolName: null,
|
|
4974
|
+
operationLabel: null,
|
|
4975
|
+
updatedAt: Date.now()
|
|
4976
|
+
});
|
|
4977
|
+
}
|
|
4978
|
+
/** Encode bytes in browsers without Node.js `Buffer`; chunks avoid argument-size limits. */ function bytesToBase64(bytes) {
|
|
4979
|
+
let binary = '';
|
|
4980
|
+
const chunkSize = 0x8000;
|
|
4981
|
+
for(let offset = 0; offset < bytes.length; offset += chunkSize){
|
|
4982
|
+
binary += String.fromCharCode(...bytes.subarray(offset, Math.min(offset + chunkSize, bytes.length)));
|
|
4983
|
+
}
|
|
4984
|
+
return globalThis.btoa(binary);
|
|
4985
|
+
}
|
|
4986
|
+
/** Decode base64 in browsers without requiring Node.js polyfills. */ function base64ToBytes(value) {
|
|
4987
|
+
const binary = globalThis.atob(value);
|
|
4988
|
+
const bytes = new Uint8Array(binary.length);
|
|
4989
|
+
for(let index = 0; index < binary.length; index += 1)bytes[index] = binary.charCodeAt(index);
|
|
4990
|
+
return bytes;
|
|
4991
|
+
}
|
|
4992
|
+
function parseAck(payload) {
|
|
4993
|
+
const documentId = stringValue(payload['documentId']);
|
|
4994
|
+
const stateVectorBase64 = stringValue(payload['stateVectorBase64']);
|
|
4995
|
+
const sequenceNumber = payload['sequenceNumber'];
|
|
4996
|
+
if (!documentId || !stateVectorBase64 || typeof sequenceNumber !== 'number') return null;
|
|
4997
|
+
const materializationStatus = payload['materializationStatus'];
|
|
4998
|
+
if (materializationStatus !== 'ready' && materializationStatus !== 'pending' && materializationStatus !== 'failed') return null;
|
|
4999
|
+
return {
|
|
5000
|
+
documentId,
|
|
5001
|
+
duplicate: payload['duplicate'] === true,
|
|
5002
|
+
sequenceNumber,
|
|
5003
|
+
updateId: stringValue(payload['updateId']),
|
|
5004
|
+
stateVectorBase64,
|
|
5005
|
+
materializationStatus
|
|
5006
|
+
};
|
|
5007
|
+
}
|
|
5008
|
+
function parsePresence(value) {
|
|
5009
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
|
5010
|
+
const item = value;
|
|
5011
|
+
const clientId = stringValue(item['clientId']);
|
|
5012
|
+
const presenceId = stringValue(item['presenceId']);
|
|
5013
|
+
const displayName = stringValue(item['displayName']);
|
|
5014
|
+
const color = stringValue(item['color']);
|
|
5015
|
+
const actorType = item['actorType'];
|
|
5016
|
+
if (!clientId || !presenceId || !displayName || !color || actorType !== 'user' && actorType !== 'agent' && actorType !== 'system') return null;
|
|
5017
|
+
return {
|
|
5018
|
+
clientId,
|
|
5019
|
+
presenceId,
|
|
5020
|
+
displayName,
|
|
5021
|
+
color,
|
|
5022
|
+
actorType,
|
|
5023
|
+
avatarUrl: nullableString(item['avatarUrl']),
|
|
5024
|
+
pageId: nullableString(item['pageId']),
|
|
5025
|
+
pointer: parsePointer(item['pointer']),
|
|
5026
|
+
focus: parseFocus(item['focus']),
|
|
5027
|
+
selection: parseSelection(item['selection']),
|
|
5028
|
+
viewport: parseViewport(item['viewport']),
|
|
5029
|
+
mode: nullableString(item['mode']),
|
|
5030
|
+
status: actorStatus(item['status']),
|
|
5031
|
+
toolName: nullableString(item['toolName']),
|
|
5032
|
+
operationLabel: nullableString(item['operationLabel']),
|
|
5033
|
+
updatedAt: typeof item['updatedAt'] === 'number' ? item['updatedAt'] : Date.now()
|
|
5034
|
+
};
|
|
5035
|
+
}
|
|
5036
|
+
function parsePointer(value) {
|
|
5037
|
+
const item = recordValue(value);
|
|
5038
|
+
if (!item || typeof item['x'] !== 'number' || typeof item['y'] !== 'number') return null;
|
|
5039
|
+
return {
|
|
5040
|
+
pageId: nullableString(item['pageId']),
|
|
5041
|
+
x: item['x'],
|
|
5042
|
+
y: item['y'],
|
|
5043
|
+
visible: item['visible'] !== false
|
|
5044
|
+
};
|
|
5045
|
+
}
|
|
5046
|
+
function parseFocus(value) {
|
|
5047
|
+
const item = recordValue(value);
|
|
5048
|
+
const kind = item && stringValue(item['kind']);
|
|
5049
|
+
if (!item || !kind) return null;
|
|
5050
|
+
return {
|
|
5051
|
+
kind,
|
|
5052
|
+
key: nullableString(item['key']),
|
|
5053
|
+
pageId: nullableString(item['pageId']),
|
|
5054
|
+
elementId: nullableString(item['elementId']),
|
|
5055
|
+
fieldKey: nullableString(item['fieldKey'])
|
|
5056
|
+
};
|
|
5057
|
+
}
|
|
5058
|
+
function parseSelection(value) {
|
|
5059
|
+
const item = recordValue(value);
|
|
5060
|
+
const kind = item == null ? void 0 : item['kind'];
|
|
5061
|
+
if (!item || kind !== 'text' && kind !== 'elements') return null;
|
|
5062
|
+
return {
|
|
5063
|
+
kind,
|
|
5064
|
+
fieldKey: nullableString(item['fieldKey']),
|
|
5065
|
+
elementIds: Array.isArray(item['elementIds']) ? item['elementIds'].filter((entry)=>typeof entry === 'string') : null,
|
|
5066
|
+
anchorRelativeBase64: nullableString(item['anchorRelativeBase64']),
|
|
5067
|
+
headRelativeBase64: nullableString(item['headRelativeBase64'])
|
|
5068
|
+
};
|
|
5069
|
+
}
|
|
5070
|
+
function parseViewport(value) {
|
|
5071
|
+
const item = recordValue(value);
|
|
5072
|
+
if (!item || typeof item['zoom'] !== 'number' || typeof item['width'] !== 'number' || typeof item['height'] !== 'number') return null;
|
|
5073
|
+
return {
|
|
5074
|
+
zoom: item['zoom'],
|
|
5075
|
+
width: item['width'],
|
|
5076
|
+
height: item['height']
|
|
5077
|
+
};
|
|
5078
|
+
}
|
|
5079
|
+
function recordValue(value) {
|
|
5080
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : null;
|
|
5081
|
+
}
|
|
5082
|
+
function isPresence(value) {
|
|
5083
|
+
return value !== null;
|
|
5084
|
+
}
|
|
5085
|
+
function stringValue(value) {
|
|
5086
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
5087
|
+
}
|
|
5088
|
+
function nullableString(value) {
|
|
5089
|
+
var _stringValue;
|
|
5090
|
+
return (_stringValue = stringValue(value)) != null ? _stringValue : null;
|
|
5091
|
+
}
|
|
5092
|
+
function actorStatus(value) {
|
|
5093
|
+
return value === 'thinking' || value === 'editing' || value === 'done' || value === 'failed' ? value : null;
|
|
5094
|
+
}
|
|
5095
|
+
function positiveInteger(value, fallback) {
|
|
5096
|
+
return Number.isFinite(value) && Number(value) > 0 ? Math.trunc(Number(value)) : fallback;
|
|
5097
|
+
}
|
|
5098
|
+
|
|
4689
5099
|
Object.defineProperty(exports, "ASSISTANT_CHAT_SEND_MESSAGE_COMMAND", {
|
|
4690
5100
|
enumerable: true,
|
|
4691
5101
|
get: function () { return contracts.ASSISTANT_CHAT_SEND_MESSAGE_COMMAND; }
|
|
@@ -4704,6 +5114,7 @@ exports.ANALYTICS_PERMISSION_SERVICE_TOKEN = ANALYTICS_PERMISSION_SERVICE_TOKEN;
|
|
|
4704
5114
|
exports.AdapterDataSourceStrategy = AdapterDataSourceStrategy;
|
|
4705
5115
|
exports.AgentMiddlewareStrategy = AgentMiddlewareStrategy;
|
|
4706
5116
|
exports.AiModelNotFoundException = AiModelNotFoundException;
|
|
5117
|
+
exports.ArtifactsRuntimeCapability = ArtifactsRuntimeCapability;
|
|
4707
5118
|
exports.AssistantTaskRuntimeCapability = AssistantTaskRuntimeCapability;
|
|
4708
5119
|
exports.BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN = BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN;
|
|
4709
5120
|
exports.BUILTIN_GLOBAL_SCOPE = BUILTIN_GLOBAL_SCOPE;
|
|
@@ -4717,11 +5128,14 @@ exports.BaseToolset = BaseToolset;
|
|
|
4717
5128
|
exports.BuiltinToolset = BuiltinToolset;
|
|
4718
5129
|
exports.CHAT_CHANNEL = CHAT_CHANNEL;
|
|
4719
5130
|
exports.CHAT_CHANNEL_TEXT_LIMITS = CHAT_CHANNEL_TEXT_LIMITS;
|
|
5131
|
+
exports.COLLABORATION_DOCUMENT_PROVIDER = COLLABORATION_DOCUMENT_PROVIDER;
|
|
4720
5132
|
exports.CONNECTION_COMMAND_ROUTER_TOKEN = CONNECTION_COMMAND_ROUTER_TOKEN;
|
|
4721
5133
|
exports.CONNECTOR_STRATEGY = CONNECTOR_STRATEGY;
|
|
4722
5134
|
exports.CancelConversationCommand = CancelConversationCommand;
|
|
4723
5135
|
exports.ChatChannel = ChatChannel;
|
|
4724
5136
|
exports.ChatOAICompatReasoningModel = ChatOAICompatReasoningModel;
|
|
5137
|
+
exports.CollaborationDocumentProvider = CollaborationDocumentProvider;
|
|
5138
|
+
exports.CollaborationRuntimeCapability = CollaborationRuntimeCapability;
|
|
4725
5139
|
exports.CommonParameterRules = CommonParameterRules;
|
|
4726
5140
|
exports.ConnectorRuntimeCapability = ConnectorRuntimeCapability;
|
|
4727
5141
|
exports.ConnectorStrategyKey = ConnectorStrategyKey;
|
|
@@ -4834,13 +5248,19 @@ exports.XpFileSystem = XpFileSystem;
|
|
|
4834
5248
|
exports.XpertServerPlugin = XpertServerPlugin;
|
|
4835
5249
|
exports.als = als;
|
|
4836
5250
|
exports.appendSandboxMessage = appendSandboxMessage;
|
|
5251
|
+
exports.base64ToBytes = base64ToBytes;
|
|
4837
5252
|
exports.buildSandboxTimeoutMessage = buildSandboxTimeoutMessage;
|
|
5253
|
+
exports.bytesToBase64 = bytesToBase64;
|
|
4838
5254
|
exports.calcTokenUsage = calcTokenUsage;
|
|
4839
5255
|
exports.chunkText = chunkText;
|
|
4840
5256
|
exports.countTokensSafe = countTokensSafe;
|
|
5257
|
+
exports.createCollaborationClient = createCollaborationClient;
|
|
5258
|
+
exports.createCollaborationPresenceStore = createCollaborationPresenceStore;
|
|
4841
5259
|
exports.createI18nInstance = createI18nInstance;
|
|
4842
5260
|
exports.createPluginLogger = createPluginLogger;
|
|
4843
5261
|
exports.createRuntimeCapability = createRuntimeCapability;
|
|
5262
|
+
exports.createSocketIoTransportAdapter = createSocketIoTransportAdapter;
|
|
5263
|
+
exports.createYjsDocumentAdapter = createYjsDocumentAdapter;
|
|
4844
5264
|
exports.defineAgentMessageType = defineAgentMessageType;
|
|
4845
5265
|
exports.defineChannelMessageType = defineChannelMessageType;
|
|
4846
5266
|
exports.derivePluginArtifactNamespace = derivePluginArtifactNamespace;
|