@copilotkit/react-core 1.83.0 → 1.84.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.
Files changed (46) hide show
  1. package/dist/{MarkdownSurfaces-DGpjmPaB.mjs → MarkdownSurfaces-DV9P0Gi9.mjs} +55 -13
  2. package/dist/MarkdownSurfaces-DV9P0Gi9.mjs.map +1 -0
  3. package/dist/{MarkdownSurfaces-FF5za2kU.cjs → MarkdownSurfaces-IUaWSJ0E.cjs} +54 -12
  4. package/dist/MarkdownSurfaces-IUaWSJ0E.cjs.map +1 -0
  5. package/dist/{copilotkit-BuIuo-Z1.cjs → copilotkit-BOTf5RHF.cjs} +296 -291
  6. package/dist/copilotkit-BOTf5RHF.cjs.map +1 -0
  7. package/dist/{copilotkit-wqaNanhw.d.cts → copilotkit-C3mvJexb.d.cts} +31 -8
  8. package/dist/copilotkit-C3mvJexb.d.cts.map +1 -0
  9. package/dist/{copilotkit-DyxwF9wL.mjs → copilotkit-CKnD8GeM.mjs} +300 -295
  10. package/dist/copilotkit-CKnD8GeM.mjs.map +1 -0
  11. package/dist/{copilotkit-C765tOUi.d.mts → copilotkit-CnYo662V.d.mts} +31 -8
  12. package/dist/copilotkit-CnYo662V.d.mts.map +1 -0
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.d.cts +1 -1
  15. package/dist/index.d.mts +1 -1
  16. package/dist/index.mjs +2 -2
  17. package/dist/index.umd.js +199 -289
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/generative-ui.cjs +33 -54
  20. package/dist/v2/generative-ui.cjs.map +1 -1
  21. package/dist/v2/generative-ui.d.cts +64 -64
  22. package/dist/v2/generative-ui.d.mts +64 -64
  23. package/dist/v2/generative-ui.mjs +33 -54
  24. package/dist/v2/generative-ui.mjs.map +1 -1
  25. package/dist/v2/headless.cjs +32 -16
  26. package/dist/v2/headless.cjs.map +1 -1
  27. package/dist/v2/headless.d.cts +2 -0
  28. package/dist/v2/headless.d.cts.map +1 -1
  29. package/dist/v2/headless.d.mts +2 -0
  30. package/dist/v2/headless.d.mts.map +1 -1
  31. package/dist/v2/headless.mjs +33 -17
  32. package/dist/v2/headless.mjs.map +1 -1
  33. package/dist/v2/index.cjs +14 -2
  34. package/dist/v2/index.css +1 -1
  35. package/dist/v2/index.d.cts +2 -2
  36. package/dist/v2/index.d.mts +2 -2
  37. package/dist/v2/index.mjs +3 -3
  38. package/dist/v2/index.umd.js +359 -300
  39. package/dist/v2/index.umd.js.map +1 -1
  40. package/package.json +8 -8
  41. package/dist/MarkdownSurfaces-DGpjmPaB.mjs.map +0 -1
  42. package/dist/MarkdownSurfaces-FF5za2kU.cjs.map +0 -1
  43. package/dist/copilotkit-BuIuo-Z1.cjs.map +0 -1
  44. package/dist/copilotkit-C765tOUi.d.mts.map +0 -1
  45. package/dist/copilotkit-DyxwF9wL.mjs.map +0 -1
  46. package/dist/copilotkit-wqaNanhw.d.cts.map +0 -1
