@opengeni/react 0.52.1 → 1.0.1
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 +51 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +43 -14
- package/dist/artifacts.js.map +1 -1
- package/dist/{chunk-ROIRTM37.js → chunk-5UQPNLIO.js} +6 -6
- package/dist/{chunk-JR3QFY6B.js → chunk-6KLX2RH5.js} +49 -2
- package/dist/chunk-6KLX2RH5.js.map +1 -0
- package/dist/{chunk-FWS3KC3Z.js → chunk-B6WPZSTT.js} +104 -104
- package/dist/{chunk-FWS3KC3Z.js.map → chunk-B6WPZSTT.js.map} +1 -1
- package/dist/{chunk-HDBG7XGO.js → chunk-C5ZPSSS5.js} +50 -1
- package/dist/chunk-C5ZPSSS5.js.map +1 -0
- package/dist/{chunk-X4S56Y2H.js → chunk-HA46CYQK.js} +135 -11
- package/dist/chunk-HA46CYQK.js.map +1 -0
- package/dist/{chunk-724BW4TW.js → chunk-IGC6A2ZI.js} +2 -2
- package/dist/chunk-LLOLUHVG.js +5937 -0
- package/dist/chunk-LLOLUHVG.js.map +1 -0
- package/dist/{chunk-WYA65Y3F.js → chunk-MKPIAGVL.js} +13 -3
- package/dist/chunk-MKPIAGVL.js.map +1 -0
- package/dist/chunk-R3AZOAB5.js +933 -0
- package/dist/chunk-R3AZOAB5.js.map +1 -0
- package/dist/{chunk-23EJ676W.js → chunk-XBZWOM2K.js} +9 -4
- package/dist/chunk-XBZWOM2K.js.map +1 -0
- package/dist/{chunk-JAGDUCZQ.js → chunk-Y7OEDUJ5.js} +17 -13
- package/dist/chunk-Y7OEDUJ5.js.map +1 -0
- package/dist/client.d.ts +6 -4
- package/dist/components/artifacts/index.d.ts +1 -0
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +14 -0
- package/dist/components/browser-input.d.ts +7 -0
- package/dist/components/browser-viewer.d.ts +5 -4
- package/dist/components/computer-viewer.d.ts +2 -1
- package/dist/components/desktop-viewer.d.ts +26 -2
- package/dist/components/interaction-intervention-banner.d.ts +11 -0
- package/dist/components/sandbox-terminal.d.ts +4 -1
- package/dist/components/sandbox-workspace.d.ts +3 -0
- package/dist/composer.js +6 -6
- package/dist/hooks/use-auth-runs.d.ts +32 -0
- package/dist/hooks/use-browser-downloads.d.ts +25 -0
- package/dist/hooks/use-browser-identities.d.ts +5 -1
- package/dist/hooks/use-browser-session.d.ts +2 -1
- package/dist/hooks/use-browser-sessions.d.ts +1 -1
- package/dist/hooks/use-channels.d.ts +26 -0
- package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
- package/dist/hooks/use-computer-session.d.ts +2 -1
- package/dist/hooks/use-computer-sessions.d.ts +1 -1
- package/dist/hooks/use-desktop-stream.d.ts +4 -0
- package/dist/hooks/use-interaction-interventions.d.ts +27 -0
- package/dist/hooks/use-interaction-invalidation.d.ts +19 -0
- package/dist/hooks/use-network-routes.d.ts +25 -0
- package/dist/hooks/use-site-auth-connections.d.ts +25 -0
- package/dist/hooks/use-supergrok-accounts.d.ts +26 -0
- package/dist/hooks/use-terminal-stream.d.ts +3 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1220 -1545
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +13 -3
- package/dist/interaction.js +520 -6
- package/dist/interaction.js.map +1 -1
- package/dist/interactive-workbench-viewers-TOHBXJEE.js +15 -0
- package/dist/lib/host-platform.d.ts +5 -0
- package/dist/lib/relay-wire.d.ts +20 -1
- package/dist/machines.js +3 -3
- package/dist/model-policy.d.ts +1 -1
- package/dist/model-policy.js +1 -1
- package/dist/provider.d.ts +3 -2
- package/dist/realtime/realtime-control.d.ts +6 -2
- package/dist/realtime.js +138 -24
- package/dist/realtime.js.map +1 -1
- package/dist/session-context.d.ts +10 -2
- package/dist/session-ui.js +3 -3
- package/dist/session.js +11 -11
- package/dist/timeline/types.d.ts +5 -0
- package/package.json +2 -2
- package/src/artifacts.ts +3 -0
- package/src/client.ts +73 -3
- package/src/components/artifacts/index.ts +5 -0
- package/src/components/artifacts/published-html-artifact-frame.tsx +38 -0
- package/src/components/browser-input.ts +65 -0
- package/src/components/browser-viewer.tsx +1287 -177
- package/src/components/computer-viewer.tsx +611 -114
- package/src/components/desktop-viewer.tsx +114 -1
- package/src/components/interaction-intervention-banner.tsx +99 -0
- package/src/components/machines/machine-detail.tsx +1 -1
- package/src/components/model-policy-picker.tsx +15 -0
- package/src/components/sandbox-terminal.tsx +24 -7
- package/src/components/sandbox-workspace.tsx +42 -4
- package/src/components/workspace-dock.tsx +59 -5
- package/src/hooks/use-attached-browsers.ts +13 -11
- package/src/hooks/use-auth-runs.ts +278 -0
- package/src/hooks/use-browser-downloads.ts +218 -0
- package/src/hooks/use-browser-frame-stream.ts +168 -59
- package/src/hooks/use-browser-identities.ts +47 -6
- package/src/hooks/use-browser-session.ts +94 -27
- package/src/hooks/use-browser-sessions.ts +19 -14
- package/src/hooks/use-channels.ts +99 -0
- package/src/hooks/use-computer-frame-stream.ts +184 -61
- package/src/hooks/use-computer-session.ts +22 -2
- package/src/hooks/use-computer-sessions.ts +19 -13
- package/src/hooks/use-desktop-stream.ts +39 -7
- package/src/hooks/use-interaction-interventions.ts +242 -0
- package/src/hooks/use-interaction-invalidation.ts +66 -0
- package/src/hooks/use-machine-chip.ts +13 -3
- package/src/hooks/use-network-routes.ts +214 -0
- package/src/hooks/use-site-auth-connections.ts +226 -0
- package/src/hooks/use-supergrok-accounts.ts +81 -0
- package/src/hooks/use-terminal-stream.ts +288 -55
- package/src/index.ts +8 -0
- package/src/interaction.ts +30 -0
- package/src/lib/host-platform.ts +10 -0
- package/src/lib/relay-wire.ts +43 -4
- package/src/lib/terminal-capability.ts +1 -1
- package/src/model-policy.ts +19 -4
- package/src/provider.tsx +133 -1
- package/src/realtime/realtime-control.tsx +181 -26
- package/src/session-context.ts +66 -1
- package/src/timeline/activity-rail.tsx +6 -0
- package/src/timeline/projection.ts +58 -0
- package/src/timeline/types.ts +2 -0
- package/styles/compiled.css +64 -6
- package/dist/chunk-23EJ676W.js.map +0 -1
- package/dist/chunk-6BBWWOOU.js +0 -82
- package/dist/chunk-6BBWWOOU.js.map +0 -1
- package/dist/chunk-7I2KB3OK.js +0 -3895
- package/dist/chunk-7I2KB3OK.js.map +0 -1
- package/dist/chunk-HDBG7XGO.js.map +0 -1
- package/dist/chunk-JAGDUCZQ.js.map +0 -1
- package/dist/chunk-JR3QFY6B.js.map +0 -1
- package/dist/chunk-WYA65Y3F.js.map +0 -1
- package/dist/chunk-X4S56Y2H.js.map +0 -1
- package/dist/interactive-workbench-viewers-KHNOHWQE.js +0 -13
- /package/dist/{chunk-ROIRTM37.js.map → chunk-5UQPNLIO.js.map} +0 -0
- /package/dist/{chunk-724BW4TW.js.map → chunk-IGC6A2ZI.js.map} +0 -0
- /package/dist/{interactive-workbench-viewers-KHNOHWQE.js.map → interactive-workbench-viewers-TOHBXJEE.js.map} +0 -0
package/src/session-context.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
StreamConnectionState,
|
|
3
|
+
WorkspaceControlEvent,
|
|
4
|
+
WorkspaceInteractionRevisionEvent,
|
|
5
|
+
} from "@opengeni/sdk";
|
|
2
6
|
import { createContext, useContext } from "react";
|
|
3
7
|
import type {
|
|
4
8
|
EmbeddedFileAttachmentClientLike,
|
|
@@ -7,6 +11,7 @@ import type {
|
|
|
7
11
|
EmbeddedBrowserInteractionClientLike,
|
|
8
12
|
EmbeddedComputerInteractionClientLike,
|
|
9
13
|
EmbeddedInteractionClientLike,
|
|
14
|
+
EmbeddedInterventionClientLike,
|
|
10
15
|
EmbeddedRealtimeSessionClientLike,
|
|
11
16
|
EmbeddedSessionClientLike,
|
|
12
17
|
EmbeddedSessionLineageClientLike,
|
|
@@ -20,6 +25,8 @@ export type OpenGeniContextValue = {
|
|
|
20
25
|
workspaceId: string;
|
|
21
26
|
workspaceControlEvent: WorkspaceControlEvent | null;
|
|
22
27
|
workspaceControlConnectionState: StreamConnectionState | "idle" | "error";
|
|
28
|
+
workspaceInteractionEvent: WorkspaceInteractionRevisionEvent | null;
|
|
29
|
+
workspaceInteractionConnectionState: StreamConnectionState | "idle" | "error";
|
|
23
30
|
registerSessionReconciler: (
|
|
24
31
|
sessionId: string,
|
|
25
32
|
key: string,
|
|
@@ -84,6 +91,11 @@ export type EmbeddedInteractionClientOverride = {
|
|
|
84
91
|
workspaceId?: string | undefined;
|
|
85
92
|
};
|
|
86
93
|
|
|
94
|
+
export type EmbeddedInterventionClientOverride = {
|
|
95
|
+
client?: EmbeddedInterventionClientLike | undefined;
|
|
96
|
+
workspaceId?: string | undefined;
|
|
97
|
+
};
|
|
98
|
+
|
|
87
99
|
export type EmbeddedBrowserInteractionClientOverride = {
|
|
88
100
|
client?: EmbeddedBrowserInteractionClientLike | undefined;
|
|
89
101
|
workspaceId?: string | undefined;
|
|
@@ -132,6 +144,8 @@ function useEmbeddedClientRefinement<TClient extends object>(
|
|
|
132
144
|
workspaceId,
|
|
133
145
|
workspaceControlEvent: context?.workspaceControlEvent ?? null,
|
|
134
146
|
workspaceControlConnectionState: context?.workspaceControlConnectionState ?? "idle",
|
|
147
|
+
workspaceInteractionEvent: context?.workspaceInteractionEvent ?? null,
|
|
148
|
+
workspaceInteractionConnectionState: context?.workspaceInteractionConnectionState ?? "idle",
|
|
135
149
|
registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,
|
|
136
150
|
reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,
|
|
137
151
|
};
|
|
@@ -158,20 +172,46 @@ export function useOpenGeni(override: ClientOverride = {}): OpenGeniContextValue
|
|
|
158
172
|
workspaceId,
|
|
159
173
|
workspaceControlEvent: context?.workspaceControlEvent ?? null,
|
|
160
174
|
workspaceControlConnectionState: context?.workspaceControlConnectionState ?? "idle",
|
|
175
|
+
workspaceInteractionEvent: context?.workspaceInteractionEvent ?? null,
|
|
176
|
+
workspaceInteractionConnectionState: context?.workspaceInteractionConnectionState ?? "idle",
|
|
161
177
|
registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,
|
|
162
178
|
reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,
|
|
163
179
|
};
|
|
164
180
|
}
|
|
165
181
|
|
|
166
182
|
const BROWSER_INTERACTION_METHODS = [
|
|
183
|
+
"streamWorkspaceInteractionRevisions",
|
|
184
|
+
"listNetworkRoutes",
|
|
185
|
+
"getNetworkRoute",
|
|
186
|
+
"createNetworkRoute",
|
|
187
|
+
"updateNetworkRoute",
|
|
188
|
+
"listSiteAuthConnections",
|
|
189
|
+
"getSiteAuthConnection",
|
|
190
|
+
"createSiteAuthConnection",
|
|
191
|
+
"updateSiteAuthConnection",
|
|
192
|
+
"listAuthRuns",
|
|
193
|
+
"getAuthRun",
|
|
194
|
+
"startBrowserAuthRun",
|
|
195
|
+
"reportBrowserAuthRun",
|
|
196
|
+
"protectedBrowserAuthFill",
|
|
197
|
+
"verifyBrowserAuthRun",
|
|
198
|
+
"listInteractionInterventions",
|
|
199
|
+
"getInteractionIntervention",
|
|
200
|
+
"createInteractionIntervention",
|
|
201
|
+
"resolveInteractionIntervention",
|
|
167
202
|
"listAttachedBrowsers",
|
|
168
203
|
"getAttachedBrowser",
|
|
169
204
|
"listBrowserIdentities",
|
|
170
205
|
"getBrowserIdentity",
|
|
171
206
|
"createBrowserIdentity",
|
|
207
|
+
"updateBrowserIdentity",
|
|
172
208
|
"listBrowserRevisions",
|
|
173
209
|
"listBrowserSessions",
|
|
174
210
|
"getBrowserSession",
|
|
211
|
+
"readBrowserClipboard",
|
|
212
|
+
"listBrowserDownloads",
|
|
213
|
+
"getBrowserDownload",
|
|
214
|
+
"saveBrowserDownload",
|
|
175
215
|
"createBrowserSession",
|
|
176
216
|
"listBrowserTargets",
|
|
177
217
|
"openBrowserTarget",
|
|
@@ -190,8 +230,14 @@ const BROWSER_INTERACTION_METHODS = [
|
|
|
190
230
|
] as const;
|
|
191
231
|
|
|
192
232
|
const COMPUTER_INTERACTION_METHODS = [
|
|
233
|
+
"streamWorkspaceInteractionRevisions",
|
|
234
|
+
"listInteractionInterventions",
|
|
235
|
+
"getInteractionIntervention",
|
|
236
|
+
"createInteractionIntervention",
|
|
237
|
+
"resolveInteractionIntervention",
|
|
193
238
|
"listComputerSessions",
|
|
194
239
|
"getComputerSession",
|
|
240
|
+
"readComputerClipboard",
|
|
195
241
|
"createComputerSession",
|
|
196
242
|
"listComputerTargets",
|
|
197
243
|
"observeComputerTarget",
|
|
@@ -202,6 +248,25 @@ const COMPUTER_INTERACTION_METHODS = [
|
|
|
202
248
|
"endComputerSession",
|
|
203
249
|
] as const;
|
|
204
250
|
|
|
251
|
+
const INTERVENTION_METHODS = [
|
|
252
|
+
"streamWorkspaceInteractionRevisions",
|
|
253
|
+
"listInteractionInterventions",
|
|
254
|
+
"getInteractionIntervention",
|
|
255
|
+
"createInteractionIntervention",
|
|
256
|
+
"resolveInteractionIntervention",
|
|
257
|
+
] as const;
|
|
258
|
+
|
|
259
|
+
/** Resolve only the workspace-wide Browser/Computer intervention surface. */
|
|
260
|
+
export function useEmbeddedInterventions(
|
|
261
|
+
override: EmbeddedInterventionClientOverride = {},
|
|
262
|
+
): EmbeddedClientContextValue<EmbeddedInterventionClientLike> {
|
|
263
|
+
return useEmbeddedClientRefinement(
|
|
264
|
+
override,
|
|
265
|
+
INTERVENTION_METHODS,
|
|
266
|
+
"interaction intervention hooks",
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
205
270
|
/** Resolve only BrowserSession methods for a standalone Browser embed. */
|
|
206
271
|
export function useEmbeddedBrowserInteraction(
|
|
207
272
|
override: EmbeddedBrowserInteractionClientOverride = {},
|
|
@@ -417,6 +417,12 @@ function WorkerRow({
|
|
|
417
417
|
{truncate(item.prompt, 140)}
|
|
418
418
|
</p>
|
|
419
419
|
) : null}
|
|
420
|
+
{failed && item.failure ? (
|
|
421
|
+
<div className="mt-1 min-w-0 text-og-sm text-og-status-failed">
|
|
422
|
+
<p className="font-og-mono text-og-xs">{item.failure.code}</p>
|
|
423
|
+
<p className="mt-0.5 break-words">{item.failure.message}</p>
|
|
424
|
+
</div>
|
|
425
|
+
) : null}
|
|
420
426
|
</div>
|
|
421
427
|
{failed ? (
|
|
422
428
|
<span className="inline-flex shrink-0 self-center items-center gap-1.5 font-og-mono text-og-xs leading-none text-og-status-failed">
|
|
@@ -49,6 +49,8 @@ export { toolDisplayName, mcpToolLeaf, toolMatchesLeaf } from "./tool-display-na
|
|
|
49
49
|
/** Tool leaves on the first-party OpenGeni MCP server that operate on sessions. */
|
|
50
50
|
const WORKER_SPAWN_TOOL = "session_create";
|
|
51
51
|
const WORKER_MESSAGE_TOOL = "session_send_message";
|
|
52
|
+
const WORKER_FAILURE_CODE_MAX_LENGTH = 128;
|
|
53
|
+
const WORKER_FAILURE_MESSAGE_MAX_UTF8_BYTES = 1_024;
|
|
52
54
|
|
|
53
55
|
/**
|
|
54
56
|
* Tools whose durable side-effect events already own the timeline (MemoryRow).
|
|
@@ -359,6 +361,7 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
359
361
|
action: toolMatchesLeaf(name, WORKER_SPAWN_TOOL) ? "spawn" : "message",
|
|
360
362
|
prompt: workerPrompt(args),
|
|
361
363
|
workerSessionId: extractSessionRef(args),
|
|
364
|
+
failure: null,
|
|
362
365
|
status: "running",
|
|
363
366
|
occurredAt: event.occurredAt,
|
|
364
367
|
});
|
|
@@ -417,6 +420,7 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
417
420
|
// isError result) settles to "failed" too, so WorkerRow surfaces it.
|
|
418
421
|
target.status = isErrorOutput(payload) ? "failed" : "complete";
|
|
419
422
|
target.workerSessionId = target.workerSessionId ?? extractSessionRef(payload.output);
|
|
423
|
+
target.failure = target.status === "failed" ? workerFailure(payload.output) : null;
|
|
420
424
|
break;
|
|
421
425
|
}
|
|
422
426
|
// An output carrying an explicit error flag (or an MCP isError result)
|
|
@@ -1300,6 +1304,8 @@ function isTurnBoundary(group: TimelineGroup | undefined): boolean {
|
|
|
1300
1304
|
(group?.kind === "item" &&
|
|
1301
1305
|
(group.item.kind === "user-message" ||
|
|
1302
1306
|
group.item.kind === "context-compaction" ||
|
|
1307
|
+
(group.item.kind === "machine-input-batch" &&
|
|
1308
|
+
group.item.members.some((member) => member.kind === "media_generation_result")) ||
|
|
1303
1309
|
(group.item.kind === "notice" && group.item.tone === "input")))
|
|
1304
1310
|
);
|
|
1305
1311
|
}
|
|
@@ -1795,6 +1801,58 @@ function workerPrompt(args: unknown): string | null {
|
|
|
1795
1801
|
return null;
|
|
1796
1802
|
}
|
|
1797
1803
|
|
|
1804
|
+
function boundedWorkerFailureMessage(value: string): string | null {
|
|
1805
|
+
const normalized = value.replace(/[\u0000-\u001f\u007f]+/g, " ").trim();
|
|
1806
|
+
if (!normalized) return null;
|
|
1807
|
+
const encoded = new TextEncoder().encode(normalized);
|
|
1808
|
+
if (encoded.byteLength <= WORKER_FAILURE_MESSAGE_MAX_UTF8_BYTES) return normalized;
|
|
1809
|
+
let end = WORKER_FAILURE_MESSAGE_MAX_UTF8_BYTES;
|
|
1810
|
+
while (end > 0 && (encoded[end]! & 0xc0) === 0x80) end -= 1;
|
|
1811
|
+
return new TextDecoder().decode(encoded.slice(0, end)).trim();
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
function boundedWorkerFailure(value: unknown): WorkerItem["failure"] {
|
|
1815
|
+
const record = asRecord(value);
|
|
1816
|
+
const code = typeof record.code === "string" ? record.code.trim() : "";
|
|
1817
|
+
const message =
|
|
1818
|
+
typeof record.message === "string" ? boundedWorkerFailureMessage(record.message) : null;
|
|
1819
|
+
if (!/^[A-Za-z0-9._:-]{1,128}$/.test(code) || !message) return null;
|
|
1820
|
+
return { code: code.slice(0, WORKER_FAILURE_CODE_MAX_LENGTH), message };
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* Extract the API's structured orchestration failure from raw objects, JSON
|
|
1825
|
+
* text, or retained MCP CallToolResult wrappers. Legacy flat strings remain
|
|
1826
|
+
* unprojected rather than being mistaken for the trusted diagnostic contract.
|
|
1827
|
+
*/
|
|
1828
|
+
function workerFailure(value: unknown, depth = 0): WorkerItem["failure"] {
|
|
1829
|
+
if (depth > 6 || value === null || value === undefined) return null;
|
|
1830
|
+
if (typeof value === "string") {
|
|
1831
|
+
const parsed = tryParseJson(value);
|
|
1832
|
+
return parsed === value ? null : workerFailure(parsed, depth + 1);
|
|
1833
|
+
}
|
|
1834
|
+
if (Array.isArray(value)) {
|
|
1835
|
+
for (const entry of value) {
|
|
1836
|
+
const failure = workerFailure(entry, depth + 1);
|
|
1837
|
+
if (failure) return failure;
|
|
1838
|
+
}
|
|
1839
|
+
return null;
|
|
1840
|
+
}
|
|
1841
|
+
if (typeof value !== "object") return null;
|
|
1842
|
+
const record = value as Record<string, unknown>;
|
|
1843
|
+
const direct = boundedWorkerFailure(record.error);
|
|
1844
|
+
if (direct) return direct;
|
|
1845
|
+
for (const key of ["structuredContent", "content", "result", "output"] as const) {
|
|
1846
|
+
if (!(key in record)) continue;
|
|
1847
|
+
const failure = workerFailure(record[key], depth + 1);
|
|
1848
|
+
if (failure) return failure;
|
|
1849
|
+
}
|
|
1850
|
+
if (record.type === "text" && typeof record.text === "string") {
|
|
1851
|
+
return workerFailure(record.text, depth + 1);
|
|
1852
|
+
}
|
|
1853
|
+
return null;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1798
1856
|
/**
|
|
1799
1857
|
* Find a session id in orchestration tool arguments or output. Handles raw
|
|
1800
1858
|
* objects, JSON strings, and MCP tool results (`{ content: [{ type: "text",
|
package/src/timeline/types.ts
CHANGED
|
@@ -127,6 +127,8 @@ export type WorkerItem = {
|
|
|
127
127
|
prompt: string | null;
|
|
128
128
|
/** The target/spawned worker session id, when parseable from args/output. */
|
|
129
129
|
workerSessionId: string | null;
|
|
130
|
+
/** Bounded structured failure retained from session_create/session_send_message. */
|
|
131
|
+
failure: { code: string; message: string } | null;
|
|
130
132
|
status: "running" | "complete" | "failed" | "cancelled";
|
|
131
133
|
occurredAt: string;
|
|
132
134
|
};
|
package/styles/compiled.css
CHANGED
|
@@ -586,9 +586,15 @@
|
|
|
586
586
|
:where(.og-root).bottom-2,:where(.og-root) .bottom-2 {
|
|
587
587
|
bottom: calc(var(--spacing) * 2);
|
|
588
588
|
}
|
|
589
|
+
:where(.og-root).bottom-3,:where(.og-root) .bottom-3 {
|
|
590
|
+
bottom: calc(var(--spacing) * 3);
|
|
591
|
+
}
|
|
589
592
|
:where(.og-root).bottom-4,:where(.og-root) .bottom-4 {
|
|
590
593
|
bottom: calc(var(--spacing) * 4);
|
|
591
594
|
}
|
|
595
|
+
:where(.og-root).bottom-7,:where(.og-root) .bottom-7 {
|
|
596
|
+
bottom: calc(var(--spacing) * 7);
|
|
597
|
+
}
|
|
592
598
|
:where(.og-root).bottom-14,:where(.og-root) .bottom-14 {
|
|
593
599
|
bottom: calc(var(--spacing) * 14);
|
|
594
600
|
}
|
|
@@ -640,6 +646,9 @@
|
|
|
640
646
|
:where(.og-root).z-\[2147483647\],:where(.og-root) .z-\[2147483647\] {
|
|
641
647
|
z-index: 2147483647;
|
|
642
648
|
}
|
|
649
|
+
:where(.og-root).col-span-2,:where(.og-root) .col-span-2 {
|
|
650
|
+
grid-column: span 2 / span 2;
|
|
651
|
+
}
|
|
643
652
|
:where(.og-root).col-span-full,:where(.og-root) .col-span-full {
|
|
644
653
|
grid-column: 1 / -1;
|
|
645
654
|
}
|
|
@@ -985,6 +994,9 @@
|
|
|
985
994
|
:where(.og-root).max-h-28,:where(.og-root) .max-h-28 {
|
|
986
995
|
max-height: calc(var(--spacing) * 28);
|
|
987
996
|
}
|
|
997
|
+
:where(.og-root).max-h-40,:where(.og-root) .max-h-40 {
|
|
998
|
+
max-height: calc(var(--spacing) * 40);
|
|
999
|
+
}
|
|
988
1000
|
:where(.og-root).max-h-48,:where(.og-root) .max-h-48 {
|
|
989
1001
|
max-height: calc(var(--spacing) * 48);
|
|
990
1002
|
}
|
|
@@ -1364,6 +1376,9 @@
|
|
|
1364
1376
|
:where(.og-root).grid-cols-2,:where(.og-root) .grid-cols-2 {
|
|
1365
1377
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1366
1378
|
}
|
|
1379
|
+
:where(.og-root).grid-cols-\[7rem_minmax\(0\,1fr\)\],:where(.og-root) .grid-cols-\[7rem_minmax\(0\,1fr\)\] {
|
|
1380
|
+
grid-template-columns: 7rem minmax(0,1fr);
|
|
1381
|
+
}
|
|
1367
1382
|
:where(.og-root).grid-cols-\[auto_minmax\(0\,1fr\)\],:where(.og-root) .grid-cols-\[auto_minmax\(0\,1fr\)\] {
|
|
1368
1383
|
grid-template-columns: auto minmax(0,1fr);
|
|
1369
1384
|
}
|
|
@@ -1502,6 +1517,12 @@
|
|
|
1502
1517
|
:where(.og-root).gap-y-0\.5,:where(.og-root) .gap-y-0\.5 {
|
|
1503
1518
|
row-gap: calc(var(--spacing) * 0.5);
|
|
1504
1519
|
}
|
|
1520
|
+
:where(.og-root).gap-y-1,:where(.og-root) .gap-y-1 {
|
|
1521
|
+
row-gap: calc(var(--spacing) * 1);
|
|
1522
|
+
}
|
|
1523
|
+
:where(.og-root).gap-y-1\.5,:where(.og-root) .gap-y-1\.5 {
|
|
1524
|
+
row-gap: calc(var(--spacing) * 1.5);
|
|
1525
|
+
}
|
|
1505
1526
|
:where(.og-root).gap-y-2,:where(.og-root) .gap-y-2 {
|
|
1506
1527
|
row-gap: calc(var(--spacing) * 2);
|
|
1507
1528
|
}
|
|
@@ -1534,6 +1555,9 @@
|
|
|
1534
1555
|
:where(.og-root).justify-self-end,:where(.og-root) .justify-self-end {
|
|
1535
1556
|
justify-self: flex-end;
|
|
1536
1557
|
}
|
|
1558
|
+
:where(.og-root).justify-self-start,:where(.og-root) .justify-self-start {
|
|
1559
|
+
justify-self: flex-start;
|
|
1560
|
+
}
|
|
1537
1561
|
:where(.og-root).truncate,:where(.og-root) .truncate {
|
|
1538
1562
|
overflow: hidden;
|
|
1539
1563
|
text-overflow: ellipsis;
|
|
@@ -1899,6 +1923,12 @@
|
|
|
1899
1923
|
background-color: color-mix(in oklab, var(--color-black) 65%, transparent);
|
|
1900
1924
|
}
|
|
1901
1925
|
}
|
|
1926
|
+
:where(.og-root).bg-black\/70,:where(.og-root) .bg-black\/70 {
|
|
1927
|
+
background-color: color-mix(in srgb, #000 70%, transparent);
|
|
1928
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1929
|
+
background-color: color-mix(in oklab, var(--color-black) 70%, transparent);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1902
1932
|
:where(.og-root).bg-black\/90,:where(.og-root) .bg-black\/90 {
|
|
1903
1933
|
background-color: color-mix(in srgb, #000 90%, transparent);
|
|
1904
1934
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -2211,6 +2241,12 @@
|
|
|
2211
2241
|
:where(.og-root).bg-white,:where(.og-root) .bg-white {
|
|
2212
2242
|
background-color: var(--color-white);
|
|
2213
2243
|
}
|
|
2244
|
+
:where(.og-root).bg-white\/10,:where(.og-root) .bg-white\/10 {
|
|
2245
|
+
background-color: color-mix(in srgb, #fff 10%, transparent);
|
|
2246
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
2247
|
+
background-color: color-mix(in oklab, var(--color-white) 10%, transparent);
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2214
2250
|
:where(.og-root).bg-gradient-to-t,:where(.og-root) .bg-gradient-to-t {
|
|
2215
2251
|
--tw-gradient-position: to top in oklab;
|
|
2216
2252
|
background-image: linear-gradient(var(--tw-gradient-stops));
|
|
@@ -2348,6 +2384,12 @@
|
|
|
2348
2384
|
:where(.og-root).py-3,:where(.og-root) .py-3 {
|
|
2349
2385
|
padding-block: calc(var(--spacing) * 3);
|
|
2350
2386
|
}
|
|
2387
|
+
:where(.og-root).py-4,:where(.og-root) .py-4 {
|
|
2388
|
+
padding-block: calc(var(--spacing) * 4);
|
|
2389
|
+
}
|
|
2390
|
+
:where(.og-root).py-5,:where(.og-root) .py-5 {
|
|
2391
|
+
padding-block: calc(var(--spacing) * 5);
|
|
2392
|
+
}
|
|
2351
2393
|
:where(.og-root).py-6,:where(.og-root) .py-6 {
|
|
2352
2394
|
padding-block: calc(var(--spacing) * 6);
|
|
2353
2395
|
}
|
|
@@ -2568,6 +2610,10 @@
|
|
|
2568
2610
|
--tw-tracking: 0.12em;
|
|
2569
2611
|
letter-spacing: 0.12em;
|
|
2570
2612
|
}
|
|
2613
|
+
:where(.og-root).tracking-\[0\.14em\],:where(.og-root) .tracking-\[0\.14em\] {
|
|
2614
|
+
--tw-tracking: 0.14em;
|
|
2615
|
+
letter-spacing: 0.14em;
|
|
2616
|
+
}
|
|
2571
2617
|
:where(.og-root).tracking-\[0\.25em\],:where(.og-root) .tracking-\[0\.25em\] {
|
|
2572
2618
|
--tw-tracking: 0.25em;
|
|
2573
2619
|
letter-spacing: 0.25em;
|
|
@@ -3679,6 +3725,16 @@
|
|
|
3679
3725
|
}
|
|
3680
3726
|
}
|
|
3681
3727
|
}
|
|
3728
|
+
:where(.og-root).hover\:bg-white\/20,:where(.og-root) .hover\:bg-white\/20 {
|
|
3729
|
+
&:hover {
|
|
3730
|
+
@media (hover: hover) {
|
|
3731
|
+
background-color: color-mix(in srgb, #fff 20%, transparent);
|
|
3732
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
3733
|
+
background-color: color-mix(in oklab, var(--color-white) 20%, transparent);
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3682
3738
|
:where(.og-root).hover\:text-fg,:where(.og-root) .hover\:text-fg {
|
|
3683
3739
|
&:hover {
|
|
3684
3740
|
@media (hover: hover) {
|
|
@@ -3778,6 +3834,14 @@
|
|
|
3778
3834
|
}
|
|
3779
3835
|
}
|
|
3780
3836
|
}
|
|
3837
|
+
:where(.og-root).hover\:brightness-105,:where(.og-root) .hover\:brightness-105 {
|
|
3838
|
+
&:hover {
|
|
3839
|
+
@media (hover: hover) {
|
|
3840
|
+
--tw-brightness: brightness(105%);
|
|
3841
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3781
3845
|
:where(.og-root).hover\:brightness-110,:where(.og-root) .hover\:brightness-110 {
|
|
3782
3846
|
&:hover {
|
|
3783
3847
|
@media (hover: hover) {
|
|
@@ -3957,12 +4021,6 @@
|
|
|
3957
4021
|
}
|
|
3958
4022
|
}
|
|
3959
4023
|
}
|
|
3960
|
-
:where(.og-root).focus-visible\:outline-none,:where(.og-root) .focus-visible\:outline-none {
|
|
3961
|
-
&:focus-visible {
|
|
3962
|
-
--tw-outline-style: none;
|
|
3963
|
-
outline-style: none;
|
|
3964
|
-
}
|
|
3965
|
-
}
|
|
3966
4024
|
:where(.og-root).focus-visible\:ring-inset,:where(.og-root) .focus-visible\:ring-inset {
|
|
3967
4025
|
&:focus-visible {
|
|
3968
4026
|
--tw-ring-inset: inset;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/model-policy.ts"],"sourcesContent":["import type { ClientModel, ReasoningEffort, WorkspaceModelCatalogModel } from \"@opengeni/sdk\";\n\nexport type PickerBillingClass = \"opengeni_credits\" | \"codex_subscription\" | \"byok\";\n\nexport type PickerModelRow<TCatalog extends ClientModel = WorkspaceModelCatalogModel> = {\n id: string;\n label: string;\n /** Catalog-curated compact label for dense UI; fall back to `label` when absent. */\n shortLabel?: string | undefined;\n billingClass: PickerBillingClass;\n billingClassLabel: string;\n selectable: boolean;\n unavailableReason: string | null;\n provider: string;\n providerLabel: string;\n catalog: TCatalog;\n};\n\nexport type LatencyModeId = \"standard\" | \"priority\" | \"fast\";\n\nconst BILLING_CLASS_ORDER: PickerBillingClass[] = [\n \"opengeni_credits\",\n \"codex_subscription\",\n \"byok\",\n];\n\nconst BILLING_CLASS_LABELS: Record<PickerBillingClass, string> = {\n opengeni_credits: \"OpenGeni\",\n codex_subscription: \"Codex\",\n byok: \"Your Gateway\",\n};\n\nconst AVAILABILITY_REASON_LABELS: Record<string, string> = {\n missing_credential: \"Credentials required\",\n needs_reauth: \"Reconnect required\",\n credential_not_ready: \"Credential not ready\",\n not_entitled: \"Not entitled\",\n provider_unhealthy: \"Provider unavailable\",\n policy_blocked: \"Blocked by workspace policy\",\n unsupported: \"Unsupported\",\n};\n\nexport function billingClassForModel(model: ClientModel): PickerBillingClass {\n if (model.source === \"codex\") {\n return \"codex_subscription\";\n }\n if (model.source === \"workspace_gateway\") {\n return \"byok\";\n }\n if (model.credentialSource?.kind === \"connected_subscription\") {\n return \"codex_subscription\";\n }\n if (model.credentialSource?.kind === \"workspace_connection\") {\n return \"byok\";\n }\n if (model.billing?.upstreamPayer === \"connected_subscription\") {\n return \"codex_subscription\";\n }\n if (model.billing?.upstreamPayer === \"workspace\") {\n return \"byok\";\n }\n return \"opengeni_credits\";\n}\n\nexport function billingClassLabel(billingClass: PickerBillingClass): string {\n return BILLING_CLASS_LABELS[billingClass];\n}\n\nexport function availabilityReasonLabel(\n reason: WorkspaceModelCatalogModel[\"availability\"][\"reason\"],\n): string | null {\n if (!reason) {\n return null;\n }\n return AVAILABILITY_REASON_LABELS[reason] ?? \"Unavailable\";\n}\n\nexport function effortOptionsForModel(model: ClientModel): ReasoningEffort[] {\n const efforts = model.capabilities?.reasoning.efforts;\n if (!efforts || efforts.length === 0) {\n return [\"low\"];\n }\n const order: ReasoningEffort[] = [\"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"];\n return order.filter((effort) => efforts.includes(effort));\n}\n\nexport function defaultEffortForModel(model: ClientModel): ReasoningEffort {\n const options = effortOptionsForModel(model);\n const configured = model.capabilities?.reasoning.defaultEffort;\n if (configured && options.includes(configured)) {\n return configured;\n }\n return options[0] ?? \"low\";\n}\n\nexport function coerceReasoningEffortForModel(\n model: ClientModel,\n effort: ReasoningEffort,\n): ReasoningEffort {\n const options = effortOptionsForModel(model);\n if (options.includes(effort)) {\n return effort;\n }\n return defaultEffortForModel(model);\n}\n\nexport function runnableLatencyModesForModel(model: ClientModel): LatencyModeId[] {\n const modes = model.capabilities?.latencyModes ?? [];\n return modes.filter((mode) => mode.runnable).map((mode) => mode.id);\n}\n\nexport function labelLatencyMode(mode: LatencyModeId): string {\n if (mode === \"fast\") {\n return \"Fast\";\n }\n if (mode === \"priority\") {\n return \"Priority\";\n }\n return \"Standard\";\n}\n\nexport function labelReasoningEffort(effort: ReasoningEffort): string {\n if (effort === \"xhigh\") {\n return \"Extra high\";\n }\n return effort.slice(0, 1).toUpperCase() + effort.slice(1);\n}\n\nexport function payerSummaryForModel(model: ClientModel): string {\n const billing = model.billing;\n if (!billing) {\n return \"Route unknown\";\n }\n if (billing.metering === \"opengeni_credits\") {\n return \"OpenGeni credits · automatic managed route\";\n }\n if (billing.upstreamPayer === \"connected_subscription\") {\n return \"Codex subscription · external billing\";\n }\n if (billing.upstreamPayer === \"workspace\") {\n return \"Billed to your AI Gateway\";\n }\n return \"Deployment route · external billing\";\n}\n\nexport function advancedSourceSummary(model: ClientModel): string | null {\n const source = model.credentialSource;\n if (!source) {\n return null;\n }\n if (source.kind === \"connected_subscription\") {\n return \"Connected Codex subscription\";\n }\n if (source.kind === \"workspace_connection\") {\n return \"Workspace AI Gateway\";\n }\n if (source.kind === \"deployment\") {\n return source.mechanism === \"azure_ad_bearer\"\n ? \"Deployment Azure identity\"\n : \"Deployment API key\";\n }\n return null;\n}\n\nexport function projectPickerRows(models: WorkspaceModelCatalogModel[]): PickerModelRow[] {\n return models\n .filter((catalog) => {\n const billingClass = billingClassForModel(catalog);\n return billingClass === \"opengeni_credits\" || catalog.credentialReadiness.status === \"ready\";\n })\n .map((catalog) => {\n const billingClass = billingClassForModel(catalog);\n return {\n id: catalog.id,\n label: catalog.label,\n ...(catalog.shortLabel ? { shortLabel: catalog.shortLabel } : {}),\n billingClass,\n billingClassLabel: billingClassLabel(billingClass),\n selectable: catalog.availability.selectable,\n unavailableReason: catalog.availability.selectable\n ? null\n : availabilityReasonLabel(catalog.availability.reason),\n provider: catalog.provider,\n providerLabel: catalog.providerLabel,\n catalog,\n };\n });\n}\n\n/** Project the lightweight client-config model list into the same picker contract. */\nexport function projectClientModelRows(models: ClientModel[]): PickerModelRow<ClientModel>[] {\n return models.map((catalog) => {\n const billingClass = billingClassForModel(catalog);\n return {\n id: catalog.id,\n label: catalog.label,\n ...(catalog.shortLabel ? { shortLabel: catalog.shortLabel } : {}),\n billingClass,\n billingClassLabel: billingClassLabel(billingClass),\n selectable: true,\n unavailableReason: null,\n provider: catalog.provider,\n providerLabel: catalog.providerLabel,\n catalog,\n };\n });\n}\n\nexport function sortPickerRows<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n): PickerModelRow<TCatalog>[] {\n return [...rows].sort((left, right) => {\n const classDelta =\n BILLING_CLASS_ORDER.indexOf(left.billingClass) -\n BILLING_CLASS_ORDER.indexOf(right.billingClass);\n if (classDelta !== 0) {\n return classDelta;\n }\n if (left.selectable !== right.selectable) {\n return left.selectable ? -1 : 1;\n }\n return left.label.localeCompare(right.label);\n });\n}\n\nexport function findPickerRow<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n modelId: string,\n): PickerModelRow<TCatalog> | null {\n return rows.find((row) => row.id === modelId) ?? null;\n}\n\nexport function groupPickerRowsByBillingClass(\n rows: PickerModelRow[],\n): Array<{ billingClass: PickerBillingClass; label: string; rows: PickerModelRow[] }>;\nexport function groupPickerRowsByBillingClass<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n): Array<{\n billingClass: PickerBillingClass;\n label: string;\n rows: PickerModelRow<TCatalog>[];\n}>;\nexport function groupPickerRowsByBillingClass<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n): Array<{\n billingClass: PickerBillingClass;\n label: string;\n rows: PickerModelRow<TCatalog>[];\n}> {\n const sorted = sortPickerRows(rows);\n const groups: Array<{\n billingClass: PickerBillingClass;\n label: string;\n rows: PickerModelRow<TCatalog>[];\n }> = [];\n for (const row of sorted) {\n const existing = groups.find((group) => group.billingClass === row.billingClass);\n if (existing) {\n existing.rows.push(row);\n continue;\n }\n groups.push({\n billingClass: row.billingClass,\n label: row.billingClassLabel,\n rows: [row],\n });\n }\n return groups;\n}\n"],"mappings":";AAoBA,IAAM,sBAA4C;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,uBAA2D;AAAA,EAC/D,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,MAAM;AACR;AAEA,IAAM,6BAAqD;AAAA,EACzD,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,aAAa;AACf;AAEO,SAAS,qBAAqB,OAAwC;AAC3E,MAAI,MAAM,WAAW,SAAS;AAC5B,WAAO;AAAA,EACT;AACA,MAAI,MAAM,WAAW,qBAAqB;AACxC,WAAO;AAAA,EACT;AACA,MAAI,MAAM,kBAAkB,SAAS,0BAA0B;AAC7D,WAAO;AAAA,EACT;AACA,MAAI,MAAM,kBAAkB,SAAS,wBAAwB;AAC3D,WAAO;AAAA,EACT;AACA,MAAI,MAAM,SAAS,kBAAkB,0BAA0B;AAC7D,WAAO;AAAA,EACT;AACA,MAAI,MAAM,SAAS,kBAAkB,aAAa;AAChD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,SAAS,kBAAkB,cAA0C;AAC1E,SAAO,qBAAqB,YAAY;AAC1C;AAEO,SAAS,wBACd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2
|
-
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
3
|
-
var STREAM_KIND_DESKTOP = 2;
|
|
4
|
-
var STREAM_KIND_BROWSER = 3;
|
|
5
|
-
var STREAM_KIND_COMPUTER = 4;
|
|
6
|
-
var STREAM_ROLE_CLIENT = 2;
|
|
7
|
-
function encodeChannel(message, writer) {
|
|
8
|
-
if (message.channelId !== "") writer.uint32(10).string(message.channelId);
|
|
9
|
-
if (message.workspaceId !== "") writer.uint32(18).string(message.workspaceId);
|
|
10
|
-
if (message.agentId !== "") writer.uint32(26).string(message.agentId);
|
|
11
|
-
if (message.kind !== 0) writer.uint32(32).int32(message.kind);
|
|
12
|
-
if (message.port !== 0) writer.uint32(40).uint32(message.port);
|
|
13
|
-
return writer;
|
|
14
|
-
}
|
|
15
|
-
function encodeStreamOpen(message) {
|
|
16
|
-
const writer = new BinaryWriter();
|
|
17
|
-
encodeChannel(message.channel, writer.uint32(10).fork()).join();
|
|
18
|
-
if (message.token !== "") writer.uint32(18).string(message.token);
|
|
19
|
-
if (message.role !== 0) writer.uint32(24).int32(message.role);
|
|
20
|
-
if (message.resumeFromSeq !== "0") writer.uint32(32).uint64(message.resumeFromSeq);
|
|
21
|
-
return writer.finish();
|
|
22
|
-
}
|
|
23
|
-
function decodeAgentErrorMessage(reader, length) {
|
|
24
|
-
const end = reader.pos + length;
|
|
25
|
-
let message;
|
|
26
|
-
while (reader.pos < end) {
|
|
27
|
-
const tag = reader.uint32();
|
|
28
|
-
if (tag >>> 3 === 2 && tag === 18) {
|
|
29
|
-
message = reader.string();
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
33
|
-
reader.skip(tag & 7);
|
|
34
|
-
}
|
|
35
|
-
return message !== void 0 ? { message } : {};
|
|
36
|
-
}
|
|
37
|
-
function decodeStreamOpenAck(bytes) {
|
|
38
|
-
const reader = new BinaryReader(bytes);
|
|
39
|
-
const end = reader.len;
|
|
40
|
-
let accepted = false;
|
|
41
|
-
let error;
|
|
42
|
-
while (reader.pos < end) {
|
|
43
|
-
const tag = reader.uint32();
|
|
44
|
-
if (tag >>> 3 === 1 && tag === 8) {
|
|
45
|
-
accepted = reader.bool();
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (tag >>> 3 === 2 && tag === 18) {
|
|
49
|
-
error = decodeAgentErrorMessage(reader, reader.uint32());
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
53
|
-
reader.skip(tag & 7);
|
|
54
|
-
}
|
|
55
|
-
return error !== void 0 ? { accepted, error } : { accepted };
|
|
56
|
-
}
|
|
57
|
-
function decodeStreamFrame(bytes) {
|
|
58
|
-
const reader = new BinaryReader(bytes);
|
|
59
|
-
const end = reader.len;
|
|
60
|
-
let data = new Uint8Array(0);
|
|
61
|
-
while (reader.pos < end) {
|
|
62
|
-
const tag = reader.uint32();
|
|
63
|
-
if (tag >>> 3 === 3 && tag === 26) {
|
|
64
|
-
data = new Uint8Array(reader.bytes());
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
68
|
-
reader.skip(tag & 7);
|
|
69
|
-
}
|
|
70
|
-
return { data };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
STREAM_KIND_DESKTOP,
|
|
75
|
-
STREAM_KIND_BROWSER,
|
|
76
|
-
STREAM_KIND_COMPUTER,
|
|
77
|
-
STREAM_ROLE_CLIENT,
|
|
78
|
-
encodeStreamOpen,
|
|
79
|
-
decodeStreamOpenAck,
|
|
80
|
-
decodeStreamFrame
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=chunk-6BBWWOOU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/relay-wire.ts"],"sourcesContent":["// Minimal HAND-MIRROR of the relay stream wire messages the desktop frame client\n// needs (`StreamOpen` encode; `StreamOpenAck` + `StreamFrame` decode). It exists\n// because the publish-closure guard (scripts/publish-closure-guard.ts) forbids\n// `@opengeni/react` from depending on `@opengeni/agent-proto` — the published SDK\n// closure may only reach `@opengeni/sdk` among `@opengeni/*` packages. So, exactly\n// as the guard prescribes (\"hand-mirror it\"), we re-encode just these three\n// messages against the third-party `@bufbuild/protobuf/wire` runtime (the same\n// runtime `@opengeni/agent-proto` generates against), byte-compatible with the\n// generated code. Field numbers copied verbatim from\n// `packages/agent-proto/src/gen/opengeni_agent.ts`:\n// StreamChannel: channelId=1, workspaceId=2, agentId=3, kind=4(int32), port=5(uint32)\n// StreamOpen: channel=1(msg), token=2, role=3(int32), resumeFromSeq=4(uint64, omitted when \"0\")\n// StreamOpenAck: accepted=1(bool), error=2(AgentError msg), resumeFromSeq=3\n// AgentError: code=1, message=2, retryable=3, detail=4 (we read only message)\n// StreamFrame: channelId=1, seq=2, data=3(bytes), producedAtMs=4 (we read only data)\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\n/** `StreamKind.STREAM_KIND_DESKTOP` (agent-proto enum value). */\nexport const STREAM_KIND_DESKTOP = 2;\n/** `StreamKind.STREAM_KIND_BROWSER` (agent-proto enum value). */\nexport const STREAM_KIND_BROWSER = 3;\n/** `StreamKind.STREAM_KIND_COMPUTER` (agent-proto enum value). */\nexport const STREAM_KIND_COMPUTER = 4;\n/** `StreamRole.STREAM_ROLE_CLIENT` (agent-proto enum value). */\nexport const STREAM_ROLE_CLIENT = 2;\n\nexport interface RelayChannel {\n channelId: string;\n workspaceId: string;\n agentId: string;\n kind: number;\n port: number;\n}\n\nexport interface RelayStreamOpen {\n channel: RelayChannel;\n token: string;\n role: number;\n resumeFromSeq: string;\n}\n\nfunction encodeChannel(message: RelayChannel, writer: BinaryWriter): BinaryWriter {\n if (message.channelId !== \"\") writer.uint32(10).string(message.channelId);\n if (message.workspaceId !== \"\") writer.uint32(18).string(message.workspaceId);\n if (message.agentId !== \"\") writer.uint32(26).string(message.agentId);\n if (message.kind !== 0) writer.uint32(32).int32(message.kind);\n if (message.port !== 0) writer.uint32(40).uint32(message.port);\n return writer;\n}\n\n/** Encode a `StreamOpen`, byte-compatible with `StreamOpen.encode(...).finish()`. */\nexport function encodeStreamOpen(message: RelayStreamOpen): Uint8Array {\n const writer = new BinaryWriter();\n encodeChannel(message.channel, writer.uint32(10).fork()).join();\n if (message.token !== \"\") writer.uint32(18).string(message.token);\n if (message.role !== 0) writer.uint32(24).int32(message.role);\n if (message.resumeFromSeq !== \"0\") writer.uint32(32).uint64(message.resumeFromSeq);\n return writer.finish();\n}\n\n/** The only `AgentError` field we surface from a rejected ack. */\nfunction decodeAgentErrorMessage(reader: BinaryReader, length: number): { message?: string } {\n const end = reader.pos + length;\n let message: string | undefined;\n while (reader.pos < end) {\n const tag = reader.uint32();\n if (tag >>> 3 === 2 && tag === 18) {\n message = reader.string();\n continue;\n }\n if ((tag & 7) === 4 || tag === 0) break;\n reader.skip(tag & 7);\n }\n return message !== undefined ? { message } : {};\n}\n\n/** Decode a `StreamOpenAck` (we need `accepted` + the error message). */\nexport function decodeStreamOpenAck(bytes: Uint8Array): {\n accepted: boolean;\n error?: { message?: string };\n} {\n const reader = new BinaryReader(bytes);\n const end = reader.len;\n let accepted = false;\n let error: { message?: string } | undefined;\n while (reader.pos < end) {\n const tag = reader.uint32();\n if (tag >>> 3 === 1 && tag === 8) {\n accepted = reader.bool();\n continue;\n }\n if (tag >>> 3 === 2 && tag === 18) {\n error = decodeAgentErrorMessage(reader, reader.uint32());\n continue;\n }\n if ((tag & 7) === 4 || tag === 0) break;\n reader.skip(tag & 7);\n }\n return error !== undefined ? { accepted, error } : { accepted };\n}\n\n/** Decode a `StreamFrame`, extracting only the `data` (framebuffer PNG) bytes. */\nexport function decodeStreamFrame(bytes: Uint8Array): { data: Uint8Array } {\n const reader = new BinaryReader(bytes);\n const end = reader.len;\n let data = new Uint8Array(0);\n while (reader.pos < end) {\n const tag = reader.uint32();\n if (tag >>> 3 === 3 && tag === 26) {\n // Copy into a fresh ArrayBuffer-backed view: BinaryReader.bytes() returns\n // `Uint8Array<ArrayBufferLike>` (a view into the message buffer), which both\n // narrows the type to `Uint8Array<ArrayBuffer>` and isolates just this frame.\n data = new Uint8Array(reader.bytes());\n continue;\n }\n if ((tag & 7) === 4 || tag === 0) break;\n reader.skip(tag & 7);\n }\n return { data };\n}\n"],"mappings":";AAeA,SAAS,cAAc,oBAAoB;AAGpC,IAAM,sBAAsB;AAE5B,IAAM,sBAAsB;AAE5B,IAAM,uBAAuB;AAE7B,IAAM,qBAAqB;AAiBlC,SAAS,cAAc,SAAuB,QAAoC;AAChF,MAAI,QAAQ,cAAc,GAAI,QAAO,OAAO,EAAE,EAAE,OAAO,QAAQ,SAAS;AACxE,MAAI,QAAQ,gBAAgB,GAAI,QAAO,OAAO,EAAE,EAAE,OAAO,QAAQ,WAAW;AAC5E,MAAI,QAAQ,YAAY,GAAI,QAAO,OAAO,EAAE,EAAE,OAAO,QAAQ,OAAO;AACpE,MAAI,QAAQ,SAAS,EAAG,QAAO,OAAO,EAAE,EAAE,MAAM,QAAQ,IAAI;AAC5D,MAAI,QAAQ,SAAS,EAAG,QAAO,OAAO,EAAE,EAAE,OAAO,QAAQ,IAAI;AAC7D,SAAO;AACT;AAGO,SAAS,iBAAiB,SAAsC;AACrE,QAAM,SAAS,IAAI,aAAa;AAChC,gBAAc,QAAQ,SAAS,OAAO,OAAO,EAAE,EAAE,KAAK,CAAC,EAAE,KAAK;AAC9D,MAAI,QAAQ,UAAU,GAAI,QAAO,OAAO,EAAE,EAAE,OAAO,QAAQ,KAAK;AAChE,MAAI,QAAQ,SAAS,EAAG,QAAO,OAAO,EAAE,EAAE,MAAM,QAAQ,IAAI;AAC5D,MAAI,QAAQ,kBAAkB,IAAK,QAAO,OAAO,EAAE,EAAE,OAAO,QAAQ,aAAa;AACjF,SAAO,OAAO,OAAO;AACvB;AAGA,SAAS,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