@rynx-ai/server 0.1.0 → 0.1.9

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.
Files changed (63) hide show
  1. package/dist/browser-surface-control-queue.d.ts +42 -0
  2. package/dist/browser-surface-control-queue.js +187 -0
  3. package/dist/browser-surface-ws.d.ts +14 -0
  4. package/dist/browser-surface-ws.js +355 -0
  5. package/dist/control-api.d.ts +59 -4
  6. package/dist/control-api.js +2213 -132
  7. package/dist/control-web/assets/highlighted-body-OFNGDK62-e-w61YLy.js +1 -0
  8. package/dist/control-web/assets/index-BQ7XVBKO.css +32 -0
  9. package/dist/control-web/assets/index-ClpzuBJx.js +606 -0
  10. package/dist/control-web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  11. package/dist/control-web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  12. package/dist/control-web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  13. package/dist/control-web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  14. package/dist/control-web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  15. package/dist/control-web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  16. package/dist/control-web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  17. package/dist/control-web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  18. package/dist/control-web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  19. package/dist/control-web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  20. package/dist/control-web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  21. package/dist/control-web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  22. package/dist/control-web/assets/mermaid-GHXKKRXX-DZn7Hbr2.js +131 -0
  23. package/dist/control-web/assets/rynx-wordmark-LL1QRYHD.png +0 -0
  24. package/dist/control-web/favicon.png +0 -0
  25. package/dist/control-web/favicon.svg +38 -0
  26. package/dist/control-web/index.html +16 -0
  27. package/dist/control-web-dist.d.ts +1 -1
  28. package/dist/control-web-dist.js +19 -14
  29. package/dist/desktop-browser-host.d.ts +153 -0
  30. package/dist/desktop-browser-host.js +936 -0
  31. package/dist/direct-runtime-browser-surface-server.d.ts +74 -0
  32. package/dist/direct-runtime-browser-surface-server.js +821 -0
  33. package/dist/direct-runtime-server.d.ts +137 -0
  34. package/dist/direct-runtime-server.js +1931 -0
  35. package/dist/emulator-surface-ws.d.ts +6 -0
  36. package/dist/emulator-surface-ws.js +197 -0
  37. package/dist/machine-session-service.d.ts +182 -0
  38. package/dist/machine-session-service.js +559 -0
  39. package/dist/provider-cli-host.d.ts +10 -0
  40. package/dist/provider-cli-host.js +1 -0
  41. package/dist/remote-runtime-dispatcher.d.ts +94 -0
  42. package/dist/remote-runtime-dispatcher.js +380 -0
  43. package/dist/remote-runtime-session-projection.d.ts +19 -0
  44. package/dist/remote-runtime-session-projection.js +556 -0
  45. package/dist/remote-runtime.d.ts +22 -0
  46. package/dist/remote-runtime.js +32 -0
  47. package/dist/runtime-web-auth.d.ts +21 -0
  48. package/dist/runtime-web-auth.js +92 -0
  49. package/dist/server.d.ts +292 -10
  50. package/dist/server.js +314 -98
  51. package/dist/session-browser-service.d.ts +218 -0
  52. package/dist/session-browser-service.js +686 -0
  53. package/dist/session-browser-surface-coordinator.d.ts +23 -0
  54. package/dist/session-browser-surface-coordinator.js +563 -0
  55. package/dist/session-emulator-service.d.ts +167 -0
  56. package/dist/session-emulator-service.js +464 -0
  57. package/dist/session-runtime-index.d.ts +17 -0
  58. package/dist/session-runtime-index.js +86 -0
  59. package/dist/session-terminal-host.d.ts +46 -0
  60. package/dist/session-terminal-host.js +252 -0
  61. package/dist/terminal-ws.d.ts +9 -20
  62. package/dist/terminal-ws.js +420 -97
  63. package/package.json +9 -7
