@rynx-ai/server 0.1.0 → 0.1.10-beta.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/dist/browser-surface-control-queue.d.ts +42 -0
- package/dist/browser-surface-control-queue.js +187 -0
- package/dist/browser-surface-ws.d.ts +16 -0
- package/dist/browser-surface-ws.js +356 -0
- package/dist/control-api.d.ts +76 -4
- package/dist/control-api.js +3014 -133
- package/dist/control-web/assets/highlighted-body-OFNGDK62-DHu2g-rk.js +1 -0
- package/dist/control-web/assets/index-B6Pb5j9M.js +666 -0
- package/dist/control-web/assets/index-BU-_Qud_.css +32 -0
- package/dist/control-web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/control-web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/control-web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/control-web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/control-web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/control-web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/control-web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-CSYzOmBR.js +131 -0
- package/dist/control-web/assets/rynx-wordmark-LL1QRYHD.png +0 -0
- package/dist/control-web/favicon.png +0 -0
- package/dist/control-web/favicon.svg +38 -0
- package/dist/control-web/index.html +16 -0
- package/dist/control-web-dist.d.ts +1 -1
- package/dist/control-web-dist.js +19 -14
- package/dist/desktop-browser-host.d.ts +170 -0
- package/dist/desktop-browser-host.js +1018 -0
- package/dist/direct-runtime-browser-inspect-server.d.ts +72 -0
- package/dist/direct-runtime-browser-inspect-server.js +749 -0
- package/dist/direct-runtime-browser-surface-server.d.ts +74 -0
- package/dist/direct-runtime-browser-surface-server.js +821 -0
- package/dist/direct-runtime-server.d.ts +143 -0
- package/dist/direct-runtime-server.js +1959 -0
- package/dist/emulator-surface-ws.d.ts +8 -0
- package/dist/emulator-surface-ws.js +198 -0
- package/dist/machine-session-service.d.ts +265 -0
- package/dist/machine-session-service.js +822 -0
- package/dist/provider-cli-host.d.ts +10 -0
- package/dist/provider-cli-host.js +1 -0
- package/dist/remote-runtime-dispatcher.d.ts +94 -0
- package/dist/remote-runtime-dispatcher.js +403 -0
- package/dist/remote-runtime-session-projection.d.ts +19 -0
- package/dist/remote-runtime-session-projection.js +566 -0
- package/dist/remote-runtime.d.ts +22 -0
- package/dist/remote-runtime.js +32 -0
- package/dist/runtime-web-auth.d.ts +26 -0
- package/dist/runtime-web-auth.js +132 -0
- package/dist/server.d.ts +364 -12
- package/dist/server.js +341 -100
- package/dist/session-browser-service.d.ts +248 -0
- package/dist/session-browser-service.js +772 -0
- package/dist/session-browser-surface-coordinator.d.ts +24 -0
- package/dist/session-browser-surface-coordinator.js +669 -0
- package/dist/session-emulator-service.d.ts +167 -0
- package/dist/session-emulator-service.js +464 -0
- package/dist/session-runtime-index.d.ts +23 -0
- package/dist/session-runtime-index.js +96 -0
- package/dist/session-terminal-host.d.ts +51 -0
- package/dist/session-terminal-host.js +270 -0
- package/dist/terminal-ws.d.ts +12 -20
- package/dist/terminal-ws.js +421 -97
- package/package.json +14 -7
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { type RuntimeBrowserCloseParams, type RuntimeBrowserCloseResult, type RuntimeBrowserExecutionBackend, type RuntimeBrowserOpenParams, type RuntimeBrowserPageCreateParams, type RuntimeBrowserPageMutationParams, type RuntimeBrowserPageNavigateParams, type RuntimeBrowserState, type RuntimeBrowserStateGetParams } from "@rynx-ai/protocol/runtime-browser";
|
|
2
|
+
import type { RuntimeBrowserSurfaceFormat, RuntimeBrowserSurfaceInputEvent } from "@rynx-ai/protocol/runtime-browser-surface";
|
|
3
|
+
import { type RuntimeBrowserEndpointDescriptor } from "@rynx-ai/protocol/runtime-browser-bootstrap";
|
|
4
|
+
export interface SessionBrowserHostCreateInput {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
browserGeneration: number;
|
|
7
|
+
url?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Generation-scoped physical page state. `hostPageId` never leaves the service. */
|
|
10
|
+
export interface SessionBrowserHostPage {
|
|
11
|
+
hostPageId: string;
|
|
12
|
+
url: string;
|
|
13
|
+
title: string;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
canGoBack: boolean;
|
|
16
|
+
canGoForward: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SessionBrowserHostSnapshot {
|
|
19
|
+
pages: SessionBrowserHostPage[];
|
|
20
|
+
activeHostPageId: string | null;
|
|
21
|
+
}
|
|
22
|
+
/** Engine viewport used by pixels and trusted human input for one physical Page. */
|
|
23
|
+
export interface SessionBrowserHostSurfaceViewport {
|
|
24
|
+
revision: number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
deviceScaleFactor: number;
|
|
28
|
+
}
|
|
29
|
+
/** A bounded Host frame. `acknowledge` releases its upstream frame exactly once. */
|
|
30
|
+
export interface SessionBrowserHostSurfaceFrame {
|
|
31
|
+
browserGeneration: number;
|
|
32
|
+
viewportRevision: number;
|
|
33
|
+
timestampMilliseconds: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
deviceScaleFactor: number;
|
|
37
|
+
format: RuntimeBrowserSurfaceFormat;
|
|
38
|
+
encodedBytes: Uint8Array;
|
|
39
|
+
acknowledge(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface SessionBrowserHostSurfaceTrustedInput {
|
|
42
|
+
browserGeneration: number;
|
|
43
|
+
viewportRevision: number;
|
|
44
|
+
event: RuntimeBrowserSurfaceInputEvent;
|
|
45
|
+
}
|
|
46
|
+
/** One generation/page-scoped capture and trusted-input source. */
|
|
47
|
+
export interface SessionBrowserHostSurfaceSource {
|
|
48
|
+
readonly browserGeneration: number;
|
|
49
|
+
readonly hostPageId: string;
|
|
50
|
+
readonly format: RuntimeBrowserSurfaceFormat;
|
|
51
|
+
readonly frames: AsyncIterable<SessionBrowserHostSurfaceFrame>;
|
|
52
|
+
getViewport(): SessionBrowserHostSurfaceViewport;
|
|
53
|
+
/** Optional atomic handoff between native guest input and streamed control. */
|
|
54
|
+
setHumanDriver?(driver: "desktop" | "stream"): Promise<void>;
|
|
55
|
+
dispatchTrustedInput(input: SessionBrowserHostSurfaceTrustedInput): Promise<void>;
|
|
56
|
+
/** Releases physical keys/buttons still held by the streamed driver. Hosts
|
|
57
|
+
* without a native desktop driver need this when a viewer releases and later
|
|
58
|
+
* retakes the same live Surface. */
|
|
59
|
+
resetTrustedInput?(): Promise<void>;
|
|
60
|
+
/** Idempotent. It ends `frames` and releases capture even after Host loss. */
|
|
61
|
+
close(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export interface SessionBrowserHostSurfaceOpenInput {
|
|
64
|
+
browserGeneration: number;
|
|
65
|
+
hostPageId: string;
|
|
66
|
+
format: RuntimeBrowserSurfaceFormat;
|
|
67
|
+
quality: number;
|
|
68
|
+
maximumFrameRate: number;
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
}
|
|
71
|
+
/** Semantic Page request used by presentation adapters; physical Page identity stays private. */
|
|
72
|
+
export interface SessionBrowserSurfaceOpenInput {
|
|
73
|
+
sessionId: string;
|
|
74
|
+
browserGeneration: number;
|
|
75
|
+
pageId: string;
|
|
76
|
+
format: RuntimeBrowserSurfaceFormat;
|
|
77
|
+
quality: number;
|
|
78
|
+
maximumFrameRate: number;
|
|
79
|
+
signal?: AbortSignal;
|
|
80
|
+
}
|
|
81
|
+
export type SessionBrowserSurfaceSource = Omit<SessionBrowserHostSurfaceSource, "hostPageId">;
|
|
82
|
+
/** One already-running semantic Page that can be exposed by a local inspection gateway. */
|
|
83
|
+
export interface SessionBrowserInspectionTarget {
|
|
84
|
+
sessionId: string;
|
|
85
|
+
browserGeneration: number;
|
|
86
|
+
pageId: string;
|
|
87
|
+
executionBackend: RuntimeBrowserExecutionBackend;
|
|
88
|
+
url: string;
|
|
89
|
+
title: string;
|
|
90
|
+
}
|
|
91
|
+
/** Exact loopback Page endpoint resolved only after the semantic tuple is fenced. */
|
|
92
|
+
export interface SessionBrowserInspectionEndpoint {
|
|
93
|
+
endpoint: string;
|
|
94
|
+
engineVersion: string;
|
|
95
|
+
}
|
|
96
|
+
export declare class SessionBrowserSurfaceUnsupportedError extends Error {
|
|
97
|
+
constructor();
|
|
98
|
+
}
|
|
99
|
+
export type SessionBrowserHostEvent = {
|
|
100
|
+
type: "changed";
|
|
101
|
+
browserGeneration: number;
|
|
102
|
+
} | {
|
|
103
|
+
type: "page.replaced";
|
|
104
|
+
browserGeneration: number;
|
|
105
|
+
previousHostPageId: string;
|
|
106
|
+
page: SessionBrowserHostPage;
|
|
107
|
+
} | {
|
|
108
|
+
type: "unavailable";
|
|
109
|
+
browserGeneration: number;
|
|
110
|
+
reason: string;
|
|
111
|
+
};
|
|
112
|
+
/** One physical Browser generation. Implementations must make `close` idempotent. */
|
|
113
|
+
export interface SessionBrowserHostHandle {
|
|
114
|
+
readonly browserGeneration: number;
|
|
115
|
+
readonly executionBackend: RuntimeBrowserExecutionBackend;
|
|
116
|
+
readonly capabilities: readonly string[];
|
|
117
|
+
readonly events: AsyncIterable<SessionBrowserHostEvent>;
|
|
118
|
+
/** Runtime-local automation handoff. It is never projected into Browser state or Direct RPC. */
|
|
119
|
+
getCdpEndpoint(): Promise<{
|
|
120
|
+
endpoint: string;
|
|
121
|
+
engineVersion: string;
|
|
122
|
+
pageTargetId?: string;
|
|
123
|
+
}>;
|
|
124
|
+
/** Optional exact physical Page handoff for the daemon-local inspection gateway. */
|
|
125
|
+
getPageCdpEndpoint?(hostPageId: string): Promise<SessionBrowserInspectionEndpoint>;
|
|
126
|
+
/** Optional physical presentation primitive; it never projects native CDP. */
|
|
127
|
+
openSurface?(input: SessionBrowserHostSurfaceOpenInput): Promise<SessionBrowserHostSurfaceSource>;
|
|
128
|
+
snapshot(): Promise<SessionBrowserHostSnapshot>;
|
|
129
|
+
/** Optional idempotent handoff from physical identity to the semantic Page ID. */
|
|
130
|
+
bindPage?(hostPageId: string, pageId: string): Promise<void>;
|
|
131
|
+
createPage(url?: string): Promise<void>;
|
|
132
|
+
closePage(hostPageId: string): Promise<void>;
|
|
133
|
+
activatePage(hostPageId: string): Promise<void>;
|
|
134
|
+
navigatePage(hostPageId: string, url: string): Promise<void>;
|
|
135
|
+
goBack(hostPageId: string): Promise<void>;
|
|
136
|
+
goForward(hostPageId: string): Promise<void>;
|
|
137
|
+
reload(hostPageId: string): Promise<void>;
|
|
138
|
+
close(): Promise<void>;
|
|
139
|
+
}
|
|
140
|
+
/** Physical Browser factory selected by the Runtime composition root. */
|
|
141
|
+
export interface SessionBrowserHost {
|
|
142
|
+
createBrowser(input: SessionBrowserHostCreateInput): Promise<SessionBrowserHostHandle>;
|
|
143
|
+
deleteSessionData?(sessionId: string): Promise<void>;
|
|
144
|
+
}
|
|
145
|
+
export interface SessionBrowserRegistryPort {
|
|
146
|
+
exists(sessionId: string): boolean | Promise<boolean>;
|
|
147
|
+
}
|
|
148
|
+
export interface SessionBrowserServicePorts {
|
|
149
|
+
host: SessionBrowserHost;
|
|
150
|
+
/** Omit only when the caller has already established Session existence. */
|
|
151
|
+
sessions?: SessionBrowserRegistryPort;
|
|
152
|
+
}
|
|
153
|
+
export interface SessionBrowserServiceOptions {
|
|
154
|
+
/** Injectable only so opaque identity behavior is deterministic in tests. */
|
|
155
|
+
pageIdFactory?: () => string;
|
|
156
|
+
/** Injectable boot nonce; production randomization fences stale pre-restart mutations. */
|
|
157
|
+
bootGenerationSeed?: number;
|
|
158
|
+
}
|
|
159
|
+
export type SessionBrowserHostErrorCode = "unavailable" | "page_not_found" | "capacity" | "outcome_unknown";
|
|
160
|
+
/** Expected failure reported by a Browser Host implementation. */
|
|
161
|
+
export declare class SessionBrowserHostError extends Error {
|
|
162
|
+
readonly code: SessionBrowserHostErrorCode;
|
|
163
|
+
constructor(code: SessionBrowserHostErrorCode, message: string, options?: ErrorOptions);
|
|
164
|
+
}
|
|
165
|
+
export type SessionBrowserServiceErrorCode = "invalid_request" | "not_found" | "generation_mismatch" | "unavailable" | "capacity" | "host_failure" | "outcome_unknown" | "shutting_down";
|
|
166
|
+
/** Stable application error; transports map the code without exposing Host diagnostics. */
|
|
167
|
+
export declare class SessionBrowserServiceError extends Error {
|
|
168
|
+
readonly code: SessionBrowserServiceErrorCode;
|
|
169
|
+
constructor(code: SessionBrowserServiceErrorCode, message: string, options?: ErrorOptions);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Transport-neutral owner of the Runtime -> Session -> Browser -> Page model.
|
|
173
|
+
* Every operation for one Session shares one queue; different Sessions remain independent.
|
|
174
|
+
*/
|
|
175
|
+
export declare class SessionBrowserService {
|
|
176
|
+
private readonly ports;
|
|
177
|
+
private readonly records;
|
|
178
|
+
private readonly generations;
|
|
179
|
+
private readonly queues;
|
|
180
|
+
private readonly deletingSessions;
|
|
181
|
+
private readonly observers;
|
|
182
|
+
private readonly pageIdFactory;
|
|
183
|
+
private readonly bootGenerationSeed;
|
|
184
|
+
private shuttingDown;
|
|
185
|
+
private closeAllPromise?;
|
|
186
|
+
constructor(ports: SessionBrowserServicePorts, options?: SessionBrowserServiceOptions);
|
|
187
|
+
/** Number of Session Browsers that still own a physical Host handle. */
|
|
188
|
+
activeBrowserCount(): number;
|
|
189
|
+
/**
|
|
190
|
+
* Snapshot the current in-memory inspection inventory. Discovery is
|
|
191
|
+
* deliberately passive: it neither creates Browsers nor asks a Host to
|
|
192
|
+
* reconcile physical state.
|
|
193
|
+
*/
|
|
194
|
+
listInspectionTargets(): SessionBrowserInspectionTarget[];
|
|
195
|
+
/**
|
|
196
|
+
* Resolve one semantic inspection target to an exact Runtime-local Page
|
|
197
|
+
* endpoint. The physical Page identity never enters discovery or Direct RPC.
|
|
198
|
+
*/
|
|
199
|
+
getInspectionPageEndpoint(input: RuntimeBrowserPageMutationParams): Promise<SessionBrowserInspectionEndpoint>;
|
|
200
|
+
getState(input: RuntimeBrowserStateGetParams): Promise<RuntimeBrowserState | null>;
|
|
201
|
+
/**
|
|
202
|
+
* Runtime-local automation handoff. This method is deliberately absent from
|
|
203
|
+
* RemoteRuntimeBrowserHost and Direct RPC so a CDP endpoint cannot cross a
|
|
204
|
+
* Runtime boundary.
|
|
205
|
+
*/
|
|
206
|
+
getRuntimeLocalEndpoint(sessionId: string): Promise<RuntimeBrowserEndpointDescriptor>;
|
|
207
|
+
/**
|
|
208
|
+
* Resolve one opaque Page to its generation-local Host source. This is the
|
|
209
|
+
* only presentation path allowed to cross the semantic/physical Page seam.
|
|
210
|
+
*/
|
|
211
|
+
validateSurfaceTarget(input: Pick<SessionBrowserSurfaceOpenInput, "sessionId" | "browserGeneration" | "pageId">): Promise<void>;
|
|
212
|
+
openSurface(input: SessionBrowserSurfaceOpenInput): Promise<SessionBrowserSurfaceSource>;
|
|
213
|
+
open(input: RuntimeBrowserOpenParams): Promise<RuntimeBrowserState>;
|
|
214
|
+
close(input: RuntimeBrowserCloseParams): Promise<RuntimeBrowserCloseResult>;
|
|
215
|
+
createPage(input: RuntimeBrowserPageCreateParams): Promise<RuntimeBrowserState>;
|
|
216
|
+
closePage(input: RuntimeBrowserPageMutationParams): Promise<RuntimeBrowserState>;
|
|
217
|
+
activatePage(input: RuntimeBrowserPageMutationParams): Promise<RuntimeBrowserState>;
|
|
218
|
+
navigatePage(input: RuntimeBrowserPageNavigateParams): Promise<RuntimeBrowserState>;
|
|
219
|
+
goBack(input: RuntimeBrowserPageMutationParams): Promise<RuntimeBrowserState>;
|
|
220
|
+
goForward(input: RuntimeBrowserPageMutationParams): Promise<RuntimeBrowserState>;
|
|
221
|
+
reload(input: RuntimeBrowserPageMutationParams): Promise<RuntimeBrowserState>;
|
|
222
|
+
/** Session deletion fence: no later Browser operation may enter for this Session ID. */
|
|
223
|
+
cleanupSession(sessionId: string): Promise<void>;
|
|
224
|
+
/** Daemon shutdown closes engines but intentionally preserves Session profile data. */
|
|
225
|
+
closeAll(): Promise<void>;
|
|
226
|
+
private closeEveryRecord;
|
|
227
|
+
private createBrowser;
|
|
228
|
+
private closeUnavailableForRecreate;
|
|
229
|
+
private pageMutation;
|
|
230
|
+
private pageMutationParsed;
|
|
231
|
+
private runMutation;
|
|
232
|
+
private reconcileForRead;
|
|
233
|
+
private reconcileForMutation;
|
|
234
|
+
private tryReconcileAfterRejectedMutation;
|
|
235
|
+
private reconcile;
|
|
236
|
+
private createPageId;
|
|
237
|
+
private project;
|
|
238
|
+
private observe;
|
|
239
|
+
private consumeEvents;
|
|
240
|
+
private applyReplacement;
|
|
241
|
+
private isCurrent;
|
|
242
|
+
private requireRecord;
|
|
243
|
+
private requireReadyRecord;
|
|
244
|
+
private requireGeneration;
|
|
245
|
+
private ensureSessionExists;
|
|
246
|
+
private ensureRunning;
|
|
247
|
+
private exclusive;
|
|
248
|
+
}
|