@opengeni/runtime 3.2.2 → 3.3.1-canary.38922642121001

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 (57) hide show
  1. package/dist/agent-LJT5NPWT.js +9 -0
  2. package/dist/assets/codemode-client.json +1 -1
  3. package/dist/{chunk-HJSIPTFA.js → chunk-4XDJ4TJA.js} +2 -2
  4. package/dist/{chunk-XQ23VCZ4.js → chunk-6FQ6KEII.js} +3 -3
  5. package/dist/{chunk-7LJ7KDPI.js → chunk-ERD4ICVB.js} +4 -3
  6. package/dist/{chunk-YG26XE7B.js → chunk-JYDG2A7H.js} +2 -2
  7. package/dist/{chunk-RSHQSLEJ.js → chunk-KIL4FGX5.js} +3 -3
  8. package/dist/{chunk-NWS4HPB7.js → chunk-MIAL5I4O.js} +2 -2
  9. package/dist/{chunk-7OUG7WBV.js → chunk-N5EB52EH.js} +3 -3
  10. package/dist/{chunk-Z5U6WE22.js → chunk-PRZPGRIK.js} +2 -2
  11. package/dist/{chunk-KCPW4K7L.js → chunk-PZQUUBEB.js} +2 -2
  12. package/dist/{chunk-2AUDDDO2.js → chunk-XJARX6VV.js} +194 -23
  13. package/dist/chunk-XJARX6VV.js.map +1 -0
  14. package/dist/{chunk-5WJOPANS.js → chunk-Y5THZH5N.js} +7 -7
  15. package/dist/{chunk-462CH77G.js → chunk-ZUHGY36R.js} +181 -8
  16. package/dist/chunk-ZUHGY36R.js.map +1 -0
  17. package/dist/gmail-rest-mcp.js +8 -8
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.js +14 -12
  20. package/dist/interaction-tool-json-schema.d.ts +20 -0
  21. package/dist/{lazy-manifest-AJ6XPJ4F.js → lazy-manifest-BLZ3UZLX.js} +4 -4
  22. package/dist/{localSources-SSIEH5F5.js → localSources-I6SIQ6CX.js} +6 -6
  23. package/dist/model-call.js +3 -3
  24. package/dist/sandbox/browser-control-client.d.ts +10 -0
  25. package/dist/sandbox/browser-control-http.d.ts +33 -0
  26. package/dist/sandbox/index.js +7 -7
  27. package/dist/sandbox/routing/backend-resolver.d.ts +1 -0
  28. package/dist/sandbox/selfhosted/session.d.ts +19 -0
  29. package/dist/slack-rest-mcp.js +8 -8
  30. package/dist/workspace-tool-gateway.js +12 -12
  31. package/package.json +14 -14
  32. package/src/bundled_site_skills/opengeni-sites/SKILL.md +46 -12
  33. package/src/index.ts +39 -1
  34. package/src/interaction-tool-json-schema.ts +214 -0
  35. package/src/interaction-tools.ts +6 -6
  36. package/src/sandbox/browser-control-client.ts +89 -0
  37. package/src/sandbox/browser-control-http.ts +32 -0
  38. package/src/sandbox/routing/backend-resolver.ts +2 -0
  39. package/src/sandbox/selfhosted/session.ts +116 -0
  40. package/dist/agent-CTPLA3HP.js +0 -9
  41. package/dist/browser-action-json-schema.d.ts +0 -4
  42. package/dist/chunk-2AUDDDO2.js.map +0 -1
  43. package/dist/chunk-462CH77G.js.map +0 -1
  44. package/src/browser-action-json-schema.ts +0 -10
  45. /package/dist/{agent-CTPLA3HP.js.map → agent-LJT5NPWT.js.map} +0 -0
  46. /package/dist/{chunk-HJSIPTFA.js.map → chunk-4XDJ4TJA.js.map} +0 -0
  47. /package/dist/{chunk-XQ23VCZ4.js.map → chunk-6FQ6KEII.js.map} +0 -0
  48. /package/dist/{chunk-7LJ7KDPI.js.map → chunk-ERD4ICVB.js.map} +0 -0
  49. /package/dist/{chunk-YG26XE7B.js.map → chunk-JYDG2A7H.js.map} +0 -0
  50. /package/dist/{chunk-RSHQSLEJ.js.map → chunk-KIL4FGX5.js.map} +0 -0
  51. /package/dist/{chunk-NWS4HPB7.js.map → chunk-MIAL5I4O.js.map} +0 -0
  52. /package/dist/{chunk-7OUG7WBV.js.map → chunk-N5EB52EH.js.map} +0 -0
  53. /package/dist/{chunk-Z5U6WE22.js.map → chunk-PRZPGRIK.js.map} +0 -0
  54. /package/dist/{chunk-KCPW4K7L.js.map → chunk-PZQUUBEB.js.map} +0 -0
  55. /package/dist/{chunk-5WJOPANS.js.map → chunk-Y5THZH5N.js.map} +0 -0
  56. /package/dist/{lazy-manifest-AJ6XPJ4F.js.map → lazy-manifest-BLZ3UZLX.js.map} +0 -0
  57. /package/dist/{localSources-SSIEH5F5.js.map → localSources-I6SIQ6CX.js.map} +0 -0
