@copilotkit/core 2.0.0-rc.40 → 2.0.0-rc.42

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.
@@ -1,4 +1,4 @@
1
- import { r as OpenThreadRegistration } from "./learning-bridge-Cqc7VJuV.cjs";
1
+ import { r as OpenThreadRegistration } from "./learning-bridge-DkOdyUdA.cjs";
2
2
 
3
3
  //#region src/chat/chat-configuration.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { r as OpenThreadRegistration } from "./learning-bridge-y2bnVsjp.mjs";
1
+ import { r as OpenThreadRegistration } from "./learning-bridge-DNdPfyx2.mjs";
2
2
 
3
3
  //#region src/chat/chat-configuration.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Gs as MarkdownSegment, Ms as A2UIMarkdownOperation, a as CopilotKitCore, dd as ɵGenerativeUIDebugRun, pd as ɵGenerativeUIDebugSource } from "../learning-bridge-Cqc7VJuV.cjs";
1
+ import { Gs as MarkdownSegment, Ms as A2UIMarkdownOperation, a as CopilotKitCore, dd as ɵGenerativeUIDebugRun, pd as ɵGenerativeUIDebugSource } from "../learning-bridge-DkOdyUdA.cjs";
2
2
  import "../index.cjs";
3
3
  import { AbstractAgent, Message } from "@ag-ui/client";
4
4
  import { A2UIActionMessage, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, CopilotKitUIEnvelope, GenerativeUIActionBinding, GenerativeUIFunctionManifest, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUIUserEvent, StandardSchemaV1, ValidateOperationOptions } from "@copilotkit/shared";
@@ -1,4 +1,4 @@
1
- import { Gs as MarkdownSegment, Ms as A2UIMarkdownOperation, a as CopilotKitCore, dd as ɵGenerativeUIDebugRun, pd as ɵGenerativeUIDebugSource } from "../learning-bridge-y2bnVsjp.mjs";
1
+ import { Gs as MarkdownSegment, Ms as A2UIMarkdownOperation, a as CopilotKitCore, dd as ɵGenerativeUIDebugRun, pd as ɵGenerativeUIDebugSource } from "../learning-bridge-DNdPfyx2.mjs";
2
2
  import "../index.mjs";
3
3
  import { AbstractAgent, Message } from "@ag-ui/client";
4
4
  import { A2UIActionMessage, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, CopilotKitUIEnvelope, GenerativeUIActionBinding, GenerativeUIFunctionManifest, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUIUserEvent, StandardSchemaV1, ValidateOperationOptions } from "@copilotkit/shared";
package/dist/index.cjs CHANGED
@@ -12169,22 +12169,42 @@ function hasValue(value) {
12169
12169
  return value !== null && value !== void 0 && value !== "";
12170
12170
  }
12171
12171
  /**
12172
+ * The component definitions an operation carries: those of an
12173
+ * `updateComponents`, or those a native (A2UI 1.0) `createSurface` carries
12174
+ * inline.
12175
+ *
12176
+ * @param operation - One A2UI operation.
12177
+ */
12178
+ function getA2UIOperationComponents(operation) {
12179
+ const update = operation.updateComponents;
12180
+ const create = operation.createSurface;
12181
+ const components = isRecord$1(update) ? update.components : operation.version === "1.0" && isRecord$1(create) ? create.components : void 0;
12182
+ return Array.isArray(components) ? components : [];
12183
+ }
12184
+ /**
12172
12185
  * Whether operations are enough to paint a visible card yet. A data-bound
12173
- * surface addresses its values by `path` and draws nothing until a data model
12174
- * update carries a non-empty value; a static surface paints from its
12175
- * components alone. Times the loader → surface hand-off to real content rather
12176
- * than a fixed delay (OSS-162).
12186
+ * surface addresses its values by `path` (`@path` in A2UI 1.0) and draws
12187
+ * nothing until a data model update, or a native create's inline data model,
12188
+ * carries a non-empty value; a static surface paints from its components
12189
+ * alone. Times the loader → surface hand-off to real content rather than a
12190
+ * fixed delay (OSS-162).
12177
12191
  *
12178
12192
  * @param operations - The operations of one surface or of a whole activity.
12179
12193
  */
12180
12194
  function surfaceHasRenderableContent(operations) {
12181
- const componentOperations = operations.filter((operation) => isRecord$1(operation.updateComponents));
12182
- if (componentOperations.length === 0) return false;
12183
- if (!JSON.stringify(componentOperations).includes("\"path\"")) return true;
12195
+ const components = operations.flatMap(getA2UIOperationComponents);
12196
+ if (components.length === 0) return false;
12197
+ const serialized = JSON.stringify(components);
12198
+ if (!(serialized.includes("\"path\"") || serialized.includes("\"@path\""))) return true;
12184
12199
  return operations.some((operation) => {
12185
- const update = operation.updateDataModel;
12186
- if (!isRecord$1(update)) return false;
12187
- const value = update.value;
12200
+ const update = isRecord$1(operation.updateDataModel) ? operation.updateDataModel : void 0;
12201
+ const create = operation.createSurface;
12202
+ const value = update?.value ?? (operation.version === "1.0" && isRecord$1(create) ? create.dataModel : void 0);
12203
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
12204
+ const path = typeof update?.path === "string" ? update.path : "/";
12205
+ const key = operation.version === "1.0" ? "@path" : "path";
12206
+ return value !== "" && serialized.includes(JSON.stringify({ [key]: path }));
12207
+ }
12188
12208
  if (typeof value !== "object" || value === null) return false;
12189
12209
  return Object.values(value).some(hasValue);
12190
12210
  });
@@ -12207,8 +12227,8 @@ function describeOperationKinds(operations) {
12207
12227
  function componentLists(operations) {
12208
12228
  const lists = [];
12209
12229
  for (const operation of operations) {
12210
- const update = operation.updateComponents;
12211
- if (isRecord$1(update) && Array.isArray(update.components)) lists.push(update.components);
12230
+ const components = getA2UIOperationComponents(operation);
12231
+ if (components.length > 0) lists.push(components);
12212
12232
  }
12213
12233
  return lists;
12214
12234
  }
@@ -12276,12 +12296,14 @@ function diagnoseUnresolvedRoot(surfaceId, operations, surface) {
12276
12296
  //#region src/a2ui/actions.ts
12277
12297
  /**
12278
12298
  * Wraps a raw processor action in the client-event envelope the runtimes read,
12279
- * filling the fields a partial action leaves out.
12299
+ * filling the fields a partial action leaves out. Other fields the action
12300
+ * carries, such as a native action's `userMessage`, are kept.
12280
12301
  *
12281
12302
  * @param action - What the `MessageProcessor` action handler received.
12282
12303
  */
12283
12304
  function toA2UIClientEvent(action) {
12284
12305
  return { userAction: {
12306
+ ...action,
12285
12307
  name: action.name ?? "unknown",
12286
12308
  surfaceId: action.surfaceId ?? A2UI_DEFAULT_SURFACE_ID,
12287
12309
  sourceComponentId: action.sourceComponentId ?? "",