@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
@@ -111,6 +111,7 @@ const CopilotChatDefaultLabels = {
111
111
  chatToggleOpenLabel: "Open chat",
112
112
  chatToggleCloseLabel: "Close chat",
113
113
  chatScrollToBottomLabel: "Scroll to bottom",
114
+ chatConnectingLabel: "Loading conversation",
114
115
  modalHeaderTitle: "CopilotKit Chat",
115
116
  welcomeMessageText: "How can I help you today?",
116
117
  reasoningMessageThinkingLabel: "Thinking…",
@@ -726,13 +727,6 @@ function toManifest(definition, modelProps, modelEvents) {
726
727
  return manifest;
727
728
  }
728
729
 
729
- //#endregion
730
- //#region src/v2/generative-ui/is-record.ts
731
- /** True for a plain object: not null, not an array. Internal, not exported. */
732
- function isRecord(value) {
733
- return typeof value === "object" && value !== null && !Array.isArray(value);
734
- }
735
-
736
730
  //#endregion
737
731
  //#region src/v2/generative-ui/errors.ts
738
732
  var GenerativeUIError = class extends Error {
@@ -938,6 +932,13 @@ function givesValidationResult(name) {
938
932
  return _copilotkit_shared.GENERATIVE_UI_FUNCTIONS[name]?.returnType === "validationResult";
939
933
  }
940
934
 
935
+ //#endregion
936
+ //#region src/v2/generative-ui/is-record.ts
937
+ /** True for a plain object: not null, not an array. Internal, not exported. */
938
+ function isRecord(value) {
939
+ return typeof value === "object" && value !== null && !Array.isArray(value);
940
+ }
941
+
941
942
  //#endregion
942
943
  //#region src/v2/generative-ui/markdown/source.ts
943
944
  /**
@@ -1586,6 +1587,7 @@ const OPERATORS = [
1586
1587
  "*",
1587
1588
  "/",
1588
1589
  "%",
1590
+ "^",
1589
1591
  "(",
1590
1592
  ")",
1591
1593
  ",",
@@ -1672,7 +1674,29 @@ const MATH = {
1672
1674
  round: ([x, decimals = 0]) => {
1673
1675
  const factor = 10 ** Math.trunc(decimals);
1674
1676
  return Math.round(x * factor) / factor;
1675
- }
1677
+ },
1678
+ pow: ([x, y]) => x ** y,
1679
+ sqrt: ([x]) => Math.sqrt(x),
1680
+ exp: ([x]) => Math.exp(x),
1681
+ ln: ([x]) => Math.log(x),
1682
+ log10: ([x]) => Math.log10(x)
1683
+ };
1684
+ /** How many args a function takes, at least and at most; min and max take any. */
1685
+ const ARITY = {
1686
+ abs: [1, 1],
1687
+ floor: [1, 1],
1688
+ ceil: [1, 1],
1689
+ round: [1, 2],
1690
+ pow: [2, 2],
1691
+ sqrt: [1, 1],
1692
+ exp: [1, 1],
1693
+ ln: [1, 1],
1694
+ log10: [1, 1]
1695
+ };
1696
+ /** Named constants, when no arg of the same name is passed. */
1697
+ const CONSTANTS = {
1698
+ pi: Math.PI,
1699
+ e: Math.E
1676
1700
  };
1677
1701
  var CalcParser = class {
1678
1702
  constructor(tokens, scope, source) {
@@ -1807,7 +1831,20 @@ var CalcParser = class {
1807
1831
  this.pos++;
1808
1832
  return !truthOf(this.unary());
1809
1833
  }
1810
- return this.primary();
1834
+ return this.power();
1835
+ }
1836
+ /** `a ^ b`: binds tighter than `*` and unary minus, right to left. */
1837
+ power() {
1838
+ const base = this.primary();
1839
+ if (!this.peekOp("^")) return base;
1840
+ this.pos++;
1841
+ const exponent = this.unary();
1842
+ if (this.skipDepth > 0) return null;
1843
+ return this.finite(this.num(base, "the left side of ^") ** this.num(exponent, "the right side of ^"), "^");
1844
+ }
1845
+ finite(value, what) {
1846
+ if (!Number.isFinite(value)) this.fail(`${what} has no finite result`);
1847
+ return value;
1811
1848
  }
1812
1849
  primary() {
1813
1850
  const token = this.tokens[this.pos++];
@@ -1842,10 +1879,15 @@ var CalcParser = class {
1842
1879
  const fn = Object.prototype.hasOwnProperty.call(MATH, name) ? MATH[name] : void 0;
1843
1880
  if (!fn) this.fail(`unknown function ${name}`);
1844
1881
  if (args.length === 0) this.fail(`${name} needs an argument`);
1845
- return fn(args);
1882
+ const [least, most] = ARITY[name] ?? [1, Infinity];
1883
+ if (args.length < least || args.length > most) this.fail(`${name} takes ${least === most ? least : `${least} or ${most}`} argument${most === 1 ? "" : "s"}`);
1884
+ return this.finite(fn(args), name);
1846
1885
  }
1847
1886
  if (this.skipDepth > 0) return null;
1848
- if (!Object.prototype.hasOwnProperty.call(this.scope, name)) this.fail(`unknown name ${name}; pass it as an arg`);
1887
+ if (!Object.prototype.hasOwnProperty.call(this.scope, name)) {
1888
+ if (Object.prototype.hasOwnProperty.call(CONSTANTS, name)) return CONSTANTS[name];
1889
+ this.fail(`unknown name ${name}; pass it as an arg`);
1890
+ }
1849
1891
  const value = this.scope[name];
1850
1892
  if (value !== null && typeof value !== "number" && typeof value !== "string" && typeof value !== "boolean") this.fail(`${name} is not a number, text or boolean (${describe(value)})`);
1851
1893
  return value;
@@ -3813,4 +3855,4 @@ Object.defineProperty(exports, 'wrapperAria', {
3813
3855
  return wrapperAria;
3814
3856
  }
3815
3857
  });
3816
- //# sourceMappingURL=MarkdownSurfaces-FF5za2kU.cjs.map
3858
+ //# sourceMappingURL=MarkdownSurfaces-IUaWSJ0E.cjs.map