@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
package/dist/shell.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
- import { a as AppFetcher, n as AgentRunEvent } from "./react-CLONxcnA.cjs";
2
+ import { a as AppFetcher, n as AgentRunEvent } from "./react-D-Sf973d.cjs";
3
+ import { _ as OxyReach } from "./function-context-D8eyZuw_.cjs";
3
4
  import * as React from "react";
4
5
  import { ReactNode } from "react";
5
6
  //#region src/shell/AnswerChart.d.ts
@@ -228,17 +229,31 @@ interface ShellContextData {
228
229
  /** Product-surface navigation targets, host-aware. `settings` opens the
229
230
  * Unified Settings Dialog via the SPA's `?settings=<section>` deep link
230
231
  * (optional: absent on servers older than the link). */
232
+ /** `login` is the product's login page, for `signOut()`; absent on a server that predates it. */
231
233
  links: {
232
234
  home: string;
233
235
  threads: string;
234
236
  settings?: string;
237
+ login?: string;
235
238
  };
236
239
  /** Viewer display identity; null on unauthenticated/local modes. */
237
- user: {
238
- name: string;
239
- email: string;
240
- picture?: string | null;
241
- } | null;
240
+ user: ShellContextUser | null;
241
+ }
242
+ /**
243
+ * The viewer, for display. `id`, `kind` and `reach` arrive on servers that
244
+ * carry the operating graph (2026-09-07 on) and are absent before — read them
245
+ * through `useIdentity()`, which fills the gaps with the fail-closed answer.
246
+ * None of this is a gate: the function's `ctx.user` is.
247
+ */
248
+ interface ShellContextUser {
249
+ name: string;
250
+ /** Empty for a frontline worker, who has no mailbox. */
251
+ email: string;
252
+ picture?: string | null;
253
+ id?: string;
254
+ /** `member` holds an org membership; `frontline` is a crew member. */
255
+ kind?: "member" | "frontline";
256
+ reach?: OxyReach | null;
242
257
  }
