@copilotkit/react-core 2.0.0-rc.14 → 2.0.0-rc.16
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/{MarkdownSurfaces-EGmsCZWN.cjs → MarkdownSurfaces-ChOKawIN.cjs} +52 -43
- package/dist/MarkdownSurfaces-ChOKawIN.cjs.map +1 -0
- package/dist/{MarkdownSurfaces-DKC9Eg_a.mjs → MarkdownSurfaces-DAEqIF5v.mjs} +52 -43
- package/dist/MarkdownSurfaces-DAEqIF5v.mjs.map +1 -0
- package/dist/context.cjs +6 -6
- package/dist/context.cjs.map +1 -1
- package/dist/context.mjs +6 -6
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui.cjs +6 -4
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.mjs +6 -4
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.cjs +2 -2
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.mjs +2 -2
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +98 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +23 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +98 -40
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +167 -65
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/dist/MarkdownSurfaces-DKC9Eg_a.mjs.map +0 -1
- package/dist/MarkdownSurfaces-EGmsCZWN.cjs.map +0 -1
|
@@ -863,6 +863,7 @@ function toManifest(definition, modelProps, modelEvents) {
|
|
|
863
863
|
//#endregion
|
|
864
864
|
//#region src/generative-ui/errors.ts
|
|
865
865
|
var GenerativeUIError = class extends Error {
|
|
866
|
+
code;
|
|
866
867
|
constructor(code, message) {
|
|
867
868
|
super(message);
|
|
868
869
|
this.name = "GenerativeUIError";
|
|
@@ -1079,10 +1080,8 @@ function isRecord(value) {
|
|
|
1079
1080
|
* is dropped at the end of that build, so the cache does not grow.
|
|
1080
1081
|
*/
|
|
1081
1082
|
var BuildMemo = class {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
this.current = /* @__PURE__ */ new Map();
|
|
1085
|
-
}
|
|
1083
|
+
previous = /* @__PURE__ */ new Map();
|
|
1084
|
+
current = /* @__PURE__ */ new Map();
|
|
1086
1085
|
/**
|
|
1087
1086
|
* The value of `key`. It is computed when no earlier value is there, or
|
|
1088
1087
|
* when `isFresh` says that the earlier value is out of date.
|
|
@@ -1100,12 +1099,11 @@ var BuildMemo = class {
|
|
|
1100
1099
|
};
|
|
1101
1100
|
/** The results of the builds of one thread. See `BuildMarkdownSurfacesOptions.cache`. */
|
|
1102
1101
|
var MarkdownBuildCache = class {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1102
|
+
segments = new BuildMemo();
|
|
1103
|
+
fences = new BuildMemo();
|
|
1104
|
+
drafts = new BuildMemo();
|
|
1105
|
+
/** The copies of an operation for other surface ids, by operation. */
|
|
1106
|
+
readdressed = /* @__PURE__ */ new WeakMap();
|
|
1109
1107
|
endBuild() {
|
|
1110
1108
|
this.segments.endBuild();
|
|
1111
1109
|
this.fences.endBuild();
|
|
@@ -1616,13 +1614,18 @@ function removalContent(surfaceId, catalogId) {
|
|
|
1616
1614
|
* that each fence renders.
|
|
1617
1615
|
*/
|
|
1618
1616
|
var MarkdownSurfaceSource = class {
|
|
1617
|
+
functions;
|
|
1618
|
+
/** By thread: the blocks of each fence, from the latest sync. */
|
|
1619
|
+
fences = /* @__PURE__ */ new Map();
|
|
1620
|
+
/** By thread, then surface: the operations last ingested, as JSON. */
|
|
1621
|
+
ingested = /* @__PURE__ */ new Map();
|
|
1622
|
+
/** By thread, then surface: the content last ingested. */
|
|
1623
|
+
contents = /* @__PURE__ */ new Map();
|
|
1624
|
+
/** By thread: the results of the earlier builds. */
|
|
1625
|
+
caches = /* @__PURE__ */ new Map();
|
|
1619
1626
|
constructor(manager, ui) {
|
|
1620
1627
|
this.manager = manager;
|
|
1621
1628
|
this.ui = ui;
|
|
1622
|
-
this.fences = /* @__PURE__ */ new Map();
|
|
1623
|
-
this.ingested = /* @__PURE__ */ new Map();
|
|
1624
|
-
this.contents = /* @__PURE__ */ new Map();
|
|
1625
|
-
this.caches = /* @__PURE__ */ new Map();
|
|
1626
1629
|
this.functions = declaredFunctions(ui);
|
|
1627
1630
|
}
|
|
1628
1631
|
/**
|
|
@@ -1801,18 +1804,18 @@ function describe(value) {
|
|
|
1801
1804
|
const MATH = {
|
|
1802
1805
|
min: (args) => Math.min(...args),
|
|
1803
1806
|
max: (args) => Math.max(...args),
|
|
1804
|
-
abs: ([x]) => Math.abs(x),
|
|
1805
|
-
floor: ([x]) => Math.floor(x),
|
|
1806
|
-
ceil: ([x]) => Math.ceil(x),
|
|
1807
|
-
round: ([x, decimals = 0]) => {
|
|
1807
|
+
abs: ([x = NaN]) => Math.abs(x),
|
|
1808
|
+
floor: ([x = NaN]) => Math.floor(x),
|
|
1809
|
+
ceil: ([x = NaN]) => Math.ceil(x),
|
|
1810
|
+
round: ([x = NaN, decimals = 0]) => {
|
|
1808
1811
|
const factor = 10 ** Math.trunc(decimals);
|
|
1809
1812
|
return Math.round(x * factor) / factor;
|
|
1810
1813
|
},
|
|
1811
|
-
pow: ([x, y]) => x ** y,
|
|
1812
|
-
sqrt: ([x]) => Math.sqrt(x),
|
|
1813
|
-
exp: ([x]) => Math.exp(x),
|
|
1814
|
-
ln: ([x]) => Math.log(x),
|
|
1815
|
-
log10: ([x]) => Math.log10(x)
|
|
1814
|
+
pow: ([x = NaN, y = NaN]) => x ** y,
|
|
1815
|
+
sqrt: ([x = NaN]) => Math.sqrt(x),
|
|
1816
|
+
exp: ([x = NaN]) => Math.exp(x),
|
|
1817
|
+
ln: ([x = NaN]) => Math.log(x),
|
|
1818
|
+
log10: ([x = NaN]) => Math.log10(x)
|
|
1816
1819
|
};
|
|
1817
1820
|
/** How many args a function takes, at least and at most; min and max take any. */
|
|
1818
1821
|
const ARITY = {
|
|
@@ -1832,18 +1835,27 @@ const CONSTANTS = {
|
|
|
1832
1835
|
e: Math.E
|
|
1833
1836
|
};
|
|
1834
1837
|
var CalcParser = class {
|
|
1838
|
+
pos = 0;
|
|
1835
1839
|
constructor(tokens, scope, source) {
|
|
1836
1840
|
this.tokens = tokens;
|
|
1837
1841
|
this.scope = scope;
|
|
1838
1842
|
this.source = source;
|
|
1839
|
-
this.pos = 0;
|
|
1840
|
-
this.skipDepth = 0;
|
|
1841
1843
|
}
|
|
1842
1844
|
parse() {
|
|
1843
1845
|
const value = this.ternary();
|
|
1844
|
-
|
|
1846
|
+
const token = this.peek();
|
|
1847
|
+
if (token.kind !== "end") this.fail(`unexpected "${this.text(token)}"`);
|
|
1845
1848
|
return value;
|
|
1846
1849
|
}
|
|
1850
|
+
/**
|
|
1851
|
+
* The token at `pos`. The parser never moves past the "end" token, which
|
|
1852
|
+
* `tokenize` always adds last, so there is always one.
|
|
1853
|
+
*/
|
|
1854
|
+
peek() {
|
|
1855
|
+
const token = this.tokens[this.pos];
|
|
1856
|
+
if (token === void 0) throw new Error(`calc: no token at ${this.pos} in "${this.source}"`);
|
|
1857
|
+
return token;
|
|
1858
|
+
}
|
|
1847
1859
|
fail(what) {
|
|
1848
1860
|
throw new ExpressionError(`calc: ${what} in "${this.source}"`);
|
|
1849
1861
|
}
|
|
@@ -1851,11 +1863,11 @@ var CalcParser = class {
|
|
|
1851
1863
|
return token.kind === "end" ? "end" : String(token.value);
|
|
1852
1864
|
}
|
|
1853
1865
|
peekOp(...ops) {
|
|
1854
|
-
const token = this.
|
|
1866
|
+
const token = this.peek();
|
|
1855
1867
|
return token.kind === "op" && ops.includes(token.value) ? token.value : void 0;
|
|
1856
1868
|
}
|
|
1857
1869
|
expectOp(op) {
|
|
1858
|
-
if (this.peekOp(op) === void 0) this.fail(`expected "${op}" but found "${this.text(this.
|
|
1870
|
+
if (this.peekOp(op) === void 0) this.fail(`expected "${op}" but found "${this.text(this.peek())}"`);
|
|
1859
1871
|
this.pos++;
|
|
1860
1872
|
}
|
|
1861
1873
|
/**
|
|
@@ -1874,6 +1886,8 @@ var CalcParser = class {
|
|
|
1874
1886
|
}
|
|
1875
1887
|
return null;
|
|
1876
1888
|
}
|
|
1889
|
+
/** Above 0 while parsing a part whose value is not needed. */
|
|
1890
|
+
skipDepth = 0;
|
|
1877
1891
|
/** The number of a value, or 0 while skipping. */
|
|
1878
1892
|
num(value, what) {
|
|
1879
1893
|
return this.skipDepth > 0 ? 0 : numberOf(value, what);
|
|
@@ -1980,7 +1994,8 @@ var CalcParser = class {
|
|
|
1980
1994
|
return value;
|
|
1981
1995
|
}
|
|
1982
1996
|
primary() {
|
|
1983
|
-
const token = this.
|
|
1997
|
+
const token = this.peek();
|
|
1998
|
+
this.pos++;
|
|
1984
1999
|
switch (token.kind) {
|
|
1985
2000
|
case "number": return token.value;
|
|
1986
2001
|
case "string": return token.value;
|
|
@@ -2260,10 +2275,10 @@ const IDENTIFIER = /@?[A-Za-z_][A-Za-z0-9_-]*/y;
|
|
|
2260
2275
|
const NUMBER = /-?\d+(?:\.\d+)?/y;
|
|
2261
2276
|
const PATH_SEGMENT = /[^\s,():'"]+/y;
|
|
2262
2277
|
var ExpressionParser = class {
|
|
2278
|
+
pos = 0;
|
|
2263
2279
|
constructor(source, state) {
|
|
2264
2280
|
this.source = source;
|
|
2265
2281
|
this.state = state;
|
|
2266
|
-
this.pos = 0;
|
|
2267
2282
|
}
|
|
2268
2283
|
parse() {
|
|
2269
2284
|
const value = this.expression();
|
|
@@ -2565,14 +2580,10 @@ function NodePlaceholder(_props) {
|
|
|
2565
2580
|
}
|
|
2566
2581
|
/** Per-node boundary. Resets on retry or a new agent revision, not on data ticks. */
|
|
2567
2582
|
var NodeBoundary = class extends react.Component {
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
this.
|
|
2571
|
-
|
|
2572
|
-
revision: this.props.revision
|
|
2573
|
-
};
|
|
2574
|
-
this.retry = () => this.setState({ error: null });
|
|
2575
|
-
}
|
|
2583
|
+
state = {
|
|
2584
|
+
error: null,
|
|
2585
|
+
revision: this.props.revision
|
|
2586
|
+
};
|
|
2576
2587
|
static getDerivedStateFromError(error) {
|
|
2577
2588
|
return { error };
|
|
2578
2589
|
}
|
|
@@ -2591,6 +2602,7 @@ var NodeBoundary = class extends react.Component {
|
|
|
2591
2602
|
error
|
|
2592
2603
|
});
|
|
2593
2604
|
}
|
|
2605
|
+
retry = () => this.setState({ error: null });
|
|
2594
2606
|
render() {
|
|
2595
2607
|
const { error } = this.state;
|
|
2596
2608
|
if (!error) return this.props.children;
|
|
@@ -2610,10 +2622,7 @@ var NodeBoundary = class extends react.Component {
|
|
|
2610
2622
|
};
|
|
2611
2623
|
/** Outer boundary: a failure here must not reach the chat or the host page. */
|
|
2612
2624
|
var SurfaceBoundary = class extends react.Component {
|
|
2613
|
-
|
|
2614
|
-
super(..._args2);
|
|
2615
|
-
this.state = { error: null };
|
|
2616
|
-
}
|
|
2625
|
+
state = { error: null };
|
|
2617
2626
|
static getDerivedStateFromError(error) {
|
|
2618
2627
|
return { error };
|
|
2619
2628
|
}
|
|
@@ -4051,4 +4060,4 @@ Object.defineProperty(exports, 'wrapperAria', {
|
|
|
4051
4060
|
return wrapperAria;
|
|
4052
4061
|
}
|
|
4053
4062
|
});
|
|
4054
|
-
//# sourceMappingURL=MarkdownSurfaces-
|
|
4063
|
+
//# sourceMappingURL=MarkdownSurfaces-ChOKawIN.cjs.map
|