@intentic/sandbox-contract 1.425.0 → 1.426.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,15 +1,49 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
2
 
3
+ /**
4
+ * What the editor sends on a browser view socket, each a JSON text message. Nothing that drives the page is sent
5
+ * until the person takes control; watching sends only the view's own housekeeping (`resize`, `pause`, `ping`, …).
6
+ */
7
+ export type BrowserViewClientMessage = { "type": "mouse", action: PointerAction, x: number, y: number,
8
+ /**
9
+ * Which button changed, in DOM numbering (0 left, 1 middle, 2 right, 3 back, 4 forward).
10
+ */
11
+ button?: number, buttons?: number, clickCount?: number, ctrl?: boolean, shift?: boolean, alt?: boolean, deltaX?: number, deltaY?: number, } | { "type": "text", text: string, raw?: boolean, } | { "type": "key", key: string, ctrl?: boolean, shift?: boolean, alt?: boolean, raw?: boolean, } | { "type": "selection" } | { "type": "selectOption", index: number, } | { "type": "bind", pageId: string, } | { "type": "navigate", url: string, pageId?: string, } | { "type": "back" } | { "type": "forward" } | { "type": "reload" } | { "type": "stop" } | { "type": "newTab", url?: string, } | { "type": "closeTab", pageId: string, } | { "type": "resize", width: number, height: number, } | { "type": "keyframe" } | { "type": "emulate", device?: EmulatedDevice, } | { "type": "dialog", accept: boolean, text?: string, } | { "type": "pause" } | { "type": "resume" } | { "type": "done" } | { "type": "ping" };
12
+
13
+ /**
14
+ * What a browser view socket sends as JSON text; the pictures travel as binary messages, each starting with one of
15
+ * [`BROWSER_FRAME_TAGS`].
16
+ */
17
+ export type BrowserViewServerMessage = { "type": "ready", kind: PictureKind, width: number, height: number, scale: number, codec?: string, } | { "type": "state", session: unknown, } | { "type": "cursor", cursor: string, } | { "type": "select", menu: SelectMenu | null, } | { "type": "selection", text: string, } | { "type": "gone", pageId: string, } | { "type": "pong" } | { "type": "error", message: string, } | { "type": "saved" };
18
+
3
19
  /**
4
20
  * The edge's verdicts, the only values [`VERDICT_HEADER`] carries.
5
21
  */
6
22
  export type EdgeVerdict = "no-tunnel" | "unknown-sandbox" | "dropped";
7
23
 
24
+ /**
25
+ * A phone a page is rendered as: its CSS viewport in portrait, whether it is a touch screen with a meta viewport, and
26
+ * the user agent it sends.
27
+ */
28
+ export type EmulatedDevice = { width: number, height: number, mobile: boolean, userAgent?: string, };
29
+
8
30
  /**
9
31
  * Where netd's control link to Node stands.
10
32
  */
11
33
  export type NodeLink = "starting" | "up" | "restarting";
12
34
 
35
+ /**
36
+ * Which decoder a picture needs.
37
+ */
38
+ export type PictureKind = "video" | "frames";
39
+
40
+ export type PictureRect = { x: number, y: number, width: number, height: number, };
41
+
42
+ /**
43
+ * What a pointer event did.
44
+ */
45
+ export type PointerAction = "move" | "down" | "up" | "wheel";
46
+
13
47
  /**
14
48
  * The share of the last 10 seconds, as a percentage, in which some of the container's tasks stalled waiting for each
15
49
  * resource: cgroup v2's `some avg10` from `cpu.pressure`, `memory.pressure` and `io.pressure`.
@@ -46,6 +80,14 @@ pressure: Pressure | null,
46
80
  */
47
81
  tunnel?: TunnelVitals, };
48
82
 
83
+ export type SelectEntry = { label: string, disabled: boolean, };
84
+
85
+ /**
86
+ * A native drop-down the frames path cannot show in its pictures, for the viewer to draw: its entries, the one
87
+ * chosen, and where it opens, in the picture's pixels.
88
+ */
89
+ export type SelectMenu = { options: Array<SelectEntry>, selected: number, rect: PictureRect, };
90
+
49
91
  /**
50
92
  * What the browser sends on a terminal socket, each a JSON text message.
51
93
  */
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
2
2
  import { EDGE_VERDICT_HEADER, edgeVerdictOf } from "../protocol/edge-verdict.js";
3
3
  import { INGRESS_GRANT_HEADER, INGRESS_TUNNEL_PATH } from "../protocol/ingress-contract.js";
4
4
  import { VITALS_FILE, VITALS_PATH } from "../protocol/vitals.js";
