@oxy-hq/sdk 2.12.0 → 2.13.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.
@@ -23,6 +23,31 @@ interface OxyAppFunctionManifest {
23
23
  pipeline: string;
24
24
  resource: string;
25
25
  };
26
+ /**
27
+ * Receive an unauthenticated POST from a third party at
28
+ * `POST /api/webhooks/apps/<org>/<app>/<name>`.
29
+ *
30
+ * The PLATFORM verifies every request — HMAC-SHA256 over the raw body, in
31
+ * constant time — before the function is enqueued, so app code never sees an
32
+ * unverified request. Omit the block and that endpoint answers 404, as if it
33
+ * did not exist.
34
+ */
35
+ webhook?: {
36
+ /**
37
+ * App-secret key holding the signing key(s) — the same `apps/<app-id>/`
38
+ * namespace `ctx.env` reads. The manifest names the secret, never holds it.
39
+ *
40
+ * **Comma-separated for rotation.** Providers that keep two live signing
41
+ * keys (Uber's `BASIC_HMAC` does) sign with either during a rotation; any
42
+ * match passes, so adopting a new key does not drop the events still
43
+ * signed with the old one.
44
+ */
45
+ secretVar: string;
46
+ /** Header carrying the signature, e.g. `x-uber-signature`. */
47
+ signatureHeader: string;
48
+ /** How the digest is encoded. Default `hex`. */
49
+ encoding?: "hex" | "base64";
50
+ };
26
51
  /** Wall-clock timeout. Default 30, max 300. */
27
52
  timeoutSeconds?: number;
28
53
  /**
@@ -187,6 +212,37 @@ interface OxyAppManifest {
187
212
  agent?: string;
188
213
  suggestedQuestions?: string[];
189
214
  };
215
+ /**
216
+ * The secrets this app expects, keyed by env-var name — the app's
217
+ * `.env.example`, declared rather than written in a README.
218
+ *
219
+ * These are the keys your functions read as `ctx.env.KEY`. Declaring one puts
220
+ * it in the app's Secrets surface (staff console → app → Secrets, and the
221
+ * workspace's own settings) as a row to fill in, so a fresh deploy says what
222
+ * is still missing instead of failing at the first invocation. Every function's
223
+ * `webhook.secretVar` is folded in automatically — no need to repeat it here.
224
+ *
225
+ * **Names only, never values.** A manifest ships inside the bundle and is
226
+ * fetchable over the app's own host; putting a secret in one publishes it.
227
+ * Values are set out-of-band on the Secrets surface, or by
228
+ * `ctx.secrets.set` from a function holding the `secrets.write` capability.
229
+ *
230
+ * App-level rather than per-function, because a secret is app-scoped by
231
+ * construction: two functions sharing `STRIPE_API_KEY` read the same value,
232
+ * so it can only be described once.
233
+ *
234
+ * ```jsonc
235
+ * "env": {
236
+ * "STRIPE_API_KEY": { "required": true, "description": "Restricted key, Dashboard → Developers" },
237
+ * "SLACK_WEBHOOK_URL": { "description": "Optional ops channel" }
238
+ * }
239
+ * ```
240
+ *
241
+ * Read by the platform at **publish time** (like {@link OxyAppStorageManifest}),
242
+ * so the block is documented here but not round-tripped through the dev-time
243
+ * manifest fetch.
244
+ */
245
+ env?: Record<string, OxyAppEnvDeclaration>;
190
246
  /**
191
247
  * Optional app-level storage policy. Distinct from the per-function
192
248
  * `storage: { read, write }` capability: those gate what one function may
@@ -220,6 +276,24 @@ interface OxyAppManifest {
220
276
  */
221
277
  analytics?: boolean;
222
278
  }
