@opengeni/react 1.0.2-canary.37191796234001 → 1.0.2
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 +15 -6
- package/dist/artifacts.js +1 -1
- package/dist/{browser-viewer-GTR5XQ7X.js → browser-viewer-SHYKQRNX.js} +4 -4
- package/dist/{chunk-CR7U7HAR.js → chunk-26ZNDDLZ.js} +3 -3
- package/dist/{chunk-ELCE5SXV.js → chunk-3CTRFMAK.js} +2 -2
- package/dist/{chunk-XOAMRDDK.js → chunk-742CZ3L3.js} +2 -2
- package/dist/{chunk-H2NJQORO.js → chunk-DO544OSV.js} +7 -1
- package/dist/chunk-DO544OSV.js.map +1 -0
- package/dist/{chunk-IQUCRAT7.js → chunk-EESD3PY3.js} +2 -2
- package/dist/{chunk-23J2ZNXT.js → chunk-EN3YTHKR.js} +3 -3
- package/dist/{chunk-JFNEV4LU.js → chunk-GYVRFZDY.js} +3 -3
- package/dist/{chunk-YWFG7ZX7.js → chunk-HDJWDK7W.js} +3 -3
- package/dist/{chunk-NZUI76EM.js → chunk-J6DBS4T3.js} +2 -2
- package/dist/{chunk-SJZDKVW2.js → chunk-JIQYUGVL.js} +4 -4
- package/dist/{chunk-XUW2UWQM.js → chunk-RLUSC2WA.js} +3 -3
- package/dist/{chunk-XUW2UWQM.js.map → chunk-RLUSC2WA.js.map} +1 -1
- package/dist/{chunk-Q5QBEZIQ.js → chunk-RSI7XYXL.js} +2 -2
- package/dist/{chunk-NEXLLTP4.js → chunk-TKOTKRWY.js} +4 -4
- package/dist/{chunk-NEXLLTP4.js.map → chunk-TKOTKRWY.js.map} +1 -1
- package/dist/{chunk-TMJRG4YC.js → chunk-VV5E43LD.js} +432 -180
- package/dist/chunk-VV5E43LD.js.map +1 -0
- package/dist/{chunk-FFA2OVOV.js → chunk-WGXVEJO5.js} +3 -3
- package/dist/{chunk-E3G7SAYZ.js → chunk-YM2DE7BQ.js} +2 -2
- package/dist/components/open-geni-chat.d.ts +6 -3
- package/dist/components/session-conversation.d.ts +6 -3
- package/dist/components/session-proxy-scope.d.ts +21 -0
- package/dist/composer.js +6 -6
- package/dist/{computer-viewer-ENHVAZ2Q.js → computer-viewer-6SRGWRUX.js} +4 -4
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +4 -4
- package/dist/{latest-question-755OW5DS.js → latest-question-HTRIS4KJ.js} +2 -2
- package/dist/lib/host-theme.d.ts +7 -0
- package/dist/machines.js +3 -3
- package/dist/{model-policy-picker-menu-PWRI7R2X.js → model-policy-picker-menu-M54ISBMN.js} +4 -4
- package/dist/model-policy.js +1 -1
- package/dist/realtime.js +3 -3
- package/dist/{sandbox-files-BBC47SLD.js → sandbox-files-GORZOUUJ.js} +4 -4
- package/dist/session-ui.js +9 -9
- package/dist/session.js +5 -5
- package/dist/timeline/turn-summary.d.ts +3 -1
- package/dist/timeline/types.d.ts +6 -0
- package/dist/usage.js +1 -1
- package/package.json +3 -3
- package/src/components/message-timeline.tsx +704 -450
- package/src/components/open-geni-chat.tsx +56 -37
- package/src/components/session-conversation.tsx +87 -73
- package/src/components/session-proxy-scope.tsx +92 -0
- package/src/hooks/use-session-background-commands.ts +2 -2
- package/src/hooks/use-video-artifact-playback.ts +1 -1
- package/src/lib/host-theme.ts +15 -2
- package/src/model-policy.ts +2 -2
- package/src/session-context.ts +3 -3
- package/src/timeline/projection.ts +9 -0
- package/src/timeline/turn-summary.tsx +10 -0
- package/src/timeline/types.ts +6 -0
- package/dist/chunk-H2NJQORO.js.map +0 -1
- package/dist/chunk-TMJRG4YC.js.map +0 -1
- /package/dist/{browser-viewer-GTR5XQ7X.js.map → browser-viewer-SHYKQRNX.js.map} +0 -0
- /package/dist/{chunk-CR7U7HAR.js.map → chunk-26ZNDDLZ.js.map} +0 -0
- /package/dist/{chunk-ELCE5SXV.js.map → chunk-3CTRFMAK.js.map} +0 -0
- /package/dist/{chunk-XOAMRDDK.js.map → chunk-742CZ3L3.js.map} +0 -0
- /package/dist/{chunk-IQUCRAT7.js.map → chunk-EESD3PY3.js.map} +0 -0
- /package/dist/{chunk-23J2ZNXT.js.map → chunk-EN3YTHKR.js.map} +0 -0
- /package/dist/{chunk-JFNEV4LU.js.map → chunk-GYVRFZDY.js.map} +0 -0
- /package/dist/{chunk-YWFG7ZX7.js.map → chunk-HDJWDK7W.js.map} +0 -0
- /package/dist/{chunk-NZUI76EM.js.map → chunk-J6DBS4T3.js.map} +0 -0
- /package/dist/{chunk-SJZDKVW2.js.map → chunk-JIQYUGVL.js.map} +0 -0
- /package/dist/{chunk-Q5QBEZIQ.js.map → chunk-RSI7XYXL.js.map} +0 -0
- /package/dist/{chunk-FFA2OVOV.js.map → chunk-WGXVEJO5.js.map} +0 -0
- /package/dist/{chunk-E3G7SAYZ.js.map → chunk-YM2DE7BQ.js.map} +0 -0
- /package/dist/{computer-viewer-ENHVAZ2Q.js.map → computer-viewer-6SRGWRUX.js.map} +0 -0
- /package/dist/{latest-question-755OW5DS.js.map → latest-question-HTRIS4KJ.js.map} +0 -0
- /package/dist/{model-policy-picker-menu-PWRI7R2X.js.map → model-policy-picker-menu-M54ISBMN.js.map} +0 -0
- /package/dist/{sandbox-files-BBC47SLD.js.map → sandbox-files-GORZOUUJ.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YQEAA6LT.js";
|
|
4
4
|
import {
|
|
5
5
|
useEmbeddedInterventions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TKOTKRWY.js";
|
|
7
7
|
import {
|
|
8
8
|
cn
|
|
9
9
|
} from "./chunk-22KP6LR5.js";
|
|
@@ -368,4 +368,4 @@ export {
|
|
|
368
368
|
InteractionInterventionBanner,
|
|
369
369
|
useViewerMenuDismiss
|
|
370
370
|
};
|
|
371
|
-
//# sourceMappingURL=chunk-
|
|
371
|
+
//# sourceMappingURL=chunk-J6DBS4T3.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
buildTimeline,
|
|
3
3
|
groupTimeline,
|
|
4
4
|
sessionStatusFromEvents
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DO544OSV.js";
|
|
6
6
|
import {
|
|
7
7
|
useDebouncedCallback,
|
|
8
8
|
useMutationRunner,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
useEmbeddedHumanInputSession,
|
|
20
20
|
useEmbeddedSession,
|
|
21
21
|
useEmbeddedSessionRead
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TKOTKRWY.js";
|
|
23
23
|
|
|
24
24
|
// src/human-input.ts
|
|
25
25
|
function isActionableHumanInputRequest(request, nowMs = Date.now()) {
|
|
@@ -834,7 +834,7 @@ function useSessionEvents(sessionId, options = {}) {
|
|
|
834
834
|
let generation = navigationGenerationRef.current;
|
|
835
835
|
const current = () => ownsNavigation() && generation === navigationGenerationRef.current;
|
|
836
836
|
try {
|
|
837
|
-
const { resolveLatestQuestion } = await import("./latest-question-
|
|
837
|
+
const { resolveLatestQuestion } = await import("./latest-question-HTRIS4KJ.js");
|
|
838
838
|
if (!current()) return null;
|
|
839
839
|
const destination = await resolveLatestQuestion({
|
|
840
840
|
client,
|
|
@@ -2326,4 +2326,4 @@ export {
|
|
|
2326
2326
|
projectPendingApprovals,
|
|
2327
2327
|
conversationTimeline
|
|
2328
2328
|
};
|
|
2329
|
-
//# sourceMappingURL=chunk-
|
|
2329
|
+
//# sourceMappingURL=chunk-JIQYUGVL.js.map
|
|
@@ -159,7 +159,7 @@ function workspaceProviderPayerSummary(model) {
|
|
|
159
159
|
if (model.provider === "workspace-anthropic")
|
|
160
160
|
return "Billed to the workspace Anthropic API account";
|
|
161
161
|
if (model.provider === "workspace-claude-subscription")
|
|
162
|
-
return "Uses the workspace Claude subscription \xB7 no
|
|
162
|
+
return "Uses the workspace Claude subscription \xB7 no Opengeni credits";
|
|
163
163
|
if (model.provider === "workspace-openrouter") {
|
|
164
164
|
return "Billed to the workspace OpenRouter account";
|
|
165
165
|
}
|
|
@@ -172,7 +172,7 @@ function organizationProviderPayerSummary(model) {
|
|
|
172
172
|
if (model.provider === "organization-anthropic")
|
|
173
173
|
return "Billed to the organization Anthropic API account";
|
|
174
174
|
if (model.provider === "organization-claude-subscription")
|
|
175
|
-
return "Uses the connected Claude subscription \xB7 no
|
|
175
|
+
return "Uses the connected Claude subscription \xB7 no Opengeni credits";
|
|
176
176
|
if (model.provider === "organization-openrouter") {
|
|
177
177
|
return "Billed to the organization OpenRouter account";
|
|
178
178
|
}
|
|
@@ -296,4 +296,4 @@ export {
|
|
|
296
296
|
modelDisplayName2 as modelDisplayName,
|
|
297
297
|
modelVendor
|
|
298
298
|
};
|
|
299
|
-
//# sourceMappingURL=chunk-
|
|
299
|
+
//# sourceMappingURL=chunk-RLUSC2WA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/model-policy.ts"],"sourcesContent":["import {\n compareModelPickerOrder,\n modelPickerBillingClassFor,\n type ModelPickerBillingClass,\n} from \"@opengeni/sdk/model-picker-order\";\nimport { modelDisplayName } from \"@opengeni/sdk/model-display\";\nimport type { ClientModel, ReasoningEffort, WorkspaceModelCatalogModel } from \"@opengeni/sdk\";\n\nexport type PickerBillingClass = ModelPickerBillingClass;\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_LABELS: Record<PickerBillingClass, string> = {\n opengeni_credits: \"Models\",\n external: \"External\",\n codex_subscription: \"Codex\",\n supergrok_subscription: \"SuperGrok\",\n claude_subscription: \"Claude subscription\",\n // Who connected the key (organization or workspace) is a settings fact, not\n // a model choice: both scopes share one label and one picker group.\n byok: \"API keys\",\n organization_byok: \"API keys\",\n};\n\n/** Models settings keeps naming who connected the key. */\nconst SCOPED_BILLING_CLASS_LABELS: Record<PickerBillingClass, string> = {\n ...BILLING_CLASS_LABELS,\n byok: \"Workspace providers\",\n organization_byok: \"Organization providers\",\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.provider === \"organization-gateway\" || model.provider === \"organization-openrouter\") {\n return \"organization_byok\";\n }\n if (\n model.provider?.startsWith(\"workspace-openai-\") ||\n model.provider?.startsWith(\"workspace-azure-openai-\")\n )\n return \"byok\";\n if (model.provider === \"workspace-gateway\" || model.provider === \"workspace-openrouter\") {\n return \"byok\";\n }\n return modelPickerBillingClassFor(model);\n}\n\nexport function billingClassLabel(billingClass: PickerBillingClass): string {\n return BILLING_CLASS_LABELS[billingClass];\n}\n\n/** The group label that names the connection scope, for Models settings only. */\nexport function scopedBillingClassLabel(billingClass: PickerBillingClass): string {\n return SCOPED_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\n/** Payment prompts must use cost policy, never the presentation group. */\nexport function modelUsesCredits(model: ClientModel | undefined): boolean {\n if (model?.cost !== undefined) return model.cost === \"credits\";\n return model?.billing?.metering === \"opengeni_credits\";\n}\n\nexport function payerSummaryForModel(model: ClientModel): string {\n if (model.cost === \"free\") {\n return \"Free in this deployment\";\n }\n if (model.cost === \"credits\") {\n return \"Opengeni credits\";\n }\n if (model.cost === \"subscription\") {\n return model.credentialSource?.kind === \"connected_subscription\" &&\n model.credentialSource.provider === \"claude\"\n ? \"Claude subscription · external billing\"\n : model.source === \"supergrok\"\n ? \"SuperGrok subscription · external billing\"\n : \"Codex subscription · external billing\";\n }\n if (model.cost === \"workspace\") {\n return workspaceProviderPayerSummary(model);\n }\n if (model.cost === \"organization\") {\n return organizationProviderPayerSummary(model);\n }\n\n // Older client-config payloads do not carry `cost`; preserve their existing\n // settlement-derived label until every deployment has rolled forward.\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 model.credentialSource?.kind === \"connected_subscription\" &&\n model.credentialSource.provider === \"claude\"\n ? \"Claude subscription · external billing\"\n : model.source === \"supergrok\"\n ? \"SuperGrok subscription · external billing\"\n : \"Codex subscription · external billing\";\n }\n if (billing.upstreamPayer === \"workspace\") {\n return workspaceProviderPayerSummary(model);\n }\n if (billing.upstreamPayer === \"organization\") {\n return organizationProviderPayerSummary(model);\n }\n return billing.upstreamPayer === \"deployment\"\n ? \"Opengeni · no model credits\"\n : \"External provider · no Opengeni credits\";\n}\n\nexport function advancedSourceSummary(model: ClientModel): string | null {\n const source = model.credentialSource;\n if (!source) {\n return model.billing?.metering === \"external\" && model.billing.upstreamPayer === \"deployment\"\n ? \"Deployment-provided connection\"\n : null;\n }\n if (source.kind === \"connected_subscription\") {\n return source.provider === \"claude\"\n ? \"Connected Claude subscription\"\n : source.provider === \"xai\"\n ? \"Connected SuperGrok subscription\"\n : \"Connected Codex subscription\";\n }\n if (source.kind === \"workspace_connection\") {\n if (model.provider === \"workspace-openrouter\") {\n return \"Workspace OpenRouter connection\";\n }\n if (model.provider === \"workspace-gateway\" || model.source === \"workspace_gateway\") {\n return \"Workspace Vercel AI Gateway\";\n }\n return \"Workspace provider connection\";\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\nfunction workspaceProviderPayerSummary(model: ClientModel): string {\n if (model.provider === \"workspace-anthropic\")\n return \"Billed to the workspace Anthropic API account\";\n if (model.provider === \"workspace-claude-subscription\")\n return \"Uses the workspace Claude subscription · no OpenGeni credits\";\n if (model.provider === \"workspace-openrouter\") {\n return \"Billed to the workspace OpenRouter account\";\n }\n if (model.provider === \"workspace-gateway\" || model.source === \"workspace_gateway\") {\n return \"Billed to the workspace Vercel account\";\n }\n return \"Billed to the workspace provider account\";\n}\n\nfunction organizationProviderPayerSummary(model: ClientModel): string {\n if (model.provider === \"organization-anthropic\")\n return \"Billed to the organization Anthropic API account\";\n if (model.provider === \"organization-claude-subscription\")\n return \"Uses the connected Claude subscription · no OpenGeni credits\";\n if (model.provider === \"organization-openrouter\") {\n return \"Billed to the organization OpenRouter account\";\n }\n if (model.provider === \"organization-gateway\") {\n return \"Billed to the organization Vercel account\";\n }\n return \"Billed to the organization provider account\";\n}\n\n/**\n * The curated compact label, else the family-free name for Claude models\n * (\"Opus 5.5\"): the maker's mark beside it already says Claude.\n */\nfunction compactLabel(catalog: ClientModel): { shortLabel?: string } {\n if (catalog.shortLabel) return { shortLabel: catalog.shortLabel };\n const name = modelDisplayName(catalog);\n return name.startsWith(\"Claude \") ? { shortLabel: name.slice(\"Claude \".length) } : {};\n}\n\nexport function projectPickerRows(models: WorkspaceModelCatalogModel[]): PickerModelRow[] {\n return models\n .filter((catalog) => catalog.credentialReadiness.status === \"ready\")\n .map((catalog) => {\n const billingClass = billingClassForModel(catalog);\n return {\n id: catalog.id,\n label: modelDisplayName(catalog),\n ...compactLabel(catalog),\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: modelDisplayName(catalog),\n ...compactLabel(catalog),\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(compareModelPickerOrder);\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 type GroupPickerRowsOptions = {\n codexOnly?: boolean;\n /**\n * Default true: organization- and workspace-connected keys share one group\n * and identical copies show once. Models settings passes false.\n */\n collapseScopes?: boolean | undefined;\n /** Kept visible when it has an identical twin (see below). */\n selectedId?: string | undefined;\n};\n\n/**\n * Organization- and workspace-connected API keys are one choice for the person\n * picking a model, so they share one group.\n */\nfunction displayGroupFor(billingClass: PickerBillingClass): PickerBillingClass {\n return billingClass === \"organization_byok\" ? \"byok\" : billingClass;\n}\n\n/**\n * The same model through the same provider kind, whichever scope connected it:\n * `organization-anthropic/claude-opus-5-5` and `workspace-anthropic/claude-opus-5-5`\n * share a key, while OpenRouter and the Anthropic API never do (different\n * accounts and bills).\n */\nfunction scopeFreeIdentity(row: PickerModelRow<ClientModel>): string | null {\n const provider = row.provider.replace(/^(?:organization|workspace)-/, \"\");\n if (provider === row.provider) return null;\n const upstream =\n row.catalog.deployment?.upstreamModelId ??\n (row.id.startsWith(`${row.provider}/`) ? row.id.slice(row.provider.length + 1) : row.id);\n return `${provider}\\u0000${upstream}`;\n}\n\n/**\n * Two rows that are the same model through the same provider kind, connected\n * by the organization and by the workspace, are one choice: show one. Keep the\n * current selection, else a selectable row, else the first in picker order.\n */\nfunction prefersTwin<TCatalog extends ClientModel>(\n candidate: PickerModelRow<TCatalog>,\n current: PickerModelRow<TCatalog>,\n selectedId: string | undefined,\n): boolean {\n if (selectedId !== undefined && current.id === selectedId) return false;\n if (selectedId !== undefined && candidate.id === selectedId) return true;\n return candidate.selectable && !current.selectable;\n}\n\nexport function groupPickerRowsByBillingClass(\n rows: PickerModelRow[],\n options?: GroupPickerRowsOptions,\n): Array<{ billingClass: PickerBillingClass; label: string; rows: PickerModelRow[] }>;\nexport function groupPickerRowsByBillingClass<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n options?: GroupPickerRowsOptions,\n): Array<{\n billingClass: PickerBillingClass;\n label: string;\n rows: PickerModelRow<TCatalog>[];\n}>;\nexport function groupPickerRowsByBillingClass<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n options?: GroupPickerRowsOptions,\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 collapse = options?.collapseScopes !== false;\n const billingClass = collapse ? displayGroupFor(row.billingClass) : row.billingClass;\n const existing = groups.find((group) => group.billingClass === billingClass);\n if (existing) {\n const identity = collapse ? scopeFreeIdentity(row) : null;\n const twin =\n identity === null\n ? -1\n : existing.rows.findIndex((candidate) => scopeFreeIdentity(candidate) === identity);\n if (twin < 0) {\n existing.rows.push(row);\n } else if (prefersTwin(row, existing.rows[twin]!, options?.selectedId)) {\n existing.rows[twin] = row;\n }\n continue;\n }\n groups.push({\n billingClass,\n label:\n billingClass === row.billingClass ? row.billingClassLabel : billingClassLabel(billingClass),\n rows: [row],\n });\n }\n const codexIndex = groups.findIndex((group) => group.billingClass === \"codex_subscription\");\n const codex = groups[codexIndex];\n const selectableOpenGeni = groups\n .find((group) => group.billingClass === \"opengeni_credits\")\n ?.rows.filter((row) => row.selectable);\n // Presentation only: never change the catalog/default model ordering or selection.\n const onlyFreeOpenGeni =\n selectableOpenGeni !== undefined &&\n selectableOpenGeni.length > 0 &&\n selectableOpenGeni.every((row) => row.catalog.cost === \"free\");\n if (\n codex &&\n codex.rows.some((row) => row.selectable) &&\n (options?.codexOnly || onlyFreeOpenGeni)\n ) {\n groups.splice(codexIndex, 1);\n groups.unshift(codex);\n }\n return groups;\n}\nexport { modelDisplayName, modelVendor } from \"@opengeni/sd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xE,UAAM,WAAW,OAAO,KAAK,CAAC,UAAU,MAAM,iBAAiB,YAAY;AAC3E,QAAI,UAAU;AACZ,YAAM,WAAW,WAAW,kBAAkB,GAAG,IAAI;AACrD,YAAM,OACJ,aAAa,OACT,KACA,SAAS,KAAK,UAAU,CAAC,cAAc,kBAAkB,SAAS,MAAM,QAAQ;AACtF,UAAI,OAAO,GAAG;AACZ,iBAAS,KAAK,KAAK,GAAG;AAAA,MACxB,WAAW,YAAY,KAAK,SAAS,KAAK,IAAI,GAAI,SAAS,UAAU,GAAG;AACtE,iBAAS,KAAK,IAAI,IAAI;AAAA,MACxB;AACA;AAAA,IACF;AACA,WAAO,KAAK;AAAA,MACV;AAAA,MACA,OACE,iBAAiB,IAAI,eAAe,IAAI,oBAAoB,kBAAkB,YAAY;AAAA,MAC5F,MAAM,CAAC,GAAG;AAAA,IACZ,CAAC;AAAA,EACH;AACA,QAAM,aAAa,OAAO,UAAU,CAAC,UAAU,MAAM,iBAAiB,oBAAoB;AAC1F,QAAM,QAAQ,OAAO,UAAU;AAC/B,QAAM,qBAAqB,OACxB,KAAK,CAAC,UAAU,MAAM,iBAAiB,kBAAkB,GACxD,KAAK,OAAO,CAAC,QAAQ,IAAI,UAAU;AAEvC,QAAM,mBACJ,uBAAuB,UACvB,mBAAmB,SAAS,KAC5B,mBAAmB,MAAM,CAAC,QAAQ,IAAI,QAAQ,SAAS,MAAM;AAC/D,MACE,SACA,MAAM,KAAK,KAAK,CAAC,QAAQ,IAAI,UAAU,MACtC,SAAS,aAAa,mBACvB;AACA,WAAO,OAAO,YAAY,CAAC;AAC3B,WAAO,QAAQ,KAAK;AAAA,EACtB;AACA,SAAO;AACT;","names":["modelDisplayName"]}
|
|
1
|
+
{"version":3,"sources":["../src/model-policy.ts"],"sourcesContent":["import {\n compareModelPickerOrder,\n modelPickerBillingClassFor,\n type ModelPickerBillingClass,\n} from \"@opengeni/sdk/model-picker-order\";\nimport { modelDisplayName } from \"@opengeni/sdk/model-display\";\nimport type { ClientModel, ReasoningEffort, WorkspaceModelCatalogModel } from \"@opengeni/sdk\";\n\nexport type PickerBillingClass = ModelPickerBillingClass;\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_LABELS: Record<PickerBillingClass, string> = {\n opengeni_credits: \"Models\",\n external: \"External\",\n codex_subscription: \"Codex\",\n supergrok_subscription: \"SuperGrok\",\n claude_subscription: \"Claude subscription\",\n // Who connected the key (organization or workspace) is a settings fact, not\n // a model choice: both scopes share one label and one picker group.\n byok: \"API keys\",\n organization_byok: \"API keys\",\n};\n\n/** Models settings keeps naming who connected the key. */\nconst SCOPED_BILLING_CLASS_LABELS: Record<PickerBillingClass, string> = {\n ...BILLING_CLASS_LABELS,\n byok: \"Workspace providers\",\n organization_byok: \"Organization providers\",\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.provider === \"organization-gateway\" || model.provider === \"organization-openrouter\") {\n return \"organization_byok\";\n }\n if (\n model.provider?.startsWith(\"workspace-openai-\") ||\n model.provider?.startsWith(\"workspace-azure-openai-\")\n )\n return \"byok\";\n if (model.provider === \"workspace-gateway\" || model.provider === \"workspace-openrouter\") {\n return \"byok\";\n }\n return modelPickerBillingClassFor(model);\n}\n\nexport function billingClassLabel(billingClass: PickerBillingClass): string {\n return BILLING_CLASS_LABELS[billingClass];\n}\n\n/** The group label that names the connection scope, for Models settings only. */\nexport function scopedBillingClassLabel(billingClass: PickerBillingClass): string {\n return SCOPED_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\n/** Payment prompts must use cost policy, never the presentation group. */\nexport function modelUsesCredits(model: ClientModel | undefined): boolean {\n if (model?.cost !== undefined) return model.cost === \"credits\";\n return model?.billing?.metering === \"opengeni_credits\";\n}\n\nexport function payerSummaryForModel(model: ClientModel): string {\n if (model.cost === \"free\") {\n return \"Free in this deployment\";\n }\n if (model.cost === \"credits\") {\n return \"Opengeni credits\";\n }\n if (model.cost === \"subscription\") {\n return model.credentialSource?.kind === \"connected_subscription\" &&\n model.credentialSource.provider === \"claude\"\n ? \"Claude subscription · external billing\"\n : model.source === \"supergrok\"\n ? \"SuperGrok subscription · external billing\"\n : \"Codex subscription · external billing\";\n }\n if (model.cost === \"workspace\") {\n return workspaceProviderPayerSummary(model);\n }\n if (model.cost === \"organization\") {\n return organizationProviderPayerSummary(model);\n }\n\n // Older client-config payloads do not carry `cost`; preserve their existing\n // settlement-derived label until every deployment has rolled forward.\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 model.credentialSource?.kind === \"connected_subscription\" &&\n model.credentialSource.provider === \"claude\"\n ? \"Claude subscription · external billing\"\n : model.source === \"supergrok\"\n ? \"SuperGrok subscription · external billing\"\n : \"Codex subscription · external billing\";\n }\n if (billing.upstreamPayer === \"workspace\") {\n return workspaceProviderPayerSummary(model);\n }\n if (billing.upstreamPayer === \"organization\") {\n return organizationProviderPayerSummary(model);\n }\n return billing.upstreamPayer === \"deployment\"\n ? \"Opengeni · no model credits\"\n : \"External provider · no Opengeni credits\";\n}\n\nexport function advancedSourceSummary(model: ClientModel): string | null {\n const source = model.credentialSource;\n if (!source) {\n return model.billing?.metering === \"external\" && model.billing.upstreamPayer === \"deployment\"\n ? \"Deployment-provided connection\"\n : null;\n }\n if (source.kind === \"connected_subscription\") {\n return source.provider === \"claude\"\n ? \"Connected Claude subscription\"\n : source.provider === \"xai\"\n ? \"Connected SuperGrok subscription\"\n : \"Connected Codex subscription\";\n }\n if (source.kind === \"workspace_connection\") {\n if (model.provider === \"workspace-openrouter\") {\n return \"Workspace OpenRouter connection\";\n }\n if (model.provider === \"workspace-gateway\" || model.source === \"workspace_gateway\") {\n return \"Workspace Vercel AI Gateway\";\n }\n return \"Workspace provider connection\";\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\nfunction workspaceProviderPayerSummary(model: ClientModel): string {\n if (model.provider === \"workspace-anthropic\")\n return \"Billed to the workspace Anthropic API account\";\n if (model.provider === \"workspace-claude-subscription\")\n return \"Uses the workspace Claude subscription · no Opengeni credits\";\n if (model.provider === \"workspace-openrouter\") {\n return \"Billed to the workspace OpenRouter account\";\n }\n if (model.provider === \"workspace-gateway\" || model.source === \"workspace_gateway\") {\n return \"Billed to the workspace Vercel account\";\n }\n return \"Billed to the workspace provider account\";\n}\n\nfunction organizationProviderPayerSummary(model: ClientModel): string {\n if (model.provider === \"organization-anthropic\")\n return \"Billed to the organization Anthropic API account\";\n if (model.provider === \"organization-claude-subscription\")\n return \"Uses the connected Claude subscription · no Opengeni credits\";\n if (model.provider === \"organization-openrouter\") {\n return \"Billed to the organization OpenRouter account\";\n }\n if (model.provider === \"organization-gateway\") {\n return \"Billed to the organization Vercel account\";\n }\n return \"Billed to the organization provider account\";\n}\n\n/**\n * The curated compact label, else the family-free name for Claude models\n * (\"Opus 5.5\"): the maker's mark beside it already says Claude.\n */\nfunction compactLabel(catalog: ClientModel): { shortLabel?: string } {\n if (catalog.shortLabel) return { shortLabel: catalog.shortLabel };\n const name = modelDisplayName(catalog);\n return name.startsWith(\"Claude \") ? { shortLabel: name.slice(\"Claude \".length) } : {};\n}\n\nexport function projectPickerRows(models: WorkspaceModelCatalogModel[]): PickerModelRow[] {\n return models\n .filter((catalog) => catalog.credentialReadiness.status === \"ready\")\n .map((catalog) => {\n const billingClass = billingClassForModel(catalog);\n return {\n id: catalog.id,\n label: modelDisplayName(catalog),\n ...compactLabel(catalog),\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: modelDisplayName(catalog),\n ...compactLabel(catalog),\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(compareModelPickerOrder);\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 type GroupPickerRowsOptions = {\n codexOnly?: boolean;\n /**\n * Default true: organization- and workspace-connected keys share one group\n * and identical copies show once. Models settings passes false.\n */\n collapseScopes?: boolean | undefined;\n /** Kept visible when it has an identical twin (see below). */\n selectedId?: string | undefined;\n};\n\n/**\n * Organization- and workspace-connected API keys are one choice for the person\n * picking a model, so they share one group.\n */\nfunction displayGroupFor(billingClass: PickerBillingClass): PickerBillingClass {\n return billingClass === \"organization_byok\" ? \"byok\" : billingClass;\n}\n\n/**\n * The same model through the same provider kind, whichever scope connected it:\n * `organization-anthropic/claude-opus-5-5` and `workspace-anthropic/claude-opus-5-5`\n * share a key, while OpenRouter and the Anthropic API never do (different\n * accounts and bills).\n */\nfunction scopeFreeIdentity(row: PickerModelRow<ClientModel>): string | null {\n const provider = row.provider.replace(/^(?:organization|workspace)-/, \"\");\n if (provider === row.provider) return null;\n const upstream =\n row.catalog.deployment?.upstreamModelId ??\n (row.id.startsWith(`${row.provider}/`) ? row.id.slice(row.provider.length + 1) : row.id);\n return `${provider}\\u0000${upstream}`;\n}\n\n/**\n * Two rows that are the same model through the same provider kind, connected\n * by the organization and by the workspace, are one choice: show one. Keep the\n * current selection, else a selectable row, else the first in picker order.\n */\nfunction prefersTwin<TCatalog extends ClientModel>(\n candidate: PickerModelRow<TCatalog>,\n current: PickerModelRow<TCatalog>,\n selectedId: string | undefined,\n): boolean {\n if (selectedId !== undefined && current.id === selectedId) return false;\n if (selectedId !== undefined && candidate.id === selectedId) return true;\n return candidate.selectable && !current.selectable;\n}\n\nexport function groupPickerRowsByBillingClass(\n rows: PickerModelRow[],\n options?: GroupPickerRowsOptions,\n): Array<{ billingClass: PickerBillingClass; label: string; rows: PickerModelRow[] }>;\nexport function groupPickerRowsByBillingClass<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n options?: GroupPickerRowsOptions,\n): Array<{\n billingClass: PickerBillingClass;\n label: string;\n rows: PickerModelRow<TCatalog>[];\n}>;\nexport function groupPickerRowsByBillingClass<TCatalog extends ClientModel>(\n rows: PickerModelRow<TCatalog>[],\n options?: GroupPickerRowsOptions,\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 collapse = options?.collapseScopes !== false;\n const billingClass = collapse ? displayGroupFor(row.billingClass) : row.billingClass;\n const existing = groups.find((group) => group.billingClass === billingClass);\n if (existing) {\n const identity = collapse ? scopeFreeIdentity(row) : null;\n const twin =\n identity === null\n ? -1\n : existing.rows.findIndex((candidate) => scopeFreeIdentity(candidate) === identity);\n if (twin < 0) {\n existing.rows.push(row);\n } else if (prefersTwin(row, existing.rows[twin]!, options?.selectedId)) {\n existing.rows[twin] = row;\n }\n continue;\n }\n groups.push({\n billingClass,\n label:\n billingClass === row.billingClass ? row.billingClassLabel : billingClassLabel(billingClass),\n rows: [row],\n });\n }\n const codexIndex = groups.findIndex((group) => group.billingClass === \"codex_subscription\");\n const codex = groups[codexIndex];\n const selectableOpenGeni = groups\n .find((group) => group.billingClass === \"opengeni_credits\")\n ?.rows.filter((row) => row.selectable);\n // Presentation only: never change the catalog/default model ordering or selection.\n const onlyFreeOpenGeni =\n selectableOpenGeni !== undefined &&\n selectableOpenGeni.length > 0 &&\n selectableOpenGeni.every((row) => row.catalog.cost === \"free\");\n if (\n codex &&\n codex.rows.some((row) => row.selectable) &&\n (options?.codexOnly || onlyFreeOpenGeni)\n ) {\n groups.splice(codexIndex, 1);\n groups.unshift(codex);\n }\n return groups;\n}\nexport { modelDisplayName, modelVendor } from \"@opengeni/sdk/model-display\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,wBAAwB;AAgbjC,SAAS,oBAAAA,mBAAkB,mBAAmB;AA3Z9C,IAAM,uBAA2D;AAAA,EAC/D,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,qBAAqB;AAAA;AAAA;AAAA,EAGrB,MAAM;AAAA,EACN,mBAAmB;AACrB;AAGA,IAAM,8BAAkE;AAAA,EACtE,GAAG;AAAA,EACH,MAAM;AAAA,EACN,mBAAmB;AACrB;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,aAAa,0BAA0B,MAAM,aAAa,2BAA2B;AAC7F,WAAO;AAAA,EACT;AACA,MACE,MAAM,UAAU,WAAW,mBAAmB,KAC9C,MAAM,UAAU,WAAW,yBAAyB;AAEpD,WAAO;A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K,OAAO,CAAC,QAAQ,IAAI,UAAU;AAEvC,QAAM,mBACJ,uBAAuB,UACvB,mBAAmB,SAAS,KAC5B,mBAAmB,MAAM,CAAC,QAAQ,IAAI,QAAQ,SAAS,MAAM;AAC/D,MACE,SACA,MAAM,KAAK,KAAK,CAAC,QAAQ,IAAI,UAAU,MACtC,SAAS,aAAa,mBACvB;AACA,WAAO,OAAO,YAAY,CAAC;AAC3B,WAAO,QAAQ,KAAK;AAAA,EACtB;AACA,SAAO;AACT;","names":["modelDisplayName"]}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-UGLEYEMP.js";
|
|
16
16
|
import {
|
|
17
17
|
useEmbeddedSession
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TKOTKRWY.js";
|
|
19
19
|
|
|
20
20
|
// src/hooks/use-composer.ts
|
|
21
21
|
import {
|
|
@@ -2152,4 +2152,4 @@ export {
|
|
|
2152
2152
|
shouldSubmitOnKey,
|
|
2153
2153
|
shouldSteerOnKey
|
|
2154
2154
|
};
|
|
2155
|
-
//# sourceMappingURL=chunk-
|
|
2155
|
+
//# sourceMappingURL=chunk-RSI7XYXL.js.map
|
|
@@ -9,7 +9,7 @@ function useEmbeddedClientRefinement(override, requiredMethods, hookName) {
|
|
|
9
9
|
const workspaceId = override.workspaceId ?? context?.workspaceId;
|
|
10
10
|
if (!candidate || !workspaceId) {
|
|
11
11
|
throw new Error(
|
|
12
|
-
"@opengeni/react: no
|
|
12
|
+
"@opengeni/react: no Opengeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook."
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
15
|
const methods = candidate;
|
|
@@ -40,7 +40,7 @@ function useOpenGeni(override = {}) {
|
|
|
40
40
|
const workspaceId = override.workspaceId ?? context?.workspaceId;
|
|
41
41
|
if (!client || !workspaceId) {
|
|
42
42
|
throw new Error(
|
|
43
|
-
"@opengeni/react: no
|
|
43
|
+
"@opengeni/react: no Opengeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook."
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
return {
|
|
@@ -226,7 +226,7 @@ function useOpenGeniClient(override = {}) {
|
|
|
226
226
|
const client = override.client ?? context?.client;
|
|
227
227
|
if (!client) {
|
|
228
228
|
throw new Error(
|
|
229
|
-
"@opengeni/react: no
|
|
229
|
+
"@opengeni/react: no Opengeni client available. Wrap the tree in <OpenGeniProvider> or pass { client } to the hook."
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
232
|
return client;
|
|
@@ -249,4 +249,4 @@ export {
|
|
|
249
249
|
useEmbeddedRealtimeSession,
|
|
250
250
|
useOpenGeniClient
|
|
251
251
|
};
|
|
252
|
-
//# sourceMappingURL=chunk-
|
|
252
|
+
//# sourceMappingURL=chunk-TKOTKRWY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/session-context.ts"],"sourcesContent":["import type {\n StreamConnectionState,\n WorkspaceControlEvent,\n WorkspaceInteractionRevisionEvent,\n} from \"@opengeni/sdk\";\nimport { createContext, useContext } from \"react\";\nimport type {\n EmbeddedFileAttachmentClientLike,\n EmbeddedGoalClientLike,\n EmbeddedHumanInputSessionClientLike,\n EmbeddedBrowserInteractionClientLike,\n EmbeddedComputerInteractionClientLike,\n EmbeddedInteractionClientLike,\n EmbeddedInterventionClientLike,\n EmbeddedRealtimeSessionClientLike,\n EmbeddedSessionClientLike,\n EmbeddedSessionLineageClientLike,\n EmbeddedSessionMcpApprovalPolicyClientLike,\n EmbeddedSessionReadClientLike,\n SessionClientLike,\n} from \"./client\";\n\nexport type OpenGeniContextValue = {\n client: SessionClientLike;\n workspaceId: string;\n workspaceControlEvent: WorkspaceControlEvent | null;\n workspaceControlConnectionState: StreamConnectionState | \"idle\" | \"error\";\n workspaceInteractionEvent: WorkspaceInteractionRevisionEvent | null;\n workspaceInteractionConnectionState: StreamConnectionState | \"idle\" | \"error\";\n registerSessionReconciler: (\n sessionId: string,\n key: string,\n reconcile: () => Promise<void>,\n ) => () => void;\n reconcileSession: (sessionId: string) => Promise<void>;\n};\n\nexport const OpenGeniContext = createContext<OpenGeniContextValue | null>(null);\n\nconst NOOP_REGISTER_RECONCILER: OpenGeniContextValue[\"registerSessionReconciler\"] = () => () =>\n undefined;\nconst NOOP_RECONCILE_SESSION: OpenGeniContextValue[\"reconcileSession\"] = async () => undefined;\n\nexport type ClientOverride = {\n client?: SessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionClientOverride = {\n client?: EmbeddedSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedHumanInputClientOverride = {\n client?: EmbeddedHumanInputSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionMcpApprovalPolicyClientOverride = {\n client?: EmbeddedSessionMcpApprovalPolicyClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionReadClientOverride = {\n client?: EmbeddedSessionReadClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedRealtimeSessionClientOverride = {\n client?: EmbeddedRealtimeSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedGoalClientOverride = {\n client?: EmbeddedGoalClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionLineageClientOverride = {\n client?: EmbeddedSessionLineageClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedFileAttachmentClientOverride = {\n client?: EmbeddedFileAttachmentClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedInteractionClientOverride = {\n client?: EmbeddedInteractionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedInterventionClientOverride = {\n client?: EmbeddedInterventionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedBrowserInteractionClientOverride = {\n client?: EmbeddedBrowserInteractionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedComputerInteractionClientOverride = {\n client?: EmbeddedComputerInteractionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionContextValue = Omit<OpenGeniContextValue, \"client\"> & {\n client: EmbeddedSessionClientLike;\n};\n\ntype EmbeddedClientOverride<TClient> = {\n client?: TClient | undefined;\n workspaceId?: string | undefined;\n};\n\ntype EmbeddedClientContextValue<TClient> = Omit<OpenGeniContextValue, \"client\"> & {\n client: TClient;\n};\n\nfunction useEmbeddedClientRefinement<TClient extends object>(\n override: EmbeddedClientOverride<TClient>,\n requiredMethods: readonly string[],\n hookName: string,\n): EmbeddedClientContextValue<TClient> {\n const context = useContext(OpenGeniContext);\n const candidate = override.client ?? context?.client;\n const workspaceId = override.workspaceId ?? context?.workspaceId;\n if (!candidate || !workspaceId) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook.\",\n );\n }\n const methods = candidate as Record<string, unknown>;\n const missing = requiredMethods.filter((method) => typeof methods[method] !== \"function\");\n if (missing.length > 0) {\n throw new Error(\n `@opengeni/react: ${hookName} requires client method${missing.length === 1 ? \"\" : \"s\"} ${missing.join(\", \")}.`,\n );\n }\n return {\n client: candidate as TClient,\n workspaceId,\n workspaceControlEvent: context?.workspaceControlEvent ?? null,\n workspaceControlConnectionState: context?.workspaceControlConnectionState ?? \"idle\",\n workspaceInteractionEvent: context?.workspaceInteractionEvent ?? null,\n workspaceInteractionConnectionState: context?.workspaceInteractionConnectionState ?? \"idle\",\n registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,\n reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,\n };\n}\n\nfunction eventClientMethods(override: object, directMethods: readonly string[]): readonly string[] {\n const hasSharedEventFeed =\n \"events\" in override && (override as { events?: unknown }).events !== undefined;\n return hasSharedEventFeed ? directMethods : [\"getSession\", \"streamEvents\", ...directMethods];\n}\n\n/** Resolve client + workspace from explicit overrides or the provider. */\nexport function useOpenGeni(override: ClientOverride = {}): OpenGeniContextValue {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n const workspaceId = override.workspaceId ?? context?.workspaceId;\n if (!client || !workspaceId) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook.\",\n );\n }\n return {\n client,\n workspaceId,\n workspaceControlEvent: context?.workspaceControlEvent ?? null,\n workspaceControlConnectionState: context?.workspaceControlConnectionState ?? \"idle\",\n workspaceInteractionEvent: context?.workspaceInteractionEvent ?? null,\n workspaceInteractionConnectionState: context?.workspaceInteractionConnectionState ?? \"idle\",\n registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,\n reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,\n };\n}\n\nconst BROWSER_INTERACTION_METHODS = [\n \"streamWorkspaceInteractionRevisions\",\n \"listNetworkRoutes\",\n \"getNetworkRoute\",\n \"createNetworkRoute\",\n \"updateNetworkRoute\",\n \"listSiteAuthConnections\",\n \"getSiteAuthConnection\",\n \"createSiteAuthConnection\",\n \"updateSiteAuthConnection\",\n \"listAuthRuns\",\n \"getAuthRun\",\n \"startBrowserAuthRun\",\n \"reportBrowserAuthRun\",\n \"protectedBrowserAuthFill\",\n \"verifyBrowserAuthRun\",\n \"listInteractionInterventions\",\n \"getInteractionIntervention\",\n \"createInteractionIntervention\",\n \"resolveInteractionIntervention\",\n \"listAttachedBrowsers\",\n \"getAttachedBrowser\",\n \"listBrowserIdentities\",\n \"getBrowserIdentity\",\n \"createBrowserIdentity\",\n \"updateBrowserIdentity\",\n \"listBrowserRevisions\",\n \"listBrowserSessions\",\n \"getBrowserSession\",\n \"readBrowserClipboard\",\n \"listBrowserDownloads\",\n \"getBrowserDownload\",\n \"saveBrowserDownload\",\n \"createBrowserSession\",\n \"listBrowserTargets\",\n \"openBrowserTarget\",\n \"selectBrowserTarget\",\n \"closeBrowserTarget\",\n \"observeBrowserTarget\",\n \"actInBrowser\",\n \"getBrowserActionReceipt\",\n \"listBrowserDiagnostics\",\n \"attachBrowserSession\",\n \"heartbeatBrowserSession\",\n \"publishBrowserRevision\",\n \"suspendBrowserSession\",\n \"resumeBrowserSession\",\n \"endBrowserSession\",\n] as const;\n\nconst COMPUTER_INTERACTION_METHODS = [\n \"streamWorkspaceInteractionRevisions\",\n \"listInteractionInterventions\",\n \"getInteractionIntervention\",\n \"createInteractionIntervention\",\n \"resolveInteractionIntervention\",\n \"listComputerSessions\",\n \"getComputerSession\",\n \"readComputerClipboard\",\n \"createComputerSession\",\n \"listComputerTargets\",\n \"observeComputerTarget\",\n \"actInComputer\",\n \"getComputerActionReceipt\",\n \"attachComputerSession\",\n \"heartbeatComputerSession\",\n \"endComputerSession\",\n] as const;\n\nconst INTERVENTION_METHODS = [\n \"streamWorkspaceInteractionRevisions\",\n \"listInteractionInterventions\",\n \"getInteractionIntervention\",\n \"createInteractionIntervention\",\n \"resolveInteractionIntervention\",\n] as const;\n\n/** Resolve only the workspace-wide Browser/Computer intervention surface. */\nexport function useEmbeddedInterventions(\n override: EmbeddedInterventionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedInterventionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n INTERVENTION_METHODS,\n \"interaction intervention hooks\",\n );\n}\n\n/** Resolve only BrowserSession methods for a standalone Browser embed. */\nexport function useEmbeddedBrowserInteraction(\n override: EmbeddedBrowserInteractionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedBrowserInteractionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n BROWSER_INTERACTION_METHODS,\n \"browser interaction hooks\",\n );\n}\n\n/** Resolve only ComputerSession methods for a standalone Computer embed. */\nexport function useEmbeddedComputerInteraction(\n override: EmbeddedComputerInteractionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedComputerInteractionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n COMPUTER_INTERACTION_METHODS,\n \"computer interaction hooks\",\n );\n}\n\n/** Resolve the complete Browser + Computer client surface. */\nexport function useEmbeddedInteraction(\n override: EmbeddedInteractionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedInteractionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n [...BROWSER_INTERACTION_METHODS, ...COMPUTER_INTERACTION_METHODS],\n \"interaction hooks\",\n );\n}\n\n/**\n * Resolve the narrow client required by the session-only hooks. The full\n * provider client is structurally compatible, while an explicit host proxy\n * only needs to expose session/event/composer/queue/control operations.\n */\nexport function useEmbeddedSession(\n override: EmbeddedSessionClientOverride = {},\n): EmbeddedSessionContextValue {\n return useEmbeddedClientRefinement(\n override,\n [\n \"getSession\",\n \"listEvents\",\n \"streamEvents\",\n \"getComposerDraft\",\n \"saveComposerDraft\",\n \"submitComposerDraft\",\n \"sendMessage\",\n \"steerMessage\",\n \"getQueue\",\n \"moveQueueItem\",\n \"editQueueItem\",\n \"steerQueueItem\",\n \"deleteQueueItem\",\n \"pauseSession\",\n \"resumeSession\",\n \"sendApprovalDecision\",\n ],\n \"session hooks\",\n );\n}\n\n/** Resolve the exact client surface required by `useSession`. */\nexport function useEmbeddedSessionRead(\n override: EmbeddedSessionReadClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedSessionReadClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSession\", \"updateSession\"]),\n \"useSession\",\n );\n}\n\n/** Resolve the exact client surface required by `useGoal`. */\nexport function useEmbeddedGoal(\n override: EmbeddedGoalClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedGoalClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getGoal\", \"updateGoal\", \"deleteGoal\"]),\n \"useGoal\",\n );\n}\n\n/** Resolve the exact client surface required by `useSessionLineage`. */\nexport function useEmbeddedSessionLineage(\n override: EmbeddedSessionLineageClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedSessionLineageClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSessionLineage\"]),\n \"useSessionLineage\",\n );\n}\n\n/** Resolve the exact client surface required by `useFileAttachments`. */\nexport function useEmbeddedFileAttachments(\n override: EmbeddedFileAttachmentClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedFileAttachmentClientLike> {\n return useEmbeddedClientRefinement(override, [\"uploadFile\"], \"useFileAttachments\");\n}\n\n/**\n * Resolve the structured-input refinement without widening the baseline\n * session-only proxy contract.\n */\nexport function useEmbeddedHumanInputSession(override: EmbeddedHumanInputClientOverride = {}): Omit<\n EmbeddedSessionContextValue,\n \"client\"\n> & {\n client: EmbeddedHumanInputSessionClientLike;\n} {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"listHumanInputRequests\", \"submitHumanInputResponse\"]),\n \"useHumanInputRequests\",\n );\n}\n\n/** Resolve the approval-policy refinement without widening session-only hosts. */\nexport function useEmbeddedSessionMcpApprovalPolicy(\n override: EmbeddedSessionMcpApprovalPolicyClientOverride = {},\n): Omit<EmbeddedSessionContextValue, \"client\"> & {\n client: EmbeddedSessionMcpApprovalPolicyClientLike;\n} {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSession\", \"updateSessionMcpApprovalPolicy\"]),\n \"useSessionMcpApprovalPolicy\",\n );\n}\n\n/** Resolve the exact browser/API surface required by `@opengeni/react/realtime`. */\nexport function useEmbeddedRealtimeSession(\n override: EmbeddedRealtimeSessionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedRealtimeSessionClientLike> {\n // Preserve the existing lazy capability behavior: proxy/test clients may\n // implement only the methods reached by their selected model and lifecycle.\n // The exported structural type remains the complete embedding contract.\n return useEmbeddedClientRefinement(override, [], \"realtime hooks\");\n}\n\n/**\n * Resolve the client only — for hooks that are not workspace-scoped\n * (`useWorkspaces`, `useBillingUsage`).\n */\nexport function useOpenGeniClient(\n override: Pick<ClientOverride, \"client\"> = {},\n): SessionClientLike {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n if (!client) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client available. Wrap the tree in <OpenGeniProvider> or pass { client } to the hook.\",\n );\n }\n return client;\n}\n"],"mappings":";AAKA,SAAS,eAAe,kBAAkB;AAgCnC,IAAM,kBAAkB,cAA2C,IAAI;AAE9E,IAAM,2BAA8E,MAAM,MACxF;AACF,IAAM,yBAAmE,YAAY;AAgFrF,SAAS,4BACP,UACA,iBACA,UACqC;AACrC,QAAM,UAAU,WAAW,eAAe;AAC1C,QAAM,YAAY,SAAS,UAAU,SAAS;AAC9C,QAAM,cAAc,SAAS,eAAe,SAAS;AACrD,MAAI,CAAC,aAAa,CAAC,aAAa;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAU;AAChB,QAAM,UAAU,gBAAgB,OAAO,CAAC,WAAW,OAAO,QAAQ,MAAM,MAAM,UAAU;AACxF,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,IAAI;AAAA,MACR,oBAAoB,QAAQ,0BAA0B,QAAQ,WAAW,IAAI,KAAK,GAAG,IAAI,QAAQ,KAAK,IAAI,CAAC;AAAA,IAC7G;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,iCAAiC,SAAS,mCAAmC;AAAA,IAC7E,2BAA2B,SAAS,6BAA6B;AAAA,IACjE,qCAAqC,SAAS,uCAAuC;AAAA,IACrF,2BAA2B,SAAS,6BAA6B;AAAA,IACjE,kBAAkB,SAAS,oBAAoB;AAAA,EACjD;AACF;AAEA,SAAS,mBAAmB,UAAkB,eAAqD;AACjG,QAAM,qBACJ,YAAY,YAAa,SAAkC,WAAW;AACxE,SAAO,qBAAqB,gBAAgB,CAAC,cAAc,gBAAgB,GAAG,aAAa;AAC7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;AAC9D,SAAO,4BAA4B,UAAU,CAAC,YAAY,GAAG,oBAAoB;AACnF;AAMO,SAAS,6BAA6B,WAA6C,CAAC,GAKzF;AACA,SAAO;AAAA,IACL;AAAA,IACA,mBAAmB,UAAU,CAAC,0BAA0B,0BAA0B,CAAC;AAAA,IACnF;AAAA,EACF;AACF;AAGO,SAAS,oCACd,WAA2D,CAAC,GAG5D;AACA,SAAO;AAAA,IACL;AAAA,IACA,mBAAmB,UAAU,CAAC,cAAc,gCAAgC,CAAC;AAAA,IAC7E;AAAA,EACF;AACF;AAGO,SAAS,2BACd,WAAkD,CAAC,GACY;AAI/D,SAAO,4BAA4B,UAAU,CAAC,GAAG,gBAAgB;AACnE;AAMO,SAAS,kBACd,WAA2C,CAAC,GACzB;AACnB,QAAM,UAAU,WAAW,eAAe;AAC1C,QAAM,SAAS,SAAS,UAAU,SAAS;AAC3C,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/session-context.ts"],"sourcesContent":["import type {\n StreamConnectionState,\n WorkspaceControlEvent,\n WorkspaceInteractionRevisionEvent,\n} from \"@opengeni/sdk\";\nimport { createContext, useContext } from \"react\";\nimport type {\n EmbeddedFileAttachmentClientLike,\n EmbeddedGoalClientLike,\n EmbeddedHumanInputSessionClientLike,\n EmbeddedBrowserInteractionClientLike,\n EmbeddedComputerInteractionClientLike,\n EmbeddedInteractionClientLike,\n EmbeddedInterventionClientLike,\n EmbeddedRealtimeSessionClientLike,\n EmbeddedSessionClientLike,\n EmbeddedSessionLineageClientLike,\n EmbeddedSessionMcpApprovalPolicyClientLike,\n EmbeddedSessionReadClientLike,\n SessionClientLike,\n} from \"./client\";\n\nexport type OpenGeniContextValue = {\n client: SessionClientLike;\n workspaceId: string;\n workspaceControlEvent: WorkspaceControlEvent | null;\n workspaceControlConnectionState: StreamConnectionState | \"idle\" | \"error\";\n workspaceInteractionEvent: WorkspaceInteractionRevisionEvent | null;\n workspaceInteractionConnectionState: StreamConnectionState | \"idle\" | \"error\";\n registerSessionReconciler: (\n sessionId: string,\n key: string,\n reconcile: () => Promise<void>,\n ) => () => void;\n reconcileSession: (sessionId: string) => Promise<void>;\n};\n\nexport const OpenGeniContext = createContext<OpenGeniContextValue | null>(null);\n\nconst NOOP_REGISTER_RECONCILER: OpenGeniContextValue[\"registerSessionReconciler\"] = () => () =>\n undefined;\nconst NOOP_RECONCILE_SESSION: OpenGeniContextValue[\"reconcileSession\"] = async () => undefined;\n\nexport type ClientOverride = {\n client?: SessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionClientOverride = {\n client?: EmbeddedSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedHumanInputClientOverride = {\n client?: EmbeddedHumanInputSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionMcpApprovalPolicyClientOverride = {\n client?: EmbeddedSessionMcpApprovalPolicyClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionReadClientOverride = {\n client?: EmbeddedSessionReadClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedRealtimeSessionClientOverride = {\n client?: EmbeddedRealtimeSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedGoalClientOverride = {\n client?: EmbeddedGoalClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionLineageClientOverride = {\n client?: EmbeddedSessionLineageClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedFileAttachmentClientOverride = {\n client?: EmbeddedFileAttachmentClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedInteractionClientOverride = {\n client?: EmbeddedInteractionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedInterventionClientOverride = {\n client?: EmbeddedInterventionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedBrowserInteractionClientOverride = {\n client?: EmbeddedBrowserInteractionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedComputerInteractionClientOverride = {\n client?: EmbeddedComputerInteractionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionContextValue = Omit<OpenGeniContextValue, \"client\"> & {\n client: EmbeddedSessionClientLike;\n};\n\ntype EmbeddedClientOverride<TClient> = {\n client?: TClient | undefined;\n workspaceId?: string | undefined;\n};\n\ntype EmbeddedClientContextValue<TClient> = Omit<OpenGeniContextValue, \"client\"> & {\n client: TClient;\n};\n\nfunction useEmbeddedClientRefinement<TClient extends object>(\n override: EmbeddedClientOverride<TClient>,\n requiredMethods: readonly string[],\n hookName: string,\n): EmbeddedClientContextValue<TClient> {\n const context = useContext(OpenGeniContext);\n const candidate = override.client ?? context?.client;\n const workspaceId = override.workspaceId ?? context?.workspaceId;\n if (!candidate || !workspaceId) {\n throw new Error(\n \"@opengeni/react: no Opengeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook.\",\n );\n }\n const methods = candidate as Record<string, unknown>;\n const missing = requiredMethods.filter((method) => typeof methods[method] !== \"function\");\n if (missing.length > 0) {\n throw new Error(\n `@opengeni/react: ${hookName} requires client method${missing.length === 1 ? \"\" : \"s\"} ${missing.join(\", \")}.`,\n );\n }\n return {\n client: candidate as TClient,\n workspaceId,\n workspaceControlEvent: context?.workspaceControlEvent ?? null,\n workspaceControlConnectionState: context?.workspaceControlConnectionState ?? \"idle\",\n workspaceInteractionEvent: context?.workspaceInteractionEvent ?? null,\n workspaceInteractionConnectionState: context?.workspaceInteractionConnectionState ?? \"idle\",\n registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,\n reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,\n };\n}\n\nfunction eventClientMethods(override: object, directMethods: readonly string[]): readonly string[] {\n const hasSharedEventFeed =\n \"events\" in override && (override as { events?: unknown }).events !== undefined;\n return hasSharedEventFeed ? directMethods : [\"getSession\", \"streamEvents\", ...directMethods];\n}\n\n/** Resolve client + workspace from explicit overrides or the provider. */\nexport function useOpenGeni(override: ClientOverride = {}): OpenGeniContextValue {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n const workspaceId = override.workspaceId ?? context?.workspaceId;\n if (!client || !workspaceId) {\n throw new Error(\n \"@opengeni/react: no Opengeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook.\",\n );\n }\n return {\n client,\n workspaceId,\n workspaceControlEvent: context?.workspaceControlEvent ?? null,\n workspaceControlConnectionState: context?.workspaceControlConnectionState ?? \"idle\",\n workspaceInteractionEvent: context?.workspaceInteractionEvent ?? null,\n workspaceInteractionConnectionState: context?.workspaceInteractionConnectionState ?? \"idle\",\n registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,\n reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,\n };\n}\n\nconst BROWSER_INTERACTION_METHODS = [\n \"streamWorkspaceInteractionRevisions\",\n \"listNetworkRoutes\",\n \"getNetworkRoute\",\n \"createNetworkRoute\",\n \"updateNetworkRoute\",\n \"listSiteAuthConnections\",\n \"getSiteAuthConnection\",\n \"createSiteAuthConnection\",\n \"updateSiteAuthConnection\",\n \"listAuthRuns\",\n \"getAuthRun\",\n \"startBrowserAuthRun\",\n \"reportBrowserAuthRun\",\n \"protectedBrowserAuthFill\",\n \"verifyBrowserAuthRun\",\n \"listInteractionInterventions\",\n \"getInteractionIntervention\",\n \"createInteractionIntervention\",\n \"resolveInteractionIntervention\",\n \"listAttachedBrowsers\",\n \"getAttachedBrowser\",\n \"listBrowserIdentities\",\n \"getBrowserIdentity\",\n \"createBrowserIdentity\",\n \"updateBrowserIdentity\",\n \"listBrowserRevisions\",\n \"listBrowserSessions\",\n \"getBrowserSession\",\n \"readBrowserClipboard\",\n \"listBrowserDownloads\",\n \"getBrowserDownload\",\n \"saveBrowserDownload\",\n \"createBrowserSession\",\n \"listBrowserTargets\",\n \"openBrowserTarget\",\n \"selectBrowserTarget\",\n \"closeBrowserTarget\",\n \"observeBrowserTarget\",\n \"actInBrowser\",\n \"getBrowserActionReceipt\",\n \"listBrowserDiagnostics\",\n \"attachBrowserSession\",\n \"heartbeatBrowserSession\",\n \"publishBrowserRevision\",\n \"suspendBrowserSession\",\n \"resumeBrowserSession\",\n \"endBrowserSession\",\n] as const;\n\nconst COMPUTER_INTERACTION_METHODS = [\n \"streamWorkspaceInteractionRevisions\",\n \"listInteractionInterventions\",\n \"getInteractionIntervention\",\n \"createInteractionIntervention\",\n \"resolveInteractionIntervention\",\n \"listComputerSessions\",\n \"getComputerSession\",\n \"readComputerClipboard\",\n \"createComputerSession\",\n \"listComputerTargets\",\n \"observeComputerTarget\",\n \"actInComputer\",\n \"getComputerActionReceipt\",\n \"attachComputerSession\",\n \"heartbeatComputerSession\",\n \"endComputerSession\",\n] as const;\n\nconst INTERVENTION_METHODS = [\n \"streamWorkspaceInteractionRevisions\",\n \"listInteractionInterventions\",\n \"getInteractionIntervention\",\n \"createInteractionIntervention\",\n \"resolveInteractionIntervention\",\n] as const;\n\n/** Resolve only the workspace-wide Browser/Computer intervention surface. */\nexport function useEmbeddedInterventions(\n override: EmbeddedInterventionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedInterventionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n INTERVENTION_METHODS,\n \"interaction intervention hooks\",\n );\n}\n\n/** Resolve only BrowserSession methods for a standalone Browser embed. */\nexport function useEmbeddedBrowserInteraction(\n override: EmbeddedBrowserInteractionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedBrowserInteractionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n BROWSER_INTERACTION_METHODS,\n \"browser interaction hooks\",\n );\n}\n\n/** Resolve only ComputerSession methods for a standalone Computer embed. */\nexport function useEmbeddedComputerInteraction(\n override: EmbeddedComputerInteractionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedComputerInteractionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n COMPUTER_INTERACTION_METHODS,\n \"computer interaction hooks\",\n );\n}\n\n/** Resolve the complete Browser + Computer client surface. */\nexport function useEmbeddedInteraction(\n override: EmbeddedInteractionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedInteractionClientLike> {\n return useEmbeddedClientRefinement(\n override,\n [...BROWSER_INTERACTION_METHODS, ...COMPUTER_INTERACTION_METHODS],\n \"interaction hooks\",\n );\n}\n\n/**\n * Resolve the narrow client required by the session-only hooks. The full\n * provider client is structurally compatible, while an explicit host proxy\n * only needs to expose session/event/composer/queue/control operations.\n */\nexport function useEmbeddedSession(\n override: EmbeddedSessionClientOverride = {},\n): EmbeddedSessionContextValue {\n return useEmbeddedClientRefinement(\n override,\n [\n \"getSession\",\n \"listEvents\",\n \"streamEvents\",\n \"getComposerDraft\",\n \"saveComposerDraft\",\n \"submitComposerDraft\",\n \"sendMessage\",\n \"steerMessage\",\n \"getQueue\",\n \"moveQueueItem\",\n \"editQueueItem\",\n \"steerQueueItem\",\n \"deleteQueueItem\",\n \"pauseSession\",\n \"resumeSession\",\n \"sendApprovalDecision\",\n ],\n \"session hooks\",\n );\n}\n\n/** Resolve the exact client surface required by `useSession`. */\nexport function useEmbeddedSessionRead(\n override: EmbeddedSessionReadClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedSessionReadClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSession\", \"updateSession\"]),\n \"useSession\",\n );\n}\n\n/** Resolve the exact client surface required by `useGoal`. */\nexport function useEmbeddedGoal(\n override: EmbeddedGoalClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedGoalClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getGoal\", \"updateGoal\", \"deleteGoal\"]),\n \"useGoal\",\n );\n}\n\n/** Resolve the exact client surface required by `useSessionLineage`. */\nexport function useEmbeddedSessionLineage(\n override: EmbeddedSessionLineageClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedSessionLineageClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSessionLineage\"]),\n \"useSessionLineage\",\n );\n}\n\n/** Resolve the exact client surface required by `useFileAttachments`. */\nexport function useEmbeddedFileAttachments(\n override: EmbeddedFileAttachmentClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedFileAttachmentClientLike> {\n return useEmbeddedClientRefinement(override, [\"uploadFile\"], \"useFileAttachments\");\n}\n\n/**\n * Resolve the structured-input refinement without widening the baseline\n * session-only proxy contract.\n */\nexport function useEmbeddedHumanInputSession(override: EmbeddedHumanInputClientOverride = {}): Omit<\n EmbeddedSessionContextValue,\n \"client\"\n> & {\n client: EmbeddedHumanInputSessionClientLike;\n} {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"listHumanInputRequests\", \"submitHumanInputResponse\"]),\n \"useHumanInputRequests\",\n );\n}\n\n/** Resolve the approval-policy refinement without widening session-only hosts. */\nexport function useEmbeddedSessionMcpApprovalPolicy(\n override: EmbeddedSessionMcpApprovalPolicyClientOverride = {},\n): Omit<EmbeddedSessionContextValue, \"client\"> & {\n client: EmbeddedSessionMcpApprovalPolicyClientLike;\n} {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSession\", \"updateSessionMcpApprovalPolicy\"]),\n \"useSessionMcpApprovalPolicy\",\n );\n}\n\n/** Resolve the exact browser/API surface required by `@opengeni/react/realtime`. */\nexport function useEmbeddedRealtimeSession(\n override: EmbeddedRealtimeSessionClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedRealtimeSessionClientLike> {\n // Preserve the existing lazy capability behavior: proxy/test clients may\n // implement only the methods reached by their selected model and lifecycle.\n // The exported structural type remains the complete embedding contract.\n return useEmbeddedClientRefinement(override, [], \"realtime hooks\");\n}\n\n/**\n * Resolve the client only — for hooks that are not workspace-scoped\n * (`useWorkspaces`, `useBillingUsage`).\n */\nexport function useOpenGeniClient(\n override: Pick<ClientOverride, \"client\"> = {},\n): SessionClientLike {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n if (!client) {\n throw new Error(\n \"@opengeni/react: no Opengeni client available. Wrap the tree in <OpenGeniProvider> or pass { client } to the hook.\",\n );\n }\n return client;\n}\n"],"mappings":";AAKA,SAAS,eAAe,kBAAkB;AAgCnC,IAAM,kBAAkB,cAA2C,IAAI;AAE9E,IAAM,2BAA8E,MAAM,MACxF;AACF,IAAM,yBAAmE,YAAY;AAgFrF,SAAS,4BACP,UACA,iBACA,UACqC;AACrC,QAAM,UAAU,WAAW,eAAe;AAC1C,QAAM,YAAY,SAAS,UAAU,SAAS;AAC9C,QAAM,cAAc,SAAS,eAAe,SAAS;AACrD,MAAI,CAAC,aAAa,CAAC,aAAa;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAU;AAChB,QAAM,UAAU,gBAAgB,OAAO,CAAC,WAAW,OAAO,QAAQ,MAAM,MAAM,UAAU;AACxF,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,IAAI;AAAA,MACR,oBAAoB,QAAQ,0BAA0B,QAAQ,WAAW,IAAI,KAAK,GAAG,IAAI,QAAQ,KAAK,IAAI,CAAC;AAAA,IAC7G;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,iCAAiC,SAAS,mCAAmC;AAAA,IAC7E,2BAA2B,SAAS,6BAA6B;AAAA,IACjE,qCAAqC,SAAS,uCAAuC;AAAA,IACrF,2BAA2B,SAAS,6BAA6B;AAAA,IACjE,kBAAkB,SAAS,oBAAoB;AAAA,EACjD;AACF;AAEA,SAAS,mBAAmB,UAAkB,eAAqD;AACjG,QAAM,qBACJ,YAAY,YAAa,SAAkC,WAAW;AACxE,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