@@ -83,6 +83,7 @@ const CopilotChatDefaultLabels = {
83
83
  chatToggleOpenLabel: "Open chat",
84
84
  chatToggleCloseLabel: "Close chat",
85
85
  chatScrollToBottomLabel: "Scroll to bottom",
86
+ chatConnectingLabel: "Loading conversation",
86
87
  modalHeaderTitle: "CopilotKit Chat",
87
88
  welcomeMessageText: "How can I help you today?",
88
89
  reasoningMessageThinkingLabel: "Thinking…",
@@ -698,13 +699,6 @@ function toManifest(definition, modelProps, modelEvents) {
698
699
  return manifest;
699
700
  }
700
701
 
701
- //#endregion
702
- //#region src/v2/generative-ui/is-record.ts
703
- /** True for a plain object: not null, not an array. Internal, not exported. */
704
- function isRecord(value) {
705
- return typeof value === "object" && value !== null && !Array.isArray(value);
706
- }
707
-
708
702
  //#endregion
709
703
  //#region src/v2/generative-ui/errors.ts
710
704
  var GenerativeUIError = class extends Error {
@@ -910,6 +904,13 @@ function givesValidationResult(name) {
910
904
  return GENERATIVE_UI_FUNCTIONS[name]?.returnType === "validationResult";
911
905
  }
912
906
 
907
+ //#endregion
908
+ //#region src/v2/generative-ui/is-record.ts
909
+ /** True for a plain object: not null, not an array. Internal, not exported. */
910
+ function isRecord(value) {
911
+ return typeof value === "object" && value !== null && !Array.isArray(value);
912
+ }
913
+
913
914
  //#endregion
914
915
  //#region src/v2/generative-ui/markdown/source.ts
915
916
  /**
@@ -1558,6 +1559,7 @@ const OPERATORS = [
1558
1559
  "*",
1559
1560
  "/",
1560
1561
  "%",
1562
+ "^",
1561
1563
  "(",
1562
1564
  ")",
1563
1565
  ",",
@@ -1644,7 +1646,29 @@ const MATH = {
1644
1646
  round: ([x, decimals = 0]) => {
1645
1647
  const factor = 10 ** Math.trunc(decimals);
1646
1648
  return Math.round(x * factor) / factor;
1647
- }
1649
+ },
1650
+ pow: ([x, y]) => x ** y,
1651
+ sqrt: ([x]) => Math.sqrt(x),
1652
+ exp: ([x]) => Math.exp(x),
1653
+ ln: ([x]) => Math.log(x),
1654
+ log10: ([x]) => Math.log10(x)
1655
+ };
1656
+ /** How many args a function takes, at least and at most; min and max take any. */
1657
+ const ARITY = {
1658
+ abs: [1, 1],
1659
+ floor: [1, 1],
1660
+ ceil: [1, 1],
1661
+ round: [1, 2],
1662
+ pow: [2, 2],
1663
+ sqrt: [1, 1],
1664
+ exp: [1, 1],
1665
+ ln: [1, 1],
1666
+ log10: [1, 1]
1667
+ };
1668
+ /** Named constants, when no arg of the same name is passed. */
1669
+ const CONSTANTS = {
1670
+ pi: Math.PI,
1671
+ e: Math.E
1648
1672
  };
1649
1673
  var CalcParser = class {
1650
1674
  constructor(tokens, scope, source) {
@@ -1779,7 +1803,20 @@ var CalcParser = class {
1779
1803
  this.pos++;
1780
1804
  return !truthOf(this.unary());
1781
1805
  }
1782
- return this.primary();
1806
+ return this.power();
1807
+ }
1808
+ /** `a ^ b`: binds tighter than `*` and unary minus, right to left. */
1809
+ power() {
1810
+ const base = this.primary();
1811
+ if (!this.peekOp("^")) return base;
1812
+ this.pos++;
1813
+ const exponent = this.unary();
1814
+ if (this.skipDepth > 0) return null;
1815
+ return this.finite(this.num(base, "the left side of ^") ** this.num(exponent, "the right side of ^"), "^");
1816
+ }
1817
+ finite(value, what) {
1818
+ if (!Number.isFinite(value)) this.fail(`${what} has no finite result`);
1819
+ return value;
1783
1820
  }
1784
1821
  primary() {
1785
1822
  const token = this.tokens[this.pos++];
@@ -1814,10 +1851,15 @@ var CalcParser = class {
1814
1851
  const fn = Object.prototype.hasOwnProperty.call(MATH, name) ? MATH[name] : void 0;
1815
1852
  if (!fn) this.fail(`unknown function ${name}`);
1816
1853
  if (args.length === 0) this.fail(`${name} needs an argument`);
1817
- return fn(args);
1854
+ const [least, most] = ARITY[name] ?? [1, Infinity];
1855
+ if (args.length < least || args.length > most) this.fail(`${name} takes ${least === most ? least : `${least} or ${most}`} argument${most === 1 ? "" : "s"}`);
1856
+ return this.finite(fn(args), name);
1818
1857
  }
1819
1858
  if (this.skipDepth > 0) return null;
1820
- if (!Object.prototype.hasOwnProperty.call(this.scope, name)) this.fail(`unknown name ${name}; pass it as an arg`);
1859
+ if (!Object.prototype.hasOwnProperty.call(this.scope, name)) {
1860
+ if (Object.prototype.hasOwnProperty.call(CONSTANTS, name)) return CONSTANTS[name];
1861
+ this.fail(`unknown name ${name}; pass it as an arg`);
1862
+ }
1821
1863
  const value = this.scope[name];
1822
1864
  if (value !== null && typeof value !== "number" && typeof value !== "string" && typeof value !== "boolean") this.fail(`${name} is not a number, text or boolean (${describe(value)})`);
1823
1865
  return value;
@@ -3527,5 +3569,5 @@ function MarkdownSurfaces({ content, messageId, ...markdownProps }) {
3527
3569
  }
3528
3570
 
3529
3571
  //#endregion
3530
- export { isRecord as A, useCopilotChatConfiguration as B, validateSchemaSync as C, BASIC_FUNCTIONS as D, getMarkdownSurfaceSource as E, defineToolCallRenderer as F, useShallowStableRef as H, useKatexStyles as I, ControlledModalOpenScope as L, componentCatalogIds as M, createGenerativeUI as N, ExpressionError as O, toJsonSchema as P, CopilotChatConfigurationProvider as R, issueKey as S, containsDynamicValue as T, shallowEqual as V, GenerativeUIRuntimeContext as _, createGenerativeUIActivityRenderer as a, formatIssues as b, DARK_THEME_CSS as c, useGenerativeUIAccessibility as d, wrapperAria as f, GenerativeUINodeContext as g, useManagerVersion as h, GenerativeUIToolCallRenderer as i, catalogIdsOf as j, GenerativeUIError as k, controlAria as l, useGenerativeUIState as m, DefaultGenerativeUIChatCard as n, createGenerativeUIFunctionCallActivityRenderer as o, useGenerativeUIFunction as p, GenerativeUIChatSlotContext as r, SurfaceView as s, MarkdownSurfaces as t, namedRole as u, useGenerativeUIRuntime as v, withoutRejectedNulls as w, isAsyncIssue as x, useRequiredGenerativeUIRuntime as y, CopilotChatDefaultLabels as z };
3531
- //# sourceMappingURL=MarkdownSurfaces-DGpjmPaB.mjs.map
3572
+ export { GenerativeUIError as A, useCopilotChatConfiguration as B, validateSchemaSync as C, isRecord as D, getMarkdownSurfaceSource as E, defineToolCallRenderer as F, useShallowStableRef as H, useKatexStyles as I, ControlledModalOpenScope as L, componentCatalogIds as M, createGenerativeUI as N, BASIC_FUNCTIONS as O, toJsonSchema as P, CopilotChatConfigurationProvider as R, issueKey as S, containsDynamicValue as T, shallowEqual as V, GenerativeUIRuntimeContext as _, createGenerativeUIActivityRenderer as a, formatIssues as b, DARK_THEME_CSS as c, useGenerativeUIAccessibility as d, wrapperAria as f, GenerativeUINodeContext as g, useManagerVersion as h, GenerativeUIToolCallRenderer as i, catalogIdsOf as j, ExpressionError as k, controlAria as l, useGenerativeUIState as m, DefaultGenerativeUIChatCard as n, createGenerativeUIFunctionCallActivityRenderer as o, useGenerativeUIFunction as p, GenerativeUIChatSlotContext as r, SurfaceView as s, MarkdownSurfaces as t, namedRole as u, useGenerativeUIRuntime as v, withoutRejectedNulls as w, isAsyncIssue as x, useRequiredGenerativeUIRuntime as y, CopilotChatDefaultLabels as z };
3573
+ //# sourceMappingURL=MarkdownSurfaces-DV9P0Gi9.mjs.map