@ricsam/r5d-browser 0.0.136 → 0.0.138

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 (49) hide show
  1. package/README.md +7 -33
  2. package/dist/cjs/package.json +1 -1
  3. package/dist/mjs/browser-input.mjs +56 -1
  4. package/dist/mjs/cli-options.mjs +1 -0
  5. package/dist/mjs/main.mjs +25 -396
  6. package/dist/mjs/package.json +1 -1
  7. package/dist/mjs/personal-diagnostics.mjs +24 -0
  8. package/dist/mjs/personal-main.mjs +159 -0
  9. package/dist/mjs/personal-port-forward.mjs +183 -0
  10. package/dist/mjs/personal-relay-client.mjs +33 -0
  11. package/dist/mjs/personal-relay-shutdown.mjs +46 -0
  12. package/dist/mjs/runtime/browser-executor.mjs +11 -0
  13. package/dist/mjs/runtime/chromium-factory.mjs +101 -0
  14. package/dist/mjs/runtime/ipc.mjs +128 -0
  15. package/dist/mjs/runtime/isolated-root.mjs +53 -0
  16. package/dist/mjs/runtime/keeper.mjs +169 -0
  17. package/dist/mjs/runtime/ledger.mjs +193 -0
  18. package/dist/mjs/runtime/main.mjs +105 -0
  19. package/dist/mjs/runtime/private-paths.mjs +48 -0
  20. package/dist/mjs/runtime/protocol.mjs +72 -0
  21. package/dist/types/browser-input.d.ts +4 -0
  22. package/dist/types/cli-options.d.ts +1 -0
  23. package/dist/types/personal-diagnostics.d.ts +13 -0
  24. package/dist/types/personal-main.d.ts +9 -0
  25. package/dist/types/personal-port-forward.d.ts +45 -0
  26. package/dist/types/personal-relay-client.d.ts +51 -0
  27. package/dist/types/personal-relay-shutdown.d.ts +19 -0
  28. package/dist/types/runtime/browser-executor.d.ts +8 -0
  29. package/dist/types/runtime/chromium-factory.d.ts +25 -0
  30. package/dist/types/runtime/fixtures/counter-main.d.ts +1 -0
  31. package/dist/types/runtime/fixtures/counter-runtime.d.ts +7 -0
  32. package/dist/types/runtime/ipc.d.ts +23 -0
  33. package/dist/types/runtime/isolated-root.d.ts +12 -0
  34. package/dist/types/runtime/keeper.d.ts +44 -0
  35. package/dist/types/runtime/ledger.d.ts +41 -0
  36. package/dist/types/runtime/main.d.ts +23 -0
  37. package/dist/types/runtime/private-paths.d.ts +4 -0
  38. package/dist/types/runtime/protocol.d.ts +228 -0
  39. package/package.json +6 -5
  40. package/dist/cjs/browser-input.cjs +0 -87
  41. package/dist/cjs/browser-runtime.cjs +0 -708
  42. package/dist/cjs/chrome-launcher.cjs +0 -701
  43. package/dist/cjs/cli-options.cjs +0 -95
  44. package/dist/cjs/main.cjs +0 -427
  45. package/dist/cjs/password-safe-snapshot.cjs +0 -150
  46. package/dist/cjs/port-forward-manager.cjs +0 -233
  47. package/dist/cjs/upload-store.cjs +0 -136
  48. package/dist/mjs/port-forward-manager.mjs +0 -199
  49. package/dist/types/port-forward-manager.d.ts +0 -23
