@oxy-hq/sdk 2.5.0 → 2.8.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 +55 -5
- package/dist/index.cjs +677 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +708 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +708 -16
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +657 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{react-BeweGSYF.cjs → react-BFFCK4VM.cjs} +34 -29
- package/dist/react-BFFCK4VM.cjs.map +1 -0
- package/dist/{react-BnpR8VRJ.d.mts → react-kHG5gkd-.d.cts} +22 -17
- package/dist/react-kHG5gkd-.d.cts.map +1 -0
- package/dist/{react-BnpR8VRJ.d.cts → react-kHG5gkd-.d.mts} +22 -17
- package/dist/react-kHG5gkd-.d.mts.map +1 -0
- package/dist/{react-CVdWXcu8.mjs → react-sT7E4CbA.mjs} +29 -24
- package/dist/react-sT7E4CbA.mjs.map +1 -0
- package/dist/shell.cjs +6 -5
- package/dist/shell.cjs.map +1 -1
- package/dist/shell.css +28 -6
- package/dist/shell.d.cts +3 -3
- package/dist/shell.d.cts.map +1 -1
- package/dist/shell.d.mts +3 -3
- package/dist/shell.d.mts.map +1 -1
- package/dist/shell.mjs +6 -5
- package/dist/shell.mjs.map +1 -1
- package/package.json +10 -10
- package/dist/react-BeweGSYF.cjs.map +0 -1
- package/dist/react-BnpR8VRJ.d.cts.map +0 -1
- package/dist/react-BnpR8VRJ.d.mts.map +0 -1
- package/dist/react-CVdWXcu8.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/custom-app/manifest.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Declaration of a single Oxy Function shipped in the bundle's
|
|
6
|
-
* `functions/` dir. See `internal-docs/
|
|
6
|
+
* `functions/` dir. See `internal-docs/customer-apps-functions.md`.
|
|
7
7
|
*
|
|
8
8
|
* All fields optional except that at least one invocation surface
|
|
9
9
|
* (`route`, `schedule`, or `airwayStep`) must be active. Absent =
|
|
@@ -136,7 +136,7 @@ interface OxyAppManifest {
|
|
|
136
136
|
* should treat this as the only source of truth for "which org/app
|
|
137
137
|
* does this bundle belong to."
|
|
138
138
|
*/
|
|
139
|
-
interface
|
|
139
|
+
interface ResolvedCustomAppManifest {
|
|
140
140
|
manifest: OxyAppManifest;
|
|
141
141
|
/**
|
|
142
142
|
* Always an empty array for v2 manifests. Kept for API compatibility;
|
|
@@ -179,13 +179,13 @@ interface LoadManifestOptions {
|
|
|
179
179
|
* Load + validate the manifest. Cached after the first call so callers
|
|
180
180
|
* can invoke this from every component without coordinating.
|
|
181
181
|
*/
|
|
182
|
-
declare function
|
|
182
|
+
declare function loadCustomAppManifest(options?: LoadManifestOptions): Promise<ResolvedCustomAppManifest>;
|
|
183
183
|
/** For tests: reset the cache between runs. */
|
|
184
|
-
declare function
|
|
184
|
+
declare function _resetCustomAppManifestCacheForTest(): void;
|
|
185
185
|
//#endregion
|
|
186
|
-
//#region src/
|
|
186
|
+
//#region src/custom-app/errors.d.ts
|
|
187
187
|
/**
|
|
188
|
-
* Error thrown by all
|
|
188
|
+
* Error thrown by all custom-app hooks when an API call returns a
|
|
189
189
|
* non-2xx response. Carries the structured `code` + `hint` the server
|
|
190
190
|
* emits so bundle UIs can render an actionable message instead of
|
|
191
191
|
* "404: { ...json... }".
|
|
@@ -208,23 +208,23 @@ declare class OxyApiError extends Error {
|
|
|
208
208
|
* dominate the bundle UI).
|
|
209
209
|
*/
|
|
210
210
|
declare function apiErrorFromResponse(resp: Response): Promise<OxyApiError>;
|
|
211
|
-
interface
|
|
211
|
+
interface CustomAppErrorReport {
|
|
212
212
|
title: string;
|
|
213
213
|
message: string;
|
|
214
214
|
hint: string;
|
|
215
215
|
docs?: string;
|
|
216
216
|
}
|
|
217
217
|
/** Interpret a thrown error as a structured report for UI display. */
|
|
218
|
-
declare function
|
|
218
|
+
declare function interpretCustomAppError(err: unknown): CustomAppErrorReport;
|
|
219
219
|
//#endregion
|
|
220
|
-
//#region src/
|
|
220
|
+
//#region src/custom-app/function-sse.d.ts
|
|
221
221
|
/** A captured `console.*` / `ctx.log` line from a function run. */
|
|
222
222
|
interface FunctionLog {
|
|
223
223
|
level: string;
|
|
224
224
|
message: string;
|
|
225
225
|
}
|
|
226
226
|
//#endregion
|
|
227
|
-
//#region src/
|
|
227
|
+
//#region src/custom-app/react.d.ts
|
|
228
228
|
/**
|
|
229
229
|
* Credentialed fetch wrapper stored in context so `useQuery` can share
|
|
230
230
|
* the same request mechanism without coupling it to the global `fetch`.
|
|
@@ -237,7 +237,7 @@ interface FunctionLog {
|
|
|
237
237
|
*/
|
|
238
238
|
type AppFetcher = typeof fetch;
|
|
239
239
|
interface OxyAppProviderProps {
|
|
240
|
-
/** Optional manifest load options. Same shape as `
|
|
240
|
+
/** Optional manifest load options. Same shape as `loadCustomAppManifest`. */
|
|
241
241
|
manifestOptions?: LoadManifestOptions;
|
|
242
242
|
/**
|
|
243
243
|
* Rendered while the manifest is loading. Defaults to nothing; pass a
|
|
@@ -249,7 +249,7 @@ interface OxyAppProviderProps {
|
|
|
249
249
|
* report so the bundle can show its own branded error card. Defaults
|
|
250
250
|
* to a minimal text-only fallback (better than a blank page).
|
|
251
251
|
*/
|
|
252
|
-
errorFallback?: (err:
|
|
252
|
+
errorFallback?: (err: CustomAppErrorReport) => React.ReactNode;
|
|
253
253
|
/**
|
|
254
254
|
* Override the fetch implementation used by all hooks (`useQuery`).
|
|
255
255
|
* Useful for test environments or proxy setups. Defaults to a wrapper
|
|
@@ -278,13 +278,18 @@ declare function OxyAppProvider(props: OxyAppProviderProps): React.JSX.Element;
|
|
|
278
278
|
* `<OxyAppProvider>` — that's a programmer error worth surfacing
|
|
279
279
|
* loudly, not silently swallowing.
|
|
280
280
|
*/
|
|
281
|
-
declare function useResolvedManifest():
|
|
281
|
+
declare function useResolvedManifest(): ResolvedCustomAppManifest;
|
|
282
282
|
/**
|
|
283
283
|
* Low-level hook that returns the raw context value (including the
|
|
284
284
|
* fetcher). Prefer `useResolvedManifest` for manifest access; use
|
|
285
285
|
* this only when you need the fetcher or identity without requiring
|
|
286
286
|
* the manifest to be ready (e.g. inside `useQuery`, or the shell
|
|
287
287
|
* chrome, which must never block the app on the manifest load).
|
|
288
|
+
*
|
|
289
|
+
* Exported for sibling hook modules (`metric-tree-hooks`,
|
|
290
|
+
* `world-model-hooks`) that need the same credentialed fetcher +
|
|
291
|
+
* project scope without re-deriving the context wiring. Not part of
|
|
292
|
+
* the public bundle API — bundle authors use the concrete hooks.
|
|
288
293
|
*/
|
|
289
294
|
declare function useOxyApp(): {
|
|
290
295
|
projectId: string | undefined;
|
|
@@ -310,7 +315,7 @@ interface UseQueryResult<Row = Record<string, unknown>> {
|
|
|
310
315
|
}
|
|
311
316
|
/**
|
|
312
317
|
* Execute an ad-hoc SQL query against the project linked to this
|
|
313
|
-
*
|
|
318
|
+
* custom app. The query is specified inline by the caller; no
|
|
314
319
|
* manifest declaration is involved.
|
|
315
320
|
*
|
|
316
321
|
* Re-runs whenever `input` or enabled `params` change. Use the
|
|
@@ -652,5 +657,5 @@ interface OxyChatProps {
|
|
|
652
657
|
*/
|
|
653
658
|
declare function OxyChat(props: OxyChatProps): React.JSX.Element;
|
|
654
659
|
//#endregion
|
|
655
|
-
export { UseSemanticQueryOpts as A,
|
|
656
|
-
//# sourceMappingURL=react-
|
|
660
|
+
export { UseSemanticQueryOpts as A, CustomAppErrorReport as B, UseProcedureRunInput as C, UseQueryOpts as D, UseQueryInput as E, useProcedureRun as F, OxyAppFunctionManifest as G, apiErrorFromResponse as H, useQuery as I, _resetCustomAppManifestCacheForTest as J, OxyAppManifest as K, useResolvedManifest as L, useAgentRun as M, useFunction as N, UseQueryResult as O, useOxyApp as P, useSemanticQuery as R, UseFunctionResult as S, UseProcedureRunResult as T, interpretCustomAppError as U, OxyApiError as V, LoadManifestOptions as W, loadCustomAppManifest as Y, SemanticFilter as _, AppFetcher as a, UseAgentRunInput as b, OxyAppProvider as c, OxyChatProps as d, ProcedureProgress as f, SemanticDateRangeOp as g, SemanticArrayOp as h, AgentSqlArtifact as i, UseSemanticQueryResult as j, UseSemanticQueryInput as k, OxyAppProviderProps as l, ProcedureRunState as m, AgentRunEvent as n, OxyAnswer as o, ProcedureResult as p, ResolvedCustomAppManifest as q, AgentRunState as r, OxyAnswerProps as s, AgentArtifact as t, OxyChat as u, SemanticScalarOp as v, UseProcedureRunOpts as w, UseAgentRunResult as x, SemanticTimeDimension as y, useTrackEvent as z };
|
|
661
|
+
//# sourceMappingURL=react-kHG5gkd-.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-kHG5gkd-.d.mts","names":[],"sources":["../src/custom-app/manifest.ts","../src/custom-app/errors.ts","../src/custom-app/function-sse.ts","../src/custom-app/react.tsx"],"mappings":";;;;;;;;;;;UA0BiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;IAAe;IAAkB;;;EAEjC;;;;;;;;;EASA;IAAU;;;;;;;;;;EASV;;;;;;;EAOA;IAAY;;;;;;;;;EAQZ;IAAU;;;;;;;;;;EASV;IAAY;IAAsB;IAAuB;;;;;;;;EAOzD;;;UAIe;;EAEf;;;;;;EAMA;;;;;;;EAOA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA,YAAY,eAAe;;;;;;;EAO3B;IAAQ;IAAgB;;;;;;;;UAUT;EACf,UAAU;;;;;;;EAOV;;EAEA;;EAEA;;;;;;EAMA;;EAEA;;;;;;;;EAQA;;UAGe;;;;;;;EAOf;;;;;;iBASc,sBACd,UAAS,sBACR,QAAQ;;iBAQK;;;;;;;;;cC9KH,oBAAoB;WACtB;WACA;WACA;EACT,YAAY;IACV;IACA;IACA;IACA;;;;;;;;;iBAmBkB,qBAAqB,MAAM,WAAW,QAAQ;UA2BnD;EACf;EACA;EACA;EACA;;;iBAMc,wBAAwB,eAAe;;;;UC7EtC;EACf;EACA;;;;;;;;;;;;;;KC4CU,oBAAoB;UAsCf;;EAEf,kBAAkB;;;;;EAKlB,WAAW,MAAM;;;;;;EAMjB,iBAAiB,KAAK,yBAAyB,MAAM;;;;;;EAMrD,UAAU;;;;;;;;;;EAUV;EACA,UAAU,MAAM;;;;;;iBAOF,eAAe,OAAO,sBAAsB,MAAM,IAAI;;;;;;iBA0GtD,uBAAuB;;;;;;;;;;;;;iBA0BvB;EACd;EACA;EACA;EACA,SAAS;;UAgBM;EACf;EACA;;UAGe;EACf,SAAS;;EAET;;UAGe,eAAe,MAAM;EACpC,MAAM;EACN;EACA;EACA,OAAO;EACP;;;;;;;;;;;iBAYc,SAAS,MAAM,yBAC7B,OAAO,eACP,OAAM,eACL,eAAe;UAwFD,kBAAkB;;;;;;;;EAQjC,SAAS,gBAAgB;IAAS;QAA8B,QAAQ;;EAExE,MAAM;;EAEN;;EAEA,OAAO;;;;;;;EAOP,MAAM;;;;;;;;;;;;iBAaQ,YAAY,gBAAgB,eAAe,kBAAkB;;KAoFjE;;KAGA;;KAGA;;;;;;;;KASA;EACN;EAAe,IAAI;EAAkB;;EACrC;EAAe,IAAI;EAAiB,QAAQ;;EAC5C;EAAe,IAAI;EAAqB;EAAc;;;UAG3C;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA,kBAAkB;EAClB,UAAU;EACV;;UAGe;;EAEf;;;;;;;EAOA;;UAGe,uBAAuB,MAAM;EAC5C,MAAM;EACN;;EAEA;;EAEA;EACA;EACA,OAAO;EACP;;;;;;;;;;;;iBAac,iBAAiB,MAAM,yBACrC,OAAO,uBACP,OAAM,uBACL,uBAAuB;KAoHd;UAEK;EACf;;UAGe;;;EAGf;EACA;;EAEA;;UAGe;EACf;EACA;;UAGe;EACf;EACA,SAAS;;UAGM;EACf,OAAO;EACP,MAAM,SAAS;;EAEf;EACA,UAAU;EACV,QAAQ;EACR,OAAO;;;;;;;;;;;;;;;;;;;;iBAyBO,gBACd,OAAO,sBACP,OAAM,sBACL;KAsLS;UAEK;EACf;EACA;;;;;;UAOe;EACf;;;EAGA;;;EAGA;EACA;;EAEA;IACE;IACA;IACA;;;;;EAKF;;KAGU,gBAAgB;UAEX;EACf;;UAGe;EACf,OAAO;;EAEP,MAAM,kBAAkB;IAAS;;;EAEjC;;EAEA,QAAQ;;;;EAIR,WAAW;;EAEX;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;EAmBA;EACA,OAAO;;iBAGO,YAAY,OAAO,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2hBtC,kBAAkB,cAAc,UAAU;UA6GzC;;EAEf;;EAEA,YAAY;;EAEZ,OAAO;;EAEP;;EAEA,QAAQ;;;;;;;;EAQR;;EAEA;;;EAGA;;EAEA;;;;;;;;;;;;;;;;;;;iBAoBc,UAAU,OAAO,iBAAiB,MAAM,IAAI;UAgE3C;;EAEf;;EAEA;;EAEA;;EAEA,aAAa,MAAM;;EAEnB;;EAEA;;;;;;;;;;;;;;iBAec,QAAQ,OAAO,eAAe,MAAM,IAAI"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/custom-app/logger.ts
|
|
6
6
|
let activeLogger = createConsoleLogger();
|
|
7
7
|
/** Replace the global logger. Pass `null` to silence everything. */
|
|
8
8
|
function setOxyAppLogger(logger) {
|
|
@@ -42,9 +42,9 @@ function silentLogger() {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
//#endregion
|
|
45
|
-
//#region src/
|
|
45
|
+
//#region src/custom-app/errors.ts
|
|
46
46
|
/**
|
|
47
|
-
* Error thrown by all
|
|
47
|
+
* Error thrown by all custom-app hooks when an API call returns a
|
|
48
48
|
* non-2xx response. Carries the structured `code` + `hint` the server
|
|
49
49
|
* emits so bundle UIs can render an actionable message instead of
|
|
50
50
|
* "404: { ...json... }".
|
|
@@ -91,12 +91,12 @@ async function apiErrorFromResponse(resp) {
|
|
|
91
91
|
}
|
|
92
92
|
const ARCH_DOC = "internal-docs/customer-apps.md";
|
|
93
93
|
/** Interpret a thrown error as a structured report for UI display. */
|
|
94
|
-
function
|
|
94
|
+
function interpretCustomAppError(err) {
|
|
95
95
|
const message = err instanceof Error ? err.message : String(err);
|
|
96
96
|
if (/Failed to load oxy-app\.json.*HTTP 404/.test(message)) return {
|
|
97
97
|
title: "Manifest not found",
|
|
98
98
|
message,
|
|
99
|
-
hint: "The bundle is being served, but oxy-app.json was not. Check that public/oxy-app.json is committed in the
|
|
99
|
+
hint: "The bundle is being served, but oxy-app.json was not. Check that public/oxy-app.json is committed in the custom-app repo and that the build copied it into the static output. If you're using Next.js, anything under public/ is auto-copied to out/.",
|
|
100
100
|
docs: ARCH_DOC
|
|
101
101
|
};
|
|
102
102
|
if (/Failed to load oxy-app\.json/.test(message)) return {
|
|
@@ -132,7 +132,7 @@ function interpretCustomerAppError(err) {
|
|
|
132
132
|
if (/^403:.*SELECT.*WITH/im.test(message)) return {
|
|
133
133
|
title: "Query rejected — read-only endpoint",
|
|
134
134
|
message,
|
|
135
|
-
hint: "This proxy only runs SELECT or WITH queries. Mutations (INSERT/UPDATE/DELETE/DROP) are not allowed from
|
|
135
|
+
hint: "This proxy only runs SELECT or WITH queries. Mutations (INSERT/UPDATE/DELETE/DROP) are not allowed from custom-app bundles.",
|
|
136
136
|
docs: ARCH_DOC
|
|
137
137
|
};
|
|
138
138
|
if (/^403:/m.test(message)) return {
|
|
@@ -168,7 +168,7 @@ function interpretCustomerAppError(err) {
|
|
|
168
168
|
if (/Unexpected token '<'|<!doctype/i.test(message)) return {
|
|
169
169
|
title: "Fetched HTML where JSON was expected",
|
|
170
170
|
message,
|
|
171
|
-
hint: "Most likely the built bundle is stale — built against an old SDK whose endpoints no longer exist on the server. Rebuild the bundle (vite build) with @oxy-hq/sdk@^2.0.0 and reload. If the bundle is current, check that OXY_APP_BASE_PATH matches the path the
|
|
171
|
+
hint: "Most likely the built bundle is stale — built against an old SDK whose endpoints no longer exist on the server. Rebuild the bundle (vite build) with @oxy-hq/sdk@^2.0.0 and reload. If the bundle is current, check that OXY_APP_BASE_PATH matches the path the custom-app row is served at.",
|
|
172
172
|
docs: ARCH_DOC
|
|
173
173
|
};
|
|
174
174
|
return {
|
|
@@ -180,7 +180,7 @@ function interpretCustomerAppError(err) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
//#endregion
|
|
183
|
-
//#region src/
|
|
183
|
+
//#region src/custom-app/inject.ts
|
|
184
184
|
/**
|
|
185
185
|
* Read the runtime app-config oxy injected at serve time. Returns
|
|
186
186
|
* `undefined` outside the browser or when the global isn't set
|
|
@@ -193,18 +193,18 @@ function readInjectedAppConfig() {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
//#endregion
|
|
196
|
-
//#region src/
|
|
196
|
+
//#region src/custom-app/manifest.ts
|
|
197
197
|
let cached = null;
|
|
198
198
|
/**
|
|
199
199
|
* Load + validate the manifest. Cached after the first call so callers
|
|
200
200
|
* can invoke this from every component without coordinating.
|
|
201
201
|
*/
|
|
202
|
-
function
|
|
202
|
+
function loadCustomAppManifest(options = {}) {
|
|
203
203
|
if (!cached) cached = fetchAndValidate(options);
|
|
204
204
|
return cached;
|
|
205
205
|
}
|
|
206
206
|
/** For tests: reset the cache between runs. */
|
|
207
|
-
function
|
|
207
|
+
function _resetCustomAppManifestCacheForTest() {
|
|
208
208
|
cached = null;
|
|
209
209
|
}
|
|
210
210
|
async function fetchAndValidate(options) {
|
|
@@ -226,7 +226,7 @@ async function fetchAndValidate(options) {
|
|
|
226
226
|
status: res.status,
|
|
227
227
|
statusText: res.statusText
|
|
228
228
|
});
|
|
229
|
-
throw new Error(`Failed to load oxy-app.json from ${manifestUrl} (HTTP ${res.status}). The
|
|
229
|
+
throw new Error(`Failed to load oxy-app.json from ${manifestUrl} (HTTP ${res.status}). The custom-app repo must commit this file alongside the bundle.`);
|
|
230
230
|
}
|
|
231
231
|
const manifest = validateManifest(await res.json(), manifestUrl);
|
|
232
232
|
const resolved = {
|
|
@@ -291,7 +291,7 @@ const FUNCTION_NAME_RE = /^[a-z][a-z0-9-]{0,63}$/;
|
|
|
291
291
|
/**
|
|
292
292
|
* Validate the optional `functions` map. Each key is a function name;
|
|
293
293
|
* each value declares how the function is invoked. Mirrors the
|
|
294
|
-
* server-side validation in `
|
|
294
|
+
* server-side validation in `custom_apps_publish.rs` so a bad
|
|
295
295
|
* manifest fails at build, not at publish.
|
|
296
296
|
*/
|
|
297
297
|
function validateFunctions(raw) {
|
|
@@ -369,7 +369,7 @@ function isRecord(v) {
|
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
//#endregion
|
|
372
|
-
//#region src/
|
|
372
|
+
//#region src/custom-app/function-invoke.ts
|
|
373
373
|
const inflight$1 = /* @__PURE__ */ new Map();
|
|
374
374
|
/**
|
|
375
375
|
* Dedup key for an invocation: function name + its (stable-serialized) body,
|
|
@@ -395,7 +395,7 @@ function sharedFunctionInvoke(key, run) {
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
//#endregion
|
|
398
|
-
//#region src/
|
|
398
|
+
//#region src/custom-app/function-sse.ts
|
|
399
399
|
/**
|
|
400
400
|
* Read a `text/event-stream` function response to completion. Resolves with the
|
|
401
401
|
* decoded result + captured logs, or rejects (with `.logs` attached) on an
|
|
@@ -452,7 +452,7 @@ async function readFunctionSseStream(resp) {
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
//#endregion
|
|
455
|
-
//#region src/
|
|
455
|
+
//#region src/custom-app/interpolate.ts
|
|
456
456
|
/**
|
|
457
457
|
* Interpolate `{{ params.X }}` and `{{ params.X | sqlquote }}` placeholders
|
|
458
458
|
* in a SQL template.
|
|
@@ -481,7 +481,7 @@ function interpolateSqlParams(sql, params) {
|
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
//#endregion
|
|
484
|
-
//#region src/
|
|
484
|
+
//#region src/custom-app/markdown.ts
|
|
485
485
|
/**
|
|
486
486
|
* Allowlist for `[text](url)` href values in agent-emitted markdown.
|
|
487
487
|
* Markdown comes from an LLM, which sits across an external trust
|
|
@@ -557,7 +557,7 @@ function isTableStart(lines, idx) {
|
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
//#endregion
|
|
560
|
-
//#region src/
|
|
560
|
+
//#region src/custom-app/query-cache.ts
|
|
561
561
|
const SWR_TTL_MS = 3e4;
|
|
562
562
|
const inflight = /* @__PURE__ */ new Map();
|
|
563
563
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -601,7 +601,7 @@ async function sharedQuery(fetcher, projectId, sql, db, opts = {}) {
|
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
//#endregion
|
|
604
|
-
//#region src/
|
|
604
|
+
//#region src/custom-app/react.tsx
|
|
605
605
|
function defaultFetcher(input, init) {
|
|
606
606
|
return fetch(input, {
|
|
607
607
|
credentials: "include",
|
|
@@ -642,7 +642,7 @@ function OxyAppProvider(props) {
|
|
|
642
642
|
});
|
|
643
643
|
React.useEffect(() => {
|
|
644
644
|
let cancelled = false;
|
|
645
|
-
|
|
645
|
+
loadCustomAppManifest(manifestOptions).then((resolved) => {
|
|
646
646
|
if (!cancelled) setState({
|
|
647
647
|
status: "ready",
|
|
648
648
|
resolved,
|
|
@@ -651,7 +651,7 @@ function OxyAppProvider(props) {
|
|
|
651
651
|
}).catch((e) => {
|
|
652
652
|
if (!cancelled) setState({
|
|
653
653
|
status: "error",
|
|
654
|
-
error:
|
|
654
|
+
error: interpretCustomAppError(e),
|
|
655
655
|
fetcher
|
|
656
656
|
});
|
|
657
657
|
});
|
|
@@ -740,6 +740,11 @@ function useResolvedManifest() {
|
|
|
740
740
|
* this only when you need the fetcher or identity without requiring
|
|
741
741
|
* the manifest to be ready (e.g. inside `useQuery`, or the shell
|
|
742
742
|
* chrome, which must never block the app on the manifest load).
|
|
743
|
+
*
|
|
744
|
+
* Exported for sibling hook modules (`metric-tree-hooks`,
|
|
745
|
+
* `world-model-hooks`) that need the same credentialed fetcher +
|
|
746
|
+
* project scope without re-deriving the context wiring. Not part of
|
|
747
|
+
* the public bundle API — bundle authors use the concrete hooks.
|
|
743
748
|
*/
|
|
744
749
|
function useOxyApp() {
|
|
745
750
|
const ctx = React.useContext(OxyAppContext);
|
|
@@ -753,7 +758,7 @@ function useOxyApp() {
|
|
|
753
758
|
}
|
|
754
759
|
/**
|
|
755
760
|
* Execute an ad-hoc SQL query against the project linked to this
|
|
756
|
-
*
|
|
761
|
+
* custom app. The query is specified inline by the caller; no
|
|
757
762
|
* manifest declaration is involved.
|
|
758
763
|
*
|
|
759
764
|
* Re-runs whenever `input` or enabled `params` change. Use the
|
|
@@ -2254,5 +2259,5 @@ const styles = {
|
|
|
2254
2259
|
};
|
|
2255
2260
|
|
|
2256
2261
|
//#endregion
|
|
2257
|
-
export {
|
|
2258
|
-
//# sourceMappingURL=react-
|
|
2262
|
+
export { interpretCustomAppError as _, useFunction as a, 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, getOxyAppLogger as v, setOxyAppLogger as y };
|
|
2263
|
+
//# sourceMappingURL=react-sT7E4CbA.mjs.map
|