@copilotkit/react-core 1.68.3 → 1.69.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/dist/{copilotkit-BUIK5yln.d.mts → copilotkit-DYKpg4pD.d.mts} +34 -25
- package/dist/copilotkit-DYKpg4pD.d.mts.map +1 -0
- package/dist/{copilotkit-Bocmlr37.cjs → copilotkit-Dr0speVK.cjs} +454 -48
- package/dist/copilotkit-Dr0speVK.cjs.map +1 -0
- package/dist/{copilotkit-C4RqjAba.mjs → copilotkit-Dr6g885f.mjs} +456 -50
- package/dist/copilotkit-Dr6g885f.mjs.map +1 -0
- package/dist/{copilotkit-DSvKW3SS.d.cts → copilotkit-Hl1t9Y1v.d.cts} +34 -25
- package/dist/copilotkit-Hl1t9Y1v.d.cts.map +1 -0
- package/dist/index.cjs +119 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +904 -28
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +904 -28
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +119 -75
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +185 -101
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +3 -2
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +5 -4
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +5 -4
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +3 -2
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- 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 +1 -1
- package/dist/v2/index.umd.js +451 -45
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/skills/react-core/SKILL.md +1 -1
- package/skills/react-core/references/provider-setup.md +23 -2
- package/skills/react-core/references/threads.md +3 -4
- package/dist/copilotkit-BUIK5yln.d.mts.map +0 -1
- package/dist/copilotkit-Bocmlr37.cjs.map +0 -1
- package/dist/copilotkit-C4RqjAba.mjs.map +0 -1
- package/dist/copilotkit-DSvKW3SS.d.cts.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -91,6 +91,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
91
91
|
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
92
92
|
assistantMessageToolbarInspectorLabel: "View in Inspector",
|
|
93
93
|
assistantMessageToolbarInspectorLocalOnlyLabel: "Local Only",
|
|
94
|
+
assistantMessageToolbarSaveSnippetLabel: "Save as snippet",
|
|
94
95
|
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
95
96
|
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
96
97
|
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
@@ -514,7 +515,8 @@ react_markdown = __toESM(react_markdown);
|
|
|
514
515
|
//#region src/v2/components/CopilotKitInspectorContext.tsx
|
|
515
516
|
const CopilotKitInspectorContext = react.createContext({
|
|
516
517
|
isLocalInspectorEnabled: false,
|
|
517
|
-
openInspector: () => void 0
|
|
518
|
+
openInspector: () => void 0,
|
|
519
|
+
saveEventSnippet: async () => void 0
|
|
518
520
|
});
|
|
519
521
|
const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
|
|
520
522
|
|
|
@@ -1296,6 +1298,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1296
1298
|
const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGenerativeUIActivityRendererInner({ content }) {
|
|
1297
1299
|
const initialHeight = content.initialHeight ?? 200;
|
|
1298
1300
|
const [autoHeight, setAutoHeight] = (0, react.useState)(null);
|
|
1301
|
+
const [sandboxReady, setSandboxReady] = (0, react.useState)(false);
|
|
1299
1302
|
const sandboxFunctions = useSandboxFunctions();
|
|
1300
1303
|
const localApi = (0, react.useMemo)(() => {
|
|
1301
1304
|
const api = {};
|
|
@@ -1397,6 +1400,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1397
1400
|
sandbox.promise.then(() => {
|
|
1398
1401
|
if (cancelled) return;
|
|
1399
1402
|
sandboxReadyRef.current = true;
|
|
1403
|
+
setSandboxReady(true);
|
|
1400
1404
|
sandbox.run(`
|
|
1401
1405
|
var s = document.createElement('style');
|
|
1402
1406
|
s.textContent = 'html, body { overflow: hidden !important; }';
|
|
@@ -1421,6 +1425,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1421
1425
|
sandboxRef.current = null;
|
|
1422
1426
|
}
|
|
1423
1427
|
sandboxReadyRef.current = false;
|
|
1428
|
+
setSandboxReady(false);
|
|
1424
1429
|
setAutoHeight(null);
|
|
1425
1430
|
};
|
|
1426
1431
|
}, [
|
|
@@ -1451,7 +1456,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1451
1456
|
const generationDone = content.generating === false;
|
|
1452
1457
|
(0, react.useEffect)(() => {
|
|
1453
1458
|
const sandbox = sandboxRef.current;
|
|
1454
|
-
if (!generationDone || !sandbox) return;
|
|
1459
|
+
if (!generationDone || !sandboxReady || !sandbox) return;
|
|
1455
1460
|
let handled = false;
|
|
1456
1461
|
const onMessage = (e) => {
|
|
1457
1462
|
if (handled) return;
|
|
@@ -1480,7 +1485,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1480
1485
|
return () => {
|
|
1481
1486
|
window.removeEventListener("message", onMessage);
|
|
1482
1487
|
};
|
|
1483
|
-
}, [generationDone]);
|
|
1488
|
+
}, [generationDone, sandboxReady]);
|
|
1484
1489
|
const height = autoHeight ?? initialHeight;
|
|
1485
1490
|
const isGenerating = content.generating !== false;
|
|
1486
1491
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -2368,10 +2373,46 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2368
2373
|
const requestInspectorOpen = (0, react.useCallback)((request) => {
|
|
2369
2374
|
setInspectorOpenRequest({ ...request });
|
|
2370
2375
|
}, []);
|
|
2376
|
+
const saveEventSnippet = (0, react.useCallback)(async (request) => {
|
|
2377
|
+
try {
|
|
2378
|
+
const mod = await import("@copilotkit/web-inspector");
|
|
2379
|
+
const threadId = request.threadId ?? "inspector-snippet";
|
|
2380
|
+
const runId = `inspector-snippet-${Date.now()}`;
|
|
2381
|
+
const compiled = mod.compileChatSnippet({
|
|
2382
|
+
...request,
|
|
2383
|
+
threadId,
|
|
2384
|
+
runId
|
|
2385
|
+
});
|
|
2386
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2387
|
+
const snippet = {
|
|
2388
|
+
id: crypto.randomUUID(),
|
|
2389
|
+
name: compiled.name,
|
|
2390
|
+
recipe: compiled.recipe,
|
|
2391
|
+
events: compiled.events,
|
|
2392
|
+
createdAt: now,
|
|
2393
|
+
updatedAt: now
|
|
2394
|
+
};
|
|
2395
|
+
mod.upsertEventSnippet(snippet);
|
|
2396
|
+
requestInspectorOpen({
|
|
2397
|
+
messageId: request.messageId,
|
|
2398
|
+
threadId: request.threadId,
|
|
2399
|
+
agentId: request.agentId,
|
|
2400
|
+
menu: "event-snippets",
|
|
2401
|
+
snippetId: snippet.id
|
|
2402
|
+
});
|
|
2403
|
+
} catch (error) {
|
|
2404
|
+
console.error("[CopilotKit] Could not save the event snippet.", error);
|
|
2405
|
+
}
|
|
2406
|
+
}, [requestInspectorOpen]);
|
|
2371
2407
|
const inspectorContextValue = (0, react.useMemo)(() => ({
|
|
2372
2408
|
isLocalInspectorEnabled,
|
|
2373
|
-
openInspector: requestInspectorOpen
|
|
2374
|
-
|
|
2409
|
+
openInspector: requestInspectorOpen,
|
|
2410
|
+
saveEventSnippet
|
|
2411
|
+
}), [
|
|
2412
|
+
isLocalInspectorEnabled,
|
|
2413
|
+
requestInspectorOpen,
|
|
2414
|
+
saveEventSnippet
|
|
2415
|
+
]);
|
|
2375
2416
|
const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
|
|
2376
2417
|
const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
|
|
2377
2418
|
const setFrom = (arr) => new Set(arr.map(key));
|
|
@@ -2426,7 +2467,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2426
2467
|
const hasLocalAgents = mergedAgents && Object.keys(mergedAgents).length > 0;
|
|
2427
2468
|
const hasSelfManagedAgents = Object.keys(selfManagedAgents).length > 0;
|
|
2428
2469
|
(0, react.useEffect)(() => {
|
|
2429
|
-
if (hasSelfManagedAgents && !resolvedPublicKey) console.warn("[CopilotKit] `selfManagedAgents` is part of CopilotKit's Enterprise Intelligence
|
|
2470
|
+
if (hasSelfManagedAgents && !resolvedPublicKey) console.warn("[CopilotKit] `selfManagedAgents` is part of CopilotKit's Enterprise Intelligence tier. Provide a `publicLicenseKey` for production use — contact the CopilotKit team about licensing.");
|
|
2430
2471
|
}, [hasSelfManagedAgents, resolvedPublicKey]);
|
|
2431
2472
|
const headers = typeof headersProp === "function" ? headersProp() : headersProp;
|
|
2432
2473
|
const mergedHeaders = (0, react.useMemo)(() => {
|
|
@@ -3590,7 +3631,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3590
3631
|
}
|
|
3591
3632
|
|
|
3592
3633
|
//#endregion
|
|
3593
|
-
//#region src/context/copilot-context.tsx
|
|
3634
|
+
//#region src/v1-deprecated/context/copilot-context.tsx
|
|
3594
3635
|
const emptyCopilotContext$1 = {
|
|
3595
3636
|
actions: {},
|
|
3596
3637
|
setAction: () => {},
|
|
@@ -3670,7 +3711,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3670
3711
|
}
|
|
3671
3712
|
|
|
3672
3713
|
//#endregion
|
|
3673
|
-
//#region src/hooks/use-tree.ts
|
|
3714
|
+
//#region src/v1-deprecated/hooks/use-tree.ts
|
|
3674
3715
|
const removeNode = (nodes, id) => {
|
|
3675
3716
|
return nodes.reduce((result, node) => {
|
|
3676
3717
|
if (node.id !== id) {
|
|
@@ -3783,7 +3824,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3783
3824
|
}
|
|
3784
3825
|
|
|
3785
3826
|
//#endregion
|
|
3786
|
-
//#region src/hooks/use-flat-category-store.ts
|
|
3827
|
+
//#region src/v1-deprecated/hooks/use-flat-category-store.ts
|
|
3787
3828
|
const useFlatCategoryStore = () => {
|
|
3788
3829
|
const [elements, dispatch] = (0, react.useReducer)(flatCategoryStoreReducer, /* @__PURE__ */ new Map());
|
|
3789
3830
|
return {
|
|
@@ -3841,7 +3882,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3841
3882
|
}
|
|
3842
3883
|
|
|
3843
3884
|
//#endregion
|
|
3844
|
-
//#region src/context/copilot-messages-context.tsx
|
|
3885
|
+
//#region src/v1-deprecated/context/copilot-messages-context.tsx
|
|
3845
3886
|
const emptyCopilotContext = {
|
|
3846
3887
|
messages: [],
|
|
3847
3888
|
setMessages: () => [],
|
|
@@ -3856,7 +3897,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3856
3897
|
}
|
|
3857
3898
|
|
|
3858
3899
|
//#endregion
|
|
3859
|
-
//#region src/components/toast/toast-provider.tsx
|
|
3900
|
+
//#region src/v1-deprecated/components/toast/toast-provider.tsx
|
|
3860
3901
|
const ToastContext = (0, react.createContext)(void 0);
|
|
3861
3902
|
function getErrorSeverity(error) {
|
|
3862
3903
|
if (error.severity) switch (error.severity) {
|
|
@@ -4163,7 +4204,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4163
4204
|
}
|
|
4164
4205
|
|
|
4165
4206
|
//#endregion
|
|
4166
|
-
//#region src/utils/dev-console.ts
|
|
4207
|
+
//#region src/v1-deprecated/utils/dev-console.ts
|
|
4167
4208
|
function isLocalhost() {
|
|
4168
4209
|
if (typeof window === "undefined") return false;
|
|
4169
4210
|
return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0";
|
|
@@ -4174,7 +4215,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4174
4215
|
}
|
|
4175
4216
|
|
|
4176
4217
|
//#endregion
|
|
4177
|
-
//#region src/components/copilot-provider/copilot-messages.tsx
|
|
4218
|
+
//#region src/v1-deprecated/components/copilot-provider/copilot-messages.tsx
|
|
4178
4219
|
/**
|
|
4179
4220
|
* An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
|
|
4180
4221
|
*/
|
|
@@ -4324,7 +4365,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4324
4365
|
}
|
|
4325
4366
|
|
|
4326
4367
|
//#endregion
|
|
4327
|
-
//#region src/components/usage-banner.tsx
|
|
4368
|
+
//#region src/v1-deprecated/components/usage-banner.tsx
|
|
4328
4369
|
function UsageBanner({ severity = _copilotkit_shared.Severity.CRITICAL, message = "", onClose, actions }) {
|
|
4329
4370
|
if (!message || !severity) return null;
|
|
4330
4371
|
const theme = {
|
|
@@ -4521,7 +4562,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4521
4562
|
};
|
|
4522
4563
|
|
|
4523
4564
|
//#endregion
|
|
4524
|
-
//#region src/utils/suggestions-constants.ts
|
|
4565
|
+
//#region src/v1-deprecated/utils/suggestions-constants.ts
|
|
4525
4566
|
/**
|
|
4526
4567
|
* Constants for suggestions retry logic
|
|
4527
4568
|
*/
|
|
@@ -4531,7 +4572,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4531
4572
|
};
|
|
4532
4573
|
|
|
4533
4574
|
//#endregion
|
|
4534
|
-
//#region src/lib/status-checker.ts
|
|
4575
|
+
//#region src/v1-deprecated/lib/status-checker.ts
|
|
4535
4576
|
const STATUS_CHECK_INTERVAL = 1e3 * 60 * 5;
|
|
4536
4577
|
var StatusChecker = class {
|
|
4537
4578
|
constructor() {
|
|
@@ -4553,7 +4594,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4553
4594
|
this.lastResponse = response;
|
|
4554
4595
|
onUpdate?.(response);
|
|
4555
4596
|
return response;
|
|
4556
|
-
} catch
|
|
4597
|
+
} catch {
|
|
4557
4598
|
return null;
|
|
4558
4599
|
}
|
|
4559
4600
|
};
|
|
@@ -4579,7 +4620,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4579
4620
|
};
|
|
4580
4621
|
|
|
4581
4622
|
//#endregion
|
|
4582
|
-
//#region src/components/toast/exclamation-mark-icon.tsx
|
|
4623
|
+
//#region src/v1-deprecated/components/toast/exclamation-mark-icon.tsx
|
|
4583
4624
|
const ExclamationMarkIcon = ({ className, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
4584
4625
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4585
4626
|
width: "24",
|
|
@@ -4614,7 +4655,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4614
4655
|
});
|
|
4615
4656
|
|
|
4616
4657
|
//#endregion
|
|
4617
|
-
//#region src/components/error-boundary/error-utils.tsx
|
|
4658
|
+
//#region src/v1-deprecated/components/error-boundary/error-utils.tsx
|
|
4618
4659
|
function ErrorToast({ errors }) {
|
|
4619
4660
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4620
4661
|
style: {
|
|
@@ -4688,7 +4729,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4688
4729
|
}
|
|
4689
4730
|
|
|
4690
4731
|
//#endregion
|
|
4691
|
-
//#region src/components/error-boundary/error-boundary.tsx
|
|
4732
|
+
//#region src/v1-deprecated/components/error-boundary/error-boundary.tsx
|
|
4692
4733
|
const statusChecker = new StatusChecker();
|
|
4693
4734
|
var CopilotErrorBoundary = class extends react.default.Component {
|
|
4694
4735
|
constructor(props) {
|
|
@@ -4729,7 +4770,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4729
4770
|
};
|
|
4730
4771
|
|
|
4731
4772
|
//#endregion
|
|
4732
|
-
//#region src/context/coagent-state-renders-context.tsx
|
|
4773
|
+
//#region src/v1-deprecated/context/coagent-state-renders-context.tsx
|
|
4733
4774
|
const CoAgentStateRendersContext = (0, react.createContext)(void 0);
|
|
4734
4775
|
function CoAgentStateRendersProvider({ children }) {
|
|
4735
4776
|
const [coAgentStateRenders, setCoAgentStateRenders] = (0, react.useState)({});
|
|
@@ -4764,7 +4805,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4764
4805
|
}
|
|
4765
4806
|
|
|
4766
4807
|
//#endregion
|
|
4767
|
-
//#region src/context/threads-context.tsx
|
|
4808
|
+
//#region src/v1-deprecated/context/threads-context.tsx
|
|
4768
4809
|
const ThreadsContext = (0, react.createContext)(void 0);
|
|
4769
4810
|
function ThreadsProvider({ children, threadId: explicitThreadId }) {
|
|
4770
4811
|
const [internalThreadId, setInternalThreadId] = (0, react.useState)(() => (0, _copilotkit_shared.randomUUID)());
|
|
@@ -4791,7 +4832,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4791
4832
|
}
|
|
4792
4833
|
|
|
4793
4834
|
//#endregion
|
|
4794
|
-
//#region src/hooks/use-coagent-state-render-bridge.helpers.ts
|
|
4835
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.helpers.ts
|
|
4795
4836
|
let RenderStatus = /* @__PURE__ */ function(RenderStatus) {
|
|
4796
4837
|
RenderStatus["InProgress"] = "inProgress";
|
|
4797
4838
|
RenderStatus["Complete"] = "complete";
|
|
@@ -4956,7 +4997,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4956
4997
|
}
|
|
4957
4998
|
|
|
4958
4999
|
//#endregion
|
|
4959
|
-
//#region src/hooks/use-coagent-state-render-registry.ts
|
|
5000
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render-registry.ts
|
|
4960
5001
|
const LAST_SNAPSHOTS_BY_RENDER_AND_RUN = "__lastSnapshotsByStateRenderIdAndRun";
|
|
4961
5002
|
const LAST_SNAPSHOTS_BY_MESSAGE = "__lastSnapshotsByMessageId";
|
|
4962
5003
|
function getClaimsStore(claimsRef) {
|
|
@@ -5078,7 +5119,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5078
5119
|
}
|
|
5079
5120
|
|
|
5080
5121
|
//#endregion
|
|
5081
|
-
//#region src/hooks/use-coagent-state-render-bridge.tsx
|
|
5122
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.tsx
|
|
5082
5123
|
function useCoagentStateRenderBridge(agentId, props) {
|
|
5083
5124
|
const { stateSnapshot, message } = props;
|
|
5084
5125
|
const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
|
|
@@ -5162,7 +5203,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5162
5203
|
}
|
|
5163
5204
|
|
|
5164
5205
|
//#endregion
|
|
5165
|
-
//#region src/components/CopilotListeners.tsx
|
|
5206
|
+
//#region src/v1-deprecated/components/CopilotListeners.tsx
|
|
5166
5207
|
const usePredictStateSubscription = (agent) => {
|
|
5167
5208
|
const predictStateToolsRef = (0, react.useRef)([]);
|
|
5168
5209
|
const getSubscriber = (0, react.useCallback)((agent) => ({
|
|
@@ -5232,7 +5273,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5232
5273
|
}
|
|
5233
5274
|
|
|
5234
5275
|
//#endregion
|
|
5235
|
-
//#region src/components/copilot-provider/copilotkit.tsx
|
|
5276
|
+
//#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
|
|
5236
5277
|
function CopilotKit({ children, ...props }) {
|
|
5237
5278
|
const enabled = shouldShowDevConsole(props.showDevConsole);
|
|
5238
5279
|
const showInspector = shouldShowDevConsole(props.enableInspector);
|
|
@@ -5250,7 +5291,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5250
5291
|
...v2Props,
|
|
5251
5292
|
showDevConsole: showInspector,
|
|
5252
5293
|
renderCustomMessages: renderArr,
|
|
5253
|
-
useSingleEndpoint: props.useSingleEndpoint ?? true,
|
|
5254
5294
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInternal, {
|
|
5255
5295
|
...props,
|
|
5256
5296
|
children
|
|
@@ -5731,7 +5771,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5731
5771
|
}
|
|
5732
5772
|
|
|
5733
5773
|
//#endregion
|
|
5734
|
-
//#region src/hooks/use-lazy-tool-renderer.tsx
|
|
5774
|
+
//#region src/v1-deprecated/hooks/use-lazy-tool-renderer.tsx
|
|
5735
5775
|
function useLazyToolRenderer() {
|
|
5736
5776
|
const renderToolCall = useRenderToolCall$1();
|
|
5737
5777
|
return (0, react.useCallback)((message, messages) => {
|
|
@@ -5747,7 +5787,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5747
5787
|
}
|
|
5748
5788
|
|
|
5749
5789
|
//#endregion
|
|
5750
|
-
//#region src/hooks/use-copilot-chat_internal.ts
|
|
5790
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat_internal.ts
|
|
5751
5791
|
function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages } = {}) {
|
|
5752
5792
|
const { copilotkit } = useCopilotKit();
|
|
5753
5793
|
const { threadId, agentSession } = useCopilotContext();
|
|
@@ -6048,7 +6088,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6048
6088
|
}
|
|
6049
6089
|
|
|
6050
6090
|
//#endregion
|
|
6051
|
-
//#region src/hooks/use-copilot-chat.ts
|
|
6091
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat.ts
|
|
6052
6092
|
/**
|
|
6053
6093
|
* A lightweight React hook for headless chat interactions.
|
|
6054
6094
|
* Perfect for programmatic messaging, background operations, and custom UI implementations.
|
|
@@ -6072,12 +6112,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6072
6112
|
}
|
|
6073
6113
|
|
|
6074
6114
|
//#endregion
|
|
6075
|
-
//#region src/hooks/use-copilot-chat-headless_c.ts
|
|
6115
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat-headless_c.ts
|
|
6076
6116
|
/**
|
|
6077
6117
|
* `useCopilotChatHeadless_c` is for building fully custom UI (headless UI) implementations.
|
|
6078
6118
|
*
|
|
6079
|
-
* <Callout title="This is
|
|
6080
|
-
* Read more about <a href="/premium/overview">
|
|
6119
|
+
* <Callout title="This is a CopilotKit Intelligence feature">
|
|
6120
|
+
* Read more about <a href="/premium/overview">CopilotKit Intelligence</a>.
|
|
6081
6121
|
*
|
|
6082
6122
|
* Usage is generous and **free** to get started.
|
|
6083
6123
|
* </Callout>
|
|
@@ -6256,11 +6296,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6256
6296
|
interrupt: null
|
|
6257
6297
|
});
|
|
6258
6298
|
/**
|
|
6259
|
-
*
|
|
6299
|
+
* CopilotKit Intelligence React hook that provides complete chat functionality for fully custom UI implementations.
|
|
6260
6300
|
* Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
|
|
6261
6301
|
*
|
|
6262
6302
|
* @param options - Configuration options for the chat
|
|
6263
|
-
* @returns Complete chat interface with all
|
|
6303
|
+
* @returns Complete chat interface with all CopilotKit Intelligence features
|
|
6264
6304
|
*
|
|
6265
6305
|
* @example
|
|
6266
6306
|
* ```tsx
|
|
@@ -6274,7 +6314,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6274
6314
|
(0, react.useEffect)(() => {
|
|
6275
6315
|
if (!hasPublicApiKey) {
|
|
6276
6316
|
setBannerError(new _copilotkit_shared.CopilotKitError({
|
|
6277
|
-
message: "You're using useCopilotChatHeadless_c,
|
|
6317
|
+
message: "You're using useCopilotChatHeadless_c, a CopilotKit Intelligence feature that offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key.",
|
|
6278
6318
|
code: _copilotkit_shared.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
6279
6319
|
severity: _copilotkit_shared.Severity.WARNING,
|
|
6280
6320
|
visibility: _copilotkit_shared.ErrorVisibility.BANNER
|
|
@@ -6287,7 +6327,26 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6287
6327
|
}
|
|
6288
6328
|
|
|
6289
6329
|
//#endregion
|
|
6290
|
-
//#region src/hooks/use-frontend-tool.ts
|
|
6330
|
+
//#region src/v1-deprecated/hooks/use-frontend-tool.ts
|
|
6331
|
+
/**
|
|
6332
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useFrontendTool` from `@copilotkit/react-core/v2` instead.
|
|
6333
|
+
*
|
|
6334
|
+
* ```tsx
|
|
6335
|
+
* import { useFrontendTool } from "@copilotkit/react-core/v2";
|
|
6336
|
+
* import { z } from "zod";
|
|
6337
|
+
*
|
|
6338
|
+
* function MyComponent() {
|
|
6339
|
+
* useFrontendTool({
|
|
6340
|
+
* name: "myTool",
|
|
6341
|
+
* description: "Run my tool",
|
|
6342
|
+
* parameters: z.object({}),
|
|
6343
|
+
* handler: async () => "done",
|
|
6344
|
+
* });
|
|
6345
|
+
* return null;
|
|
6346
|
+
* }
|
|
6347
|
+
* ```
|
|
6348
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useFrontendTool
|
|
6349
|
+
*/
|
|
6291
6350
|
function useFrontendTool(tool, dependencies) {
|
|
6292
6351
|
const { name, description, parameters, render, followUp, available } = tool;
|
|
6293
6352
|
const zodParameters = (0, _copilotkit_shared.getZodParameters)(parameters);
|
|
@@ -6325,7 +6384,27 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6325
6384
|
}
|
|
6326
6385
|
|
|
6327
6386
|
//#endregion
|
|
6328
|
-
//#region src/hooks/use-render-tool-call.ts
|
|
6387
|
+
//#region src/v1-deprecated/hooks/use-render-tool-call.ts
|
|
6388
|
+
/**
|
|
6389
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useRenderTool` from `@copilotkit/react-core/v2` instead.
|
|
6390
|
+
*
|
|
6391
|
+
* ```tsx
|
|
6392
|
+
* import { useRenderTool } from "@copilotkit/react-core/v2";
|
|
6393
|
+
* import { z } from "zod";
|
|
6394
|
+
*
|
|
6395
|
+
* function StatusTool() {
|
|
6396
|
+
* useRenderTool({
|
|
6397
|
+
* name: "showStatus",
|
|
6398
|
+
* parameters: z.object({}),
|
|
6399
|
+
* render: ({ status, result }) => (
|
|
6400
|
+
* <div>{status === "complete" ? result : "Running..."}</div>
|
|
6401
|
+
* ),
|
|
6402
|
+
* });
|
|
6403
|
+
* return null;
|
|
6404
|
+
* }
|
|
6405
|
+
* ```
|
|
6406
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useRenderTool
|
|
6407
|
+
*/
|
|
6329
6408
|
function useRenderToolCall(tool, dependencies) {
|
|
6330
6409
|
const { copilotkit } = useCopilotKit();
|
|
6331
6410
|
const hasAddedRef = (0, react.useRef)(false);
|
|
@@ -6365,7 +6444,28 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6365
6444
|
}
|
|
6366
6445
|
|
|
6367
6446
|
//#endregion
|
|
6368
|
-
//#region src/hooks/use-human-in-the-loop.ts
|
|
6447
|
+
//#region src/v1-deprecated/hooks/use-human-in-the-loop.ts
|
|
6448
|
+
/**
|
|
6449
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useHumanInTheLoop` from `@copilotkit/react-core/v2` instead.
|
|
6450
|
+
*
|
|
6451
|
+
* ```tsx
|
|
6452
|
+
* import { useHumanInTheLoop } from "@copilotkit/react-core/v2";
|
|
6453
|
+
* import { z } from "zod";
|
|
6454
|
+
*
|
|
6455
|
+
* function Confirmation() {
|
|
6456
|
+
* useHumanInTheLoop({
|
|
6457
|
+
* name: "confirmAction",
|
|
6458
|
+
* description: "Ask the user to confirm",
|
|
6459
|
+
* parameters: z.object({}),
|
|
6460
|
+
* render: ({ respond }) => (
|
|
6461
|
+
* <button onClick={() => respond?.(true)}>Confirm</button>
|
|
6462
|
+
* ),
|
|
6463
|
+
* });
|
|
6464
|
+
* return null;
|
|
6465
|
+
* }
|
|
6466
|
+
* ```
|
|
6467
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useHumanInTheLoop
|
|
6468
|
+
*/
|
|
6369
6469
|
function useHumanInTheLoop(tool, dependencies) {
|
|
6370
6470
|
const { render, ...toolRest } = tool;
|
|
6371
6471
|
const { name, description, parameters, followUp } = toolRest;
|
|
@@ -6417,7 +6517,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6417
6517
|
}
|
|
6418
6518
|
|
|
6419
6519
|
//#endregion
|
|
6420
|
-
//#region src/hooks/use-copilot-action.ts
|
|
6520
|
+
//#region src/v1-deprecated/hooks/use-copilot-action.ts
|
|
6421
6521
|
/**
|
|
6422
6522
|
* Example usage of useCopilotAction with complex parameters:
|
|
6423
6523
|
*
|
|
@@ -6616,7 +6716,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6616
6716
|
}
|
|
6617
6717
|
|
|
6618
6718
|
//#endregion
|
|
6619
|
-
//#region src/hooks/use-coagent-state-render.ts
|
|
6719
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render.ts
|
|
6620
6720
|
/**
|
|
6621
6721
|
* The useCoAgentStateRender hook allows you to render UI or text based components on a Agentic Copilot's state in the chat.
|
|
6622
6722
|
* This is particularly useful for showing intermediate state or progress during Agentic Copilot operations.
|
|
@@ -6724,7 +6824,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6724
6824
|
}
|
|
6725
6825
|
|
|
6726
6826
|
//#endregion
|
|
6727
|
-
//#region src/hooks/use-make-copilot-document-readable.ts
|
|
6827
|
+
//#region src/v1-deprecated/hooks/use-make-copilot-document-readable.ts
|
|
6728
6828
|
/**
|
|
6729
6829
|
* Makes a document readable by Copilot.
|
|
6730
6830
|
* @param document The document to make readable.
|
|
@@ -6750,7 +6850,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6750
6850
|
}
|
|
6751
6851
|
|
|
6752
6852
|
//#endregion
|
|
6753
|
-
//#region src/hooks/use-copilot-readable.ts
|
|
6853
|
+
//#region src/v1-deprecated/hooks/use-copilot-readable.ts
|
|
6754
6854
|
/**
|
|
6755
6855
|
* `useCopilotReadable` is a React hook that provides app-state and other information
|
|
6756
6856
|
* to the Copilot.
|
|
@@ -6821,6 +6921,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6821
6921
|
*/
|
|
6822
6922
|
/**
|
|
6823
6923
|
* Adds the given information to the Copilot context to make it readable by Copilot.
|
|
6924
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useAgentContext` from `@copilotkit/react-core/v2` instead.
|
|
6925
|
+
*
|
|
6926
|
+
* ```tsx
|
|
6927
|
+
* import { useAgentContext } from "@copilotkit/react-core/v2";
|
|
6928
|
+
*
|
|
6929
|
+
* function UserContext() {
|
|
6930
|
+
* useAgentContext({
|
|
6931
|
+
* description: "The current user",
|
|
6932
|
+
* value: { name: "Ada" },
|
|
6933
|
+
* });
|
|
6934
|
+
* return null;
|
|
6935
|
+
* }
|
|
6936
|
+
* ```
|
|
6937
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useAgentContext
|
|
6824
6938
|
*/
|
|
6825
6939
|
function useCopilotReadable({ description, value, convert, available = "enabled" }, dependencies) {
|
|
6826
6940
|
const { copilotkit } = useCopilotKit();
|
|
@@ -6849,7 +6963,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6849
6963
|
}
|
|
6850
6964
|
|
|
6851
6965
|
//#endregion
|
|
6852
|
-
//#region src/hooks/use-agent-nodename.ts
|
|
6966
|
+
//#region src/v1-deprecated/hooks/use-agent-nodename.ts
|
|
6853
6967
|
/**
|
|
6854
6968
|
* Tracks the node the agent is currently executing.
|
|
6855
6969
|
*
|
|
@@ -6884,7 +6998,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6884
6998
|
}
|
|
6885
6999
|
|
|
6886
7000
|
//#endregion
|
|
6887
|
-
//#region src/hooks/use-coagent.ts
|
|
7001
|
+
//#region src/v1-deprecated/hooks/use-coagent.ts
|
|
6888
7002
|
/**
|
|
6889
7003
|
* <Callout type="info">
|
|
6890
7004
|
* Usage of this hook assumes some additional setup in your application, for more information
|
|
@@ -7092,7 +7206,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7092
7206
|
};
|
|
7093
7207
|
|
|
7094
7208
|
//#endregion
|
|
7095
|
-
//#region src/hooks/use-copilot-runtime-client.ts
|
|
7209
|
+
//#region src/v1-deprecated/hooks/use-copilot-runtime-client.ts
|
|
7096
7210
|
const useCopilotRuntimeClient = (options) => {
|
|
7097
7211
|
const { setBannerError } = useToast();
|
|
7098
7212
|
const { showDevConsole, onError, ...runtimeOptions } = options;
|
|
@@ -7195,7 +7309,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7195
7309
|
}
|
|
7196
7310
|
|
|
7197
7311
|
//#endregion
|
|
7198
|
-
//#region src/hooks/use-copilot-authenticated-action.ts
|
|
7312
|
+
//#region src/v1-deprecated/hooks/use-copilot-authenticated-action.ts
|
|
7199
7313
|
/**
|
|
7200
7314
|
* Hook to create an authenticated action that requires user sign-in before execution.
|
|
7201
7315
|
*
|
|
@@ -7238,7 +7352,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7238
7352
|
}
|
|
7239
7353
|
|
|
7240
7354
|
//#endregion
|
|
7241
|
-
//#region src/hooks/use-langgraph-interrupt.ts
|
|
7355
|
+
//#region src/v1-deprecated/hooks/use-langgraph-interrupt.ts
|
|
7242
7356
|
/**
|
|
7243
7357
|
* Transforms a v2 InterruptEvent into the v1 LangGraphInterruptEvent shape
|
|
7244
7358
|
* expected by existing useLangGraphInterrupt callbacks.
|
|
@@ -7251,6 +7365,23 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7251
7365
|
value
|
|
7252
7366
|
};
|
|
7253
7367
|
}
|
|
7368
|
+
/**
|
|
7369
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useInterrupt` from `@copilotkit/react-core/v2` instead.
|
|
7370
|
+
*
|
|
7371
|
+
* ```tsx
|
|
7372
|
+
* import { useInterrupt } from "@copilotkit/react-core/v2";
|
|
7373
|
+
*
|
|
7374
|
+
* function ApprovalInterrupt() {
|
|
7375
|
+
* useInterrupt({
|
|
7376
|
+
* render: ({ resolve }) => (
|
|
7377
|
+
* <button onClick={() => resolve({ approved: true })}>Approve</button>
|
|
7378
|
+
* ),
|
|
7379
|
+
* });
|
|
7380
|
+
* return null;
|
|
7381
|
+
* }
|
|
7382
|
+
* ```
|
|
7383
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useInterrupt
|
|
7384
|
+
*/
|
|
7254
7385
|
function useLangGraphInterrupt(action, _dependencies) {
|
|
7255
7386
|
const actionRef = (0, react.useRef)(action);
|
|
7256
7387
|
actionRef.current = action;
|
|
@@ -7298,7 +7429,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7298
7429
|
}
|
|
7299
7430
|
|
|
7300
7431
|
//#endregion
|
|
7301
|
-
//#region src/hooks/use-copilot-additional-instructions.ts
|
|
7432
|
+
//#region src/v1-deprecated/hooks/use-copilot-additional-instructions.ts
|
|
7302
7433
|
/**
|
|
7303
7434
|
* `useCopilotAdditionalInstructions` is a React hook that provides additional instructions
|
|
7304
7435
|
* to the Copilot.
|
|
@@ -7357,7 +7488,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7357
7488
|
}
|
|
7358
7489
|
|
|
7359
7490
|
//#endregion
|
|
7360
|
-
//#region src/hooks/use-default-tool.ts
|
|
7491
|
+
//#region src/v1-deprecated/hooks/use-default-tool.ts
|
|
7361
7492
|
function useDefaultTool(tool, dependencies) {
|
|
7362
7493
|
useCopilotAction({
|
|
7363
7494
|
...tool,
|
|
@@ -7366,7 +7497,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7366
7497
|
}
|
|
7367
7498
|
|
|
7368
7499
|
//#endregion
|
|
7369
|
-
//#region src/hooks/use-copilot-chat-suggestions.tsx
|
|
7500
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat-suggestions.tsx
|
|
7370
7501
|
/**
|
|
7371
7502
|
* <Callout type="warning">
|
|
7372
7503
|
* useCopilotChatSuggestions is experimental. The interface is not final and
|
|
@@ -7438,7 +7569,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7438
7569
|
}
|
|
7439
7570
|
|
|
7440
7571
|
//#endregion
|
|
7441
|
-
//#region src/types/frontend-action.ts
|
|
7572
|
+
//#region src/v1-deprecated/types/frontend-action.ts
|
|
7442
7573
|
function processActionsForRuntimeRequest(actions) {
|
|
7443
7574
|
return actions.filter((action) => action.available !== _copilotkit_runtime_client_gql.ActionInputAvailability.Disabled && action.disabled !== true && action.name !== "*" && action.available != "frontend" && !action.pairedAction).map((action) => {
|
|
7444
7575
|
let available = _copilotkit_runtime_client_gql.ActionInputAvailability.Enabled;
|
|
@@ -7455,54 +7586,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7455
7586
|
}
|
|
7456
7587
|
|
|
7457
7588
|
//#endregion
|
|
7458
|
-
//#region src/lib/copilot-task.ts
|
|
7459
|
-
/**
|
|
7460
|
-
* This class is used to execute one-off tasks, for example on button press. It can use the context available via [useCopilotReadable](/reference/v1/hooks/useCopilotReadable) and the actions provided by [useCopilotAction](/reference/v1/hooks/useCopilotAction), or you can provide your own context and actions.
|
|
7461
|
-
*
|
|
7462
|
-
* ## Example
|
|
7463
|
-
* In the simplest case, use CopilotTask in the context of your app by giving it instructions on what to do.
|
|
7464
|
-
*
|
|
7465
|
-
* ```tsx
|
|
7466
|
-
* import { CopilotTask, useCopilotContext } from "@copilotkit/react-core";
|
|
7467
|
-
*
|
|
7468
|
-
* export function MyComponent() {
|
|
7469
|
-
* const context = useCopilotContext();
|
|
7470
|
-
*
|
|
7471
|
-
* const task = new CopilotTask({
|
|
7472
|
-
* instructions: "Set a random message",
|
|
7473
|
-
* actions: [
|
|
7474
|
-
* {
|
|
7475
|
-
* name: "setMessage",
|
|
7476
|
-
* description: "Set the message.",
|
|
7477
|
-
* argumentAnnotations: [
|
|
7478
|
-
* {
|
|
7479
|
-
* name: "message",
|
|
7480
|
-
* type: "string",
|
|
7481
|
-
* description:
|
|
7482
|
-
* "A message to display.",
|
|
7483
|
-
* required: true,
|
|
7484
|
-
* },
|
|
7485
|
-
* ],
|
|
7486
|
-
* }
|
|
7487
|
-
* ]
|
|
7488
|
-
* });
|
|
7489
|
-
*
|
|
7490
|
-
* const executeTask = async () => {
|
|
7491
|
-
* await task.run(context, action);
|
|
7492
|
-
* }
|
|
7493
|
-
*
|
|
7494
|
-
* return (
|
|
7495
|
-
* <>
|
|
7496
|
-
* <button onClick={executeTask}>
|
|
7497
|
-
* Execute task
|
|
7498
|
-
* </button>
|
|
7499
|
-
* </>
|
|
7500
|
-
* )
|
|
7501
|
-
* }
|
|
7502
|
-
* ```
|
|
7503
|
-
*
|
|
7504
|
-
* Have a look at the [Presentation Example App](https://github.com/CopilotKit/CopilotKit/blob/main/examples/v1/next-openai/src/app/presentation/page.tsx) for a more complete example.
|
|
7505
|
-
*/
|
|
7589
|
+
//#region src/v1-deprecated/lib/copilot-task.ts
|
|
7506
7590
|
var CopilotTask = class {
|
|
7507
7591
|
constructor(config) {
|
|
7508
7592
|
this.instructions = config.instructions;
|