@modelprofile.com/browser-runtime 5.2.1 → 5.4.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.
@@ -1,4 +1,4 @@
1
- export type TBrowserRuntimeErrorCode = 'ABORTED' | 'AUTHORIZATION_DENIED' | 'ATTACHMENT_CONFLICT' | 'BUSY' | 'CAPABILITY_EXPIRED' | 'CAPABILITY_INVALID' | 'CAPABILITY_REVOKED' | 'CONFINEMENT_FAILED' | 'EGRESS_DENIED' | 'FENCED' | 'FRAME_STREAM_FAILED' | 'FRAME_TOO_LARGE' | 'INVALID_INPUT' | 'LOCKED' | 'NOT_RUNNING' | 'PROTOCOL_ERROR' | 'QUOTA_EXCEEDED' | 'RESOURCE_NOT_FOUND' | 'RESOURCE_RETIRED' | 'TIMEOUT';
1
+ export type TBrowserRuntimeErrorCode = 'ABORTED' | 'AUTHORIZATION_DENIED' | 'ATTACHMENT_CONFLICT' | 'BUSY' | 'CAPABILITY_EXPIRED' | 'CAPABILITY_INVALID' | 'CAPABILITY_REVOKED' | 'CONFINEMENT_FAILED' | 'EGRESS_DENIED' | 'FENCED' | 'FRAME_STREAM_FAILED' | 'FRAME_TOO_LARGE' | 'DIALOG_PENDING' | 'STALE_INPUT' | 'INVALID_INPUT' | 'LOCKED' | 'NOT_RUNNING' | 'PROTOCOL_ERROR' | 'QUOTA_EXCEEDED' | 'RESOURCE_NOT_FOUND' | 'RESOURCE_RETIRED' | 'TIMEOUT';
2
2
  export declare class BrowserRuntimeError extends Error {
3
3
  readonly code: TBrowserRuntimeErrorCode;
4
4
  constructor(code: TBrowserRuntimeErrorCode, internalMessage?: string);
package/dist_ts/errors.js CHANGED
@@ -11,6 +11,8 @@ const publicMessages = {
11
11
  FENCED: 'The browser resource is permanently fenced.',
12
12
  FRAME_STREAM_FAILED: 'The browser frame stream failed.',
13
13
  FRAME_TOO_LARGE: 'The browser frame exceeded its limit.',
14
+ DIALOG_PENDING: 'Respond to the website dialog before sending input.',
15
+ STALE_INPUT: 'The input belongs to a previous document or dialog.',
14
16
  INVALID_INPUT: 'The request is invalid.',
15
17
  LOCKED: 'The browser runtime is already locked.',
16
18
  NOT_RUNNING: 'The browser runtime is not running.',
@@ -41,4 +43,4 @@ export const toBrowserRuntimeError = (error) => {
41
43
  }
42
44
  return new BrowserRuntimeError('ABORTED');
43
45
  };
44
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvZXJyb3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXNCQSxNQUFNLGNBQWMsR0FBNkM7SUFDL0QsT0FBTyxFQUFFLDRCQUE0QjtJQUNyQyxvQkFBb0IsRUFBRSxzQ0FBc0M7SUFDNUQsbUJBQW1CLEVBQUUsNkRBQTZEO0lBQ2xGLElBQUksRUFBRSwrQkFBK0I7SUFDckMsa0JBQWtCLEVBQUUsNkJBQTZCO0lBQ2pELGtCQUFrQixFQUFFLDRCQUE0QjtJQUNoRCxrQkFBa0IsRUFBRSxrQ0FBa0M7SUFDdEQsa0JBQWtCLEVBQUUsNkNBQTZDO0lBQ2pFLGFBQWEsRUFBRSwrQkFBK0I7SUFDOUMsTUFBTSxFQUFFLDZDQUE2QztJQUNyRCxtQkFBbUIsRUFBRSxrQ0FBa0M7SUFDdkQsZUFBZSxFQUFFLHVDQUF1QztJQUN4RCxhQUFhLEVBQUUseUJBQXlCO0lBQ3hDLE1BQU0sRUFBRSx3Q0FBd0M7SUFDaEQsV0FBVyxFQUFFLHFDQUFxQztJQUNsRCxjQUFjLEVBQUUseUNBQXlDO0lBQ3pELGNBQWMsRUFBRSx1Q0FBdUM7SUFDdkQsa0JBQWtCLEVBQUUseUNBQXlDO0lBQzdELGdCQUFnQixFQUFFLHdDQUF3QztJQUMxRCxPQUFPLEVBQUUsMEJBQTBCO0NBQ3BDLENBQU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dBQUcsSUFBSSxDQUFDO0lBQ25CLENBQUM7SUFFRCxJQUFXLGFBQWE7UUFDdEIsT0FBTyxjQUFjLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ25DLENBQUM7Q0FDRjtBQUVELE1BQU0sQ0FBQyxNQUFNLHFCQUFxQixHQUFHLENBQUMsS0FBYyxFQUF1QixFQUFFO0lBQzNFLElBQUksS0FBSyxZQUFZLG1CQUFtQixFQUFFLENBQUM7UUFDekMsT0FBTyxLQUFLLENBQUM7SUFDZixDQUFDO0lBQ0QsSUFDRSxLQUFLLFlBQVksS0FBSztXQUNuQixDQUFDLEtBQUssQ0FBQyxJQUFJLEtBQUssWUFBWSxJQUFJLEtBQUssQ0FBQyxJQUFJLEtBQUssY0FBYyxDQUFDLEVBQ2pFLENBQUM7UUFDRCxPQUFPLElBQUksbUJBQW1CLENBQUMsS0FBSyxDQUFDLElBQUksS0FBSyxjQUFjLENBQUMsQ0FBQyxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDeEYsQ0FBQztJQUNELE9BQU8sSUFBSSxtQkFBbUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUM1QyxDQUFDLENBQUMifQ==
@@ -101,7 +101,7 @@ export type TBrowserRuntimeOperationIdentity = TReadonlyBrowserCapabilityAuthori
101
101
  readonly classification: TBrowserRuntimeOperationClassification;
102
102
  readonly startedAt: number;
103
103
  };