@@ -18,7 +18,7 @@ import {
18
18
  shellQuote,
19
19
  tool,
20
20
  withSandboxSpan
21
- } from "./chunk-7LJ7KDPI.js";
21
+ } from "./chunk-ERD4ICVB.js";
22
22
 
23
23
  // ../../node_modules/.bun/@openai+agents-core@0.14.3+933c5e7db4cd33c2/node_modules/@openai/agents-core/dist/sandbox/capabilities/transport.mjs
24
24
  function supportsResponsesCompactionTransport(modelInstance) {
@@ -999,4 +999,4 @@ export {
999
999
  probeSandboxPathExists,
1000
1000
  SandboxAgent
1001
1001
  };
1002
- //# sourceMappingURL=chunk-HJSIPTFA.js.map
1002
+ //# sourceMappingURL=chunk-4XDJ4TJA.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  connectorAttachmentFileName
3
- } from "./chunk-Z5U6WE22.js";
3
+ } from "./chunk-PRZPGRIK.js";
4
4
  import {
5
5
  isRoutingMutationOutcomeUnknownError
6
- } from "./chunk-5WJOPANS.js";
6
+ } from "./chunk-Y5THZH5N.js";
7
7
 
8
8
  // src/gmail-rest-mcp.ts
9
9
  import {
@@ -2258,4 +2258,4 @@ export {
2258
2258
  gmailRestToolIsMutation,
2259
2259
  gmailRestResultOutcome
2260
2260
  };
2261
- //# sourceMappingURL=chunk-XQ23VCZ4.js.map
2261
+ //# sourceMappingURL=chunk-6FQ6KEII.js.map
@@ -27556,7 +27556,7 @@ var SandboxMemoryGenerationManager = class {
27556
27556
  if (!transcript) {
27557
27557
  throw new UserError(`Memory rollout transcript was not found: ${transcriptPath}`);
27558
27558
  }
27559
- const { SandboxAgent } = await import("./agent-CTPLA3HP.js");
27559
+ const { SandboxAgent } = await import("./agent-LJT5NPWT.js");
27560
27560
  const phaseOneAgent = new SandboxAgent({
27561
27561
  name: "sandbox-memory-phase-one",
27562
27562
  instructions: renderRolloutExtractionInstructions(generate.extraPrompt),
@@ -27617,7 +27617,7 @@ var SandboxMemoryGenerationManager = class {
27617
27617
  })) {
27618
27618
  return;
27619
27619
  }
27620
- const { SandboxAgent } = await import("./agent-CTPLA3HP.js");
27620
+ const { SandboxAgent } = await import("./agent-LJT5NPWT.js");
27621
27621
  const phaseTwoAgent = new SandboxAgent({
27622
27622
  name: "sandbox-memory-phase-two",
27623
27623
  model: generate.phaseTwoModel,
@@ -43273,6 +43273,7 @@ export {
43273
43273
  setTraceProcessors,
43274
43274
  setTracingDisabled,
43275
43275
  normalizeHostedMcpRequireApproval,
43276
+ defineToolInputGuardrail,
43276
43277
  ToolGuardrailFunctionOutputFactory,
43277
43278
  applyPatchTool,
43278
43279
  attachClientToolSearchExecutor,
@@ -43358,4 +43359,4 @@ export {
43358
43359
  Runner,
43359
43360
  Agent
43360
43361
  };
43361
- //# sourceMappingURL=chunk-7LJ7KDPI.js.map
43362
+ //# sourceMappingURL=chunk-ERD4ICVB.js.map
@@ -16,7 +16,7 @@ import {
16
16
  randomUUID,
17
17
  relativePosixPathWithinRoot,
18
18
  shellQuote
19
- } from "./chunk-7LJ7KDPI.js";
19
+ } from "./chunk-ERD4ICVB.js";
20
20
 
21
21
  // ../../node_modules/.bun/@openai+agents-core@0.14.3+933c5e7db4cd33c2/node_modules/@openai/agents-core/dist/sandbox/shared/output.mjs
22
22
  var APPROX_BYTES_PER_TOKEN = 4;
@@ -1231,4 +1231,4 @@ export {
1231
1231
  materializeLocalSourceManifest,
1232
1232
  materializeLocalSourceManifestEntry
1233
1233
  };
1234
- //# sourceMappingURL=chunk-YG26XE7B.js.map
1234
+ //# sourceMappingURL=chunk-JYDG2A7H.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  connectorAttachmentFileName
3
- } from "./chunk-Z5U6WE22.js";
3
+ } from "./chunk-PRZPGRIK.js";
4
4
  import {
5
5
  isRoutingMutationOutcomeUnknownError
6
- } from "./chunk-5WJOPANS.js";
6
+ } from "./chunk-Y5THZH5N.js";
7
7
 
8
8
  // src/slack-rest-mcp.ts
9
9
  import {
@@ -597,4 +597,4 @@ export {
597
597
  SLACK_REST_API_BASE2 as SLACK_REST_API_BASE,
598
598
  SLACK_REST_MCP_TOOLS
599
599
  };
600
- //# sourceMappingURL=chunk-RSHQSLEJ.js.map
600
+ //# sourceMappingURL=chunk-KIL4FGX5.js.map
@@ -3,7 +3,7 @@ import {
3
3
  UserError,
4
4
  cloneManifest,
5
5
  isRecord
6
- } from "./chunk-7LJ7KDPI.js";
6
+ } from "./chunk-ERD4ICVB.js";
7
7
 
8
8
  // ../../node_modules/.bun/@openai+agents-core@0.14.3+933c5e7db4cd33c2/node_modules/@openai/agents-core/dist/sandbox/client.mjs
9
9
  var DEFAULT_SANDBOX_ARCHIVE_LIMITS = {
@@ -91,4 +91,4 @@ export {
91
91
  NoopSnapshotSpec,
92
92
  isNoopSnapshotSpec
93
93
  };
94
- //# sourceMappingURL=chunk-NWS4HPB7.js.map
94
+ //# sourceMappingURL=chunk-MIAL5I4O.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-5ULGMFKR.js";
4
4
  import {
5
5
  MemorySession
6
- } from "./chunk-KCPW4K7L.js";
6
+ } from "./chunk-PZQUUBEB.js";
7
7
  import {
8
8
  BatchTraceProcessor,
9
9
  ModelBehaviorError,
@@ -34,7 +34,7 @@ import {
34
34
  tool,
35
35
  withGenerationSpan,
36
36
  withResponseSpan
37
- } from "./chunk-7LJ7KDPI.js";
37
+ } from "./chunk-ERD4ICVB.js";
38
38
  import {
39
39
  MCP_MAX_TOOL_DEFINITION_BYTES,
40
40
  MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES,
@@ -16218,4 +16218,4 @@ export {
16218
16218
  normalizeModelCallUsage,
16219
16219
  modelCallUsageTelemetry
16220
16220
  };
16221
- //# sourceMappingURL=chunk-7OUG7WBV.js.map
16221
+ //# sourceMappingURL=chunk-N5EB52EH.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isRoutingMutationOutcomeUnknownError,
3
3
  isRoutingMutationOutputRejectedError
4
- } from "./chunk-5WJOPANS.js";
4
+ } from "./chunk-Y5THZH5N.js";
5
5
  import {
6
6
  assertMcpPayloadWithinBytes
7
7
  } from "./chunk-LJNCGUMB.js";