243
258
  interface UseShellContextResult {
244
259
  data: ShellContextData | null;
@@ -252,6 +267,46 @@ interface UseShellContextResult {
252
267
  * endpoint), so errors are surfaced on the result, never thrown.
253
268
  */
254
269
  declare function useShellContext(): UseShellContextResult;
270
+ /** What `useIdentity()` returns. */
271
+ interface ViewerIdentity {
272
+ id: string | null;
273
+ name: string;
274
+ /** `null` for a frontline worker — the crew signal, as in `ctx.user.email`. */
275
+ email: string | null;
276
+ picture: string | null;
277
+ kind: "member" | "frontline" | null;
278
+ /** Display-only reach; the fail-closed answer until the server says otherwise. */
279
+ reach: OxyReach;
280
+ loading: boolean;
281
+ }
282
+ /**
283
+ * The viewer, in one shape, on every server version: who is signed in, the
284
+ * crew-or-office signal, and where they work — for a greeting, a "your
285
+ * store" default, or hiding a tab. Never for authorization: a browser can
286
+ * edit what it renders, and the function's `ctx.user.reach` is the gate.
287
+ */
288
+ declare function useIdentity(): ViewerIdentity;
289
+ /**
290
+ * Where a signed-out person lands: the product's login page, with this app
291
+ * as the place to come back to.
292
+ *
293
+ * `loginUrl` is `links.login` from the shell context — the product host's,
294
+ * which a custom-app subdomain cannot derive — and `/login` on the current
295
+ * origin when the context is unavailable or the server predates the field.
296
+ * `returnTo` is the app's own address, which it knows legitimately.
297
+ */
298
+ declare function signOutUrl(loginUrl: string | null | undefined, returnTo: string): string;
299
+ /**
300
+ * End the platform session, then leave for the login page.
301
+ *
302
+ * `GET /api/logout` clears the session cookie server-side. That is the same
303
+ * cookie a crew member's PIN session rides, so on an enrolled tablet the login
304
+ * page comes back as "Who's on shift?" and returns to the app after the next
305
+ * PIN; elsewhere it is the ordinary sign-in. Throws when the server refused,
306
+ * so a caller can say so rather than navigate away from a session that still
307
+ * exists. Pass the app's `fetcher` from `useOxyApp()` so credentials ride.
308
+ */
309
+ declare function signOut(fetcher: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>, loginUrl?: string | null, returnTo?: string): Promise<void>;
255
310
  //#endregion
256
311
  //#region src/shell/Tooltip.d.ts
257
312
  /**
@@ -342,5 +397,5 @@ declare function WorkspaceTile({ name, logoUrl }: {
342
397
  logoUrl?: string;
343
398
  }): import("react").JSX.Element;
344
399
  //#endregion
345
- export { AnswerChart, type AnswerChartProps, AskDock, type AskDockProps, Breadcrumb, type ChartBlock, type ChartBlockConfig, OXY_MARK_PATH, OxyMark, OxyShell, type OxyShellProps, OxygenFactoryMark, type RailItem, ReasoningTrace, type ReasoningTraceProps, type ShellContextApp, type ShellContextData, ShellRail, ShellTooltip, SystemIndicator, type ThreadSummary, type ThreadTranscript, TopBar, type TraceItem, type TraceStep, type TraceStepStatus, type TranscriptTurn, type UseShellContextResult, type UseThreadHistoryResult, WorkspaceClock, WorkspaceTile, buildTraceSteps, fetchThreadTranscript, useShellContext, useThreadHistory, workspaceLogoUrl };
400
+ export { AnswerChart, type AnswerChartProps, AskDock, type AskDockProps, Breadcrumb, type ChartBlock, type ChartBlockConfig, OXY_MARK_PATH, OxyMark, OxyShell, type OxyShellProps, OxygenFactoryMark, type RailItem, ReasoningTrace, type ReasoningTraceProps, type ShellContextApp, type ShellContextData, type ShellContextUser, ShellRail, ShellTooltip, SystemIndicator, type ThreadSummary, type ThreadTranscript, TopBar, type TraceItem, type TraceStep, type TraceStepStatus, type TranscriptTurn, type UseShellContextResult, type UseThreadHistoryResult, type ViewerIdentity, WorkspaceClock, WorkspaceTile, buildTraceSteps, fetchThreadTranscript, signOut, signOutUrl, useIdentity, useShellContext, useThreadHistory, workspaceLogoUrl };
346
401
  //# sourceMappingURL=shell.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.cts","names":[],"sources":["../src/shell/AnswerChart.tsx","../src/shell/AskDock.tsx","../src/shell/logoUrl.ts","../src/shell/marks.tsx","../src/shell/OxyShell.tsx","../src/shell/trace.ts","../src/shell/ReasoningTrace.tsx","../src/shell/ShellRail.tsx","../src/shell/shellContext.ts","../src/shell/Tooltip.tsx","../src/shell/TopBar.tsx","../src/shell/threadHistory.ts","../src/shell/WorkspaceTile.tsx"],"mappings":";;;;;UAYiB;EACf;EACA;EACA;EACA;E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;;;UAGtB;EACf,MAAM;EACN;EACA,OAAO;;;;;;;;iBASO,mBAAmB;;;;;;;;iBC/CnB,eACd,SACA,MACA;EAEA,SAAS,MAAM;EACf;EACA,UAAU,MAAM;IACjB,MAAA,IAAA;;;;;iBCNe,SACd,MACA,OACA;EAEA,OAAO;EACP,QAAQ;EACR;oBACD,IAAA;;;;;;iBAqBe,aACd,gBACA,WACA,UACA;EAEA;EACA;EACA;EACA;oBACD,IAAA;;;;;;;iBAmDe,mCAAe,IAAA;;;;;;iBA+Bf,iBAAiB;EAAc;oBAAmB,IAAA;;;UCrHjD;EACf;EACA;EACA;;UAGe;EACf;EACA,QAAQ;;UAGO;EACf;EACA,OAAO;;UAGQ;EACf,SAAS;EACT;EACA,OAAO;;EAEP;;;;;;;iBAQc,oBAAoB;;;;;iBAyCd,sBACpB,SAAS,YACT,mBACA,mBACC,QAAQ;;;;;;iBCnFK,gBAAgB,MAAM;EAAa;EAAc;oBAAkB,IAAA"}
1
+ {"version":3,"file":"shell.d.cts","names":[],"sources":["../src/shell/AnswerChart.tsx","../src/shell/AskDock.tsx","../src/shell/logoUrl.ts","../src/shell/marks.tsx","../src/shell/OxyShell.tsx","../src/shell/trace.ts","../src/shell/ReasoningTrace.tsx","../src/shell/ShellRail.tsx","../src/shell/shellContext.ts","../src/shell/Tooltip.tsx","../src/shell/TopBar.tsx","../src/shell/threadHistory.ts","../src/shell/WorkspaceTile.tsx"],"mappings":";;;;;;UAYiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR;EACA;;UA8ce;EACf,OAAO;EACP;;;;;iBAMc,cAAc,OAAO,aAAa,mBAAgB,MAAA,IAAA;;;UCzUjD;;EAEf;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;;;;;;iBAuEc,UACd,SACA,eACA,aACA,aACA,MACA,SACA,aACC,eAAY,MAAA,IAAA;;;;;;;;cC7PF,mBAAgB,oBAAsB,qBAAqB;;;;cCA3D;;;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ACC;;;;;;;;iBC7Ka,eACd,SACA,MACA;EAEA,SAAS,MAAM;EACf;EACA,UAAU,MAAM;IACjB,MAAA,IAAA;;;;;iBCNe,SACd,MACA,OACA;EAEA,OAAO;EACP,QAAQ;EACR;oBACD,IAAA;;;;;;iBAqBe,aACd,gBACA,WACA,UACA;EAEA;EACA;EACA;EACA;oBACD,IAAA;;;;;;;iBAmDe,mCAAe,IAAA;;;;;;iBA+Bf,iBAAiB;EAAc;oBAAmB,IAAA;;;UCrHjD;EACf;EACA;EACA;;UAGe;EACf;EACA,QAAQ;;UAGO;EACf;EACA,OAAO;;UAGQ;EACf,SAAS;EACT;EACA,OAAO;;EAEP;;;;;;;iBAQc,oBAAoB;;;;;iBAyCd,sBACpB,SAAS,YACT,mBACA,mBACC,QAAQ;;;;;;iBCnFK,gBAAgB,MAAM;EAAa;EAAc;oBAAkB,IAAA"}
package/dist/shell.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
- import { a as AppFetcher, n as AgentRunEvent } from "./react-CLONxcnA.mjs";
2
+ import { a as AppFetcher, n as AgentRunEvent } from "./react-D-Sf973d.mjs";
3
+ import { _ as OxyReach } from "./function-context-D8eyZuw_.mjs";
3
4
  import * as React from "react";
4
5
  import { ReactNode } from "react";
5
6
  //#region src/shell/AnswerChart.d.ts
@@ -228,17 +229,31 @@ interface ShellContextData {
228
229
  /** Product-surface navigation targets, host-aware. `settings` opens the
229
230
  * Unified Settings Dialog via the SPA's `?settings=<section>` deep link
230
231
  * (optional: absent on servers older than the link). */
232
+ /** `login` is the product's login page, for `signOut()`; absent on a server that predates it. */
231
233
  links: {
232
234
  home: string;
233
235
  threads: string;
234
236
  settings?: string;
237
+ login?: string;
235
238
  };
236
239
  /** Viewer display identity; null on unauthenticated/local modes. */
237
- user: {
238
- name: string;
239
- email: string;
240
- picture?: string | null;
241
- } | null;
240
+ user: ShellContextUser | null;
241
+ }
242
+ /**
243
+ * The viewer, for display. `id`, `kind` and `reach` arrive on servers that
244
+ * carry the operating graph (2026-09-07 on) and are absent before — read them
245
+ * through `useIdentity()`, which fills the gaps with the fail-closed answer.
246
+ * None of this is a gate: the function's `ctx.user` is.
247
+ */
248
+ interface ShellContextUser {
249
+ name: string;
250
+ /** Empty for a frontline worker, who has no mailbox. */
251
+ email: string;
252
+ picture?: string | null;
253
+ id?: string;
254
+ /** `member` holds an org membership; `frontline` is a crew member. */
255
+ kind?: "member" | "frontline";
256
+ reach?: OxyReach | null;
242
257
  }
