@copilotkit/react-core 1.56.5-canary.1777972218 → 1.57.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.
- package/dist/{copilotkit-BVK_b6St.mjs → copilotkit-CPe2-340.mjs} +177 -330
- package/dist/copilotkit-CPe2-340.mjs.map +1 -0
- package/dist/{copilotkit-DV9LwRgi.d.mts → copilotkit-DFaI4j2r.d.mts} +6 -52
- package/dist/copilotkit-DFaI4j2r.d.mts.map +1 -0
- package/dist/{copilotkit-BGIsblrk.cjs → copilotkit-DGbvw8n2.cjs} +176 -335
- package/dist/copilotkit-DGbvw8n2.cjs.map +1 -0
- package/dist/{copilotkit-Bc7kZ72T.d.cts → copilotkit-Dg4r4Gi_.d.cts} +6 -52
- package/dist/copilotkit-Dg4r4Gi_.d.cts.map +1 -0
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +172 -117
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.cjs +1 -2
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +182 -340
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +6 -5
- package/src/hooks/use-copilot-chat_internal.ts +1 -0
- package/src/v2/components/chat/CopilotChat.tsx +1 -2
- package/src/v2/components/chat/CopilotChatMessageView.tsx +13 -124
- package/src/v2/components/chat/CopilotChatView.tsx +2 -2
- package/src/v2/components/chat/__tests__/CopilotChat.welcomeGate.test.tsx +3 -1
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +25 -29
- package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.tsx +60 -5
- package/src/v2/components/index.ts +0 -1
- package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.tsx +333 -0
- package/src/v2/hooks/use-agent.tsx +116 -7
- package/src/v2/hooks/use-render-activity-message.tsx +11 -3
- package/src/v2/hooks/use-render-custom-messages.tsx +6 -1
- package/src/v2/styles/globals.css +0 -112
- package/dist/copilotkit-BGIsblrk.cjs.map +0 -1
- package/dist/copilotkit-BVK_b6St.mjs.map +0 -1
- package/dist/copilotkit-Bc7kZ72T.d.cts.map +0 -1
- package/dist/copilotkit-DV9LwRgi.d.mts.map +0 -1
- package/src/v2/components/intelligence-indicator/IntelligenceIndicator.tsx +0 -265
- package/src/v2/components/intelligence-indicator/__tests__/IntelligenceIndicator.e2e.test.tsx +0 -362
- package/src/v2/components/intelligence-indicator/index.ts +0 -2
package/dist/v2/index.umd.js
CHANGED
|
@@ -3558,6 +3558,171 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3558
3558
|
]);
|
|
3559
3559
|
}
|
|
3560
3560
|
|
|
3561
|
+
//#endregion
|
|
3562
|
+
//#region src/v2/hooks/use-agent.tsx
|
|
3563
|
+
let UseAgentUpdate = /* @__PURE__ */ function(UseAgentUpdate) {
|
|
3564
|
+
UseAgentUpdate["OnMessagesChanged"] = "OnMessagesChanged";
|
|
3565
|
+
UseAgentUpdate["OnStateChanged"] = "OnStateChanged";
|
|
3566
|
+
UseAgentUpdate["OnRunStatusChanged"] = "OnRunStatusChanged";
|
|
3567
|
+
return UseAgentUpdate;
|
|
3568
|
+
}({});
|
|
3569
|
+
const ALL_UPDATES = [
|
|
3570
|
+
UseAgentUpdate.OnMessagesChanged,
|
|
3571
|
+
UseAgentUpdate.OnStateChanged,
|
|
3572
|
+
UseAgentUpdate.OnRunStatusChanged
|
|
3573
|
+
];
|
|
3574
|
+
/**
|
|
3575
|
+
* Clone a registry agent for per-thread isolation.
|
|
3576
|
+
* Copies agent configuration (transport, headers, etc.) but resets conversation
|
|
3577
|
+
* state (messages, threadId, state) so each thread starts fresh.
|
|
3578
|
+
*/
|
|
3579
|
+
function cloneForThread(source, threadId, headers) {
|
|
3580
|
+
const clone = source.clone();
|
|
3581
|
+
if (clone === source) throw new Error(`useAgent: ${source.constructor.name}.clone() returned the same instance. clone() must return a new, independent object.`);
|
|
3582
|
+
clone.threadId = threadId;
|
|
3583
|
+
clone.setMessages([]);
|
|
3584
|
+
clone.setState({});
|
|
3585
|
+
if (clone instanceof _ag_ui_client.HttpAgent) clone.headers = { ...headers };
|
|
3586
|
+
return clone;
|
|
3587
|
+
}
|
|
3588
|
+
/**
|
|
3589
|
+
* Module-level WeakMap: registryAgent → (threadId → clone).
|
|
3590
|
+
* Shared across all useAgent() calls so that every component using the same
|
|
3591
|
+
* (agentId, threadId) pair receives the same agent instance. Using WeakMap
|
|
3592
|
+
* ensures the clone map is garbage-collected when the registry agent is
|
|
3593
|
+
* replaced (e.g. after reconnect or hot-reload).
|
|
3594
|
+
*/
|
|
3595
|
+
const globalThreadCloneMap = /* @__PURE__ */ new WeakMap();
|
|
3596
|
+
/**
|
|
3597
|
+
* Look up an existing per-thread clone without creating one.
|
|
3598
|
+
* Returns undefined when no clone has been created yet for this pair.
|
|
3599
|
+
*/
|
|
3600
|
+
function getThreadClone(registryAgent, threadId) {
|
|
3601
|
+
var _globalThreadCloneMap;
|
|
3602
|
+
if (!registryAgent || !threadId) return void 0;
|
|
3603
|
+
return (_globalThreadCloneMap = globalThreadCloneMap.get(registryAgent)) === null || _globalThreadCloneMap === void 0 ? void 0 : _globalThreadCloneMap.get(threadId);
|
|
3604
|
+
}
|
|
3605
|
+
function getOrCreateThreadClone(existing, threadId, headers) {
|
|
3606
|
+
let byThread = globalThreadCloneMap.get(existing);
|
|
3607
|
+
if (!byThread) {
|
|
3608
|
+
byThread = /* @__PURE__ */ new Map();
|
|
3609
|
+
globalThreadCloneMap.set(existing, byThread);
|
|
3610
|
+
}
|
|
3611
|
+
const cached = byThread.get(threadId);
|
|
3612
|
+
if (cached) return cached;
|
|
3613
|
+
const clone = cloneForThread(existing, threadId, headers);
|
|
3614
|
+
byThread.set(threadId, clone);
|
|
3615
|
+
return clone;
|
|
3616
|
+
}
|
|
3617
|
+
function useAgent({ agentId, threadId, updates, throttleMs } = {}) {
|
|
3618
|
+
var _agentId, _threadId;
|
|
3619
|
+
(_agentId = agentId) !== null && _agentId !== void 0 || (agentId = _copilotkit_shared.DEFAULT_AGENT_ID);
|
|
3620
|
+
const { copilotkit } = useCopilotKit();
|
|
3621
|
+
const providerThrottleMs = copilotkit.defaultThrottleMs;
|
|
3622
|
+
const chatConfig = useCopilotChatConfiguration();
|
|
3623
|
+
(_threadId = threadId) !== null && _threadId !== void 0 || (threadId = chatConfig === null || chatConfig === void 0 ? void 0 : chatConfig.threadId);
|
|
3624
|
+
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
3625
|
+
const updateFlags = (0, react.useMemo)(() => updates !== null && updates !== void 0 ? updates : ALL_UPDATES, [JSON.stringify(updates)]);
|
|
3626
|
+
const provisionalAgentCache = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
3627
|
+
const agent = (0, react.useMemo)(() => {
|
|
3628
|
+
var _copilotkit$agents;
|
|
3629
|
+
const cacheKey = threadId ? `${agentId}:${threadId}` : agentId;
|
|
3630
|
+
const existing = copilotkit.getAgent(agentId);
|
|
3631
|
+
if (existing) {
|
|
3632
|
+
provisionalAgentCache.current.delete(cacheKey);
|
|
3633
|
+
provisionalAgentCache.current.delete(agentId);
|
|
3634
|
+
if (!threadId) return existing;
|
|
3635
|
+
return getOrCreateThreadClone(existing, threadId, copilotkit.headers);
|
|
3636
|
+
}
|
|
3637
|
+
const isRuntimeConfigured = copilotkit.runtimeUrl !== void 0;
|
|
3638
|
+
const status = copilotkit.runtimeConnectionStatus;
|
|
3639
|
+
if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
|
|
3640
|
+
const cached = provisionalAgentCache.current.get(cacheKey);
|
|
3641
|
+
if (cached) {
|
|
3642
|
+
cached.headers = { ...copilotkit.headers };
|
|
3643
|
+
return cached;
|
|
3644
|
+
}
|
|
3645
|
+
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
3646
|
+
runtimeUrl: copilotkit.runtimeUrl,
|
|
3647
|
+
agentId,
|
|
3648
|
+
transport: copilotkit.runtimeTransport,
|
|
3649
|
+
runtimeMode: "pending"
|
|
3650
|
+
});
|
|
3651
|
+
provisional.headers = { ...copilotkit.headers };
|
|
3652
|
+
if (threadId) provisional.threadId = threadId;
|
|
3653
|
+
provisionalAgentCache.current.set(cacheKey, provisional);
|
|
3654
|
+
return provisional;
|
|
3655
|
+
}
|
|
3656
|
+
if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
|
|
3657
|
+
const cached = provisionalAgentCache.current.get(cacheKey);
|
|
3658
|
+
if (cached) {
|
|
3659
|
+
cached.headers = { ...copilotkit.headers };
|
|
3660
|
+
return cached;
|
|
3661
|
+
}
|
|
3662
|
+
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
3663
|
+
runtimeUrl: copilotkit.runtimeUrl,
|
|
3664
|
+
agentId,
|
|
3665
|
+
transport: copilotkit.runtimeTransport,
|
|
3666
|
+
runtimeMode: "pending"
|
|
3667
|
+
});
|
|
3668
|
+
provisional.headers = { ...copilotkit.headers };
|
|
3669
|
+
if (threadId) provisional.threadId = threadId;
|
|
3670
|
+
provisionalAgentCache.current.set(cacheKey, provisional);
|
|
3671
|
+
return provisional;
|
|
3672
|
+
}
|
|
3673
|
+
const knownAgents = Object.keys((_copilotkit$agents = copilotkit.agents) !== null && _copilotkit$agents !== void 0 ? _copilotkit$agents : {});
|
|
3674
|
+
const runtimePart = isRuntimeConfigured ? `runtimeUrl=${copilotkit.runtimeUrl}` : "no runtimeUrl";
|
|
3675
|
+
throw new Error(`useAgent: Agent '${agentId}' not found after runtime sync (${runtimePart}). ` + (knownAgents.length ? `Known agents: [${knownAgents.join(", ")}]` : "No agents registered.") + " Verify your runtime /info and/or agents__unsafe_dev_only.");
|
|
3676
|
+
}, [
|
|
3677
|
+
agentId,
|
|
3678
|
+
threadId,
|
|
3679
|
+
copilotkit.agents,
|
|
3680
|
+
copilotkit.runtimeConnectionStatus,
|
|
3681
|
+
copilotkit.runtimeUrl,
|
|
3682
|
+
copilotkit.runtimeTransport,
|
|
3683
|
+
JSON.stringify(copilotkit.headers)
|
|
3684
|
+
]);
|
|
3685
|
+
(0, react.useEffect)(() => {
|
|
3686
|
+
if (updateFlags.length === 0) return;
|
|
3687
|
+
let active = true;
|
|
3688
|
+
const handlers = {};
|
|
3689
|
+
let batchScheduled = false;
|
|
3690
|
+
const batchedForceUpdate = () => {
|
|
3691
|
+
if (!active) return;
|
|
3692
|
+
if (!batchScheduled) {
|
|
3693
|
+
batchScheduled = true;
|
|
3694
|
+
queueMicrotask(() => {
|
|
3695
|
+
batchScheduled = false;
|
|
3696
|
+
if (active) forceUpdate();
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
};
|
|
3700
|
+
if (updateFlags.includes(UseAgentUpdate.OnMessagesChanged)) handlers.onMessagesChanged = forceUpdate;
|
|
3701
|
+
if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) handlers.onStateChanged = batchedForceUpdate;
|
|
3702
|
+
if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {
|
|
3703
|
+
handlers.onRunInitialized = batchedForceUpdate;
|
|
3704
|
+
handlers.onRunFinalized = batchedForceUpdate;
|
|
3705
|
+
handlers.onRunFailed = batchedForceUpdate;
|
|
3706
|
+
handlers.onRunErrorEvent = batchedForceUpdate;
|
|
3707
|
+
}
|
|
3708
|
+
const subscription = copilotkit.subscribeToAgentWithOptions(agent, handlers, { throttleMs });
|
|
3709
|
+
return () => {
|
|
3710
|
+
active = false;
|
|
3711
|
+
subscription.unsubscribe();
|
|
3712
|
+
};
|
|
3713
|
+
}, [
|
|
3714
|
+
agent,
|
|
3715
|
+
forceUpdate,
|
|
3716
|
+
throttleMs,
|
|
3717
|
+
providerThrottleMs,
|
|
3718
|
+
updateFlags
|
|
3719
|
+
]);
|
|
3720
|
+
(0, react.useEffect)(() => {
|
|
3721
|
+
if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...copilotkit.headers };
|
|
3722
|
+
}, [agent, JSON.stringify(copilotkit.headers)]);
|
|
3723
|
+
return { agent };
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3561
3726
|
//#endregion
|
|
3562
3727
|
//#region src/v2/hooks/use-render-custom-messages.tsx
|
|
3563
3728
|
function useRenderCustomMessages() {
|
|
@@ -3571,12 +3736,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3571
3736
|
return aHasAgent ? -1 : 1;
|
|
3572
3737
|
});
|
|
3573
3738
|
return function(params) {
|
|
3574
|
-
var _copilotkit$getRunIdF;
|
|
3739
|
+
var _copilotkit$getRunIdF, _getThreadClone;
|
|
3575
3740
|
if (!customMessageRenderers.length) return null;
|
|
3576
3741
|
const { message, position } = params;
|
|
3577
3742
|
const resolvedRunId = (_copilotkit$getRunIdF = copilotkit.getRunIdForMessage(agentId, threadId, message.id)) !== null && _copilotkit$getRunIdF !== void 0 ? _copilotkit$getRunIdF : copilotkit.getRunIdsForThread(agentId, threadId).slice(-1)[0];
|
|
3578
3743
|
const runId = resolvedRunId !== null && resolvedRunId !== void 0 ? resolvedRunId : `missing-run-id:${message.id}`;
|
|
3579
|
-
const
|
|
3744
|
+
const registryAgent = copilotkit.getAgent(agentId);
|
|
3745
|
+
const agent = (_getThreadClone = getThreadClone(registryAgent, threadId)) !== null && _getThreadClone !== void 0 ? _getThreadClone : registryAgent;
|
|
3580
3746
|
if (!agent) return null;
|
|
3581
3747
|
const messagesIdsInRun = resolvedRunId ? agent.messages.filter((msg) => copilotkit.getRunIdForMessage(agentId, threadId, msg.id) === resolvedRunId).map((msg) => msg.id) : [message.id];
|
|
3582
3748
|
const rawMessageIndex = agent.messages.findIndex((msg) => msg.id === message.id);
|
|
@@ -3607,9 +3773,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3607
3773
|
//#endregion
|
|
3608
3774
|
//#region src/v2/hooks/use-render-activity-message.tsx
|
|
3609
3775
|
function useRenderActivityMessage() {
|
|
3610
|
-
var
|
|
3776
|
+
var _config$agentId;
|
|
3611
3777
|
const { copilotkit } = useCopilotKit();
|
|
3612
|
-
const
|
|
3778
|
+
const config = useCopilotChatConfiguration();
|
|
3779
|
+
const agentId = (_config$agentId = config === null || config === void 0 ? void 0 : config.agentId) !== null && _config$agentId !== void 0 ? _config$agentId : _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
3613
3780
|
const renderers = copilotkit.renderActivityMessages;
|
|
3614
3781
|
const findRenderer = (0, react.useCallback)((activityType) => {
|
|
3615
3782
|
var _ref, _ref2, _matches$find;
|
|
@@ -3618,6 +3785,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3618
3785
|
return (_ref = (_ref2 = (_matches$find = matches.find((candidate) => candidate.agentId === agentId)) !== null && _matches$find !== void 0 ? _matches$find : matches.find((candidate) => candidate.agentId === void 0)) !== null && _ref2 !== void 0 ? _ref2 : renderers.find((candidate) => candidate.activityType === "*")) !== null && _ref !== void 0 ? _ref : null;
|
|
3619
3786
|
}, [agentId, renderers]);
|
|
3620
3787
|
const renderActivityMessage = (0, react.useCallback)((message) => {
|
|
3788
|
+
var _getThreadClone;
|
|
3621
3789
|
const renderer = findRenderer(message.activityType);
|
|
3622
3790
|
if (!renderer) return null;
|
|
3623
3791
|
const parseResult = renderer.content.safeParse(message.content);
|
|
@@ -3626,7 +3794,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3626
3794
|
return null;
|
|
3627
3795
|
}
|
|
3628
3796
|
const Component = renderer.render;
|
|
3629
|
-
const
|
|
3797
|
+
const registryAgent = copilotkit.getAgent(agentId);
|
|
3798
|
+
const agent = (_getThreadClone = getThreadClone(registryAgent, config === null || config === void 0 ? void 0 : config.threadId)) !== null && _getThreadClone !== void 0 ? _getThreadClone : registryAgent;
|
|
3630
3799
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
3631
3800
|
activityType: message.activityType,
|
|
3632
3801
|
content: parseResult.data,
|
|
@@ -3635,6 +3804,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3635
3804
|
}, message.id);
|
|
3636
3805
|
}, [
|
|
3637
3806
|
agentId,
|
|
3807
|
+
config === null || config === void 0 ? void 0 : config.threadId,
|
|
3638
3808
|
copilotkit,
|
|
3639
3809
|
findRenderer
|
|
3640
3810
|
]);
|
|
@@ -4075,120 +4245,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4075
4245
|
]);
|
|
4076
4246
|
}
|
|
4077
4247
|
|
|
4078
|
-
//#endregion
|
|
4079
|
-
//#region src/v2/hooks/use-agent.tsx
|
|
4080
|
-
let UseAgentUpdate = /* @__PURE__ */ function(UseAgentUpdate) {
|
|
4081
|
-
UseAgentUpdate["OnMessagesChanged"] = "OnMessagesChanged";
|
|
4082
|
-
UseAgentUpdate["OnStateChanged"] = "OnStateChanged";
|
|
4083
|
-
UseAgentUpdate["OnRunStatusChanged"] = "OnRunStatusChanged";
|
|
4084
|
-
return UseAgentUpdate;
|
|
4085
|
-
}({});
|
|
4086
|
-
const ALL_UPDATES = [
|
|
4087
|
-
UseAgentUpdate.OnMessagesChanged,
|
|
4088
|
-
UseAgentUpdate.OnStateChanged,
|
|
4089
|
-
UseAgentUpdate.OnRunStatusChanged
|
|
4090
|
-
];
|
|
4091
|
-
function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
4092
|
-
var _agentId;
|
|
4093
|
-
(_agentId = agentId) !== null && _agentId !== void 0 || (agentId = _copilotkit_shared.DEFAULT_AGENT_ID);
|
|
4094
|
-
const { copilotkit } = useCopilotKit();
|
|
4095
|
-
const providerThrottleMs = copilotkit.defaultThrottleMs;
|
|
4096
|
-
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
4097
|
-
const updateFlags = (0, react.useMemo)(() => updates !== null && updates !== void 0 ? updates : ALL_UPDATES, [JSON.stringify(updates)]);
|
|
4098
|
-
const provisionalAgentCache = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
4099
|
-
const agent = (0, react.useMemo)(() => {
|
|
4100
|
-
var _copilotkit$agents;
|
|
4101
|
-
const existing = copilotkit.getAgent(agentId);
|
|
4102
|
-
if (existing) {
|
|
4103
|
-
provisionalAgentCache.current.delete(agentId);
|
|
4104
|
-
return existing;
|
|
4105
|
-
}
|
|
4106
|
-
const isRuntimeConfigured = copilotkit.runtimeUrl !== void 0;
|
|
4107
|
-
const status = copilotkit.runtimeConnectionStatus;
|
|
4108
|
-
if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
|
|
4109
|
-
const cached = provisionalAgentCache.current.get(agentId);
|
|
4110
|
-
if (cached) {
|
|
4111
|
-
cached.headers = { ...copilotkit.headers };
|
|
4112
|
-
return cached;
|
|
4113
|
-
}
|
|
4114
|
-
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
4115
|
-
runtimeUrl: copilotkit.runtimeUrl,
|
|
4116
|
-
agentId,
|
|
4117
|
-
transport: copilotkit.runtimeTransport,
|
|
4118
|
-
runtimeMode: "pending"
|
|
4119
|
-
});
|
|
4120
|
-
provisional.headers = { ...copilotkit.headers };
|
|
4121
|
-
provisionalAgentCache.current.set(agentId, provisional);
|
|
4122
|
-
return provisional;
|
|
4123
|
-
}
|
|
4124
|
-
if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
|
|
4125
|
-
const cached = provisionalAgentCache.current.get(agentId);
|
|
4126
|
-
if (cached) {
|
|
4127
|
-
cached.headers = { ...copilotkit.headers };
|
|
4128
|
-
return cached;
|
|
4129
|
-
}
|
|
4130
|
-
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
4131
|
-
runtimeUrl: copilotkit.runtimeUrl,
|
|
4132
|
-
agentId,
|
|
4133
|
-
transport: copilotkit.runtimeTransport,
|
|
4134
|
-
runtimeMode: "pending"
|
|
4135
|
-
});
|
|
4136
|
-
provisional.headers = { ...copilotkit.headers };
|
|
4137
|
-
provisionalAgentCache.current.set(agentId, provisional);
|
|
4138
|
-
return provisional;
|
|
4139
|
-
}
|
|
4140
|
-
const knownAgents = Object.keys((_copilotkit$agents = copilotkit.agents) !== null && _copilotkit$agents !== void 0 ? _copilotkit$agents : {});
|
|
4141
|
-
const runtimePart = isRuntimeConfigured ? `runtimeUrl=${copilotkit.runtimeUrl}` : "no runtimeUrl";
|
|
4142
|
-
throw new Error(`useAgent: Agent '${agentId}' not found after runtime sync (${runtimePart}). ` + (knownAgents.length ? `Known agents: [${knownAgents.join(", ")}]` : "No agents registered.") + " Verify your runtime /info and/or agents__unsafe_dev_only.");
|
|
4143
|
-
}, [
|
|
4144
|
-
agentId,
|
|
4145
|
-
copilotkit.agents,
|
|
4146
|
-
copilotkit.runtimeConnectionStatus,
|
|
4147
|
-
copilotkit.runtimeUrl,
|
|
4148
|
-
copilotkit.runtimeTransport,
|
|
4149
|
-
JSON.stringify(copilotkit.headers)
|
|
4150
|
-
]);
|
|
4151
|
-
(0, react.useEffect)(() => {
|
|
4152
|
-
if (updateFlags.length === 0) return;
|
|
4153
|
-
let active = true;
|
|
4154
|
-
const handlers = {};
|
|
4155
|
-
let batchScheduled = false;
|
|
4156
|
-
const batchedForceUpdate = () => {
|
|
4157
|
-
if (!active) return;
|
|
4158
|
-
if (!batchScheduled) {
|
|
4159
|
-
batchScheduled = true;
|
|
4160
|
-
queueMicrotask(() => {
|
|
4161
|
-
batchScheduled = false;
|
|
4162
|
-
if (active) forceUpdate();
|
|
4163
|
-
});
|
|
4164
|
-
}
|
|
4165
|
-
};
|
|
4166
|
-
if (updateFlags.includes(UseAgentUpdate.OnMessagesChanged)) handlers.onMessagesChanged = forceUpdate;
|
|
4167
|
-
if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) handlers.onStateChanged = batchedForceUpdate;
|
|
4168
|
-
if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {
|
|
4169
|
-
handlers.onRunInitialized = batchedForceUpdate;
|
|
4170
|
-
handlers.onRunFinalized = batchedForceUpdate;
|
|
4171
|
-
handlers.onRunFailed = batchedForceUpdate;
|
|
4172
|
-
handlers.onRunErrorEvent = batchedForceUpdate;
|
|
4173
|
-
}
|
|
4174
|
-
const subscription = copilotkit.subscribeToAgentWithOptions(agent, handlers, { throttleMs });
|
|
4175
|
-
return () => {
|
|
4176
|
-
active = false;
|
|
4177
|
-
subscription.unsubscribe();
|
|
4178
|
-
};
|
|
4179
|
-
}, [
|
|
4180
|
-
agent,
|
|
4181
|
-
forceUpdate,
|
|
4182
|
-
throttleMs,
|
|
4183
|
-
providerThrottleMs,
|
|
4184
|
-
updateFlags
|
|
4185
|
-
]);
|
|
4186
|
-
(0, react.useEffect)(() => {
|
|
4187
|
-
if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...copilotkit.headers };
|
|
4188
|
-
}, [agent, JSON.stringify(copilotkit.headers)]);
|
|
4189
|
-
return { agent };
|
|
4190
|
-
}
|
|
4191
|
-
|
|
4192
4248
|
//#endregion
|
|
4193
4249
|
//#region src/v2/hooks/use-capabilities.tsx
|
|
4194
4250
|
/**
|
|
@@ -5697,172 +5753,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5697
5753
|
*/
|
|
5698
5754
|
const ScrollElementContext = react.default.createContext(null);
|
|
5699
5755
|
|
|
5700
|
-
//#endregion
|
|
5701
|
-
//#region src/v2/components/intelligence-indicator/IntelligenceIndicator.tsx
|
|
5702
|
-
/**
|
|
5703
|
-
* Brief debounce on `agent.isRunning` falling edges. Multi-step agent
|
|
5704
|
-
* runs can emit transient `RUN_FINISHED → RUN_STARTED` cycles between
|
|
5705
|
-
* LLM steps inside one user turn; without a small grace window the pill
|
|
5706
|
-
* would flicker spinner → check → spinner. 500 ms is well below
|
|
5707
|
-
* human-perceptible flash latency yet long enough to absorb step blips.
|
|
5708
|
-
*/
|
|
5709
|
-
const RUN_IDLE_DEBOUNCE_MS = 500;
|
|
5710
|
-
/** Hold the checkmark briefly before fading out. */
|
|
5711
|
-
const CHECK_HOLD_MS = 800;
|
|
5712
|
-
/**
|
|
5713
|
-
* Duration of the fade-out animation. Must match
|
|
5714
|
-
* `cpk-intelligence-pill-fade-out` keyframes in `v2/styles/globals.css`.
|
|
5715
|
-
*/
|
|
5716
|
-
const FADE_OUT_ANIMATION_MS = 480;
|
|
5717
|
-
/**
|
|
5718
|
-
* Polling interval for `agent.isRunning`. Background: AG-UI's `runAgent`
|
|
5719
|
-
* snapshots `[...this.subscribers]` at invocation time and threads that
|
|
5720
|
-
* snapshot through the entire run pipeline (including the `finalize`
|
|
5721
|
-
* block that fires `onRunFinalized` and flips `isRunning` off). A
|
|
5722
|
-
* subscriber added AFTER `runAgent` starts — which is always the case
|
|
5723
|
-
* here, because the renderer mounts when the matching message first
|
|
5724
|
-
* appears INSIDE the run — is missing from that snapshot and never
|
|
5725
|
-
* receives the falling edge.
|
|
5726
|
-
*
|
|
5727
|
-
* Re-renders driven by parent state still keep the pill alive while
|
|
5728
|
-
* messages stream, but `agent.isRunning` only flips off via the
|
|
5729
|
-
* snapshotted set. A 200 ms poll reads the live property and forces a
|
|
5730
|
-
* re-render when it changes, closing the gap.
|
|
5731
|
-
*/
|
|
5732
|
-
const ISRUNNING_POLL_MS = 200;
|
|
5733
|
-
/**
|
|
5734
|
-
* Tool-name regex patterns that trigger the indicator. Currently
|
|
5735
|
-
* hardcoded to the Intelligence MCP server's canonical tool name. If
|
|
5736
|
-
* we add per-instance customization later (e.g. a `CopilotKitProvider`
|
|
5737
|
-
* prop or a runtime-info field), this constant becomes the fallback.
|
|
5738
|
-
*/
|
|
5739
|
-
const DEFAULT_TOOL_PATTERNS = [/^bash$/];
|
|
5740
|
-
/**
|
|
5741
|
-
* The "Using CopilotKit Intelligence" pill. Auto-mounted by
|
|
5742
|
-
* `CopilotChatMessageView` for every message slot when
|
|
5743
|
-
* `copilotkit.intelligence` is configured — callers do not register
|
|
5744
|
-
* this themselves. Self-gates so only the canonical message renders a
|
|
5745
|
-
* pill.
|
|
5746
|
-
*
|
|
5747
|
-
* Render gates (all must hold):
|
|
5748
|
-
* 1. `copilotkit.intelligence !== undefined` (Intelligence runtime
|
|
5749
|
-
* is configured; checked by the parent before mounting, and
|
|
5750
|
-
* again here as a defence)
|
|
5751
|
-
* 2. The message is the last message of its run
|
|
5752
|
-
* 3. The message's run is the latest run on the thread
|
|
5753
|
-
* 4. The message has at least one tool call whose name matches
|
|
5754
|
-
* {@link DEFAULT_TOOL_PATTERNS}
|
|
5755
|
-
* 5. The phase machine is not yet `hidden`
|
|
5756
|
-
*
|
|
5757
|
-
* Phase machine (per-instance, all timers local):
|
|
5758
|
-
* - `spinner` while `agent.isRunning`
|
|
5759
|
-
* - → `check` after `agent.isRunning` falls (debounced 500 ms to
|
|
5760
|
-
* absorb step-boundary `RUN_FINISHED → RUN_STARTED` blips inside
|
|
5761
|
-
* one user turn)
|
|
5762
|
-
* - → `fading` after a brief hold ({@link CHECK_HOLD_MS})
|
|
5763
|
-
* - → `hidden` after the fade animation
|
|
5764
|
-
* ({@link FADE_OUT_ANIMATION_MS})
|
|
5765
|
-
*
|
|
5766
|
-
* The "exactly one pill at a time" guarantee is structural — only one
|
|
5767
|
-
* message at any moment satisfies gates 2–4 — so no shared coordination
|
|
5768
|
-
* state is required.
|
|
5769
|
-
*/
|
|
5770
|
-
function IntelligenceIndicator(props) {
|
|
5771
|
-
const { message, agentId, label = "Using CopilotKit Intelligence" } = props;
|
|
5772
|
-
const { copilotkit } = useCopilotKit();
|
|
5773
|
-
const config = useCopilotChatConfiguration();
|
|
5774
|
-
const { agent } = useAgent({
|
|
5775
|
-
agentId,
|
|
5776
|
-
updates: [UseAgentUpdate.OnRunStatusChanged, UseAgentUpdate.OnMessagesChanged]
|
|
5777
|
-
});
|
|
5778
|
-
const [, forceRender] = (0, react.useReducer)((n) => n + 1, 0);
|
|
5779
|
-
const lastSeenIsRunningRef = (0, react.useRef)(agent.isRunning);
|
|
5780
|
-
(0, react.useEffect)(() => {
|
|
5781
|
-
const interval = setInterval(() => {
|
|
5782
|
-
const live = agent.isRunning;
|
|
5783
|
-
if (live !== lastSeenIsRunningRef.current) {
|
|
5784
|
-
lastSeenIsRunningRef.current = live;
|
|
5785
|
-
forceRender();
|
|
5786
|
-
}
|
|
5787
|
-
}, ISRUNNING_POLL_MS);
|
|
5788
|
-
return () => clearInterval(interval);
|
|
5789
|
-
}, [agent]);
|
|
5790
|
-
const [phase, setPhase] = (0, react.useState)(agent.isRunning ? "spinner" : "check");
|
|
5791
|
-
(0, react.useEffect)(() => {
|
|
5792
|
-
if (agent.isRunning) {
|
|
5793
|
-
setPhase("spinner");
|
|
5794
|
-
return;
|
|
5795
|
-
}
|
|
5796
|
-
const t = setTimeout(() => setPhase("check"), RUN_IDLE_DEBOUNCE_MS);
|
|
5797
|
-
return () => clearTimeout(t);
|
|
5798
|
-
}, [agent.isRunning]);
|
|
5799
|
-
(0, react.useEffect)(() => {
|
|
5800
|
-
if (phase !== "check") return void 0;
|
|
5801
|
-
const t = setTimeout(() => setPhase("fading"), CHECK_HOLD_MS);
|
|
5802
|
-
return () => clearTimeout(t);
|
|
5803
|
-
}, [phase]);
|
|
5804
|
-
(0, react.useEffect)(() => {
|
|
5805
|
-
if (phase !== "fading") return void 0;
|
|
5806
|
-
const t = setTimeout(() => setPhase("hidden"), FADE_OUT_ANIMATION_MS);
|
|
5807
|
-
return () => clearTimeout(t);
|
|
5808
|
-
}, [phase]);
|
|
5809
|
-
if (copilotkit.intelligence === void 0) return null;
|
|
5810
|
-
if (!config) return null;
|
|
5811
|
-
if (phase === "hidden") return null;
|
|
5812
|
-
if (message.role !== "assistant") return null;
|
|
5813
|
-
if (!(Array.isArray(message.toolCalls) ? message.toolCalls : []).some((tc) => {
|
|
5814
|
-
var _tc$function;
|
|
5815
|
-
const name = tc === null || tc === void 0 || (_tc$function = tc.function) === null || _tc$function === void 0 ? void 0 : _tc$function.name;
|
|
5816
|
-
return typeof name === "string" && DEFAULT_TOOL_PATTERNS.some((p) => p.test(name));
|
|
5817
|
-
})) return null;
|
|
5818
|
-
const messageRunId = copilotkit.getRunIdForMessage(agentId, config.threadId, message.id);
|
|
5819
|
-
if (!messageRunId) return null;
|
|
5820
|
-
let latestRunId;
|
|
5821
|
-
let lastMessageIdInThisRun;
|
|
5822
|
-
for (let i = agent.messages.length - 1; i >= 0; i -= 1) {
|
|
5823
|
-
const m = agent.messages[i];
|
|
5824
|
-
const r = copilotkit.getRunIdForMessage(agentId, config.threadId, m.id);
|
|
5825
|
-
if (latestRunId === void 0 && r) latestRunId = r;
|
|
5826
|
-
if (lastMessageIdInThisRun === void 0 && r === messageRunId) lastMessageIdInThisRun = m.id;
|
|
5827
|
-
if (latestRunId !== void 0 && lastMessageIdInThisRun !== void 0) break;
|
|
5828
|
-
}
|
|
5829
|
-
if (latestRunId !== messageRunId) return null;
|
|
5830
|
-
if (lastMessageIdInThisRun !== message.id) return null;
|
|
5831
|
-
const showSpinner = phase === "spinner";
|
|
5832
|
-
const isFading = phase === "fading";
|
|
5833
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
5834
|
-
className: "cpk-intelligence-pill" + (isFading ? " cpk-intelligence-pill--fading" : ""),
|
|
5835
|
-
role: "status",
|
|
5836
|
-
"aria-live": "polite",
|
|
5837
|
-
"aria-hidden": isFading || void 0,
|
|
5838
|
-
"data-testid": `cpk-intelligence-pill-${message.id}`,
|
|
5839
|
-
title: label,
|
|
5840
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
5841
|
-
className: "cpk-intelligence-pill__icon",
|
|
5842
|
-
viewBox: "0 0 24 24",
|
|
5843
|
-
width: "14",
|
|
5844
|
-
height: "14",
|
|
5845
|
-
"aria-hidden": "true",
|
|
5846
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
5847
|
-
cx: "12",
|
|
5848
|
-
cy: "12",
|
|
5849
|
-
r: "9",
|
|
5850
|
-
fill: "none",
|
|
5851
|
-
strokeWidth: "2.5",
|
|
5852
|
-
strokeLinecap: "round",
|
|
5853
|
-
className: "cpk-intelligence-pill__ring" + (showSpinner ? "" : " cpk-intelligence-pill__ring--done")
|
|
5854
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5855
|
-
d: "M8 12.5l3 3 5-6",
|
|
5856
|
-
fill: "none",
|
|
5857
|
-
strokeWidth: "2.5",
|
|
5858
|
-
strokeLinecap: "round",
|
|
5859
|
-
strokeLinejoin: "round",
|
|
5860
|
-
className: "cpk-intelligence-pill__check" + (showSpinner ? "" : " cpk-intelligence-pill__check--shown")
|
|
5861
|
-
})]
|
|
5862
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label })]
|
|
5863
|
-
});
|
|
5864
|
-
}
|
|
5865
|
-
|
|
5866
5756
|
//#endregion
|
|
5867
5757
|
//#region src/v2/components/chat/CopilotChatMessageView.tsx
|
|
5868
5758
|
/**
|
|
@@ -5984,9 +5874,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5984
5874
|
if (prevProps.message.content !== nextProps.message.content) return false;
|
|
5985
5875
|
if (prevProps.message.role !== nextProps.message.role) return false;
|
|
5986
5876
|
if (JSON.stringify(prevProps.stateSnapshot) !== JSON.stringify(nextProps.stateSnapshot)) return false;
|
|
5987
|
-
if (prevProps.numberOfMessagesInRun !== nextProps.numberOfMessagesInRun) return false;
|
|
5988
|
-
if (prevProps.isInLatestRun !== nextProps.isInLatestRun) return false;
|
|
5989
|
-
if (nextProps.isInLatestRun && prevProps.isRunning !== nextProps.isRunning) return false;
|
|
5990
5877
|
return true;
|
|
5991
5878
|
});
|
|
5992
5879
|
/**
|
|
@@ -6026,13 +5913,16 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6026
5913
|
const config = useCopilotChatConfiguration();
|
|
6027
5914
|
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
6028
5915
|
(0, react.useEffect)(() => {
|
|
5916
|
+
var _getThreadClone;
|
|
6029
5917
|
if (!(config === null || config === void 0 ? void 0 : config.agentId)) return;
|
|
6030
|
-
const
|
|
5918
|
+
const registryAgent = copilotkit.getAgent(config.agentId);
|
|
5919
|
+
const agent = (_getThreadClone = getThreadClone(registryAgent, config.threadId)) !== null && _getThreadClone !== void 0 ? _getThreadClone : registryAgent;
|
|
6031
5920
|
if (!agent) return;
|
|
6032
5921
|
const subscription = agent.subscribe({ onStateChanged: forceUpdate });
|
|
6033
5922
|
return () => subscription.unsubscribe();
|
|
6034
5923
|
}, [
|
|
6035
5924
|
config === null || config === void 0 ? void 0 : config.agentId,
|
|
5925
|
+
config === null || config === void 0 ? void 0 : config.threadId,
|
|
6036
5926
|
copilotkit,
|
|
6037
5927
|
forceUpdate
|
|
6038
5928
|
]);
|
|
@@ -6044,37 +5934,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6044
5934
|
} });
|
|
6045
5935
|
return () => subscription.unsubscribe();
|
|
6046
5936
|
}, [copilotkit]);
|
|
6047
|
-
const runMetadata = (0, react.useMemo)(() => {
|
|
6048
|
-
if (!config) return null;
|
|
6049
|
-
const runIdByMessageId = /* @__PURE__ */ new Map();
|
|
6050
|
-
for (const msg of messages) {
|
|
6051
|
-
const r = copilotkit.getRunIdForMessage(config.agentId, config.threadId, msg.id);
|
|
6052
|
-
if (r) runIdByMessageId.set(msg.id, r);
|
|
6053
|
-
}
|
|
6054
|
-
const countByRunId = /* @__PURE__ */ new Map();
|
|
6055
|
-
for (const r of runIdByMessageId.values()) {
|
|
6056
|
-
var _countByRunId$get;
|
|
6057
|
-
countByRunId.set(r, ((_countByRunId$get = countByRunId.get(r)) !== null && _countByRunId$get !== void 0 ? _countByRunId$get : 0) + 1);
|
|
6058
|
-
}
|
|
6059
|
-
let latestRunId;
|
|
6060
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
6061
|
-
const r = runIdByMessageId.get(messages[i].id);
|
|
6062
|
-
if (r) {
|
|
6063
|
-
latestRunId = r;
|
|
6064
|
-
break;
|
|
6065
|
-
}
|
|
6066
|
-
}
|
|
6067
|
-
return {
|
|
6068
|
-
runIdByMessageId,
|
|
6069
|
-
countByRunId,
|
|
6070
|
-
latestRunId
|
|
6071
|
-
};
|
|
6072
|
-
}, [
|
|
6073
|
-
messages,
|
|
6074
|
-
config === null || config === void 0 ? void 0 : config.agentId,
|
|
6075
|
-
config === null || config === void 0 ? void 0 : config.threadId,
|
|
6076
|
-
copilotkit
|
|
6077
|
-
]);
|
|
6078
5937
|
const getStateSnapshotForMessage = (messageId) => {
|
|
6079
5938
|
var _copilotkit$getRunIdF;
|
|
6080
5939
|
if (!config) return void 0;
|
|
@@ -6114,17 +5973,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6114
5973
|
const renderMessageBlock = (message) => {
|
|
6115
5974
|
const elements = [];
|
|
6116
5975
|
const stateSnapshot = getStateSnapshotForMessage(message.id);
|
|
6117
|
-
const messageRunId = runMetadata === null || runMetadata === void 0 ? void 0 : runMetadata.runIdByMessageId.get(message.id);
|
|
6118
|
-
const numberOfMessagesInRun = messageRunId ? runMetadata === null || runMetadata === void 0 ? void 0 : runMetadata.countByRunId.get(messageRunId) : void 0;
|
|
6119
|
-
const isInLatestRun = messageRunId === void 0 ? void 0 : messageRunId === (runMetadata === null || runMetadata === void 0 ? void 0 : runMetadata.latestRunId);
|
|
6120
5976
|
if (renderCustomMessage) elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedCustomMessage, {
|
|
6121
5977
|
message,
|
|
6122
5978
|
position: "before",
|
|
6123
5979
|
renderCustomMessage,
|
|
6124
|
-
stateSnapshot
|
|
6125
|
-
numberOfMessagesInRun,
|
|
6126
|
-
isInLatestRun,
|
|
6127
|
-
isRunning
|
|
5980
|
+
stateSnapshot
|
|
6128
5981
|
}, `${message.id}-custom-before`));
|
|
6129
5982
|
if (message.role === "assistant") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedAssistantMessage, {
|
|
6130
5983
|
message,
|
|
@@ -6153,18 +6006,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6153
6006
|
message,
|
|
6154
6007
|
position: "after",
|
|
6155
6008
|
renderCustomMessage,
|
|
6156
|
-
stateSnapshot
|
|
6157
|
-
numberOfMessagesInRun,
|
|
6158
|
-
isInLatestRun,
|
|
6159
|
-
isRunning
|
|
6009
|
+
stateSnapshot
|
|
6160
6010
|
}, `${message.id}-custom-after`));
|
|
6161
|
-
if (copilotkit.intelligence !== void 0 && message.role === "assistant") {
|
|
6162
|
-
var _config$agentId;
|
|
6163
|
-
elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntelligenceIndicator, {
|
|
6164
|
-
message,
|
|
6165
|
-
agentId: (_config$agentId = config === null || config === void 0 ? void 0 : config.agentId) !== null && _config$agentId !== void 0 ? _config$agentId : _copilotkit_shared.DEFAULT_AGENT_ID
|
|
6166
|
-
}, `${message.id}-intelligence`));
|
|
6167
|
-
}
|
|
6168
6011
|
return elements.filter(Boolean);
|
|
6169
6012
|
};
|
|
6170
6013
|
const messageElements = shouldVirtualize ? [] : deduplicatedMessages.flatMap(renderMessageBlock);
|
|
@@ -7118,6 +6961,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7118
6961
|
const hasExplicitThreadId = !!threadId || !!(existingConfig === null || existingConfig === void 0 ? void 0 : existingConfig.hasExplicitThreadId);
|
|
7119
6962
|
const { agent } = useAgent({
|
|
7120
6963
|
agentId: resolvedAgentId,
|
|
6964
|
+
threadId: resolvedThreadId,
|
|
7121
6965
|
throttleMs
|
|
7122
6966
|
});
|
|
7123
6967
|
const { copilotkit } = useCopilotKit();
|
|
@@ -7163,7 +7007,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7163
7007
|
let detached = false;
|
|
7164
7008
|
const connectAbortController = new AbortController();
|
|
7165
7009
|
if (agent instanceof _ag_ui_client.HttpAgent) agent.abortController = connectAbortController;
|
|
7166
|
-
agent.threadId = resolvedThreadId;
|
|
7167
7010
|
const connect = async (agent) => {
|
|
7168
7011
|
try {
|
|
7169
7012
|
await copilotkit.connectAgent({ agent });
|
|
@@ -10079,7 +9922,6 @@ Object.defineProperty(exports, 'CopilotSidebarView', {
|
|
|
10079
9922
|
return CopilotSidebarView;
|
|
10080
9923
|
}
|
|
10081
9924
|
});
|
|
10082
|
-
exports.IntelligenceIndicator = IntelligenceIndicator;
|
|
10083
9925
|
exports.MCPAppsActivityContentSchema = MCPAppsActivityContentSchema;
|
|
10084
9926
|
exports.MCPAppsActivityRenderer = MCPAppsActivityRenderer;
|
|
10085
9927
|
exports.MCPAppsActivityType = MCPAppsActivityType;
|