@copilotkit/vue 1.62.0 → 1.62.1
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/PARITY.md +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{use-render-activity-message-Bzh3Bckz.js → use-render-activity-message-8_HyVZWc.js} +7 -5
- package/dist/use-render-activity-message-8_HyVZWc.js.map +1 -0
- package/dist/{use-render-activity-message-CW3vipBB.cjs → use-render-activity-message-BqgmNPCz.cjs} +2 -2
- package/dist/use-render-activity-message-BqgmNPCz.cjs.map +1 -0
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/package.json +6 -6
- package/src/v2/hooks/__tests__/use-agent.test.ts +60 -1
- package/src/v2/hooks/use-agent.ts +4 -1
- package/dist/use-render-activity-message-Bzh3Bckz.js.map +0 -1
- package/dist/use-render-activity-message-CW3vipBB.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/use-agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAYnD,oBAAY,cAAc;IACxB,iBAAiB,sBAAsB;IACvC,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;CAC1C;AAQD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,M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 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@copilotkit/core"),i=require("@ag-ui/client"),e=require("../use-render-activity-message-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@copilotkit/core"),i=require("@ag-ui/client"),e=require("../use-render-activity-message-BqgmNPCz.cjs"),n=require("@copilotkit/shared");exports.A2UIActivityContentSchema=e.A2UIActivityContentSchema;exports.A2UISurfaceActivityRenderer=e._sfc_main;exports.A2UISurfaceActivityType=e.A2UISurfaceActivityType;exports.CopilotChat=e.CopilotChat;exports.CopilotChatAssistantMessage=e._sfc_main$1;exports.CopilotChatAttachmentQueue=e._sfc_main$2;exports.CopilotChatAttachmentRenderer=e._sfc_main$3;exports.CopilotChatAudioRecorder=e._sfc_main$4;exports.CopilotChatConfigurationProvider=e._sfc_main$5;exports.CopilotChatDefaultLabels=e.CopilotChatDefaultLabels;exports.CopilotChatInput=e._sfc_main$6;exports.CopilotChatMessageView=e._sfc_main$7;exports.CopilotChatReasoningMessage=e._sfc_main$8;exports.CopilotChatSuggestionPill=e._sfc_main$9;exports.CopilotChatSuggestionView=e._sfc_main$10;exports.CopilotChatToggleButton=e.CopilotChatToggleButton;exports.CopilotChatToggleButtonCloseIcon=e.CopilotChatToggleButtonCloseIcon;exports.CopilotChatToggleButtonOpenIcon=e.CopilotChatToggleButtonOpenIcon;exports.CopilotChatToolCallsView=e._sfc_main$11;exports.CopilotChatUserMessage=e._sfc_main$12;exports.CopilotChatView=e._sfc_main$13;exports.CopilotKitCoreVue=e.CopilotKitCoreVue;exports.CopilotKitInspector=e._sfc_main$14;exports.CopilotKitProvider=e._sfc_main$15;exports.CopilotModalHeader=e.CopilotModalHeader;exports.CopilotPopup=e._sfc_main$16;exports.CopilotPopupView=e.CopilotPopupView;exports.CopilotSidebar=e._sfc_main$17;exports.CopilotSidebarView=e.CopilotSidebarView;exports.GenerateSandboxedUiArgsSchema=e.GenerateSandboxedUiArgsSchema;exports.LicenseContextKey=e.LicenseContextKey;exports.MCPAppsActivityContentSchema=e.MCPAppsActivityContentSchema;exports.MCPAppsActivityRenderer=e.MCPAppsActivityRenderer;exports.MCPAppsActivityType=e.MCPAppsActivityType;exports.OpenGenerativeUIActivityRenderer=e.OpenGenerativeUIActivityRenderer;exports.OpenGenerativeUIActivityType=e.OpenGenerativeUIActivityType;exports.OpenGenerativeUIContentSchema=e.OpenGenerativeUIContentSchema;exports.OpenGenerativeUIRenderer=e.OpenGenerativeUIRenderer;exports.OpenGenerativeUIToolRenderer=e.OpenGenerativeUIToolRenderer;exports.UseAgentUpdate=e.UseAgentUpdate;exports.createA2UIMessageRenderer=e.createA2UIMessageRenderer;exports.createDefaultLicenseRef=e.createDefaultLicenseRef;exports.defineToolCallRenderer=e.defineToolCallRenderer;exports.extractCompleteStyles=e.extractCompleteStyles;exports.getOperationSurfaceId=e.getOperationSurfaceId;exports.processPartialHtml=e.processPartialHtml;exports.useAgent=e.useAgent;exports.useAgentContext=e.useAgentContext;exports.useAttachments=e.useAttachments;exports.useCapabilities=e.useCapabilities;exports.useComponent=e.useComponent;exports.useConfigureSuggestions=e.useConfigureSuggestions;exports.useCopilotChatConfiguration=e.useCopilotChatConfiguration;exports.useCopilotKit=e.useCopilotKit;exports.useDefaultRenderTool=e.useDefaultRenderTool;exports.useFrontendTool=e.useFrontendTool;exports.useHumanInTheLoop=e.useHumanInTheLoop;exports.useInterrupt=e.useInterrupt;exports.useKatexStyles=e.useKatexStyles;exports.useKeyboardHeight=e.useKeyboardHeight;exports.useLicenseContext=e.useLicenseContext;exports.useRenderActivityMessage=e.useRenderActivityMessage;exports.useRenderCustomMessages=e.useRenderCustomMessages;exports.useRenderTool=e.useRenderTool;exports.useSandboxFunctions=e.useSandboxFunctions;exports.useSuggestions=e.useSuggestions;exports.useThreads=e.useThreads;exports.vueBasicCatalog=e.vueBasicCatalog;Object.defineProperty(exports,"createLicenseContextValue",{enumerable:!0,get:()=>n.createLicenseContextValue});Object.keys(o).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>o[t]})});Object.keys(i).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>i[t]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/v2/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "@copilotkit/core";
|
|
2
2
|
export * from "@ag-ui/client";
|
|
3
|
-
import { A as o, _ as i, a as n, C, b as r, c as p, d as l, e as u, f as c, g, h as d, i as h, j as A, k as v, l as S, m, n as y, o as I, p as f, q as R, r as T, s as U, t as x, u as M, v as P, w as b, x as V, y as K, z as O, G as w, L as G, M as L, B, D as H, O as D, E as F, F as Q, H as j, I as k, U as q, J as z, K as E, N as J, P as N, Q as W, R as X, S as Y, T as Z, V as _, W as $, X as ee, Y as ae, Z as te, $ as se, a0 as oe, a1 as ie, a2 as ne, a3 as Ce, a4 as re, a5 as pe, a6 as le, a7 as ue, a8 as ce, a9 as ge, aa as de, ab as he, ac as Ae, ad as ve } from "../use-render-activity-message-
|
|
3
|
+
import { A as o, _ as i, a as n, C, b as r, c as p, d as l, e as u, f as c, g, h as d, i as h, j as A, k as v, l as S, m, n as y, o as I, p as f, q as R, r as T, s as U, t as x, u as M, v as P, w as b, x as V, y as K, z as O, G as w, L as G, M as L, B, D as H, O as D, E as F, F as Q, H as j, I as k, U as q, J as z, K as E, N as J, P as N, Q as W, R as X, S as Y, T as Z, V as _, W as $, X as ee, Y as ae, Z as te, $ as se, a0 as oe, a1 as ie, a2 as ne, a3 as Ce, a4 as re, a5 as pe, a6 as le, a7 as ue, a8 as ce, a9 as ge, aa as de, ab as he, ac as Ae, ad as ve } from "../use-render-activity-message-8_HyVZWc.js";
|
|
4
4
|
import { createLicenseContextValue as me } from "@copilotkit/shared";
|
|
5
5
|
export {
|
|
6
6
|
o as A2UIActivityContentSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/vue",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Vue 3 components and composables for CopilotKit",
|
|
6
6
|
"keywords": [
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"streamdown-vue": "^1.0.29",
|
|
71
71
|
"zod": "^3.25.75",
|
|
72
72
|
"zod-to-json-schema": "^3.24.5",
|
|
73
|
-
"@copilotkit/core": "1.62.
|
|
74
|
-
"@copilotkit/
|
|
75
|
-
"@copilotkit/
|
|
73
|
+
"@copilotkit/core": "1.62.1",
|
|
74
|
+
"@copilotkit/shared": "1.62.1",
|
|
75
|
+
"@copilotkit/web-inspector": "1.62.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@eslint/js": "^9.39.2",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"scripts": {
|
|
115
115
|
"build": "vite build && pnpm build:css && pnpm build:types",
|
|
116
116
|
"build:css": "npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css -m && node scripts/scope-preflight.mjs ./dist/styles.css",
|
|
117
|
-
"build:types": "vue-tsc -p tsconfig.json --declaration --emitDeclarationOnly --outDir dist --skipLibCheck &&
|
|
117
|
+
"build:types": "vue-tsc -p tsconfig.json --declaration --emitDeclarationOnly --outDir dist --skipLibCheck && node -e \"const fs=require('fs');fs.cpSync('./dist/index.d.ts','./dist/index.d.mts');fs.cpSync('./dist/index.d.ts','./dist/index.d.cts');fs.cpSync('./dist/v2/index.d.ts','./dist/v2/index.d.mts');fs.cpSync('./dist/v2/index.d.ts','./dist/v2/index.d.cts')\"",
|
|
118
118
|
"dev:css": "npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css --watch --minify",
|
|
119
119
|
"dev": "concurrently \"pnpm dev:css\" \"vite build --watch\"",
|
|
120
120
|
"test": "vitest run",
|
|
@@ -125,6 +125,6 @@
|
|
|
125
125
|
"check-types": "vue-tsc --noEmit",
|
|
126
126
|
"publint": "publint .",
|
|
127
127
|
"attw": "attw --pack . --profile node16 --exclude-entrypoints ./styles.css --ignore-rules internal-resolution-error",
|
|
128
|
-
"clean": "
|
|
128
|
+
"clean": "node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\""
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -4,7 +4,10 @@ import type { AbstractAgent, Message } from "@ag-ui/client";
|
|
|
4
4
|
import { randomUUID } from "@copilotkit/shared";
|
|
5
5
|
import { useAgent } from "../use-agent";
|
|
6
6
|
import { useCopilotKit } from "../../providers/useCopilotKit";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
mountWithProvider,
|
|
9
|
+
renderWithCopilotKit,
|
|
10
|
+
} from "../../__tests__/utils/mount";
|
|
8
11
|
import { StateCapturingAgent } from "../../__tests__/utils/agents";
|
|
9
12
|
|
|
10
13
|
describe("useAgent", () => {
|
|
@@ -37,6 +40,62 @@ describe("useAgent", () => {
|
|
|
37
40
|
expect(wrapper.find("[data-testid=agent-id]").text()).toBe("test-agent");
|
|
38
41
|
});
|
|
39
42
|
|
|
43
|
+
it("uses agentId from chat configuration when no agentId prop is provided", () => {
|
|
44
|
+
const mockAgent = new StateCapturingAgent([], "configured-agent");
|
|
45
|
+
|
|
46
|
+
const Child = defineComponent({
|
|
47
|
+
setup() {
|
|
48
|
+
const { agent } = useAgent();
|
|
49
|
+
return () =>
|
|
50
|
+
h(
|
|
51
|
+
"span",
|
|
52
|
+
{ "data-testid": "agent-id" },
|
|
53
|
+
agent.value?.agentId ?? "none",
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const { wrapper } = renderWithCopilotKit(() => h(Child), {
|
|
59
|
+
agentId: "configured-agent",
|
|
60
|
+
agents: {
|
|
61
|
+
"configured-agent": mockAgent as unknown as AbstractAgent,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
expect(wrapper.find("[data-testid=agent-id]").text()).toBe(
|
|
66
|
+
"configured-agent",
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("uses explicit agentId over chat configuration", () => {
|
|
71
|
+
const configuredAgent = new StateCapturingAgent([], "configured-agent");
|
|
72
|
+
const explicitAgent = new StateCapturingAgent([], "explicit-agent");
|
|
73
|
+
|
|
74
|
+
const Child = defineComponent({
|
|
75
|
+
setup() {
|
|
76
|
+
const { agent } = useAgent({ agentId: "explicit-agent" });
|
|
77
|
+
return () =>
|
|
78
|
+
h(
|
|
79
|
+
"span",
|
|
80
|
+
{ "data-testid": "agent-id" },
|
|
81
|
+
agent.value?.agentId ?? "none",
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const { wrapper } = renderWithCopilotKit(() => h(Child), {
|
|
87
|
+
agentId: "configured-agent",
|
|
88
|
+
agents: {
|
|
89
|
+
"configured-agent": configuredAgent as unknown as AbstractAgent,
|
|
90
|
+
"explicit-agent": explicitAgent as unknown as AbstractAgent,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(wrapper.find("[data-testid=agent-id]").text()).toBe(
|
|
95
|
+
"explicit-agent",
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
40
99
|
it("passes state set through useAgent into run input", async () => {
|
|
41
100
|
const mockAgent = new StateCapturingAgent(
|
|
42
101
|
[{ newMessages: [] }],
|
|
@@ -128,8 +128,11 @@ function getOrCreateThreadClone(
|
|
|
128
128
|
* ```
|
|
129
129
|
*/
|
|
130
130
|
export function useAgent(props: UseAgentProps = {}) {
|
|
131
|
-
const agentId = computed(() => toValue(props.agentId) ?? DEFAULT_AGENT_ID);
|
|
132
131
|
const chatConfig = useCopilotChatConfiguration();
|
|
132
|
+
const agentId = computed(
|
|
133
|
+
() =>
|
|
134
|
+
toValue(props.agentId) ?? chatConfig.value?.agentId ?? DEFAULT_AGENT_ID,
|
|
135
|
+
);
|
|
133
136
|
const threadId = computed(
|
|
134
137
|
() => toValue(props.threadId) ?? chatConfig.value?.threadId,
|
|
135
138
|
);
|