@opengeni/runtime 4.0.1 → 4.0.3

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 (43) hide show
  1. package/dist/{agent-RJQLKFIW.js → agent-ME6HT4DH.js} +2 -2
  2. package/dist/assets/codemode-client.json +1 -1
  3. package/dist/browser-action-json-schema.d.ts +4 -0
  4. package/dist/{chunk-J5AR5XAJ.js → chunk-GBVN7WSK.js} +377 -210
  5. package/dist/chunk-GBVN7WSK.js.map +1 -0
  6. package/dist/{chunk-ZG2YH25H.js → chunk-JAYHA6BF.js} +2 -2
  7. package/dist/{chunk-J6J3VYFW.js → chunk-LL2YQO5H.js} +527 -48
  8. package/dist/chunk-LL2YQO5H.js.map +1 -0
  9. package/dist/{chunk-UNICCRW5.js → chunk-LZIXCZUV.js} +6 -3
  10. package/dist/{chunk-UNICCRW5.js.map → chunk-LZIXCZUV.js.map} +1 -1
  11. package/dist/{chunk-SPT3PLMX.js → chunk-PRHMSM6C.js} +2 -2
  12. package/dist/index.js +7 -7
  13. package/dist/interaction-tools.d.ts +1 -1
  14. package/dist/{lazy-manifest-OEYEHNVY.js → lazy-manifest-GCGUFIWP.js} +3 -3
  15. package/dist/{localSources-TWHTEKGO.js → localSources-FDH65AFI.js} +4 -4
  16. package/dist/sandbox/browser-control-client.d.ts +28 -1
  17. package/dist/sandbox/index.d.ts +2 -2
  18. package/dist/sandbox/index.js +6 -6
  19. package/dist/sandbox/providers/modal-command-router-wire.d.ts +8 -0
  20. package/dist/sandbox/providers/modal.d.ts +5 -6
  21. package/dist/workspace-tool-gateway.js +5 -5
  22. package/package.json +7 -7
  23. package/src/browser-action-json-schema.ts +10 -0
  24. package/src/bundled_artifact_skills/opengeni-documents/SKILL.md +4 -1
  25. package/src/bundled_artifact_skills/opengeni-documents/references/api.md +20 -0
  26. package/src/bundled_default_skills/opengeni-client/SKILL.md +4 -1
  27. package/src/bundled_default_skills/opengeni-client/references/discovery-and-autonomy.md +31 -0
  28. package/src/bundled_default_skills/opengeni-client/references/runtime-profile-and-verification.md +32 -0
  29. package/src/index.ts +9 -0
  30. package/src/interaction-tools.ts +656 -48
  31. package/src/sandbox/browser-control-client.ts +241 -26
  32. package/src/sandbox/index.ts +3 -1
  33. package/src/sandbox/providers/modal-command-control.ts +7 -1
  34. package/src/sandbox/providers/modal-command-router-wire.ts +47 -6
  35. package/src/sandbox/providers/modal.ts +16 -24
  36. package/src/sandbox/routing/routing-session.ts +4 -2
  37. package/dist/chunk-J5AR5XAJ.js.map +0 -1
  38. package/dist/chunk-J6J3VYFW.js.map +0 -1
  39. /package/dist/{agent-RJQLKFIW.js.map → agent-ME6HT4DH.js.map} +0 -0
  40. /package/dist/{chunk-ZG2YH25H.js.map → chunk-JAYHA6BF.js.map} +0 -0
  41. /package/dist/{chunk-SPT3PLMX.js.map → chunk-PRHMSM6C.js.map} +0 -0
  42. /package/dist/{lazy-manifest-OEYEHNVY.js.map → lazy-manifest-GCGUFIWP.js.map} +0 -0
  43. /package/dist/{localSources-TWHTEKGO.js.map → localSources-FDH65AFI.js.map} +0 -0
@@ -8,6 +8,7 @@ import {
8
8
  createTurnToolCancellationController,
9
9
  installManagedCodemodeClient,
10
10
  isDefinitePathNotFoundError,
11
+ isModalTaskExecStartPreDispatchUnavailableError,
11
12
  isRoutingMutationOutcomeUnknownError,
12
13
  loadManagedCodemodeClient,
13
14
  managedCodemodeClientDirectory,
@@ -26,11 +27,11 @@ import {
26
27
  withRunCredentialsClient,
27
28
  withRunCredentialsSession,
28
29
  wrapCapabilityToolsForTurnCancellation
29
- } from "./chunk-J5AR5XAJ.js";
30
+ } from "./chunk-GBVN7WSK.js";
30
31
  import {
31
32
  MemorySession,
32
33
  connectMcpServers
33
- } from "./chunk-SPT3PLMX.js";
34
+ } from "./chunk-PRHMSM6C.js";
34
35
  import {
35
36
  SKILL_MAX_FILES,
36
37
  SKILL_READ_MAX_OUTPUT_BYTES,
@@ -114,7 +115,7 @@ import {
114
115
  tool,
115
116
  withGenerationSpan,
116
117
  withResponseSpan
117
- } from "./chunk-UNICCRW5.js";
118
+ } from "./chunk-LZIXCZUV.js";
118
119
 
119
120
  // src/prepared-compaction-request.ts
120
121
  import { AsyncLocalStorage } from "async_hooks";
@@ -12348,7 +12349,7 @@ import { existsSync, readdirSync } from "fs";
12348
12349
  // ../sdk/package.json