243
258
  interface UseShellContextResult {
244
259
  data: ShellContextData | null;
@@ -252,6 +267,46 @@ interface UseShellContextResult {
252
267
  * endpoint), so errors are surfaced on the result, never thrown.
253
268
  */
254
269
  declare function useShellContext(): UseShellContextResult;
270
+ /** What `useIdentity()` returns. */
271
+ interface ViewerIdentity {
272
+ id: string | null;
273
+ name: string;
274
+ /** `null` for a frontline worker — the crew signal, as in `ctx.user.email`. */
275
+ email: string | null;
276
+ picture: string | null;
277
+ kind: "member" | "frontline" | null;
278
+ /** Display-only reach; the fail-closed answer until the server says otherwise. */
279
+ reach: OxyReach;
280
+ loading: boolean;
281
+ }
282
+ /**
283
+ * The viewer, in one shape, on every server version: who is signed in, the
284
+ * crew-or-office signal, and where they work — for a greeting, a "your
285
+ * store" default, or hiding a tab. Never for authorization: a browser can
286
+ * edit what it renders, and the function's `ctx.user.reach` is the gate.
287
+ */
288
+ declare function useIdentity(): ViewerIdentity;
289
+ /**
290
+ * Where a signed-out person lands: the product's login page, with this app
291
+ * as the place to come back to.
292
+ *
293
+ * `loginUrl` is `links.login` from the shell context — the product host's,
294
+ * which a custom-app subdomain cannot derive — and `/login` on the current
295
+ * origin when the context is unavailable or the server predates the field.
296
+ * `returnTo` is the app's own address, which it knows legitimately.
297
+ */
298
+ declare function signOutUrl(loginUrl: string | null | undefined, returnTo: string): string;
299
+ /**
300
+ * End the platform session, then leave for the login page.
301
+ *
302
+ * `GET /api/logout` clears the session cookie server-side. That is the same
303
+ * cookie a crew member's PIN session rides, so on an enrolled tablet the login
304
+ * page comes back as "Who's on shift?" and returns to the app after the next
305
+ * PIN; elsewhere it is the ordinary sign-in. Throws when the server refused,
306
+ * so a caller can say so rather than navigate away from a session that still
307
+ * exists. Pass the app's `fetcher` from `useOxyApp()` so credentials ride.
308
+ */
309
+ declare function signOut(fetcher: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>, loginUrl?: string | null, returnTo?: string): Promise<void>;
255
310
  //#endregion
256
311
  //#region src/shell/Tooltip.d.ts
257
312
  /**
@@ -342,5 +397,5 @@ declare function WorkspaceTile({ name, logoUrl }: {
342
397
  logoUrl?: string;
343
398
  }): import("react").JSX.Element;
344
399
  //#endregion
345
- export { AnswerChart, type AnswerChartProps, AskDock, type AskDockProps, Breadcrumb, type ChartBlock, type ChartBlockConfig, OXY_MARK_PATH, OxyMark, OxyShell, type OxyShellProps, OxygenFactoryMark, type RailItem, ReasoningTrace, type ReasoningTraceProps, type ShellContextApp, type ShellContextData, ShellRail, ShellTooltip, SystemIndicator, type ThreadSummary, type ThreadTranscript, TopBar, type TraceItem, type TraceStep, type TraceStepStatus, type TranscriptTurn, type UseShellContextResult, type UseThreadHistoryResult, WorkspaceClock, WorkspaceTile, buildTraceSteps, fetchThreadTranscript, useShellContext, useThreadHistory, workspaceLogoUrl };
400
+ export { AnswerChart, type AnswerChartProps, AskDock, type AskDockProps, Breadcrumb, type ChartBlock, type ChartBlockConfig, OXY_MARK_PATH, OxyMark, OxyShell, type OxyShellProps, OxygenFactoryMark, type RailItem, ReasoningTrace, type ReasoningTraceProps, type ShellContextApp, type ShellContextData, type ShellContextUser, ShellRail, ShellTooltip, SystemIndicator, type ThreadSummary, type ThreadTranscript, TopBar, type TraceItem, type TraceStep, type TraceStepStatus, type TranscriptTurn, type UseShellContextResult, type UseThreadHistoryResult, type ViewerIdentity, WorkspaceClock, WorkspaceTile, buildTraceSteps, fetchThreadTranscript, signOut, signOutUrl, useIdentity, useShellContext, useThreadHistory, workspaceLogoUrl };
346
401
  //# sourceMappingURL=shell.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.mts","names":[],"sources":["../src/shell/AnswerChart.tsx","../src/shell/AskDock.tsx","../src/shell/logoUrl.ts","../src/shell/marks.tsx","../src/shell/OxyShell.tsx","../src/shell/trace.ts","../src/shell/ReasoningTrace.tsx","../src/shell/ShellRail.tsx","../src/shell/shellContext.ts","../src/shell/Tooltip.tsx","../src/shell/TopBar.tsx","../src/shell/threadHistory.ts","../src/shell/WorkspaceTile.tsx"],"mappings":";;;;;UAYiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR;EACA;;UA8ce;EACf,OAAO;EACP;;;;;iBAMc,cAAc,OAAO,aAAa,mBAAgB,MAAA,IAAA;;;UCzUjD;;EAEf;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;;;;;;iBAuEc,UACd,SACA,eACA,aACA,aACA,MACA,SACA,aACC,eAAY,MAAA,IAAA;;;;;;;;cC7PF,mBAAgB,oBAAsB,qBAAqB;;;;cCA3D;;;iBAKG,UAAU;EAAe;oBAAoB,IAAA;;;;;;iBAyB7C,oBAAoB;EAAe;oBAAoB,IAAA;;;UC+BtD;EACf,UAAU;;EAEV;;;;;EAKA,aAAa;;;EAGb,cAAc;;;EAGd,aAAa;;EAEb;;;EAGA;;;;;;;;EAQA;EACA;;;;;EAKA;;;;EAIA;;;;;;iBAsDc,WACd,UACA,WACA,YACA,aACA,YACA,YACA,WACA,gBACA,WACA,kBACA,oBACC,gCAAa,IAAA;;;KC9JJ;UAEK;EACf;EACA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,QAAQ;EACR,OAAO;;;;iBA8IO,gBAAgB,QAAQ,kBAAkB;;;UCvDzC;EACf,OAAO;;EAEP;;EAEA;IAAQ;IAAe;;EACvB;;;;iBAKc,iBAAiB,OAAO,WAAmB,KAAK,aAAa,sCAAmB,IAAA;;;;;;;KCxHpF;EACV;EACA;;;EAGA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;;;;;;;iBAuDc,YACd,KACA,QACA,aACA,QACA;EAEA,MAAM;EACN,QAAQ;EACR,cAAc;EACd,SAAS;EACT;oBACD,IAAA;;;UC9EgB;EACf;EACA;EACA;;EAEA;EACA;;;EAGA;;EAEA;;UAGe;EACf;IAAa;IAAY;;EACzB;IAAO;IAAY;IAAc;;;EAEjC;;EAEA,MAAM;;;;EAIN;IAAS;IAAc;IAAiB;;;EAExC;IAAQ;IAAc;IAAe;;;UAGtB;EACf,MAAM;EACN;EACA,OAAO;;;;;;;;iBASO,mBAAmB;;;;;;;;iBC/CnB,eACd,SACA,MACA;EAEA,SAAS,MAAM;EACf;EACA,UAAU,MAAM;IACjB,MAAA,IAAA;;;;;iBCNe,SACd,MACA,OACA;EAEA,OAAO;EACP,QAAQ;EACR;oBACD,IAAA;;;;;;iBAqBe,aACd,gBACA,WACA,UACA;EAEA;EACA;EACA;EACA;oBACD,IAAA;;;;;;;iBAmDe,mCAAe,IAAA;;;;;;iBA+Bf,iBAAiB;EAAc;oBAAmB,IAAA;;;UCrHjD;EACf;EACA;EACA;;UAGe;EACf;EACA,QAAQ;;UAGO;EACf;EACA,OAAO;;UAGQ;EACf,SAAS;EACT;EACA,OAAO;;EAEP;;;;;;;iBAQc,oBAAoB;;;;;iBAyCd,sBACpB,SAAS,YACT,mBACA,mBACC,QAAQ;;;;;;iBCnFK,gBAAgB,MAAM;EAAa;EAAc;oBAAkB,IAAA"}
1
+ {"version":3,"file":"shell.d.mts","names":[],"sources":["../src/shell/AnswerChart.tsx","../src/shell/AskDock.tsx","../src/shell/logoUrl.ts","../src/shell/marks.tsx","../src/shell/OxyShell.tsx","../src/shell/trace.ts","../src/shell/ReasoningTrace.tsx","../src/shell/ShellRail.tsx","../src/shell/shellContext.ts","../src/shell/Tooltip.tsx","../src/shell/TopBar.tsx","../src/shell/threadHistory.ts","../src/shell/WorkspaceTile.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N;IAAS;IAAc;IAAiB;IAAmB;;;EAE3D,MAAM;;;;;;;;UASS;EACf;;EAEA;EACA;EACA;;EAEA;EACA,QAAQ;;UAGO;EACf,MAAM;EACN;EACA,OAAO;;;;;;;;iBASO,mBAAmB;;UA4ClB;EACf;EACA;;EAEA;EACA;EACA;;EAEA,OAAO;EACP;;;;;;;;iBAWc,eAAe;;;;;;;;;;iBAuBf,WAAW,qCAAqC;;;;;;;;;;;iBAgB1C,QACpB,UAAU,OAAO,cAAc,KAAK,OAAO,gBAAgB,QAAQ,WACnE,0BACA,oBACC;;;;;;;;iBC7Ka,eACd,SACA,MACA;EAEA,SAAS,MAAM;EACf;EACA,UAAU,MAAM;IACjB,MAAA,IAAA;;;;;iBCNe,SACd,MACA,OACA;EAEA,OAAO;EACP,QAAQ;EACR;oBACD,IAAA;;;;;;iBAqBe,aACd,gBACA,WACA,UACA;EAEA;EACA;EACA;EACA;oBACD,IAAA;;;;;;;iBAmDe,mCAAe,IAAA;;;;;;iBA+Bf,iBAAiB;EAAc;oBAAmB,IAAA;;;UCrHjD;EACf;EACA;EACA;;UAGe;EACf;EACA,QAAQ;;UAGO;EACf;EACA,OAAO;;UAGQ;EACf,SAAS;EACT;EACA,OAAO;;EAEP;;;;;;;iBAQc,oBAAoB;;;;;iBAyCd,sBACpB,SAAS,YACT,mBACA,mBACC,QAAQ;;;;;;iBCnFK,gBAAgB,MAAM;EAAa;EAAc;oBAAkB,IAAA"}
package/dist/shell.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // @oxy/sdk - TypeScript SDK for Oxy data platform
2
- import { i as useAgentRun, l as useResolvedManifest, o as useOxyApp, t as OxyAnswer, v as getOxyAppLogger } from "./react-DqnINwTi.mjs";
2
+ import { i as useAgentRun, l as useResolvedManifest, o as useOxyApp, t as OxyAnswer, v as getOxyAppLogger } from "./react-Cq3xULOr.mjs";
3
3
  import * as React from "react";
4
4
  import { Fragment, useEffect, useMemo, useState } from "react";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -1785,7 +1785,7 @@ function ShellRail({ top, groups, footerItems, bottom, className }) {
1785
1785
  * endpoint), so errors are surfaced on the result, never thrown.
1786
1786
  */
1787
1787
  function useShellContext() {
1788
- const { projectId, fetcher } = useOxyApp();
1788
+ const { projectId, appId, fetcher } = useOxyApp();
1789
1789
  const [state, setState] = React.useState({
1790
1790
  data: null,
1791
1791
  loading: true,
@@ -1801,7 +1801,8 @@ function useShellContext() {
1801
1801
  return;
1802
1802
  }
1803
1803
  let cancelled = false;
1804
- fetcher(`/api/projects/${projectId}/shell-context`, { method: "GET" }).then(async (resp) => {
1804
+ const query = appId ? `?app=${encodeURIComponent(appId)}` : "";
1805
+ fetcher(`/api/projects/${projectId}/shell-context${query}`, { method: "GET" }).then(async (resp) => {
1805
1806
  if (!resp.ok) throw new Error(`shell-context failed: HTTP ${resp.status}`);
1806
1807
  const data = await resp.json();
1807
1808
  if (!cancelled) setState({
@@ -1821,9 +1822,69 @@ function useShellContext() {
1821
1822
  return () => {
1822
1823
  cancelled = true;
1823
1824
  };
1824
- }, [projectId, fetcher]);
1825
+ }, [
1826
+ projectId,
1827
+ appId,
1828
+ fetcher
1829
+ ]);
1825
1830
  return state;
1826
1831
  }
1832
+ const NOWHERE = {
1833
+ everywhere: false,
1834
+ via: null,
1835
+ locations: []
1836
+ };
1837
+ /**
1838
+ * The viewer, in one shape, on every server version: who is signed in, the
1839
+ * crew-or-office signal, and where they work — for a greeting, a "your
1840
+ * store" default, or hiding a tab. Never for authorization: a browser can
1841
+ * edit what it renders, and the function's `ctx.user.reach` is the gate.
1842
+ */
1843
+ function useIdentity() {
1844
+ const { data, loading } = useShellContext();
1845
+ const u = data?.user ?? null;
1846
+ return {
1847
+ id: u?.id ?? null,
1848
+ name: u?.name ?? "",
1849
+ email: u?.email ? u.email : null,
1850
+ picture: u?.picture ?? null,
1851
+ kind: u?.kind ?? null,
1852
+ reach: u?.reach ?? NOWHERE,
1853
+ loading
1854
+ };
1855
+ }
1856
+ /**
1857
+ * Where a signed-out person lands: the product's login page, with this app
1858
+ * as the place to come back to.
1859
+ *
1860
+ * `loginUrl` is `links.login` from the shell context — the product host's,
1861
+ * which a custom-app subdomain cannot derive — and `/login` on the current
1862
+ * origin when the context is unavailable or the server predates the field.
1863
+ * `returnTo` is the app's own address, which it knows legitimately.
1864
+ */
1865
+ function signOutUrl(loginUrl, returnTo) {
1866
+ const base = loginUrl?.trim() ? loginUrl.trim() : "/login";
1867
+ return `${base}${base.includes("?") ? "&" : "?"}return_to=${encodeURIComponent(returnTo)}`;
1868
+ }
1869
+ /**
1870
+ * End the platform session, then leave for the login page.
1871
+ *
1872
+ * `GET /api/logout` clears the session cookie server-side. That is the same
1873
+ * cookie a crew member's PIN session rides, so on an enrolled tablet the login
1874
+ * page comes back as "Who's on shift?" and returns to the app after the next
1875
+ * PIN; elsewhere it is the ordinary sign-in. Throws when the server refused,
1876
+ * so a caller can say so rather than navigate away from a session that still
1877
+ * exists. Pass the app's `fetcher` from `useOxyApp()` so credentials ride.
1878
+ */
1879
+ async function signOut(fetcher, loginUrl, returnTo) {
1880
+ const res = await fetcher("/api/logout", {
1881
+ method: "GET",
1882
+ credentials: "include"
1883
+ });
1884
+ if (!res.ok) throw new Error(`sign-out refused: HTTP ${res.status}`);
1885
+ if (typeof window === "undefined") return;
1886
+ window.location.assign(signOutUrl(loginUrl, returnTo ?? window.location.href));
1887
+ }
1827
1888
 
1828
1889
  //#endregion
1829
1890
  //#region src/shell/TopBar.tsx
@@ -2150,5 +2211,5 @@ function OxyShell({ children, pageLabel, topBarLeft, topBarExtra, railBottom, hi
2150
2211
  }
2151
2212
 
2152
2213
  //#endregion
2153
- export { AnswerChart, AskDock, Breadcrumb, OXY_MARK_PATH, OxyMark, OxyShell, OxygenFactoryMark, ReasoningTrace, ShellRail, ShellTooltip, SystemIndicator, TopBar, WorkspaceClock, WorkspaceTile, buildTraceSteps, fetchThreadTranscript, useShellContext, useThreadHistory, workspaceLogoUrl };
2214
+ export { AnswerChart, AskDock, Breadcrumb, OXY_MARK_PATH, OxyMark, OxyShell, OxygenFactoryMark, ReasoningTrace, ShellRail, ShellTooltip, SystemIndicator, TopBar, WorkspaceClock, WorkspaceTile, buildTraceSteps, fetchThreadTranscript, signOut, signOutUrl, useIdentity, useShellContext, useThreadHistory, workspaceLogoUrl };
2154
2215
  //# sourceMappingURL=shell.mjs.map