@oxy-hq/sdk 2.11.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.
Files changed (42) hide show
  1. package/README.md +44 -4
  2. package/dist/function-context-D8eyZuw_.d.cts +720 -0
  3. package/dist/function-context-D8eyZuw_.d.cts.map +1 -0
  4. package/dist/function-context-D8eyZuw_.d.mts +720 -0
  5. package/dist/function-context-D8eyZuw_.d.mts.map +1 -0
  6. package/dist/index.cjs +217 -11
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +499 -638
  9. package/dist/index.d.cts.map +1 -1
  10. package/dist/index.d.mts +499 -638
  11. package/dist/index.d.mts.map +1 -1
  12. package/dist/index.mjs +215 -12
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/ops.cjs +85 -0
  15. package/dist/ops.cjs.map +1 -0
  16. package/dist/ops.d.cts +61 -0
  17. package/dist/ops.d.cts.map +1 -0
  18. package/dist/ops.d.mts +61 -0
  19. package/dist/ops.d.mts.map +1 -0
  20. package/dist/ops.mjs +79 -0
  21. package/dist/ops.mjs.map +1 -0
  22. package/dist/{react-riTxd9ce.cjs → react-CkAQg9wB.cjs} +72 -7
  23. package/dist/react-CkAQg9wB.cjs.map +1 -0
  24. package/dist/{react-DqnINwTi.mjs → react-Cq3xULOr.mjs} +72 -7
  25. package/dist/react-Cq3xULOr.mjs.map +1 -0
  26. package/dist/{react-CLONxcnA.d.cts → react-D-Sf973d.d.cts} +94 -2
  27. package/dist/react-D-Sf973d.d.cts.map +1 -0
  28. package/dist/{react-CLONxcnA.d.mts → react-D-Sf973d.d.mts} +94 -2
  29. package/dist/react-D-Sf973d.d.mts.map +1 -0
  30. package/dist/shell.cjs +68 -4
  31. package/dist/shell.cjs.map +1 -1
  32. package/dist/shell.d.cts +62 -7
  33. package/dist/shell.d.cts.map +1 -1
  34. package/dist/shell.d.mts +62 -7
  35. package/dist/shell.d.mts.map +1 -1
  36. package/dist/shell.mjs +66 -5
  37. package/dist/shell.mjs.map +1 -1
  38. package/package.json +13 -2
  39. package/dist/react-CLONxcnA.d.cts.map +0 -1
  40. package/dist/react-CLONxcnA.d.mts.map +0 -1
  41. package/dist/react-DqnINwTi.mjs.map +0 -1
  42. package/dist/react-riTxd9ce.cjs.map +0 -1
@@ -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
@@ -569,6 +654,13 @@ interface UseSemanticQueryInput {
569
654
  time_dimensions?: SemanticTimeDimension[];
570
655
  filters?: SemanticFilter[];
571
656
  limit?: number;
657
+ /**
658
+ * `"reach"` — pin the query server-side to the viewer's places: one `in`
659
+ * filter per view it names whose primary entity is bound to the org's
660
+ * locations registry. The bundle's own app is sent along so app-admin
661
+ * standing counts. A query naming no bound view is refused.
662
+ */
663
+ scope?: "reach";
572
664
  }
