@superblocksteam/library 2.0.149 → 2.0.150-next.1
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/{build-manifest-Xi8oZhWX.js → build-manifest-BQAcrmit.js} +1 -1
- package/dist/{build-manifest-Xi8oZhWX.js.map → build-manifest-BQAcrmit.js.map} +1 -1
- package/dist/{devtools-consolidated--QF_TVsD.js → devtools-consolidated-C5sXwPGD.js} +1 -1
- package/dist/{devtools-consolidated--QF_TVsD.js.map → devtools-consolidated-C5sXwPGD.js.map} +1 -1
- package/dist/jsx-dev-runtime/index.js +2 -1
- package/dist/jsx-dev-runtime/index.js.map +1 -1
- package/dist/jsx-wrapper-c5W52jgK.js +638 -0
- package/dist/jsx-wrapper-c5W52jgK.js.map +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +8 -321
- package/dist/lib/index.js.map +1 -1
- package/dist/{logs-Bo--dJx2.js → logs-DwKJqoRc.js} +1 -1
- package/dist/{logs-Bo--dJx2.js.map → logs-DwKJqoRc.js.map} +1 -1
- package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
- package/dist/{jsx-wrapper-CSTsctdq.js → root-store-CkTnQd84.js} +215 -665
- package/dist/root-store-CkTnQd84.js.map +1 -0
- package/dist/sdk-api-discovery-ekr6aG8h.js +366 -0
- package/dist/sdk-api-discovery-ekr6aG8h.js.map +1 -0
- package/dist/{utils-C-i9g4Qh.js → utils-kXteBlMZ.js} +2 -13
- package/dist/{utils-C-i9g4Qh.js.map → utils-kXteBlMZ.js.map} +1 -1
- package/package.json +4 -4
- package/dist/jsx-wrapper-CSTsctdq.js.map +0 -1
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { t as getTracer } from "./utils-
|
|
1
|
+
import { t as getTracer } from "./utils-kXteBlMZ.js";
|
|
2
2
|
import { InputType, PropsCategory } from "@superblocksteam/library-shared/props";
|
|
3
3
|
import { action, entries, isComputedProp, isObservableArray, isObservableMap, isObservableObject, makeAutoObservable, makeObservable, observable, observe, reaction, toJS, values } from "mobx";
|
|
4
4
|
import { matchRoutes } from "react-router";
|
|
5
|
-
import {
|
|
5
|
+
import { URL_PARAMS, getQueryParams, pathStringToArray, toMobXPatch } from "@superblocksteam/library-shared";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
|
-
import
|
|
7
|
+
import { createContext, isValidElement, useCallback, useContext, useMemo, useSyncExternalStore } from "react";
|
|
8
8
|
import { pick, throttle } from "lodash";
|
|
9
9
|
import { ApiResponseType, OrchestratorViewMode, SUPERBLOCKS_AUTHORIZATION_HEADER, SUPERBLOCKS_REQUEST_ID_HEADER, ViewMode, decodeBytestrings } from "@superblocksteam/shared";
|
|
10
10
|
import isString from "lodash/isString.js";
|
|
11
11
|
import { toast } from "sonner";
|
|
12
|
-
import styled
|
|
12
|
+
import styled from "styled-components";
|
|
13
13
|
import { NotificationPosition } from "@superblocksteam/library-shared/types";
|
|
14
|
-
import { jsx
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
15
|
import { ROOT_CONTEXT, context, propagation, trace } from "@opentelemetry/api";
|
|
16
16
|
import diff from "microdiff";
|
|
17
|
-
import { Observer } from "mobx-react-lite";
|
|
18
|
-
import polyfill from "@oddbird/css-anchor-positioning/fn";
|
|
19
17
|
//#region src/edit-mode/get-edit-store.ts
|
|
20
18
|
/**
|
|
21
19
|
* Get the global EditStore instance
|
|
@@ -1225,23 +1223,23 @@ var LocationStore = class {
|
|
|
1225
1223
|
};
|
|
1226
1224
|
//#endregion
|
|
1227
1225
|
//#region src/lib/user-facing/assets/icons/system-danger.svg
|
|
1228
|
-
var _path$
|
|
1229
|
-
function _extends$
|
|
1230
|
-
return _extends$
|
|
1226
|
+
var _path$3;
|
|
1227
|
+
function _extends$3() {
|
|
1228
|
+
return _extends$3 = Object.assign ? Object.assign.bind() : function(n) {
|
|
1231
1229
|
for (var e = 1; e < arguments.length; e++) {
|
|
1232
1230
|
var t = arguments[e];
|
|
1233
1231
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1234
1232
|
}
|
|
1235
1233
|
return n;
|
|
1236
|
-
}, _extends$
|
|
1234
|
+
}, _extends$3.apply(null, arguments);
|
|
1237
1235
|
}
|
|
1238
1236
|
var SvgSystemDanger = function SvgSystemDanger(props) {
|
|
1239
|
-
return /* @__PURE__ */ React$1.createElement("svg", _extends$
|
|
1237
|
+
return /* @__PURE__ */ React$1.createElement("svg", _extends$3({
|
|
1240
1238
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1241
1239
|
width: 16,
|
|
1242
1240
|
height: 16,
|
|
1243
1241
|
fill: "none"
|
|
1244
|
-
}, props), _path$
|
|
1242
|
+
}, props), _path$3 || (_path$3 = /* @__PURE__ */ React$1.createElement("path", {
|
|
1245
1243
|
fill: "currentColor",
|
|
1246
1244
|
fillRule: "evenodd",
|
|
1247
1245
|
d: "M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14m.75-10a.75.75 0 0 0-1.5 0v3a.75.75 0 1 0 1.5 0zM8 9.75a1 1 0 1 0 0 2 1 1 0 0 0 0-2",
|
|
@@ -1250,23 +1248,23 @@ var SvgSystemDanger = function SvgSystemDanger(props) {
|
|
|
1250
1248
|
};
|
|
1251
1249
|
//#endregion
|
|
1252
1250
|
//#region src/lib/user-facing/assets/icons/system-error.svg
|
|
1253
|
-
var _path$
|
|
1254
|
-
function _extends$
|
|
1255
|
-
return _extends$
|
|
1251
|
+
var _path$2;
|
|
1252
|
+
function _extends$2() {
|
|
1253
|
+
return _extends$2 = Object.assign ? Object.assign.bind() : function(n) {
|
|
1256
1254
|
for (var e = 1; e < arguments.length; e++) {
|
|
1257
1255
|
var t = arguments[e];
|
|
1258
1256
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1259
1257
|
}
|
|
1260
1258
|
return n;
|
|
1261
|
-
}, _extends$
|
|
1259
|
+
}, _extends$2.apply(null, arguments);
|
|
1262
1260
|
}
|
|
1263
1261
|
var SvgSystemError = function SvgSystemError(props) {
|
|
1264
|
-
return /* @__PURE__ */ React$1.createElement("svg", _extends$
|
|
1262
|
+
return /* @__PURE__ */ React$1.createElement("svg", _extends$2({
|
|
1265
1263
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1266
1264
|
width: 16,
|
|
1267
1265
|
height: 16,
|
|
1268
1266
|
fill: "none"
|
|
1269
|
-
}, props), _path$
|
|
1267
|
+
}, props), _path$2 || (_path$2 = /* @__PURE__ */ React$1.createElement("path", {
|
|
1270
1268
|
fill: "currentColor",
|
|
1271
1269
|
fillRule: "evenodd",
|
|
1272
1270
|
d: "M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0M5.942 5.058a.625.625 0 1 0-.884.884L7.116 8l-2.058 2.058a.625.625 0 1 0 .884.884L8 8.884l2.058 2.058a.625.625 0 1 0 .884-.884L8.884 8l2.058-2.058a.625.625 0 1 0-.884-.884L8 7.116z",
|
|
@@ -1275,46 +1273,46 @@ var SvgSystemError = function SvgSystemError(props) {
|
|
|
1275
1273
|
};
|
|
1276
1274
|
//#endregion
|
|
1277
1275
|
//#region src/lib/user-facing/assets/icons/system-info.svg
|
|
1278
|
-
var _path$
|
|
1279
|
-
function _extends$
|
|
1280
|
-
return _extends$
|
|
1276
|
+
var _path$1;
|
|
1277
|
+
function _extends$1() {
|
|
1278
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
|
|
1281
1279
|
for (var e = 1; e < arguments.length; e++) {
|
|
1282
1280
|
var t = arguments[e];
|
|
1283
1281
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1284
1282
|
}
|
|
1285
1283
|
return n;
|
|
1286
|
-
}, _extends$
|
|
1284
|
+
}, _extends$1.apply(null, arguments);
|
|
1287
1285
|
}
|
|
1288
1286
|
var SvgSystemInfo = function SvgSystemInfo(props) {
|
|
1289
|
-
return /* @__PURE__ */ React$1.createElement("svg", _extends$
|
|
1287
|
+
return /* @__PURE__ */ React$1.createElement("svg", _extends$1({
|
|
1290
1288
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1291
1289
|
width: 16,
|
|
1292
1290
|
height: 16,
|
|
1293
1291
|
fill: "none"
|
|
1294
|
-
}, props), _path$
|
|
1292
|
+
}, props), _path$1 || (_path$1 = /* @__PURE__ */ React$1.createElement("path", {
|
|
1295
1293
|
fill: "currentColor",
|
|
1296
1294
|
d: "M8 1a7 7 0 1 0 7 7 7.014 7.014 0 0 0-7-7m-.135 3.23a.808.808 0 1 1 0 1.616.808.808 0 0 1 0-1.615m.673 7.54H8a.54.54 0 0 1-.538-.54V8a.538.538 0 1 1 0-1.077H8a.54.54 0 0 1 .538.539v3.23a.538.538 0 1 1 0 1.077"
|
|
1297
1295
|
})));
|
|
1298
1296
|
};
|
|
1299
1297
|
//#endregion
|
|
1300
1298
|
//#region src/lib/user-facing/assets/icons/system-success.svg
|
|
1301
|
-
var _path
|
|
1302
|
-
function _extends
|
|
1303
|
-
return _extends
|
|
1299
|
+
var _path;
|
|
1300
|
+
function _extends() {
|
|
1301
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
1304
1302
|
for (var e = 1; e < arguments.length; e++) {
|
|
1305
1303
|
var t = arguments[e];
|
|
1306
1304
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1307
1305
|
}
|
|
1308
1306
|
return n;
|
|
1309
|
-
}, _extends
|
|
1307
|
+
}, _extends.apply(null, arguments);
|
|
1310
1308
|
}
|
|
1311
1309
|
var SvgSystemSuccess = function SvgSystemSuccess(props) {
|
|
1312
|
-
return /* @__PURE__ */ React$1.createElement("svg", _extends
|
|
1310
|
+
return /* @__PURE__ */ React$1.createElement("svg", _extends({
|
|
1313
1311
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1314
1312
|
width: 16,
|
|
1315
1313
|
height: 16,
|
|
1316
1314
|
fill: "none"
|
|
1317
|
-
}, props), _path
|
|
1315
|
+
}, props), _path || (_path = /* @__PURE__ */ React$1.createElement("path", {
|
|
1318
1316
|
fill: "currentColor",
|
|
1319
1317
|
fillRule: "evenodd",
|
|
1320
1318
|
d: "M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14m3.442-8.058a.625.625 0 1 0-.884-.884L7.5 9.116 5.942 7.558a.625.625 0 1 0-.884.884l2 2c.244.244.64.244.884 0z",
|
|
@@ -2077,6 +2075,129 @@ var HttpError = class extends Error {
|
|
|
2077
2075
|
this.critical = critical;
|
|
2078
2076
|
}
|
|
2079
2077
|
};
|
|
2078
|
+
/** Byte budget for a single value captured into an editor API run record. */
|
|
2079
|
+
const MAX_EDITOR_RUN_RECORD_RESPONSE_BYTES = 1e6;
|
|
2080
|
+
const RUN_RECORD_TRUNCATION_PREVIEW_CHARS = 4096;
|
|
2081
|
+
/**
|
|
2082
|
+
* Serializes a value for the run-record size probe, tolerating inputs that plain
|
|
2083
|
+
* `JSON.stringify` rejects but `structuredClone` (the postMessage transport)
|
|
2084
|
+
* accepts: `BigInt` (rendered as a `"<n>n"` string) and repeated/circular
|
|
2085
|
+
* references (collapsed to a `"[Circular]"` marker). Returning a JSON-safe string
|
|
2086
|
+
* lets the caller preserve sibling fields instead of blanking the whole value,
|
|
2087
|
+
* and keeps the stored inspector copy safe for the inspector's own
|
|
2088
|
+
* `JSON.stringify` render.
|
|
2089
|
+
*
|
|
2090
|
+
* A DAG (the same object reached from two branches) is treated like a cycle and
|
|
2091
|
+
* its repeats collapse to the marker; that only under-counts size for the probe
|
|
2092
|
+
* and never drops data the app relies on.
|
|
2093
|
+
*/
|
|
2094
|
+
const serializeRunRecordValueTolerant = (value) => {
|
|
2095
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
2096
|
+
return JSON.stringify(value, (_key, val) => {
|
|
2097
|
+
if (typeof val === "bigint") return `${val.toString()}n`;
|
|
2098
|
+
if (typeof val === "object" && val !== null) {
|
|
2099
|
+
if (seen.has(val)) return "[Circular]";
|
|
2100
|
+
seen.add(val);
|
|
2101
|
+
}
|
|
2102
|
+
return val;
|
|
2103
|
+
});
|
|
2104
|
+
};
|
|
2105
|
+
/**
|
|
2106
|
+
* Bounds a value captured into an editor API run record (its `response` or its
|
|
2107
|
+
* `inputs`). In edit mode these are forwarded to the parent editor (postMessage)
|
|
2108
|
+
* and retained per run for the run inspector; a large value (e.g. thousands of
|
|
2109
|
+
* rows) would be structured-cloned and accumulated, exhausting the editor tab's
|
|
2110
|
+
* memory. Only the editor's inspector copy is capped -- the app still receives
|
|
2111
|
+
* the full, untouched value. Mirrors the AI-service forward path, which already
|
|
2112
|
+
* caps outputs (see library-shared `socket.ts` output-truncated flag).
|
|
2113
|
+
*
|
|
2114
|
+
* `BigInt` / circular values are re-encoded to a JSON-safe form (siblings
|
|
2115
|
+
* preserved) rather than blanked, so a single `BigInt` or cycle no longer hides
|
|
2116
|
+
* the whole value; only a value that throws while serializing (e.g. a throwing
|
|
2117
|
+
* `toJSON`) is omitted. When `truncated` is true, `value` is a human-readable
|
|
2118
|
+
* marker STRING (a size preview, or an "omitted" notice), not the original
|
|
2119
|
+
* shape; `reason` distinguishes the two cases. Never throws.
|
|
2120
|
+
*/
|
|
2121
|
+
const boundRunRecordValue = (value) => {
|
|
2122
|
+
if (value == null) return {
|
|
2123
|
+
value,
|
|
2124
|
+
truncated: false
|
|
2125
|
+
};
|
|
2126
|
+
let serialized;
|
|
2127
|
+
let sanitized = false;
|
|
2128
|
+
try {
|
|
2129
|
+
serialized = JSON.stringify(value);
|
|
2130
|
+
} catch {
|
|
2131
|
+
try {
|
|
2132
|
+
serialized = serializeRunRecordValueTolerant(value);
|
|
2133
|
+
sanitized = true;
|
|
2134
|
+
} catch (err) {
|
|
2135
|
+
console.warn("[api-utils] [boundRunRecordValue] value not serializable; omitting from editor run record:", err instanceof Error ? err.message : String(err));
|
|
2136
|
+
return {
|
|
2137
|
+
value: "[Superblocks editor: value omitted from the run record -- not serializable. The full value is still available to your app.]",
|
|
2138
|
+
truncated: true,
|
|
2139
|
+
reason: "unserializable"
|
|
2140
|
+
};
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
if (serialized == null) return {
|
|
2144
|
+
value,
|
|
2145
|
+
truncated: false
|
|
2146
|
+
};
|
|
2147
|
+
const bytes = new TextEncoder().encode(serialized).byteLength;
|
|
2148
|
+
if (bytes <= 1e6) return sanitized ? {
|
|
2149
|
+
value: JSON.parse(serialized),
|
|
2150
|
+
truncated: false
|
|
2151
|
+
} : {
|
|
2152
|
+
value,
|
|
2153
|
+
truncated: false
|
|
2154
|
+
};
|
|
2155
|
+
console.warn(`[api-utils] [boundRunRecordValue] value truncated from editor run record: ${bytes} bytes exceeds the ${MAX_EDITOR_RUN_RECORD_RESPONSE_BYTES}-byte inspector limit.`);
|
|
2156
|
+
return {
|
|
2157
|
+
value: `[Superblocks editor: value truncated -- ${bytes} bytes exceeds the ${MAX_EDITOR_RUN_RECORD_RESPONSE_BYTES}-byte inspector limit. The full value is still available to your app; run the API to view it.]\nPreview: ${serialized.slice(0, RUN_RECORD_TRUNCATION_PREVIEW_CHARS)}`,
|
|
2158
|
+
truncated: true,
|
|
2159
|
+
reason: "size"
|
|
2160
|
+
};
|
|
2161
|
+
};
|
|
2162
|
+
/**
|
|
2163
|
+
* Bounds the step logs captured into an editor run record. Each step's `output`
|
|
2164
|
+
* (the step's return value -- for the final step this often mirrors the full API
|
|
2165
|
+
* result) and its `stdout`/`stderr` are capped the same way as the top-level
|
|
2166
|
+
* response. Only the editor copy is bounded; the app is unaffected. Never throws.
|
|
2167
|
+
*
|
|
2168
|
+
* The cap is PER FIELD, not per record: a single oversized step field is
|
|
2169
|
+
* bounded, but an API with many blocks each returning a just-under-budget
|
|
2170
|
+
* payload could still assemble an aggregate above the budget. This closes the
|
|
2171
|
+
* reported single-fetch case (one large response / terminal-step output);
|
|
2172
|
+
* bounding the aggregate across all step fields is a separate follow-up.
|
|
2173
|
+
*
|
|
2174
|
+
* `reuse` lets the caller supply an already-computed bound for a step whose
|
|
2175
|
+
* `output` is reference-equal to `reuse.value`. A single-fetch API's terminal
|
|
2176
|
+
* step output is the same object as the top-level response, so this avoids
|
|
2177
|
+
* serializing that (potentially multi-MB) payload a second time.
|
|
2178
|
+
*/
|
|
2179
|
+
const boundRunRecordStepLogs = (stepLogs, reuse) => {
|
|
2180
|
+
if (!stepLogs?.length) return {
|
|
2181
|
+
stepLogs,
|
|
2182
|
+
truncated: false
|
|
2183
|
+
};
|
|
2184
|
+
let truncated = false;
|
|
2185
|
+
return {
|
|
2186
|
+
stepLogs: stepLogs.map((step) => {
|
|
2187
|
+
const output = reuse && step.output === reuse.value ? reuse.bounded : boundRunRecordValue(step.output);
|
|
2188
|
+
const stdout = boundRunRecordValue(step.stdout);
|
|
2189
|
+
const stderr = boundRunRecordValue(step.stderr);
|
|
2190
|
+
if (output.truncated || stdout.truncated || stderr.truncated) truncated = true;
|
|
2191
|
+
return {
|
|
2192
|
+
...step,
|
|
2193
|
+
output: output.value,
|
|
2194
|
+
stdout: stdout.truncated ? [String(stdout.value)] : step.stdout,
|
|
2195
|
+
stderr: stderr.truncated ? [String(stderr.value)] : step.stderr
|
|
2196
|
+
};
|
|
2197
|
+
}),
|
|
2198
|
+
truncated
|
|
2199
|
+
};
|
|
2200
|
+
};
|
|
2080
2201
|
var ResponseSizeLimitError = class extends Error {
|
|
2081
2202
|
constructor(limitBytes) {
|
|
2082
2203
|
super(`Response blocked: exceeded orchestrator /execute response limit of ${limitBytes} bytes.`);
|
|
@@ -2634,16 +2755,57 @@ var ApiManager = class {
|
|
|
2634
2755
|
options,
|
|
2635
2756
|
callback
|
|
2636
2757
|
};
|
|
2758
|
+
let boundedResponse = {
|
|
2759
|
+
value: data,
|
|
2760
|
+
truncated: false
|
|
2761
|
+
};
|
|
2762
|
+
let boundedInputs = {
|
|
2763
|
+
value: inputs,
|
|
2764
|
+
truncated: false
|
|
2765
|
+
};
|
|
2766
|
+
let boundedStepLogs = {
|
|
2767
|
+
stepLogs,
|
|
2768
|
+
truncated: false
|
|
2769
|
+
};
|
|
2770
|
+
if (editMode) try {
|
|
2771
|
+
boundedResponse = boundRunRecordValue(data);
|
|
2772
|
+
boundedInputs = boundRunRecordValue(inputs);
|
|
2773
|
+
boundedStepLogs = boundRunRecordStepLogs(stepLogs, {
|
|
2774
|
+
value: data,
|
|
2775
|
+
bounded: boundedResponse
|
|
2776
|
+
});
|
|
2777
|
+
} catch (err) {
|
|
2778
|
+
const omitted = "[Superblocks editor: run record omitted -- inspector bounding failed. The full result is still available to your app.]";
|
|
2779
|
+
console.warn("[api-store] editor run-record bounding failed; omitting inspector copy:", err instanceof Error ? err.message : String(err));
|
|
2780
|
+
boundedResponse = {
|
|
2781
|
+
value: omitted,
|
|
2782
|
+
truncated: true,
|
|
2783
|
+
reason: "unserializable"
|
|
2784
|
+
};
|
|
2785
|
+
boundedInputs = {
|
|
2786
|
+
value: omitted,
|
|
2787
|
+
truncated: true,
|
|
2788
|
+
reason: "unserializable"
|
|
2789
|
+
};
|
|
2790
|
+
boundedStepLogs = {
|
|
2791
|
+
stepLogs: void 0,
|
|
2792
|
+
truncated: true
|
|
2793
|
+
};
|
|
2794
|
+
}
|
|
2795
|
+
const recordInputs = boundedInputs.truncated ? { superblocksTruncated: boundedInputs.value } : boundedInputs.value;
|
|
2637
2796
|
if (isRerun) editorBridge.updateApiRunRecord(apiId, callId, {
|
|
2638
2797
|
timestamp: executionStartTime,
|
|
2639
2798
|
statusCode: this.extractStatusCode(parsedResult),
|
|
2640
2799
|
timeTaken,
|
|
2641
|
-
inputs,
|
|
2642
|
-
|
|
2800
|
+
inputs: recordInputs,
|
|
2801
|
+
inputsTruncated: boundedInputs.truncated,
|
|
2802
|
+
response: boundedResponse.value,
|
|
2803
|
+
responseTruncated: boundedResponse.truncated,
|
|
2643
2804
|
error,
|
|
2644
2805
|
loading: false,
|
|
2645
2806
|
isTestRun,
|
|
2646
|
-
stepLogs
|
|
2807
|
+
stepLogs: boundedStepLogs.stepLogs,
|
|
2808
|
+
stepLogsTruncated: boundedStepLogs.truncated
|
|
2647
2809
|
});
|
|
2648
2810
|
else editorBridge.addApiRunRecord(apiId, {
|
|
2649
2811
|
id: `${apiId}-${executionStartTime}`,
|
|
@@ -2651,12 +2813,15 @@ var ApiManager = class {
|
|
|
2651
2813
|
timestamp: executionStartTime,
|
|
2652
2814
|
statusCode: this.extractStatusCode(parsedResult),
|
|
2653
2815
|
timeTaken,
|
|
2654
|
-
inputs,
|
|
2655
|
-
|
|
2816
|
+
inputs: recordInputs,
|
|
2817
|
+
inputsTruncated: boundedInputs.truncated,
|
|
2818
|
+
response: boundedResponse.value,
|
|
2819
|
+
responseTruncated: boundedResponse.truncated,
|
|
2656
2820
|
error,
|
|
2657
2821
|
loading: false,
|
|
2658
2822
|
isTestRun,
|
|
2659
|
-
stepLogs
|
|
2823
|
+
stepLogs: boundedStepLogs.stepLogs,
|
|
2824
|
+
stepLogsTruncated: boundedStepLogs.truncated
|
|
2660
2825
|
});
|
|
2661
2826
|
return {
|
|
2662
2827
|
parsedResult,
|
|
@@ -2754,6 +2919,17 @@ var ApiManager = class {
|
|
|
2754
2919
|
if (discoveryMs > 50) console.warn(`[api-store] awaitDiscovery blocked executeSdkApiV3(${apiName}) for ${String(discoveryMs)}ms`);
|
|
2755
2920
|
entryPoint = this.rootStore.getApiEntryPoint(apiName);
|
|
2756
2921
|
}
|
|
2922
|
+
if (!entryPoint && this.rootStore.sdkApiEnabled) try {
|
|
2923
|
+
const rediscoveryT0 = performance.now();
|
|
2924
|
+
const { discoverAndRegisterSdkApis } = await import("./sdk-api-discovery-ekr6aG8h.js").then((n) => n.n);
|
|
2925
|
+
await discoverAndRegisterSdkApis();
|
|
2926
|
+
const rediscoveryMs = Math.round(performance.now() - rediscoveryT0);
|
|
2927
|
+
discoveryMs += rediscoveryMs;
|
|
2928
|
+
if (rediscoveryMs > 50) console.warn(`[api-store] rediscovery blocked executeSdkApiV3(${apiName}) for ${String(rediscoveryMs)}ms`);
|
|
2929
|
+
entryPoint = this.rootStore.getApiEntryPoint(apiName);
|
|
2930
|
+
} catch (error) {
|
|
2931
|
+
console.error(`[api-store] rediscovery failed for executeSdkApiV3(${apiName}):`, error);
|
|
2932
|
+
}
|
|
2757
2933
|
if (!entryPoint) return {
|
|
2758
2934
|
success: false,
|
|
2759
2935
|
error: {
|
|
@@ -3659,632 +3835,6 @@ var RootStore = class {
|
|
|
3659
3835
|
};
|
|
3660
3836
|
var root_store_default = new RootStore();
|
|
3661
3837
|
//#endregion
|
|
3662
|
-
|
|
3663
|
-
var _path$1, _path2, _path3, _path4, _path5, _path6, _path7, _defs;
|
|
3664
|
-
function _extends$1() {
|
|
3665
|
-
return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
|
|
3666
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
3667
|
-
var t = arguments[e];
|
|
3668
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
3669
|
-
}
|
|
3670
|
-
return n;
|
|
3671
|
-
}, _extends$1.apply(null, arguments);
|
|
3672
|
-
}
|
|
3673
|
-
var SvgClark = function SvgClark(props) {
|
|
3674
|
-
return /* @__PURE__ */ React$1.createElement("svg", _extends$1({
|
|
3675
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3676
|
-
width: 28,
|
|
3677
|
-
height: 20,
|
|
3678
|
-
fill: "none"
|
|
3679
|
-
}, props), _path$1 || (_path$1 = /* @__PURE__ */ React$1.createElement("path", {
|
|
3680
|
-
fill: "url(#clark_svg__a)",
|
|
3681
|
-
d: "M20.41 1.239a5.16 5.16 0 0 0-4.703 5.413l2.648-.232a2.227 2.227 0 1 1 2.886 2.49l.18 2.062.035.02c.575-.05 1.213-.454 1.57-.748 1.617-1.337 1.71-3.2 1.705-3.672 0-.063.047-.117.11-.123l.27-.024a.18.18 0 0 0 .167-.206c-.068-.444-.304-1.577-1.018-2.419-.064-.074-.019-.194.079-.203l.402-.035c.142-.012.218-.166.13-.28-.492-.64-1.994-2.26-4.46-2.043"
|
|
3682
|
-
})), _path2 || (_path2 = /* @__PURE__ */ React$1.createElement("path", {
|
|
3683
|
-
fill: "#2A333D",
|
|
3684
|
-
d: "M18.333 6.987a2.226 2.226 0 0 0 2.411 2.024l.555-.048c-.612-2.74-1.987-3.551-1.987-3.551.153-.386 1.044-.836 1.044-.836a2.226 2.226 0 0 0-2.023 2.411",
|
|
3685
|
-
opacity: .12
|
|
3686
|
-
})), _path3 || (_path3 = /* @__PURE__ */ React$1.createElement("path", {
|
|
3687
|
-
fill: "url(#clark_svg__b)",
|
|
3688
|
-
d: "m6.65 12.564.045.492-.228-2.607A2.338 2.338 0 1 1 8.58 6.587l2.588-.226a5.16 5.16 0 0 0-5.371-3.584c-2.467.216-3.665 2.072-4.039 2.787-.066.127.035.266.177.253l.403-.035c.097-.008.162.102.113.186-.558.953-.593 2.11-.583 2.56a.18.18 0 0 0 .2.173l.27-.023a.12.12 0 0 1 .13.101c.078.467.492 2.285 2.317 3.32.402.228 1.291.515 1.866.465"
|
|
3689
|
-
})), _path4 || (_path4 = /* @__PURE__ */ React$1.createElement("path", {
|
|
3690
|
-
fill: "#2A333D",
|
|
3691
|
-
d: "M9.161 7.938a2.337 2.337 0 0 1-2.124 2.53l-.582.052c.133-2.944 1.406-4.032 1.406-4.032-.227-.371-1.231-.675-1.231-.675A2.337 2.337 0 0 1 9.16 7.938",
|
|
3692
|
-
opacity: .12
|
|
3693
|
-
})), _path5 || (_path5 = /* @__PURE__ */ React$1.createElement("path", {
|
|
3694
|
-
fill: "currentColor",
|
|
3695
|
-
fillRule: "evenodd",
|
|
3696
|
-
d: "M21.72 10.543c-.461-3.366-2.697-6.01-6.685-6.252-.109-.006-.163-.01-.202-.031a.2.2 0 0 1-.078-.084c-.02-.04-.02-.092-.02-.197v-.572a.192.192 0 0 0-.308-.153l-.938.708a.192.192 0 0 1-.309-.154v-.361a.192.192 0 0 0-.318-.145l-.807.717a9 9 0 0 1-.5.431 2 2 0 0 1-.305.2c-.119.069-.414.205-1.004.477-2.794 1.29-4.104 3.885-3.852 6.757.43 4.911 3.404 6.652 8.266 6.226 4.215-.368 7.758-2.469 7.06-7.567M11.64 10.2c.142.62-.16 1.221-.678 1.34-.518.12-1.053-.286-1.197-.907a1.3 1.3 0 0 1-.018-.521.384.384 0 1 0 .376-.667.8.8 0 0 1 .32-.153c.517-.12 1.053.287 1.196.908m7.042-.148c.51-.146.782-.761.606-1.374-.176-.612-.732-.99-1.242-.844a.83.83 0 0 0-.375.23.384.384 0 1 1-.284.713q-.01.211.052.431c.176.613.732.99 1.243.844m-5.448 3.596-.253-2.896a2.08 2.08 0 0 1 4.092-.685l.704 2.82a2.31 2.31 0 1 1-4.543.761",
|
|
3697
|
-
clipRule: "evenodd"
|
|
3698
|
-
})), _path6 || (_path6 = /* @__PURE__ */ React$1.createElement("path", {
|
|
3699
|
-
fill: "url(#clark_svg__c)",
|
|
3700
|
-
d: "M13.88 14.096a2.3 2.3 0 0 0 1.847.492 2.3 2.3 0 0 0 1.585-1.066 1.79 1.79 0 0 1-3.431.574",
|
|
3701
|
-
opacity: .5
|
|
3702
|
-
})), _path7 || (_path7 = /* @__PURE__ */ React$1.createElement("path", {
|
|
3703
|
-
fill: "url(#clark_svg__d)",
|
|
3704
|
-
d: "M13.191 13.144a2.312 2.312 0 0 0 4.465-.748l.123.491a2.31 2.31 0 1 1-4.544.761z",
|
|
3705
|
-
opacity: .5
|
|
3706
|
-
})), _defs || (_defs = /* @__PURE__ */ React$1.createElement("defs", null, /* @__PURE__ */ React$1.createElement("linearGradient", {
|
|
3707
|
-
id: "clark_svg__a",
|
|
3708
|
-
x1: 21.636,
|
|
3709
|
-
x2: 17.027,
|
|
3710
|
-
y1: 4.149,
|
|
3711
|
-
y2: 8.785,
|
|
3712
|
-
gradientUnits: "userSpaceOnUse"
|
|
3713
|
-
}, /* @__PURE__ */ React$1.createElement("stop", { stopColor: "currentColor" }), /* @__PURE__ */ React$1.createElement("stop", {
|
|
3714
|
-
offset: 1,
|
|
3715
|
-
stopColor: "currentColor",
|
|
3716
|
-
stopOpacity: .84
|
|
3717
|
-
})), /* @__PURE__ */ React$1.createElement("linearGradient", {
|
|
3718
|
-
id: "clark_svg__b",
|
|
3719
|
-
x1: 4.534,
|
|
3720
|
-
x2: 10.643,
|
|
3721
|
-
y1: 6.603,
|
|
3722
|
-
y2: 9.712,
|
|
3723
|
-
gradientUnits: "userSpaceOnUse"
|
|
3724
|
-
}, /* @__PURE__ */ React$1.createElement("stop", { stopColor: "currentColor" }), /* @__PURE__ */ React$1.createElement("stop", {
|
|
3725
|
-
offset: 1,
|
|
3726
|
-
stopColor: "currentColor",
|
|
3727
|
-
stopOpacity: .84
|
|
3728
|
-
})), /* @__PURE__ */ React$1.createElement("linearGradient", {
|
|
3729
|
-
id: "clark_svg__c",
|
|
3730
|
-
x1: 15.788,
|
|
3731
|
-
x2: 16.004,
|
|
3732
|
-
y1: 13.866,
|
|
3733
|
-
y2: 15.093,
|
|
3734
|
-
gradientUnits: "userSpaceOnUse"
|
|
3735
|
-
}, /* @__PURE__ */ React$1.createElement("stop", {
|
|
3736
|
-
stopColor: "currentColor",
|
|
3737
|
-
stopOpacity: .6
|
|
3738
|
-
}), /* @__PURE__ */ React$1.createElement("stop", {
|
|
3739
|
-
offset: 1,
|
|
3740
|
-
stopColor: "currentColor"
|
|
3741
|
-
})), /* @__PURE__ */ React$1.createElement("linearGradient", {
|
|
3742
|
-
id: "clark_svg__d",
|
|
3743
|
-
x1: 15.704,
|
|
3744
|
-
x2: 16.07,
|
|
3745
|
-
y1: 13.597,
|
|
3746
|
-
y2: 15.67,
|
|
3747
|
-
gradientUnits: "userSpaceOnUse"
|
|
3748
|
-
}, /* @__PURE__ */ React$1.createElement("stop", {
|
|
3749
|
-
stopColor: "currentColor",
|
|
3750
|
-
stopOpacity: .6
|
|
3751
|
-
}), /* @__PURE__ */ React$1.createElement("stop", {
|
|
3752
|
-
offset: 1,
|
|
3753
|
-
stopColor: "currentColor"
|
|
3754
|
-
})))));
|
|
3755
|
-
};
|
|
3756
|
-
//#endregion
|
|
3757
|
-
//#region src/lib/internal-details/internal-components/common.ts
|
|
3758
|
-
const ErrorIconContainer = styled.div`
|
|
3759
|
-
width: 60px;
|
|
3760
|
-
height: 60px;
|
|
3761
|
-
min-width: 60px;
|
|
3762
|
-
min-height: 60px;
|
|
3763
|
-
background: linear-gradient(135deg, #aab 0%, #000033 50%, #000066 100%);
|
|
3764
|
-
border-radius: 16px;
|
|
3765
|
-
display: flex;
|
|
3766
|
-
align-items: center;
|
|
3767
|
-
justify-content: center;
|
|
3768
|
-
margin: 0 auto 16px;
|
|
3769
|
-
flex-shrink: 0;
|
|
3770
|
-
animation: scaleIn 0.3s ease-out forwards;
|
|
3771
|
-
opacity: 0;
|
|
3772
|
-
box-shadow:
|
|
3773
|
-
0 0 1px black,
|
|
3774
|
-
0 4px 12px rgba(0, 85, 187, 0.15),
|
|
3775
|
-
0 2px 4px rgba(0, 85, 187, 0.05);
|
|
3776
|
-
|
|
3777
|
-
@keyframes scaleIn {
|
|
3778
|
-
from {
|
|
3779
|
-
transform: scale(0.8);
|
|
3780
|
-
opacity: 0;
|
|
3781
|
-
}
|
|
3782
|
-
to {
|
|
3783
|
-
transform: scale(1);
|
|
3784
|
-
opacity: 1;
|
|
3785
|
-
}
|
|
3786
|
-
}
|
|
3787
|
-
`;
|
|
3788
|
-
const StyledClarkIcon = styled(SvgClark)`
|
|
3789
|
-
width: 54px;
|
|
3790
|
-
height: 54px;
|
|
3791
|
-
color: white;
|
|
3792
|
-
margin-top: 3px;
|
|
3793
|
-
margin-left: 1px;
|
|
3794
|
-
animation: scaleIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
|
|
3795
|
-
opacity: 0;
|
|
3796
|
-
|
|
3797
|
-
@keyframes scaleIn {
|
|
3798
|
-
0% {
|
|
3799
|
-
transform: scale(0.6);
|
|
3800
|
-
opacity: 0;
|
|
3801
|
-
}
|
|
3802
|
-
50% {
|
|
3803
|
-
transform: scale(1.1);
|
|
3804
|
-
}
|
|
3805
|
-
100% {
|
|
3806
|
-
transform: scale(1);
|
|
3807
|
-
opacity: 1;
|
|
3808
|
-
}
|
|
3809
|
-
}
|
|
3810
|
-
`;
|
|
3811
|
-
const ErrorTitle = styled.h2`
|
|
3812
|
-
font-family: Inter;
|
|
3813
|
-
color: rgba(0, 0, 0, 0.85);
|
|
3814
|
-
font-weight: 600;
|
|
3815
|
-
font-size: 24px;
|
|
3816
|
-
line-height: 1.35;
|
|
3817
|
-
text-align: center;
|
|
3818
|
-
margin-bottom: 6px;
|
|
3819
|
-
flex-shrink: 0;
|
|
3820
|
-
`;
|
|
3821
|
-
const ErrorMessage = styled.p`
|
|
3822
|
-
font-family: Inter;
|
|
3823
|
-
font-size: 14px;
|
|
3824
|
-
color: #6c7689;
|
|
3825
|
-
line-height: 1.5715;
|
|
3826
|
-
text-align: center;
|
|
3827
|
-
flex-shrink: 0;
|
|
3828
|
-
margin-top: 0;
|
|
3829
|
-
margin-bottom: 16px;
|
|
3830
|
-
`;
|
|
3831
|
-
const ErrorDetails = styled.details`
|
|
3832
|
-
margin-top: 24px;
|
|
3833
|
-
text-align: left;
|
|
3834
|
-
background-color: #f9fafb;
|
|
3835
|
-
border-radius: 6px;
|
|
3836
|
-
padding: 16px;
|
|
3837
|
-
box-shadow:
|
|
3838
|
-
0px 0px 1px 0px #22272f52,
|
|
3839
|
-
0px 1px 3px 0px #22272f1f;
|
|
3840
|
-
flex-shrink: 0;
|
|
3841
|
-
font-family: Inter;
|
|
3842
|
-
|
|
3843
|
-
&[open] summary {
|
|
3844
|
-
margin-bottom: 12px;
|
|
3845
|
-
}
|
|
3846
|
-
`;
|
|
3847
|
-
const ErrorSummary = styled.summary`
|
|
3848
|
-
cursor: pointer;
|
|
3849
|
-
font-weight: 500;
|
|
3850
|
-
color: #374151;
|
|
3851
|
-
font-size: 14px;
|
|
3852
|
-
user-select: none;
|
|
3853
|
-
`;
|
|
3854
|
-
const ErrorStack = styled.pre`
|
|
3855
|
-
font-size: 12px;
|
|
3856
|
-
color: #dc2626;
|
|
3857
|
-
overflow: auto;
|
|
3858
|
-
white-space: pre-wrap;
|
|
3859
|
-
margin: 16px;
|
|
3860
|
-
font-family: monospace;
|
|
3861
|
-
`;
|
|
3862
|
-
const ErrorContainer = styled.div`
|
|
3863
|
-
position: absolute;
|
|
3864
|
-
inset: 0;
|
|
3865
|
-
display: flex;
|
|
3866
|
-
align-items: center;
|
|
3867
|
-
justify-content: center;
|
|
3868
|
-
z-index: 10;
|
|
3869
|
-
background: rgba(255, 255, 255, 0.5);
|
|
3870
|
-
pointer-events: auto;
|
|
3871
|
-
`;
|
|
3872
|
-
const ErrorContent = styled.div`
|
|
3873
|
-
max-width: 700px;
|
|
3874
|
-
padding: 40px;
|
|
3875
|
-
overflow-y: auto;
|
|
3876
|
-
flex: 1;
|
|
3877
|
-
display: flex;
|
|
3878
|
-
flex-direction: column;
|
|
3879
|
-
gap: 20px;
|
|
3880
|
-
|
|
3881
|
-
opacity: 0;
|
|
3882
|
-
animation: fadeIn 0.3s ease-out forwards;
|
|
3883
|
-
|
|
3884
|
-
@keyframes fadeIn {
|
|
3885
|
-
from {
|
|
3886
|
-
opacity: 0;
|
|
3887
|
-
}
|
|
3888
|
-
to {
|
|
3889
|
-
opacity: 1;
|
|
3890
|
-
}
|
|
3891
|
-
}
|
|
3892
|
-
`;
|
|
3893
|
-
const SecondaryButton = styled.button`
|
|
3894
|
-
color: ${colors.GREY_700};
|
|
3895
|
-
border: 1px solid ${colors.GREY_100};
|
|
3896
|
-
width: fit-content;
|
|
3897
|
-
border-radius: 4px;
|
|
3898
|
-
padding: 6px 12px;
|
|
3899
|
-
cursor: pointer;
|
|
3900
|
-
height: fit-content;
|
|
3901
|
-
font-size: 12px;
|
|
3902
|
-
|
|
3903
|
-
&:hover {
|
|
3904
|
-
opacity: 0.8;
|
|
3905
|
-
}
|
|
3906
|
-
|
|
3907
|
-
&:active {
|
|
3908
|
-
opacity: 0.6;
|
|
3909
|
-
}
|
|
3910
|
-
`;
|
|
3911
|
-
const ActionsContainer = styled.div`
|
|
3912
|
-
display: flex;
|
|
3913
|
-
gap: 12px;
|
|
3914
|
-
align-items: center;
|
|
3915
|
-
justify-content: center;
|
|
3916
|
-
`;
|
|
3917
|
-
//#endregion
|
|
3918
|
-
//#region src/edit-mode/assets/ai-stars.svg
|
|
3919
|
-
var _path;
|
|
3920
|
-
function _extends() {
|
|
3921
|
-
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
3922
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
3923
|
-
var t = arguments[e];
|
|
3924
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
3925
|
-
}
|
|
3926
|
-
return n;
|
|
3927
|
-
}, _extends.apply(null, arguments);
|
|
3928
|
-
}
|
|
3929
|
-
var SvgAiStars = function SvgAiStars(props) {
|
|
3930
|
-
return /* @__PURE__ */ React$1.createElement("svg", _extends({
|
|
3931
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3932
|
-
width: 13,
|
|
3933
|
-
height: 14,
|
|
3934
|
-
fill: "none"
|
|
3935
|
-
}, props), _path || (_path = /* @__PURE__ */ React$1.createElement("path", {
|
|
3936
|
-
fill: "currentColor",
|
|
3937
|
-
fillRule: "evenodd",
|
|
3938
|
-
d: "M10.5.9a.6.6 0 0 1 .586.472l.133.605a.4.4 0 0 0 .305.305l.605.132a.6.6 0 0 1 0 1.172l-.605.133a.4.4 0 0 0-.305.305l-.133.605a.6.6 0 0 1-1.172 0l-.132-.605a.4.4 0 0 0-.305-.305l-.605-.133a.6.6 0 0 1 0-1.172l.605-.132a.4.4 0 0 0 .305-.305l.132-.605A.6.6 0 0 1 10.5.9M5.077 3.833a.6.6 0 0 0-1.153 0l-.215.74A2.4 2.4 0 0 1 2.074 6.21l-.741.215a.6.6 0 0 0 0 1.153l.74.215A2.4 2.4 0 0 1 3.71 9.427l.215.74a.6.6 0 0 0 1.153 0l.215-.74a2.4 2.4 0 0 1 1.635-1.635l.74-.215a.6.6 0 0 0 0-1.153l-.74-.215a2.4 2.4 0 0 1-1.635-1.635zm6.01 5.539a.6.6 0 0 0-1.173 0l-.132.605a.4.4 0 0 1-.305.305l-.605.133a.6.6 0 0 0 0 1.172l.605.132a.4.4 0 0 1 .305.305l.132.605a.6.6 0 0 0 1.172 0l.133-.605a.4.4 0 0 1 .305-.305l.605-.132a.6.6 0 0 0 0-1.172l-.605-.133a.4.4 0 0 1-.305-.305z",
|
|
3939
|
-
clipRule: "evenodd"
|
|
3940
|
-
})));
|
|
3941
|
-
};
|
|
3942
|
-
//#endregion
|
|
3943
|
-
//#region src/lib/internal-details/internal-components/fix-with-clark-button.tsx
|
|
3944
|
-
const MAX_STACK_FRAMES = 10;
|
|
3945
|
-
const MAX_PROMPT_LENGTH = 8e3;
|
|
3946
|
-
function buildRuntimeErrorPrompt(error) {
|
|
3947
|
-
const defaultPrompt = "Fix this error: Unknown error";
|
|
3948
|
-
if (!error) return defaultPrompt;
|
|
3949
|
-
const [messageLine, ...rawFrames] = error.stack?.split("\n") ?? [];
|
|
3950
|
-
const message = (messageLine || error.message || error.toString()).trim();
|
|
3951
|
-
const filteredFrames = rawFrames.filter((line) => line && !line.includes("node_modules"));
|
|
3952
|
-
const selectedFrames = filteredFrames.slice(0, MAX_STACK_FRAMES);
|
|
3953
|
-
const omittedCount = filteredFrames.length - selectedFrames.length;
|
|
3954
|
-
const frameSection = [...selectedFrames, ...omittedCount > 0 ? [`... (${omittedCount} additional frame${omittedCount > 1 ? "s" : ""} omitted)`] : []].map((line) => line.trimEnd()).join("\n");
|
|
3955
|
-
const prompt = `Fix this error: ${frameSection ? `${message}\n${frameSection}` : message}`;
|
|
3956
|
-
if (prompt.length <= MAX_PROMPT_LENGTH) return prompt;
|
|
3957
|
-
const suffix = "... (truncated)";
|
|
3958
|
-
const availableChars = Math.max(MAX_PROMPT_LENGTH - 15, 0);
|
|
3959
|
-
return `${prompt.slice(0, availableChars)}${suffix}`;
|
|
3960
|
-
}
|
|
3961
|
-
const FixWithClarkButtonContainer = styled.button`
|
|
3962
|
-
padding: 6px 12px;
|
|
3963
|
-
background-color: ${colors.ACCENT_BLUE_500};
|
|
3964
|
-
border-radius: 4px;
|
|
3965
|
-
border: none;
|
|
3966
|
-
color: white;
|
|
3967
|
-
height: fit-content;
|
|
3968
|
-
display: flex;
|
|
3969
|
-
gap: 4px;
|
|
3970
|
-
cursor: pointer;
|
|
3971
|
-
transition: opacity 0.2s;
|
|
3972
|
-
font-size: 12px;
|
|
3973
|
-
align-items: center;
|
|
3974
|
-
|
|
3975
|
-
&:hover:not(:disabled) {
|
|
3976
|
-
opacity: 0.8;
|
|
3977
|
-
}
|
|
3978
|
-
|
|
3979
|
-
&:disabled {
|
|
3980
|
-
opacity: 0.5;
|
|
3981
|
-
cursor: not-allowed;
|
|
3982
|
-
}
|
|
3983
|
-
`;
|
|
3984
|
-
function FixWithClarkButton({ identifier, error, onClick }) {
|
|
3985
|
-
const isAiEditing = root_store_default.editStore?.ai.getIsEditing() ?? false;
|
|
3986
|
-
const handleFixWithAi = () => {
|
|
3987
|
-
onClick?.();
|
|
3988
|
-
if (identifier) editorBridge.addComponentToAiContext(identifier.sourceId, identifier.selectorId);
|
|
3989
|
-
const prompt = buildRuntimeErrorPrompt(error);
|
|
3990
|
-
editorBridge.aiGenerate(prompt, true);
|
|
3991
|
-
};
|
|
3992
|
-
return /* @__PURE__ */ jsxs(FixWithClarkButtonContainer, {
|
|
3993
|
-
onClick: handleFixWithAi,
|
|
3994
|
-
disabled: isAiEditing,
|
|
3995
|
-
children: [/* @__PURE__ */ jsx(SvgAiStars, {}), " Fix with Clark"]
|
|
3996
|
-
});
|
|
3997
|
-
}
|
|
3998
|
-
//#endregion
|
|
3999
|
-
//#region src/lib/internal-details/css-constants.ts
|
|
4000
|
-
const CSS_CLASSES = {
|
|
4001
|
-
SUSPENSE_FALLBACK: "sb-suspense-fallback",
|
|
4002
|
-
ANCHOR_NAME: "sb-anchor-name"
|
|
4003
|
-
};
|
|
4004
|
-
//#endregion
|
|
4005
|
-
//#region src/lib/internal-details/lib/suspense/suspense-fallback.tsx
|
|
4006
|
-
const shimmerAnimation = keyframes`
|
|
4007
|
-
0% {
|
|
4008
|
-
background-position: -200px 0;
|
|
4009
|
-
}
|
|
4010
|
-
100% {
|
|
4011
|
-
background-position: calc(200px + 100%) 0;
|
|
4012
|
-
}
|
|
4013
|
-
`;
|
|
4014
|
-
const ShimmerDiv = styled.div`
|
|
4015
|
-
min-height: 12px;
|
|
4016
|
-
min-width: 12px;
|
|
4017
|
-
background-color: ${(props) => props.$backgroundColor};
|
|
4018
|
-
border-radius: ${(props) => props.$borderRadius};
|
|
4019
|
-
position: relative;
|
|
4020
|
-
overflow: hidden;
|
|
4021
|
-
background: linear-gradient(
|
|
4022
|
-
90deg,
|
|
4023
|
-
${(props) => props.$backgroundColor} 25%,
|
|
4024
|
-
${(props) => props.$shimmerHighlight} 50%,
|
|
4025
|
-
${(props) => props.$backgroundColor} 75%
|
|
4026
|
-
);
|
|
4027
|
-
background-size: max(100%, 200px) 100%;
|
|
4028
|
-
animation: ${shimmerAnimation} 5s infinite linear;
|
|
4029
|
-
`;
|
|
4030
|
-
/**
|
|
4031
|
-
* Default fallback component displayed while components are suspended.
|
|
4032
|
-
*/
|
|
4033
|
-
function SuspenseFallback({ style, className, noBorderRadius }) {
|
|
4034
|
-
const backgroundColor = "#f8f9fa";
|
|
4035
|
-
const shimmerHighlight = "#ffffff";
|
|
4036
|
-
const borderRadius = noBorderRadius ? "0px" : "4px";
|
|
4037
|
-
const classes = useMemo(() => [CSS_CLASSES.ANCHOR_NAME, className].filter(Boolean).join(" "), [className]);
|
|
4038
|
-
return /* @__PURE__ */ jsx(ShimmerDiv, {
|
|
4039
|
-
$backgroundColor: backgroundColor,
|
|
4040
|
-
$shimmerHighlight: shimmerHighlight,
|
|
4041
|
-
$borderRadius: borderRadius,
|
|
4042
|
-
style: style?.(),
|
|
4043
|
-
className: classes,
|
|
4044
|
-
"data-test": "suspense-fallback"
|
|
4045
|
-
});
|
|
4046
|
-
}
|
|
4047
|
-
//#endregion
|
|
4048
|
-
//#region src/lib/user-facing/component-base/error-boundary.tsx
|
|
4049
|
-
const ErrorBoundaryContainer = styled.div`
|
|
4050
|
-
background: white;
|
|
4051
|
-
padding: 10px;
|
|
4052
|
-
display: flex;
|
|
4053
|
-
flex-direction: column;
|
|
4054
|
-
gap: 8px;
|
|
4055
|
-
border: 1px solid ${colors.GREY_100};
|
|
4056
|
-
border-left: 3px solid ${colors.RED_500};
|
|
4057
|
-
border-radius: 4px;
|
|
4058
|
-
width: 100%;
|
|
4059
|
-
color: ${colors.GREY_700};
|
|
4060
|
-
`;
|
|
4061
|
-
const ErrorDetailsContainer = styled.div`
|
|
4062
|
-
display: flex;
|
|
4063
|
-
flex-direction: column;
|
|
4064
|
-
gap: 8px;
|
|
4065
|
-
`;
|
|
4066
|
-
const ErrorActionsContainer = styled.div`
|
|
4067
|
-
display: flex;
|
|
4068
|
-
justify-content: flex-end;
|
|
4069
|
-
align-items: center;
|
|
4070
|
-
gap: 8px;
|
|
4071
|
-
`;
|
|
4072
|
-
var ErrorBoundary = class extends Component {
|
|
4073
|
-
state = {
|
|
4074
|
-
id: generateId(),
|
|
4075
|
-
hasError: false
|
|
4076
|
-
};
|
|
4077
|
-
disposeAutoReset;
|
|
4078
|
-
static getDerivedStateFromError(e) {
|
|
4079
|
-
const error = e instanceof Error ? e : new Error(typeof e === "object" && e !== null ? JSON.stringify(e) : String(e));
|
|
4080
|
-
return {
|
|
4081
|
-
id: generateId(),
|
|
4082
|
-
hasError: true,
|
|
4083
|
-
error
|
|
4084
|
-
};
|
|
4085
|
-
}
|
|
4086
|
-
componentDidCatch(error, errorInfo) {
|
|
4087
|
-
if (isEditMode()) root_store_default.editStore?.ai.handleRuntimeError({
|
|
4088
|
-
id: this.state.id,
|
|
4089
|
-
error: String(error),
|
|
4090
|
-
errorInfo,
|
|
4091
|
-
identifier: this.props.identifier
|
|
4092
|
-
});
|
|
4093
|
-
}
|
|
4094
|
-
reset = () => {
|
|
4095
|
-
if (isEditMode()) root_store_default.editStore?.ai.clearRuntimeError(this.state.id);
|
|
4096
|
-
this.setState({
|
|
4097
|
-
hasError: false,
|
|
4098
|
-
error: void 0
|
|
4099
|
-
});
|
|
4100
|
-
};
|
|
4101
|
-
componentWillUnmount() {
|
|
4102
|
-
if (this.state.hasError && isEditMode()) root_store_default.editStore?.ai.clearRuntimeError(this.state.id);
|
|
4103
|
-
this.disposeAutoReset?.();
|
|
4104
|
-
}
|
|
4105
|
-
handleFixWithClarkInitiated = () => {
|
|
4106
|
-
const ai = root_store_default.editStore?.ai;
|
|
4107
|
-
if (!ai) return;
|
|
4108
|
-
this.disposeAutoReset?.();
|
|
4109
|
-
this.disposeAutoReset = void 0;
|
|
4110
|
-
let sawStart = ai.getIsEditing();
|
|
4111
|
-
this.disposeAutoReset = reaction(() => ai.getIsEditing(), (isEditing) => {
|
|
4112
|
-
if (!sawStart && isEditing) sawStart = true;
|
|
4113
|
-
if (sawStart && !isEditing) {
|
|
4114
|
-
this.reset();
|
|
4115
|
-
this.disposeAutoReset?.();
|
|
4116
|
-
this.disposeAutoReset = void 0;
|
|
4117
|
-
}
|
|
4118
|
-
}, {
|
|
4119
|
-
fireImmediately: true,
|
|
4120
|
-
name: "error-boundary-ai-auto-reset"
|
|
4121
|
-
});
|
|
4122
|
-
};
|
|
4123
|
-
handleFixWithAi() {
|
|
4124
|
-
const { identifier } = this.props;
|
|
4125
|
-
if (identifier) editorBridge.addComponentToAiContext(identifier.sourceId, identifier.selectorId);
|
|
4126
|
-
let prompt = `Fix this error: `;
|
|
4127
|
-
if (this.state.error?.stack) {
|
|
4128
|
-
const lines = this.state.error.stack.split("\n");
|
|
4129
|
-
const nodeModulesIndex = lines.findIndex((line) => line.includes("node_modules"));
|
|
4130
|
-
const relevantLines = nodeModulesIndex > -1 ? lines.slice(0, nodeModulesIndex) : lines;
|
|
4131
|
-
prompt += relevantLines.slice(0, 5).join("\n");
|
|
4132
|
-
} else prompt += this.state.error?.toString();
|
|
4133
|
-
editorBridge.aiGenerate(prompt);
|
|
4134
|
-
}
|
|
4135
|
-
render() {
|
|
4136
|
-
if (this.state.hasError) return /* @__PURE__ */ jsx(Observer, { children: () => {
|
|
4137
|
-
if (root_store_default.editStore?.ai.getIsEditing() ?? false) return /* @__PURE__ */ jsx(SuspenseFallback, {});
|
|
4138
|
-
return /* @__PURE__ */ jsxs(ErrorBoundaryContainer, { children: [/* @__PURE__ */ jsxs(ErrorDetailsContainer, {
|
|
4139
|
-
"data-testid": "runtime-error-details",
|
|
4140
|
-
children: [/* @__PURE__ */ jsx("h3", { children: this.props.header || "Something went wrong." }), /* @__PURE__ */ jsxs("details", {
|
|
4141
|
-
style: { fontSize: "0.8em" },
|
|
4142
|
-
children: [/* @__PURE__ */ jsx("summary", {
|
|
4143
|
-
style: { paddingLeft: "0.25rem" },
|
|
4144
|
-
children: "Error details"
|
|
4145
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
4146
|
-
style: {
|
|
4147
|
-
marginTop: "0.5rem",
|
|
4148
|
-
maxWidth: "100%",
|
|
4149
|
-
overflowX: "auto",
|
|
4150
|
-
scrollbarWidth: "thin"
|
|
4151
|
-
},
|
|
4152
|
-
children: /* @__PURE__ */ jsx("pre", {
|
|
4153
|
-
style: { color: "gray" },
|
|
4154
|
-
children: /* @__PURE__ */ jsx("code", { children: this.state.error?.stack ? this.state.error.stack : this.state.error?.toString() })
|
|
4155
|
-
})
|
|
4156
|
-
})]
|
|
4157
|
-
})]
|
|
4158
|
-
}), /* @__PURE__ */ jsxs(ErrorActionsContainer, { children: [isEditMode() && /* @__PURE__ */ jsx(FixWithClarkButton, {
|
|
4159
|
-
onClick: this.handleFixWithClarkInitiated,
|
|
4160
|
-
error: this.state.error,
|
|
4161
|
-
identifier: this.props.identifier
|
|
4162
|
-
}), /* @__PURE__ */ jsx(SecondaryButton, {
|
|
4163
|
-
onClick: this.reset,
|
|
4164
|
-
children: "Try again"
|
|
4165
|
-
})] })] });
|
|
4166
|
-
} });
|
|
4167
|
-
return this.props.children;
|
|
4168
|
-
}
|
|
4169
|
-
};
|
|
4170
|
-
//#endregion
|
|
4171
|
-
//#region src/lib/utils/widget-wrapper-naming.ts
|
|
4172
|
-
const getWidgetAnchorName = (selectorId) => {
|
|
4173
|
-
return `--widget-${selectorId}`;
|
|
4174
|
-
};
|
|
4175
|
-
const getWidgetRectAnchorName = (selectorId) => {
|
|
4176
|
-
return `--widget-rect-${selectorId}`;
|
|
4177
|
-
};
|
|
4178
|
-
//#endregion
|
|
4179
|
-
//#region src/edit-mode/edit-wrapper.tsx
|
|
4180
|
-
if (typeof window !== "undefined" && typeof document.documentElement !== "undefined" && !("anchorName" in document.documentElement.style)) polyfill();
|
|
4181
|
-
const createAnchorNameStyle = (props) => {
|
|
4182
|
-
return { "--anchor-name": getWidgetAnchorName(props.selectorId) };
|
|
4183
|
-
};
|
|
4184
|
-
//#endregion
|
|
4185
|
-
//#region src/edit-mode/instance-tracker.ts
|
|
4186
|
-
/**
|
|
4187
|
-
* Tracks and recycles instance numbers for each sourceId to generate stable, unique selector IDs.
|
|
4188
|
-
* When components unmount, their instance numbers are released and can be reused.
|
|
4189
|
-
*/
|
|
4190
|
-
var InstanceTracker = class {
|
|
4191
|
-
sourceIdToUsedInstances = /* @__PURE__ */ new Map();
|
|
4192
|
-
getNextAvailableInstance(sourceId) {
|
|
4193
|
-
const usedInstances = this.sourceIdToUsedInstances.get(sourceId) ?? /* @__PURE__ */ new Set();
|
|
4194
|
-
let instance = 0;
|
|
4195
|
-
while (usedInstances.has(instance)) instance++;
|
|
4196
|
-
usedInstances.add(instance);
|
|
4197
|
-
this.sourceIdToUsedInstances.set(sourceId, usedInstances);
|
|
4198
|
-
return instance;
|
|
4199
|
-
}
|
|
4200
|
-
releaseInstance(sourceId, instance) {
|
|
4201
|
-
const usedInstances = this.sourceIdToUsedInstances.get(sourceId);
|
|
4202
|
-
if (usedInstances) {
|
|
4203
|
-
usedInstances.delete(instance);
|
|
4204
|
-
if (usedInstances.size === 0) this.sourceIdToUsedInstances.delete(sourceId);
|
|
4205
|
-
}
|
|
4206
|
-
}
|
|
4207
|
-
};
|
|
4208
|
-
const instanceTracker = new InstanceTracker();
|
|
4209
|
-
//#endregion
|
|
4210
|
-
//#region src/edit-mode/jsx-wrapper.tsx
|
|
4211
|
-
const JSXContext = React.createContext({
|
|
4212
|
-
selectorId: "S-<unknown>",
|
|
4213
|
-
sourceId: "SB-<unknown>"
|
|
4214
|
-
});
|
|
4215
|
-
const makeWrappedComponent = (type) => {
|
|
4216
|
-
const isTag = typeof type === "string";
|
|
4217
|
-
const isRegisteredSbComponent = root_store_default.componentRegistry.hasComponent(type);
|
|
4218
|
-
const Component = React.forwardRef((props, ref) => {
|
|
4219
|
-
const { selectorId: parentSelectorId } = useJSXContext();
|
|
4220
|
-
const sourceId = props[SOURCE_ID_ATTRIBUTE];
|
|
4221
|
-
const noSelect = props[NO_SELECT_ATTRIBUTE];
|
|
4222
|
-
const instanceNumberRef = useRef();
|
|
4223
|
-
const selectorId = useRef("S-<unknown>");
|
|
4224
|
-
if (selectorId.current === "S-<unknown>") {
|
|
4225
|
-
instanceNumberRef.current = instanceTracker.getNextAvailableInstance(sourceId);
|
|
4226
|
-
selectorId.current = `S-x-${sourceId}-${instanceNumberRef.current}`;
|
|
4227
|
-
}
|
|
4228
|
-
useEffect(() => {
|
|
4229
|
-
root_store_default.editStore?.runtimeTrackingStore.registerComponent(selectorId.current, {
|
|
4230
|
-
sourceId,
|
|
4231
|
-
type,
|
|
4232
|
-
parentSelectorId,
|
|
4233
|
-
isSbComponent: isRegisteredSbComponent,
|
|
4234
|
-
isHtmlElement: isTag,
|
|
4235
|
-
noSelect
|
|
4236
|
-
});
|
|
4237
|
-
return () => {
|
|
4238
|
-
root_store_default.editStore?.runtimeTrackingStore.unregisterComponent(selectorId.current);
|
|
4239
|
-
if (instanceNumberRef.current !== void 0) instanceTracker.releaseInstance(sourceId, instanceNumberRef.current);
|
|
4240
|
-
};
|
|
4241
|
-
}, []);
|
|
4242
|
-
useEffect(() => {
|
|
4243
|
-
root_store_default.editStore?.runtimeTrackingStore.updatePropsForComponent(selectorId.current, props);
|
|
4244
|
-
}, [props]);
|
|
4245
|
-
const jsxContext = useMemo(() => ({
|
|
4246
|
-
selectorId: selectorId.current,
|
|
4247
|
-
sourceId
|
|
4248
|
-
}), [sourceId]);
|
|
4249
|
-
const selectorProps = { [SELECTOR_ID_ATTRIBUTE]: selectorId.current };
|
|
4250
|
-
if (parentSelectorId) selectorProps["data-sb-parent-selector-id"] = parentSelectorId;
|
|
4251
|
-
const { style: propsStyle, className: propsClassName } = props;
|
|
4252
|
-
const style = useMemo(() => {
|
|
4253
|
-
return {
|
|
4254
|
-
...propsStyle,
|
|
4255
|
-
...createAnchorNameStyle({ selectorId: selectorId.current })
|
|
4256
|
-
};
|
|
4257
|
-
}, [propsStyle]);
|
|
4258
|
-
const className = useMemo(() => {
|
|
4259
|
-
return typeof propsClassName === "function" ? (...args) => ["sb-anchor-name", propsClassName(...args)].filter(Boolean).join(" ") : ["sb-anchor-name", propsClassName].filter(Boolean).join(" ");
|
|
4260
|
-
}, [propsClassName]);
|
|
4261
|
-
const element = React.createElement(type, {
|
|
4262
|
-
ref,
|
|
4263
|
-
...props,
|
|
4264
|
-
...selectorProps,
|
|
4265
|
-
className,
|
|
4266
|
-
style
|
|
4267
|
-
});
|
|
4268
|
-
if (!root_store_default.editStore?.isInitialized) return /* @__PURE__ */ jsx(JSXContext.Provider, {
|
|
4269
|
-
value: jsxContext,
|
|
4270
|
-
children: element
|
|
4271
|
-
});
|
|
4272
|
-
return /* @__PURE__ */ jsx(JSXContext.Provider, {
|
|
4273
|
-
value: jsxContext,
|
|
4274
|
-
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: element })
|
|
4275
|
-
});
|
|
4276
|
-
});
|
|
4277
|
-
try {
|
|
4278
|
-
Component.displayName = typeof type === "string" ? type : type.displayName || type.name || "Component";
|
|
4279
|
-
} catch (e) {
|
|
4280
|
-
console.error("Error setting displayName", e);
|
|
4281
|
-
}
|
|
4282
|
-
return Component;
|
|
4283
|
-
};
|
|
4284
|
-
const useJSXContext = () => {
|
|
4285
|
-
return React.useContext(JSXContext);
|
|
4286
|
-
};
|
|
4287
|
-
//#endregion
|
|
4288
|
-
export { useSuperblocksGroups as A, isEmbeddedBySuperblocksFirstParty as B, addNewPromise as C, getAppMode as D, SuperblocksContextProvider as E, sendNotification as F, PropsCategory as G, isEditMode as H, colors as I, getEditStore as J, Section as K, editorBridge as L, useSuperblocksUser as M, embedStore as N, useSuperblocksContext as O, generateId as P, getParentOrigin as R, tracker as S, resolveById as T, createManagedPropsList as U, sendMessageImmediately as V, Prop as W, ORCHESTRATOR_EXECUTE_RESPONSE_SIZE_LIMIT_FLAG as _, FixWithClarkButton as a, createIframeSpan as b, ErrorContent as c, ErrorMessage as d, ErrorStack as f, StyledClarkIcon as g, SecondaryButton as h, getWidgetRectAnchorName as i, useSuperblocksProfiles as j, useSuperblocksDataTags as k, ErrorDetails as l, ErrorTitle as m, useJSXContext as n, ActionsContainer as o, ErrorSummary as p, createPropertiesPanelDefinition as q, getWidgetAnchorName as r, ErrorContainer as s, makeWrappedComponent as t, ErrorIconContainer as u, root_store_default as v, rejectById as w, getContextFromTraceHeaders as x, startEditorSync as y, iframeMessageHandler as z };
|
|
3838
|
+
export { Section as A, iframeMessageHandler as C, createManagedPropsList as D, isEditMode as E, getEditStore as M, Prop as O, getParentOrigin as S, sendMessageImmediately as T, embedStore as _, getContextFromTraceHeaders as a, colors as b, rejectById as c, getAppMode as d, useSuperblocksContext as f, useSuperblocksUser as g, useSuperblocksProfiles as h, createIframeSpan as i, createPropertiesPanelDefinition as j, PropsCategory as k, resolveById as l, useSuperblocksGroups as m, root_store_default as n, tracker as o, useSuperblocksDataTags as p, startEditorSync as r, addNewPromise as s, ORCHESTRATOR_EXECUTE_RESPONSE_SIZE_LIMIT_FLAG as t, SuperblocksContextProvider as u, generateId as v, isEmbeddedBySuperblocksFirstParty as w, editorBridge as x, sendNotification as y };
|
|
4289
3839
|
|
|
4290
|
-
//# sourceMappingURL=
|
|
3840
|
+
//# sourceMappingURL=root-store-CkTnQd84.js.map
|