279
+ /** One declared secret — an entry in the `env` block of `oxy-app.json`. */
280
+ interface OxyAppEnvDeclaration {
281
+ /**
282
+ * Flag the key as **Missing** (rather than merely absent) while nothing is
283
+ * stored for it, and count it in the app's missing-secrets badge.
284
+ *
285
+ * Advisory, not a gate: a publish is never blocked on an unset key, because
286
+ * the first publish is exactly when nobody could have set one yet.
287
+ *
288
+ * Default: `false` — a declaration is documentation first.
289
+ */
290
+ required?: boolean;
291
+ /**
292
+ * Shown beside the key on the Secrets surface. Say what it is and where to
293
+ * get one — this is the text that saves someone a Slack message.
294
+ */
295
+ description?: string;
296
+ }
223
297
  /** Browser-runtime performance opt-outs — the `performance` block in `oxy-app.json`. */
224
298
  interface OxyAppPerformanceManifest {
225
299
  /**
@@ -387,6 +461,14 @@ type FunctionError = Error & {
387
461
  logs?: FunctionLog[];
388
462
  status?: number;
389
463
  body?: unknown;
464
+ /**
465
+ * The platform trace this invoke ran in (32 hex chars) and the server-minted
466
+ * `x-oxy-request-id`, when the request got as far as the server. Quote
467
+ * either in a bug report: an operator can open the trace in HyperDX, and
468
+ * an app admin can filter the app's Logs by the request.
469
+ */
470
+ traceId?: string;
471
+ requestId?: string;
390
472
  };
391
473
  //#endregion
392
474
  //#region src/custom-app/react.d.ts
