@copilotkit/react-core 1.61.1 → 1.62.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-UY-H6Kx7.mjs → copilotkit-BtRkFsNR.mjs} +1227 -599
- package/dist/copilotkit-BtRkFsNR.mjs.map +1 -0
- package/dist/{copilotkit-BCJDP8qd.cjs → copilotkit-CdpDZi3i.cjs} +1219 -585
- package/dist/copilotkit-CdpDZi3i.cjs.map +1 -0
- package/dist/{copilotkit-CEdu_aie.d.cts → copilotkit-Cga6AHO0.d.cts} +497 -209
- package/dist/copilotkit-Cga6AHO0.d.cts.map +1 -0
- package/dist/{copilotkit-M1FiciGd.d.mts → copilotkit-DnLpJ2Cl.d.mts} +497 -209
- package/dist/copilotkit-DnLpJ2Cl.d.mts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +360 -270
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/context.d.cts +5 -1
- package/dist/v2/context.d.cts.map +1 -1
- package/dist/v2/context.d.mts +5 -1
- package/dist/v2/context.d.mts.map +1 -1
- package/dist/v2/headless.cjs +323 -104
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +187 -69
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +187 -69
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +325 -106
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +2 -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 +2 -2
- package/dist/v2/index.umd.js +1112 -484
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -6
- package/dist/copilotkit-BCJDP8qd.cjs.map +0 -1
- package/dist/copilotkit-CEdu_aie.d.cts.map +0 -1
- package/dist/copilotkit-M1FiciGd.d.mts.map +0 -1
- package/dist/copilotkit-UY-H6Kx7.mjs.map +0 -1
package/dist/v2/headless.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1, { ComponentType, ReactNode } from "react";
|
|
2
2
|
import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
|
|
3
|
-
import { AbstractAgent, RunAgentResult } from "@ag-ui/client";
|
|
3
|
+
import { AbstractAgent, Interrupt, ResumeEntry, ResumeStatus, RunAgentResult } from "@ag-ui/client";
|
|
4
4
|
import { DynamicSuggestionsConfig, FrontendTool, StaticSuggestionsConfig, Suggestion, ToolCallStatus } from "@copilotkit/core";
|
|
5
5
|
import { CopilotKitCoreReact, CopilotKitCoreReactConfig } from "./context";
|
|
6
6
|
import { AgentCapabilities } from "@ag-ui/core";
|
|
@@ -35,7 +35,74 @@ interface CopilotChatConfigurationValue {
|
|
|
35
35
|
threadId: string;
|
|
36
36
|
isModalOpen: boolean;
|
|
37
37
|
setModalOpen: (open: boolean) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the thread-list drawer is open. A sibling boolean to `isModalOpen`
|
|
40
|
+
* (deliberately NOT folded into a tri-state enum): on desktop the chat modal
|
|
41
|
+
* and the drawer coexist, so two independent booleans are required.
|
|
42
|
+
*/
|
|
43
|
+
drawerOpen: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Toggles the drawer open state. On mobile viewports (`<768px`) opening the
|
|
46
|
+
* drawer closes the chat modal (mutual exclusion); on desktop there is no
|
|
47
|
+
* constraint.
|
|
48
|
+
*/
|
|
49
|
+
setDrawerOpen: (open: boolean) => void;
|
|
50
|
+
/**
|
|
51
|
+
* True once a `<CopilotThreadsDrawer>` wrapper has registered itself with this chat
|
|
52
|
+
* configuration. The header thread-list launcher renders ONLY when this is
|
|
53
|
+
* set, so chats with no drawer stay byte-for-byte unchanged.
|
|
54
|
+
*/
|
|
55
|
+
drawerRegistered: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Called by the drawer wrapper on mount to announce its presence (and flip
|
|
58
|
+
* `drawerRegistered`). Returns a cleanup function that de-registers the
|
|
59
|
+
* drawer on unmount.
|
|
60
|
+
*
|
|
61
|
+
* @returns A cleanup callback that reverses the registration.
|
|
62
|
+
*/
|
|
63
|
+
registerDrawer: () => () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Internal: registers the modal-close setter of the provider that actually
|
|
66
|
+
* owns the rendered modal (a descendant that supplied `isModalDefaultOpen`),
|
|
67
|
+
* so the drawer's mobile mutual-exclusion — owned by the top-most provider —
|
|
68
|
+
* closes the modal that is genuinely on screen rather than the top-most
|
|
69
|
+
* provider's own (possibly unrendered) modal state.
|
|
70
|
+
*
|
|
71
|
+
* @param closeModal - A setter the drawer may call to close the rendered modal.
|
|
72
|
+
* @returns A cleanup callback that de-registers the closer.
|
|
73
|
+
*/
|
|
74
|
+
ɵregisterModalCloser: (closeModal: (open: boolean) => void) => () => void;
|
|
38
75
|
hasExplicitThreadId: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Imperatively sets the active thread for this chat configuration.
|
|
78
|
+
*
|
|
79
|
+
* Use this to drive the rendered thread without a host callback — e.g. a
|
|
80
|
+
* `<CopilotThreadsDrawer>` selecting a thread row sets it explicitly so the chat
|
|
81
|
+
* connects to that backend thread.
|
|
82
|
+
*
|
|
83
|
+
* Guarded like the top-level `<CopilotKit>` provider's `setThreadId`: when
|
|
84
|
+
* the consumer controls the threadId via the `threadId` prop on this
|
|
85
|
+
* provider, this is a no-op (a warning is logged) so a prop-controlled
|
|
86
|
+
* threadId is never silently overridden.
|
|
87
|
+
*
|
|
88
|
+
* @param threadId - The thread id to make active.
|
|
89
|
+
* @param options.explicit - Whether the thread is a caller choice. Defaults
|
|
90
|
+
* to `true` (a picked thread). Pass `false` to set a non-explicit thread
|
|
91
|
+
* so the welcome screen shows (see {@link startNewThread}).
|
|
92
|
+
*/
|
|
93
|
+
setActiveThreadId: (threadId: string, options?: {
|
|
94
|
+
explicit?: boolean;
|
|
95
|
+
}) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Resets the active thread to a fresh, non-explicit client-side thread: a
|
|
98
|
+
* newly minted UUID with `hasExplicitThreadId=false`, so the welcome screen
|
|
99
|
+
* shows. Pairs with the core `startNewThread()` to clear the conversation
|
|
100
|
+
* with no host wiring.
|
|
101
|
+
*
|
|
102
|
+
* Guarded identically to {@link setActiveThreadId}: a no-op when the
|
|
103
|
+
* threadId is prop-controlled.
|
|
104
|
+
*/
|
|
105
|
+
startNewThread: () => void;
|
|
39
106
|
}
|
|
40
107
|
interface CopilotChatConfigurationProviderProps {
|
|
41
108
|
children: ReactNode;
|
|
@@ -92,7 +159,11 @@ declare function useAgent({
|
|
|
92
159
|
//#region src/v2/types/react-tool-call-renderer.d.ts
|
|
93
160
|
interface ReactToolCallRenderer<T = unknown> {
|
|
94
161
|
name: string;
|
|
95
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Schema describing the tool arguments. Optional — renderers registered for
|
|
164
|
+
* tools without parameters (e.g. HITL confirm dialogs) have no schema.
|
|
165
|
+
*/
|
|
166
|
+
args?: StandardSchemaV1<any, T>;
|
|
96
167
|
/**
|
|
97
168
|
* Optional agent ID to constrain this tool renderer to a specific agent.
|
|
98
169
|
* If specified, this renderer will only be used for the specified agent.
|
|
@@ -179,7 +250,7 @@ type InferRenderProps<T> = T extends StandardSchemaV1 ? InferSchemaOutput<T> : a
|
|
|
179
250
|
* );
|
|
180
251
|
* ```
|
|
181
252
|
*/
|
|
182
|
-
declare function useComponent<TSchema extends StandardSchemaV1 | undefined = undefined>(config: {
|
|
253
|
+
declare function useComponent<TSchema extends StandardSchemaV1<any, Record<string, unknown>> | undefined = undefined>(config: {
|
|
183
254
|
name: string;
|
|
184
255
|
description?: string;
|
|
185
256
|
parameters?: TSchema;
|
|
@@ -240,18 +311,49 @@ type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unkn
|
|
|
240
311
|
declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
|
|
241
312
|
//#endregion
|
|
242
313
|
//#region src/v2/types/interrupt.d.ts
|
|
314
|
+
/** Legacy custom-event interrupt payload (agent emits a custom `on_interrupt` event). */
|
|
243
315
|
interface InterruptEvent<TValue = unknown> {
|
|
244
316
|
name: string;
|
|
245
317
|
value: TValue;
|
|
246
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Resolve the agent with user input for an interrupt.
|
|
321
|
+
*
|
|
322
|
+
* - Standard interrupts: records `{ status: "resolved", payload }` for the target
|
|
323
|
+
* interrupt (defaults to the primary one). Resumes once every open interrupt is
|
|
324
|
+
* addressed; returns the resume run result, or `void` while still awaiting others.
|
|
325
|
+
* - Legacy interrupts: resumes immediately via `command.resume = payload`.
|
|
326
|
+
*/
|
|
327
|
+
type InterruptResolveFn = (payload?: unknown, interruptId?: string) => Promise<RunAgentResult | void>;
|
|
328
|
+
/**
|
|
329
|
+
* Cancel an interrupt.
|
|
330
|
+
*
|
|
331
|
+
* - Standard interrupts: records `{ status: "cancelled" }` for the target interrupt
|
|
332
|
+
* (defaults to the primary one), then resumes once all are addressed.
|
|
333
|
+
* - Legacy interrupts: dismisses the pending interrupt without resuming.
|
|
334
|
+
*/
|
|
335
|
+
type InterruptCancelFn = (interruptId?: string) => Promise<RunAgentResult | void>;
|
|
247
336
|
interface InterruptHandlerProps<TValue = unknown> {
|
|
337
|
+
/**
|
|
338
|
+
* Legacy event shape (`{ name, value }`). Always present for back-compat: for
|
|
339
|
+
* standard interrupts, `value` is the primary `Interrupt` and `name` is `"on_interrupt"`.
|
|
340
|
+
* Prefer `interrupt` / `interrupts` for standard interrupts.
|
|
341
|
+
*/
|
|
248
342
|
event: InterruptEvent<TValue>;
|
|
249
|
-
|
|
343
|
+
/** Primary standard interrupt (`interrupts[0]`), or `null` for legacy interrupts. */
|
|
344
|
+
interrupt: Interrupt | null;
|
|
345
|
+
/** All open standard interrupts (empty array for legacy interrupts). */
|
|
346
|
+
interrupts: Interrupt[];
|
|
347
|
+
resolve: InterruptResolveFn;
|
|
348
|
+
cancel: InterruptCancelFn;
|
|
250
349
|
}
|
|
251
350
|
interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
|
|
252
351
|
event: InterruptEvent<TValue>;
|
|
352
|
+
interrupt: Interrupt | null;
|
|
353
|
+
interrupts: Interrupt[];
|
|
253
354
|
result: TResult;
|
|
254
|
-
resolve:
|
|
355
|
+
resolve: InterruptResolveFn;
|
|
356
|
+
cancel: InterruptCancelFn;
|
|
255
357
|
}
|
|
256
358
|
//#endregion
|
|
257
359
|
//#region src/v2/hooks/use-interrupt.d.ts
|
|
@@ -267,86 +369,53 @@ interface UseInterruptConfigBase<TValue = unknown, TResult = never> {
|
|
|
267
369
|
/**
|
|
268
370
|
* Render function for the interrupt UI.
|
|
269
371
|
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
372
|
+
* Receives both the standard `interrupt`/`interrupts` and the legacy `event`.
|
|
373
|
+
* Call `resolve(payload)` to resume with user input, or `cancel()` to cancel.
|
|
272
374
|
*/
|
|
273
375
|
render: (props: InterruptRenderProps<TValue, InterruptResult<TValue, TResult>>) => React$1.ReactElement;
|
|
274
376
|
/**
|
|
275
377
|
* Optional pre-render handler invoked when an interrupt is received.
|
|
276
|
-
*
|
|
277
|
-
* Return either a sync value or an async value to pass into `render` as `result`.
|
|
378
|
+
* Return a sync or async value to expose as `result` in `render`.
|
|
278
379
|
* Rejecting/throwing falls back to `result = null`.
|
|
279
380
|
*/
|
|
280
381
|
handler?: InterruptHandlerFn<TValue, TResult>;
|
|
281
382
|
/**
|
|
282
|
-
* Optional predicate to filter which interrupts
|
|
283
|
-
*
|
|
383
|
+
* Optional predicate to filter which interrupts this hook handles.
|
|
384
|
+
* Receives the legacy-compatible event (for standard interrupts, `value` is
|
|
385
|
+
* the primary `Interrupt`). Return `false` to ignore.
|
|
284
386
|
*/
|
|
285
387
|
enabled?: (event: InterruptEvent<TValue>) => boolean;
|
|
286
388
|
/** Optional agent id. Defaults to the current configured chat agent. */
|
|
287
389
|
agentId?: string;
|
|
288
390
|
}
|
|
289
391
|
type UseInterruptConfig<TValue = unknown, TResult = never, TRenderInChat extends InterruptRenderInChat = undefined> = UseInterruptConfigBase<TValue, TResult> & {
|
|
290
|
-
/** When true (default), the interrupt UI renders inside `<CopilotChat>` automatically.
|
|
392
|
+
/** When true (default), the interrupt UI renders inside `<CopilotChat>` automatically. */renderInChat?: TRenderInChat;
|
|
291
393
|
};
|
|
292
394
|
/**
|
|
293
|
-
* Handles agent interrupts
|
|
294
|
-
*
|
|
295
|
-
* The hook listens to custom events on the active agent, stores interrupt payloads per run,
|
|
296
|
-
* and surfaces a render callback once the run finalizes. Call `resolve` from your UI to resume
|
|
297
|
-
* execution with user-provided data.
|
|
298
|
-
*
|
|
299
|
-
* - `renderInChat: true` (default): the element is published into `<CopilotChat>` and this hook returns `void`.
|
|
300
|
-
* - `renderInChat: false`: the hook returns the interrupt element so you can place it anywhere in your component tree.
|
|
395
|
+
* Handles agent interrupts with optional filtering, preprocessing, and resume behavior.
|
|
301
396
|
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
397
|
+
* Supports both the AG-UI standard interrupt flow (`RUN_FINISHED` with
|
|
398
|
+
* `outcome.type === "interrupt"`) and the legacy custom-event flow
|
|
399
|
+
* (`on_interrupt`). For standard interrupts, `render` receives `interrupt`
|
|
400
|
+
* (the primary one) and `interrupts` (the full open set); call `resolve(payload)`
|
|
401
|
+
* to resume or `cancel()` to cancel. Resuming addresses the targeted interrupt
|
|
402
|
+
* and, once every open interrupt is addressed, submits a single spec `resume`
|
|
403
|
+
* array via `copilotkit.runAgent`.
|
|
304
404
|
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
* @returns When `renderInChat` is `false`, returns the interrupt element (or `null` when idle).
|
|
308
|
-
* Otherwise returns `void` and publishes the element into chat. In `render`, `result` is always
|
|
309
|
-
* either the handler's resolved return value or `null` (including when no handler is provided,
|
|
310
|
-
* when filtering skips the interrupt, or when handler execution fails).
|
|
405
|
+
* - `renderInChat: true` (default): the element is published into `<CopilotChat>`; returns `void`.
|
|
406
|
+
* - `renderInChat: false`: the hook returns the interrupt element for manual placement.
|
|
311
407
|
*
|
|
312
408
|
* @example
|
|
313
409
|
* ```tsx
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* <
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
* </div>
|
|
324
|
-
* ),
|
|
325
|
-
* });
|
|
326
|
-
*
|
|
327
|
-
* return null;
|
|
328
|
-
* }
|
|
329
|
-
* ```
|
|
330
|
-
*
|
|
331
|
-
* @example
|
|
332
|
-
* ```tsx
|
|
333
|
-
* import { useInterrupt } from "@copilotkit/react-core/v2";
|
|
334
|
-
*
|
|
335
|
-
* function CustomPanel() {
|
|
336
|
-
* const interruptElement = useInterrupt({
|
|
337
|
-
* renderInChat: false,
|
|
338
|
-
* enabled: (event) => event.value.startsWith("approval:"),
|
|
339
|
-
* handler: async ({ event }) => ({ label: event.value.toUpperCase() }),
|
|
340
|
-
* render: ({ event, result, resolve }) => (
|
|
341
|
-
* <aside>
|
|
342
|
-
* <strong>{result?.label ?? ""}</strong>
|
|
343
|
-
* <button onClick={() => resolve({ value: event.value })}>Continue</button>
|
|
344
|
-
* </aside>
|
|
345
|
-
* ),
|
|
346
|
-
* });
|
|
347
|
-
*
|
|
348
|
-
* return <>{interruptElement}</>;
|
|
349
|
-
* }
|
|
410
|
+
* useInterrupt({
|
|
411
|
+
* render: ({ interrupt, resolve, cancel }) => (
|
|
412
|
+
* <div>
|
|
413
|
+
* <p>{interrupt?.message}</p>
|
|
414
|
+
* <button onClick={() => resolve({ approved: true })}>Approve</button>
|
|
415
|
+
* <button onClick={() => cancel()}>Cancel</button>
|
|
416
|
+
* </div>
|
|
417
|
+
* ),
|
|
418
|
+
* });
|
|
350
419
|
* ```
|
|
351
420
|
*/
|
|
352
421
|
declare function useInterrupt<TResult = never, TRenderInChat extends InterruptRenderInChat = undefined>(config: UseInterruptConfig<any, TResult, TRenderInChat>): UseInterruptReturn<TRenderInChat>;
|
|
@@ -427,6 +496,16 @@ interface UseThreadsInput {
|
|
|
427
496
|
includeArchived?: boolean;
|
|
428
497
|
/** Maximum number of threads to fetch per page. When set, enables cursor-based pagination. */
|
|
429
498
|
limit?: number;
|
|
499
|
+
/**
|
|
500
|
+
* When `false`, the hook stays inert: no runtime context is dispatched, so
|
|
501
|
+
* NO thread-list fetch or realtime subscription is issued. Used by gated
|
|
502
|
+
* surfaces (e.g. an unlicensed `<CopilotThreadsDrawer>`) that must not touch the
|
|
503
|
+
* network until the gate opens. Defaults to `true`.
|
|
504
|
+
*
|
|
505
|
+
* Flipping `enabled` back to `true` resumes normal fetching on the next
|
|
506
|
+
* effect run; mutations are likewise short-circuited while disabled.
|
|
507
|
+
*/
|
|
508
|
+
enabled?: boolean;
|
|
430
509
|
}
|
|
431
510
|
/**
|
|
432
511
|
* Return value of the {@link useThreads} hook.
|
|
@@ -451,8 +530,21 @@ interface UseThreadsResult {
|
|
|
451
530
|
* The most recent error from fetching threads or executing a mutation,
|
|
452
531
|
* or `null` when there is no error. Reset to `null` on the next
|
|
453
532
|
* successful fetch.
|
|
533
|
+
*
|
|
534
|
+
* This channel folds together developer/config errors (missing runtime URL,
|
|
535
|
+
* runtime without thread endpoints) and genuine list-load/mutation failures.
|
|
536
|
+
* End-user surfaces that must not leak config errors should prefer
|
|
537
|
+
* {@link listError}, which excludes the config/runtime-setup errors.
|
|
454
538
|
*/
|
|
455
539
|
error: Error | null;
|
|
540
|
+
/**
|
|
541
|
+
* The most recent genuine list-load or mutation error from the platform, or
|
|
542
|
+
* `null`. Unlike {@link error}, this EXCLUDES developer/config errors (a
|
|
543
|
+
* missing runtime URL, or a runtime that does not advertise thread
|
|
544
|
+
* endpoints), so an end-user surface can render it directly without leaking
|
|
545
|
+
* a developer-facing configuration message into the UI.
|
|
546
|
+
*/
|
|
547
|
+
listError: Error | null;
|
|
456
548
|
/**
|
|
457
549
|
* `true` when there are more threads available to fetch via
|
|
458
550
|
* {@link fetchMoreThreads}. Only meaningful when `limit` is set.
|
|
@@ -462,11 +554,30 @@ interface UseThreadsResult {
|
|
|
462
554
|
* `true` while a subsequent page of threads is being fetched.
|
|
463
555
|
*/
|
|
464
556
|
isFetchingMoreThreads: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* `true` while at least one thread mutation (rename, archive, unarchive,
|
|
559
|
+
* delete) is awaiting a server response. Mutations apply optimistically, so
|
|
560
|
+
* this is primarily useful for disabling controls or showing a subtle
|
|
561
|
+
* in-flight indicator.
|
|
562
|
+
*/
|
|
563
|
+
isMutating: boolean;
|
|
465
564
|
/**
|
|
466
565
|
* Fetch the next page of threads. No-op when {@link hasMoreThreads} is
|
|
467
566
|
* `false` or a fetch is already in progress.
|
|
468
567
|
*/
|
|
469
568
|
fetchMoreThreads: () => void;
|
|
569
|
+
/**
|
|
570
|
+
* Re-fetch the thread list from the platform without clearing the current
|
|
571
|
+
* list. Backs the drawer's error-state Retry and the Active/All filter
|
|
572
|
+
* refetch. No-op until the runtime is connected.
|
|
573
|
+
*/
|
|
574
|
+
refetchThreads: () => void;
|
|
575
|
+
/**
|
|
576
|
+
* Reset to a fresh, non-explicit client-side thread so the welcome screen
|
|
577
|
+
* shows. Lazy creation: no row appears in {@link threads} until the new
|
|
578
|
+
* thread's first run persists server-side.
|
|
579
|
+
*/
|
|
580
|
+
startNewThread: () => void;
|
|
470
581
|
/**
|
|
471
582
|
* Rename a thread on the platform.
|
|
472
583
|
* Resolves when the server confirms the update; rejects on failure.
|
|
@@ -478,6 +589,12 @@ interface UseThreadsResult {
|
|
|
478
589
|
* Resolves when the server confirms the update; rejects on failure.
|
|
479
590
|
*/
|
|
480
591
|
archiveThread: (threadId: string) => Promise<void>;
|
|
592
|
+
/**
|
|
593
|
+
* Restore a previously archived thread on the platform.
|
|
594
|
+
* The thread re-appears in default (non-archived) list results.
|
|
595
|
+
* Resolves when the server confirms the update; rejects on failure.
|
|
596
|
+
*/
|
|
597
|
+
unarchiveThread: (threadId: string) => Promise<void>;
|
|
481
598
|
/**
|
|
482
599
|
* Permanently delete a thread from the platform.
|
|
483
600
|
* This is irreversible. Resolves when the server confirms deletion;
|
|
@@ -494,9 +611,9 @@ interface UseThreadsResult {
|
|
|
494
611
|
* current without polling — thread creates, renames, archives, and deletes
|
|
495
612
|
* from any client are reflected immediately.
|
|
496
613
|
*
|
|
497
|
-
* Mutation methods (`renameThread`, `archiveThread`, `
|
|
498
|
-
* promises that resolve once the platform confirms the
|
|
499
|
-
* with an `Error` on failure.
|
|
614
|
+
* Mutation methods (`renameThread`, `archiveThread`, `unarchiveThread`,
|
|
615
|
+
* `deleteThread`) return promises that resolve once the platform confirms the
|
|
616
|
+
* operation and reject with an `Error` on failure.
|
|
500
617
|
*
|
|
501
618
|
* @param input - Agent identifier and optional list controls.
|
|
502
619
|
* @returns Thread list state and stable mutation callbacks.
|
|
@@ -529,7 +646,8 @@ interface UseThreadsResult {
|
|
|
529
646
|
declare function useThreads({
|
|
530
647
|
agentId,
|
|
531
648
|
includeArchived,
|
|
532
|
-
limit
|
|
649
|
+
limit,
|
|
650
|
+
enabled
|
|
533
651
|
}: UseThreadsInput): UseThreadsResult;
|
|
534
652
|
//#endregion
|
|
535
653
|
//#region src/v2/hooks/use-render-tool.d.ts
|
|
@@ -671,5 +789,5 @@ declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
|
|
|
671
789
|
*/
|
|
672
790
|
declare function useCapabilities(agentId?: string): AgentCapabilities | undefined;
|
|
673
791
|
//#endregion
|
|
674
|
-
export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type Thread, type UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useSuggestions, useThreads };
|
|
792
|
+
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 RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type ResumeEntry, type ResumeStatus, type Thread, type UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useSuggestions, useThreads };
|
|
675
793
|
//# sourceMappingURL=headless.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.mts","names":[],"sources":["../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/types/human-in-the-loop.ts","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/types/interrupt.ts","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx","../../src/v2/hooks/use-render-tool.tsx","../../src/v2/types/defineToolCallRenderer.ts","../../src/v2/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;cAca,wBAAA;;;;;;;;;;;;;;;;;;;;;;KAwBD,iBAAA,UAA2B,wBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"headless.d.mts","names":[],"sources":["../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/types/human-in-the-loop.ts","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/types/interrupt.ts","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx","../../src/v2/hooks/use-render-tool.tsx","../../src/v2/types/defineToolCallRenderer.ts","../../src/v2/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;cAca,wBAAA;;;;;;;;;;;;;;;;;;;;;;KAwBD,iBAAA,UAA2B,wBAAA;AAAA,UA6BtB,6BAAA;EACf,MAAA,EAAQ,iBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;;;;AAlCjB;;EAwCE,UAAA;EAxCqC;;AA6BvC;;;EAiBE,aAAA,GAAgB,IAAA;EAhBhB;;;;;EAsBA,gBAAA;EAlBe;;;;;;;EA0Bf,cAAA;EAWuB;;;;;;;;;AA4CzB;EA5CE,oBAAA,GAAuB,UAAA,GAAa,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