@copilotkit/react-core 2.0.0-rc.3 → 2.0.0-rc.30
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/{MarkdownRendererContext-B4Us6mwL.d.cts → MarkdownRendererContext-BX26QLwl.d.cts} +16 -33
- package/dist/MarkdownRendererContext-BX26QLwl.d.cts.map +1 -0
- package/dist/{MarkdownRendererContext-CRKFzsEB.d.mts → MarkdownRendererContext-DAOMewji.d.mts} +16 -33
- package/dist/MarkdownRendererContext-DAOMewji.d.mts.map +1 -0
- package/dist/{MarkdownSurfaces-S4wfUl3J.cjs → MarkdownSurfaces-BbrHcSHN.cjs} +246 -334
- package/dist/MarkdownSurfaces-BbrHcSHN.cjs.map +1 -0
- package/dist/{MarkdownSurfaces-Bd--93O1.mjs → MarkdownSurfaces-DQbRS91-.mjs} +226 -315
- package/dist/MarkdownSurfaces-DQbRS91-.mjs.map +1 -0
- package/dist/context.cjs +75 -63
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +62 -107
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.mts +62 -107
- package/dist/context.d.mts.map +1 -1
- package/dist/context.mjs +76 -64
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui.cjs +570 -567
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +2137 -4178
- package/dist/generative-ui.d.cts.map +1 -1
- package/dist/generative-ui.d.mts +2137 -4178
- package/dist/generative-ui.d.mts.map +1 -1
- package/dist/generative-ui.mjs +75 -73
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.cjs +289 -1054
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +159 -293
- package/dist/headless.d.cts.map +1 -1
- package/dist/headless.d.mts +112 -232
- package/dist/headless.d.mts.map +1 -1
- package/dist/headless.mjs +283 -1054
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +4157 -6520
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +332 -831
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +329 -828
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2012 -6009
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +4057 -6472
- package/dist/index.umd.js.map +1 -1
- package/package.json +19 -20
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
- package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
- package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +0 -1
package/dist/headless.d.mts
CHANGED
|
@@ -1,59 +1,40 @@
|
|
|
1
|
-
import React$1, { ComponentType, ReactNode } from "react";
|
|
1
|
+
import React$1, { ComponentType, MutableRefObject, ReactNode } from "react";
|
|
2
|
+
import * as _copilotkit_core0 from "@copilotkit/core";
|
|
3
|
+
import { CopilotChatDefaultLabels, CopilotChatLabels, CopilotChatLabels as CopilotChatLabels$1, FrontendTool, HumanInTheLoopRenderProps, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, Suggestion, ToolCallRenderProps, ToolCallRendererDef, ɵChatConfigurationStore, ɵJsonSerializable, ɵSuggestionsConfigInput, ɵThreadSummary } from "@copilotkit/core";
|
|
2
4
|
import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
|
|
3
|
-
import { DynamicSuggestionsConfig, FrontendTool, StaticSuggestionsConfig, Suggestion, ToolCallStatus } from "@copilotkit/core";
|
|
4
|
-
import { AbstractAgent, Interrupt, ResumeEntry, ResumeStatus, RunAgentResult } from "@ag-ui/client";
|
|
5
|
-
import { AgentCapabilities, ToolCall, ToolMessage } from "@ag-ui/core";
|
|
6
5
|
import { CopilotKitCoreReact, CopilotKitCoreReactConfig, useCopilotKit } from "@copilotkit/react-core/context";
|
|
6
|
+
import * as _ag_ui_client0 from "@ag-ui/client";
|
|
7
|
+
import { Interrupt, ResumeEntry, ResumeStatus } from "@ag-ui/client";
|
|
8
|
+
import { AgentCapabilities, ToolCall, ToolMessage } from "@ag-ui/core";
|
|
7
9
|
|
|
10
|
+
//#region src/providers/use-owned-core.d.ts
|
|
11
|
+
/** The part of a core this hook needs: something it can dispose. */
|
|
12
|
+
interface Disposable {
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @internal Create a core for the provider's lifetime and dispose it on
|
|
17
|
+
* unmount.
|
|
18
|
+
*
|
|
19
|
+
* The dispose waits one task. StrictMode (and Fast Refresh) unmount and
|
|
20
|
+
* remount effects in the same commit, so the remount cancels the pending
|
|
21
|
+
* dispose and the same core keeps working. When effects mount again after the
|
|
22
|
+
* core was really disposed (for example an `<Activity>` that was hidden and
|
|
23
|
+
* shown), the hook creates a new core and renders again: a disposed core is
|
|
24
|
+
* never reused.
|
|
25
|
+
*
|
|
26
|
+
* `ref` holds the current core. The provider owns it, so code that runs
|
|
27
|
+
* before the core exists can read `ref.current`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const coreRef = useRef<CopilotKitCoreReact | null>(null);
|
|
31
|
+
* const core = ɵuseOwnedCore(coreRef, () => new CopilotKitCoreReact(config));
|
|
32
|
+
*/
|
|
33
|
+
declare function ɵuseOwnedCore<T extends Disposable>(ref: MutableRefObject<T | null>, create: () => T): T;
|
|
34
|
+
//#endregion
|
|
8
35
|
//#region src/providers/CopilotChatConfigurationProvider.d.ts
|
|
9
|
-
declare const CopilotChatDefaultLabels: {
|
|
10
|
-
chatInputPlaceholder: string;
|
|
11
|
-
chatInputToolbarStartTranscribeButtonLabel: string;
|
|
12
|
-
chatInputToolbarCancelTranscribeButtonLabel: string;
|
|
13
|
-
chatInputToolbarFinishTranscribeButtonLabel: string;
|
|
14
|
-
chatInputToolbarAddButtonLabel: string;
|
|
15
|
-
chatInputToolbarToolsButtonLabel: string;
|
|
16
|
-
chatInputToolbarSendButtonLabel: string;
|
|
17
|
-
chatInputToolbarStopButtonLabel: string;
|
|
18
|
-
assistantMessageToolbarCopyCodeLabel: string;
|
|
19
|
-
assistantMessageToolbarCopyCodeCopiedLabel: string;
|
|
20
|
-
assistantMessageToolbarCopyMessageLabel: string;
|
|
21
|
-
assistantMessageToolbarInspectorLabel: string;
|
|
22
|
-
assistantMessageToolbarInspectorDescription: string;
|
|
23
|
-
assistantMessageToolbarInspectorLocalOnlyLabel: string;
|
|
24
|
-
assistantMessageToolbarInspectorLocalOnlyDescription: string;
|
|
25
|
-
assistantMessageToolbarInspectorTitle: string;
|
|
26
|
-
assistantMessageToolbarInspectorHideLabel: string;
|
|
27
|
-
assistantMessageToolbarInspectorHideDescription: string;
|
|
28
|
-
assistantMessageToolbarThumbsUpLabel: string;
|
|
29
|
-
assistantMessageToolbarThumbsDownLabel: string;
|
|
30
|
-
assistantMessageFeedbackCommentPlaceholder: string;
|
|
31
|
-
assistantMessageFeedbackCommentSubmitLabel: string;
|
|
32
|
-
assistantMessageToolbarReadAloudLabel: string;
|
|
33
|
-
assistantMessageToolbarRegenerateLabel: string;
|
|
34
|
-
userMessageToolbarCopyMessageLabel: string;
|
|
35
|
-
userMessageToolbarEditMessageLabel: string;
|
|
36
|
-
userMessageToolbarPreviousBranchLabel: string;
|
|
37
|
-
userMessageToolbarNextBranchLabel: string;
|
|
38
|
-
chatDisclaimerText: string;
|
|
39
|
-
chatToggleOpenLabel: string;
|
|
40
|
-
chatToggleCloseLabel: string;
|
|
41
|
-
chatScrollToBottomLabel: string;
|
|
42
|
-
modalHeaderTitle: string;
|
|
43
|
-
welcomeMessageText: string;
|
|
44
|
-
reasoningMessageThinkingLabel: string;
|
|
45
|
-
chatInputSlashMenuLabel: string;
|
|
46
|
-
chatInputSlashMenuEmptyText: string;
|
|
47
|
-
attachmentRemoveButtonLabel: string;
|
|
48
|
-
attachmentPlayVideoButtonLabel: string;
|
|
49
|
-
attachmentPreviewCloseButtonLabel: string;
|
|
50
|
-
modalHeaderCloseButtonLabel: string;
|
|
51
|
-
modalHeaderThreadsButtonLabel: string;
|
|
52
|
-
sidebarLabel: string;
|
|
53
|
-
};
|
|
54
|
-
type CopilotChatLabels = typeof CopilotChatDefaultLabels;
|
|
55
36
|
interface CopilotChatConfigurationValue {
|
|
56
|
-
labels: CopilotChatLabels;
|
|
37
|
+
labels: CopilotChatLabels$1;
|
|
57
38
|
agentId: string;
|
|
58
39
|
threadId: string;
|
|
59
40
|
isModalOpen: boolean;
|
|
@@ -126,10 +107,15 @@ interface CopilotChatConfigurationValue {
|
|
|
126
107
|
* threadId is prop-controlled.
|
|
127
108
|
*/
|
|
128
109
|
startNewThread: () => void;
|
|
110
|
+
/**
|
|
111
|
+
* Internal: the core store behind this value, so a nested provider can link
|
|
112
|
+
* its own store to it.
|
|
113
|
+
*/
|
|
114
|
+
ɵstore?: ɵChatConfigurationStore;
|
|
129
115
|
}
|
|
130
116
|
interface CopilotChatConfigurationProviderProps {
|
|
131
117
|
children: ReactNode;
|
|
132
|
-
labels?: Partial<CopilotChatLabels>;
|
|
118
|
+
labels?: Partial<CopilotChatLabels$1>;
|
|
133
119
|
agentId?: string;
|
|
134
120
|
threadId?: string;
|
|
135
121
|
hasExplicitThreadId?: boolean;
|
|
@@ -263,7 +249,7 @@ declare function useAgent({
|
|
|
263
249
|
updates,
|
|
264
250
|
throttleMs
|
|
265
251
|
}?: UseAgentProps): {
|
|
266
|
-
agent: AbstractAgent;
|
|
252
|
+
agent: _ag_ui_client0.AbstractAgent | _copilotkit_core0.ProxiedCopilotRuntimeAgent;
|
|
267
253
|
/**
|
|
268
254
|
* Whether `agent` is the real, runtime-synced (or locally-registered) agent
|
|
269
255
|
* rather than a provisional stand-in returned while the runtime is still
|
|
@@ -282,45 +268,16 @@ declare function useAgent({
|
|
|
282
268
|
};
|
|
283
269
|
//#endregion
|
|
284
270
|
//#region src/types/react-tool-call-renderer.d.ts
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
*/
|
|
296
|
-
agentId?: string;
|
|
297
|
-
/**
|
|
298
|
-
* Whether calls this renderer draws join the chat's tool-call groups (see
|
|
299
|
-
* `toolCallDisplay` on `CopilotChatMessageView`). CopilotKit's built-in card
|
|
300
|
-
* sets it; a renderer that leaves it unset always shows its calls on their
|
|
301
|
-
* own, since the chat can't tell what it draws (it may even draw nothing).
|
|
302
|
-
*/
|
|
303
|
-
group?: boolean;
|
|
304
|
-
render: React.ComponentType<{
|
|
305
|
-
name: string;
|
|
306
|
-
toolCallId: string;
|
|
307
|
-
args: Partial<T>;
|
|
308
|
-
status: ToolCallStatus.InProgress;
|
|
309
|
-
result: undefined;
|
|
310
|
-
} | {
|
|
311
|
-
name: string;
|
|
312
|
-
toolCallId: string;
|
|
313
|
-
args: T;
|
|
314
|
-
status: ToolCallStatus.Executing;
|
|
315
|
-
result: undefined;
|
|
316
|
-
} | {
|
|
317
|
-
name: string;
|
|
318
|
-
toolCallId: string;
|
|
319
|
-
args: T;
|
|
320
|
-
status: ToolCallStatus.Complete;
|
|
321
|
-
result: string;
|
|
322
|
-
}>;
|
|
323
|
-
}
|
|
271
|
+
/**
|
|
272
|
+
* A tool call renderer for React: a React component that draws one tool call
|
|
273
|
+
* in the chat. The component receives {@link ToolCallRenderProps}.
|
|
274
|
+
*
|
|
275
|
+
* Pass a list of these to `renderToolCalls` on `CopilotKitProvider`, or build
|
|
276
|
+
* one with `defineToolCallRenderer`.
|
|
277
|
+
*
|
|
278
|
+
* @typeParam T - The shape of the tool arguments.
|
|
279
|
+
*/
|
|
280
|
+
type ReactToolCallRenderer<T = unknown> = ToolCallRendererDef<T, React$1.ComponentType<ToolCallRenderProps<T>>>;
|
|
324
281
|
//#endregion
|
|
325
282
|
//#region src/types/frontend-tool.d.ts
|
|
326
283
|
type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = FrontendTool<T> & {
|
|
@@ -328,6 +285,30 @@ type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknow
|
|
|
328
285
|
};
|
|
329
286
|
//#endregion
|
|
330
287
|
//#region src/hooks/use-frontend-tool.d.ts
|
|
288
|
+
/**
|
|
289
|
+
* Register a frontend tool while the component is mounted. The agent can
|
|
290
|
+
* call it, and its `render` component draws the call in the chat.
|
|
291
|
+
*
|
|
292
|
+
* A tool with the same name and agentId as a tool that is already registered
|
|
293
|
+
* (for example one from the provider's `tools`) overrides it while this
|
|
294
|
+
* component is mounted. When the component unmounts, the overridden tool is
|
|
295
|
+
* active again. The renderer stays registered after unmount, so past tool
|
|
296
|
+
* calls still render in the chat history.
|
|
297
|
+
*
|
|
298
|
+
* @param tool - The tool to register.
|
|
299
|
+
* @param deps - Extra values that re-register the tool when they change. Use
|
|
300
|
+
* it when the handler closes over a value that is not part of the tool.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```tsx
|
|
304
|
+
* useFrontendTool({
|
|
305
|
+
* name: "showWeather",
|
|
306
|
+
* description: "Show the weather for a city",
|
|
307
|
+
* parameters: z.object({ city: z.string() }),
|
|
308
|
+
* handler: async ({ city }) => `Sunny in ${city}`,
|
|
309
|
+
* });
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
331
312
|
declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
|
|
332
313
|
//#endregion
|
|
333
314
|
//#region src/hooks/use-frontend-tools.d.ts
|
|
@@ -341,8 +322,10 @@ declare function useFrontendTool<T extends Record<string, unknown> = Record<stri
|
|
|
341
322
|
*
|
|
342
323
|
* Tools are keyed by `name` plus `agentId`, the same as `useFrontendTool`. A
|
|
343
324
|
* tool that disappears from the array is unregistered on the next render, and
|
|
344
|
-
* every tool is unregistered on unmount.
|
|
345
|
-
*
|
|
325
|
+
* every tool is unregistered on unmount. A listed tool hides a tool with the
|
|
326
|
+
* same name and agentId (for example one from the provider's `tools`) until it
|
|
327
|
+
* is unregistered, and then the hidden tool is active again. Renderers stay
|
|
328
|
+
* registered after unmount so past tool calls still render in the chat history.
|
|
346
329
|
*
|
|
347
330
|
* @param tools - The tools to register. May be empty and may change length.
|
|
348
331
|
* @param deps - Extra dependencies that force re-registration, compared by
|
|
@@ -444,109 +427,30 @@ declare function useComponent<TSchema extends StandardSchemaV1<any, Record<strin
|
|
|
444
427
|
}, deps?: ReadonlyArray<unknown>): void;
|
|
445
428
|
//#endregion
|
|
446
429
|
//#region src/types/human-in-the-loop.d.ts
|
|
430
|
+
/**
|
|
431
|
+
* A human-in-the-loop tool for React. It has no handler: the agent waits until
|
|
432
|
+
* the `render` component calls `respond` with the user's answer.
|
|
433
|
+
*
|
|
434
|
+
* @typeParam T - The shape of the tool arguments.
|
|
435
|
+
*/
|
|
447
436
|
type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
|
|
448
437
|
/**
|
|
449
|
-
* Render the human-in-the-loop UI for this tool call.
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
* stable key for correlating this interrupt with runtime (sub)agent
|
|
455
|
-
* attribution — e.g. the `agentId` reported by `onToolExecutionStart`, or
|
|
456
|
-
* per-run attribution stamped on the event stream — so the UI can label
|
|
457
|
-
* the interrupt with the agent that actually raised it.
|
|
458
|
-
* - `agentId` — the agent this tool was *registered* to (the tool's own
|
|
459
|
-
* `agentId`), or `undefined` for an unscoped tool. This is the static
|
|
460
|
-
* registration scope; it is NOT necessarily the runtime (sub)agent that
|
|
461
|
-
* raised the interrupt. For runtime attribution, correlate `toolCallId`
|
|
462
|
-
* with the event-stream/`onToolExecutionStart` agent id.
|
|
463
|
-
*/
|
|
464
|
-
render: React$1.ComponentType<{
|
|
465
|
-
name: string;
|
|
466
|
-
description: string;
|
|
467
|
-
toolCallId: string;
|
|
468
|
-
agentId?: string;
|
|
469
|
-
args: Partial<T>;
|
|
470
|
-
status: ToolCallStatus.InProgress;
|
|
471
|
-
result: undefined;
|
|
472
|
-
respond: undefined;
|
|
473
|
-
} | {
|
|
474
|
-
name: string;
|
|
475
|
-
description: string;
|
|
476
|
-
toolCallId: string;
|
|
477
|
-
agentId?: string;
|
|
478
|
-
args: T;
|
|
479
|
-
status: ToolCallStatus.Executing;
|
|
480
|
-
result: undefined;
|
|
481
|
-
respond: (result: unknown) => Promise<void>;
|
|
482
|
-
} | {
|
|
483
|
-
name: string;
|
|
484
|
-
description: string;
|
|
485
|
-
toolCallId: string;
|
|
486
|
-
agentId?: string;
|
|
487
|
-
args: T;
|
|
488
|
-
status: ToolCallStatus.Complete;
|
|
489
|
-
result: string;
|
|
490
|
-
respond: undefined;
|
|
491
|
-
}>;
|
|
438
|
+
* Render the human-in-the-loop UI for this tool call. The component
|
|
439
|
+
* receives {@link HumanInTheLoopRenderProps}, which also carry `toolCallId`
|
|
440
|
+
* and `agentId` for attribution.
|
|
441
|
+
*/
|
|
442
|
+
render: React$1.ComponentType<HumanInTheLoopRenderProps<T>>;
|
|
492
443
|
};
|
|
493
444
|
//#endregion
|
|
494
445
|
//#region src/hooks/use-human-in-the-loop.d.ts
|
|
495
446
|
declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
|
|
496
447
|
//#endregion
|
|
497
|
-
//#region src/types/interrupt.d.ts
|
|
498
|
-
/** Legacy custom-event interrupt payload (agent emits a custom `on_interrupt` event). */
|
|
499
|
-
interface InterruptEvent<TValue = unknown> {
|
|
500
|
-
name: string;
|
|
501
|
-
value: TValue;
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Resolve the agent with user input for an interrupt.
|
|
505
|
-
*
|
|
506
|
-
* - Standard interrupts: records `{ status: "resolved", payload }` for the target
|
|
507
|
-
* interrupt (defaults to the primary one). Resumes once every open interrupt is
|
|
508
|
-
* addressed; returns the resume run result, or `void` while still awaiting others.
|
|
509
|
-
* - Legacy interrupts: resumes immediately via `command.resume = payload`.
|
|
510
|
-
*/
|
|
511
|
-
type InterruptResolveFn = (payload?: unknown, interruptId?: string) => Promise<RunAgentResult | void>;
|
|
512
|
-
/**
|
|
513
|
-
* Cancel an interrupt.
|
|
514
|
-
*
|
|
515
|
-
* - Standard interrupts: records `{ status: "cancelled" }` for the target interrupt
|
|
516
|
-
* (defaults to the primary one), then resumes once all are addressed.
|
|
517
|
-
* - Legacy interrupts: dismisses the pending interrupt without resuming.
|
|
518
|
-
*/
|
|
519
|
-
type InterruptCancelFn = (interruptId?: string) => Promise<RunAgentResult | void>;
|
|
520
|
-
interface InterruptHandlerProps<TValue = unknown> {
|
|
521
|
-
/**
|
|
522
|
-
* Legacy event shape (`{ name, value }`). Always present for back-compat: for
|
|
523
|
-
* standard interrupts, `value` is the primary `Interrupt` and `name` is `"on_interrupt"`.
|
|
524
|
-
* Prefer `interrupt` / `interrupts` for standard interrupts.
|
|
525
|
-
*/
|
|
526
|
-
event: InterruptEvent<TValue>;
|
|
527
|
-
/** Primary standard interrupt (`interrupts[0]`), or `null` for legacy interrupts. */
|
|
528
|
-
interrupt: Interrupt | null;
|
|
529
|
-
/** All open standard interrupts (empty array for legacy interrupts). */
|
|
530
|
-
interrupts: Interrupt[];
|
|
531
|
-
resolve: InterruptResolveFn;
|
|
532
|
-
cancel: InterruptCancelFn;
|
|
533
|
-
}
|
|
534
|
-
interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
|
|
535
|
-
event: InterruptEvent<TValue>;
|
|
536
|
-
interrupt: Interrupt | null;
|
|
537
|
-
interrupts: Interrupt[];
|
|
538
|
-
result: TResult;
|
|
539
|
-
resolve: InterruptResolveFn;
|
|
540
|
-
cancel: InterruptCancelFn;
|
|
541
|
-
}
|
|
542
|
-
//#endregion
|
|
543
448
|
//#region src/hooks/use-interrupt.d.ts
|
|
544
449
|
type InterruptHandlerFn<TValue, TResult> = (props: InterruptHandlerProps<TValue>) => TResult | PromiseLike<TResult>;
|
|
545
450
|
type InterruptResultFromHandler<THandler> = THandler extends ((...args: never[]) => infer TResult) ? TResult extends PromiseLike<infer TResolved> ? TResolved | null : TResult | null : null;
|
|
546
451
|
type InterruptResult<TValue, TResult> = InterruptResultFromHandler<InterruptHandlerFn<TValue, TResult>>;
|
|
547
452
|
type InterruptRenderInChat = boolean | undefined;
|
|
548
453
|
type UseInterruptReturn<TRenderInChat extends InterruptRenderInChat> = TRenderInChat extends false ? React$1.ReactElement | null : TRenderInChat extends true | undefined ? void : React$1.ReactElement | null | void;
|
|
549
|
-
/** Recognize thenables returned by interrupt preprocessing handlers. */
|
|
550
454
|
/**
|
|
551
455
|
* Configuration options for `useInterrupt`.
|
|
552
456
|
*/
|
|
@@ -620,20 +524,26 @@ declare function useSuggestions({
|
|
|
620
524
|
}?: UseSuggestionsOptions): UseSuggestionsResult;
|
|
621
525
|
//#endregion
|
|
622
526
|
//#region src/hooks/use-configure-suggestions.d.ts
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
527
|
+
/**
|
|
528
|
+
* Registers a suggestions configuration (dynamic or static) for the current
|
|
529
|
+
* chat. A global config (no `consumerAgentId`, or `"*"`) applies to every
|
|
530
|
+
* agent and loads for the surrounding chat's agent first.
|
|
531
|
+
*
|
|
532
|
+
* Pass `deps` to reload suggestions when values the config reads change.
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* useConfigureSuggestions({
|
|
536
|
+
* instructions: "Suggest concise next steps for the user",
|
|
537
|
+
* available: "always",
|
|
538
|
+
* });
|
|
539
|
+
*/
|
|
540
|
+
declare function useConfigureSuggestions(config: ɵSuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
|
|
629
541
|
//#endregion
|
|
630
542
|
//#region src/hooks/use-agent-context.d.ts
|
|
631
543
|
/**
|
|
632
544
|
* Represents any value that can be serialized to JSON.
|
|
633
545
|
*/
|
|
634
|
-
type JsonSerializable =
|
|
635
|
-
[key: string]: JsonSerializable;
|
|
636
|
-
};
|
|
546
|
+
type JsonSerializable = ɵJsonSerializable;
|
|
637
547
|
/**
|
|
638
548
|
* Context configuration for useAgentContext.
|
|
639
549
|
* Accepts any JSON-serializable value which will be converted to a string.
|
|
@@ -651,23 +561,12 @@ declare function useAgentContext(context: AgentContextInput): void;
|
|
|
651
561
|
* A conversation thread managed by CopilotKit Intelligence.
|
|
652
562
|
*
|
|
653
563
|
* Each thread has a unique `id`, an optional human-readable `name`, and
|
|
654
|
-
*
|
|
564
|
+
* ISO-8601 `createdAt` and `updatedAt` timestamps. `lastRunAt` is the time of
|
|
565
|
+
* the most recent agent run, absent when the thread has never run; prefer it
|
|
566
|
+
* over `updatedAt` for "last activity", since rename and archive do not bump
|
|
567
|
+
* it. The shape is core's thread summary, which Angular also exposes.
|
|
655
568
|
*/
|
|
656
|
-
|
|
657
|
-
id: string;
|
|
658
|
-
agentId: string;
|
|
659
|
-
name: string | null;
|
|
660
|
-
archived: boolean;
|
|
661
|
-
createdAt: string;
|
|
662
|
-
updatedAt: string;
|
|
663
|
-
/**
|
|
664
|
-
* ISO-8601 timestamp of the most recent agent run on this thread. Absent
|
|
665
|
-
* when the thread has never been run. Prefer this over `updatedAt` for
|
|
666
|
-
* user-facing "last activity" displays — it is not bumped by metadata-only
|
|
667
|
-
* actions like rename or archive.
|
|
668
|
-
*/
|
|
669
|
-
lastRunAt?: string;
|
|
670
|
-
}
|
|
569
|
+
type Thread = ɵThreadSummary;
|
|
671
570
|
/**
|
|
672
571
|
* Configuration for the {@link useThreads} hook.
|
|
673
572
|
*
|
|
@@ -953,37 +852,18 @@ declare function useRenderToolCall(): ({
|
|
|
953
852
|
* - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
|
|
954
853
|
* - Derives `args` type from the provided schema (any Standard Schema V1 compatible library).
|
|
955
854
|
* - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
|
|
956
|
-
* - For wildcard tools (name: "*"), args is optional and defaults to
|
|
855
|
+
* - For wildcard tools (name: "*"), args is optional and defaults to a schema that accepts any value.
|
|
957
856
|
*/
|
|
958
|
-
type RenderProps<T> = {
|
|
959
|
-
name: string;
|
|
960
|
-
toolCallId: string;
|
|
961
|
-
args: Partial<T>;
|
|
962
|
-
status: ToolCallStatus.InProgress;
|
|
963
|
-
result: undefined;
|
|
964
|
-
} | {
|
|
965
|
-
name: string;
|
|
966
|
-
toolCallId: string;
|
|
967
|
-
args: T;
|
|
968
|
-
status: ToolCallStatus.Executing;
|
|
969
|
-
result: undefined;
|
|
970
|
-
} | {
|
|
971
|
-
name: string;
|
|
972
|
-
toolCallId: string;
|
|
973
|
-
args: T;
|
|
974
|
-
status: ToolCallStatus.Complete;
|
|
975
|
-
result: string;
|
|
976
|
-
};
|
|
977
857
|
declare function defineToolCallRenderer(def: {
|
|
978
858
|
name: "*";
|
|
979
|
-
render: (props:
|
|
859
|
+
render: (props: ToolCallRenderProps<any>) => React$1.ReactElement | null;
|
|
980
860
|
agentId?: string;
|
|
981
861
|
group?: boolean;
|
|
982
862
|
}): ReactToolCallRenderer<any>;
|
|
983
863
|
declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
|
|
984
864
|
name: string;
|
|
985
865
|
args: S;
|
|
986
|
-
render: (props:
|
|
866
|
+
render: (props: ToolCallRenderProps<InferSchemaOutput<S>>) => React$1.ReactElement | null;
|
|
987
867
|
agentId?: string;
|
|
988
868
|
group?: boolean;
|
|
989
869
|
}): ReactToolCallRenderer<InferSchemaOutput<S>>;
|
|
@@ -1004,5 +884,5 @@ declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
|
|
|
1004
884
|
*/
|
|
1005
885
|
declare function useCapabilities(agentId?: string): AgentCapabilities | undefined;
|
|
1006
886
|
//#endregion
|
|
1007
|
-
export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type Interrupt, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRenderer, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type ResumeEntry, type ResumeStatus, type Thread, UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useFrontendTools, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads };
|
|
887
|
+
export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type Interrupt, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRenderer, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type ResumeEntry, type ResumeStatus, type Thread, UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useFrontendTools, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads, ɵuseOwnedCore };
|
|
1008
888
|
//# sourceMappingURL=headless.d.mts.map
|
package/dist/headless.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.mts","names":[],"sources":["../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/
|
|
1
|
+
{"version":3,"file":"headless.d.mts","names":[],"sources":["../src/providers/use-owned-core.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-interrupt.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-threads.tsx","../src/hooks/use-render-tool.tsx","../src/hooks/use-render-tool-call.tsx","../src/types/defineToolCallRenderer.ts","../src/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;;;;UAIU,UAAA;EACR,OAAA;AAAA;;;;;;AAJ4C;;;;;AAyB9C;;;;;;;;iBAAgB,aAAA,WAAwB,UAAA,CAAA,CACtC,GAAA,EAAK,gBAAA,CAAiB,CAAA,UACtB,MAAA,QAAc,CAAA,GAAC,CAAA;;;UCRA,6BAAA;EACf,MAAA,EAAQ,mBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;EDrBP;;;;;EC2BR,UAAA;EDL2B;;;;;ECW3B,aAAA,GAAgB,IAAA;EDTD;;;;;ECef,gBAAA;EDhBsB;;;;;;;ECwBtB,cAAA;;;AA/BF;;;;;;;;EA0CE,oBAAA,GAAuB,UAAA,GAAa,IAAA;EAKpC,mBAAA;EA1Ce;;;;;;;;;;;;;;;;;EA4Df,iBAAA,GACE,QAAA,UACA,OAAA;IAAY,QAAA;EAAA;EAwBsC;;;;;;;;;EAbpD,cAAA;EAeS;;;;EAVT,MAAA,GAAS,uBAAA;AAAA;AAAA,UAQM,q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