@opengeni/runtime 3.3.0 → 3.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.
Files changed (64) hide show
  1. package/dist/agent-LJT5NPWT.js +9 -0
  2. package/dist/assets/codemode-client.json +1 -1
  3. package/dist/browser-current-tab.d.ts +46 -0
  4. package/dist/browser-model-text.d.ts +126 -0
  5. package/dist/{chunk-XRX57ZQO.js → chunk-3DFH3ZHU.js} +784 -121
  6. package/dist/chunk-3DFH3ZHU.js.map +1 -0
  7. package/dist/{chunk-HJSIPTFA.js → chunk-4XDJ4TJA.js} +2 -2
  8. package/dist/{chunk-XQ23VCZ4.js → chunk-6FQ6KEII.js} +3 -3
  9. package/dist/{chunk-7LJ7KDPI.js → chunk-ERD4ICVB.js} +4 -3
  10. package/dist/{chunk-EK7IW2FR.js → chunk-ETTCGPBT.js} +224 -6
  11. package/dist/chunk-ETTCGPBT.js.map +1 -0
  12. package/dist/{chunk-7OUG7WBV.js → chunk-GWRBALGQ.js} +181 -13
  13. package/dist/chunk-GWRBALGQ.js.map +1 -0
  14. package/dist/{chunk-YG26XE7B.js → chunk-JYDG2A7H.js} +2 -2
  15. package/dist/{chunk-RSHQSLEJ.js → chunk-KIL4FGX5.js} +3 -3
  16. package/dist/{chunk-NWS4HPB7.js → chunk-MIAL5I4O.js} +2 -2
  17. package/dist/{chunk-Z5U6WE22.js → chunk-PRZPGRIK.js} +2 -2
  18. package/dist/{chunk-KCPW4K7L.js → chunk-PZQUUBEB.js} +2 -2
  19. package/dist/{chunk-5WJOPANS.js → chunk-Y5THZH5N.js} +7 -7
  20. package/dist/codex-tool-search.d.ts +9 -0
  21. package/dist/gmail-rest-mcp.js +8 -8
  22. package/dist/index.d.ts +3 -0
  23. package/dist/index.js +14 -12
  24. package/dist/interaction-tool-json-schema.d.ts +27 -0
  25. package/dist/{lazy-manifest-AJ6XPJ4F.js → lazy-manifest-BLZ3UZLX.js} +4 -4
  26. package/dist/lazy-tool-transport.d.ts +10 -0
  27. package/dist/{localSources-SSIEH5F5.js → localSources-I6SIQ6CX.js} +6 -6
  28. package/dist/model-call.js +3 -3
  29. package/dist/sandbox/browser-control-client.d.ts +77 -0
  30. package/dist/sandbox/index.d.ts +1 -1
  31. package/dist/sandbox/index.js +7 -7
  32. package/dist/sandbox/selfhosted/session.d.ts +3 -0
  33. package/dist/slack-rest-mcp.js +8 -8
  34. package/dist/workspace-tool-gateway.js +12 -12
  35. package/package.json +14 -14
  36. package/src/browser-current-tab.ts +139 -0
  37. package/src/browser-model-text.ts +378 -0
  38. package/src/codex-tool-search.ts +53 -0
  39. package/src/index.ts +39 -1
  40. package/src/interaction-tool-json-schema.ts +281 -0
  41. package/src/interaction-tools.ts +425 -235
  42. package/src/lazy-tool-transport.ts +229 -10
  43. package/src/model-input.ts +12 -1
  44. package/src/sandbox/browser-control-client.ts +336 -0
  45. package/src/sandbox/index.ts +4 -0
  46. package/src/sandbox/selfhosted/session.ts +38 -0
  47. package/dist/agent-CTPLA3HP.js +0 -9
  48. package/dist/browser-action-json-schema.d.ts +0 -4
  49. package/dist/chunk-7OUG7WBV.js.map +0 -1
  50. package/dist/chunk-EK7IW2FR.js.map +0 -1
  51. package/dist/chunk-XRX57ZQO.js.map +0 -1
  52. package/src/browser-action-json-schema.ts +0 -10
  53. /package/dist/{agent-CTPLA3HP.js.map → agent-LJT5NPWT.js.map} +0 -0
  54. /package/dist/{chunk-HJSIPTFA.js.map → chunk-4XDJ4TJA.js.map} +0 -0
  55. /package/dist/{chunk-XQ23VCZ4.js.map → chunk-6FQ6KEII.js.map} +0 -0
  56. /package/dist/{chunk-7LJ7KDPI.js.map → chunk-ERD4ICVB.js.map} +0 -0
  57. /package/dist/{chunk-YG26XE7B.js.map → chunk-JYDG2A7H.js.map} +0 -0
  58. /package/dist/{chunk-RSHQSLEJ.js.map → chunk-KIL4FGX5.js.map} +0 -0
  59. /package/dist/{chunk-NWS4HPB7.js.map → chunk-MIAL5I4O.js.map} +0 -0
  60. /package/dist/{chunk-Z5U6WE22.js.map → chunk-PRZPGRIK.js.map} +0 -0
  61. /package/dist/{chunk-KCPW4K7L.js.map → chunk-PZQUUBEB.js.map} +0 -0
  62. /package/dist/{chunk-5WJOPANS.js.map → chunk-Y5THZH5N.js.map} +0 -0
  63. /package/dist/{lazy-manifest-AJ6XPJ4F.js.map → lazy-manifest-BLZ3UZLX.js.map} +0 -0
  64. /package/dist/{localSources-SSIEH5F5.js.map → localSources-I6SIQ6CX.js.map} +0 -0