@@ -0,0 +1,9 @@
1
+ import type { BrowserCliOptions } from "./cli-options";
2
+ export declare function personalBrowserConnection(options: BrowserCliOptions): {
3
+ origin: string;
4
+ token: string;
5
+ };
6
+ /** Keep Chrome's OS environment intact while isolating r5d state per origin. */
7
+ export declare function personalBrowserStateDirectory(origin: string, rootPath?: string): string;
8
+ /** The locally retained keeper, profile and ledger outlive every web reconnect. */
9
+ export declare function startPersonalBrowser(options: BrowserCliOptions, version: string): Promise<void>;
@@ -0,0 +1,45 @@
1
+ import type { PersonalBrowserObserver } from "./personal-diagnostics";
2
+ export type ForwardRequest = {
3
+ forwardId: string;
4
+ streamId: string;
5
+ requestId: string;
6
+ command: {
7
+ method: "connect" | "write" | "read" | "close";
8
+ offset?: number;
9
+ after?: number;
10
+ base64?: string;
11
+ end?: boolean;
12
+ };
13
+ };
14
+ export type ForwardCall = (request: ForwardRequest) => Promise<any>;
15
+ export declare class PersonalForwardResponseError extends Error {
16
+ readonly status: number;
17
+ readonly code?: string | undefined;
18
+ constructor(status: number, message: string, code?: string | undefined);
19
+ }
20
+ /** Local loopback sockets outlive every HTTP relay/web connection. Each byte
21
+ * operation waits for its immutable acknowledgement before advancing offsets. */
22
+ export declare class PersonalPortForwardManager {
23
+ private readonly call;
24
+ private readonly observer?;
25
+ private active;
26
+ private failures;
27
+ private queue;
28
+ private stopping;
29
+ constructor(call: ForwardCall, observer?: PersonalBrowserObserver | undefined);
30
+ private observe;
31
+ list(): {
32
+ forwardId: string;
33
+ ready: boolean;
34
+ activeConnections: number;
35
+ lastError: {
36
+ error: string;
37
+ at: string;
38
+ } | null;
39
+ }[];
40
+ reconcile(raw: unknown): Promise<void>;
41
+ private start;
42
+ private stop;
43
+ private accept;
44
+ close(): Promise<void>;
45
+ }
@@ -0,0 +1,51 @@
1
+ import { BrowserKeeper } from "./runtime/keeper";
2
+ import { type BrowserReceipt } from "./runtime/protocol";
3
+ import { z } from "zod";
4
+ export declare const PersonalBrowserAction: z.ZodObject<{
5
+ id: z.ZodString;
6
+ requestHash: z.ZodString;
7
+ request: z.ZodObject<{
8
+ action: z.ZodEnum<{
9
+ list_tabs: "list_tabs";
10
+ list_downloads: "list_downloads";
11
+ get_download: "get_download";
12
+ open_tab: "open_tab";
13
+ close_tab: "close_tab";
14
+ navigate: "navigate";
15
+ set_viewport: "set_viewport";
16
+ read_page: "read_page";
17
+ screenshot: "screenshot";
18
+ move_mouse: "move_mouse";
19
+ mouse_click: "mouse_click";
20
+ scroll: "scroll";
21
+ wait_for: "wait_for";
22
+ form_input: "form_input";
23
+ keyboard: "keyboard";
24
+ keyboard_type: "keyboard_type";
25
+ run_js: "run_js";
26
+ upload_begin: "upload_begin";
27
+ upload_chunk: "upload_chunk";
28
+ upload_attach: "upload_attach";
29
+ upload_abort: "upload_abort";
30
+ }>;
31
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
32
+ }, z.core.$strict>;
33
+ }, z.core.$strict>;
34
+ /** Network replacement never disposes this keeper. Its ledger decides whether an
35
+ * action ran; polling the same server queue item cannot replay a browser effect. */
36
+ export declare class PersonalBrowserProcessor {
37
+ private readonly keeper;
38
+ readonly identity: {
39
+ installationId: string;
40
+ userId: string;
41
+ instanceId: string;
42
+ };
43
+ private readonly nextEpoch?;
44
+ private epoch;
45
+ constructor(keeper: BrowserKeeper, identity: {
46
+ installationId: string;
47
+ userId: string;
48
+ instanceId: string;
49
+ }, nextEpoch?: (() => number) | undefined);
50
+ execute(raw: unknown): Promise<BrowserReceipt>;
51
+ }
@@ -0,0 +1,19 @@
1
+ type RelayAction = {
2
+ id: string;
3
+ requestHash: string;
4
+ };
5
+ export type PersonalBrowserAcknowledgement = {
6
+ id: string;
7
+ requestHash: string;
8
+ state: "completed" | "unknown";
9
+ result: unknown;
10
+ };
11
+ /** Shutdown cancels queue observation, never an admitted browser effect or its receipt. */
12
+ export declare class PersonalBrowserRelayShutdown {
13
+ private readonly polls;
14
+ get stopping(): boolean;
15
+ get pollSignal(): AbortSignal;
16
+ stop(): void;
17
+ dispatch<T extends RelayAction>(actions: readonly T[], execute: (action: T) => Promise<unknown>, acknowledge: (receipt: PersonalBrowserAcknowledgement) => Promise<unknown>): Promise<void>;
18
+ }
19
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { BrowserRuntime } from "../browser-runtime";
2
+ import type { BrowserExecutor } from "./keeper";
3
+ /**
4
+ * The supplied runtime must be constructed/retained by the independently supervised keeper.
5
+ * It is not recreated on adapter replacement. This uses the existing action implementation,
6
+ * including its retained tab IDs, cursor, CDP sessions and upload store, without profile copies.
7
+ */
8
+ export declare function browserRuntimeExecutor(runtime: Pick<BrowserRuntime, "execute">): BrowserExecutor;
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ import type { BrowserExecutor } from "./keeper";
3
+ /** Declarative built-in factory approval, NOT an arbitrary JS module or Chromium argument escape hatch. */
4
+ export declare const ChromiumFactoryApproval: z.ZodObject<{
5
+ kind: z.ZodLiteral<"isolated-chromium-v1">;
6
+ executablePath: z.ZodString;
7
+ allowedOrigins: z.ZodArray<z.ZodString>;
8
+ }, z.core.$strict>;
9
+ export type ChromiumFactoryApproval = z.infer<typeof ChromiumFactoryApproval>;
10
+ export declare function loadApprovedChromiumFactory(filename: string, sha256: string): ChromiumFactoryApproval;
11
+ export type ChromiumKeeperIdentity = {
12
+ runId: string;
13
+ browserPid: number;
14
+ keeperPid: number;
15
+ profile: string;
16
+ downloads: string;
17
+ uploads: string;
18
+ };
19
+ export declare function createIsolatedChromiumRuntime(input: {
20
+ runs: string;
21
+ approval: ChromiumFactoryApproval;
22
+ }): Promise<{
23
+ executor: BrowserExecutor;
24
+ identity: ChromiumKeeperIdentity;
25
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { BrowserExecutor } from "../keeper";
2
+ /** Offline subprocess proof. No Chrome, network, profiles or user resources. */
3
+ export declare const createBrowserKeeperRuntime: ({ directory }: {
4
+ directory: string;
5
+ }) => Promise<{
6
+ executor: BrowserExecutor;
7
+ }>;
@@ -0,0 +1,23 @@
1
+ import { BrowserKeeper, type BrowserAdapterPrincipal } from "./keeper";
2
+ import { type BrowserKeeperMessage } from "./protocol";
3
+ export type BrowserKeeperIpcOptions = {
4
+ keeper: BrowserKeeper;
5
+ socketPath: string;
6
+ /** Authentication must bind installation + user + owner; an unverified hello is NOT authority. */
7
+ authenticate: (token: string) => BrowserAdapterPrincipal | null;
8
+ maxFrameBytes?: number;
9
+ maxConnections?: number;
10
+ };
11
+ export type BrowserKeeperIpc = {
12
+ close(): Promise<void>;
13
+ };
14
+ /** One bounded JSON request/reply per private Unix connection. No raw requests/errors are logged. */
15
+ export declare function serveBrowserKeeper(options: BrowserKeeperIpcOptions): Promise<BrowserKeeperIpc>;
16
+ /** No automatic retries: caller resubmits the SAME operation ID to reconcile a lost response. */
17
+ export declare function callBrowserKeeper(options: {
18
+ socketPath: string;
19
+ token: string;
20
+ message: BrowserKeeperMessage;
21
+ timeoutMs?: number;
22
+ maxReplyBytes?: number;
23
+ }): Promise<unknown>;
@@ -0,0 +1,12 @@
1
+ export declare function isolatedBrowserRoot(root: string, installationId: string, userId: string): {
2
+ ledger: string;
3
+ runs: string;
4
+ };
5
+ export declare function freshBrowserRun(runs: string): {
6
+ id: string;
7
+ directory: string;
8
+ profile: string;
9
+ downloads: string;
10
+ uploads: string;
11
+ home: string;
12
+ };
@@ -0,0 +1,44 @@
1
+ import { RuntimeHello } from "@ricsam/r5d-api/runtime-protocol";
2
+ import { type LedgerOptions } from "./ledger";
3
+ import { BrowserOperation, type BrowserReceipt } from "./protocol";
4
+ /** Granted by the authenticated transport, NEVER inferred from hello or request fields. */
5
+ export type BrowserAdapterPrincipal = {
6
+ installationId: string;
7
+ userId: string;
8
+ ownerId: string;
9
+ };
10
+ /** This object and its browser handles live in the keeper, not in a replaceable socket adapter. */
11
+ export interface BrowserExecutor {
12
+ execute(operation: BrowserOperation): Promise<unknown>;
13
+ /** Keeper maintenance only; called after drain while still holding the exclusive ledger lock. */
14
+ dispose?(): Promise<void>;
15
+ }
16
+ export type BrowserKeeperOptions = LedgerOptions & {
17
+ executor: BrowserExecutor;
18
+ instanceId: string;
19
+ releaseId: string;
20
+ maxInFlight?: number;
21
+ maxPayloadBytes?: number;
22
+ };
23
+ export declare class BrowserKeeper {
24
+ readonly hello: RuntimeHello;
25
+ private readonly ledger;
26
+ private readonly executor;
27
+ private readonly inFlight;
28
+ private readonly queues;
29
+ private readonly maxInFlight;
30
+ private readonly maxPayloadBytes;
31
+ private readonly pruneTimer;
32
+ private closing;
33
+ private closePromise;
34
+ private storageFailed;
35
+ constructor(options: BrowserKeeperOptions);
36
+ /** Callable versioned boundary. Transport disconnect is deliberately not an AbortSignal. */
37
+ handle(input: unknown, principal: BrowserAdapterPrincipal): Promise<BrowserReceipt | {
38
+ ok: true;
39
+ } | null>;
40
+ private handleRequest;
41
+ private perform;
42
+ /** Maintenance only: adapter disconnection must NOT invoke close or executor disposal. */
43
+ close(): Promise<void>;
44
+ }
@@ -0,0 +1,41 @@
1
+ import { type OwnershipFence } from "@ricsam/r5d-api/runtime-protocol";
2
+ import { type BrowserOperation, type BrowserReceipt } from "./protocol";
3
+ export type LedgerOptions = {
4
+ directory: string;
5
+ installationId: string;
6
+ userId: string;
7
+ now?: () => number;
8
+ retentionMs?: number;
9
+ maxReceiptBytes?: number;
10
+ maxTotalReceiptBytes?: number;
11
+ maxOperations?: number;
12
+ maxClaims?: number;
13
+ maxLeaseMs?: number;
14
+ };
15
+ /** Local single-process authority. The exclusive SQLite lock is retained until close/crash. */
16
+ export declare class BrowserLedger {
17
+ private readonly db;
18
+ private readonly now;
19
+ readonly installationId: string;
20
+ readonly userId: string;
21
+ private readonly retentionMs;
22
+ private readonly maxReceiptBytes;
23
+ private readonly maxTotalReceiptBytes;
24
+ private readonly maxOperations;
25
+ private readonly maxClaims;
26
+ private readonly maxLeaseMs;
27
+ constructor(options: LedgerOptions);
28
+ assertIdentity(installationId: string, userId: string): void;
29
+ private claimRow;
30
+ assertFence(fence: OwnershipFence): void;
31
+ claim(fence: OwnershipFence, expiresAt: number, renew?: boolean): void;
32
+ release(fence: OwnershipFence): void;
33
+ private count;
34
+ find(operation: BrowserOperation, hash: string): BrowserReceipt | null;
35
+ admit(operation: BrowserOperation, hash: string): void;
36
+ running(operationId: string): void;
37
+ finish(operationId: string, state: "completed" | "cancelled" | "unknown", resultJson: string | null, reason?: BrowserReceipt["reason"]): void;
38
+ prune(): void;
39
+ private receipt;
40
+ close(): void;
41
+ }
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import { type ChromiumKeeperIdentity } from "./chromium-factory";
3
+ export declare const BrowserKeeperConfig: z.ZodObject<{
4
+ installationId: z.ZodString;
5
+ userId: z.ZodString;
6
+ instanceId: z.ZodString;
7
+ releaseId: z.ZodString;
8
+ root: z.ZodString;
9
+ factory: z.ZodObject<{
10
+ approvalPath: z.ZodString;
11
+ sha256: z.ZodString;
12
+ }, z.core.$strict>;
13
+ adapters: z.ZodArray<z.ZodObject<{
14
+ ownerId: z.ZodString;
15
+ token: z.ZodString;
16
+ }, z.core.$strict>>;
17
+ }, z.core.$strict>;
18
+ /** Only the built-in isolated REAL Chromium factory is reachable from this startup boundary. */
19
+ export declare function startConfiguredBrowserKeeper(configPath: string): Promise<{
20
+ socketPath: string;
21
+ identity: ChromiumKeeperIdentity;
22
+ close(): Promise<void>;
23
+ }>;
@@ -0,0 +1,4 @@
1
+ /** Reject symlink ancestors, non-canonical paths and writable-by-other-user ancestors. */
2
+ export declare function assertPrivatePath(filename: string, kind: "directory" | "file", immutable?: boolean): void;
3
+ export declare function readPrivateFile(filename: string, maximumBytes: number, immutable?: boolean): Buffer;
4
+ export declare function makePrivateDirectory(directory: string): void;
@@ -0,0 +1,228 @@
1
+ import { z } from "zod";
2
+ import { RUNTIME_PROTOCOL } from "@ricsam/r5d-api/runtime-protocol";
3
+ export declare const BROWSER_KEEPER_CAPABILITY = "browser-operations.v1";
4
+ export declare const BrowserAction: z.ZodEnum<{
5
+ list_tabs: "list_tabs";
6
+ list_downloads: "list_downloads";
7
+ get_download: "get_download";
8
+ open_tab: "open_tab";
9
+ close_tab: "close_tab";
10
+ navigate: "navigate";
11
+ set_viewport: "set_viewport";
12
+ read_page: "read_page";
13
+ screenshot: "screenshot";
14
+ move_mouse: "move_mouse";
15
+ mouse_click: "mouse_click";
16
+ scroll: "scroll";
17
+ wait_for: "wait_for";
18
+ form_input: "form_input";
19
+ keyboard: "keyboard";
20
+ keyboard_type: "keyboard_type";
21
+ run_js: "run_js";
22
+ upload_begin: "upload_begin";
23
+ upload_chunk: "upload_chunk";
24
+ upload_attach: "upload_attach";
25
+ upload_abort: "upload_abort";
26
+ }>;
27
+ export declare const BrowserFence: z.ZodObject<{
28
+ installationId: z.ZodString;
29
+ resourceType: z.ZodString;
30
+ resourceId: z.ZodString;
31
+ ownerId: z.ZodString;
32
+ epoch: z.ZodNumber;
33
+ }, z.core.$strict>;
34
+ export declare const BrowserOperation: z.ZodObject<{
35
+ protocol: z.ZodLiteral<1>;
36
+ installationId: z.ZodString;
37
+ operationId: z.ZodString;
38
+ userId: z.ZodString;
39
+ sessionId: z.ZodOptional<z.ZodString>;
40
+ kind: z.ZodString;
41
+ fence: z.ZodObject<{
42
+ installationId: z.ZodString;
43
+ resourceType: z.ZodString;
44
+ resourceId: z.ZodString;
45
+ ownerId: z.ZodString;
46
+ epoch: z.ZodNumber;
47
+ }, z.core.$strict>;
48
+ payload: z.ZodUnknown;
49
+ }, z.core.$strict>;
50
+ export type BrowserOperation = z.infer<typeof BrowserOperation>;
51
+ export declare const BrowserKeeperRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
52
+ method: z.ZodLiteral<"claim">;
53
+ userId: z.ZodString;
54
+ fence: z.ZodObject<{
55
+ installationId: z.ZodString;
56
+ resourceType: z.ZodString;
57
+ resourceId: z.ZodString;
58
+ ownerId: z.ZodString;
59
+ epoch: z.ZodNumber;
60
+ }, z.core.$strict>;
61
+ expiresAt: z.ZodNumber;
62
+ }, z.core.$strict>, z.ZodObject<{
63
+ method: z.ZodLiteral<"renew">;
64
+ userId: z.ZodString;
65
+ fence: z.ZodObject<{
66
+ installationId: z.ZodString;
67
+ resourceType: z.ZodString;
68
+ resourceId: z.ZodString;
69
+ ownerId: z.ZodString;
70
+ epoch: z.ZodNumber;
71
+ }, z.core.$strict>;
72
+ expiresAt: z.ZodNumber;
73
+ }, z.core.$strict>, z.ZodObject<{
74
+ method: z.ZodLiteral<"release">;
75
+ userId: z.ZodString;
76
+ fence: z.ZodObject<{
77
+ installationId: z.ZodString;
78
+ resourceType: z.ZodString;
79
+ resourceId: z.ZodString;
80
+ ownerId: z.ZodString;
81
+ epoch: z.ZodNumber;
82
+ }, z.core.$strict>;
83
+ }, z.core.$strict>, z.ZodObject<{
84
+ method: z.ZodLiteral<"execute">;
85
+ operation: z.ZodObject<{
86
+ protocol: z.ZodLiteral<1>;
87
+ installationId: z.ZodString;
88
+ operationId: z.ZodString;
89
+ userId: z.ZodString;
90
+ sessionId: z.ZodOptional<z.ZodString>;
91
+ kind: z.ZodString;
92
+ fence: z.ZodObject<{
93
+ installationId: z.ZodString;
94
+ resourceType: z.ZodString;
95
+ resourceId: z.ZodString;
96
+ ownerId: z.ZodString;
97
+ epoch: z.ZodNumber;
98
+ }, z.core.$strict>;
99
+ payload: z.ZodUnknown;
100
+ }, z.core.$strict>;
101
+ }, z.core.$strict>, z.ZodObject<{
102
+ method: z.ZodLiteral<"inspect">;
103
+ operation: z.ZodObject<{
104
+ protocol: z.ZodLiteral<1>;
105
+ installationId: z.ZodString;
106
+ operationId: z.ZodString;
107
+ userId: z.ZodString;
108
+ sessionId: z.ZodOptional<z.ZodString>;
109
+ kind: z.ZodString;
110
+ fence: z.ZodObject<{
111
+ installationId: z.ZodString;
112
+ resourceType: z.ZodString;
113
+ resourceId: z.ZodString;
114
+ ownerId: z.ZodString;
115
+ epoch: z.ZodNumber;
116
+ }, z.core.$strict>;
117
+ payload: z.ZodUnknown;
118
+ }, z.core.$strict>;
119
+ }, z.core.$strict>], "method">;
120
+ export type BrowserKeeperRequest = z.infer<typeof BrowserKeeperRequest>;
121
+ export declare const BrowserKeeperMessage: z.ZodObject<{
122
+ hello: z.ZodObject<{
123
+ installationId: z.ZodString;
124
+ instanceId: z.ZodString;
125
+ releaseId: z.ZodString;
126
+ role: z.ZodEnum<{
127
+ web: "web";
128
+ scheduler: "scheduler";
129
+ runner: "runner";
130
+ gateway: "gateway";
131
+ "worker-adapter": "worker-adapter";
132
+ "browser-adapter": "browser-adapter";
133
+ executor: "executor";
134
+ keeper: "keeper";
135
+ storage: "storage";
136
+ }>;
137
+ protocol: z.ZodObject<{
138
+ min: z.ZodNumber;
139
+ max: z.ZodNumber;
140
+ }, z.core.$strict>;
141
+ capabilities: z.ZodArray<z.ZodString>;
142
+ }, z.core.$strict>;
143
+ request: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
+ method: z.ZodLiteral<"claim">;
145
+ userId: z.ZodString;
146
+ fence: z.ZodObject<{
147
+ installationId: z.ZodString;
148
+ resourceType: z.ZodString;
149
+ resourceId: z.ZodString;
150
+ ownerId: z.ZodString;
151
+ epoch: z.ZodNumber;
152
+ }, z.core.$strict>;
153
+ expiresAt: z.ZodNumber;
154
+ }, z.core.$strict>, z.ZodObject<{
155
+ method: z.ZodLiteral<"renew">;
156
+ userId: z.ZodString;
157
+ fence: z.ZodObject<{
158
+ installationId: z.ZodString;
159
+ resourceType: z.ZodString;
160
+ resourceId: z.ZodString;
161
+ ownerId: z.ZodString;
162
+ epoch: z.ZodNumber;
163
+ }, z.core.$strict>;
164
+ expiresAt: z.ZodNumber;
165
+ }, z.core.$strict>, z.ZodObject<{
166
+ method: z.ZodLiteral<"release">;
167
+ userId: z.ZodString;
168
+ fence: z.ZodObject<{
169
+ installationId: z.ZodString;
170
+ resourceType: z.ZodString;
171
+ resourceId: z.ZodString;
172
+ ownerId: z.ZodString;
173
+ epoch: z.ZodNumber;
174
+ }, z.core.$strict>;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ method: z.ZodLiteral<"execute">;
177
+ operation: z.ZodObject<{
178
+ protocol: z.ZodLiteral<1>;
179
+ installationId: z.ZodString;
180
+ operationId: z.ZodString;
181
+ userId: z.ZodString;
182
+ sessionId: z.ZodOptional<z.ZodString>;
183
+ kind: z.ZodString;
184
+ fence: z.ZodObject<{
185
+ installationId: z.ZodString;
186
+ resourceType: z.ZodString;
187
+ resourceId: z.ZodString;
188
+ ownerId: z.ZodString;
189
+ epoch: z.ZodNumber;
190
+ }, z.core.$strict>;
191
+ payload: z.ZodUnknown;
192
+ }, z.core.$strict>;
193
+ }, z.core.$strict>, z.ZodObject<{
194
+ method: z.ZodLiteral<"inspect">;
195
+ operation: z.ZodObject<{
196
+ protocol: z.ZodLiteral<1>;
197
+ installationId: z.ZodString;
198
+ operationId: z.ZodString;
199
+ userId: z.ZodString;
200
+ sessionId: z.ZodOptional<z.ZodString>;
201
+ kind: z.ZodString;
202
+ fence: z.ZodObject<{
203
+ installationId: z.ZodString;
204
+ resourceType: z.ZodString;
205
+ resourceId: z.ZodString;
206
+ ownerId: z.ZodString;
207
+ epoch: z.ZodNumber;
208
+ }, z.core.$strict>;
209
+ payload: z.ZodUnknown;
210
+ }, z.core.$strict>;
211
+ }, z.core.$strict>], "method">;
212
+ }, z.core.$strict>;
213
+ export type BrowserKeeperMessage = z.infer<typeof BrowserKeeperMessage>;
214
+ export type BrowserReceipt = {
215
+ protocol: typeof RUNTIME_PROTOCOL;
216
+ installationId: string;
217
+ userId: string;
218
+ operationId: string;
219
+ payloadHash: string;
220
+ state: "accepted" | "running" | "completed" | "cancelled" | "unknown";
221
+ resultAvailable: boolean;
222
+ result?: unknown;
223
+ reason?: "keeper_restarted" | "executor_uncertain" | "stale_before_start" | "receipt_too_large";
224
+ };
225
+ export declare class BrowserKeeperError extends Error {
226
+ readonly code: string;
227
+ constructor(code: string);
228
+ }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-browser",
3
- "version": "0.0.136",
3
+ "version": "0.0.138",
4
4
  "type": "module",
5
- "main": "./dist/cjs/main.cjs",
5
+ "main": "./dist/mjs/main.mjs",
6
6
  "module": "./dist/mjs/main.mjs",
7
7
  "types": "./dist/types/main.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/types/main.d.ts",
11
11
  "import": "./dist/mjs/main.mjs",
12
- "require": "./dist/cjs/main.cjs"
12
+ "default": "./dist/mjs/main.mjs"
13
13
  }
14
14
  },
15
15
  "repository": {
@@ -18,11 +18,12 @@
18
18
  "directory": "packages/r5d-browser"
19
19
  },
20
20
  "bin": {
21
- "r5d-browser": "dist/cjs/main.cjs"
21
+ "r5d-browser": "dist/mjs/main.mjs"
22
22
  },
23
23
  "dependencies": {
24
- "@ricsam/r5d-api": "^0.0.136",
24
+ "@ricsam/r5d-api": "^0.0.138",
25
25
  "playwright-core": "1.62.1",
26
+ "zod": "^4.1.13",
26
27
  "ws": "^8.18.3"
27
28
  },
28
29
  "files": [