@@ -509,7 +591,10 @@ interface UseFunctionResult<Data = unknown> {
509
591
  data: Data | null;
510
592
  /** True while an invocation is in flight. */
511
593
  isLoading: boolean;
512
- /** Last invocation error, or null. On error this carries `.logs` too. */
594
+ /**
595
+ * Last invocation error, or null. On error this carries `.logs`, and
596
+ * `.traceId` / `.requestId` — the ids that name the run to an operator.
597
+ */
513
598
  error: Error | null;
514
599
  /**
515
600
  * `console.*` / `ctx.log` output from the last invoke (success or error), so
@@ -836,4 +921,4 @@ interface OxyChatProps {
836
921
  declare function OxyChat(props: OxyChatProps): React.JSX.Element;
837
922
  //#endregion
838
923
  export { loadCustomAppManifest as $, UseSemanticQueryOpts as A, FunctionError as B, UseProcedureRunInput as C, UseQueryOpts as D, UseQueryInput as E, useProcedureRun as F, apiErrorFromResponse as G, FunctionResult as H, useQuery as I, OxyAppFunctionManifest as J, interpretCustomAppError as K, useResolvedManifest as L, useAgentRun as M, useFunction as N, UseQueryResult as O, useOxyApp as P, _resetCustomAppManifestCacheForTest as Q, useSemanticQuery as R, UseFunctionResult as S, UseProcedureRunResult as T, CustomAppErrorReport as U, FunctionLog as V, OxyApiError as W, OxyAppPerformanceManifest as X, OxyAppManifest as Y, ResolvedCustomAppManifest as Z, 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, LoadManifestOptions 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 };
839
- //# sourceMappingURL=react-DW7Z96sD.d.mts.map
924
+ //# sourceMappingURL=react-D-Sf973d.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-D-Sf973d.d.cts","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;;;;;;;;;;;EAUjC;;;;;;;;;;IAUE;;IAEA;;IAEA;;;EAGF;;;;;;;;;EASA;IAAU;;;;;;;;;;EASV;;;;;;;EAOA;IAAY;;;;;;;;;EAQZ;IAAU;;;;;;;;;;;;;;;;;;EAiBV;IAAQ;;;;;;;;;;;;;;;;;;EAiBR;IAAS;;;;;;;;;;EAST;IAAY;IAAsB;IAAuB;;;;;;;;EAOzD;;;UAIe;;EAEf;;;;;;EAMA;;;;;;;EAOA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA,YAAY,eAAe;;;;;;;;;;;;;;;;;EAiB3B;IAAe;;;;;;;;EAOf;IAAQ;IAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BxB,MAAM,eAAe;;;;;;;EAOrB,UAAU;;;;;;;;;;EAUV,cAAc;;;;;;;;;;;;;;;EAed;;;UAIe;;;;;;;;;;EAUf;;;;;EAKA;;;UAIe;;;;;;;;;;;;EAYf;;;UAIe;;;;;EAKf;;;;;;;;;EASA;;;UAIe;;;;;;;;;;;;;;;;;;;;EAoBf,YAAY;;;;;;;UAUG;EACf,UAAU;;;;;;;EAOV;;EAEA;;EAEA;;;;;;EAMA;;EAEA;;;;;;;;EAQA;;UAGe;;;;;;;EAOf;;;;;;iBASc,sBACd,UAAS,sBACR,QAAQ;;iBAQK;;;;;;;;;cCtYH,oBAAoB;WACtB;WACA;WACA;EACT,YAAY;IACV;IAC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yBACrC,OAAO,uBACP,OAAM,uBACL,uBAAuB;KAqHd;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;UAmHzC;;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"}
@@ -23,6 +23,31 @@ interface OxyAppFunctionManifest {
23
23
  pipeline: string;
24
24
  resource: string;
25
25
  };
26
+ /**
27
+ * Receive an unauthenticated POST from a third party at
28
+ * `POST /api/webhooks/apps/<org>/<app>/<name>`.
29
+ *
30
+ * The PLATFORM verifies every request — HMAC-SHA256 over the raw body, in
31
+ * constant time — before the function is enqueued, so app code never sees an
32
+ * unverified request. Omit the block and that endpoint answers 404, as if it
33
+ * did not exist.
34
+ */
35
+ webhook?: {
36
+ /**
37
+ * App-secret key holding the signing key(s) — the same `apps/<app-id>/`
38
+ * namespace `ctx.env` reads. The manifest names the secret, never holds it.
39
+ *
40
+ * **Comma-separated for rotation.** Providers that keep two live signing
41
+ * keys (Uber's `BASIC_HMAC` does) sign with either during a rotation; any
42
+ * match passes, so adopting a new key does not drop the events still
43
+ * signed with the old one.
44
+ */
45
+ secretVar: string;
46
+ /** Header carrying the signature, e.g. `x-uber-signature`. */
47
+ signatureHeader: string;
48
+ /** How the digest is encoded. Default `hex`. */
49
+ encoding?: "hex" | "base64";
50
+ };
26
51
  /** Wall-clock timeout. Default 30, max 300. */
27
52
  timeoutSeconds?: number;
28
53
  /**
@@ -187,6 +212,37 @@ interface OxyAppManifest {
187
212
  agent?: string;
188
213
  suggestedQuestions?: string[];
189
214
  };
215
+ /**
216
+ * The secrets this app expects, keyed by env-var name — the app's
217
+ * `.env.example`, declared rather than written in a README.
218
+ *
219
+ * These are the keys your functions read as `ctx.env.KEY`. Declaring one puts
220
+ * it in the app's Secrets surface (staff console → app → Secrets, and the
221
+ * workspace's own settings) as a row to fill in, so a fresh deploy says what
222
+ * is still missing instead of failing at the first invocation. Every function's
223
+ * `webhook.secretVar` is folded in automatically — no need to repeat it here.
224
+ *
225
+ * **Names only, never values.** A manifest ships inside the bundle and is
226
+ * fetchable over the app's own host; putting a secret in one publishes it.
227
+ * Values are set out-of-band on the Secrets surface, or by
228
+ * `ctx.secrets.set` from a function holding the `secrets.write` capability.
229
+ *
230
+ * App-level rather than per-function, because a secret is app-scoped by
231
+ * construction: two functions sharing `STRIPE_API_KEY` read the same value,
232
+ * so it can only be described once.
233
+ *
234
+ * ```jsonc
235
+ * "env": {
236
+ * "STRIPE_API_KEY": { "required": true, "description": "Restricted key, Dashboard → Developers" },
237
+ * "SLACK_WEBHOOK_URL": { "description": "Optional ops channel" }
238
+ * }
239
+ * ```
240
+ *
241
+ * Read by the platform at **publish time** (like {@link OxyAppStorageManifest}),
242
+ * so the block is documented here but not round-tripped through the dev-time
243
+ * manifest fetch.
244
+ */
245
+ env?: Record<string, OxyAppEnvDeclaration>;
190
246
  /**
191
247
  * Optional app-level storage policy. Distinct from the per-function
192
248
  * `storage: { read, write }` capability: those gate what one function may
@@ -220,6 +276,24 @@ interface OxyAppManifest {
220
276
  */
221
277
  analytics?: boolean;
222
278
  }
