@oxy-hq/sdk 2.3.0 → 2.5.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.
@@ -0,0 +1,346 @@
1
+
2
+ import { a as AppFetcher, n as AgentRunEvent } from "./react-BnpR8VRJ.mjs";
3
+ import * as React from "react";
4
+ import { ReactNode } from "react";
5
+ //#region src/shell/AnswerChart.d.ts
6
+ interface ChartBlockConfig {
7
+ chart_type: "line_chart" | "bar_chart" | "pie_chart" | "table";
8
+ x?: string;
9
+ y?: string;
10
+ series?: string;
11
+ name?: string;
12
+ value?: string;
13
+ title?: string;
14
+ x_axis_label?: string;
15
+ y_axis_label?: string;
16
+ }
17
+ interface ChartBlock {
18
+ config: ChartBlockConfig;
19
+ columns: string[];
20
+ rows: unknown[][];
21
+ }
22
+ interface AnswerChartProps {
23
+ block: ChartBlock;
24
+ className?: string;
25
+ }
26
+ /** Renders one `chart_rendered` block. Uses ECharts (interactive, matching
27
+ * the main web-app) when the host app has it installed; otherwise falls
28
+ * back to a dependency-free SVG render. Table type always uses SVG. */
29
+ declare function AnswerChart({ block, className }: AnswerChartProps): React.JSX.Element;
30
+ //#endregion
31
+ //#region src/shell/AskDock.d.ts
32
+ interface AskDockProps {
33
+ /** Agent the panel asks (the app manifest's `ask.agent`). */
34
+ agentId: string;
35
+ /** Workspace display name for the composer placeholder. */
36
+ workspaceName?: string;
37
+ /** Suggested-question chips shown before the first ask. */
38
+ suggestions?: string[];
39
+ /** "Open chat in Oxygen" header link target (product Chat surface). */
40
+ threadsHref?: string;
41
+ open: boolean;
42
+ onClose: () => void;
43
+ className?: string;
44
+ }
45
+ /**
46
+ * The Ask Oxygen drawer. Keep it mounted and toggle `open` — the
47
+ * transcript survives close/reopen, matching the web-app dock.
48
+ */
49
+ declare function AskDock({ agentId, workspaceName, suggestions, threadsHref, open, onClose, className }: AskDockProps): React.JSX.Element;
50
+ //#endregion
51
+ //#region src/shell/logoUrl.d.ts
52
+ /** URL of the workspace logo endpoint (org-uploaded logo, falling back to
53
+ * the code-first file). Consumers render an `<img>` and fall back on error.
54
+ * `apiBaseUrl` is the API root (e.g. `"/api"` same-origin, or an absolute
55
+ * base in dev); pass `version` (the org's `updated_at`) to bust the cache
56
+ * after an upload/remove. */
57
+ declare const workspaceLogoUrl: (apiBaseUrl: string, workspaceId: string, version?: string) => string;
58
+ //#endregion
59
+ //#region src/shell/marks.d.ts
60
+ /** The Oxygen "O" glyph path, in a 0 0 44 44 viewBox, used by `OxyMark`. */
61
+ declare const OXY_MARK_PATH = "M38.4 22C39.2837 22 40.0074 22.7178 39.9289 23.5979C39.6619 26.5942 38.6471 29.485 36.9665 32.0003C34.9886 34.9603 32.1774 37.2674 28.8883 38.6298C25.5992 39.9922 21.98 40.3487 18.4884 39.6541C14.9967 38.9596 11.7894 37.2453 9.27209 34.7279C6.75474 32.2106 5.04041 29.0033 4.34587 25.5116C3.65134 22.02 4.0078 18.4008 5.37018 15.1117C6.73255 11.8226 9.03966 9.0114 11.9997 7.03353C14.515 5.35287 17.4058 4.33807 20.4021 4.07104C21.2822 3.9926 22 4.71633 22 5.59998L22 11.2C22 12.0837 22.7163 12.8 23.6 12.8H29.2C30.0837 12.8 30.8 12.0837 30.8 11.2V5.6C30.8 4.71634 31.5163 4 32.4 4H38.4C39.2836 4 40 4.71634 40 5.6V11.6C40 12.4837 39.2836 13.2 38.4 13.2H32.8C31.9163 13.2 31.2 13.9163 31.2 14.8V20.4C31.2 21.2837 31.9163 22 32.8 22L38.4 22ZM23.6 22C22.7163 22 22 21.2837 22 20.4L22 14.8371C22 13.9534 21.2778 13.2223 20.4089 13.3827C19.2427 13.5981 18.1268 14.0489 17.1316 14.7139C15.6905 15.6768 14.5674 17.0454 13.9041 18.6466C13.2409 20.2478 13.0674 22.0097 13.4055 23.7095C13.7436 25.4094 14.5782 26.9708 15.8037 28.1963C17.0292 29.4218 18.5906 30.2564 20.2904 30.5945C21.9903 30.9326 23.7522 30.7591 25.3534 30.0959C26.9546 29.4326 28.3232 28.3095 29.2861 26.8684C29.9511 25.8732 30.4019 24.7573 30.6172 23.5911C30.7777 22.7222 30.0466 22 29.1629 22L23.6 22Z";
62
+ /** The Oxygen "O" mark as an inline SVG that inherits `currentColor`, so it
63
+ * reads correctly on any surface in light or dark mode. */
64
+ declare function OxyMark({ className }: {
65
+ className?: string;
66
+ }): import("react").JSX.Element;
67
+ /** The Oxygen Factory mark (three-shard glyph) as an inline SVG in
68
+ * `currentColor`, so it follows the shell foreground in either theme.
69
+ * (The web-app's asset files are fixed-color; this inline variant frees
70
+ * external bundles from carrying those assets.) Decorative — the rail
71
+ * button supplies the "Oxygen Factory" aria-label. */
72
+ declare function OxygenFactoryMark({ className }: {
73
+ className?: string;
74
+ }): import("react").JSX.Element;
75
+ //#endregion
76
+ //#region src/shell/OxyShell.d.ts
77
+ interface OxyShellProps {
78
+ children: ReactNode;
79
+ /** Breadcrumb page label; defaults to this app's registered name. */
80
+ pageLabel?: string;
81
+ /** Replace the top bar's left side (the default workspace/page
82
+ * breadcrumb) with the app's own brand/header content. Host-provided
83
+ * slots keep rendering even when the shell bootstrap is unavailable,
84
+ * so the app never loses its header by adopting the shell. */
85
+ topBarLeft?: ReactNode;
86
+ /** Extra right-side top bar content, rendered after the status cluster
87
+ * (Sys · clock) and before the Ask Oxygen button. */
88
+ topBarExtra?: ReactNode;
89
+ /** Rail bottom slot content. The shell adds no built-in entries here —
90
+ * a bundle that wants a Settings link supplies its own. */
91
+ railBottom?: ReactNode;
92
+ /** Drop the top bar and keep only the rail. */
93
+ hideTopBar?: boolean;
94
+ /** Bind ⌘K / Ctrl+K to toggle the Ask dock (default true). Set false
95
+ * when the host app owns that shortcut; the top-bar button still works. */
96
+ askHotkey?: boolean;
97
+ /** Origin of the Oxygen product (e.g. `https://app.oxygen-hq.com`).
98
+ * shell-context returns product links as relative paths, which resolve
99
+ * correctly when oxy serves the bundle (production, org subdomain). In
100
+ * local dev the bundle runs on its own Vite origin, so those paths would
101
+ * resolve to the app's origin, not oxy's — set this to the oxy origin
102
+ * and the shell rewrites Home / Chat / Settings / app links to absolute
103
+ * URLs. Leave unset in production. */
104
+ productBaseUrl?: string;
105
+ className?: string;
106
+ /** Background of the shell chrome — the icon rail, the top bar, and the
107
+ * AskDock (they share one token). Any CSS color, including `var(--…)` to
108
+ * track a host token (e.g. `var(--background)` to match the app's canvas).
109
+ * Overrides the theme's default; leave unset to keep it. */
110
+ chromeBackground?: string;
111
+ /** Text/icon color on the chrome, paired with `chromeBackground` for
112
+ * contrast when using a background outside the current light/dark family.
113
+ * Unset keeps the theme's foreground. */
114
+ chromeForeground?: string;
115
+ }
116
+ /**
117
+ * The workspace chrome around a customer app: icon rail + universal top bar
118
+ * + content column — visually identical to the main web-app shell.
119
+ */
120
+ declare function OxyShell({ children, pageLabel, topBarLeft, topBarExtra, railBottom, hideTopBar, askHotkey, productBaseUrl, className, chromeBackground, chromeForeground }: OxyShellProps): import("react").JSX.Element;
121
+ //#endregion
122
+ //#region src/shell/trace.d.ts
123
+ type TraceStepStatus = "running" | "done" | "failed" | "suspended";
124
+ interface TraceItem {
125
+ id: string;
126
+ kind: "tool" | "sql" | "note" | "thinking";
127
+ label: string;
128
+ /** Muted inline preview of the tool input / query intent. */
129
+ preview?: string;
130
+ /** Right-aligned detail, e.g. "22 rows · 1.4s". */
131
+ detail?: string;
132
+ /** Body text (thinking items) — rendered as a wrapped paragraph. */
133
+ text?: string;
134
+ /** Full tool input / SQL, pretty-printed — the expandable detail body. */
135
+ input?: string;
136
+ /** Full tool output / result summary, pretty-printed. */
137
+ output?: string;
138
+ error?: boolean;
139
+ running?: boolean;
140
+ }
141
+ interface TraceStep {
142
+ id: string;
143
+ label: string;
144
+ summary?: string;
145
+ status: TraceStepStatus;
146
+ items: TraceItem[];
147
+ }
148
+ /** Fold raw SSE events into display steps. Pure — safe to re-run on every
149
+ * render over the accumulated event array. */
150
+ declare function buildTraceSteps(events: AgentRunEvent[]): TraceStep[];
151
+ //#endregion
152
+ //#region src/shell/ReasoningTrace.d.ts
153
+ interface ReasoningTraceProps {
154
+ steps: TraceStep[];
155
+ /** True while the run is still streaming — keeps the trace expanded. */
156
+ streaming?: boolean;
157
+ /** Header meta from `aggregateLlmStats` (LLM call count + total time). */
158
+ llm?: {
159
+ calls: number;
160
+ totalMs: number;
161
+ };
162
+ className?: string;
163
+ }
164
+ /** Renders nothing when there are no steps (runs whose stream carries no
165
+ * step events degrade to the plain answer, same as before). */
166
+ declare function ReasoningTrace({ steps, streaming, llm, className }: ReasoningTraceProps): import("react").JSX.Element | null;
167
+ //#endregion
168
+ //#region src/shell/ShellRail.d.ts
169
+ /** One rail entry. Provide `imageUrl` (custom app mark, falls back to
170
+ * `letter` on load error), `icon` (any SVG node), or `letter`.
171
+ * `href` renders a real anchor (full-page nav — custom apps live outside
172
+ * the SPA); `onSelect` renders a button (SPA nav, wired by the caller). */
173
+ type RailItem = {
174
+ key: string;
175
+ label: string;
176
+ /** Hover-tooltip text; defaults to `label`. Use for a richer description
177
+ * while keeping `label` short for the aria-label. */
178
+ tooltip?: string;
179
+ testId?: string;
180
+ active?: boolean;
181
+ icon?: ReactNode;
182
+ letter?: string;
183
+ imageUrl?: string;
184
+ href?: string;
185
+ onSelect?: () => void;
186
+ };
187
+ /** The icon rail. `groups` are the conceptual sections (HQ · Apps ·
188
+ * Intelligence), rendered top-down with a hairline divider between them.
189
+ * `footerItems` pin to the bottom of the scroll area as a distinct
190
+ * "system" zone (Oxygen Factory), above the `bottom` account slot
191
+ * (workspace switch · user menu — injected by the host app). */
192
+ declare function ShellRail({ top, groups, footerItems, bottom, className }: {
193
+ top?: ReactNode;
194
+ groups: RailItem[][];
195
+ footerItems?: RailItem[];
196
+ bottom?: ReactNode;
197
+ className?: string;
198
+ }): import("react").JSX.Element;
199
+ //#endregion
200
+ //#region src/shell/shellContext.d.ts
201
+ interface ShellContextApp {
202
+ id: string;
203
+ name: string;
204
+ slug: string;
205
+ /** Ready-to-navigate URL (relative on the same host, absolute across hosts). */
206
+ url: string;
207
+ icon_url?: string | null;
208
+ /** Agent ref the app's Ask Oxygen panel binds to (manifest `ask.agent`).
209
+ * Absent → the shell hides the Ask surface for this app. */
210
+ default_agent?: string | null;
211
+ /** Composer chips for the Ask panel (manifest `ask.suggestedQuestions`). */
212
+ suggested_questions?: string[];
213
+ }
214
+ interface ShellContextData {
215
+ workspace: {
216
+ id: string;
217
+ name: string;
218
+ };
219
+ org: {
220
+ id: string;
221
+ slug: string;
222
+ name: string;
223
+ };
224
+ /** Workspace logo endpoint URL, or null when no logo is configured. */
225
+ logo_url: string | null;
226
+ /** Published custom apps in this workspace, including the current one. */
227
+ apps: ShellContextApp[];
228
+ /** Product-surface navigation targets, host-aware. `settings` opens the
229
+ * Unified Settings Dialog via the SPA's `?settings=<section>` deep link
230
+ * (optional: absent on servers older than the link). */
231
+ links: {
232
+ home: string;
233
+ threads: string;
234
+ settings?: string;
235
+ };
236
+ /** Viewer display identity; null on unauthenticated/local modes. */
237
+ user: {
238
+ name: string;
239
+ email: string;
240
+ picture?: string | null;
241
+ } | null;
242
+ }
243
+ interface UseShellContextResult {
244
+ data: ShellContextData | null;
245
+ loading: boolean;
246
+ error: Error | null;
247
+ }
248
+ /**
249
+ * Fetch the shell bootstrap payload for the current customer app. Must be
250
+ * called inside `<OxyAppProvider>`. Failure is non-fatal by design: the
251
+ * shell degrades to chrome-less rendering (older servers don't have the
252
+ * endpoint), so errors are surfaced on the result, never thrown.
253
+ */
254
+ declare function useShellContext(): UseShellContextResult;
255
+ //#endregion
256
+ //#region src/shell/Tooltip.d.ts
257
+ /**
258
+ * Hover tooltip for shell controls. Mirrors the web-app's Radix tooltip
259
+ * (zero delay, side arrow, `--zinc-200`/muted surface) but portals into the
260
+ * shell scope so the namespaced tokens and dark-mode class reach it.
261
+ */
262
+ declare function ShellTooltip({ content, side, children }: {
263
+ content: React.ReactNode;
264
+ side?: "top" | "right" | "bottom" | "left";
265
+ children: React.ReactNode;
266
+ }): React.JSX.Element;
267
+ //#endregion
268
+ //#region src/shell/TopBar.d.ts
269
+ /** Frame only: left content + right cluster. Mirrors the rail's
270
+ * `--sidebar-background` so the two read as one 48px-tall frame. */
271
+ declare function TopBar({ left, right, className }: {
272
+ left?: ReactNode;
273
+ right?: ReactNode;
274
+ className?: string;
275
+ }): import("react").JSX.Element;
276
+ /**
277
+ * "<Workspace> / <Page>" — e.g. "Poke House / HQ". The workspace name links
278
+ * back to the HQ home; pass `onHomeNavigate` to intercept for SPA routing
279
+ * (the anchor still carries `homeHref` for middle-click/new-tab).
280
+ */
281
+ declare function Breadcrumb({ workspaceLabel, pageLabel, homeHref, onHomeNavigate }: {
282
+ workspaceLabel: string;
283
+ pageLabel: string;
284
+ homeHref: string;
285
+ onHomeNavigate?: () => void;
286
+ }): import("react").JSX.Element;
287
+ /**
288
+ * Universal "Sys: Connected" indicator — a pulsing green dot when the browser
289
+ * is online, red when offline. Presentational connectivity signal; a real
290
+ * backend health ping can replace `useOnlineStatus` later without touching
291
+ * consumers.
292
+ */
293
+ declare function SystemIndicator(): import("react").JSX.Element;
294
+ /**
295
+ * Live clock in the given IANA timezone (viewer-local when omitted or
296
+ * invalid). Updates each half-minute (minute precision), pausing while the
297
+ * tab is hidden.
298
+ */
299
+ declare function WorkspaceClock({ timezone }: {
300
+ timezone?: string;
301
+ }): import("react").JSX.Element;
302
+ //#endregion
303
+ //#region src/shell/threadHistory.d.ts
304
+ interface ThreadSummary {
305
+ id: string;
306
+ title: string;
307
+ created_at: string;
308
+ }
309
+ interface TranscriptTurn {
310
+ question: string;
311
+ events: AgentRunEvent[];
312
+ }
313
+ interface ThreadTranscript {
314
+ title: string;
315
+ turns: TranscriptTurn[];
316
+ }
317
+ interface UseThreadHistoryResult {
318
+ threads: ThreadSummary[];
319
+ loading: boolean;
320
+ error: Error | null;
321
+ /** Re-fetch the list (call after a new chat is archived server-side). */
322
+ refetch: () => void;
323
+ }
324
+ /**
325
+ * List the viewer's persistent chat threads for the current project.
326
+ * Non-fatal on failure (older server / no session): returns an empty
327
+ * list so the dock falls back to session-only history.
328
+ */
329
+ declare function useThreadHistory(): UseThreadHistoryResult;
330
+ /**
331
+ * Fetch a thread's transcript for restore. Throws on failure so the
332
+ * caller can surface a toast / fall back.
333
+ */
334
+ declare function fetchThreadTranscript(fetcher: AppFetcher, projectId: string, threadId: string): Promise<ThreadTranscript>;
335
+ //#endregion
336
+ //#region src/shell/WorkspaceTile.d.ts
337
+ /** Rail-top workspace identity: the org/code-first logo when present, the
338
+ * name initial otherwise. Pure branding — switching workspaces is the host
339
+ * app's concern (the rail `bottom` slot). */
340
+ declare function WorkspaceTile({ name, logoUrl }: {
341
+ name: string;
342
+ logoUrl?: string;
343
+ }): import("react").JSX.Element;
344
+ //#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 };
346
+ //# sourceMappingURL=shell.d.mts.map
@@ -0,0 +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;E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