5
- import { EDGE_TRANSPORTS, TERMINAL_PATH, WEBTRANSPORT_PATH } from "./browser-wire.js";
5
+ import { BROWSER_FRAME_TAGS, BROWSER_VIEW_PATH, EDGE_TRANSPORTS, TERMINAL_PATH, WEBTRANSPORT_PATH } from "./browser-wire.js";
6
6
  import {
7
7
  ASK_PATIENCE_MS,
8
8
  FRAME_LENGTH_BYTES,
@@ -30,6 +30,7 @@ const socket = manifest("netd-wire") as {
30
30
  frame: { lengthBytes: number; maxBytes: number };
31
31
  };
32
32
  const browser = manifest("browser-wire") as {
33
+ browserView: { path: string; frameTags: Record<string, number> };
33
34
  edge: { verdictHeader: string; verdicts: { oneOf: { const: string }[] } };
34
35
  terminal: { path: string; upgrade: string };
35
36
  vitals: { path: string; file: string; body: { $defs: { NodeLink: { oneOf: { const: string }[] } } } };
@@ -80,6 +81,11 @@ describe("the wire outside oRPC, as the Rust crates define it", () => {
80
81
  });
81
82
  });
82
83
 
84
+ it("opens the browser view where browser-wire says, and tags its pictures as it numbers them", () => {
85
+ expect(BROWSER_VIEW_PATH).toBe(browser.browserView.path);
86
+ expect<Record<string, number>>(BROWSER_FRAME_TAGS).toEqual(browser.browserView.frameTags);
87
+ });
88
+
83
89
  it("finds netd's vitals where browser-wire says it answers them, in the states it names", () => {
84
90
  expect(VITALS_PATH).toBe(browser.vitals.path);
85
91
  expect(VITALS_FILE).toBe(browser.vitals.file);
@@ -65,7 +65,7 @@ export const TerminalScrollbackSchema = z.object({
65
65
  });
66
66
  export type TerminalScrollback = z.infer<typeof TerminalScrollbackSchema>;
67
67
  // The Chromium the agent drives via @playwright/mcp, listed apart from terminals since it holds several pages at once,
68
- // not one stream. `active` is the page the agent last touched.
68
+ // not one stream. `active` is the tab the window has in front, which is what its picture shows.
69
69
  export const BrowserPageSchema = z.object({
70
70
  id: z
71
71
  .string()
@@ -75,8 +75,11 @@ export const BrowserPageSchema = z.object({
75
75
  // The page's title; absent mid-navigation, when a tab still needs to render.
76
76
  title: z.string().optional().describe("The page's title. Absent mid-navigation, which is exactly when a tab still has to be drawn."),
77
77
  url: z.string().describe("Where it is. On the browser's error page, the address that failed to load."),
78
- // The page the agent last drove; for a finished session, the one it ended on. Exactly one page has it.
79
- active: z.boolean().describe("The one the agent last touched, or for a finished session, the one it ended on. Exactly one page has this."),
78
+ // The tab the window has in front, which its picture shows, whoever brought it there (the agent, the person, a
79
+ // popup opening); for a finished session, the one it ended on. Exactly one page has it.
80
+ active: z
81
+ .boolean()
82
+ .describe("The tab the window has in front, which is what its picture shows; for a closed browser, the one it ended on. Exactly one page has this."),
80
83
  // What a browser's own chrome says about a tab between two addresses, which the picture crops away: it turns, it
81
84
  // names the host it waits on, and it says why it gave up. All absent from a daemon older than them.
82
85
  loading: z
@@ -94,9 +97,16 @@ export const BrowserPageSchema = z.object({
94
97
  .string()
95
98
  .optional()
96
99
  .describe("Why the last navigation failed, in the browser's own words (net::ERR_CONNECTION_TIMED_OUT), while the page shows its error page."),
100
+ // Whether the tab's history has somewhere to go, read off Chromium after each arrival; absent from an older daemon
101
+ // and before the first arrival, when the buttons stay as they were.
102
+ canGoBack: z.boolean().optional().describe("Its history has a page before this one to go back to."),
103
+ canGoForward: z.boolean().optional().describe("Its history has a page after this one to go forward to."),
97
104
  });
98
105
  export const BrowserSessionSchema = z.object({
99
106
  name: z.string().describe("Its id, and what the close route takes."),
107
+ // Rises on every change to the window, across daemon restarts too. The same window arrives two ways, in this list
108
+ // and on its own view socket's `state` (browser-wire): the higher `seq` is the newer. Absent from an older daemon.
109
+ seq: z.number().optional().describe("Rises with every change to this window; of two copies of it, the one with the higher number is the newer."),
100
110
  // The pill's text: the active page's title, else its host, else which browser this is.
101
111
  label: z.string().describe("What to call it on screen: the open page's title, or its site, or which browser this is."),
102
112
  // Which MCP server drives it: the credential-free browser, or a signed-in capability's id.