279
+ /** One declared secret — an entry in the `env` block of `oxy-app.json`. */
280
+ interface OxyAppEnvDeclaration {
281
+ /**
282
+ * Flag the key as **Missing** (rather than merely absent) while nothing is
283
+ * stored for it, and count it in the app's missing-secrets badge.
284
+ *
285
+ * Advisory, not a gate: a publish is never blocked on an unset key, because
286
+ * the first publish is exactly when nobody could have set one yet.
287
+ *
288
+ * Default: `false` — a declaration is documentation first.
289
+ */
290
+ required?: boolean;
291
+ /**
292
+ * Shown beside the key on the Secrets surface. Say what it is and where to
293
+ * get one — this is the text that saves someone a Slack message.
294
+ */
295
+ description?: string;
296
+ }
223
297
  /** Browser-runtime performance opt-outs — the `performance` block in `oxy-app.json`. */
224
298
  interface OxyAppPerformanceManifest {
225
299
  /**
@@ -387,6 +461,14 @@ type FunctionError = Error & {
387
461
  logs?: FunctionLog[];
388
462
  status?: number;
389
463
  body?: unknown;
464
+ /**
465
+ * The platform trace this invoke ran in (32 hex chars) and the server-minted
466
+ * `x-oxy-request-id`, when the request got as far as the server. Quote
467
+ * either in a bug report: an operator can open the trace in HyperDX, and
468
+ * an app admin can filter the app's Logs by the request.
469
+ */
470
+ traceId?: string;
471
+ requestId?: string;
390
472
  };
391
473
  //#endregion
392
474
  //#region src/custom-app/react.d.ts
