@copilotkit/react-core 1.59.3 → 1.59.5-canary.1781104893
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-CEJz6krE.d.mts → copilotkit-B83H_vWJ.d.mts} +412 -64
- package/dist/copilotkit-B83H_vWJ.d.mts.map +1 -0
- package/dist/{copilotkit-D16eCFkt.d.cts → copilotkit-CD3EqiJ4.d.cts} +412 -64
- package/dist/copilotkit-CD3EqiJ4.d.cts.map +1 -0
- package/dist/{copilotkit-DhONbYmz.cjs → copilotkit-CWGR3Ict.cjs} +1002 -345
- package/dist/copilotkit-CWGR3Ict.cjs.map +1 -0
- package/dist/{copilotkit-BRNy5UvX.mjs → copilotkit-DBOofUYQ.mjs} +950 -335
- package/dist/copilotkit-DBOofUYQ.mjs.map +1 -0
- package/dist/index.cjs +10 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -7
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +350 -210
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.cjs +8 -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 +956 -334
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/dist/copilotkit-BRNy5UvX.mjs.map +0 -1
- package/dist/copilotkit-CEJz6krE.d.mts.map +0 -1
- package/dist/copilotkit-D16eCFkt.d.cts.map +0 -1
- package/dist/copilotkit-DhONbYmz.cjs.map +0 -1
|
@@ -881,12 +881,158 @@ declare const CopilotChatSuggestionView: React$1.ForwardRefExoticComponent<{
|
|
|
881
881
|
loadingIndexes?: ReadonlyArray<number>;
|
|
882
882
|
} & React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
883
883
|
//#endregion
|
|
884
|
+
//#region src/v2/components/intelligence-indicator/IntelligenceIndicatorView.d.ts
|
|
885
|
+
/** Lifecycle state the brain hands the face. */
|
|
886
|
+
type IntelligenceIndicatorStatus = "in-progress" | "finished";
|
|
887
|
+
interface IntelligenceIndicatorViewProps extends React$1.HTMLAttributes<HTMLSpanElement> {
|
|
888
|
+
/** The assistant message this indicator is attached to. */
|
|
889
|
+
message: Message$2;
|
|
890
|
+
/**
|
|
891
|
+
* Whether the intelligence work is still running (`in-progress`) or
|
|
892
|
+
* has settled (`finished`). Drives the icon morph and chrome
|
|
893
|
+
* fade-out via the `data-status` attribute on the wrapper.
|
|
894
|
+
*/
|
|
895
|
+
status: IntelligenceIndicatorStatus;
|
|
896
|
+
/** The visible label, e.g. "Using CopilotKit Intelligence". */
|
|
897
|
+
label: string;
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* The presentational "CopilotKit Intelligence" face — the default
|
|
901
|
+
* rendered by the {@link IntelligenceIndicator} brain and the default
|
|
902
|
+
* value for the `intelligenceIndicator` slot.
|
|
903
|
+
*
|
|
904
|
+
* Layout: a glassmorphism pill (the `__chrome` layer) wrapping an icon
|
|
905
|
+
* and a label. The icon is two overlaid SVG paths — a spinner arc and a
|
|
906
|
+
* checkmark — whose geometry lives in each path's `d` ATTRIBUTE so it
|
|
907
|
+
* renders in every browser (the CSS `d:` property is Chrome-only).
|
|
908
|
+
*
|
|
909
|
+
* Two states, driven by the `data-status` attribute (see globals.css
|
|
910
|
+
* for the exact timing):
|
|
911
|
+
* 1. **In-progress.** The arc spins (CSS rotation) inside the pill and
|
|
912
|
+
* the checkmark is hidden. Label + icon are a saturated purple.
|
|
913
|
+
* 2. **Finished.** The arc fades out mid-spin while the checkmark draws
|
|
914
|
+
* itself in upright (animated `stroke-dashoffset`); the pill chrome
|
|
915
|
+
* fades away; and the label + icon settle from purple to a neutral
|
|
916
|
+
* gray, with the label slanting slightly (a `transform: skewX`
|
|
917
|
+
* faux-italic, so it interpolates with the color instead of snapping
|
|
918
|
+
* and never reflows). The result reads as quiet "history metadata"
|
|
919
|
+
* rather than an active spinner. The label text itself never changes
|
|
920
|
+
* — the static check plus the color/slant shift carry the "done"
|
|
921
|
+
* meaning, so no wording change is needed.
|
|
922
|
+
*
|
|
923
|
+
* All motion is gated behind `prefers-reduced-motion` (globals.css):
|
|
924
|
+
* when reduced motion is requested the arc does not spin and the two
|
|
925
|
+
* states swap instantly, without transitions.
|
|
926
|
+
*
|
|
927
|
+
* Customize via the `intelligenceIndicator` slot on `CopilotChat`:
|
|
928
|
+
* a className string restyles the wrapper, a props object tweaks
|
|
929
|
+
* the default (`{ label }`), and a component replaces it entirely
|
|
930
|
+
* with full control over visuals and timing.
|
|
931
|
+
*/
|
|
932
|
+
declare function IntelligenceIndicatorView({
|
|
933
|
+
message,
|
|
934
|
+
status,
|
|
935
|
+
label,
|
|
936
|
+
className,
|
|
937
|
+
...rest
|
|
938
|
+
}: IntelligenceIndicatorViewProps): React$1.ReactElement;
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region src/v2/components/intelligence-indicator/IntelligenceIndicator.d.ts
|
|
941
|
+
interface IntelligenceIndicatorProps {
|
|
942
|
+
/** The message this indicator is attached to. */
|
|
943
|
+
message: Message$2;
|
|
944
|
+
/**
|
|
945
|
+
* Agent id whose run state the indicator tracks. Pass through from
|
|
946
|
+
* the surrounding chat configuration; mounting from
|
|
947
|
+
* `CopilotChatMessageView` resolves this automatically.
|
|
948
|
+
*/
|
|
949
|
+
agentId: string;
|
|
950
|
+
/**
|
|
951
|
+
* Optional override for the visible label. Defaults to
|
|
952
|
+
* "CopilotKit Intelligence".
|
|
953
|
+
*/
|
|
954
|
+
label?: string;
|
|
955
|
+
/**
|
|
956
|
+
* Slot override for the presentational face. A className string, a
|
|
957
|
+
* props object, or a full replacement component — see
|
|
958
|
+
* {@link IntelligenceIndicatorView}. Forwarded from the
|
|
959
|
+
* `intelligenceIndicator` slot on `CopilotChat`.
|
|
960
|
+
*/
|
|
961
|
+
intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Stable turn id for the messages that precede the first user message (a turn
|
|
965
|
+
* with no opening user message of its own). Used as the React key so the
|
|
966
|
+
* indicator for that turn never collides with a real user-message id.
|
|
967
|
+
*/
|
|
968
|
+
declare const INTELLIGENCE_TURN_HEAD = "__cpk_turn_head__";
|
|
969
|
+
/**
|
|
970
|
+
* Map each Intelligence-using turn to its anchor message — the FIRST bash-using
|
|
971
|
+
* assistant message of the turn — and a stable turn id (the id of the user
|
|
972
|
+
* message that opened the turn, or {@link INTELLIGENCE_TURN_HEAD} for the
|
|
973
|
+
* pre-first-user turn). Returns `Map<anchorMessageId, turnId>`.
|
|
974
|
+
*
|
|
975
|
+
* Anchoring to the FIRST (not last) bash-using message keeps the indicator
|
|
976
|
+
* fixed in place for the whole turn: later bash steps don't reposition it, so
|
|
977
|
+
* the spinner never abruptly jumps mid-turn (bug 1). `CopilotChatMessageView`
|
|
978
|
+
* emits exactly one `IntelligenceIndicator` per entry, keyed by the turn id and
|
|
979
|
+
* positioned at the anchor; the per-turn key also lets every past turn keep its
|
|
980
|
+
* own indicator in scroll-back.
|
|
981
|
+
*/
|
|
982
|
+
declare function getIntelligenceTurnAnchors(messages: readonly Message$2[]): Map<string, string>;
|
|
983
|
+
/**
|
|
984
|
+
* The "Using CopilotKit Intelligence" indicator brain. Auto-mounted by
|
|
985
|
+
* `CopilotChatMessageView` — once per Intelligence-using turn, at that
|
|
986
|
+
* turn's anchor message and keyed by the turn id (see
|
|
987
|
+
* {@link getIntelligenceTurnAnchors}). Callers do not register this
|
|
988
|
+
* themselves. It owns the run subscription and the phase machine and
|
|
989
|
+
* renders its swappable face via the `intelligenceIndicator` slot.
|
|
990
|
+
*
|
|
991
|
+
* Placement (which message anchors the turn) is decided by the view, so
|
|
992
|
+
* this component does not self-gate its own placement; it only derives
|
|
993
|
+
* in-progress/finished for the turn it was mounted on.
|
|
994
|
+
*
|
|
995
|
+
* Render gates (all must hold):
|
|
996
|
+
* 1. `copilotkit.intelligence !== undefined`
|
|
997
|
+
* 2. The (anchor) message is an assistant message with at least one
|
|
998
|
+
* tool call whose name matches {@link DEFAULT_TOOL_PATTERNS}.
|
|
999
|
+
* 3. The phase machine is past `hidden`.
|
|
1000
|
+
*
|
|
1001
|
+
* Because the view keys each indicator by its turn id, the instance moves
|
|
1002
|
+
* with the anchor across a hand-off (no remount, no spinner restart), and
|
|
1003
|
+
* every prior Intelligence-using turn keeps its own persistent indicator
|
|
1004
|
+
* in chat history.
|
|
1005
|
+
*
|
|
1006
|
+
* Phase machine (per-instance, all timers local):
|
|
1007
|
+
* - Starts in `hidden`, unless the message mounts onto an
|
|
1008
|
+
* already-completed turn (no pending work, agent stopped or a
|
|
1009
|
+
* real follow-up already present), in which case the lazy
|
|
1010
|
+
* `useState` initializer starts directly in `finished`. This is
|
|
1011
|
+
* what avoids a "hidden flash" on history replay.
|
|
1012
|
+
* - `hidden → spinner` once a matching tool call has been pending
|
|
1013
|
+
* (no `tool`-role result with a matching `toolCallId`) for
|
|
1014
|
+
* {@link PENDING_THRESHOLD_MS}. Replay flashes (tool call + result
|
|
1015
|
+
* in the same tick) never cross this threshold.
|
|
1016
|
+
* - `hidden → finished` if after the grace window the turn is
|
|
1017
|
+
* already complete (no pending work AND
|
|
1018
|
+
* `sawRealFollowup || !agent.isRunning`). Handles very fast tools
|
|
1019
|
+
* whose result lands within the grace window.
|
|
1020
|
+
* - `spinner → finished` as soon as EITHER `agent.isRunning` flips
|
|
1021
|
+
* false OR a non-tool-call-like message appears later in
|
|
1022
|
+
* `agent.messages` (i.e. the agent produced a "real" follow-up —
|
|
1023
|
+
* prose answer or a new user turn).
|
|
1024
|
+
* - `finished` is terminal: the indicator settles into its
|
|
1025
|
+
* persistent tag form and stays mounted.
|
|
1026
|
+
*/
|
|
1027
|
+
declare function IntelligenceIndicator(props: IntelligenceIndicatorProps): React$1.ReactElement | null;
|
|
1028
|
+
//#endregion
|
|
884
1029
|
//#region src/v2/components/chat/CopilotChatMessageView.d.ts
|
|
885
1030
|
type CopilotChatMessageViewProps = Omit<WithSlots<{
|
|
886
1031
|
assistantMessage: typeof CopilotChatAssistantMessage;
|
|
887
1032
|
userMessage: typeof CopilotChatUserMessage;
|
|
888
1033
|
reasoningMessage: typeof CopilotChatReasoningMessage;
|
|
889
1034
|
cursor: typeof CopilotChatMessageView.Cursor;
|
|
1035
|
+
intelligenceIndicator: typeof IntelligenceIndicatorView;
|
|
890
1036
|
}, {
|
|
891
1037
|
isRunning?: boolean;
|
|
892
1038
|
messages?: Message$2[];
|
|
@@ -904,6 +1050,7 @@ declare function CopilotChatMessageView({
|
|
|
904
1050
|
userMessage,
|
|
905
1051
|
reasoningMessage,
|
|
906
1052
|
cursor,
|
|
1053
|
+
intelligenceIndicator,
|
|
907
1054
|
isRunning,
|
|
908
1055
|
children,
|
|
909
1056
|
className,
|
|
@@ -977,6 +1124,12 @@ type CopilotChatViewProps = WithSlots<{
|
|
|
977
1124
|
* ```
|
|
978
1125
|
*/
|
|
979
1126
|
disclaimer?: SlotValue<React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>>;
|
|
1127
|
+
/**
|
|
1128
|
+
* Slot for the "Using CopilotKit Intelligence" indicator. Pass-through
|
|
1129
|
+
* to `CopilotChatMessageView`'s `intelligenceIndicator` slot — accepts a
|
|
1130
|
+
* className string, a props object, or a replacement component.
|
|
1131
|
+
*/
|
|
1132
|
+
intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
|
|
980
1133
|
} & React$1.HTMLAttributes<HTMLDivElement>>;
|
|
981
1134
|
declare function CopilotChatView({
|
|
982
1135
|
messageView,
|
|
@@ -1009,6 +1162,7 @@ declare function CopilotChatView({
|
|
|
1009
1162
|
isConnecting,
|
|
1010
1163
|
hasExplicitThreadId,
|
|
1011
1164
|
disclaimer,
|
|
1165
|
+
intelligenceIndicator,
|
|
1012
1166
|
children,
|
|
1013
1167
|
className,
|
|
1014
1168
|
...props
|
|
@@ -1303,62 +1457,6 @@ interface MCPAppsActivityRendererProps {
|
|
|
1303
1457
|
*/
|
|
1304
1458
|
declare const MCPAppsActivityRenderer: React$1.FC<MCPAppsActivityRendererProps>;
|
|
1305
1459
|
//#endregion
|
|
1306
|
-
//#region src/v2/components/intelligence-indicator/IntelligenceIndicator.d.ts
|
|
1307
|
-
interface IntelligenceIndicatorProps {
|
|
1308
|
-
/** The message this indicator is attached to. */
|
|
1309
|
-
message: Message$2;
|
|
1310
|
-
/**
|
|
1311
|
-
* Agent id whose run state the indicator tracks. Pass through from
|
|
1312
|
-
* the surrounding chat configuration; mounting from
|
|
1313
|
-
* `CopilotChatMessageView` resolves this automatically.
|
|
1314
|
-
*/
|
|
1315
|
-
agentId: string;
|
|
1316
|
-
/**
|
|
1317
|
-
* Optional override for the visible label. Defaults to "Using
|
|
1318
|
-
* CopilotKit Intelligence".
|
|
1319
|
-
*/
|
|
1320
|
-
label?: string;
|
|
1321
|
-
}
|
|
1322
|
-
/**
|
|
1323
|
-
* The "Using CopilotKit Intelligence" pill. Auto-mounted by
|
|
1324
|
-
* `CopilotChatMessageView` for every message slot when
|
|
1325
|
-
* `copilotkit.intelligence` is configured — callers do not register
|
|
1326
|
-
* this themselves. Self-gates so only the canonical message renders a
|
|
1327
|
-
* pill.
|
|
1328
|
-
*
|
|
1329
|
-
* Render gates (all must hold):
|
|
1330
|
-
* 1. `copilotkit.intelligence !== undefined`
|
|
1331
|
-
* 2. The message is an assistant message with at least one tool call
|
|
1332
|
-
* whose name matches {@link DEFAULT_TOOL_PATTERNS}
|
|
1333
|
-
* 3. The message is the *latest* such matching-assistant message in
|
|
1334
|
-
* `agent.messages` — tool-result messages and prose-only assistant
|
|
1335
|
-
* messages don't invalidate the slot, so the pill stays
|
|
1336
|
-
* continuously through a multi-step tool chain.
|
|
1337
|
-
* 4. The phase machine is past `idle` (the pending-grace timer fired)
|
|
1338
|
-
* and not yet `hidden`.
|
|
1339
|
-
*
|
|
1340
|
-
* Phase machine (per-instance, all timers local):
|
|
1341
|
-
* - Starts in `idle` — nothing rendered.
|
|
1342
|
-
* - `idle → spinner` once a matching tool call has been pending
|
|
1343
|
-
* (no `tool`-role result with a matching `toolCallId`) for
|
|
1344
|
-
* {@link PENDING_THRESHOLD_MS}. Replay flashes (tool call + result
|
|
1345
|
-
* in the same tick) never cross this threshold.
|
|
1346
|
-
* - `spinner → check` as soon as EITHER `agent.isRunning` flips
|
|
1347
|
-
* false OR a non-tool-call-like message appears later in
|
|
1348
|
-
* `agent.messages` (i.e. the agent has produced a "real"
|
|
1349
|
-
* follow-up — prose answer or a new user turn).
|
|
1350
|
-
* - `check → fading` after {@link CHECK_HOLD_MS}.
|
|
1351
|
-
* - `fading → hidden` after {@link FADE_OUT_ANIMATION_MS}.
|
|
1352
|
-
*
|
|
1353
|
-
* Once `hidden`, the phase is sticky — a finished pill never re-spawns
|
|
1354
|
-
* on the same message. New runs mount fresh indicator instances on
|
|
1355
|
-
* their own assistant messages.
|
|
1356
|
-
*
|
|
1357
|
-
* The "exactly one pill at a time" guarantee is structural: only one
|
|
1358
|
-
* message satisfies the latest-matching-assistant gate at any moment.
|
|
1359
|
-
*/
|
|
1360
|
-
declare function IntelligenceIndicator(props: IntelligenceIndicatorProps): React$1.ReactElement | null;
|
|
1361
|
-
//#endregion
|
|
1362
1460
|
//#region src/v2/hooks/use-render-tool-call.d.ts
|
|
1363
1461
|
interface UseRenderToolCallProps {
|
|
1364
1462
|
toolCall: ToolCall;
|
|
@@ -2086,6 +2184,130 @@ declare function useThreads({
|
|
|
2086
2184
|
limit
|
|
2087
2185
|
}: UseThreadsInput): UseThreadsResult;
|
|
2088
2186
|
//#endregion
|
|
2187
|
+
//#region src/v2/hooks/use-learn-from-user-action.d.ts
|
|
2188
|
+
/**
|
|
2189
|
+
* Input to {@link UseLearnFromUserActionRecorder}, the function returned
|
|
2190
|
+
* by {@link useLearnFromUserAction}. Captures a single UI interaction that
|
|
2191
|
+
* the Intelligence platform's auto-curated knowledge base loop will distill
|
|
2192
|
+
* into the team's `/project` notes.
|
|
2193
|
+
*/
|
|
2194
|
+
interface LearnFromUserActionInput {
|
|
2195
|
+
/** Thread the action is associated with. May be unknown to the platform. */
|
|
2196
|
+
threadId: string;
|
|
2197
|
+
/** Short, agent-readable summary of what the user did. Optional. */
|
|
2198
|
+
title?: string | null;
|
|
2199
|
+
/** Optional longer explanation. */
|
|
2200
|
+
description?: string | null;
|
|
2201
|
+
/** Free-form, JSON-serializable snapshot describing the action. Optional. */
|
|
2202
|
+
data?: unknown;
|
|
2203
|
+
/** ISO-8601 client-asserted timestamp. Defaults to server NOW() when absent. */
|
|
2204
|
+
occurredAt?: string;
|
|
2205
|
+
/**
|
|
2206
|
+
* Caller-supplied idempotency key. When omitted, `recordAnnotation` generates a
|
|
2207
|
+
* fresh UUID per call so retries collapse to the original row at the
|
|
2208
|
+
* platform. Supply your own to keep a single semantic event idempotent
|
|
2209
|
+
* across calls (e.g. a React re-render or a manual retry button).
|
|
2210
|
+
*/
|
|
2211
|
+
clientEventId?: string;
|
|
2212
|
+
}
|
|
2213
|
+
/** Outcome returned by the recorder function. */
|
|
2214
|
+
interface LearnFromUserActionResult {
|
|
2215
|
+
/** Platform-assigned id of the user-action row. */
|
|
2216
|
+
id: string;
|
|
2217
|
+
/** True when the platform recognized this `clientEventId` as a retry. */
|
|
2218
|
+
duplicate: boolean;
|
|
2219
|
+
}
|
|
2220
|
+
/** Recorder function returned by {@link useLearnFromUserAction}. */
|
|
2221
|
+
type UseLearnFromUserActionRecorder = (input: LearnFromUserActionInput) => Promise<LearnFromUserActionResult>;
|
|
2222
|
+
/**
|
|
2223
|
+
* Record a user UI interaction in the Intelligence platform's user-actions
|
|
2224
|
+
* stream. The platform's auto-curated knowledge base agent reads these
|
|
2225
|
+
* (alongside finished agent runs) and writes free-form Obsidian-flavored
|
|
2226
|
+
* markdown to `/project`, where any agent in the same project can later
|
|
2227
|
+
* read it via the `copilotkit_knowledge_base_shell` MCP tool.
|
|
2228
|
+
*
|
|
2229
|
+
* The hook returns a stable function. Calling it issues a request to the
|
|
2230
|
+
* customer's CopilotKit runtime (`POST ${runtimeUrl}/annotate`), which
|
|
2231
|
+
* resolves the Intel user from the BFF's auth and forwards to the
|
|
2232
|
+
* platform — the Intel API key never reaches the browser.
|
|
2233
|
+
*
|
|
2234
|
+
* If `clientEventId` is omitted `recordAnnotation` generates a UUID per call,
|
|
2235
|
+
* so a naive double-call (e.g. React 18 strict-mode double-mount, or a retry
|
|
2236
|
+
* after a network blip on a fresh Promise) is naturally safe. Supply your
|
|
2237
|
+
* own key when a single semantic event must remain idempotent across
|
|
2238
|
+
* multiple `learnFromUserAction(...)` calls.
|
|
2239
|
+
*
|
|
2240
|
+
* @example
|
|
2241
|
+
* ```tsx
|
|
2242
|
+
* import { useLearnFromUserAction } from "@copilotkit/react-core";
|
|
2243
|
+
*
|
|
2244
|
+
* function SettingsPage({ threadId }) {
|
|
2245
|
+
* const learnFromUserAction = useLearnFromUserAction();
|
|
2246
|
+
*
|
|
2247
|
+
* const onRename = (oldName: string, newName: string) => {
|
|
2248
|
+
* void learnFromUserAction({
|
|
2249
|
+
* threadId,
|
|
2250
|
+
* title: "Renamed project",
|
|
2251
|
+
* data: { previous: { name: oldName }, next: { name: newName } },
|
|
2252
|
+
* });
|
|
2253
|
+
* };
|
|
2254
|
+
* }
|
|
2255
|
+
* ```
|
|
2256
|
+
*/
|
|
2257
|
+
declare function useLearnFromUserAction(): UseLearnFromUserActionRecorder;
|
|
2258
|
+
//#endregion
|
|
2259
|
+
//#region src/v2/hooks/use-learn-from-user-action-in-current-thread.d.ts
|
|
2260
|
+
/**
|
|
2261
|
+
* Input to {@link UseLearnFromUserActionInCurrentThreadRecorder} — same as
|
|
2262
|
+
* {@link LearnFromUserActionInput} minus `threadId`, which is sourced from
|
|
2263
|
+
* the surrounding `<CopilotChatConfigurationProvider>` at call time.
|
|
2264
|
+
*/
|
|
2265
|
+
type LearnFromUserActionInCurrentThreadInput = Omit<LearnFromUserActionInput, "threadId">;
|
|
2266
|
+
/** Recorder function returned by {@link useLearnFromUserActionInCurrentThread}. */
|
|
2267
|
+
type UseLearnFromUserActionInCurrentThreadRecorder = (input: LearnFromUserActionInCurrentThreadInput) => Promise<LearnFromUserActionResult>;
|
|
2268
|
+
/**
|
|
2269
|
+
* Record a user UI interaction against the **current chat's** thread. The
|
|
2270
|
+
* `threadId` is sourced from the surrounding
|
|
2271
|
+
* `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
|
|
2272
|
+
* `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
|
|
2273
|
+
* subtree don't need to thread an id through manually.
|
|
2274
|
+
*
|
|
2275
|
+
* Throws on **call** (not on mount) when there is no chat-config provider
|
|
2276
|
+
* in scope — matches the "throw on call when runtimeUrl is missing"
|
|
2277
|
+
* behavior of {@link useLearnFromUserAction}. Mounting the hook in a branch
|
|
2278
|
+
* that never fires is harmless.
|
|
2279
|
+
*
|
|
2280
|
+
* The recorder does NOT accept a `threadId` override. If you need to
|
|
2281
|
+
* record against an explicit thread, use {@link useLearnFromUserAction}
|
|
2282
|
+
* directly — two hooks, two crisp contracts, no mode confusion.
|
|
2283
|
+
*
|
|
2284
|
+
* This hook always uses `config.threadId`, regardless of whether the
|
|
2285
|
+
* surrounding chat config minted it internally or received one from
|
|
2286
|
+
* the caller. Auto-minted threads simply mean the action lands under
|
|
2287
|
+
* a thread the platform never saw — the writer agent still distills
|
|
2288
|
+
* user-action-only threads (it does not require the thread to exist
|
|
2289
|
+
* in `cpki.threads`), so the loop keeps learning.
|
|
2290
|
+
*
|
|
2291
|
+
* @example
|
|
2292
|
+
* ```tsx
|
|
2293
|
+
* import { useLearnFromUserActionInCurrentThread } from "@copilotkit/react-core";
|
|
2294
|
+
*
|
|
2295
|
+
* function SettingsPanel() {
|
|
2296
|
+
* const learnFromUserAction = useLearnFromUserActionInCurrentThread();
|
|
2297
|
+
*
|
|
2298
|
+
* const onRename = (oldName: string, newName: string) => {
|
|
2299
|
+
* void learnFromUserAction({
|
|
2300
|
+
* title: "Renamed project",
|
|
2301
|
+
* data: { previous: { name: oldName }, next: { name: newName } },
|
|
2302
|
+
* });
|
|
2303
|
+
* };
|
|
2304
|
+
*
|
|
2305
|
+
* // ...
|
|
2306
|
+
* }
|
|
2307
|
+
* ```
|
|
2308
|
+
*/
|
|
2309
|
+
declare function useLearnFromUserActionInCurrentThread(): UseLearnFromUserActionInCurrentThreadRecorder;
|
|
2310
|
+
//#endregion
|
|
2089
2311
|
//#region src/v2/hooks/use-attachments.d.ts
|
|
2090
2312
|
interface UseAttachmentsProps {
|
|
2091
2313
|
config?: AttachmentsConfig;
|
|
@@ -2129,6 +2351,95 @@ declare function useAttachments({
|
|
|
2129
2351
|
config
|
|
2130
2352
|
}: UseAttachmentsProps): UseAttachmentsReturn;
|
|
2131
2353
|
//#endregion
|
|
2354
|
+
//#region src/v2/hooks/use-learning-containers.d.ts
|
|
2355
|
+
/**
|
|
2356
|
+
* Arguments for {@link useLearningContainers}.
|
|
2357
|
+
*/
|
|
2358
|
+
interface UseLearningContainersArgs {
|
|
2359
|
+
/** Thread to apply the learning-container selection to. */
|
|
2360
|
+
threadId: string;
|
|
2361
|
+
/**
|
|
2362
|
+
* The ordered list of learning container identifiers to activate for this
|
|
2363
|
+
* thread. Defaults to `["project"]` on the backend when absent.
|
|
2364
|
+
*/
|
|
2365
|
+
learningContainers: readonly string[];
|
|
2366
|
+
}
|
|
2367
|
+
/**
|
|
2368
|
+
* Declaratively keeps a thread's learning containers in sync by emitting
|
|
2369
|
+
* `set_learning_containers` annotations via the CopilotKit runtime annotate
|
|
2370
|
+
* endpoint (`POST ${runtimeUrl}/annotate`).
|
|
2371
|
+
*
|
|
2372
|
+
* **Emit rules:**
|
|
2373
|
+
* - On mount with `["project"]` (the backend default) → does NOT emit.
|
|
2374
|
+
* Absence of an annotation equals the default, so the round-trip is skipped.
|
|
2375
|
+
* - On mount with any other value → emits immediately.
|
|
2376
|
+
* - On any subsequent content change (including a switch back to
|
|
2377
|
+
* `["project"]`) → emits (a deliberate switch is always recorded).
|
|
2378
|
+
* - On unmount or threadId change → emits a reset to `["project"]`
|
|
2379
|
+
* so the backend is left in a clean state for the next consumer.
|
|
2380
|
+
* Changing `learningContainers` within the same thread does NOT reset the
|
|
2381
|
+
* thread; only the new value is emitted.
|
|
2382
|
+
*
|
|
2383
|
+
* Content-equality is evaluated via `JSON.stringify` so a fresh array literal
|
|
2384
|
+
* with the same items does NOT trigger a redundant emit.
|
|
2385
|
+
*
|
|
2386
|
+
* If `runtimeUrl` is absent, all emits are silently skipped.
|
|
2387
|
+
*
|
|
2388
|
+
* @example
|
|
2389
|
+
* ```tsx
|
|
2390
|
+
* function ThreadPane({ threadId, userScope }: Props) {
|
|
2391
|
+
* useLearningContainers({
|
|
2392
|
+
* threadId,
|
|
2393
|
+
* learningContainers: [userScope],
|
|
2394
|
+
* });
|
|
2395
|
+
* // ...
|
|
2396
|
+
* }
|
|
2397
|
+
* ```
|
|
2398
|
+
*/
|
|
2399
|
+
declare function useLearningContainers({
|
|
2400
|
+
threadId,
|
|
2401
|
+
learningContainers
|
|
2402
|
+
}: UseLearningContainersArgs): void;
|
|
2403
|
+
//#endregion
|
|
2404
|
+
//#region src/v2/hooks/use-learning-containers-in-current-thread.d.ts
|
|
2405
|
+
/**
|
|
2406
|
+
* Arguments for {@link useLearningContainersInCurrentThread}.
|
|
2407
|
+
* Same as {@link UseLearningContainersArgs} minus `threadId`, which is
|
|
2408
|
+
* sourced from the surrounding `<CopilotChatConfigurationProvider>` at
|
|
2409
|
+
* render time.
|
|
2410
|
+
*/
|
|
2411
|
+
type UseLearningContainersInCurrentThreadArgs = Omit<UseLearningContainersArgs, "threadId">;
|
|
2412
|
+
/**
|
|
2413
|
+
* Declaratively keeps the **current chat thread's** learning containers in
|
|
2414
|
+
* sync. The `threadId` is sourced from the surrounding
|
|
2415
|
+
* `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
|
|
2416
|
+
* `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
|
|
2417
|
+
* subtree don't need to thread an id through manually.
|
|
2418
|
+
*
|
|
2419
|
+
* **Throws on render** when there is no chat-config provider in scope or
|
|
2420
|
+
* when the provider does not yet have an active `threadId`. Mount the hook
|
|
2421
|
+
* inside a subtree that is guaranteed to have a thread context.
|
|
2422
|
+
*
|
|
2423
|
+
* If you need to manage an explicit thread, use {@link useLearningContainers}
|
|
2424
|
+
* directly — two hooks, two crisp contracts, no mode confusion.
|
|
2425
|
+
*
|
|
2426
|
+
* @throws When no `CopilotChatConfigurationProvider` is in scope or when the
|
|
2427
|
+
* active `threadId` is absent/empty.
|
|
2428
|
+
*
|
|
2429
|
+
* @example
|
|
2430
|
+
* ```tsx
|
|
2431
|
+
* function ThreadPanel({ scope }: Props) {
|
|
2432
|
+
* useLearningContainersInCurrentThread({
|
|
2433
|
+
* learningContainers: [scope],
|
|
2434
|
+
* });
|
|
2435
|
+
* // ...
|
|
2436
|
+
* }
|
|
2437
|
+
* ```
|
|
2438
|
+
*/
|
|
2439
|
+
declare function useLearningContainersInCurrentThread({
|
|
2440
|
+
learningContainers
|
|
2441
|
+
}: UseLearningContainersInCurrentThreadArgs): void;
|
|
2442
|
+
//#endregion
|
|
2132
2443
|
//#region src/v2/lib/react-core.d.ts
|
|
2133
2444
|
interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
|
|
2134
2445
|
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
@@ -2193,6 +2504,32 @@ interface CopilotKitContextValue {
|
|
|
2193
2504
|
}
|
|
2194
2505
|
declare const useCopilotKit: () => CopilotKitContextValue;
|
|
2195
2506
|
//#endregion
|
|
2507
|
+
//#region src/v2/a2ui/A2UIRecoveryStates.d.ts
|
|
2508
|
+
/**
|
|
2509
|
+
* Shared pre-paint lifecycle states for the A2UI surface renderer (OSS-162).
|
|
2510
|
+
*
|
|
2511
|
+
* The A2UI middleware drives the WHOLE generative-UI lifecycle on a single
|
|
2512
|
+
* `a2ui-surface` activity (one stable messageId, `replace: true`), so the states
|
|
2513
|
+
* below swap IN PLACE and the painted surface ultimately replaces them:
|
|
2514
|
+
*
|
|
2515
|
+
* building → animated skeleton + "Building interface" (+ optional ~N tokens)
|
|
2516
|
+
* retrying → same skeleton; once perceptible, the sub-label becomes
|
|
2517
|
+
* "Retrying generation… (N/M attempts)" (threshold-gated so a fast
|
|
2518
|
+
* transient retry never flashes), with debug detail per debugExposure
|
|
2519
|
+
* failed → a clean hard-failure card (replacing the skeleton), developer
|
|
2520
|
+
* detail tucked into an expander gated by debugExposure
|
|
2521
|
+
* painted → the surface renderer owns the UI (these states render nothing)
|
|
2522
|
+
*
|
|
2523
|
+
* Timing (`showAfterMs` / `showAfterAttempts`) and how much debug detail to surface
|
|
2524
|
+
* (`debugExposure`) are client concerns; the server can override `debugExposure`
|
|
2525
|
+
* by stamping it onto the activity content (it wins over the client option).
|
|
2526
|
+
*/
|
|
2527
|
+
type A2UIRecoveryRendererOptions = {
|
|
2528
|
+
/** Delay (ms) before the "Retrying…" sub-label becomes visible. Default 2000. */showAfterMs?: number; /** Show the "Retrying…" sub-label immediately once `attempt` reaches this. Default 2. */
|
|
2529
|
+
showAfterAttempts?: number; /** How much retry/debug detail to surface. Default "collapsed". */
|
|
2530
|
+
debugExposure?: "hidden" | "collapsed" | "verbose";
|
|
2531
|
+
};
|
|
2532
|
+
//#endregion
|
|
2196
2533
|
//#region src/v2/providers/CopilotKitProvider.d.ts
|
|
2197
2534
|
interface CopilotKitProviderProps {
|
|
2198
2535
|
children: ReactNode;
|
|
@@ -2212,7 +2549,7 @@ interface CopilotKitProviderProps {
|
|
|
2212
2549
|
publicLicenseKey?: string;
|
|
2213
2550
|
/**
|
|
2214
2551
|
* Signed license token for offline verification of premium features.
|
|
2215
|
-
* Obtain from https://
|
|
2552
|
+
* Obtain from https://dashboard.operations.copilotkit.ai.
|
|
2216
2553
|
*/
|
|
2217
2554
|
licenseToken?: string;
|
|
2218
2555
|
properties?: Record<string, unknown>;
|
|
@@ -2303,6 +2640,12 @@ interface CopilotKitProviderProps {
|
|
|
2303
2640
|
* schema if configured. Set to false to disable.
|
|
2304
2641
|
*/
|
|
2305
2642
|
includeSchema?: boolean;
|
|
2643
|
+
/**
|
|
2644
|
+
* Options for the A2UI error-recovery status UI (OSS-162): how long before
|
|
2645
|
+
* the transient "Retrying…" hint appears, after how many attempts, and how
|
|
2646
|
+
* much retry/debug detail to surface. When omitted, sane defaults apply.
|
|
2647
|
+
*/
|
|
2648
|
+
recovery?: A2UIRecoveryRendererOptions;
|
|
2306
2649
|
};
|
|
2307
2650
|
/**
|
|
2308
2651
|
* Default throttle interval (in milliseconds) for `useAgent` re-renders
|
|
@@ -2344,8 +2687,13 @@ type A2UIUserAction = {
|
|
|
2344
2687
|
};
|
|
2345
2688
|
type A2UIMessageRendererOptions = {
|
|
2346
2689
|
theme: Theme; /** Optional component catalog to pass to A2UIProvider */
|
|
2347
|
-
catalog?: any; /** Optional custom loading component shown while A2UI surface is
|
|
2690
|
+
catalog?: any; /** Optional custom loading component shown while the A2UI surface is building. */
|
|
2348
2691
|
loadingComponent?: React.ComponentType;
|
|
2692
|
+
/**
|
|
2693
|
+
* Pre-paint recovery/loading UX options (OSS-162): timing before the
|
|
2694
|
+
* "Retrying…" sub-label appears + how much retry/debug detail to surface.
|
|
2695
|
+
*/
|
|
2696
|
+
recovery?: A2UIRecoveryRendererOptions;
|
|
2349
2697
|
};
|
|
2350
2698
|
declare function createA2UIMessageRenderer(options: A2UIMessageRendererOptions): ReactActivityMessageRenderer<any>;
|
|
2351
2699
|
//#endregion
|
|
@@ -2363,13 +2711,13 @@ interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
|
|
|
2363
2711
|
/**
|
|
2364
2712
|
* Your Copilot Cloud API key.
|
|
2365
2713
|
*
|
|
2366
|
-
* Don't have it yet? Go to https://
|
|
2714
|
+
* Don't have it yet? Go to https://dashboard.operations.copilotkit.ai and get one for free.
|
|
2367
2715
|
*/
|
|
2368
2716
|
publicApiKey?: string;
|
|
2369
2717
|
/**
|
|
2370
2718
|
* Your public license key for accessing premium CopilotKit features.
|
|
2371
2719
|
*
|
|
2372
|
-
* Don't have it yet? Go to https://
|
|
2720
|
+
* Don't have it yet? Go to https://dashboard.operations.copilotkit.ai and get one for free.
|
|
2373
2721
|
*/
|
|
2374
2722
|
publicLicenseKey?: string;
|
|
2375
2723
|
/**
|
|
@@ -2384,7 +2732,7 @@ interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
|
|
|
2384
2732
|
* Restrict input to specific topics using guardrails.
|
|
2385
2733
|
* @remarks
|
|
2386
2734
|
*
|
|
2387
|
-
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://
|
|
2735
|
+
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://dashboard.operations.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
|
|
2388
2736
|
*/
|
|
2389
2737
|
guardrails_c?: {
|
|
2390
2738
|
validTopics?: string[];
|
|
@@ -2485,7 +2833,7 @@ interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
|
|
|
2485
2833
|
* The auth config to use for the CopilotKit.
|
|
2486
2834
|
* @remarks
|
|
2487
2835
|
*
|
|
2488
|
-
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://
|
|
2836
|
+
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://dashboard.operations.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
|
|
2489
2837
|
*/
|
|
2490
2838
|
authConfig_c?: {
|
|
2491
2839
|
SignInComponent: React.ComponentType<{
|
|
@@ -2545,5 +2893,5 @@ declare function CopilotKit({
|
|
|
2545
2893
|
}: CopilotKitProps): react_jsx_runtime0.JSX.Element;
|
|
2546
2894
|
declare const defaultCopilotContextCategories: string[];
|
|
2547
2895
|
//#endregion
|
|
2548
|
-
export {
|
|
2549
|
-
//# sourceMappingURL=copilotkit-
|
|
2896
|
+
export { InterruptEvent as $, CopilotChatSuggestionPill as $t, UseLearnFromUserActionRecorder as A, LangGraphInterruptRenderHandlerProps as An, CopilotSidebarViewProps as At, AgentContextInput as B, SystemMessageFunction as Bn, CopilotChatViewProps as Bt, UseAttachmentsReturn as C, CopilotContextParams as Cn, CopilotPopup as Ct, useLearnFromUserActionInCurrentThread as D, LangGraphInterruptActionSetter as Dn, CopilotPopupView as Dt, UseLearnFromUserActionInCurrentThreadRecorder as E, LangGraphInterruptAction as En, CopilotSidebarProps as Et, useThreads as F, CrewsResponseStatus as Fn, DefaultCloseIcon as Ft, useAgent as G, ActionRenderPropsNoArgs as Gn, IntelligenceIndicator as Gt, useAgentContext as H, Tree as Hn, CopilotChatMessageView as Ht, UseInterruptConfig as I, CrewsStateItem as In, DefaultOpenIcon as It, useRenderTool as J, CatchAllActionRenderProps as Jn, IntelligenceIndicatorStatus as Jt, useHumanInTheLoop as K, ActionRenderPropsNoArgsWait as Kn, IntelligenceIndicatorProps as Kt, useInterrupt as L, CrewsTaskStateItem as Ln, CopilotChat as Lt, Thread as M, QueuedInterruptEvent as Mn, CopilotModalHeaderProps as Mt, UseThreadsInput as N, CrewsAgentState as Nn, CopilotChatToggleButton as Nt, LearnFromUserActionInput as O, LangGraphInterruptActionSetterArgs as On, CopilotPopupViewProps as Ot, UseThreadsResult as P, CrewsResponse as Pn, CopilotChatToggleButtonProps as Pt, SandboxFunction as Q, RenderFunctionStatus as Qn, CopilotChatSuggestionViewProps as Qt, useConfigureSuggestions as R, CrewsToolStateItem as Rn, CopilotChatProps as Rt, UseAttachmentsProps as S, CopilotContext as Sn, CopilotChatAttachmentQueue as St, LearnFromUserActionInCurrentThreadInput as T, CoAgentStateRender as Tn, CopilotSidebar as Tt, useCapabilities as U, TreeNode as Un, CopilotChatMessageViewProps as Ut, JsonSerializable as V, DocumentPointer as Vn, AutoScrollMode as Vt, UseAgentUpdate as W, ActionRenderProps as Wn, INTELLIGENCE_TURN_HEAD as Wt, useFrontendTool as X, FrontendAction as Xn, IntelligenceIndicatorViewProps as Xt, useComponent as Y, CatchAllFrontendAction as Yn, IntelligenceIndicatorView as Yt, useRenderActivityMessage as Z, FrontendActionAvailability as Zn, CopilotChatSuggestionView as Zt, CopilotKitCoreReactSubscriber as _, AudioRecorderError as _n, WildcardToolCallRender as _t, A2UIUserAction as a, CopilotChatAssistantMessage as an, ReactActivityMessageRenderer as at, UseLearningContainersArgs as b, CoagentInChatRenderFunction as bn, AttachmentsConfig$1 as bt, SandboxFunctionsContext as c, CopilotChatToolCallsViewProps as cn, ReactCustomMessageRenderer as ct, CopilotKitProviderProps as d, ToolsMenuItem as dn, MCPAppsActivityContent as dt, CopilotChatSuggestionPillProps as en, InterruptHandlerProps as et, A2UIRecoveryRendererOptions as f, CopilotChatConfigurationProvider as fn, MCPAppsActivityContentSchema as ft, CopilotKitCoreReactConfig as g, useCopilotChatConfiguration as gn, CopilotKitInspectorProps as gt, CopilotKitCoreReact as h, CopilotChatLabels as hn, CopilotKitInspector as ht, A2UIMessageRendererOptions as i, CopilotChatUserMessageProps as in, ReactFrontendTool as it, useLearnFromUserAction as j, LangGraphInterruptRenderProps as jn, CopilotModalHeader as jt, LearnFromUserActionResult as k, LangGraphInterruptRender as kn, CopilotSidebarView as kt, useSandboxFunctions as l, CopilotChatInput as ln, ReactCustomMessageRendererPosition as lt, useCopilotKit as m, CopilotChatConfigurationValue as mn, MCPAppsActivityType as mt, defaultCopilotContextCategories as n, CopilotChatReasoningMessageProps as nn, defineToolCallRenderer as nt, createA2UIMessageRenderer as o, CopilotChatAssistantMessageProps as on, ReactToolCallRenderer as ot, CopilotKitContextValue as p, CopilotChatConfigurationProviderProps as pn, MCPAppsActivityRenderer as pt, useDefaultRenderTool as q, ActionRenderPropsWait as qn, getIntelligenceTurnAnchors as qt, CopilotKitProps as r, CopilotChatUserMessage as rn, ReactHumanInTheLoop as rt, InspectorAnchor as s, CopilotChatToolCallsView as sn, useRenderCustomMessages as st, CopilotKit as t, CopilotChatReasoningMessage as tn, InterruptRenderProps as tt, CopilotKitProvider as u, CopilotChatInputProps as un, useRenderToolCall as ut, UseLearningContainersInCurrentThreadArgs as v, AudioRecorderState as vn, Attachment$1 as vt, useAttachments as w, useCopilotContext as wn, CopilotPopupProps as wt, useLearningContainers as x, CopilotApiConfig as xn, CopilotChatAttachmentRenderer as xt, useLearningContainersInCurrentThread as y, CopilotChatAudioRecorder as yn, AttachmentModality as yt, useSuggestions as z, CopilotChatSuggestionConfiguration as zn, CopilotChatView as zt };
|
|
2897
|
+
//# sourceMappingURL=copilotkit-CD3EqiJ4.d.cts.map
|