@@ -0,0 +1,137 @@
1
+ import type { AddressInfo } from "node:net";
2
+ import { DIRECT_RUNTIME_CONTROL_PATH, type DirectRuntimeClientAuthenticate, type DirectRuntimeChannelRole, type DirectRuntimeServerAccepted, type DirectRuntimeServerHello } from "@rynx-ai/protocol/direct-runtime";
3
+ import { type RuntimeEmulatorSurfaceClientFrame, type RuntimeEmulatorSurfaceOpenFrame, type RuntimeEmulatorSurfaceReadyFrame } from "@rynx-ai/protocol/runtime-emulator-surface";
4
+ import { WebSocket } from "ws";
5
+ import { type AuthenticatedRuntimeSubject, type RemoteRuntimeDispatcher } from "./remote-runtime-dispatcher.js";
6
+ import { type DirectRuntimeBrowserSurfaceHost, type DirectRuntimeBrowserSurfaceServerLimits } from "./direct-runtime-browser-surface-server.js";
7
+ export { DIRECT_RUNTIME_CONTROL_PATH };
8
+ export interface DirectRuntimeAuthenticator {
9
+ createServerHello(input: {
10
+ channelBinding: Uint8Array;
11
+ role: DirectRuntimeChannelRole;
12
+ signal: AbortSignal;
13
+ }): DirectRuntimeServerHello | Promise<DirectRuntimeServerHello>;
14
+ authenticate(input: {
15
+ channelBinding: Uint8Array;
16
+ role: DirectRuntimeChannelRole;
17
+ serverHello: DirectRuntimeServerHello;
18
+ /**
19
+ * Exact UTF-8 JSON wire bytes written to this channel. Proofs use the
20
+ * protocol's canonical encoders; callers must not substitute these bytes.
21
+ */
22
+ serverHelloBytes: Uint8Array;
23
+ clientAuthenticate: DirectRuntimeClientAuthenticate;
24
+ /**
25
+ * Exact UTF-8 JSON wire bytes received from this channel. Proofs use the
26
+ * protocol's canonical encoders; callers must not substitute these bytes.
27
+ */
28
+ clientAuthenticateBytes: Uint8Array;
29
+ signal: AbortSignal;
30
+ }): DirectRuntimeAuthenticationResult | Promise<DirectRuntimeAuthenticationResult>;
31
+ }
32
+ export interface DirectRuntimeAuthenticationResult {
33
+ peer: DirectRuntimePeer;
34
+ accepted: DirectRuntimeServerAccepted;
35
+ }
36
+ /** Direct-binding identity retained only by the transport adapter. */
37
+ export interface DirectRuntimePeer {
38
+ subject: AuthenticatedRuntimeSubject;
39
+ clientId: string;
40
+ grantId: string;
41
+ }
42
+ export interface DirectRuntimeServerLimits {
43
+ authenticationTimeoutMs: number;
44
+ maxConnections: number;
45
+ /** Simultaneous pre-authentication sockets from one real TCP peer address. */
46
+ maxUnauthenticatedConnectionsPerSource: number;
47
+ /** Authentication frames admitted from one real TCP peer per fixed window. */
48
+ maxAuthenticationAttemptsPerSource: number;
49
+ authenticationAttemptWindowMs: number;
50
+ /** Hard memory bound for the fixed-window source tracker. */
51
+ maxTrackedAuthenticationSources: number;
52
+ /** Simultaneous authenticated channels issued to one grant. */
53
+ maxConnectionsPerGrant: number;
54
+ /** Authentication queue depth or authenticated unary RPCs in flight per channel. */
55
+ maxQueuedFrames: number;
56
+ /** Request IDs are retained for the connection lifetime; reconnect after this many calls. */
57
+ maxRequestIds: number;
58
+ maxBufferedBytes: number;
59
+ /** Opening or active Remote Session event tails admitted on one authenticated channel. */
60
+ maxSessionSubscriptions: number;
61
+ /** Per-subscription application queue, independent of the WebSocket implementation buffer. */
62
+ maxQueuedSessionEvents: number;
63
+ maxQueuedSessionEventBytes: number;
64
+ /** Per-terminal queue; V1 admits one terminal attachment per connection. */
65
+ maxQueuedTerminalOutputFrames: number;
66
+ maxQueuedTerminalOutputBytes: number;
67
+ /** RFC 6455 ping cadence; a peer missing the next heartbeat is terminated. */
68
+ heartbeatIntervalMs: number;
69
+ shutdownDeadlineMs: number;
70
+ }
71
+ export interface StartDirectRuntimeServerOptions {
72
+ host: string;
73
+ /** Production configuration uses 1-65535; zero is accepted as a test/deployment seam. */
74
+ port: number;
75
+ /** Application E2EE identity owned by the daemon, not the transport adapter. */
76
+ e2ee: {
77
+ serverPublicKey: string;
78
+ deriveSharedSecret(clientEphemeralPublicKey: string): Uint8Array;
79
+ };
80
+ authenticator: DirectRuntimeAuthenticator;
81
+ dispatcher: RemoteRuntimeDispatcher;
82
+ /** Binding-level revocation fence, rechecked before every dispatched RPC. */
83
+ isPeerActive(peer: DirectRuntimePeer): boolean | Promise<boolean>;
84
+ connectionHub?: DirectRuntimeConnectionHub;
85
+ /** Optional additive V3 pixel/input transport on the same Direct listener. */
86
+ browserSurface?: {
87
+ host: DirectRuntimeBrowserSurfaceHost;
88
+ limits?: Partial<Pick<DirectRuntimeBrowserSurfaceServerLimits, "maxQueuedFrames" | "maxBufferedBytes" | "peerLivenessTimeoutMs">>;
89
+ };
90
+ /** Session-owned Emulator frames on a dedicated authenticated control connection. */
91
+ emulatorSurface?: {
92
+ host: DirectRuntimeEmulatorSurfaceHost;
93
+ };
94
+ limits?: Partial<DirectRuntimeServerLimits>;
95
+ onError?: (error: unknown, context: string) => void;
96
+ }
97
+ export interface DirectRuntimeEmulatorSurfaceAttachment {
98
+ readonly ready: RuntimeEmulatorSurfaceReadyFrame;
99
+ capture(): Promise<Uint8Array>;
100
+ handle(frame: Extract<RuntimeEmulatorSurfaceClientFrame, {
101
+ type: "emulator.surface.touch";
102
+ }>): void | Promise<void>;
103
+ close(): void | Promise<void>;
104
+ }
105
+ export interface DirectRuntimeEmulatorSurfaceHost {
106
+ open(frame: RuntimeEmulatorSurfaceOpenFrame, context: {
107
+ peer: DirectRuntimePeer;
108
+ signal: AbortSignal;
109
+ }): DirectRuntimeEmulatorSurfaceAttachment | Promise<DirectRuntimeEmulatorSurfaceAttachment>;
110
+ }
111
+ export interface DirectRuntimeServer {
112
+ readonly connectionHub: DirectRuntimeConnectionHub;
113
+ readonly listening: boolean;
114
+ address(): AddressInfo | string | null;
115
+ shutdown(): Promise<void>;
116
+ }
117
+ interface HubConnection {
118
+ ws: WebSocket;
119
+ close(code: number, reason: string): void;
120
+ }
121
+ /** Process-live connection index used to fence grants immediately after revocation. */
122
+ export declare class DirectRuntimeConnectionHub {
123
+ private readonly connectionsByGrant;
124
+ private readonly grantByConnection;
125
+ private readonly revokedGrantIds;
126
+ /** @internal Called by the Direct adapter after authentication and before acceptance. */
127
+ register(grantId: string, connection: HubConnection): boolean;
128
+ /** @internal Atomically fence revocation and enforce a per-grant channel bound. */
129
+ registerWithinLimit(grantId: string, connection: HubConnection, maxConnections: number): "registered" | "revoked" | "capacity";
130
+ /** @internal Idempotent adapter cleanup. */
131
+ unregister(connection: HubConnection): void;
132
+ /** Mark a grant revoked and immediately close every matching active channel. */
133
+ revokeGrant(grantId: string, reason?: string): number;
134
+ get activeConnectionCount(): number;
135
+ }
136
+ /** Start a fail-closed HTTP/WebSocket listener containing only the E2EE Direct route. */
137
+ export declare function startDirectRuntimeServer(options: StartDirectRuntimeServerOptions): Promise<DirectRuntimeServer>;