@oxy-hq/sdk 2.13.0 → 2.16.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.
- package/README.md +67 -0
- package/dist/{function-context-D8eyZuw_.d.cts → function-context-BNpL5bFb.d.cts} +223 -20
- package/dist/function-context-BNpL5bFb.d.cts.map +1 -0
- package/dist/{function-context-D8eyZuw_.d.mts → function-context-BNpL5bFb.d.mts} +223 -20
- package/dist/function-context-BNpL5bFb.d.mts.map +1 -0
- package/dist/index.cjs +19 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +17 -15
- package/dist/index.mjs.map +1 -1
- package/dist/ops.d.cts +1 -1
- package/dist/ops.d.mts +1 -1
- package/dist/{react-D-Sf973d.d.mts → react-CljeXJuw.d.cts} +56 -7
- package/dist/react-CljeXJuw.d.cts.map +1 -0
- package/dist/{react-D-Sf973d.d.cts → react-CljeXJuw.d.mts} +56 -7
- package/dist/react-CljeXJuw.d.mts.map +1 -0
- package/dist/{react-CkAQg9wB.cjs → react-Dvkv2deI.cjs} +46 -55
- package/dist/react-Dvkv2deI.cjs.map +1 -0
- package/dist/{react-Cq3xULOr.mjs → react-OW1t_J0M.mjs} +39 -22
- package/dist/react-OW1t_J0M.mjs.map +1 -0
- package/dist/rolldown-runtime-KC0qvQup.cjs +34 -0
- package/dist/shell.cjs +4 -3
- package/dist/shell.cjs.map +1 -1
- package/dist/shell.d.cts +2 -2
- package/dist/shell.d.mts +2 -2
- package/dist/shell.mjs +1 -1
- package/dist/testing.cjs +4431 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +656 -0
- package/dist/testing.d.cts.map +1 -0
- package/dist/testing.d.mts +656 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +4395 -0
- package/dist/testing.mjs.map +1 -0
- package/package.json +22 -9
- package/dist/function-context-D8eyZuw_.d.cts.map +0 -1
- package/dist/function-context-D8eyZuw_.d.mts.map +0 -1
- package/dist/react-CkAQg9wB.cjs.map +0 -1
- package/dist/react-Cq3xULOr.mjs.map +0 -1
- package/dist/react-D-Sf973d.d.cts.map +0 -1
- package/dist/react-D-Sf973d.d.mts.map +0 -1
|
@@ -87,6 +87,25 @@ async function apiErrorFromResponse(resp) {
|
|
|
87
87
|
message: snippet || `HTTP ${resp.status}`
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Normalize a rejected request into the `Error` a hook reports.
|
|
92
|
+
*
|
|
93
|
+
* An `AbortError` reaching a hook's `.catch` is by construction an abort the
|
|
94
|
+
* hook did NOT cause — its own teardown is marked separately — so it is a
|
|
95
|
+
* fetcher's request timeout, a dropped socket, or a navigation. The platform's
|
|
96
|
+
* wording for those ("The user aborted a request.") is wrong on its face by
|
|
97
|
+
* the time a bundle renders it, so rephrase and keep the original as `cause`.
|
|
98
|
+
*
|
|
99
|
+
* The name is used only to WORD an error already being reported. Whether to
|
|
100
|
+
* report at all is the caller's teardown flag, never the name — that
|
|
101
|
+
* conflation is what left hooks loading forever.
|
|
102
|
+
*/
|
|
103
|
+
function asReportableError(err) {
|
|
104
|
+
const name = typeof err === "object" && err !== null && "name" in err ? String(err.name) : "";
|
|
105
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
106
|
+
if (name !== "AbortError" && e.name !== "AbortError") return e;
|
|
107
|
+
return Object.assign(/* @__PURE__ */ new Error("request was interrupted (the connection dropped or timed out)"), { cause: e });
|
|
108
|
+
}
|
|
90
109
|
const ARCH_DOC = "internal-docs/customer-apps.md";
|
|
91
110
|
/** Interpret a thrown error as a structured report for UI display. */
|
|
92
111
|
function interpretCustomAppError(err) {
|
|
@@ -299,7 +318,7 @@ const FUNCTION_NAME_RE = /^[a-z][a-z0-9-]{0,63}$/;
|
|
|
299
318
|
*
|
|
300
319
|
* This runs at manifest LOAD (app boot / `pnpm dev`), not at `oxy build` — the
|
|
301
320
|
* build-time gate is the vite plugin's `validateManifest`, which now checks
|
|
302
|
-
* function names too. `
|
|
321
|
+
* function names too. `oxyc publish` also validates them locally before esbuild,
|
|
303
322
|
* so a bad name fails before the upload regardless.
|
|
304
323
|
*/
|
|
305
324
|
function validateFunctions(raw) {
|
|
@@ -338,6 +357,10 @@ function validateFunctions(raw) {
|
|
|
338
357
|
if (typeof t !== "number" || !Number.isInteger(t) || t < 1 || t > 300) throw new Error(`oxy-app.json: function "${fnName}" \`timeoutSeconds\` must be an integer in [1, 300]`);
|
|
339
358
|
fn.timeoutSeconds = t;
|
|
340
359
|
}
|
|
360
|
+
if (value.check !== void 0) {
|
|
361
|
+
if (typeof value.check !== "boolean") throw new Error(`oxy-app.json: function "${fnName}" \`check\` must be a boolean`);
|
|
362
|
+
fn.check = value.check;
|
|
363
|
+
}
|
|
341
364
|
if (value.cache !== void 0) {
|
|
342
365
|
const c = value.cache;
|
|
343
366
|
if (!isRecord(c)) throw new Error(`oxy-app.json: function "${fnName}" \`cache\` must be an object`);
|
|
@@ -892,7 +915,7 @@ function useQuery(input, opts = {}) {
|
|
|
892
915
|
setState((s) => ({
|
|
893
916
|
...s,
|
|
894
917
|
loading: false,
|
|
895
|
-
error:
|
|
918
|
+
error: asReportableError(err)
|
|
896
919
|
}));
|
|
897
920
|
});
|
|
898
921
|
return () => {
|
|
@@ -1070,11 +1093,10 @@ function useSemanticQuery(input, opts = {}) {
|
|
|
1070
1093
|
});
|
|
1071
1094
|
}).catch((err) => {
|
|
1072
1095
|
if (cancelled) return;
|
|
1073
|
-
if (err instanceof DOMException && err.name === "AbortError") return;
|
|
1074
1096
|
setState((s) => ({
|
|
1075
1097
|
...s,
|
|
1076
1098
|
loading: false,
|
|
1077
|
-
error:
|
|
1099
|
+
error: asReportableError(err)
|
|
1078
1100
|
}));
|
|
1079
1101
|
});
|
|
1080
1102
|
return () => {
|
|
@@ -1231,13 +1253,13 @@ function useProcedureRun(input, opts = {}) {
|
|
|
1231
1253
|
return;
|
|
1232
1254
|
}
|
|
1233
1255
|
} catch (e) {
|
|
1234
|
-
if (
|
|
1256
|
+
if (ctrl.signal.aborted) return;
|
|
1235
1257
|
inflight.current.runId = void 0;
|
|
1236
1258
|
setState({
|
|
1237
1259
|
state: "failed",
|
|
1238
1260
|
progress: null,
|
|
1239
1261
|
result: null,
|
|
1240
|
-
error:
|
|
1262
|
+
error: asReportableError(e)
|
|
1241
1263
|
});
|
|
1242
1264
|
}
|
|
1243
1265
|
})();
|
|
@@ -1338,6 +1360,8 @@ function useAgentRun(input) {
|
|
|
1338
1360
|
if (ctrl.signal.aborted) return;
|
|
1339
1361
|
if (terminated) return;
|
|
1340
1362
|
attempts += 1;
|
|
1363
|
+
const idBeforeAttempt = lastEventId;
|
|
1364
|
+
let windowError;
|
|
1341
1365
|
try {
|
|
1342
1366
|
await consumeSseStream({
|
|
1343
1367
|
url: `/api/projects/${projectId}/agents/runs/${encodeURIComponent(run_id)}/events`,
|
|
@@ -1387,36 +1411,29 @@ function useAgentRun(input) {
|
|
|
1387
1411
|
}
|
|
1388
1412
|
});
|
|
1389
1413
|
} catch (err) {
|
|
1390
|
-
if (
|
|
1391
|
-
|
|
1392
|
-
inflight.current.runId = void 0;
|
|
1393
|
-
setState((s) => ({
|
|
1394
|
-
...s,
|
|
1395
|
-
state: "failed",
|
|
1396
|
-
error: err instanceof Error ? err : new Error(String(err))
|
|
1397
|
-
}));
|
|
1398
|
-
return;
|
|
1399
|
-
}
|
|
1414
|
+
if (ctrl.signal.aborted) return;
|
|
1415
|
+
windowError = err;
|
|
1400
1416
|
}
|
|
1401
1417
|
if (terminated) return;
|
|
1402
|
-
if (
|
|
1418
|
+
if (lastEventId !== idBeforeAttempt) attempts = 0;
|
|
1419
|
+
else if (attempts >= 5) {
|
|
1403
1420
|
inflight.current.runId = void 0;
|
|
1404
1421
|
setState((s) => ({
|
|
1405
1422
|
...s,
|
|
1406
1423
|
state: "failed",
|
|
1407
|
-
error: /* @__PURE__ */ new Error("run event stream closed without a terminal event")
|
|
1424
|
+
error: windowError ? asReportableError(windowError) : /* @__PURE__ */ new Error("run event stream closed without a terminal event")
|
|
1408
1425
|
}));
|
|
1409
1426
|
return;
|
|
1410
1427
|
}
|
|
1411
1428
|
await sleep(1e3, ctrl.signal);
|
|
1412
1429
|
}
|
|
1413
1430
|
} catch (e) {
|
|
1414
|
-
if (
|
|
1431
|
+
if (ctrl.signal.aborted) return;
|
|
1415
1432
|
inflight.current.runId = void 0;
|
|
1416
1433
|
setState((s) => ({
|
|
1417
1434
|
...s,
|
|
1418
1435
|
state: "failed",
|
|
1419
|
-
error:
|
|
1436
|
+
error: asReportableError(e)
|
|
1420
1437
|
}));
|
|
1421
1438
|
}
|
|
1422
1439
|
})();
|
|
@@ -2356,5 +2373,5 @@ const styles = {
|
|
|
2356
2373
|
};
|
|
2357
2374
|
|
|
2358
2375
|
//#endregion
|
|
2359
|
-
export {
|
|
2360
|
-
//# sourceMappingURL=react-
|
|
2376
|
+
export { asReportableError as _, useFunction as a, setOxyAppLogger as b, useQuery as c, useTrackEvent as d, _resetCustomAppManifestCacheForTest as f, apiErrorFromResponse as g, OxyApiError as h, useAgentRun as i, useResolvedManifest as l, readInjectedAppConfig as m, OxyAppProvider as n, useOxyApp as o, loadCustomAppManifest as p, OxyChat as r, useProcedureRun as s, OxyAnswer as t, useSemanticQuery as u, interpretCustomAppError as v, getOxyAppLogger as y };
|
|
2377
|
+
//# sourceMappingURL=react-OW1t_J0M.mjs.map
|