@revoengine/cli 1.0.38 → 2.0.0
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 +33 -0
- package/README.md +22 -10
- package/dist/src/argument-contract.js +5 -5
- package/dist/src/automation-contract.generated.d.ts +6 -30
- package/dist/src/automation-contract.generated.js +6 -30
- package/dist/src/client.d.ts +2 -2
- package/dist/src/client.js +4 -14
- package/dist/src/commands/component.js +16 -0
- package/dist/src/commands/database-tables.js +1 -1
- package/dist/src/commands/emulate.js +67 -74
- package/dist/src/commands/terminal-browser-human-input.d.ts +28 -0
- package/dist/src/commands/terminal-browser-human-input.js +56 -7
- package/dist/src/commands/terminal-browser-live-protocol.d.ts +13 -1
- package/dist/src/commands/terminal-browser-live-protocol.js +20 -4
- package/dist/src/commands/terminal-browser-live-transport.d.ts +2 -0
- package/dist/src/commands/terminal-browser-live-transport.js +21 -4
- package/dist/src/commands/terminal-browser-live.d.ts +36 -1
- package/dist/src/commands/terminal-browser-live.js +435 -106
- package/dist/src/commands/terminal-browser-observation.d.ts +1 -1
- package/dist/src/commands/terminal-browser-observation.js +10 -1
- package/dist/src/commands/terminal-browser-page-input.d.ts +1 -0
- package/dist/src/commands/terminal-browser-page-input.js +20 -0
- package/dist/src/commands/terminal-browser-profile-sync.d.ts +5 -1
- package/dist/src/commands/terminal-browser-profile-sync.js +13 -2
- package/dist/src/commands/terminal-browser-profile-sync.protocol.d.ts +2 -0
- package/dist/src/commands/terminal-browser-recording.d.ts +6 -3
- package/dist/src/commands/terminal-browser-recording.js +45 -15
- package/dist/src/commands/terminal-browser.d.ts +17 -0
- package/dist/src/commands/terminal-browser.js +318 -111
- package/dist/src/commands/terminal-operational-log.js +2 -1
- package/dist/src/commands/terminal-output-buffer.d.ts +2 -0
- package/dist/src/commands/terminal-output-buffer.js +6 -0
- package/dist/src/commands/terminal-reconnect-grace.d.ts +1 -0
- package/dist/src/commands/terminal-reconnect-grace.js +1 -0
- package/dist/src/commands/terminal-sandbox.js +22 -6
- package/dist/src/commands/terminal.js +136 -40
- package/dist/src/endpoint-emulator.d.ts +16 -13
- package/dist/src/endpoint-emulator.js +26 -35
- package/dist/src/project.js +1 -0
- package/dist/src/request-contract.d.ts +2 -0
- package/dist/src/request-contract.js +11 -1
- package/dist/src/resource-syncs/database-table-sync.d.ts +2 -1
- package/dist/src/resource-syncs/database-table-sync.js +60 -23
- package/dist/src/sync-omit.js +1 -1
- package/dist/src/types.d.ts +0 -3
- package/dist/src/ui.js +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import type { BrowserObservation } from './terminal-browser-interaction.ts';
|
|
|
4
4
|
export declare class BrowserObservations {
|
|
5
5
|
private generation;
|
|
6
6
|
private readonly entries;
|
|
7
|
-
invalidate(): void;
|
|
7
|
+
invalidate(page?: Page): void;
|
|
8
8
|
fresh(page: Page, tabId: string): BrowserObservation;
|
|
9
9
|
require(id: string, page: Page, tabId: string, human?: boolean): BrowserObservation;
|
|
10
10
|
}
|
|
@@ -3,7 +3,16 @@ import { randomUUID } from 'node:crypto';
|
|
|
3
3
|
export class BrowserObservations {
|
|
4
4
|
generation = 0;
|
|
5
5
|
entries = new Map();
|
|
6
|
-
invalidate() {
|
|
6
|
+
invalidate(page) {
|
|
7
|
+
if (page) {
|
|
8
|
+
for (const [id, observed] of this.entries)
|
|
9
|
+
if (observed.page === page)
|
|
10
|
+
this.entries.delete(id);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
this.generation++;
|
|
14
|
+
this.entries.clear();
|
|
15
|
+
}
|
|
7
16
|
fresh(page, tabId) {
|
|
8
17
|
const viewport = page.viewportSize();
|
|
9
18
|
if (!viewport || page.isClosed())
|
|
@@ -4,6 +4,7 @@ export declare function describeFocusedField(page: Page): Promise<string | undef
|
|
|
4
4
|
/** CAPTCHA answers are model-solvable; explicit password/MFA controls remain private. */
|
|
5
5
|
export declare function secretControlAttributes(attributes: Array<string | null>): boolean;
|
|
6
6
|
export declare function pageHasSecretFocus(page: Page): Promise<boolean>;
|
|
7
|
+
export declare function readPageSelection(page: Page): Promise<string | undefined>;
|
|
7
8
|
export declare function clearSecretInputs(page: Page): Promise<void>;
|
|
8
9
|
export declare function releasePageInput(page: Page): Promise<void>;
|
|
9
10
|
export declare function applyPageInteraction(page: Page, interaction: BrowserInteraction & {
|
|
@@ -64,6 +64,26 @@ export async function pageHasSecretFocus(page) {
|
|
|
64
64
|
}
|
|
65
65
|
return false;
|
|
66
66
|
}
|
|
67
|
+
export async function readPageSelection(page) {
|
|
68
|
+
if (await pageHasSecretFocus(page))
|
|
69
|
+
return undefined;
|
|
70
|
+
for (const frame of page.frames()) {
|
|
71
|
+
const selection = await frame.evaluate(() => {
|
|
72
|
+
let active = document.activeElement;
|
|
73
|
+
while (active?.shadowRoot?.activeElement)
|
|
74
|
+
active = active.shadowRoot.activeElement;
|
|
75
|
+
if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) {
|
|
76
|
+
if (active instanceof HTMLInputElement && active.type === 'password')
|
|
77
|
+
return null;
|
|
78
|
+
const attrs = ['type', 'id', 'name', 'autocomplete', 'aria-label', 'placeholder'].map(name => active.getAttribute(name));
|
|
79
|
+
return { attrs, text: active.value.slice(active.selectionStart ?? 0, Math.min(active.selectionEnd ?? 0, (active.selectionStart ?? 0) + 4097)) };
|
|
80
|
+
}
|
|
81
|
+
return { attrs: [], text: document.getSelection()?.toString().slice(0, 4097) ?? '' };
|
|
82
|
+
}).catch(() => null);
|
|
83
|
+
if (selection?.text && !secretControlAttributes(selection.attrs))
|
|
84
|
+
return selection.text;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
67
87
|
export async function clearSecretInputs(page) {
|
|
68
88
|
for (const frame of page.frames())
|
|
69
89
|
await frame.evaluate(() => {
|
|
@@ -9,6 +9,10 @@ export declare class BrowserProfileRunnerRpc {
|
|
|
9
9
|
constructor(connectionId: string, send: (request: BrowserProfileSyncRequest) => void);
|
|
10
10
|
accept(value: unknown): void;
|
|
11
11
|
private request;
|
|
12
|
-
|
|
12
|
+
releaseMember(browserSessionId: string): Promise<void>;
|
|
13
|
+
transport(grant: BrowserProfileRunnerGrant, membership?: {
|
|
14
|
+
current(): string[];
|
|
15
|
+
revoke(ids: string[]): void;
|
|
16
|
+
}): CentralBrowserProfileTransport;
|
|
13
17
|
dispose(): void;
|
|
14
18
|
}
|
|
@@ -54,10 +54,13 @@ export class BrowserProfileRunnerRpc {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
async releaseMember(browserSessionId) {
|
|
58
|
+
await this.request(browserSessionId, 'release');
|
|
59
|
+
}
|
|
60
|
+
transport(grant, membership) {
|
|
58
61
|
if (grant.scope.connectionId !== this.connectionId)
|
|
59
62
|
throw new Error('browser_profile_lease_expired');
|
|
60
|
-
const browserSessionId = grant.scope.browserSessionId;
|
|
63
|
+
const browserSessionId = grant.sharedContextId ?? grant.scope.browserSessionId;
|
|
61
64
|
return {
|
|
62
65
|
read: async () => grant.download ? downloadProfile(grant.download) : null,
|
|
63
66
|
readback: async (expectedRevision) => {
|
|
@@ -80,7 +83,15 @@ export class BrowserProfileRunnerRpc {
|
|
|
80
83
|
return { revision: result.revision };
|
|
81
84
|
},
|
|
82
85
|
renew: async () => {
|
|
86
|
+
const known = membership?.current() || [];
|
|
83
87
|
const result = await this.request(browserSessionId, 'renew');
|
|
88
|
+
if (membership) {
|
|
89
|
+
const active = result.activeMemberIds;
|
|
90
|
+
if (!Array.isArray(active) || !active.length || active.length > 16
|
|
91
|
+
|| active.some(id => typeof id !== 'string' || !/^[a-f0-9]{64}$/u.test(id)))
|
|
92
|
+
throw new Error('browser_profile_sync_invalid');
|
|
93
|
+
membership.revoke(known.filter(id => !active.includes(id)));
|
|
94
|
+
}
|
|
84
95
|
if (!Number.isSafeInteger(result.leaseRemainingMs) || result.leaseRemainingMs < 1 || result.leaseRemainingMs > 45_000)
|
|
85
96
|
throw new Error('browser_profile_sync_invalid');
|
|
86
97
|
return { leaseRemainingMs: result.leaseRemainingMs };
|
|
@@ -9,6 +9,7 @@ export type BrowserProfileRunnerGrant = {
|
|
|
9
9
|
sealedKey: BrowserProfileSealedKey;
|
|
10
10
|
revision: number;
|
|
11
11
|
leaseRemainingMs: number;
|
|
12
|
+
sharedContextId?: string;
|
|
12
13
|
download: {
|
|
13
14
|
url: string;
|
|
14
15
|
size: number;
|
|
@@ -35,6 +36,7 @@ export type BrowserProfileSyncResult = {
|
|
|
35
36
|
leaseRemainingMs?: number;
|
|
36
37
|
revision?: number;
|
|
37
38
|
keyVersion?: string;
|
|
39
|
+
activeMemberIds?: string[];
|
|
38
40
|
download?: {
|
|
39
41
|
url: string;
|
|
40
42
|
size: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BrowserLiveRecording } from './terminal-browser-live.ts';
|
|
1
|
+
import type { BrowserLiveRecording, BrowserRecordingCheckpoint } from './terminal-browser-live.ts';
|
|
2
2
|
import type { BrowserSessionRecordingGrant } from './terminal-browser-recording.protocol.ts';
|
|
3
3
|
import { transferWorkspaceFile } from './terminal-file.ts';
|
|
4
4
|
type Descriptor = {
|
|
@@ -10,6 +10,7 @@ type Descriptor = {
|
|
|
10
10
|
expiresAt?: number;
|
|
11
11
|
storageEntryId?: string;
|
|
12
12
|
};
|
|
13
|
+
type SaveStage = 'authorization' | 'source' | 'provision' | 'descriptor' | 'finalize' | 'cleanup';
|
|
13
14
|
type Options = {
|
|
14
15
|
grant: BrowserSessionRecordingGrant;
|
|
15
16
|
terminalId: string;
|
|
@@ -18,7 +19,7 @@ type Options = {
|
|
|
18
19
|
request: (route: string, token: string, body: {
|
|
19
20
|
size: number;
|
|
20
21
|
}) => Promise<Descriptor>;
|
|
21
|
-
onStatus: (status: 'saved' | 'failed' | 'backpressure', recordingId: string) => void;
|
|
22
|
+
onStatus: (status: 'saved' | 'failed' | 'backpressure', recordingId: string, stage?: SaveStage) => void;
|
|
22
23
|
transfer?: typeof transferWorkspaceFile;
|
|
23
24
|
};
|
|
24
25
|
/** Session-owned single-attempt PUT queue. No viewer/socket, transcript payload, cookies or raw credentials. */
|
|
@@ -27,13 +28,15 @@ export declare class BrowserSessionRecordingSink {
|
|
|
27
28
|
private pending;
|
|
28
29
|
private pendingBytes;
|
|
29
30
|
private failed;
|
|
31
|
+
private readonly attempted;
|
|
32
|
+
private checkpointStatus?;
|
|
30
33
|
private readonly options;
|
|
31
34
|
constructor(options: Options);
|
|
32
35
|
get authorized(): boolean;
|
|
36
|
+
get checkpoint(): BrowserRecordingCheckpoint | undefined;
|
|
33
37
|
refresh(grant: BrowserSessionRecordingGrant, isAuthorized: () => boolean): void;
|
|
34
38
|
accept(recording: BrowserLiveRecording): boolean;
|
|
35
39
|
settled(): Promise<void>;
|
|
36
|
-
private assertAuthorized;
|
|
37
40
|
private save;
|
|
38
41
|
}
|
|
39
42
|
export {};
|
|
@@ -7,49 +7,72 @@ export class BrowserSessionRecordingSink {
|
|
|
7
7
|
pending = 0;
|
|
8
8
|
pendingBytes = 0;
|
|
9
9
|
failed = false;
|
|
10
|
+
attempted = new Set();
|
|
11
|
+
checkpointStatus;
|
|
10
12
|
options;
|
|
11
13
|
constructor(options) { this.options = options; }
|
|
12
14
|
get authorized() { return this.options.isAuthorized() && this.options.grant.expiresAt > Date.now(); }
|
|
15
|
+
get checkpoint() { return this.checkpointStatus; }
|
|
13
16
|
refresh(grant, isAuthorized) {
|
|
14
17
|
if (grant.browserSessionId !== this.options.grant.browserSessionId)
|
|
15
18
|
throw new Error('browser_recording_scope_invalid');
|
|
19
|
+
if (grant.grantId !== this.options.grant.grantId)
|
|
20
|
+
this.failed = false;
|
|
16
21
|
this.options.grant = grant;
|
|
17
22
|
this.options.isAuthorized = isAuthorized;
|
|
18
23
|
}
|
|
19
24
|
accept(recording) {
|
|
20
25
|
if (recording.mode === 'local')
|
|
21
26
|
return true;
|
|
22
|
-
if (this.failed)
|
|
27
|
+
if (this.attempted.has(recording.recordingId) || (this.failed && !recording.checkpoint)
|
|
28
|
+
|| (recording.checkpoint && this.checkpointStatus?.status === 'saving'))
|
|
23
29
|
return false;
|
|
24
|
-
if (this.pending >= 4 || this.pendingBytes + recording.size > 256 * 1024 * 1024) {
|
|
30
|
+
if (this.attempted.size >= 4096 || this.pending >= 4 || this.pendingBytes + recording.size > 256 * 1024 * 1024) {
|
|
25
31
|
this.options.onStatus('backpressure', recording.recordingId);
|
|
26
32
|
return false;
|
|
27
33
|
}
|
|
34
|
+
this.attempted.add(recording.recordingId);
|
|
35
|
+
if (recording.checkpoint)
|
|
36
|
+
this.checkpointStatus = { recordingId: recording.recordingId, status: 'saving' };
|
|
28
37
|
this.pending++;
|
|
29
38
|
this.pendingBytes += recording.size;
|
|
30
|
-
this.chain = this.chain.then(
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
this.chain = this.chain.then(async () => {
|
|
40
|
+
const { grant, isAuthorized } = this.options;
|
|
41
|
+
let stage = 'authorization';
|
|
42
|
+
try {
|
|
43
|
+
await this.save(recording, grant, isAuthorized, current => { stage = current; });
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
if (grant.grantId === this.options.grant.grantId)
|
|
47
|
+
this.failed = true;
|
|
48
|
+
if (recording.checkpoint || this.checkpointStatus?.status !== 'saving')
|
|
49
|
+
this.checkpointStatus = { recordingId: recording.recordingId, status: 'failed' };
|
|
50
|
+
this.options.onStatus('failed', recording.recordingId, stage);
|
|
51
|
+
}
|
|
33
52
|
}).finally(() => { this.pending--; this.pendingBytes -= recording.size; });
|
|
34
53
|
return true;
|
|
35
54
|
}
|
|
36
55
|
async settled() { await this.chain; }
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
async save(recording, grant, isAuthorized, setStage) {
|
|
57
|
+
const assertAuthorized = () => {
|
|
58
|
+
setStage('authorization');
|
|
59
|
+
if (!isAuthorized() || grant.expiresAt <= Date.now())
|
|
60
|
+
throw new Error('browser_recording_scope_expired');
|
|
61
|
+
};
|
|
62
|
+
assertAuthorized();
|
|
63
|
+
setStage('source');
|
|
43
64
|
if (path.dirname(recording.path) !== this.options.directory)
|
|
44
65
|
throw new Error('browser_recording_path_invalid');
|
|
45
66
|
const source = await fs.lstat(recording.path);
|
|
46
67
|
if (!source.isFile() || source.isSymbolicLink() || source.size !== recording.size)
|
|
47
68
|
throw new Error('browser_recording_source_changed');
|
|
48
|
-
const {
|
|
69
|
+
const { terminalId, request } = this.options;
|
|
49
70
|
const route = `/agents/terminals/${terminalId}/browser-recording-runner/${grant.grantId}/${recording.recordingId}`;
|
|
71
|
+
setStage('provision');
|
|
50
72
|
const descriptor = await request(`${route}/provision`, grant.token, { size: recording.size });
|
|
51
|
-
|
|
73
|
+
assertAuthorized();
|
|
52
74
|
if (!descriptor.storageEntryId) {
|
|
75
|
+
setStage('descriptor');
|
|
53
76
|
if (!descriptor.expiresAt || descriptor.expiresAt > grant.expiresAt || descriptor.expiresAt <= Date.now())
|
|
54
77
|
throw new Error('browser_recording_upload_invalid');
|
|
55
78
|
const transfer = { path: recording.path, url: descriptor.uploadUrl, headers: descriptor.headers, overwrite: false, offset: null, length: null };
|
|
@@ -62,13 +85,20 @@ export class BrowserSessionRecordingSink {
|
|
|
62
85
|
throw new Error('browser_recording_upload_unconfirmed');
|
|
63
86
|
}
|
|
64
87
|
catch { /* Exact-size provider verification below resolves an uncertain PUT without replay. */ }
|
|
65
|
-
|
|
88
|
+
assertAuthorized();
|
|
89
|
+
setStage('finalize');
|
|
66
90
|
const finalized = await request(`${route}/finalize`, grant.token, { size: recording.size });
|
|
67
91
|
if (!finalized.storageEntryId)
|
|
68
92
|
throw new Error('browser_recording_upload_unconfirmed');
|
|
69
93
|
}
|
|
94
|
+
if (grant.grantId === this.options.grant.grantId)
|
|
95
|
+
this.failed = false;
|
|
96
|
+
if (recording.checkpoint || this.checkpointStatus?.status === 'failed')
|
|
97
|
+
this.checkpointStatus = { recordingId: recording.recordingId, status: 'saved' };
|
|
70
98
|
this.options.onStatus('saved', recording.recordingId);
|
|
71
99
|
if (recording.mode === 'storage')
|
|
72
|
-
await fs.unlink(recording.path)
|
|
100
|
+
await fs.unlink(recording.path).catch(() => {
|
|
101
|
+
this.options.onStatus('failed', recording.recordingId, 'cleanup');
|
|
102
|
+
});
|
|
73
103
|
}
|
|
74
104
|
}
|
|
@@ -46,6 +46,11 @@ export type BrowserActionInput = {
|
|
|
46
46
|
id: string;
|
|
47
47
|
name: string;
|
|
48
48
|
lease: BrowserProfilePersistenceLease;
|
|
49
|
+
shared?: {
|
|
50
|
+
contextId: string;
|
|
51
|
+
authorized: () => boolean;
|
|
52
|
+
releaseMember: () => Promise<void>;
|
|
53
|
+
};
|
|
49
54
|
};
|
|
50
55
|
recording?: {
|
|
51
56
|
options: BrowserLiveOptions;
|
|
@@ -100,6 +105,18 @@ export declare function threadBrowserScopes(): Array<{
|
|
|
100
105
|
}>;
|
|
101
106
|
export declare function closeThreadBrowserSession(browserSessionId: string): Promise<void>;
|
|
102
107
|
export declare function browserSessionIds(): string[];
|
|
108
|
+
/** Local runner display. Authentication itself is known only to the website. */
|
|
109
|
+
export declare function browserRuntimeInventory(): {
|
|
110
|
+
browsers: number;
|
|
111
|
+
tabs: number;
|
|
112
|
+
sessions: {
|
|
113
|
+
id: string;
|
|
114
|
+
tabs: number;
|
|
115
|
+
mode: "blocked" | "observe" | "human";
|
|
116
|
+
profile: string | null;
|
|
117
|
+
restored: boolean;
|
|
118
|
+
}[];
|
|
119
|
+
};
|
|
103
120
|
export declare function hasBrowserSessions(): boolean;
|
|
104
121
|
/** Revocation closes only this central context and never checkpoints its authentication. */
|
|
105
122
|
export declare function revokeBrowserProfileSession(browserSessionId: string, profileId: string): Promise<void>;
|