@@ -509,7 +591,10 @@ interface UseFunctionResult<Data = unknown> {
509
591
  data: Data | null;
510
592
  /** True while an invocation is in flight. */
511
593
  isLoading: boolean;
512
- /** Last invocation error, or null. On error this carries `.logs` too. */
594
+ /**
595
+ * Last invocation error, or null. On error this carries `.logs`, and
596
+ * `.traceId` / `.requestId` — the ids that name the run to an operator.
597
+ */
513
598
  error: Error | null;
514
599
  /**
515
600
  * `console.*` / `ctx.log` output from the last invoke (success or error), so
@@ -836,4 +921,4 @@ interface OxyChatProps {
836
921
  declare function OxyChat(props: OxyChatProps): React.JSX.Element;
837
922
  //#endregion
838
923
  export { loadCustomAppManifest as $, UseSemanticQueryOpts as A, FunctionError as B, UseProcedureRunInput as C, UseQueryOpts as D, UseQueryInput as E, useProcedureRun as F, apiErrorFromResponse as G, FunctionResult as H, useQuery as I, OxyAppFunctionManifest as J, interpretCustomAppError as K, useResolvedManifest as L, useAgentRun as M, useFunction as N, UseQueryResult as O, useOxyApp as P, _resetCustomAppManifestCacheForTest as Q, useSemanticQuery as R, UseFunctionResult as S, UseProcedureRunResult as T, CustomAppErrorReport as U, FunctionLog as V, OxyApiError as W, OxyAppPerformanceManifest as X, OxyAppManifest as Y, ResolvedCustomAppManifest as Z, 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, LoadManifestOptions 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 };
839
- //# sourceMappingURL=react-DW7Z96sD.d.cts.map
924
+ //# sourceMappingURL=react-D-Sf973d.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-D-Sf973d.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;;;;;;;;;;;EAUjC;;;;;;;;;;IAUE;;IAEA;;IAEA;;;EAGF;;;;;;;;;EASA;IAAU;;;;;;;;;;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;EAEA,QAAQ;;;;EAIR,WAAW;;EAEX;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;EAmBA;EACA,OAAO;;iBAGO,YAAY,OAAO,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2hBtC,kBAAkB,cAAc,UAAU;UAmHzC;;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"}
package/dist/shell.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // @oxy/sdk - TypeScript SDK for Oxy data platform
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const require_react = require('./react-DcT-mUPj.cjs');
3
+ const require_react = require('./react-CkAQg9wB.cjs');
4
4
  let react = require("react");
5
5
  react = require_react.__toESM(react, 1);
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1855,6 +1855,38 @@ function useIdentity() {
1855
1855
  loading
1856
1856
  };
1857
1857
  }
1858
+ /**
1859
+ * Where a signed-out person lands: the product's login page, with this app
1860
+ * as the place to come back to.
1861
+ *
1862
+ * `loginUrl` is `links.login` from the shell context — the product host's,
1863
+ * which a custom-app subdomain cannot derive — and `/login` on the current
1864
+ * origin when the context is unavailable or the server predates the field.
1865
+ * `returnTo` is the app's own address, which it knows legitimately.
1866
+ */
1867
+ function signOutUrl(loginUrl, returnTo) {
1868
+ const base = loginUrl?.trim() ? loginUrl.trim() : "/login";
1869
+ return `${base}${base.includes("?") ? "&" : "?"}return_to=${encodeURIComponent(returnTo)}`;
1870
+ }
1871
+ /**
1872
+ * End the platform session, then leave for the login page.
1873
+ *
1874
+ * `GET /api/logout` clears the session cookie server-side. That is the same
1875
+ * cookie a crew member's PIN session rides, so on an enrolled tablet the login
1876
+ * page comes back as "Who's on shift?" and returns to the app after the next
1877
+ * PIN; elsewhere it is the ordinary sign-in. Throws when the server refused,
1878
+ * so a caller can say so rather than navigate away from a session that still
1879
+ * exists. Pass the app's `fetcher` from `useOxyApp()` so credentials ride.
1880
+ */
1881
+ async function signOut(fetcher, loginUrl, returnTo) {
1882
+ const res = await fetcher("/api/logout", {
1883
+ method: "GET",
1884
+ credentials: "include"
1885
+ });
1886
+ if (!res.ok) throw new Error(`sign-out refused: HTTP ${res.status}`);
1887
+ if (typeof window === "undefined") return;
1888
+ window.location.assign(signOutUrl(loginUrl, returnTo ?? window.location.href));
1889
+ }
1858
1890
 
1859
1891
  //#endregion
1860
1892
  //#region src/shell/TopBar.tsx
@@ -2197,6 +2229,8 @@ exports.WorkspaceClock = WorkspaceClock;
2197
2229
  exports.WorkspaceTile = WorkspaceTile;
2198
2230
  exports.buildTraceSteps = buildTraceSteps;
2199
2231
  exports.fetchThreadTranscript = fetchThreadTranscript;
2232
+ exports.signOut = signOut;
2233
+ exports.signOutUrl = signOutUrl;
2200
2234
  exports.useIdentity = useIdentity;
2201
2235
  exports.useShellContext = useShellContext;
2202
2236
  exports.useThreadHistory = useThreadHistory;