@@ -164,4 +164,4 @@ export {
164
164
  connectorAttachmentSandboxPath,
165
165
  projectConnectorAttachmentTransfers
166
166
  };
167
- //# sourceMappingURL=chunk-Z5U6WE22.js.map
167
+ //# sourceMappingURL=chunk-PRZPGRIK.js.map
@@ -9,7 +9,7 @@ import {
9
9
  logToolActionError,
10
10
  logger,
11
11
  randomUUID
12
- } from "./chunk-7LJ7KDPI.js";
12
+ } from "./chunk-ERD4ICVB.js";
13
13
 
14
14
  // ../../node_modules/.bun/@openai+agents-core@0.14.3+933c5e7db4cd33c2/node_modules/@openai/agents-core/dist/mcpServers.mjs
15
15
  var DEFAULT_CONNECT_TIMEOUT_MS = 1e4;
@@ -828,4 +828,4 @@ export {
828
828
  connectMcpServers,
829
829
  MemorySession
830
830
  };
831
- //# sourceMappingURL=chunk-KCPW4K7L.js.map
831
+ //# sourceMappingURL=chunk-PZQUUBEB.js.map
@@ -21,7 +21,7 @@ import {
21
21
  withCommandNotStartedCallProof,
22
22
  withRunCredentialsClient,
23
23
  withRunCredentialsSession
24
- } from "./chunk-462CH77G.js";
24
+ } from "./chunk-ZUHGY36R.js";
25
25
  import {
26
26
  SKILL_MAX_FILES,
27
27
  SKILL_READ_MAX_OUTPUT_BYTES,
@@ -101,19 +101,19 @@ import {
101
101
  withModelRequestCapture,
102
102
  withModelTransportStartedObserver,
103
103
  withPreparedCompactionRequest
104
- } from "./chunk-7OUG7WBV.js";
104
+ } from "./chunk-N5EB52EH.js";
105
105
  import {
106
106
  GMAIL_REST_MCP_BRIDGE_ADAPTER,
107
107
  gmailRestResultOutcome,
108
108
  isOfficialGmailMcpConfig
109
- } from "./chunk-XQ23VCZ4.js";
109
+ } from "./chunk-6FQ6KEII.js";
110
110
  import {
111
111
  SLACK_REST_MCP_BRIDGE_ADAPTER
112
- } from "./chunk-RSHQSLEJ.js";
112
+ } from "./chunk-KIL4FGX5.js";
113
113
  import {
114
114
  ConnectorAttachmentTransferError,
115
115
  projectConnectorAttachmentTransfers
116
- } from "./chunk-Z5U6WE22.js";
116
+ } from "./chunk-PRZPGRIK.js";
117
117
  import {
118
118
  SelfhostedControlError,
119
119
  SynchronousCommandOutcomeUnknownError,
@@ -127,15 +127,15 @@ import {
127
127
  runWithToolCallCorrelation,
128
128
  withRoutingMutationOutputRejectionFence,
129
129
  wrapCapabilityToolsForTurnCancellation
130
- } from "./chunk-5WJOPANS.js";
130
+ } from "./chunk-Y5THZH5N.js";
131
131
  import {
132
132
  SandboxAgent,
133
133
  filesystem,
134
134
  shell
135
- } from "./chunk-HJSIPTFA.js";
135
+ } from "./chunk-4XDJ4TJA.js";
136
136
  import {
137
137
  connectMcpServers
138
- } from "./chunk-KCPW4K7L.js";
138
+ } from "./chunk-PZQUUBEB.js";
139
139
  import {
140
140
  Agent,
141
141
  AgentsError,
@@ -151,6 +151,7 @@ import {
151
151
  Usage,
152
152
  applyDiff,
153
153
  azureBlobMount,
154
+ defineToolInputGuardrail,
154
155
  dir,
155
156
  external_exports,
156
157
  file,
@@ -162,7 +163,7 @@ import {
162
163
  setDefaultModelProvider,
163
164
  setTracingDisabled,
164
165
  tool
165
- } from "./chunk-7LJ7KDPI.js";
166
+ } from "./chunk-ERD4ICVB.js";
166
167
  import {
167
168
  MCP_MAX_CONCURRENT_SERVER_OPERATIONS,
168
169
  MCP_MAX_RESPONSE_BYTES,
@@ -384,12 +385,151 @@ import {
384
385
  interactionControlFailureFromError
385
386
  } from "@opengeni/sdk";
386
387
 
387
- // src/browser-action-json-schema.ts
388
- function browserActionInputJsonSchema(schema) {
389
- return external_exports.toJSONSchema(schema, {
390
- target: "draft-2020-12",
391
- reused: "ref"
388
+ // src/interaction-tool-json-schema.ts
389
+ var VALIDATION_ONLY_KEYWORDS = /* @__PURE__ */ new Set(["$schema", "$id", "minLength", "maxLength"]);
390
+ var MEANINGFUL_NUMERIC_BOUND = 1e5;
391
+ var MEANINGFUL_MAX_ITEMS = 64;
392
+ var MEANINGFUL_PATTERN_LENGTH = 32;
393
+ function interactionToolInputJsonSchema(schema) {
394
+ const generated = external_exports.toJSONSchema(schema, { target: "draft-2020-12" });
395
+ return modelFacingSchema(generated);
396
+ }
397
+ var flattenedVariants = /* @__PURE__ */ new WeakMap();
398
+ function modelFacingSchema(node) {
399
+ if (Array.isArray(node)) return node.map(modelFacingSchema);
400
+ if (!isNode(node)) return node;
401
+ const out = {};
402
+ for (const [key, value] of Object.entries(node)) {
403
+ if (VALIDATION_ONLY_KEYWORDS.has(key)) continue;
404
+ if (key === "additionalProperties" && value === false) continue;
405
+ if ((key === "minimum" || key === "maximum") && typeof value === "number" && Math.abs(value) >= MEANINGFUL_NUMERIC_BOUND) {
406
+ continue;
407
+ }
408
+ if (key === "minItems" && typeof value === "number" && value <= 1) continue;
409
+ if (key === "maxItems" && typeof value === "number" && value > MEANINGFUL_MAX_ITEMS) continue;
410
+ if (key === "pattern" && typeof value === "string" && value.length > MEANINGFUL_PATTERN_LENGTH) {
411
+ continue;
412
+ }
413
+ out[key] = modelFacingSchema(value);
414
+ }
415
+ for (const unionKey of ["oneOf", "anyOf"]) {
416
+ const members = out[unionKey];
417
+ if (!Array.isArray(members)) continue;
418
+ const flattened = flattenTaggedUnion(members);
419
+ if (!flattened) continue;
420
+ delete out[unionKey];
421
+ const { description, ...rest } = flattened;
422
+ Object.assign(out, rest);
423
+ const own = typeof out.description === "string" ? out.description : "";
424
+ out.description = own ? `${own} ${String(description)}` : description;
425
+ flattenedVariants.set(out, flattenedVariants.get(flattened) ?? []);
426
+ }
427
+ return out;
428
+ }
429
+ function flattenTaggedUnion(members) {
430
+ if (members.length < 2 || !members.every(isObjectSchema)) return null;
431
+ const objects = members;
432
+ const tag = ["type", "kind", "operation"].find(
433
+ (candidate) => objects.every((member) => tagValues(member.properties[candidate]) !== null)
434
+ );
435
+ if (!tag) return null;
436
+ const variants = [];
437
+ const tagValuesInOrder = [];
438
+ const properties = /* @__PURE__ */ new Map();
439
+ for (const member of objects) {
440
+ const nested = flattenedVariants.get(member);
441
+ const required = new Set(Array.isArray(member.required) ? member.required : []);
442
+ if (nested) {
443
+ variants.push(...nested);
444
+ } else {
445
+ const fields = Object.keys(member.properties).filter((field) => field !== tag).map((field) => required.has(field) ? field : `${field}?`);
446
+ for (const value of tagValues(member.properties[tag])) variants.push([value, fields]);
447
+ }
448
+ for (const value of tagValues(member.properties[tag])) {
449
+ if (!tagValuesInOrder.includes(value)) tagValuesInOrder.push(value);
450
+ }
451
+ for (const [field, schema] of Object.entries(member.properties)) {
452
+ if (field === tag) continue;
453
+ const seen = properties.get(field) ?? [];
454
+ if (!seen.some((existing) => sameSchema(existing, schema))) seen.push(schema);
455
+ properties.set(field, seen);
456
+ }
457
+ }
458
+ const merged = {
459
+ [tag]: { type: "string", enum: tagValuesInOrder }
460
+ };
461
+ for (const [field, schemas] of properties) {
462
+ merged[field] = schemas.length === 1 ? schemas[0] : mergeAlternatives(schemas);
463
+ }
464
+ const summary = variants.map(([value, fields]) => fields.length > 0 ? `${value}: ${fields.join(", ")}` : value).join("; ");
465
+ const flattened = {
466
+ type: "object",
467
+ properties: merged,
468
+ required: [tag],
469
+ description: `Fields by ${tag} (? = optional): ${summary}.`
470
+ };
471
+ flattenedVariants.set(flattened, variants);
472
+ return flattened;
473
+ }
474
+ function mergeAlternatives(schemas) {
475
+ if (schemas.every((schema) => tagValues(schema) !== null)) {
476
+ return { type: "string", enum: [...new Set(schemas.flatMap((schema) => tagValues(schema)))] };
477
+ }
478
+ return { anyOf: schemas };
479
+ }
480
+ function tagValues(schema) {
481
+ if (!isNode(schema)) return null;
482
+ if (typeof schema.const === "string") return [schema.const];
483
+ if (Array.isArray(schema.enum) && schema.enum.length > 0 && schema.enum.every((value) => typeof value === "string")) {
484
+ return schema.enum;
485
+ }
486
+ return null;
487
+ }
488
+ function isObjectSchema(schema) {
489
+ return isNode(schema) && schema.type === "object" && isNode(schema.properties);
490
+ }
491
+ function sameSchema(left, right) {
492
+ return JSON.stringify(left) === JSON.stringify(right);
493
+ }
494
+ function isNode(value) {
495
+ return typeof value === "object" && value !== null && !Array.isArray(value);
496
+ }
497
+ var MAX_REPORTED_ISSUES = 4;
498
+ var MAX_ISSUE_MESSAGE_CHARS = 240;
499
+ function describeInvalidToolArguments(error) {
500
+ const issues = leafIssues(error.issues, []).slice(0, MAX_REPORTED_ISSUES);
501
+ const described = issues.map(({ path, message }) => {
502
+ const text = message.replace(/^Invalid input: /u, "").slice(0, MAX_ISSUE_MESSAGE_CHARS);
503
+ return path.length > 0 ? `${path.join(".")}: ${text}` : text;
392
504
  });
505
+ return `Interaction tool arguments are invalid: ${described.join("; ")}.`;
506
+ }
507
+ function leafIssues(issues, base) {
508
+ const leaves = [];
509
+ for (const issue of issues) {
510
+ const path = [...base, ...issue.path];
511
+ if (issue.code === "invalid_union" && issue.errors.length > 0) {
512
+ leaves.push(...leafIssues(chosenUnionBranch(issue.errors), path));
513
+ continue;
514
+ }
515
+ if (issue.code === "unrecognized_keys") {
516
+ leaves.push({ path, message: `unexpected field ${issue.keys.join(", ")}` });
517
+ continue;
518
+ }
519
+ leaves.push({ path, message: issue.message });
520
+ }
521
+ return leaves;
522
+ }
523
+ function chosenUnionBranch(branches) {
524
+ const tagMismatch = (issue) => issue.code === "invalid_union" && issue.errors.length === 0 || issue.code === "invalid_value" && ["type", "kind", "operation"].includes(String(issue.path.at(-1)));
525
+ const matching = branches.filter((branch) => !branch.some(tagMismatch));
526
+ if (matching.length > 0) {
527
+ return matching.reduce((best, branch) => branch.length < best.length ? branch : best);
528
+ }
529
+ const unknownTag = branches.find(
530
+ (branch) => branch.some((issue) => issue.code === "invalid_union" && issue.errors.length === 0)
531
+ );
532
+ return unknownTag?.filter((issue) => issue.code === "invalid_union") ?? branches.reduce((best, branch) => branch.length < best.length ? branch : best);
393
533
  }
394
534
 
395
535
  // src/interaction-tools.ts
@@ -882,7 +1022,7 @@ function createInteractionAttemptToolDefinitions(input) {
882
1022
  codemodePath: options.codemodePath,
883
1023
  title: options.title,
884
1024
  description: options.description,
885
- inputSchema: options.name === "browser_act" ? browserActionInputJsonSchema(options.input) : jsonSchema(options.input),
1025
+ inputSchema: interactionToolInputJsonSchema(options.input),
886
1026
  outputSchema: jsonSchema(options.output),
887
1027
  annotations: {
888
1028
  title: options.title,
@@ -2224,7 +2364,7 @@ async function safeInteractionExecution(inputSchema, outputSchema, raw, context,
2224
2364
  return result;
2225
2365
  } catch (error) {
2226
2366
  if (error instanceof external_exports.ZodError) {
2227
- return interactionErrorResult("invalid_arguments", "Interaction tool arguments are invalid.");
2367
+ return interactionErrorResult("invalid_arguments", describeInvalidToolArguments(error));
2228
2368
  }
2229
2369
  const secretReferenceFailure = secretReferenceToolResult(error);
2230
2370
  if (secretReferenceFailure) return secretReferenceFailure;
@@ -3101,6 +3241,7 @@ function createSecretArgumentResolver(input) {
3101
3241
  import {
3102
3242
  approvalIdentifier,
3103
3243
  INTERACTION_REQUEST_HUMAN_MODEL_TOOL_NAME as INTERACTION_REQUEST_HUMAN_MODEL_TOOL_NAME2,
3244
+ RequestHumanInteractionToolInput as RequestHumanInteractionToolInput2,
3104
3245
  CAPABILITY_DESCRIPTORS,
3105
3246
  DEFAULT_FIRST_PARTY_MCP_PERMISSIONS as DEFAULT_FIRST_PARTY_MCP_PERMISSIONS4,
3106
3247
  DEFAULT_FIRST_PARTY_MCP_TOOLS as DEFAULT_FIRST_PARTY_MCP_TOOLS2,
@@ -5111,7 +5252,7 @@ import { existsSync, readdirSync } from "fs";
5111
5252
  // ../sdk/package.json
5112
5253
  var package_default = {
5113
5254
  name: "@opengeni/sdk",
5114
- version: "3.2.2",
5255
+ version: "3.3.1-canary.38922642121001",
5115
5256
  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.",
5116
5257
  license: "Apache-2.0",
5117
5258
  repository: {
@@ -5333,7 +5474,7 @@ var package_default = {
5333
5474
  // ../react/package.json
5334
5475
  var package_default2 = {
5335
5476
  name: "@opengeni/react",
5336
- version: "3.2.2",
5477
+ version: "3.3.1-canary.38922642121001",
5337
5478
  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.",
5338
5479
  license: "Apache-2.0",
5339
5480
  repository: {
@@ -5670,7 +5811,7 @@ var package_default2 = {
5670
5811
  // ../codemode/package.json
5671
5812
  var package_default3 = {
5672
5813
  name: "@opengeni/codemode",
5673
- version: "3.2.2",
5814
+ version: "3.3.1-canary.38922642121001",
5674
5815
  description: "Attempt-frozen programmatic tool catalog and execution authority for Opengeni.",
5675
5816
  license: "Apache-2.0",
5676
5817
  repository: {
@@ -5720,7 +5861,7 @@ var package_default3 = {
5720
5861
  // ../ogtool/package.json
5721
5862
  var package_default4 = {
5722
5863
  name: "@opengeni/ogtool",
5723
- version: "3.2.2",
5864
+ version: "3.3.1-canary.38922642121001",
5724
5865
  description: "Codemode CLI and typed client entrypoint for an Opengeni execution attempt.",
5725
5866
  license: "Apache-2.0",
5726
5867
  repository: {
@@ -9367,6 +9508,18 @@ function activeModelToolInvocation(modelName) {
9367
9508
  const invocation = modelToolInvocation.getStore();
9368
9509
  return invocation?.modelName === modelName ? invocation : null;
9369
9510
  }
9511
+ function interactionRequestArgumentsProblem(serialized) {
9512
+ let value;
9513
+ try {
9514
+ value = JSON.parse(serialized);
9515
+ } catch {
9516
+ return "Invalid interaction_request_human arguments: they are not valid JSON. Nothing was requested; call it again with a JSON object matching its schema.";
9517
+ }
9518
+ const parsed = RequestHumanInteractionToolInput2.safeParse(value);
9519
+ if (parsed.success) return null;
9520
+ const issues = parsed.error.issues.slice(0, 5).map((issue) => `${issue.path.join(".") || "arguments"}: ${issue.message}`);
9521
+ return `Invalid interaction_request_human arguments: ${issues.join("; ")}. Nothing was requested; call it again with corrected arguments.`;
9522
+ }
9370
9523
  function installInteractionInterventionPolicy(agent, approvedToolCallId) {
9371
9524
  const approvalRequiredCallIds = /* @__PURE__ */ new Set();
9372
9525
  const listMcpTools = agent.getMcpTools.bind(agent);
@@ -9380,6 +9533,20 @@ function installInteractionInterventionPolicy(agent, approvedToolCallId) {
9380
9533
  const originalInvoke = tool2.invoke.bind(tool2);
9381
9534
  return {
9382
9535
  ...tool2,
9536
+ // Runs before the approval pause, so invalid arguments come back to
9537
+ // the model as a correctable tool result. Without it the call would
9538
+ // pause first, the intervention could never be recorded, and the
9539
+ // turn would fail.
9540
+ inputGuardrails: [
9541
+ ...tool2.inputGuardrails ?? [],
9542
+ defineToolInputGuardrail({
9543
+ name: "validate_interaction_request_human",
9544
+ run: async ({ toolCall }) => {
9545
+ const problem = interactionRequestArgumentsProblem(toolCall.arguments);
9546
+ return problem ? ToolGuardrailFunctionOutputFactory.rejectContent(problem) : ToolGuardrailFunctionOutputFactory.allow();
9547
+ }
9548
+ })
9549
+ ],
9383
9550
  needsApproval: async (_runContext, _parsedInput, callId) => {
9384
9551
  if (!callId) {
9385
9552
  throw new Error("Interaction intervention is missing its durable approval identity");
@@ -12309,7 +12476,10 @@ var PrefixedMcpServer = class _PrefixedMcpServer {
12309
12476
  return {
12310
12477
  ...tool2,
12311
12478
  name,
12312
- ...this.accountLabel ? {
12479
+ // Name the account only when the turn has several accounts of this
12480
+ // connector to tell apart. With one account the line adds nothing
12481
+ // the model can act on, and it would repeat on every tool.
12482
+ ...this.accountLabel?.account ? {
12313
12483
  description: `Account: ${this.accountLabel.model}. Use only this account; if the intended account for a write is unclear, ask before calling.
12314
12484
  ${tool2.description ?? ""}`.trimEnd()
12315
12485
  } : {}
@@ -13466,7 +13636,7 @@ async function runOwnedSandboxSetup(agent, session, setupSession, opts) {
13466
13636
  if (opts.recordLazyManifest) {
13467
13637
  const manifest = agent.defaultManifest;
13468
13638
  if (manifest) {
13469
- const { recordLazyMaterializedDirectories } = await import("./lazy-manifest-AJ6XPJ4F.js");
13639
+ const { recordLazyMaterializedDirectories } = await import("./lazy-manifest-BLZ3UZLX.js");
13470
13640
  await recordLazyMaterializedDirectories(session, manifest);
13471
13641
  }
13472
13642
  }
@@ -15942,6 +16112,7 @@ export {
15942
16112
  hasCanonicalEditableArtifactToolSurface,
15943
16113
  buildOpenGeniAgent,
15944
16114
  sessionMcpApprovalConnectionId,
16115
+ interactionRequestArgumentsProblem,
15945
16116
  withStructuredViewImageFunctionResults,
15946
16117
  buildAgentCapabilities,
15947
16118
  sandboxRunAs,
@@ -16006,4 +16177,4 @@ export {
16006
16177
  runAzureCliLoginHook,
16007
16178
  renderSessionGoalContext2 as renderSessionGoalContext
16008
16179
  };
16009
- //# sourceMappingURL=chunk-2AUDDDO2.js.map
16180
+ //# sourceMappingURL=chunk-XJARX6VV.js.map