104
- export type TBrowserRuntimeOperationClassification = 'raw-input' | 'frame-stream' | 'video-peer' | 'viewport' | 'navigation' | 'tab' | 'agent-action';
104
+ export type TBrowserRuntimeOperationClassification = 'dialog' | 'raw-input' | 'frame-stream' | 'video-peer' | 'devtools' | 'viewport' | 'navigation' | 'tab' | 'agent-action';
105
105
  /** The viewport accepted by the shared resource, which may be smaller than one viewer's request. */
106
106
  export interface IBrowserRuntimeViewportResult {
107
107
  viewport: plugins.smartpuppeteer.ILiveBrowserViewport;
@@ -120,6 +120,8 @@ export type TBrowserRuntimeAuditEvent = TBrowserRuntimeOperationIdentity & {
120
120
  readonly errorCode?: string;
121
121
  };
122
122
  export interface ILiveBrowserSessionLike {
123
+ respondToDialog(input: plugins.smartpuppeteer.ILiveBrowserDialogResponse, options?: plugins.smartpuppeteer.ILiveBrowserOperationOptions): Promise<void>;
124
+ openDevTools?(options: plugins.smartpuppeteer.ILiveBrowserDevToolsOptions, operationOptions?: plugins.smartpuppeteer.ILiveBrowserOperationOptions): Promise<plugins.smartpuppeteer.ILiveBrowserDevToolsConnection>;
123
125
  start(options?: plugins.smartpuppeteer.ILiveBrowserOperationOptions): Promise<void>;
124
126
  stop(): Promise<void>;
125
127
  terminate(options?: plugins.smartpuppeteer.ILiveBrowserTerminationOptions): Promise<plugins.smartpuppeteer.ILiveBrowserTerminationResult>;
@@ -200,10 +202,13 @@ export interface IBrowserRuntimeOptions {
200
202
  screencast?: IBrowserRuntimeScreencastOptions;
201
203
  /** Trusted host configuration; defaults to direct ICE and automatic GPU support. */
202
204
  video?: plugins.smartpuppeteer.ILiveVideoOptions;
205
+ /** Enables selected-tab DevTools for human leases only. Disabled by default. */
206
+ devTools?: boolean;
203
207
  egress?: Omit<IBrowserEgressProxyOptions, 'projectId' | 'browserResourceId'>;
204
208
  artifacts?: Omit<IBrowserArtifactStoreOptions, 'rootDirectory'>;
205
209
  }
206
210
  export interface IBrowserRuntimeTabState {
211
+ dialog?: plugins.smartpuppeteer.ILiveBrowserDialog;
207
212
  id: string;
208
213
  url: string;
209
214
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelprofile.com/browser-runtime",
3
- "version": "5.2.1",
3
+ "version": "5.4.0",
4
4
  "private": false,
5
5
  "description": "Parent-owned, resource-centric Chromium runtime with revisioned attachment fencing, authenticated human and agent control, fail-closed egress, bounded artifacts, and Flex/MCP adapters.",
6
6
  "main": "dist_ts/index.js",
@@ -30,7 +30,7 @@
30
30
  "@push.rocks/smartagent": "^6.0.0",
31
31
  "@push.rocks/smartipc": "^2.6.0",
32
32
  "@push.rocks/smartmcp": "^0.3.0",
33
- "@push.rocks/smartpuppeteer": "^2.8.1",
33
+ "@push.rocks/smartpuppeteer": "^2.11.1",
34
34
  "ipaddr.js": "^2.5.0"
35
35
  },
36
36
  "devDependencies": {
package/readme.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  Parent-owned, resource-centric Chromium runtime with revisioned attachment fencing, authenticated human and agent control, fail-closed egress, bounded artifacts, and Flex/MCP adapters.
4
4
 
5
+ ## Selected-tab DevTools
6
+
7
+ Set the trusted host option `devTools: true` to enable `humanLease.openDevTools({
8
+ tabId, onMessage, onClose }, operationOptions?)`. Agent leases cannot acquire an
9
+ inspector. The returned connection exposes `tabId`, `browserVersion`,
10
+ `send(message)`, and `close()` using SmartPuppeteer's bounded CDP contract.
11
+
12
+ DevTools commands run concurrently on a separate lane, so pausing JavaScript does
13
+ not queue `Debugger.resume` behind a pending evaluation. The lane reserves interrupt
14
+ capacity and applies the normal authorization hook and audit policy to every command;
15
+ audit records contain the method and outcome, never expressions or response bodies.
16
+ Lease, attachment, and browser incarnation authority are rechecked before execution
17
+ and around every delivered event. Revocation closes pending and late-opening
18
+ attachments. Failed cleanup terminates the exact owned browser incarnation.
19
+
20
+ Await each `onMessage` delivery to preserve transport backpressure. Closing an
21
+ inspector does not close the human lease or its video peer. The embedding application
22
+ must close the inspector when changing the inspected tab or replacing its transport.
23
+ No browser debugging port or browser-wide target discovery is exposed. Pair this
24
+ connection with `DevToolsFrontend` from `@push.rocks/smartbrowser/web` for the official
25
+ Chrome DevTools UI.
26
+
27
+ ## Page dialogs
28
+
29
+ `state.tabs[].dialog` exposes the exact pending website dialog. A human lease can call `respondToDialog({ tabId, dialogId, accept, promptText? }, options?)`. This response receives the same authorization, audit, cancellation, and incarnation checks as other operations while bypassing document serialization. Agent leases cannot send this human response. A pending dialog rejects raw input with `DIALOG_PENDING`, preserving held-input tracking until it closes. Before input enters a new document, the runtime releases native keys and buttons retained from the previous document. Obsolete input and dialog identities fail with `STALE_INPUT`; they do not imply a failed browser connection.
30
+
5
31
  ## Native video viewers
6
32
 
7
33
  Human leases expose `openVideoPeer(options?)`, `answerVideoPeer(negotiationId, description, options?)`, `closeVideoPeer(options?)`, and `getVideoStatistics(options?)`. Each operation runs through the resource's bounded, authorized and audited operation queue. Peer IDs are private to the lease; offers expose the negotiation ID and exact tab/generation/viewport source identity. Agent leases cannot open media peers. Releasing or revoking a human lease closes only its peer, preserving other viewers and agent work. Failed peer cleanup remains owned for a subsequent release attempt.
@@ -136,11 +162,11 @@ by `maxCapabilities`. Hosts must stop scheduling renewal when their viewer disco
136
162
 
137
163
  Agent actions are exactly `navigate`, `snapshot`, `screenshot`, `click`, `fill`, and `press`. Agents can read or delete screenshots created by their exact lease using `readArtifact()` and `deleteArtifact()`. Human leases additionally expose tab lifecycle, viewport, raw input, frame subscription/acknowledgement and refresh, and exact-resource artifact reads/deletes. JavaScript evaluation is not public.
138
164
 
139
- All participants enter one strict resource FIFO. `maxQueuedOperationsPerLease` defaults to 128 and accepts 1 through 1,024; each participant has that bound, and the resource queue is bounded by its product with `maxCapabilitiesPerResource`. Overflow fails with `QUOTA_EXCEEDED`. Releasing a participant cancels only its queued and active work. Resource termination and shutdown cancel everyone. Started uncertain work must quiesce or the exact incarnation is terminated before operation settlement.
165
+ All participants share a bounded resource queue. Up to four wheel operations may run concurrently, with authorization and native-send admission kept in order. Other input, viewport, and semantic operations remain barriers behind preceding wheel work. Dialog replies use one interrupt slot so a paused document operation cannot block its own response. `maxQueuedOperationsPerLease` defaults to 128 and accepts 1 through 1,024; each participant has that bound, and the resource queue is bounded by its product with `maxCapabilitiesPerResource`. Overflow fails with `QUOTA_EXCEEDED`. Releasing a participant cancels only its queued and active work. Resource termination and shutdown cancel everyone. Started uncertain work must quiesce or the exact incarnation is terminated before operation settlement.
140
166
 
141
167
  `setViewport()` stores the viewer's preferred width, height and device scale factor and returns `IBrowserRuntimeViewportResult` with the effective `viewport` and `viewportRevision`. The effective values are the componentwise minima across active viewers that have supplied a preference. Unchanged effective sizes do not restart the stream. Removing a viewer recomputes the viewport in the resource FIFO. Held keys and buttons are tracked per participant; leaving releases only inputs that no other participant holds. Viewport and tab/navigation transitions clear held input before changing the target. Resource-owned departure cleanup is bounded and audited as `releaseParticipant`; it does not call the external `beforeOperation` gate after the participant has lost access.
142
168
 
143
- `beforeOperation` is an optional awaited fail-closed gate. It receives the complete immutable authority, operation/capability/lease IDs, action, classification, start time, and an `AbortSignal` after dequeue but before the browser side effect starts. Classifications are `raw-input`, `frame-stream`, `video-peer`, `viewport`, `navigation`, `tab`, and `agent-action`. Hosts that require durable attempt-before-side-effect auditing should persist the attempt there. Rejection denies the operation. The default `beforeOperationTimeoutMs` is 10,000 milliseconds and accepts values from 100 through 120,000; timeout fails with `TIMEOUT`. The terminal `audit` callback remains a best-effort `completed`/`failed` notification correlated by the same operation ID and classification and runs after bounded operation cleanup releases or fences the exact reservation.
169
+ `beforeOperation` is an optional awaited fail-closed gate. It receives the complete immutable authority, operation/capability/lease IDs, action, classification, start time, and an `AbortSignal` after dequeue but before the browser side effect starts. Classifications are `raw-input`, `dialog`, `devtools`, `frame-stream`, `video-peer`, `viewport`, `navigation`, `tab`, and `agent-action`. Hosts that require durable attempt-before-side-effect auditing should persist the attempt there. Rejection denies the operation. The default `beforeOperationTimeoutMs` is 10,000 milliseconds and accepts values from 100 through 120,000; timeout fails with `TIMEOUT`. The terminal `audit` callback remains a best-effort `completed`/`failed` notification correlated by the same operation ID and classification and runs after bounded operation cleanup releases or fences the exact reservation.
144
170
 
145
171
  `lease.getAuthority()` returns an immutable process-local lease authority containing the runtime authority ID, exported `authorityGeneration`, incarnation generation, and complete capability binding. Every snapshot also binds the exact `capabilityId` and `leaseId`. `lease.isAuthorityCurrent(authority)` performs an exact synchronous revalidation suitable for a host-owned virtual stream. These values are not durable Controller state and do not replace attachment checks against the Controller database.
146
172
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@modelprofile.com/browser-runtime',
6
- version: '5.2.1',
6
+ version: '5.4.0',
7
7
  description: 'Parent-owned, resource-centric Chromium runtime with revisioned attachment fencing, authenticated human and agent control, fail-closed egress, bounded artifacts, and Flex/MCP adapters.'
8
8
  }