573
665
  interface UseSemanticQueryOpts {
574
666
  /** Set false to skip the request (e.g., waiting on user input). */
@@ -829,4 +921,4 @@ interface OxyChatProps {
829
921
  declare function OxyChat(props: OxyChatProps): React.JSX.Element;
830
922
  //#endregion
831
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 };
832
- //# sourceMappingURL=react-CLONxcnA.d.cts.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;;;;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;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
@@ -569,6 +654,13 @@ interface UseSemanticQueryInput {
569
654
  time_dimensions?: SemanticTimeDimension[];
570
655
  filters?: SemanticFilter[];
571
656
  limit?: number;
657
+ /**
658
+ * `"reach"` — pin the query server-side to the viewer's places: one `in`
659
+ * filter per view it names whose primary entity is bound to the org's
660
+ * locations registry. The bundle's own app is sent along so app-admin
661
+ * standing counts. A query naming no bound view is refused.
662
+ */
663
+ scope?: "reach";
572
664
  }
573
665
  interface UseSemanticQueryOpts {
574
666
  /** Set false to skip the request (e.g., waiting on user input). */
@@ -829,4 +921,4 @@ interface OxyChatProps {
829
921
  declare function OxyChat(props: OxyChatProps): React.JSX.Element;
830
922
  //#endregion
831
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 };
832
- //# sourceMappingURL=react-CLONxcnA.d.mts.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;;;;;;;;;;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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HANGED
@@ -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-riTxd9ce.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");
@@ -1787,7 +1787,7 @@ function ShellRail({ top, groups, footerItems, bottom, className }) {
1787
1787
  * endpoint), so errors are surfaced on the result, never thrown.
1788
1788
  */
1789
1789
  function useShellContext() {
1790
- const { projectId, fetcher } = require_react.useOxyApp();
1790
+ const { projectId, appId, fetcher } = require_react.useOxyApp();
1791
1791
  const [state, setState] = react.useState({
1792
1792
  data: null,
1793
1793
  loading: true,
@@ -1803,7 +1803,8 @@ function useShellContext() {
1803
1803
  return;
1804
1804
  }
1805
1805
  let cancelled = false;
1806
- fetcher(`/api/projects/${projectId}/shell-context`, { method: "GET" }).then(async (resp) => {
1806
+ const query = appId ? `?app=${encodeURIComponent(appId)}` : "";
1807
+ fetcher(`/api/projects/${projectId}/shell-context${query}`, { method: "GET" }).then(async (resp) => {
1807
1808
  if (!resp.ok) throw new Error(`shell-context failed: HTTP ${resp.status}`);
1808
1809
  const data = await resp.json();
1809
1810
  if (!cancelled) setState({
@@ -1823,9 +1824,69 @@ function useShellContext() {
1823
1824
  return () => {
1824
1825
  cancelled = true;
1825
1826
  };
1826
- }, [projectId, fetcher]);
1827
+ }, [
1828
+ projectId,
1829
+ appId,
1830
+ fetcher
1831
+ ]);
1827
1832
  return state;
1828
1833
  }
1834
+ const NOWHERE = {
1835
+ everywhere: false,
1836
+ via: null,
1837
+ locations: []
1838
+ };
1839
+ /**
1840
+ * The viewer, in one shape, on every server version: who is signed in, the
1841
+ * crew-or-office signal, and where they work — for a greeting, a "your
1842
+ * store" default, or hiding a tab. Never for authorization: a browser can
1843
+ * edit what it renders, and the function's `ctx.user.reach` is the gate.
1844
+ */
1845
+ function useIdentity() {
1846
+ const { data, loading } = useShellContext();
1847
+ const u = data?.user ?? null;
1848
+ return {
1849
+ id: u?.id ?? null,
1850
+ name: u?.name ?? "",
1851
+ email: u?.email ? u.email : null,
1852
+ picture: u?.picture ?? null,
1853
+ kind: u?.kind ?? null,
1854
+ reach: u?.reach ?? NOWHERE,
1855
+ loading
1856
+ };
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
+ }
1829
1890
 
1830
1891
  //#endregion
1831
1892
  //#region src/shell/TopBar.tsx
@@ -2168,6 +2229,9 @@ exports.WorkspaceClock = WorkspaceClock;
2168
2229
  exports.WorkspaceTile = WorkspaceTile;
2169
2230
  exports.buildTraceSteps = buildTraceSteps;
2170
2231
  exports.fetchThreadTranscript = fetchThreadTranscript;
2232
+ exports.signOut = signOut;
2233
+ exports.signOutUrl = signOutUrl;
2234
+ exports.useIdentity = useIdentity;
2171
2235
  exports.useShellContext = useShellContext;
2172
2236
  exports.useThreadHistory = useThreadHistory;
2173
2237
  exports.workspaceLogoUrl = workspaceLogoUrl;