@urun-sh/react 0.2.3 → 0.2.5
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/CHANGELOG.md +18 -0
- package/dist/auth.d.mts +6 -0
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +1 -0
- package/dist/auth.mjs +1 -0
- package/dist/chunk-SSZO4I6Y.mjs +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +362 -13
- package/dist/index.d.ts +362 -13
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/styles.css +148 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.5
|
|
4
|
+
|
|
5
|
+
- Session workbench building blocks: generic, composable debug/steer components
|
|
6
|
+
over the public `Session` primitives — `UrunStreamTail` (named data-lane tail
|
|
7
|
+
over `stream.messages()`), `UrunDocPanel` + `UrunControlSender` (view/patch a
|
|
8
|
+
session doc), `UrunEventSpine` (SDK-native activity log from `onPhase` /
|
|
9
|
+
track / doc events), `UrunSessionStatus` + `UrunSessionGate`, plus the hooks
|
|
10
|
+
`useSessionTrack` / `useSessionDoc` / `useStreamMessages`. Media panes reuse
|
|
11
|
+
the existing `UrunVideo` / `UrunAudio` / `UrunVoice`. See
|
|
12
|
+
`docs/session-workbench-building-blocks.md`.
|
|
13
|
+
- `useStreamMessages` now cancels the stream's async iterator (calls
|
|
14
|
+
`.return()`) on unmount / name change, instead of only flipping a local
|
|
15
|
+
flag — on a quiet stream the old subscription used to linger until the next
|
|
16
|
+
message ever arrived.
|
|
17
|
+
- `UrunControlSender`'s doc-change log line is labeled `change` instead of
|
|
18
|
+
`recv`: the core doc has no origin marker, so the line also fires for this
|
|
19
|
+
component's own writes and `recv` overclaimed it came from the runtime.
|
|
20
|
+
|
|
3
21
|
## 0.2.1
|
|
4
22
|
|
|
5
23
|
- Republish of the 0.2.0 line (`@urun-sh/core` / `@urun-sh/react` 0.2.0 published but never persisted in the npm packument; bumped to 0.2.1 for a clean, resolvable release). No source changes vs 0.2.0.
|
package/dist/auth.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type UrunAuthMode = 'workos' | 'jwt';
|
|
2
|
+
declare function urunPublicEnv(name: string): string | undefined;
|
|
3
|
+
declare function authMode(): UrunAuthMode;
|
|
4
|
+
declare function usesWorkOSAuth(): boolean;
|
|
5
|
+
|
|
6
|
+
export { type UrunAuthMode, authMode, urunPublicEnv, usesWorkOSAuth };
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type UrunAuthMode = 'workos' | 'jwt';
|
|
2
|
+
declare function urunPublicEnv(name: string): string | undefined;
|
|
3
|
+
declare function authMode(): UrunAuthMode;
|
|
4
|
+
declare function usesWorkOSAuth(): boolean;
|
|
5
|
+
|
|
6
|
+
export { type UrunAuthMode, authMode, urunPublicEnv, usesWorkOSAuth };
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(e,n)=>{for(var s in n)u(e,s,{get:n[s],enumerable:!0})},U=(e,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of f(n))!c.call(e,o)&&o!==s&&u(e,o,{get:()=>n[o],enumerable:!(i=E(n,o))||i.enumerable});return e};var N=e=>U(u({},"__esModule",{value:!0}),e);var T={};p(T,{authMode:()=>d,urunPublicEnv:()=>t,usesWorkOSAuth:()=>_});module.exports=N(T);function r(e){return e&&e.trim()?e.trim():void 0}function t(e){switch(e){case"NEXT_PUBLIC_AUTH_MODE":return r(typeof process<"u"?process.env?.NEXT_PUBLIC_AUTH_MODE:void 0);case"NEXT_PUBLIC_AUTH_ENABLED":return r(typeof process<"u"?process.env?.NEXT_PUBLIC_AUTH_ENABLED:void 0);case"NEXT_PUBLIC_SESSION_AUTH_PROVIDER":return r(typeof process<"u"?process.env?.NEXT_PUBLIC_SESSION_AUTH_PROVIDER:void 0);case"NEXT_PUBLIC_SESSION_TOKEN":return r(typeof process<"u"?process.env?.NEXT_PUBLIC_SESSION_TOKEN:void 0);case"NEXT_PUBLIC_URUN_JWT":return r(typeof process<"u"?process.env?.NEXT_PUBLIC_URUN_JWT:void 0);case"VERCEL_ENV":return r(typeof process<"u"?process.env?.VERCEL_ENV:void 0);default:return r(typeof process<"u"?process.env?.[e]:void 0)}}function d(){let e=t("NEXT_PUBLIC_AUTH_MODE")?.toLowerCase();return e==="jwt"||e==="customer-jwt"||e==="test-jwt"?"jwt":e==="workos"||t("VERCEL_ENV")==="production"?"workos":t("NEXT_PUBLIC_AUTH_ENABLED")==="false"?"jwt":"workos"}function _(){return d()==="workos"}0&&(module.exports={authMode,urunPublicEnv,usesWorkOSAuth});
|
package/dist/auth.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u,b as o,c as e}from"./chunk-SSZO4I6Y.mjs";export{o as authMode,u as urunPublicEnv,e as usesWorkOSAuth};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(e){return e&&e.trim()?e.trim():void 0}function r(e){switch(e){case"NEXT_PUBLIC_AUTH_MODE":return n(typeof process<"u"?process.env?.NEXT_PUBLIC_AUTH_MODE:void 0);case"NEXT_PUBLIC_AUTH_ENABLED":return n(typeof process<"u"?process.env?.NEXT_PUBLIC_AUTH_ENABLED:void 0);case"NEXT_PUBLIC_SESSION_AUTH_PROVIDER":return n(typeof process<"u"?process.env?.NEXT_PUBLIC_SESSION_AUTH_PROVIDER:void 0);case"NEXT_PUBLIC_SESSION_TOKEN":return n(typeof process<"u"?process.env?.NEXT_PUBLIC_SESSION_TOKEN:void 0);case"NEXT_PUBLIC_URUN_JWT":return n(typeof process<"u"?process.env?.NEXT_PUBLIC_URUN_JWT:void 0);case"VERCEL_ENV":return n(typeof process<"u"?process.env?.VERCEL_ENV:void 0);default:return n(typeof process<"u"?process.env?.[e]:void 0)}}function s(){let e=r("NEXT_PUBLIC_AUTH_MODE")?.toLowerCase();return e==="jwt"||e==="customer-jwt"||e==="test-jwt"?"jwt":e==="workos"||r("VERCEL_ENV")==="production"?"workos":r("NEXT_PUBLIC_AUTH_ENABLED")==="false"?"jwt":"workos"}function t(){return s()==="workos"}export{r as a,s as b,t as c};
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--urun-bg: #ffffff;--urun-text: #1a1a2e;--urun-border: #e2e8f0;--urun-radius: 8px;--urun-font: system-ui, -apple-system, sans-serif;--urun-progress-bg: #e2e8f0;--urun-progress-fill: #3b82f6;--urun-progress-success: #22c55e;--urun-progress-error: #ef4444;--urun-progress-height: 8px;--urun-status-thinking: #f59e0b;--urun-status-generating: #3b82f6;--urun-status-idle: #94a3b8;--urun-status-error: #ef4444;--urun-status-indicator-size: 8px;--urun-cursor-color: #3b82f6;--urun-cursor-width: 2px;--urun-metric-bg: #f8fafc;--urun-metric-label-color: #64748b;--urun-metric-value-color: #1a1a2e}.urun-progress-card{font-family:var(--urun-font);color:var(--urun-text);border:1px solid var(--urun-border);border-radius:var(--urun-radius);padding:12px 16px;background:var(--urun-bg)}.urun-progress-label{font-size:.875rem;font-weight:500;margin-bottom:8px}.urun-progress-bar{height:var(--urun-progress-height);background:var(--urun-progress-bg);border-radius:calc(var(--urun-progress-height) / 2);overflow:hidden}.urun-progress-fill{height:100%;background:var(--urun-progress-fill);border-radius:inherit;transition:width .3s ease}.urun-progress-card[data-variant=success] .urun-progress-fill{background:var(--urun-progress-success)}.urun-progress-card[data-variant=error] .urun-progress-fill{background:var(--urun-progress-error)}.urun-progress-text{font-size:.75rem;color:var(--urun-metric-label-color);margin-top:4px;text-align:right}.urun-status-badge{display:inline-flex;align-items:center;gap:6px;font-family:var(--urun-font);font-size:.875rem;color:var(--urun-text)}.urun-status-indicator{display:inline-block;width:var(--urun-status-indicator-size);height:var(--urun-status-indicator-size);border-radius:50%;background:var(--urun-status-idle);flex-shrink:0}.urun-status-badge[data-state=thinking] .urun-status-indicator{background:var(--urun-status-thinking)}.urun-status-badge[data-state=generating] .urun-status-indicator{background:var(--urun-status-generating)}.urun-status-badge[data-state=error] .urun-status-indicator{background:var(--urun-status-error)}.urun-status-pulse{animation:urun-pulse 1.5s ease-in-out infinite}.urun-text-stream{font-family:var(--urun-font);color:var(--urun-text);white-space:pre-wrap;word-break:break-word}.urun-text-cursor{display:inline-block;width:var(--urun-cursor-width);height:1em;background:var(--urun-cursor-color);vertical-align:text-bottom;animation:urun-blink 1s step-end infinite}.urun-image-frame{margin:0;border:1px solid var(--urun-border);border-radius:var(--urun-radius);overflow:hidden;background:var(--urun-bg)}.urun-image{display:block;width:100%;height:auto}.urun-image-caption{padding:8px 12px;font-family:var(--urun-font);font-size:.875rem;color:var(--urun-metric-label-color);text-align:center}.urun-metrics-panel{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;font-family:var(--urun-font)}.urun-metric-card{background:var(--urun-metric-bg);border:1px solid var(--urun-border);border-radius:var(--urun-radius);padding:12px;text-align:center}.urun-metric-label{font-size:.75rem;color:var(--urun-metric-label-color);margin-bottom:4px}.urun-metric-value{font-size:1.25rem;font-weight:600;color:var(--urun-metric-value-color)}.urun-component-error{font-family:var(--urun-font);padding:8px 12px;border:1px solid var(--urun-status-error);border-radius:var(--urun-radius);background:#fef2f2;color:var(--urun-status-error);font-size:.875rem}@keyframes urun-pulse{0%,to{opacity:1}50%{opacity:.4}}@keyframes urun-blink{0%,to{opacity:1}50%{opacity:0}}[data-urun-video],[data-urun-video] .video-js,[data-urun-video] .vjs-tech{width:100%;height:100%}[data-urun-video] .vjs-tech{object-fit:contain}.urun-video-live.vjs-has-started .vjs-poster,.urun-video-live.vjs-has-started .vjs-loading-spinner,.urun-video-live.vjs-has-started .vjs-big-play-button{display:none!important}.urun-video-live .vjs-poster{background-color:transparent}
|
|
1
|
+
:root{--urun-bg: #ffffff;--urun-text: #1a1a2e;--urun-border: #e2e8f0;--urun-radius: 8px;--urun-font: system-ui, -apple-system, sans-serif;--urun-progress-bg: #e2e8f0;--urun-progress-fill: #3b82f6;--urun-progress-success: #22c55e;--urun-progress-error: #ef4444;--urun-progress-height: 8px;--urun-status-thinking: #f59e0b;--urun-status-generating: #3b82f6;--urun-status-idle: #94a3b8;--urun-status-error: #ef4444;--urun-status-indicator-size: 8px;--urun-cursor-color: #3b82f6;--urun-cursor-width: 2px;--urun-metric-bg: #f8fafc;--urun-metric-label-color: #64748b;--urun-metric-value-color: #1a1a2e}.urun-progress-card{font-family:var(--urun-font);color:var(--urun-text);border:1px solid var(--urun-border);border-radius:var(--urun-radius);padding:12px 16px;background:var(--urun-bg)}.urun-progress-label{font-size:.875rem;font-weight:500;margin-bottom:8px}.urun-progress-bar{height:var(--urun-progress-height);background:var(--urun-progress-bg);border-radius:calc(var(--urun-progress-height) / 2);overflow:hidden}.urun-progress-fill{height:100%;background:var(--urun-progress-fill);border-radius:inherit;transition:width .3s ease}.urun-progress-card[data-variant=success] .urun-progress-fill{background:var(--urun-progress-success)}.urun-progress-card[data-variant=error] .urun-progress-fill{background:var(--urun-progress-error)}.urun-progress-text{font-size:.75rem;color:var(--urun-metric-label-color);margin-top:4px;text-align:right}.urun-status-badge{display:inline-flex;align-items:center;gap:6px;font-family:var(--urun-font);font-size:.875rem;color:var(--urun-text)}.urun-status-indicator{display:inline-block;width:var(--urun-status-indicator-size);height:var(--urun-status-indicator-size);border-radius:50%;background:var(--urun-status-idle);flex-shrink:0}.urun-status-badge[data-state=thinking] .urun-status-indicator{background:var(--urun-status-thinking)}.urun-status-badge[data-state=generating] .urun-status-indicator{background:var(--urun-status-generating)}.urun-status-badge[data-state=error] .urun-status-indicator{background:var(--urun-status-error)}.urun-status-pulse{animation:urun-pulse 1.5s ease-in-out infinite}.urun-text-stream{font-family:var(--urun-font);color:var(--urun-text);white-space:pre-wrap;word-break:break-word}.urun-text-cursor{display:inline-block;width:var(--urun-cursor-width);height:1em;background:var(--urun-cursor-color);vertical-align:text-bottom;animation:urun-blink 1s step-end infinite}.urun-image-frame{margin:0;border:1px solid var(--urun-border);border-radius:var(--urun-radius);overflow:hidden;background:var(--urun-bg)}.urun-image{display:block;width:100%;height:auto}.urun-image-caption{padding:8px 12px;font-family:var(--urun-font);font-size:.875rem;color:var(--urun-metric-label-color);text-align:center}.urun-metrics-panel{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;font-family:var(--urun-font)}.urun-metric-card{background:var(--urun-metric-bg);border:1px solid var(--urun-border);border-radius:var(--urun-radius);padding:12px;text-align:center}.urun-metric-label{font-size:.75rem;color:var(--urun-metric-label-color);margin-bottom:4px}.urun-metric-value{font-size:1.25rem;font-weight:600;color:var(--urun-metric-value-color)}.urun-component-error{font-family:var(--urun-font);padding:8px 12px;border:1px solid var(--urun-status-error);border-radius:var(--urun-radius);background:#fef2f2;color:var(--urun-status-error);font-size:.875rem}@keyframes urun-pulse{0%,to{opacity:1}50%{opacity:.4}}@keyframes urun-blink{0%,to{opacity:1}50%{opacity:0}}[data-urun-video],[data-urun-video] .video-js,[data-urun-video] .vjs-tech{width:100%;height:100%}[data-urun-video] .vjs-tech{object-fit:contain}.urun-video-live.vjs-has-started .vjs-poster,.urun-video-live.vjs-has-started .vjs-loading-spinner,.urun-video-live.vjs-has-started .vjs-big-play-button{display:none!important}.urun-video-live .vjs-poster{background-color:transparent}.urun-stream-tail,.urun-doc-panel,.urun-control-sender,.urun-event-spine{display:flex;flex-direction:column;gap:6px;font-size:12px}.urun-stream-tail-meta,.urun-doc-panel-meta{display:flex;align-items:center;gap:8px;color:var(--urun-wb-muted, #8a8a8a)}.urun-stream-tail-log,.urun-control-sender-log{display:flex;flex-direction:column;gap:2px;max-height:220px;overflow:auto;padding:6px;border-radius:6px;background:var(--urun-wb-log-bg, rgba(0, 0, 0, .25));font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px}.urun-stream-tail-time,.urun-control-sender-time,.urun-event-spine-time{color:var(--urun-wb-muted, #8a8a8a)}.urun-doc-panel-snapshot{margin:0;padding:8px;max-height:220px;overflow:auto;border-radius:6px;background:var(--urun-wb-log-bg, rgba(0, 0, 0, .25));font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px}.urun-doc-patch,.urun-control-sender{display:flex;flex-direction:column;gap:6px}.urun-doc-patch-input{width:100%;resize:vertical;border-radius:6px;border:1px solid var(--urun-wb-border, rgba(128, 128, 128, .4));background:var(--urun-wb-input-bg, transparent);color:inherit;padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.urun-doc-patch-actions{display:flex;align-items:center;gap:8px}.urun-doc-patch-button,.urun-mic-button{cursor:pointer;border-radius:6px;border:1px solid var(--urun-wb-border, rgba(128, 128, 128, .4));background:var(--urun-wb-accent, #24db49);color:var(--urun-wb-accent-fg, #04120a);padding:4px 12px;font-size:12px;font-weight:600}.urun-doc-patch-button:disabled{cursor:default;opacity:.5}.urun-doc-patch-error,.urun-mic-error{color:var(--urun-wb-danger, #e5484d)}.urun-event-spine{max-height:260px;overflow:auto}.urun-event-spine-line,.urun-control-sender-line{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px}.urun-event-spine-kind,.urun-control-sender-dir{display:inline-block;min-width:3.5em;color:var(--urun-wb-muted, #8a8a8a)}.urun-session-status{display:inline-flex;align-items:center;gap:6px;font-size:12px}.urun-session-status-dot{width:8px;height:8px;border-radius:50%;background:var(--urun-wb-muted, #8a8a8a)}.urun-session-status-dot[data-phase=live]{background:var(--urun-wb-accent, #24db49)}.urun-session-status-dot[data-phase=connecting],.urun-session-status-dot[data-phase=provisioning],.urun-session-status-dot[data-phase=queued]{background:var(--urun-wb-warn, #ffb224)}.urun-session-status-dot[data-phase=error]{background:var(--urun-wb-danger, #e5484d)}.urun-session-status-detail{color:var(--urun-wb-muted, #8a8a8a)}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { RefObject, ReactNode, Component, ErrorInfo, ComponentType } from 'react';
|
|
4
|
-
|
|
4
|
+
export { UrunAuthMode, authMode, urunPublicEnv, usesWorkOSAuth } from './auth.mjs';
|
|
5
|
+
import { SessionInterface, SessionDocument, SessionStream, SessionPhase, SessionStatus } from '@urun-sh/core';
|
|
5
6
|
export { App as AppInterface, AppOptions, SessionDocument, Session as SessionInterface, SessionPhase, SessionPhaseName, SessionStream } from '@urun-sh/core';
|
|
6
7
|
import { ZodSchema, z } from 'zod';
|
|
7
8
|
import Player from 'video.js/dist/types/player';
|
|
@@ -60,11 +61,6 @@ declare function UrunAuthProvider({ getAccessToken, children }: UrunAuthProvider
|
|
|
60
61
|
declare const UrunJwtProvider: typeof UrunAuthProvider;
|
|
61
62
|
declare function useUrunAuth(): UrunAuthContextValue | null;
|
|
62
63
|
|
|
63
|
-
type UrunAuthMode = 'workos' | 'jwt';
|
|
64
|
-
declare function urunPublicEnv(name: string): string | undefined;
|
|
65
|
-
declare function authMode(): UrunAuthMode;
|
|
66
|
-
declare function usesWorkOSAuth(): boolean;
|
|
67
|
-
|
|
68
64
|
type Unsubscribe = () => void;
|
|
69
65
|
type ReactSessionDocument<T = Record<string, unknown>> = Omit<SessionDocument, 'get' | 'set' | 'on'> & {
|
|
70
66
|
get(): T;
|
|
@@ -78,6 +74,8 @@ interface ReactSession extends Omit<SessionInterface, 'doc' | 'stream'> {
|
|
|
78
74
|
stream(name: string): ReactSessionStream;
|
|
79
75
|
|
|
80
76
|
readonly phase: SessionPhase;
|
|
77
|
+
|
|
78
|
+
readonly status: SessionStatus;
|
|
81
79
|
}
|
|
82
80
|
type ReactApp = Record<string, (args?: Record<string, unknown>) => ReactSession>;
|
|
83
81
|
|
|
@@ -279,12 +277,12 @@ declare const ImageFrameSchema: z.ZodObject<{
|
|
|
279
277
|
caption: z.ZodOptional<z.ZodString>;
|
|
280
278
|
}, "strip", z.ZodTypeAny, {
|
|
281
279
|
src: string;
|
|
282
|
-
alt?: string | undefined;
|
|
283
280
|
caption?: string | undefined;
|
|
281
|
+
alt?: string | undefined;
|
|
284
282
|
}, {
|
|
285
283
|
src: string;
|
|
286
|
-
alt?: string | undefined;
|
|
287
284
|
caption?: string | undefined;
|
|
285
|
+
alt?: string | undefined;
|
|
288
286
|
}>;
|
|
289
287
|
type ImageFrameProps = z.infer<typeof ImageFrameSchema>;
|
|
290
288
|
declare function useImageFrame(props: ImageFrameProps): {
|
|
@@ -300,24 +298,24 @@ declare const MetricsPanelSchema: z.ZodObject<{
|
|
|
300
298
|
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
301
299
|
unit: z.ZodOptional<z.ZodString>;
|
|
302
300
|
}, "strip", z.ZodTypeAny, {
|
|
303
|
-
value: string | number;
|
|
304
301
|
label: string;
|
|
302
|
+
value: string | number;
|
|
305
303
|
unit?: string | undefined;
|
|
306
304
|
}, {
|
|
307
|
-
value: string | number;
|
|
308
305
|
label: string;
|
|
306
|
+
value: string | number;
|
|
309
307
|
unit?: string | undefined;
|
|
310
308
|
}>, "many">;
|
|
311
309
|
}, "strip", z.ZodTypeAny, {
|
|
312
310
|
metrics: {
|
|
313
|
-
value: string | number;
|
|
314
311
|
label: string;
|
|
312
|
+
value: string | number;
|
|
315
313
|
unit?: string | undefined;
|
|
316
314
|
}[];
|
|
317
315
|
}, {
|
|
318
316
|
metrics: {
|
|
319
|
-
value: string | number;
|
|
320
317
|
label: string;
|
|
318
|
+
value: string | number;
|
|
321
319
|
unit?: string | undefined;
|
|
322
320
|
}[];
|
|
323
321
|
}>;
|
|
@@ -366,4 +364,355 @@ interface UrunVideoProps {
|
|
|
366
364
|
|
|
367
365
|
declare const UrunVideo: react.ForwardRefExoticComponent<UrunVideoProps & react.RefAttributes<HTMLVideoElement>>;
|
|
368
366
|
|
|
369
|
-
|
|
367
|
+
interface UrunAudioStreamSource {
|
|
368
|
+
|
|
369
|
+
readonly track: MediaStreamTrack | null;
|
|
370
|
+
|
|
371
|
+
on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
interface UrunAudioSessionSource {
|
|
375
|
+
stream(name: string): UrunAudioStreamSource;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
interface UrunAudioHandle {
|
|
379
|
+
|
|
380
|
+
unlock(): void;
|
|
381
|
+
|
|
382
|
+
readonly unlocked: boolean;
|
|
383
|
+
|
|
384
|
+
readonly element: HTMLAudioElement | null;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
interface UrunAudioProps {
|
|
388
|
+
|
|
389
|
+
session?: UrunAudioSessionSource | null;
|
|
390
|
+
|
|
391
|
+
stream?: string;
|
|
392
|
+
|
|
393
|
+
track?: MediaStreamTrack | null;
|
|
394
|
+
|
|
395
|
+
controls?: boolean;
|
|
396
|
+
|
|
397
|
+
className?: string;
|
|
398
|
+
|
|
399
|
+
onTrack?: (track: MediaStreamTrack | null) => void;
|
|
400
|
+
|
|
401
|
+
onUnlockChange?: (unlocked: boolean) => void;
|
|
402
|
+
|
|
403
|
+
onAudioElement?: (el: HTMLAudioElement | null) => void;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
declare const UrunAudio: react.ForwardRefExoticComponent<UrunAudioProps & react.RefAttributes<UrunAudioHandle>>;
|
|
407
|
+
|
|
408
|
+
interface UrunVoiceStreamSource extends UrunAudioStreamSource {
|
|
409
|
+
attach(track: MediaStreamTrack): Promise<void>;
|
|
410
|
+
detach(): Promise<void>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
interface UrunVoiceSessionSource {
|
|
414
|
+
stream(name: string): UrunVoiceStreamSource;
|
|
415
|
+
|
|
416
|
+
whenLive(options?: {
|
|
417
|
+
timeout?: number;
|
|
418
|
+
signal?: AbortSignal;
|
|
419
|
+
}): Promise<void>;
|
|
420
|
+
|
|
421
|
+
readonly status?: SessionStatus;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface UrunVoiceHandle {
|
|
425
|
+
|
|
426
|
+
start(): Promise<void>;
|
|
427
|
+
|
|
428
|
+
stop(): Promise<void>;
|
|
429
|
+
|
|
430
|
+
readonly active: boolean;
|
|
431
|
+
|
|
432
|
+
readonly micStream: MediaStream | null;
|
|
433
|
+
|
|
434
|
+
unlock(): void;
|
|
435
|
+
|
|
436
|
+
readonly audio: UrunAudioHandle | null;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
interface UrunVoiceProps {
|
|
440
|
+
|
|
441
|
+
session: UrunVoiceSessionSource;
|
|
442
|
+
|
|
443
|
+
stream?: string;
|
|
444
|
+
|
|
445
|
+
constraints?: MediaTrackConstraints;
|
|
446
|
+
|
|
447
|
+
connectTimeoutMs?: number;
|
|
448
|
+
|
|
449
|
+
attempts?: number;
|
|
450
|
+
|
|
451
|
+
retryDelayMs?: number;
|
|
452
|
+
|
|
453
|
+
onActiveChange?: (active: boolean) => void;
|
|
454
|
+
|
|
455
|
+
onError?: (error: Error) => void;
|
|
456
|
+
|
|
457
|
+
onMicStream?: (stream: MediaStream | null) => void;
|
|
458
|
+
|
|
459
|
+
onTrack?: (track: MediaStreamTrack | null) => void;
|
|
460
|
+
|
|
461
|
+
onUnlockChange?: (unlocked: boolean) => void;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
declare const DEFAULT_VOICE_CONSTRAINTS: MediaTrackConstraints;
|
|
465
|
+
|
|
466
|
+
declare const UrunVoice: react.ForwardRefExoticComponent<UrunVoiceProps & react.RefAttributes<UrunVoiceHandle>>;
|
|
467
|
+
|
|
468
|
+
interface UrunCameraStreamSource {
|
|
469
|
+
attachVideo(track: MediaStreamTrack): Promise<void>;
|
|
470
|
+
detachVideo(): Promise<void>;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
interface UrunCameraSessionSource {
|
|
474
|
+
stream(name: string): UrunCameraStreamSource;
|
|
475
|
+
|
|
476
|
+
whenLive(options?: {
|
|
477
|
+
timeout?: number;
|
|
478
|
+
signal?: AbortSignal;
|
|
479
|
+
}): Promise<void>;
|
|
480
|
+
|
|
481
|
+
readonly status?: SessionStatus;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
type UrunCameraFacing = 'user' | 'environment';
|
|
485
|
+
|
|
486
|
+
interface UrunCameraHandle {
|
|
487
|
+
|
|
488
|
+
start(options?: {
|
|
489
|
+
facingMode?: UrunCameraFacing;
|
|
490
|
+
}): Promise<void>;
|
|
491
|
+
|
|
492
|
+
stop(): Promise<void>;
|
|
493
|
+
|
|
494
|
+
flip(): Promise<void>;
|
|
495
|
+
|
|
496
|
+
setFacingMode(mode: UrunCameraFacing): Promise<void>;
|
|
497
|
+
|
|
498
|
+
readonly active: boolean;
|
|
499
|
+
|
|
500
|
+
readonly facingMode: UrunCameraFacing;
|
|
501
|
+
|
|
502
|
+
readonly stream: MediaStream | null;
|
|
503
|
+
|
|
504
|
+
readonly element: HTMLVideoElement | null;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
interface UrunCameraProps {
|
|
508
|
+
|
|
509
|
+
session: UrunCameraSessionSource;
|
|
510
|
+
|
|
511
|
+
stream?: string;
|
|
512
|
+
|
|
513
|
+
constraints?: MediaTrackConstraints;
|
|
514
|
+
|
|
515
|
+
facingMode?: UrunCameraFacing;
|
|
516
|
+
|
|
517
|
+
mirror?: boolean | 'auto';
|
|
518
|
+
|
|
519
|
+
connectTimeoutMs?: number;
|
|
520
|
+
|
|
521
|
+
preview?: boolean;
|
|
522
|
+
|
|
523
|
+
className?: string;
|
|
524
|
+
|
|
525
|
+
videoClassName?: string;
|
|
526
|
+
|
|
527
|
+
onActiveChange?: (active: boolean) => void;
|
|
528
|
+
|
|
529
|
+
onError?: (error: Error) => void;
|
|
530
|
+
|
|
531
|
+
onStream?: (stream: MediaStream | null) => void;
|
|
532
|
+
|
|
533
|
+
onTrack?: (track: MediaStreamTrack | null) => void;
|
|
534
|
+
|
|
535
|
+
children?: ReactNode;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
declare const DEFAULT_CAMERA_CONSTRAINTS: MediaTrackConstraints;
|
|
539
|
+
|
|
540
|
+
declare const UrunCamera: react.ForwardRefExoticComponent<UrunCameraProps & react.RefAttributes<UrunCameraHandle>>;
|
|
541
|
+
|
|
542
|
+
interface UseUrunAudioLevelOptions {
|
|
543
|
+
|
|
544
|
+
fftSize?: number;
|
|
545
|
+
|
|
546
|
+
intervalMs?: number;
|
|
547
|
+
|
|
548
|
+
speakingThreshold?: number;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
interface UrunAudioLevel {
|
|
552
|
+
|
|
553
|
+
level: number;
|
|
554
|
+
|
|
555
|
+
speaking: boolean;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
declare function useUrunAudioLevel(source: MediaStream | MediaStreamTrack | null | undefined, options?: UseUrunAudioLevelOptions): UrunAudioLevel;
|
|
559
|
+
|
|
560
|
+
declare function getUrunAudioContext(): AudioContext | null;
|
|
561
|
+
|
|
562
|
+
declare function resumeUrunAudioContext(): void;
|
|
563
|
+
|
|
564
|
+
interface WorkbenchStreamSource {
|
|
565
|
+
|
|
566
|
+
readonly track: MediaStreamTrack | null;
|
|
567
|
+
|
|
568
|
+
on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
|
|
569
|
+
|
|
570
|
+
messages(): AsyncIterable<unknown>;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
interface WorkbenchDocSource {
|
|
574
|
+
|
|
575
|
+
get(path?: string, defaultValue?: unknown): unknown;
|
|
576
|
+
|
|
577
|
+
set(patch: Record<string, unknown>): void;
|
|
578
|
+
|
|
579
|
+
on(event: 'change', handler: (snapshot: unknown) => void): () => void;
|
|
580
|
+
|
|
581
|
+
readonly synced: boolean;
|
|
582
|
+
|
|
583
|
+
onSynced(handler: () => void): () => void;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
interface WorkbenchSession {
|
|
587
|
+
|
|
588
|
+
readonly id: string;
|
|
589
|
+
|
|
590
|
+
readonly phase: SessionPhase;
|
|
591
|
+
|
|
592
|
+
onPhase(handler: (phase: SessionPhase) => void): () => void;
|
|
593
|
+
|
|
594
|
+
stream(name: string): WorkbenchStreamSource;
|
|
595
|
+
|
|
596
|
+
doc(key: string): WorkbenchDocSource;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
declare function useSessionTrack(session: WorkbenchSession | null, name: string): MediaStreamTrack | null;
|
|
600
|
+
|
|
601
|
+
interface UseSessionDocResult<T> {
|
|
602
|
+
|
|
603
|
+
snapshot: T | null;
|
|
604
|
+
|
|
605
|
+
synced: boolean;
|
|
606
|
+
|
|
607
|
+
set: (patch: Partial<T> & Record<string, unknown>) => void;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
declare function useSessionDoc<T = Record<string, unknown>>(session: WorkbenchSession | null, key: string): UseSessionDocResult<T>;
|
|
611
|
+
|
|
612
|
+
declare const DEFAULT_LOG_CAP = 200;
|
|
613
|
+
|
|
614
|
+
declare function pushCapped<T>(list: readonly T[], entry: T, cap?: number): T[];
|
|
615
|
+
|
|
616
|
+
interface StreamMessageEntry {
|
|
617
|
+
at: number;
|
|
618
|
+
payload: unknown;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
interface SpineEntry {
|
|
622
|
+
at: number;
|
|
623
|
+
kind: 'phase' | 'track' | 'doc';
|
|
624
|
+
text: string;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
declare function formatPayload(payload: unknown): string;
|
|
628
|
+
type JsonObjectParse = {
|
|
629
|
+
ok: true;
|
|
630
|
+
value: Record<string, unknown>;
|
|
631
|
+
} | {
|
|
632
|
+
ok: false;
|
|
633
|
+
error: string;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
declare function parseJsonObject(text: string): JsonObjectParse;
|
|
637
|
+
|
|
638
|
+
interface UseStreamMessagesOptions {
|
|
639
|
+
|
|
640
|
+
cap?: number;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
declare function useStreamMessages(session: WorkbenchSession | null, name: string, options?: UseStreamMessagesOptions): StreamMessageEntry[];
|
|
644
|
+
|
|
645
|
+
interface UrunStreamTailProps {
|
|
646
|
+
|
|
647
|
+
session: WorkbenchSession | null;
|
|
648
|
+
|
|
649
|
+
name: string;
|
|
650
|
+
|
|
651
|
+
cap?: number;
|
|
652
|
+
className?: string;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
declare function UrunStreamTail({ session, name, cap, className }: UrunStreamTailProps): react_jsx_runtime.JSX.Element;
|
|
656
|
+
|
|
657
|
+
declare function DocPatchForm({ placeholder, buttonLabel, disabled, onApply, }: {
|
|
658
|
+
placeholder?: string;
|
|
659
|
+
buttonLabel: string;
|
|
660
|
+
disabled?: boolean;
|
|
661
|
+
onApply: (patch: Record<string, unknown>, raw: string) => void;
|
|
662
|
+
}): react_jsx_runtime.JSX.Element;
|
|
663
|
+
interface UrunDocPanelProps {
|
|
664
|
+
session: WorkbenchSession | null;
|
|
665
|
+
|
|
666
|
+
docKey: string;
|
|
667
|
+
|
|
668
|
+
editable?: boolean;
|
|
669
|
+
|
|
670
|
+
patchPlaceholder?: string;
|
|
671
|
+
className?: string;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
declare function UrunDocPanel({ session, docKey, editable, patchPlaceholder, className, }: UrunDocPanelProps): react_jsx_runtime.JSX.Element;
|
|
675
|
+
|
|
676
|
+
interface UrunControlSenderProps {
|
|
677
|
+
session: WorkbenchSession | null;
|
|
678
|
+
|
|
679
|
+
docKey?: string;
|
|
680
|
+
|
|
681
|
+
cap?: number;
|
|
682
|
+
className?: string;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
declare function UrunControlSender({ session, docKey, cap, className, }: UrunControlSenderProps): react_jsx_runtime.JSX.Element;
|
|
686
|
+
|
|
687
|
+
interface UrunEventSpineProps {
|
|
688
|
+
session: WorkbenchSession | null;
|
|
689
|
+
|
|
690
|
+
trackNames?: string[];
|
|
691
|
+
|
|
692
|
+
docKeys?: string[];
|
|
693
|
+
|
|
694
|
+
cap?: number;
|
|
695
|
+
className?: string;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
declare function UrunEventSpine({ session, trackNames, docKeys, cap, className, }: UrunEventSpineProps): react_jsx_runtime.JSX.Element;
|
|
699
|
+
|
|
700
|
+
declare function useSessionPhase(session: WorkbenchSession | null): SessionPhase | null;
|
|
701
|
+
interface UrunSessionStatusProps {
|
|
702
|
+
session: WorkbenchSession | null;
|
|
703
|
+
className?: string;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
declare function UrunSessionStatus({ session, className }: UrunSessionStatusProps): react_jsx_runtime.JSX.Element;
|
|
707
|
+
interface UrunSessionGateProps {
|
|
708
|
+
session: WorkbenchSession | null;
|
|
709
|
+
|
|
710
|
+
children: ReactNode;
|
|
711
|
+
|
|
712
|
+
fallback?: (phase: SessionPhase | null) => ReactNode;
|
|
713
|
+
className?: string;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
declare function UrunSessionGate({ session, children, fallback, className, }: UrunSessionGateProps): react_jsx_runtime.JSX.Element;
|
|
717
|
+
|
|
718
|
+
export { type ChatMessage, type ChatRole, ComponentRenderer, DEFAULT_CAMERA_CONSTRAINTS, DEFAULT_LOG_CAP, DEFAULT_VOICE_CONSTRAINTS, DocPatchForm, ImageFrame, ImageFrameSchema, type JsonObjectParse, MetricsPanel, MetricsPanelSchema, ProgressCard, ProgressCardSchema, type ReactApp, type ReactSession, type ReactSessionDocument, type ReactSessionStream, type RegisteredComponent, type RequestCapableSession, type RequestStream, type SessionRequestOptions, type SpineEntry, StatusBadge, StatusBadgeSchema, type StreamMessageEntry, TextStream, TextStreamSchema, type UrunAccessToken, type UrunAccessTokenProvider, UrunAudio, type UrunAudioHandle, type UrunAudioLevel, type UrunAudioProps, type UrunAudioSessionSource, type UrunAudioStreamSource, type UrunAuthContextValue, UrunAuthProvider, type UrunAuthProviderProps, UrunCamera, type UrunCameraFacing, type UrunCameraHandle, type UrunCameraProps, type UrunCameraSessionSource, type UrunCameraStreamSource, UrunControlSender, type UrunControlSenderProps, UrunDocPanel, type UrunDocPanelProps, UrunErrorBoundary, UrunEventSpine, type UrunEventSpineProps, UrunJwtProvider, UrunProvider, UrunSessionGate, type UrunSessionGateProps, UrunSessionStatus, type UrunSessionStatusProps, UrunStreamTail, type UrunStreamTailProps, UrunVideo, type UrunVideoProps, UrunVoice, type UrunVoiceHandle, type UrunVoiceProps, type UrunVoiceSessionSource, type UrunVoiceStreamSource, type UseChatOptions, type UseChatResult, type UseCompletionOptions, type UseCompletionResult, type UseRequestOptions, type UseRequestResult, type UseSessionDocResult, type UseStreamMessagesOptions, type UseUrunAudioLevelOptions, type WorkbenchDocSource, type WorkbenchSession, type WorkbenchStreamSource, formatPayload, getUrunAudioContext, parseJsonObject, pushCapped, registerComponent, resumeUrunAudioContext, useApp, useChat, useCompletion, useImageFrame, useMetricsPanel, useProgressCard, useRequest, useSessionDoc, useSessionPhase, useSessionTrack, useStatusBadge, useStreamMessages, useTextStream, useUrunAudioLevel, useUrunAuth };
|