12349
12350
  var package_default = {
12350
12351
  name: "@opengeni/sdk",
12351
- version: "7.1.0",
12352
+ version: "7.1.1",
12352
12353
  description: "Framework-agnostic TypeScript SDK for the OpenGeni API: typed client, session lifecycle, SSE event streaming with reconnect + replay-by-sequence, and proxy re-streaming helpers.",
12353
12354
  license: "Apache-2.0",
12354
12355
  repository: {
@@ -12500,7 +12501,7 @@ var package_default = {
12500
12501
  // ../react/package.json
12501
12502
  var package_default2 = {
12502
12503
  name: "@opengeni/react",
12503
- version: "7.1.0",
12504
+ version: "7.1.2",
12504
12505
  description: "React hooks and styled components for OpenGeni: live session streaming, chat composer, message timeline, session status, and fleet views \u2014 token-themed (CSS variables), dark-first, built on Tailwind v4 + Radix + Motion.",
12505
12506
  license: "Apache-2.0",
12506
12507
  repository: {
@@ -12753,7 +12754,7 @@ var package_default2 = {
12753
12754
  // ../codemode/package.json
12754
12755
  var package_default3 = {
12755
12756
  name: "@opengeni/codemode",
12756
- version: "0.6.1",
12757
+ version: "0.6.2",
12757
12758
  description: "Attempt-frozen programmatic tool catalog and execution authority for OpenGeni.",
12758
12759
  license: "Apache-2.0",
12759
12760
  repository: {
@@ -12803,7 +12804,7 @@ var package_default3 = {
12803
12804
  // ../ogtool/package.json
12804
12805
  var package_default4 = {
12805
12806
  name: "@opengeni/ogtool",
12806
- version: "0.3.43",
12807
+ version: "0.3.44",
12807
12808
  description: "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
12808
12809
  license: "Apache-2.0",
12809
12810
  repository: {
@@ -15021,6 +15022,10 @@ import {
15021
15022
  BrowserActionReceipt,
15022
15023
  BrowserClipboard,
15023
15024
  BrowserDiagnosticBatch,
15025
+ BrowserDomReadResponse,
15026
+ BrowserDomReadLocator,
15027
+ BrowserDomReadSelector,
15028
+ BrowserDomSafeAttribute,
15024
15029
  BrowserIdentity,
15025
15030
  BrowserIdentityListResponse,
15026
15031
  BrowserIdentityMutationResponse,
@@ -15061,6 +15066,16 @@ import {
15061
15066
  resolveFirstPartyDelegationSecret
15062
15067
  } from "@opengeni/config";
15063
15068
  import { OpenGeniApiError, OpenGeniClient } from "@opengeni/sdk";
15069
+
15070
+ // src/browser-action-json-schema.ts
15071
+ function browserActionInputJsonSchema(schema) {
15072
+ return external_exports.toJSONSchema(schema, {
15073
+ target: "draft-2020-12",
15074
+ reused: "ref"
15075
+ });
15076
+ }
15077
+
15078
+ // src/interaction-tools.ts
15064
15079
  var INTERACTION_ATTEMPT_TOOL_NAMES = FIRST_PARTY_IN_PROCESS_TOOL_NAMES;
15065
15080
  var InteractionExecutionResult = class {
15066
15081
  constructor(output, additionalContent) {
@@ -15068,11 +15083,161 @@ var InteractionExecutionResult = class {
15068
15083
  this.additionalContent = additionalContent;
15069
15084
  }
15070
15085
  };
15086
+ var BROWSER_AGENT_MAX_NODES = 60;
15087
+ var BROWSER_AGENT_MAX_NODE_BYTES = 12e3;
15088
+ var BROWSER_AGENT_MAX_FIELD_LENGTH = 180;
15089
+ var BROWSER_READ_MAX_NODES = 80;
15090
+ var BROWSER_TOOL_IMAGE_MAX_BYTES = 8 * 1024 * 1024;
15091
+ var BrowserAgentNode = external_exports.object({
15092
+ ref: external_exports.string().max(512),
15093
+ role: external_exports.string().max(256),
15094
+ depth: external_exports.number().int().nonnegative(),
15095
+ name: external_exports.string().max(BROWSER_AGENT_MAX_FIELD_LENGTH).optional(),
15096
+ description: external_exports.string().max(BROWSER_AGENT_MAX_FIELD_LENGTH).optional(),
15097
+ value: external_exports.union([
15098
+ external_exports.string().max(BROWSER_AGENT_MAX_FIELD_LENGTH),
15099
+ external_exports.object({ redacted: external_exports.literal(true), reason: external_exports.string().max(32) }).strict()
15100
+ ]).optional(),
15101
+ states: external_exports.array(external_exports.string().max(BROWSER_AGENT_MAX_FIELD_LENGTH)).max(6),
15102
+ actions: external_exports.array(external_exports.string().max(BROWSER_AGENT_MAX_FIELD_LENGTH)).max(6)
15103
+ }).strict();
15104
+ var BrowserAgentView = external_exports.object({
15105
+ kind: external_exports.literal("compact"),
15106
+ sourceKind: external_exports.enum(["snapshot", "diff", "none"]),
15107
+ nodes: external_exports.array(BrowserAgentNode).max(BROWSER_AGENT_MAX_NODES),
15108
+ sourceNodeCount: external_exports.number().int().nonnegative(),
15109
+ omittedNodeCount: external_exports.number().int().nonnegative(),
15110
+ removedRefCount: external_exports.number().int().nonnegative(),
15111
+ clippedFieldCount: external_exports.number().int().nonnegative(),
15112
+ maxNodes: external_exports.number().int().positive(),
15113
+ maxNodeBytes: external_exports.number().int().positive()
15114
+ }).strict();
15115
+ var CompactBrowserObservation = BrowserObservation.safeExtend({
15116
+ semantic: external_exports.null(),
15117
+ agentView: BrowserAgentView
15118
+ });
15119
+ var BrowserAgentObservation = external_exports.union([BrowserObservation, CompactBrowserObservation]);
15120
+ var BrowserAgentActionReceipt = BrowserActionReceipt.safeExtend({
15121
+ observation: BrowserAgentObservation.nullable()
15122
+ });
15123
+ var BrowserScreenshotInput = external_exports.object({
15124
+ browserSessionId: external_exports.string().uuid(),
15125
+ targetId: external_exports.string().min(1).max(512),
15126
+ fullPage: external_exports.boolean().optional(),
15127
+ quality: external_exports.number().int().min(1).max(100).optional()
15128
+ }).strict();
15129
+ var BrowserScreenshotOutput = external_exports.object({
15130
+ kind: external_exports.literal("browser_screenshot"),
15131
+ browserSessionId: external_exports.string().uuid(),
15132
+ targetId: external_exports.string(),
15133
+ frameId: external_exports.string(),
15134
+ targetGeneration: external_exports.string(),
15135
+ documentGeneration: external_exports.string(),
15136
+ mediaType: external_exports.enum(["image/jpeg", "image/png"]),
15137
+ width: external_exports.number().int().positive(),
15138
+ height: external_exports.number().int().positive(),
15139
+ deviceScaleFactor: external_exports.number().positive(),
15140
+ scrollX: external_exports.number(),
15141
+ scrollY: external_exports.number(),
15142
+ capturedAt: external_exports.string(),
15143
+ fullPage: external_exports.boolean()
15144
+ }).strict();
15145
+ var BrowserReadInput = external_exports.object({
15146
+ browserSessionId: external_exports.string().uuid(),
15147
+ targetId: external_exports.string().min(1).max(512),
15148
+ mode: external_exports.enum(["matches", "count", "subtree", "dom"]).optional(),
15149
+ dom: external_exports.discriminatedUnion("kind", [
15150
+ external_exports.object({
15151
+ kind: external_exports.literal("element"),
15152
+ locator: BrowserDomReadLocator,
15153
+ attributes: external_exports.array(BrowserDomSafeAttribute).max(6).optional(),
15154
+ maxChars: external_exports.number().int().min(1).max(4096).optional()
15155
+ }).strict(),
15156
+ external_exports.object({
15157
+ kind: external_exports.literal("count"),
15158
+ selector: BrowserDomReadSelector
15159
+ }).strict()
15160
+ ]).optional(),
15161
+ expectedTargetGeneration: external_exports.string().min(1).max(256).optional(),
15162
+ expectedDocumentGeneration: external_exports.string().min(1).max(256).nullable().optional(),
15163
+ expectedFrameId: external_exports.string().min(1).max(256).nullable().optional(),
15164
+ ref: external_exports.string().min(1).max(512).optional(),
15165
+ scopeRef: external_exports.string().min(1).max(512).optional(),
15166
+ role: external_exports.string().min(1).max(256).optional(),
15167
+ nameContains: external_exports.string().min(1).max(512).optional(),
15168
+ textContains: external_exports.string().min(1).max(512).optional(),
15169
+ state: external_exports.string().min(1).max(128).optional(),
15170
+ action: external_exports.string().min(1).max(128).optional(),
15171
+ limit: external_exports.number().int().min(1).max(BROWSER_READ_MAX_NODES).optional()
15172
+ }).strict().superRefine((value, context) => {
15173
+ if (value.mode === "subtree" && !value.ref) {
15174
+ context.addIssue({ code: "custom", path: ["ref"], message: "subtree requires a ref" });
15175
+ }
15176
+ if (value.mode === "dom" !== (value.dom !== void 0)) {
15177
+ context.addIssue({
15178
+ code: "custom",
15179
+ path: ["dom"],
15180
+ message: "dom query is required only with mode=dom"
15181
+ });
15182
+ }
15183
+ if (value.mode === "dom" && [
15184
+ value.ref,
15185
+ value.scopeRef,
15186
+ value.role,
15187
+ value.nameContains,
15188
+ value.textContains,
15189
+ value.state,
15190
+ value.action,
15191
+ value.limit
15192
+ ].some((field) => field !== void 0)) {
15193
+ context.addIssue({
15194
+ code: "custom",
15195
+ path: ["mode"],
15196
+ message: "accessibility filters cannot be combined with a DOM query"
15197
+ });
15198
+ }
15199
+ if (value.mode !== "dom" && [
15200
+ value.expectedTargetGeneration,
15201
+ value.expectedDocumentGeneration,
15202
+ value.expectedFrameId
15203
+ ].some((field) => field !== void 0)) {
15204
+ context.addIssue({
15205
+ code: "custom",
15206
+ path: ["mode"],
15207
+ message: "DOM generation fences require mode=dom"
15208
+ });
15209
+ }
15210
+ });
15211
+ var BrowserReadOutput = external_exports.object({
15212
+ browserSessionId: external_exports.string().uuid(),
15213
+ targetId: external_exports.string(),
15214
+ observationId: external_exports.string(),
15215
+ targetGeneration: external_exports.string(),
15216
+ documentGeneration: external_exports.string().nullable(),
15217
+ frameId: external_exports.string().nullable(),
15218
+ source: external_exports.literal("accessibility"),
15219
+ mode: external_exports.enum(["matches", "count", "subtree"]),
15220
+ scopeFound: external_exports.boolean(),
15221
+ nodes: external_exports.array(BrowserAgentNode).max(BROWSER_READ_MAX_NODES),
15222
+ totalMatches: external_exports.number().int().nonnegative(),
15223
+ omittedMatches: external_exports.number().int().nonnegative(),
15224
+ clippedFieldCount: external_exports.number().int().nonnegative(),
15225
+ maxNodeBytes: external_exports.number().int().positive()
15226
+ }).strict();
15227
+ var BrowserDomAgentReadOutput = BrowserDomReadResponse.safeExtend({
15228
+ source: external_exports.literal("dom")
15229
+ });
15230
+ var BrowserReadToolOutput = external_exports.discriminatedUnion("source", [
15231
+ BrowserReadOutput,
15232
+ BrowserDomAgentReadOutput
15233
+ ]);
15071
15234
  var TOOL_PERMISSION = {
15072
15235
  interaction_discover: "sessions:read",
15073
15236
  browser_open: "sessions:control",
15074
15237
  browser_tabs: "sessions:control",
15075
15238
  browser_observe: "sessions:read",
15239
+ browser_read: "sessions:read",
15240
+ browser_screenshot: "sessions:read",
15076
15241
  browser_act: "sessions:control",
15077
15242
  browser_clipboard: "sessions:read",
15078
15243
  browser_debug: "sessions:read",
@@ -15153,7 +15318,9 @@ var BrowserTabsInput = external_exports.discriminatedUnion("operation", [
15153
15318
  ]);
15154
15319
  var BrowserObserveInput = external_exports.object({
15155
15320
  browserSessionId: external_exports.string().uuid(),
15156
- targetId: external_exports.string().min(1).max(512)
15321
+ targetId: external_exports.string().min(1).max(512),
15322
+ view: external_exports.enum(["compact", "full"]).optional(),
15323
+ includeScreenshot: external_exports.boolean().optional()
15157
15324
  }).strict();
15158
15325
  var BrowserActInput = external_exports.object({
15159
15326
  browserSessionId: external_exports.string().uuid(),
@@ -15161,6 +15328,7 @@ var BrowserActInput = external_exports.object({
15161
15328
  expectedTargetGeneration: external_exports.string().min(1).max(256).optional(),
15162
15329
  expectedDocumentGeneration: external_exports.string().min(1).max(256).nullable().optional(),
15163
15330
  expectedFrameId: external_exports.string().min(1).max(256).nullable().optional(),
15331
+ view: external_exports.enum(["compact", "full", "none"]).optional(),
15164
15332
  action: external_exports.union([BrowserAction, BrowserActionBatch])
15165
15333
  }).strict();
15166
15334
  var BrowserClipboardInput = external_exports.object({ browserSessionId: external_exports.string().uuid() }).strict();
@@ -15288,12 +15456,15 @@ var ComputerObserveInput = external_exports.object({
15288
15456
  computerSessionId: external_exports.string().uuid(),
15289
15457
  targetId: external_exports.string().min(1).max(512)
15290
15458
  }).strict();
15459
+ var ComputerObserveOutput = ComputerObservation.extend({
15460
+ capturedFrame: external_exports.object({ width: external_exports.number().int().positive(), height: external_exports.number().int().positive() }).strict()
15461
+ }).strict();
15291
15462
  var ComputerClipboardInput = external_exports.object({ computerSessionId: external_exports.string().uuid() }).strict();
15292
15463
  var ComputerActInput = external_exports.object({
15293
15464
  computerSessionId: external_exports.string().uuid(),
15294
15465
  targetId: external_exports.string().min(1).max(512),
15295
15466
  expectedTargetGeneration: external_exports.string().min(1).max(256).optional(),
15296
- expectedObservationId: external_exports.string().uuid().nullable().optional(),
15467
+ expectedObservationId: ComputerObservation.shape.observationId.nullable().optional(),
15297
15468
  expectedFrameId: external_exports.string().min(1).max(256).nullable().optional(),
15298
15469
  action: ComputerAction
15299
15470
  }).strict();
@@ -15316,7 +15487,7 @@ function createInteractionAttemptToolDefinitions(input) {
15316
15487
  codemodePath: options.codemodePath,
15317
15488
  title: options.title,
15318
15489
  description: options.description,
15319
- inputSchema: jsonSchema(options.input),
15490
+ inputSchema: options.name === "browser_act" ? browserActionInputJsonSchema(options.input) : jsonSchema(options.input),
15320
15491
  outputSchema: jsonSchema(options.output),
15321
15492
  annotations: {
15322
15493
  title: options.title,
@@ -15384,7 +15555,7 @@ function createInteractionAttemptToolDefinitions(input) {
15384
15555
  name: "browser_open",
15385
15556
  codemodePath: ["interaction", "browser", "open"],
15386
15557
  title: "Open or reuse browser",
15387
- description: "Open a managed BrowserSession on the current agent placement, reuse a relevant compatible live session by default, attach to an explicit workspace BrowserSession, or open an attached Chrome profile by passing placement={kind:'attached_device',deviceId}. This does not infer or attach the user's existing Chrome: for requests about 'my browser', 'my tabs', or current Chrome, call interaction_discover first and select an actual attachedBrowsers device; if none exists, explain that the Chrome extension must be connected instead of silently creating a blank managed browser. Managed Chromium defaults to headed so OAuth and later human interaction use a supported browser; request headless=true only for agent-only work that will not require sign-in or human control. Returns exact session and tab state.",
15558
+ description: "Open a managed BrowserSession on the current agent placement, reuse a relevant compatible live session by default, attach to an explicit workspace BrowserSession, or open an attached Chrome profile by passing placement={kind:'attached_device',deviceId}. This does not infer or attach the user's existing Chrome: for requests about 'my browser', 'my tabs', or current Chrome, call interaction_discover first and select an actual attachedBrowsers device; if none exists, explain that the Chrome extension must be connected instead of silently creating a blank managed browser. BrowserSessions persist across tool calls; shell-launched browser daemons do not survive remote-command cleanup. Never switch to the user's attached Chrome as a fallback for a failed managed browser unless the user requested that profile. A new attached session opens a dedicated tab. Managed Chromium defaults to headed so OAuth and later human interaction use a supported browser; request headless=true only for agent-only work that will not require sign-in or human control. Returns exact session and tab state.",
15388
15559
  input: BrowserOpenInput,
15389
15560
  output: BrowserOpenOutput,
15390
15561
  readOnly: false,
@@ -15395,7 +15566,7 @@ function createInteractionAttemptToolDefinitions(input) {
15395
15566
  name: "browser_tabs",
15396
15567
  codemodePath: ["interaction", "browser", "tabs"],
15397
15568
  title: "Manage browser tabs",
15398
- description: "List, open, select, or close tabs in one exact BrowserSession. Returns the authoritative complete tab list after the operation.",
15569
+ description: "List, open, logically select, or close tabs in one exact BrowserSession. Selection changes the BrowserSession's default target, not the visible desktop tab. New attached-Chrome tabs open in the background. Use browser_act activate only when foregrounding the owned tab is explicitly intended. Returns the authoritative complete tab list after the operation.",
15399
15570
  input: BrowserTabsInput,
15400
15571
  output: BrowserTargetListResponse,
15401
15572
  readOnly: false,
@@ -15425,40 +15596,169 @@ function createInteractionAttemptToolDefinitions(input) {
15425
15596
  name: "browser_observe",
15426
15597
  codemodePath: ["interaction", "browser", "observe"],
15427
15598
  title: "Observe browser tab",
15428
- description: "Read one tab's current URL/title, causal generations, compact semantic accessibility tree, dialog, and diagnostic counts without taking control.",
15599
+ description: "Read one tab's URL, title, viewport, causal generations, and a bounded accessibility view. Compact view is the default: agentView lists selected refs and reports omitted nodes and clipped fields; it is not a complete page tree. Set view=full for the complete accessibility snapshot. Set includeScreenshot=true to add a current still image as tool image content; browser_screenshot is faster when only pixels are needed.",
15429
15600
  input: BrowserObserveInput,
15430
- output: BrowserObservation,
15601
+ output: BrowserAgentObservation,
15431
15602
  readOnly: true,
15432
15603
  idempotent: true,
15433
- execute: async (value) => await input.transport.observeBrowserTarget(
15434
- input.workspaceId,
15435
- value.browserSessionId,
15436
- value.targetId
15437
- )
15604
+ execute: async (value) => {
15605
+ let observation = await input.transport.observeBrowserTarget(
15606
+ input.workspaceId,
15607
+ value.browserSessionId,
15608
+ value.targetId
15609
+ );
15610
+ if (!value.includeScreenshot)
15611
+ return projectBrowserObservation(observation, value.view ?? "compact");
15612
+ const frame = await input.transport.captureBrowserTarget(
15613
+ input.workspaceId,
15614
+ value.browserSessionId,
15615
+ value.targetId
15616
+ );
15617
+ if (observation.target.targetGeneration !== frame.targetGeneration || observation.target.documentGeneration !== frame.documentGeneration) {
15618
+ observation = await input.transport.observeBrowserTarget(
15619
+ input.workspaceId,
15620
+ value.browserSessionId,
15621
+ value.targetId
15622
+ );
15623
+ }
15624
+ if (observation.target.targetGeneration !== frame.targetGeneration || observation.target.documentGeneration !== frame.documentGeneration) {
15625
+ throw new Error("browser target changed while its visual observation was captured");
15626
+ }
15627
+ return new InteractionExecutionResult(
15628
+ projectBrowserObservation(observation, value.view ?? "compact"),
15629
+ [browserToolImageContent(frame.data, frame.mediaType)]
15630
+ );
15631
+ }
15632
+ });
15633
+ add({
15634
+ name: "browser_read",
15635
+ codemodePath: ["interaction", "browser", "read"],
15636
+ title: "Read focused browser content",
15637
+ description: "Search, count, or read a subtree from one tab's accessibility snapshot; filter by ref, role, name, accessibility text, state, or action, and scopeRef. AX mode refreshes the full tree internally and cannot return DOM attributes or editable input values. Use mode=dom with a ref, CSS, test-id, or placeholder locator for bounded element text, editable value, or allowlisted attributes, or a CSS selector for count. Content-matching role/label/text locators and CSS attribute/pseudo selectors are rejected for DOM reads to prevent secret-value probing. DOM reads use exact causal fences and only fixed, read-only browser-side projection; callers cannot supply JavaScript. Ref DOM locators refresh accessibility; CSS/test-id/placeholder locators avoid that scan.",
15638
+ input: BrowserReadInput,
15639
+ output: BrowserReadToolOutput,
15640
+ readOnly: true,
15641
+ idempotent: true,
15642
+ execute: async (value) => {
15643
+ if (value.mode === "dom") {
15644
+ const state = value.expectedTargetGeneration !== void 0 && value.expectedDocumentGeneration !== void 0 && value.expectedFrameId !== void 0 ? null : await input.transport.getBrowserTargetState(
15645
+ input.workspaceId,
15646
+ value.browserSessionId,
15647
+ value.targetId
15648
+ );
15649
+ const fences = {
15650
+ expectedTargetGeneration: value.expectedTargetGeneration ?? state.targetGeneration,
15651
+ expectedDocumentGeneration: value.expectedDocumentGeneration === void 0 ? state.documentGeneration : value.expectedDocumentGeneration,
15652
+ expectedFrameId: value.expectedFrameId === void 0 ? state.frameId : value.expectedFrameId
15653
+ };
15654
+ const documentGeneration = fences.expectedDocumentGeneration;
15655
+ const frameId = fences.expectedFrameId;
15656
+ if (documentGeneration === null || frameId === null) {
15657
+ throw new OpenGeniApiError(409, "browser target has no inspectable document", {
15658
+ code: "document_unavailable",
15659
+ retryable: true
15660
+ });
15661
+ }
15662
+ const inspectedFences = {
15663
+ expectedTargetGeneration: fences.expectedTargetGeneration,
15664
+ expectedDocumentGeneration: documentGeneration,
15665
+ expectedFrameId: frameId
15666
+ };
15667
+ const dom = value.dom;
15668
+ const request = dom.kind === "element" ? {
15669
+ ...inspectedFences,
15670
+ kind: "element",
15671
+ locator: dom.locator,
15672
+ ...dom.attributes ? { attributes: dom.attributes } : {},
15673
+ maxChars: dom.maxChars ?? 4096
15674
+ } : { ...inspectedFences, kind: "count", selector: dom.selector };
15675
+ return {
15676
+ ...await input.transport.readBrowserDom(
15677
+ input.workspaceId,
15678
+ value.browserSessionId,
15679
+ value.targetId,
15680
+ request
15681
+ ),
15682
+ source: "dom"
15683
+ };
15684
+ }
15685
+ return readBrowserObservation(
15686
+ await input.transport.observeBrowserTarget(
15687
+ input.workspaceId,
15688
+ value.browserSessionId,
15689
+ value.targetId
15690
+ ),
15691
+ value
15692
+ );
15693
+ }
15694
+ });
15695
+ add({
15696
+ name: "browser_screenshot",
15697
+ codemodePath: ["interaction", "browser", "screenshot"],
15698
+ title: "Capture browser screenshot",
15699
+ description: "Capture a current browser tab screenshot without reading its accessibility tree. The image is returned as tool image content, with small structured frame metadata. Set fullPage=true to capture the whole scrollable page when supported; large pages may take longer or exceed capture bounds. Set quality lower to reduce JPEG bytes if a large capture exceeds the Code Mode image limit.",
15700
+ input: BrowserScreenshotInput,
15701
+ output: BrowserScreenshotOutput,
15702
+ readOnly: true,
15703
+ idempotent: true,
15704
+ execute: async (value) => {
15705
+ const frame = await input.transport.captureBrowserTarget(
15706
+ input.workspaceId,
15707
+ value.browserSessionId,
15708
+ value.targetId,
15709
+ {},
15710
+ { fullPage: value.fullPage ?? false, ...value.quality ? { quality: value.quality } : {} }
15711
+ );
15712
+ return new InteractionExecutionResult(
15713
+ {
15714
+ kind: "browser_screenshot",
15715
+ browserSessionId: frame.browserSessionId,
15716
+ targetId: frame.targetId,
15717
+ frameId: frame.frameId,
15718
+ targetGeneration: frame.targetGeneration,
15719
+ documentGeneration: frame.documentGeneration,
15720
+ mediaType: frame.mediaType,
15721
+ width: frame.width,
15722
+ height: frame.height,
15723
+ deviceScaleFactor: frame.deviceScaleFactor,
15724
+ scrollX: frame.scrollX,
15725
+ scrollY: frame.scrollY,
15726
+ capturedAt: frame.capturedAt,
15727
+ fullPage: value.fullPage ?? false
15728
+ },
15729
+ [browserToolImageContent(frame.data, frame.mediaType)]
15730
+ );
15731
+ }
15438
15732
  });
15439
15733
  add({
15440
15734
  name: "browser_act",
15441
15735
  codemodePath: ["interaction", "browser", "act"],
15442
15736
  title: "Act in browser tab",
15443
- description: "Perform one semantic-first browser action or bounded batch, including setting a managed browser's web permission for this tab's exact current top-level origin. Omit generation fences to use a fresh observation automatically; provide them to require exact previously observed state. Returns the durable receipt and changed observation.",
15737
+ description: "Perform one semantic-first browser action or bounded batch. Use viewport to set page width, height, desktop/mobile layout and touch emulation, then check the measured viewport in the returned observation; emulation does not prove physical mobile-browser behavior. Use history back/forward for tab navigation; keypress shortcuts are page input and may not navigate browser history. The explicit activate action foregrounds the target in the user's desktop browser; use only when that is intended. Permission actions set a managed browser's web permission for this tab's exact current top-level origin. Omit generation fences to fetch fresh generation metadata without scanning accessibility; supplying all three fences skips that state read while preserving controller validation. The default receipt includes a compact accessibility view with explicit omissions; set view=full for the complete observation, or view=none when no post-action tree is needed.",
15444
15738
  input: BrowserActInput,
15445
- output: BrowserActionReceipt,
15739
+ output: BrowserAgentActionReceipt,
15446
15740
  readOnly: false,
15447
15741
  idempotent: true,
15448
15742
  execute: async (value, context) => {
15449
- const current = await input.transport.observeBrowserTarget(
15743
+ const current = value.expectedTargetGeneration !== void 0 && value.expectedDocumentGeneration !== void 0 && value.expectedFrameId !== void 0 ? null : await input.transport.getBrowserTargetState(
15450
15744
  input.workspaceId,
15451
15745
  value.browserSessionId,
15452
15746
  value.targetId
15453
15747
  );
15454
- return await input.transport.actInBrowser(input.workspaceId, value.browserSessionId, {
15455
- operationId: context.operationId,
15456
- targetId: value.targetId,
15457
- expectedTargetGeneration: value.expectedTargetGeneration ?? current.target.targetGeneration,
15458
- expectedDocumentGeneration: value.expectedDocumentGeneration === void 0 ? current.target.documentGeneration : value.expectedDocumentGeneration,
15459
- expectedFrameId: value.expectedFrameId === void 0 ? current.frameId : value.expectedFrameId,
15460
- action: value.action
15461
- });
15748
+ const receipt = await input.transport.actInBrowser(
15749
+ input.workspaceId,
15750
+ value.browserSessionId,
15751
+ {
15752
+ operationId: context.operationId,
15753
+ targetId: value.targetId,
15754
+ expectedTargetGeneration: value.expectedTargetGeneration ?? current.targetGeneration,
15755
+ expectedDocumentGeneration: value.expectedDocumentGeneration === void 0 ? current.documentGeneration : value.expectedDocumentGeneration,
15756
+ expectedFrameId: value.expectedFrameId === void 0 ? current.frameId : value.expectedFrameId,
15757
+ ...value.view === "none" ? { observationMode: "none" } : {},
15758
+ action: value.action
15759
+ }
15760
+ );
15761
+ return receipt.observation && (value.view ?? "compact") === "compact" ? { ...receipt, observation: projectBrowserObservation(receipt.observation, "compact") } : receipt;
15462
15762
  }
15463
15763
  });
15464
15764
  add({
@@ -15758,9 +16058,9 @@ function createInteractionAttemptToolDefinitions(input) {
15758
16058
  name: "computer_observe",
15759
16059
  codemodePath: ["interaction", "computer", "observe"],
15760
16060
  title: "Observe app or window",
15761
- description: "Read one ComputerSession app/window/screen target, causal generation, semantic accessibility tree, focus, frame identity, and a bounded current screenshot without taking control.",
16061
+ description: "Read one ComputerSession app/window/screen target, causal generation, semantic accessibility tree, focus, frame identity, and a bounded current screenshot without taking control. capturedFrame gives the screenshot's exact pixel dimensions; use those pixels for pointer coordinates, not the target's native bounds or an image-preview size.",
15762
16062
  input: ComputerObserveInput,
15763
- output: ComputerObservation,
16063
+ output: ComputerObserveOutput,
15764
16064
  readOnly: true,
15765
16065
  idempotent: true,
15766
16066
  execute: async (value) => {
@@ -15784,13 +16084,20 @@ function createInteractionAttemptToolDefinitions(input) {
15784
16084
  if (observation.target.targetGeneration !== frame.targetGeneration) {
15785
16085
  throw new Error("computer target changed while its visual observation was captured");
15786
16086
  }
15787
- return new InteractionExecutionResult({ ...observation, frameId: frame.frameId }, [
16087
+ return new InteractionExecutionResult(
15788
16088
  {
15789
- type: "image",
15790
- data: Buffer.from(frame.data).toString("base64"),
15791
- mimeType: frame.mediaType
15792
- }
15793
- ]);
16089
+ ...observation,
16090
+ frameId: frame.frameId,
16091
+ capturedFrame: { width: frame.width, height: frame.height }
16092
+ },
16093
+ [
16094
+ {
16095
+ type: "image",
16096
+ data: Buffer.from(frame.data).toString("base64"),
16097
+ mimeType: frame.mediaType
16098
+ }
16099
+ ]
16100
+ );
15794
16101
  }
15795
16102
  });
15796
16103
  add({
@@ -15808,13 +16115,13 @@ function createInteractionAttemptToolDefinitions(input) {
15808
16115
  name: "computer_act",
15809
16116
  codemodePath: ["interaction", "computer", "act"],
15810
16117
  title: "Act in app or window",
15811
- description: "Perform one action in an exact ComputerSession target. Prefer semantic actions from computer_observe: on macOS they can invoke controls and set values without foregrounding the app. Pointer, keyboard, target focus, screen actions, and clipboard paste use the physical graphical seat and may change the user's foreground app; use them only when foreground control is explicitly intended. Omit fences to use a fresh observation automatically. Returns the durable causal receipt.",
16118
+ description: "Perform one action in an exact ComputerSession target. Prefer semantic actions from computer_observe: on macOS they can invoke controls and set values without foregrounding the app. Pointer, keyboard, target focus, screen actions, and clipboard paste use the physical graphical seat and may change the user's foreground app; use them only when foreground control is explicitly intended. For pointer actions, set action.frameId from the observed frame and use coordinates in the returned screenshot's pixels; do not scale them to target.bounds. A pixel frame fence applies only to pointer actions; semantic actions use the observation fence even if a frame ID is supplied. Supplying the target generation and relevant action fence preserves the exact observation without refreshing it. Omit fences to use a fresh observation automatically. Returns the durable causal receipt.",
15812
16119
  input: ComputerActInput,
15813
16120
  output: ComputerActionReceipt,
15814
16121
  readOnly: false,
15815
16122
  idempotent: true,
15816
16123
  execute: async (value, context) => {
15817
- const current = await input.transport.observeComputerTarget(
16124
+ const current = value.expectedTargetGeneration !== void 0 && (value.action.type === "pointer" ? (value.expectedFrameId ?? value.action.frameId) != null : value.expectedObservationId != null) ? null : await input.transport.observeComputerTarget(
15818
16125
  input.workspaceId,
15819
16126
  value.computerSessionId,
15820
16127
  value.targetId
@@ -15823,8 +16130,8 @@ function createInteractionAttemptToolDefinitions(input) {
15823
16130
  operationId: context.operationId,
15824
16131
  targetId: value.targetId,
15825
16132
  expectedTargetGeneration: value.expectedTargetGeneration ?? current.target.targetGeneration,
15826
- expectedObservationId: value.expectedObservationId === void 0 ? current.observationId : value.expectedObservationId,
15827
- expectedFrameId: value.expectedFrameId === void 0 ? value.action.type === "pointer" ? value.action.frameId : null : value.expectedFrameId,
16133
+ expectedObservationId: value.expectedObservationId === void 0 ? current?.observationId ?? null : value.expectedObservationId,
16134
+ expectedFrameId: value.action.type === "pointer" ? value.expectedFrameId === void 0 ? value.action.frameId : value.expectedFrameId : null,
15828
16135
  action: value.action
15829
16136
  });
15830
16137
  }
@@ -15901,10 +16208,12 @@ async function openBrowser(transport, workspaceId, sourceSessionId, value, conte
15901
16208
  if (value.browserSessionId) {
15902
16209
  session = await transport.getBrowserSession(workspaceId, value.browserSessionId);
15903
16210
  } else {
15904
- const listed = await transport.listBrowserSessions(workspaceId);
16211
+ const listed = value.mode === "new" ? { sessions: [] } : await transport.listBrowserSessions(workspaceId);
15905
16212
  const requestedHeadless = value.headless ?? false;
15906
16213
  const reusable = value.mode === "new" ? null : newestRelevant(
15907
- listed.sessions.filter((candidate) => candidate.headless === requestedHeadless),
16214
+ listed.sessions.filter(
16215
+ (candidate) => candidate.headless === requestedHeadless && compatibleInteractionPlacement(candidate.placement, value.placement) && (value.identityId === void 0 || candidate.identityId === value.identityId) && (value.baseRevisionId === void 0 || candidate.baseRevisionId === value.baseRevisionId) && (value.networkRouteId === void 0 || candidate.networkRouteId === value.networkRouteId) && (value.linkedComputerSessionId === void 0 || candidate.linkedComputerSessionId === value.linkedComputerSessionId)
16216
+ ),
15908
16217
  sourceSessionId
15909
16218
  );
15910
16219
  if (reusable) {
@@ -15950,8 +16259,13 @@ async function openComputer(transport, workspaceId, sourceSessionId, value, cont
15950
16259
  if (value.computerSessionId) {
15951
16260
  session = await transport.getComputerSession(workspaceId, value.computerSessionId);
15952
16261
  } else {
15953
- const listed = await transport.listComputerSessions(workspaceId);
15954
- const reusable = value.mode === "new" ? null : newestRelevant(listed.sessions, sourceSessionId);
16262
+ const listed = value.mode === "new" ? { sessions: [] } : await transport.listComputerSessions(workspaceId);
16263
+ const reusable = newestRelevant(
16264
+ listed.sessions.filter(
16265
+ (candidate) => compatibleInteractionPlacement(candidate.placement, value.placement)
16266
+ ),
16267
+ sourceSessionId
16268
+ );
15955
16269
  session = reusable ? reusable : (await transport.createComputerSession(workspaceId, {
15956
16270
  operationId: context.operationId,
15957
16271
  sessionId: sourceSessionId,
@@ -15964,6 +16278,12 @@ async function openComputer(transport, workspaceId, sourceSessionId, value, cont
15964
16278
  targets: session.lifecycle === "active" ? (await transport.listComputerTargets(workspaceId, session.id)).targets : []
15965
16279
  };
15966
16280
  }
16281
+ function compatibleInteractionPlacement(candidate, requested) {
16282
+ if (!requested) return candidate.kind !== "attached_device";
16283
+ return Object.entries(requested).every(
16284
+ ([key, value]) => candidate[key] === value
16285
+ );
16286
+ }
15967
16287
  function newestRelevant(sessions, sourceSessionId) {
15968
16288
  return sessions.filter(
15969
16289
  (session) => !["ending", "ended", "failed", "lost", "repair_required"].includes(session.lifecycle) && session.associations.some((association) => association.sessionId === sourceSessionId)
@@ -15980,6 +16300,147 @@ function assertInterventionResumeMatches(request, intervention) {
15980
16300
  throw new Error("Interaction response does not match the resumed tool request");
15981
16301
  }
15982
16302
  }
16303
+ function flattenBrowserNodes(roots, scopeRef) {
16304
+ const flattened = [];
16305
+ const stack = [...roots].reverse().map((node) => ({ node, depth: 0, withinScope: !scopeRef }));
16306
+ while (stack.length > 0) {
16307
+ const next = stack.pop();
16308
+ const withinScope = next.withinScope || next.node.ref === scopeRef;
16309
+ flattened.push({
16310
+ node: next.node,
16311
+ depth: next.depth,
16312
+ index: flattened.length,
16313
+ withinScope
16314
+ });
16315
+ for (const child of [...next.node.children ?? []].reverse()) {
16316
+ stack.push({ node: child, depth: next.depth + 1, withinScope });
16317
+ }
16318
+ }
16319
+ return flattened;
16320
+ }
16321
+ function boundedAgentField(value, onClip) {
16322
+ if (value.length <= BROWSER_AGENT_MAX_FIELD_LENGTH) return value;
16323
+ onClip();
16324
+ return `${value.slice(0, BROWSER_AGENT_MAX_FIELD_LENGTH - 1)}\u2026`;
16325
+ }
16326
+ function projectAgentNode(flat) {
16327
+ let clippedFieldCount = 0;
16328
+ const clip = () => {
16329
+ clippedFieldCount += 1;
16330
+ };
16331
+ const source = flat.node;
16332
+ const nodes = {
16333
+ ref: source.ref,
16334
+ role: source.role,
16335
+ depth: flat.depth,
16336
+ ...source.name !== void 0 ? { name: boundedAgentField(source.name, clip) } : {},
16337
+ ...source.description !== void 0 ? { description: boundedAgentField(source.description, clip) } : {},
16338
+ ...source.value !== void 0 ? {
16339
+ value: typeof source.value === "string" ? boundedAgentField(source.value, clip) : source.value
16340
+ } : {},
16341
+ states: source.states.slice(0, 6).map((state) => boundedAgentField(state, clip)),
16342
+ actions: source.actions.slice(0, 6).map((action) => boundedAgentField(action, clip))
16343
+ };
16344
+ if (source.states.length > 6) clippedFieldCount += source.states.length - 6;
16345
+ if (source.actions.length > 6) clippedFieldCount += source.actions.length - 6;
16346
+ return { node: nodes, clippedFieldCount };
16347
+ }
16348
+ function selectAgentNodes(flattened, maxNodes, maxBytes, prioritize = true) {
16349
+ const priority = (flat) => {
16350
+ const { node } = flat;
16351
+ if (node.actions.length > 0) return 0;
16352
+ if (["heading", "dialog", "alert", "status", "navigation", "main"].includes(node.role))
16353
+ return 1;
16354
+ if (["text", "paragraph", "listitem"].includes(node.role) && node.name) return 2;
16355
+ if (node.name || node.value || node.description) return 3;
16356
+ return 4;
16357
+ };
16358
+ const candidates = prioritize ? [...flattened].sort((a, b) => priority(a) - priority(b) || a.index - b.index) : flattened;
16359
+ const selected = [];
16360
+ let usedBytes = 0;
16361
+ let clippedFieldCount = 0;
16362
+ for (const flat of candidates) {
16363
+ if (selected.length >= maxNodes) break;
16364
+ const projected = projectAgentNode(flat);
16365
+ const bytes = Buffer.byteLength(JSON.stringify(projected.node), "utf8");
16366
+ if (usedBytes + bytes > maxBytes) continue;
16367
+ selected.push({ index: flat.index, node: projected.node });
16368
+ usedBytes += bytes;
16369
+ clippedFieldCount += projected.clippedFieldCount;
16370
+ }
16371
+ return {
16372
+ nodes: selected.sort((a, b) => a.index - b.index).map((entry) => entry.node),
16373
+ clippedFieldCount
16374
+ };
16375
+ }
16376
+ function projectBrowserObservation(observation, view) {
16377
+ if (view === "full") return observation;
16378
+ const semantic = observation.semantic;
16379
+ const roots = semantic?.kind === "snapshot" ? semantic.roots : semantic?.kind === "diff" ? semantic.changed : [];
16380
+ const flattened = flattenBrowserNodes(roots);
16381
+ const projected = selectAgentNodes(
16382
+ flattened,
16383
+ BROWSER_AGENT_MAX_NODES,
16384
+ BROWSER_AGENT_MAX_NODE_BYTES
16385
+ );
16386
+ return {
16387
+ ...observation,
16388
+ semantic: null,
16389
+ agentView: {
16390
+ kind: "compact",
16391
+ sourceKind: semantic?.kind ?? "none",
16392
+ nodes: projected.nodes,
16393
+ sourceNodeCount: flattened.length,
16394
+ omittedNodeCount: flattened.length - projected.nodes.length,
16395
+ removedRefCount: semantic?.kind === "diff" ? semantic.removedRefs.length : 0,
16396
+ clippedFieldCount: projected.clippedFieldCount,
16397
+ maxNodes: BROWSER_AGENT_MAX_NODES,
16398
+ maxNodeBytes: BROWSER_AGENT_MAX_NODE_BYTES
16399
+ }
16400
+ };
16401
+ }
16402
+ function readBrowserObservation(observation, input) {
16403
+ if (observation.semantic?.kind !== "snapshot") {
16404
+ throw new Error("browser focused read requires a complete accessibility snapshot");
16405
+ }
16406
+ const mode = input.mode && input.mode !== "dom" ? input.mode : "matches";
16407
+ const scopeRef = mode === "subtree" ? input.ref : input.scopeRef;
16408
+ const flattened = flattenBrowserNodes(observation.semantic.roots, scopeRef);
16409
+ const scopeFound = !scopeRef || flattened.some((entry) => entry.node.ref === scopeRef);
16410
+ const includes = (source, needle) => needle === void 0 || (source ?? "").toLowerCase().includes(needle.toLowerCase());
16411
+ const matches = flattened.filter(({ node, withinScope }) => {
16412
+ if (!withinScope) return false;
16413
+ if (mode !== "subtree" && input.ref && node.ref !== input.ref) return false;
16414
+ if (input.role && node.role.toLowerCase() !== input.role.toLowerCase()) return false;
16415
+ if (!includes(node.name, input.nameContains)) return false;
16416
+ if (input.textContains && ![node.name, node.description, typeof node.value === "string" ? node.value : void 0].some(
16417
+ (candidate) => includes(candidate, input.textContains)
16418
+ ))
16419
+ return false;
16420
+ if (input.state && !node.states.some((state) => state.toLowerCase() === input.state.toLowerCase()))
16421
+ return false;
16422
+ if (input.action && !node.actions.some((action) => action.toLowerCase() === input.action.toLowerCase()))
16423
+ return false;
16424
+ return true;
16425
+ });
16426
+ const projected = mode === "count" ? { nodes: [], clippedFieldCount: 0 } : selectAgentNodes(matches, input.limit ?? 40, BROWSER_AGENT_MAX_NODE_BYTES, false);
16427
+ return {
16428
+ browserSessionId: observation.browserSessionId,
16429
+ targetId: observation.target.id,
16430
+ observationId: observation.observationId,
16431
+ targetGeneration: observation.target.targetGeneration,
16432
+ documentGeneration: observation.target.documentGeneration,
16433
+ frameId: observation.frameId,
16434
+ source: "accessibility",
16435
+ mode,
16436
+ scopeFound,
16437
+ nodes: projected.nodes,
16438
+ totalMatches: matches.length,
16439
+ omittedMatches: matches.length - projected.nodes.length,
16440
+ clippedFieldCount: projected.clippedFieldCount,
16441
+ maxNodeBytes: BROWSER_AGENT_MAX_NODE_BYTES
16442
+ };
16443
+ }
15983
16444
  async function safeInteractionExecution(inputSchema, outputSchema, raw, context, execute) {
15984
16445
  try {
15985
16446
  const value = inputSchema.parse(raw);
@@ -16009,6 +16470,16 @@ async function safeInteractionExecution(inputSchema, outputSchema, raw, context,
16009
16470
  throw error;
16010
16471
  }
16011
16472
  }
16473
+ function browserToolImageContent(data, mimeType) {
16474
+ if (data.byteLength > BROWSER_TOOL_IMAGE_MAX_BYTES) {
16475
+ throw new OpenGeniApiError(
16476
+ 413,
16477
+ "Browser screenshot exceeds the Code Mode image limit; capture the viewport or lower JPEG quality.",
16478
+ { code: "browser_screenshot_too_large", retryable: false }
16479
+ );
16480
+ }
16481
+ return { type: "image", data: Buffer.from(data).toString("base64"), mimeType };
16482
+ }
16012
16483
  function interactionErrorResult(code, message, retryable = false) {
16013
16484
  const error = { code, message, retryable };
16014
16485
  return {
@@ -18291,6 +18762,14 @@ function buildAgentCapabilitiesFromComposition(settings, skillComposition, optio
18291
18762
  const caps = [
18292
18763
  filesystemCapability,
18293
18764
  shell({
18765
+ // The SDK normally renders every shell error into model-facing text.
18766
+ // Preserve that behavior except for client-side, pre-dispatch Modal
18767
+ // readiness proof, which reaches bounded same-turn recovery.
18768
+ execCommandErrorFunction: (_context, error) => {
18769
+ if (isModalTaskExecStartPreDispatchUnavailableError(error)) throw error;
18770
+ const details = error instanceof Error ? error.toString() : String(error);
18771
+ return `An error occurred while running the tool. Please try again. Error: ${details}`;
18772
+ },
18294
18773
  ...toolCancellation ? {} : { configureTools: withExecOpCorrelation }
18295
18774
  })
18296
18775
  ];
@@ -21622,7 +22101,7 @@ async function runOwnedSandboxSetup(agent, session, setupSession, opts) {
21622
22101
  if (opts.recordLazyManifest) {
21623
22102
  const manifest = agent.defaultManifest;
21624
22103
  if (manifest) {
21625
- const { recordLazyMaterializedDirectories } = await import("./lazy-manifest-OEYEHNVY.js");
22104
+ const { recordLazyMaterializedDirectories } = await import("./lazy-manifest-GCGUFIWP.js");
21626
22105
  await recordLazyMaterializedDirectories(session, manifest);
21627
22106
  }
21628
22107
  }
@@ -23941,4 +24420,4 @@ export {
23941
24420
  runAzureCliLoginHook,
23942
24421
  renderSessionGoalContext2 as renderSessionGoalContext
23943
24422
  };
23944
- //# sourceMappingURL=chunk-J6J3VYFW.js.map
24423
+ //# sourceMappingURL=chunk-LL2YQO5H.js.map