@@ -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,
@@ -13125,6 +13125,36 @@ function familyCompanions(disclosed, pool) {
13125
13125
  }
13126
13126
  return companions;
13127
13127
  }
13128
+ var INTERACTION_ENTRY_TOOLS = /* @__PURE__ */ new Set(["browser_open", "computer_open"]);
13129
+ function isInteractionEntryFunctionTool(tool2, mcpServerIds = NO_MCP_SERVER_IDS, modelServerIds) {
13130
+ if (!tool2 || typeof tool2 !== "object" || tool2.type !== "function") {
13131
+ return false;
13132
+ }
13133
+ const name = tool2.name;
13134
+ if (typeof name !== "string" || !isInteractionEntryToolName(name)) return false;
13135
+ const serverId = mcpServerIdForTool(tool2, mcpServerIds, modelServerIds);
13136
+ return serverId === null || serverId === INTERACTION_MCP_SERVER_ID;
13137
+ }
13138
+ function isInteractionEntryToolName(name) {
13139
+ const short = interactionToolName(name);
13140
+ return short !== null && INTERACTION_ENTRY_TOOLS.has(short);
13141
+ }
13142
+ function interactionEntryCompanions(entryName, searchable) {
13143
+ if (!isInteractionEntryToolName(entryName)) return [];
13144
+ const pool = searchable.filter(
13145
+ (tool2) => tool2.type === "function" && typeof tool2.name === "string"
13146
+ );
13147
+ const disclosed = [];
13148
+ let disclosedBytes = 0;
13149
+ for (const tool2 of familyCompanions([{ name: entryName }], pool)) {
13150
+ const toolBytes = mcpSerializedSizeBytes(tool2);
13151
+ if (toolBytes > MCP_MAX_TOOL_DEFINITION_BYTES) continue;
13152
+ if (disclosedBytes + toolBytes > MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES) continue;
13153
+ disclosedBytes += toolBytes;
13154
+ disclosed.push(tool2);
13155
+ }
13156
+ return disclosed;
13157
+ }
13128
13158
  function isHarnessControlMcpFunctionTool(tool2, mcpServerIds = NO_MCP_SERVER_IDS, modelServerIds) {
13129
13159
  const serverId = mcpServerIdForTool(tool2, mcpServerIds, modelServerIds);
13130
13160
  return serverId !== null && isHarnessControlMcpToolName(serverId, tool2.name);
@@ -13421,6 +13451,8 @@ var ALWAYS_VISIBLE_BASE_TOOL_NAMES = /* @__PURE__ */ new Set([
13421
13451
  ]);
13422
13452
  var DISPATCH_MARKER_KEY = "opengeni.lazy_dispatch.v1";
13423
13453
  var SEARCH_MARKER_KEY = "opengeni.lazy_search.v1";
13454
+ var FAMILY_DISCLOSURE_MARKER_KEY = "opengeni.family_disclosure.v1";
13455
+ var FAMILY_DISCLOSURE_CALL_PREFIX = "opengeni:family:";
13424
13456
  var INTERNAL_REGISTRATION_TOOL_MARKER_KEY = "opengeni.internal_lazy_registration.v1";
13425
13457
  var INTERNAL_DISPATCH_REGISTRATION_CALL_PREFIX = "opengeni:lazy-dispatch:register:";
13426
13458
  var SEARCH_DESCRIPTION = "Search the currently authorized tools by capability. Describe what you need to do in plain language. Returns matching tool names and input schemas. Search is ranked, not exhaustive: if relevant tools are missing, use tool_list to browse, then pass exact names here with query set to an empty string. Names selects exact tools only; it does not broaden authorization.";
@@ -13610,6 +13642,7 @@ var LazyToolRuntime = class {
13610
13642
  if (ALWAYS_VISIBLE_BASE_TOOL_NAMES.has(tool2.name)) continue;
13611
13643
  if (this.preparationIndependentToolNames.has(tool2.name)) continue;
13612
13644
  if (isHarnessControlMcpFunctionTool(tool2, this.mcpServerIds, modelServerIds)) continue;
13645
+ if (isInteractionEntryFunctionTool(tool2, this.mcpServerIds, modelServerIds)) continue;
13613
13646
  const lazy = isSearchableMcpFunctionTool(tool2, this.deferredMcpServerIds, modelServerIds) || !isSearchableMcpFunctionTool(tool2, this.mcpServerIds, modelServerIds);
13614
13647
  if (lazy) {
13615
13648
  tool2.deferLoading = false;
@@ -13666,6 +13699,11 @@ var LazyToolRuntime = class {
13666
13699
  search(rawArguments) {
13667
13700
  return searchToolPool(this.searchableTools(this.currentTools), rawArguments);
13668
13701
  }
13702
+ /** Model-visible schemas an entry-tool call discloses, or [] for any other tool. */
13703
+ familyDisclosure(toolName) {
13704
+ if (!isInteractionEntryToolName(toolName)) return [];
13705
+ return interactionEntryCompanions(toolName, this.searchableTools(this.currentTools)).map((tool2) => modelVisibleToolDefinition(tool2)).filter((definition) => definition !== null);
13706
+ }
13669
13707
  genericSearchOutput(rawArguments) {
13670
13708
  const definitions = [];
13671
13709
  for (const tool2 of this.search(rawArguments)) {
@@ -13876,6 +13914,7 @@ function restoredProviderData(providerData) {
13876
13914
  const restored = { ...providerData };
13877
13915
  delete restored[DISPATCH_MARKER_KEY];
13878
13916
  delete restored[SEARCH_MARKER_KEY];
13917
+ delete restored[FAMILY_DISCLOSURE_MARKER_KEY];
13879
13918
  return Object.keys(restored).length > 0 ? restored : void 0;
13880
13919
  }
13881
13920
  function restoreGenericDispatchHistory(input) {
@@ -13900,7 +13939,8 @@ function restoreGenericDispatchHistoryItem(candidate) {
13900
13939
  const hasDispatchMarker = isRecord7(marker) && marker.version === 1 && typeof marker.arguments === "string";
13901
13940
  const searchMarker = providerData?.[SEARCH_MARKER_KEY];
13902
13941
  const hasSearchMarker = isRecord7(searchMarker) && searchMarker.version === 1 && typeof searchMarker.output === "string";
13903
- if (!hasDispatchMarker && !hasSearchMarker) {
13942
+ const hasFamilyMarker = providerData !== void 0 && FAMILY_DISCLOSURE_MARKER_KEY in providerData;
13943
+ if (!hasDispatchMarker && !hasSearchMarker && !hasFamilyMarker) {
13904
13944
  return candidate;
13905
13945
  }
13906
13946
  const restored = { ...candidate };
@@ -14012,14 +14052,140 @@ function restoreDirectDeferredCallArgumentTypes(candidate, runtime) {
14012
14052
  const restored = restoreDeferredToolArgumentTypes(candidate.arguments, tool2.parameters);
14013
14053
  return restored === null ? candidate : { ...candidate, arguments: restored };
14014
14054
  }
14015
- function transformGenericDispatchResponse(response, runtime) {
14055
+ function transformResponseItem(item, runtime) {
14056
+ const items = runtime.transport === "generic_dispatch" ? transformGenericDispatchCall(item, runtime) : [item];
14057
+ return items.map((candidate) => withFamilyDisclosure(candidate, runtime));
14058
+ }
14059
+ function transformResponseOutput(output, runtime) {
14060
+ const transformed = output.flatMap((item) => transformResponseItem(item, runtime));
14061
+ const unchanged = transformed.length === output.length && transformed.every((item, index) => item === output[index]);
14062
+ return unchanged ? output : transformed;
14063
+ }
14064
+ function withFamilyDisclosure(candidate, runtime) {
14065
+ if (!isRecord7(candidate) || candidate.type !== "function_call") return candidate;
14066
+ if (typeof candidate.name !== "string" || !isInteractionEntryToolName(candidate.name)) {
14067
+ return candidate;
14068
+ }
14069
+ const providerData = isRecord7(candidate.providerData) ? candidate.providerData : {};
14070
+ if (FAMILY_DISCLOSURE_MARKER_KEY in providerData) return candidate;
14071
+ const tools = runtime.familyDisclosure(candidate.name);
14072
+ if (tools.length === 0) return candidate;
14016
14073
  return {
14017
- ...response,
14018
- output: response.output.flatMap(
14019
- (item) => transformGenericDispatchCall(item, runtime)
14020
- )
14074
+ ...candidate,
14075
+ providerData: {
14076
+ ...providerData,
14077
+ [FAMILY_DISCLOSURE_MARKER_KEY]: {
14078
+ version: 1,
14079
+ format: runtime.transport === "generic_dispatch" ? "generic" : "native",
14080
+ tools
14081
+ }
14082
+ }
14021
14083
  };
14022
14084
  }
14085
+ function familyDisclosureMarker(candidate) {
14086
+ const providerData = isRecord7(candidate.providerData) ? candidate.providerData : null;
14087
+ const marker = providerData?.[FAMILY_DISCLOSURE_MARKER_KEY];
14088
+ if (!isRecord7(marker) || marker.version !== 1 || marker.format !== "native" && marker.format !== "generic" || !Array.isArray(marker.tools)) {
14089
+ return null;
14090
+ }
14091
+ const tools = marker.tools.filter(
14092
+ (tool2) => isRecord7(tool2) && typeof tool2.name === "string"
14093
+ );
14094
+ return { version: 1, format: marker.format, tools };
14095
+ }
14096
+ function disclosedToolNames(tools) {
14097
+ if (!Array.isArray(tools)) return [];
14098
+ return tools.flatMap(
14099
+ (tool2) => isRecord7(tool2) && typeof tool2.name === "string" ? [tool2.name] : []
14100
+ );
14101
+ }
14102
+ function genericSearchOutputNames(output) {
14103
+ const parsed = parseJsonObject(output);
14104
+ return parsed ? disclosedToolNames(parsed.tools) : [];
14105
+ }
14106
+ function expandInteractionFamilyDisclosures(input) {
14107
+ const pending = /* @__PURE__ */ new Map();
14108
+ const disclosed = /* @__PURE__ */ new Set();
14109
+ let expanded = null;
14110
+ for (let index = 0; index < input.length; index += 1) {
14111
+ const original = input[index];
14112
+ expanded?.push(original);
14113
+ const candidate = original;
14114
+ if (!isRecord7(candidate)) continue;
14115
+ if (candidate.type === "tool_search_output") {
14116
+ for (const name of disclosedToolNames(candidate.tools)) disclosed.add(name);
14117
+ continue;
14118
+ }
14119
+ if (candidate.type === "function_call") {
14120
+ const providerData = isRecord7(candidate.providerData) ? candidate.providerData : null;
14121
+ const searchMarker = providerData?.[SEARCH_MARKER_KEY];
14122
+ if (isRecord7(searchMarker) && typeof searchMarker.output === "string") {
14123
+ for (const name of genericSearchOutputNames(searchMarker.output)) disclosed.add(name);
14124
+ }
14125
+ const id2 = callId2(candidate);
14126
+ const marker2 = familyDisclosureMarker(candidate);
14127
+ if (id2 && marker2) pending.set(id2, marker2);
14128
+ continue;
14129
+ }
14130
+ if (candidate.type === "function_call_result" && candidate.name === TOOL_SEARCH_NAME) {
14131
+ if (typeof candidate.output === "string") {
14132
+ for (const name of genericSearchOutputNames(candidate.output)) disclosed.add(name);
14133
+ }
14134
+ continue;
14135
+ }
14136
+ if (candidate.type !== "function_call_result") continue;
14137
+ const id = callId2(candidate);
14138
+ const marker = id ? pending.get(id) : void 0;
14139
+ if (!id || !marker) continue;
14140
+ pending.delete(id);
14141
+ const tools = marker.tools.filter((tool2) => !disclosed.has(String(tool2.name)));
14142
+ if (tools.length === 0) continue;
14143
+ for (const tool2 of tools) disclosed.add(String(tool2.name));
14144
+ expanded ??= input.slice(0, index + 1);
14145
+ expanded.push(...cachedFamilyDisclosureItems(candidate, id, marker.format, tools));
14146
+ }
14147
+ return expanded ?? input;
14148
+ }
14149
+ var familyDisclosureItemCache = /* @__PURE__ */ new WeakMap();
14150
+ function cachedFamilyDisclosureItems(result, id, format, tools) {
14151
+ const key = `${format}\0${tools.map((tool2) => String(tool2.name)).join("\0")}`;
14152
+ const cached = familyDisclosureItemCache.get(result);
14153
+ if (cached?.key === key) return cached.items;
14154
+ const items = familyDisclosureItems(`${FAMILY_DISCLOSURE_CALL_PREFIX}${id}`, format, tools);
14155
+ familyDisclosureItemCache.set(result, { key, items });
14156
+ return items;
14157
+ }
14158
+ function familyDisclosureItems(id, format, tools) {
14159
+ const names = tools.map((tool2) => String(tool2.name));
14160
+ if (format === "native") {
14161
+ return [
14162
+ {
14163
+ type: "tool_search_call",
14164
+ call_id: id,
14165
+ status: "completed",
14166
+ execution: "client",
14167
+ arguments: { query: "", names }
14168
+ },
14169
+ { type: "tool_search_output", call_id: id, status: "completed", execution: "client", tools }
14170
+ ];
14171
+ }
14172
+ return [
14173
+ {
14174
+ type: "function_call",
14175
+ callId: id,
14176
+ name: TOOL_SEARCH_NAME,
14177
+ arguments: JSON.stringify({ query: "", names }),
14178
+ status: "completed"
14179
+ },
14180
+ {
14181
+ type: "function_call_result",
14182
+ callId: id,
14183
+ name: TOOL_SEARCH_NAME,
14184
+ status: "completed",
14185
+ output: JSON.stringify({ tools })
14186
+ }
14187
+ ];
14188
+ }
14023
14189
  function prepareLazyToolRequest(request, runtime) {
14024
14190
  const input = restoreGenericSearchResults(request.input);
14025
14191
  return {
@@ -14044,7 +14210,7 @@ var LazyToolModel = class {
14044
14210
  if (responseRequiresToolPreparation(response, this.runtime)) {
14045
14211
  await this.runtime.ensurePrepared();
14046
14212
  }
14047
- return this.runtime.transport === "generic_dispatch" ? transformGenericDispatchResponse(response, this.runtime) : response;
14213
+ return { ...response, output: transformResponseOutput(response.output, this.runtime) };
14048
14214
  }
14049
14215
  async *getStreamedResponse(request) {
14050
14216
  await beforeModelRequest("model_entry");
@@ -14057,12 +14223,13 @@ var LazyToolModel = class {
14057
14223
  await this.runtime.ensurePrepared();
14058
14224
  }
14059
14225
  }
14060
- const delivered = this.runtime.transport === "generic_dispatch" && event.type === "response_done" ? {
14226
+ const delivered = event.type === "response_done" ? {
14061
14227
  ...event,
14062
14228
  response: {
14063
14229
  ...event.response,
14064
- output: event.response.output.flatMap(
14065
- (item) => transformGenericDispatchCall(item, this.runtime)
14230
+ output: transformResponseOutput(
14231
+ event.response.output,
14232
+ this.runtime
14066
14233
  )
14067
14234
  }
14068
14235
  } : event;
@@ -16192,6 +16359,7 @@ export {
16192
16359
  restoreGenericDispatchHistoryItem,
16193
16360
  restoreGenericDispatchHistoryItems,
16194
16361
  restoreDirectDeferredCallArgumentTypes,
16362
+ expandInteractionFamilyDisclosures,
16195
16363
  LazyToolModelProvider,
16196
16364
  AssistantMessagePhaseTracker,
16197
16365
  HUMAN_INPUT_TOOL_NAME,
@@ -16218,4 +16386,4 @@ export {
16218
16386
  normalizeModelCallUsage,
16219
16387
  modelCallUsageTelemetry
16220
16388
  };
16221
- //# sourceMappingURL=chunk-7OUG7WBV.js.map
16389
+ //# sourceMappingURL=chunk-GWRBALGQ.js.map