@particle-academy/agent-integrations 0.39.1 → 0.40.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.
@@ -1,5 +1,5 @@
1
- import { ShareControls, AgentCursor, AgentActivityHighlight, AgentPanel } from './chunk-QYWPCRT2.js';
2
- import { createSessionDescriptor, attachSseRelay } from './chunk-JDCB2NMM.js';
1
+ import { ShareControls, AgentCursor, AgentActivityHighlight, AgentPanel } from './chunk-QDC7MXBH.js';
2
+ import { createSessionDescriptor, attachSseRelay } from './chunk-6TZ5IBRN.js';
3
3
  import { attachInProcess } from './chunk-AFUULW5E.js';
4
4
  import { registerWhiteboardBridge } from './chunk-2U5JB6ZA.js';
5
5
  import './chunk-CT3LRNH7.js';
package/dist/index.cjs CHANGED
@@ -4887,9 +4887,9 @@ var SseRelayTransport = class {
4887
4887
  this.peers.add(subscriberId);
4888
4888
  this.notifyPeers();
4889
4889
  fancyAutoCommon.emitActivity({
4890
- agentId: "agent",
4891
- agentName: "Agent",
4892
- agentColor: "#a855f7",
4890
+ agentId: this.opts.agent?.id ?? "agent",
4891
+ agentName: this.opts.agent?.name ?? "Agent",
4892
+ agentColor: this.opts.agent?.color ?? "#a855f7",
4893
4893
  action: "agent_connected",
4894
4894
  timestamp: Date.now(),
4895
4895
  target: { kind: "navigation", label: "Agent connected" },
@@ -4903,9 +4903,9 @@ var SseRelayTransport = class {
4903
4903
  this.notifyPeers();
4904
4904
  if (this.peers.size === 0) {
4905
4905
  fancyAutoCommon.emitActivity({
4906
- agentId: "agent",
4907
- agentName: "Agent",
4908
- agentColor: "#a855f7",
4906
+ agentId: this.opts.agent?.id ?? "agent",
4907
+ agentName: this.opts.agent?.name ?? "Agent",
4908
+ agentColor: this.opts.agent?.color ?? "#a855f7",
4909
4909
  action: "agent_disconnected",
4910
4910
  timestamp: Date.now(),
4911
4911
  target: { kind: "navigation", label: "Agent disconnected" },
@@ -4928,6 +4928,15 @@ function attachSseRelay(server, options) {
4928
4928
  transport.start();
4929
4929
  Promise.resolve().then(() => (init_registry(), registry_exports)).then(({ onActivity: onActivity2 }) => {
4930
4930
  const off = onActivity2((event) => {
4931
+ if (options.activityFilter) {
4932
+ let keep;
4933
+ try {
4934
+ keep = options.activityFilter(event);
4935
+ } catch {
4936
+ return;
4937
+ }
4938
+ if (!keep) return;
4939
+ }
4931
4940
  transport.send({
4932
4941
  jsonrpc: "2.0",
4933
4942
  method: "notifications/agent_activity",
@@ -4991,7 +5000,13 @@ function useCoBrowseSession(options) {
4991
5000
  if (!response.ok) {
4992
5001
  throw new Error(`Relay registration failed (${response.status})`);
4993
5002
  }
4994
- const relay = attachSseRelay(server, { baseUrl: relayBaseUrl, sessionId: descriptor.id, token: descriptor.token });
5003
+ const relay = attachSseRelay(server, {
5004
+ baseUrl: relayBaseUrl,
5005
+ sessionId: descriptor.id,
5006
+ token: descriptor.token,
5007
+ agent: options.agent,
5008
+ activityFilter: options.activityFilter
5009
+ });
4995
5010
  relay.onStateChange(setRelayState);
4996
5011
  relay.onPeersChange(setAgentCount);
4997
5012
  relayRef.current = relay;