@opengeni/runtime 4.0.0 → 4.0.1-canary.35916963870001
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.
- package/dist/assets/codemode-client.json +1 -1
- package/dist/{chunk-WIHICNWS.js → chunk-JFMOX5OE.js} +63 -11
- package/dist/chunk-JFMOX5OE.js.map +1 -0
- package/dist/{chunk-5HJEVOMJ.js → chunk-ROCWOHGM.js} +138 -30
- package/dist/chunk-ROCWOHGM.js.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +6 -2
- package/dist/operational-instructions.d.ts +1 -1
- package/dist/sandbox/browser-control-client.d.ts +20 -0
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/routing/routing-session.d.ts +2 -1
- package/dist/sandbox/turn-tool-cancellation.d.ts +1 -1
- package/dist/workspace-tool-gateway.js +2 -2
- package/package.json +11 -11
- package/src/bundled_default_skills/opengeni-help/SKILL.md +14 -0
- package/src/bundled_management_skills/opengeni-skills/SKILL.md +1 -1
- package/src/bundled_site_skills/opengeni-sites/SKILL.md +23 -2
- package/src/index.ts +97 -16
- package/src/interaction-tools.ts +72 -13
- package/src/operational-instructions.ts +5 -1
- package/src/sandbox/browser-control-client.ts +109 -23
- package/src/sandbox/routing/routing-session.ts +6 -1
- package/src/sandbox/turn-tool-cancellation.ts +12 -2
- package/dist/chunk-5HJEVOMJ.js.map +0 -1
- package/dist/chunk-WIHICNWS.js.map +0 -1
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
withRunCredentialsClient,
|
|
27
27
|
withRunCredentialsSession,
|
|
28
28
|
wrapCapabilityToolsForTurnCancellation
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-JFMOX5OE.js";
|
|
30
30
|
import {
|
|
31
31
|
MemorySession,
|
|
32
32
|
connectMcpServers
|
|
@@ -10316,6 +10316,8 @@ Display images with . Use the exac
|
|
|
10316
10316
|
|
|
10317
10317
|
Publish files you deliberately deliver so they are retained and discoverable in Artifacts; do not publish every temporary file. Reuse retained references for unchanged outputs. Source-code navigation may still use workspace file links. Inline HTML stays in chat unless explicitly saved as a Site.
|
|
10318
10318
|
|
|
10319
|
+
For published files, [Open file](artifact:<artifactId>) opens the retained file in Artifacts.  displays images, video, audio, or PDFs inline in the OpenGeni console, with an Artifact link for other formats. Replace <artifactId> with the exact artifact.artifactId from the publication receipt and use a descriptive label. Sites and native documents keep their tool-returned canonical links. Never substitute a storage URL or a sandbox path for a published artifact reference.
|
|
10320
|
+
|
|
10319
10321
|
# Rules for getting work done
|
|
10320
10322
|
|
|
10321
10323
|
- When you search for text or files, you reach first for \`rg\` or \`rg --files\`; they are much faster than alternatives like \`grep\`. If \`rg\` is unavailable, you use the next best tool without fuss.
|
|
@@ -10353,6 +10355,8 @@ When presented with clarifying questions or objections from the user, lead with
|
|
|
10353
10355
|
|
|
10354
10356
|
If completion requires new authority, external coordination, or a meaningful expansion beyond the user\u2019s implied intent and task scope (e.g. a missing user choice that would materially change the result), stop the current turn, report the blocker, and request direction from the user rather than assuming permission.
|
|
10355
10357
|
|
|
10358
|
+
Decide the design before building it. First check whether OpenGeni already provides the capability natively (for example, a Site reaches the model and workspace tools through the host bridge and needs no server of its own). If a native path fits, use it. Follow the project's established architecture and choices the user has already authorized or delegated; the user need not name each host, provider, or credential. Ask before making a new external commitment or materially departing from the established architecture beyond the authorized scope: name the candidate designs, and do not start parallel work that assumes the unresolved choice. The absence of a native path alone does not require a question; continue with routine implementation choices within scope.
|
|
10359
|
+
|
|
10356
10360
|
# Destructive Actions
|
|
10357
10361
|
|
|
10358
10362
|
Be cautious with commands or API calls that can delete, overwrite, or otherwise make data difficult to recover.
|
|
@@ -10385,7 +10389,7 @@ Skills are reusable instructions supplied dynamically for the current session. W
|
|
|
10385
10389
|
|
|
10386
10390
|
# Integration setup
|
|
10387
10391
|
|
|
10388
|
-
Use available integration tools directly. If the task needs an integration you cannot access, discover it with \`capability_catalog_search\` before declaring a setup blocker. For a suitable match with \`setup.nextAction\`, call \`capability_authorization_request\` with the returned capability ID and a brief task-specific rationale to show its Connect card in chat. Requesting the card does not need integration-management permission; the authenticated human must authorize setup. After setup, rediscover the tools and continue the task, verifying the access it needs. If access remains blocked, explain the specific blocker from the returned facts. If either setup tool is unavailable, report the missing setup path.
|
|
10392
|
+
Use available integration tools directly. If the task needs an integration you cannot access, discover it with \`capability_catalog_search\` before declaring a setup blocker. For a suitable match with \`setup.nextAction\`, call \`capability_authorization_request\` with the returned capability ID and a brief task-specific rationale to show its Connect card in chat. Requesting the card does not need integration-management permission; the authenticated human must authorize setup. A card is for an integration required by the authorized design, including established or delegated choices. Resolve out-of-scope architecture choices before requesting setup. After setup, rediscover the tools and continue the task, verifying the access it needs. If access remains blocked, explain the specific blocker from the returned facts. If either setup tool is unavailable, report the missing setup path.
|
|
10389
10393
|
|
|
10390
10394
|
# Session coordination
|
|
10391
10395
|
|
|
@@ -12344,7 +12348,7 @@ import { existsSync, readdirSync } from "fs";
|
|
|
12344
12348
|
// ../sdk/package.json
|
|
12345
12349
|
var package_default = {
|
|
12346
12350
|
name: "@opengeni/sdk",
|
|
12347
|
-
version: "7.0.
|
|
12351
|
+
version: "7.1.0-canary.35916963870001",
|
|
12348
12352
|
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.",
|
|
12349
12353
|
license: "Apache-2.0",
|
|
12350
12354
|
repository: {
|
|
@@ -12496,7 +12500,7 @@ var package_default = {
|
|
|
12496
12500
|
// ../react/package.json
|
|
12497
12501
|
var package_default2 = {
|
|
12498
12502
|
name: "@opengeni/react",
|
|
12499
|
-
version: "7.0.
|
|
12503
|
+
version: "7.1.0-canary.35916963870001",
|
|
12500
12504
|
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.",
|
|
12501
12505
|
license: "Apache-2.0",
|
|
12502
12506
|
repository: {
|
|
@@ -12749,7 +12753,7 @@ var package_default2 = {
|
|
|
12749
12753
|
// ../codemode/package.json
|
|
12750
12754
|
var package_default3 = {
|
|
12751
12755
|
name: "@opengeni/codemode",
|
|
12752
|
-
version: "0.6.
|
|
12756
|
+
version: "0.6.1-canary.35916963870001",
|
|
12753
12757
|
description: "Attempt-frozen programmatic tool catalog and execution authority for OpenGeni.",
|
|
12754
12758
|
license: "Apache-2.0",
|
|
12755
12759
|
repository: {
|
|
@@ -12799,7 +12803,7 @@ var package_default3 = {
|
|
|
12799
12803
|
// ../ogtool/package.json
|
|
12800
12804
|
var package_default4 = {
|
|
12801
12805
|
name: "@opengeni/ogtool",
|
|
12802
|
-
version: "0.3.
|
|
12806
|
+
version: "0.3.43-canary.35916963870001",
|
|
12803
12807
|
description: "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
|
|
12804
12808
|
license: "Apache-2.0",
|
|
12805
12809
|
repository: {
|
|
@@ -15149,7 +15153,8 @@ var BrowserTabsInput = external_exports.discriminatedUnion("operation", [
|
|
|
15149
15153
|
]);
|
|
15150
15154
|
var BrowserObserveInput = external_exports.object({
|
|
15151
15155
|
browserSessionId: external_exports.string().uuid(),
|
|
15152
|
-
targetId: external_exports.string().min(1).max(512)
|
|
15156
|
+
targetId: external_exports.string().min(1).max(512),
|
|
15157
|
+
includeScreenshot: external_exports.boolean().optional()
|
|
15153
15158
|
}).strict();
|
|
15154
15159
|
var BrowserActInput = external_exports.object({
|
|
15155
15160
|
browserSessionId: external_exports.string().uuid(),
|
|
@@ -15289,7 +15294,7 @@ var ComputerActInput = external_exports.object({
|
|
|
15289
15294
|
computerSessionId: external_exports.string().uuid(),
|
|
15290
15295
|
targetId: external_exports.string().min(1).max(512),
|
|
15291
15296
|
expectedTargetGeneration: external_exports.string().min(1).max(256).optional(),
|
|
15292
|
-
expectedObservationId:
|
|
15297
|
+
expectedObservationId: ComputerObservation.shape.observationId.nullable().optional(),
|
|
15293
15298
|
expectedFrameId: external_exports.string().min(1).max(256).nullable().optional(),
|
|
15294
15299
|
action: ComputerAction
|
|
15295
15300
|
}).strict();
|
|
@@ -15380,7 +15385,7 @@ function createInteractionAttemptToolDefinitions(input) {
|
|
|
15380
15385
|
name: "browser_open",
|
|
15381
15386
|
codemodePath: ["interaction", "browser", "open"],
|
|
15382
15387
|
title: "Open or reuse browser",
|
|
15383
|
-
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.",
|
|
15388
|
+
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.",
|
|
15384
15389
|
input: BrowserOpenInput,
|
|
15385
15390
|
output: BrowserOpenOutput,
|
|
15386
15391
|
readOnly: false,
|
|
@@ -15391,7 +15396,7 @@ function createInteractionAttemptToolDefinitions(input) {
|
|
|
15391
15396
|
name: "browser_tabs",
|
|
15392
15397
|
codemodePath: ["interaction", "browser", "tabs"],
|
|
15393
15398
|
title: "Manage browser tabs",
|
|
15394
|
-
description: "List, open, select, or close tabs in one exact BrowserSession. Returns the authoritative complete tab list after the operation.",
|
|
15399
|
+
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.",
|
|
15395
15400
|
input: BrowserTabsInput,
|
|
15396
15401
|
output: BrowserTargetListResponse,
|
|
15397
15402
|
readOnly: false,
|
|
@@ -15421,22 +15426,47 @@ function createInteractionAttemptToolDefinitions(input) {
|
|
|
15421
15426
|
name: "browser_observe",
|
|
15422
15427
|
codemodePath: ["interaction", "browser", "observe"],
|
|
15423
15428
|
title: "Observe browser tab",
|
|
15424
|
-
description: "Read one tab's current URL/title, causal generations, compact semantic accessibility tree, dialog, and diagnostic counts without taking control.",
|
|
15429
|
+
description: "Read one tab's current URL/title, measured page viewport, causal generations, compact semantic accessibility tree, dialog, and diagnostic counts without taking control. Set includeScreenshot=true to receive a current still image as tool image content; the structured screenshot field is only a retained-artifact reference and can remain null.",
|
|
15425
15430
|
input: BrowserObserveInput,
|
|
15426
15431
|
output: BrowserObservation,
|
|
15427
15432
|
readOnly: true,
|
|
15428
15433
|
idempotent: true,
|
|
15429
|
-
execute: async (value) =>
|
|
15430
|
-
input.
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
+
execute: async (value) => {
|
|
15435
|
+
let observation = await input.transport.observeBrowserTarget(
|
|
15436
|
+
input.workspaceId,
|
|
15437
|
+
value.browserSessionId,
|
|
15438
|
+
value.targetId
|
|
15439
|
+
);
|
|
15440
|
+
if (!value.includeScreenshot) return observation;
|
|
15441
|
+
const frame = await input.transport.captureBrowserTarget(
|
|
15442
|
+
input.workspaceId,
|
|
15443
|
+
value.browserSessionId,
|
|
15444
|
+
value.targetId
|
|
15445
|
+
);
|
|
15446
|
+
if (observation.target.targetGeneration !== frame.targetGeneration || observation.target.documentGeneration !== frame.documentGeneration) {
|
|
15447
|
+
observation = await input.transport.observeBrowserTarget(
|
|
15448
|
+
input.workspaceId,
|
|
15449
|
+
value.browserSessionId,
|
|
15450
|
+
value.targetId
|
|
15451
|
+
);
|
|
15452
|
+
}
|
|
15453
|
+
if (observation.target.targetGeneration !== frame.targetGeneration || observation.target.documentGeneration !== frame.documentGeneration) {
|
|
15454
|
+
throw new Error("browser target changed while its visual observation was captured");
|
|
15455
|
+
}
|
|
15456
|
+
return new InteractionExecutionResult(observation, [
|
|
15457
|
+
{
|
|
15458
|
+
type: "image",
|
|
15459
|
+
data: Buffer.from(frame.data).toString("base64"),
|
|
15460
|
+
mimeType: frame.mediaType
|
|
15461
|
+
}
|
|
15462
|
+
]);
|
|
15463
|
+
}
|
|
15434
15464
|
});
|
|
15435
15465
|
add({
|
|
15436
15466
|
name: "browser_act",
|
|
15437
15467
|
codemodePath: ["interaction", "browser", "act"],
|
|
15438
15468
|
title: "Act in browser tab",
|
|
15439
|
-
description: "Perform one semantic-first browser action or bounded batch,
|
|
15469
|
+
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 use a fresh observation automatically; provide them to require exact previously observed state. Returns the durable receipt and changed observation.",
|
|
15440
15470
|
input: BrowserActInput,
|
|
15441
15471
|
output: BrowserActionReceipt,
|
|
15442
15472
|
readOnly: false,
|
|
@@ -15804,7 +15834,7 @@ function createInteractionAttemptToolDefinitions(input) {
|
|
|
15804
15834
|
name: "computer_act",
|
|
15805
15835
|
codemodePath: ["interaction", "computer", "act"],
|
|
15806
15836
|
title: "Act in app or window",
|
|
15807
|
-
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.",
|
|
15837
|
+
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. Omit fences to use a fresh observation automatically. Returns the durable causal receipt.",
|
|
15808
15838
|
input: ComputerActInput,
|
|
15809
15839
|
output: ComputerActionReceipt,
|
|
15810
15840
|
readOnly: false,
|
|
@@ -15897,10 +15927,12 @@ async function openBrowser(transport, workspaceId, sourceSessionId, value, conte
|
|
|
15897
15927
|
if (value.browserSessionId) {
|
|
15898
15928
|
session = await transport.getBrowserSession(workspaceId, value.browserSessionId);
|
|
15899
15929
|
} else {
|
|
15900
|
-
const listed = await transport.listBrowserSessions(workspaceId);
|
|
15930
|
+
const listed = value.mode === "new" ? { sessions: [] } : await transport.listBrowserSessions(workspaceId);
|
|
15901
15931
|
const requestedHeadless = value.headless ?? false;
|
|
15902
15932
|
const reusable = value.mode === "new" ? null : newestRelevant(
|
|
15903
|
-
listed.sessions.filter(
|
|
15933
|
+
listed.sessions.filter(
|
|
15934
|
+
(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)
|
|
15935
|
+
),
|
|
15904
15936
|
sourceSessionId
|
|
15905
15937
|
);
|
|
15906
15938
|
if (reusable) {
|
|
@@ -15946,8 +15978,13 @@ async function openComputer(transport, workspaceId, sourceSessionId, value, cont
|
|
|
15946
15978
|
if (value.computerSessionId) {
|
|
15947
15979
|
session = await transport.getComputerSession(workspaceId, value.computerSessionId);
|
|
15948
15980
|
} else {
|
|
15949
|
-
const listed = await transport.listComputerSessions(workspaceId);
|
|
15950
|
-
const reusable =
|
|
15981
|
+
const listed = value.mode === "new" ? { sessions: [] } : await transport.listComputerSessions(workspaceId);
|
|
15982
|
+
const reusable = newestRelevant(
|
|
15983
|
+
listed.sessions.filter(
|
|
15984
|
+
(candidate) => compatibleInteractionPlacement(candidate.placement, value.placement)
|
|
15985
|
+
),
|
|
15986
|
+
sourceSessionId
|
|
15987
|
+
);
|
|
15951
15988
|
session = reusable ? reusable : (await transport.createComputerSession(workspaceId, {
|
|
15952
15989
|
operationId: context.operationId,
|
|
15953
15990
|
sessionId: sourceSessionId,
|
|
@@ -15960,6 +15997,12 @@ async function openComputer(transport, workspaceId, sourceSessionId, value, cont
|
|
|
15960
15997
|
targets: session.lifecycle === "active" ? (await transport.listComputerTargets(workspaceId, session.id)).targets : []
|
|
15961
15998
|
};
|
|
15962
15999
|
}
|
|
16000
|
+
function compatibleInteractionPlacement(candidate, requested) {
|
|
16001
|
+
if (!requested) return candidate.kind !== "attached_device";
|
|
16002
|
+
return Object.entries(requested).every(
|
|
16003
|
+
([key, value]) => candidate[key] === value
|
|
16004
|
+
);
|
|
16005
|
+
}
|
|
15963
16006
|
function newestRelevant(sessions, sourceSessionId) {
|
|
15964
16007
|
return sessions.filter(
|
|
15965
16008
|
(session) => !["ending", "ended", "failed", "lost", "repair_required"].includes(session.lifecycle) && session.associations.some((association) => association.sessionId === sourceSessionId)
|
|
@@ -18430,6 +18473,7 @@ var DeferredPreparedMcpServer = class {
|
|
|
18430
18473
|
deferredPreparation = true;
|
|
18431
18474
|
name;
|
|
18432
18475
|
listedModelNames = /* @__PURE__ */ new Set();
|
|
18476
|
+
preparedTarget = null;
|
|
18433
18477
|
toolMetaResolver = async (context) => {
|
|
18434
18478
|
const target = await this.resolveTarget();
|
|
18435
18479
|
return await target?.toolMetaResolver?.(context);
|
|
@@ -18446,6 +18490,7 @@ var DeferredPreparedMcpServer = class {
|
|
|
18446
18490
|
if (!this.isPrepared()) return [];
|
|
18447
18491
|
const target = await this.resolveTarget();
|
|
18448
18492
|
const tools = target ? await target.listTools() : [];
|
|
18493
|
+
this.preparedTarget = target instanceof PrefixedMcpServer ? target : null;
|
|
18449
18494
|
this.listedModelNames.clear();
|
|
18450
18495
|
for (const tool2 of tools) this.listedModelNames.add(tool2.name);
|
|
18451
18496
|
return tools;
|
|
@@ -18453,6 +18498,9 @@ var DeferredPreparedMcpServer = class {
|
|
|
18453
18498
|
modelToolNames() {
|
|
18454
18499
|
return this.listedModelNames.values();
|
|
18455
18500
|
}
|
|
18501
|
+
toolDisplayMetadata(name) {
|
|
18502
|
+
return this.preparedTarget?.toolDisplayMetadata(name);
|
|
18503
|
+
}
|
|
18456
18504
|
async unprefixedToolName(name) {
|
|
18457
18505
|
const target = await this.requiredTarget();
|
|
18458
18506
|
if (!(target instanceof PrefixedMcpServer)) throw new Error("Unknown prepared MCP identity");
|
|
@@ -20201,7 +20249,31 @@ function normalizeUrl(raw) {
|
|
|
20201
20249
|
}
|
|
20202
20250
|
function prefixedMcpToolName(registryId, toolName) {
|
|
20203
20251
|
const name = sharedPrefixedMcpToolName(registryId, toolName);
|
|
20204
|
-
|
|
20252
|
+
if (name.length <= 64 && /^[A-Za-z0-9_]+$/.test(name)) return name;
|
|
20253
|
+
const digest = legacyMcpToolDigest(registryId, toolName).slice(0, 24);
|
|
20254
|
+
const leaf = toolName.replace(/[^A-Za-z0-9_]/g, "_").slice(0, 34) || "tool";
|
|
20255
|
+
return `mcp_${digest}__${leaf}`;
|
|
20256
|
+
}
|
|
20257
|
+
function legacyMcpToolDigest(registryId, toolName) {
|
|
20258
|
+
return createHash5("sha256").update(JSON.stringify([registryId, toolName])).digest("hex");
|
|
20259
|
+
}
|
|
20260
|
+
function mcpToolDisplayMetadata(servers, name) {
|
|
20261
|
+
for (const server of servers) {
|
|
20262
|
+
if (server instanceof PrefixedMcpServer || server instanceof DeferredPreparedMcpServer) {
|
|
20263
|
+
const display = server.toolDisplayMetadata(name);
|
|
20264
|
+
if (display) return display;
|
|
20265
|
+
}
|
|
20266
|
+
}
|
|
20267
|
+
return void 0;
|
|
20268
|
+
}
|
|
20269
|
+
function withMcpToolDisplayMetadata(servers, payload) {
|
|
20270
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) return payload;
|
|
20271
|
+
const item = payload;
|
|
20272
|
+
const raw = item.rawItem && typeof item.rawItem === "object" ? item.rawItem : {};
|
|
20273
|
+
const name = item.name ?? item.toolName ?? raw.name;
|
|
20274
|
+
if (typeof name !== "string") return payload;
|
|
20275
|
+
const display = mcpToolDisplayMetadata(servers, name);
|
|
20276
|
+
return display ? { ...item, display } : payload;
|
|
20205
20277
|
}
|
|
20206
20278
|
var MCP_SDK_LIFECYCLE_NAME = "opengeni-mcp-lifecycle";
|
|
20207
20279
|
function publicMcpLifecycleError(error, phase, serverId, options = {}) {
|
|
@@ -20364,6 +20436,10 @@ var PrefixedMcpServer = class _PrefixedMcpServer {
|
|
|
20364
20436
|
listedToolSchemaTokens = 0;
|
|
20365
20437
|
frozenTools = null;
|
|
20366
20438
|
originalToolNames = /* @__PURE__ */ new Map();
|
|
20439
|
+
displayMetadata = /* @__PURE__ */ new Map();
|
|
20440
|
+
toolDisplayMetadata(name) {
|
|
20441
|
+
return this.displayMetadata.get(name);
|
|
20442
|
+
}
|
|
20367
20443
|
/** Exact attempt-local classification, including names too long for a prefix. */
|
|
20368
20444
|
modelToolNames() {
|
|
20369
20445
|
return this.originalToolNames.keys();
|
|
@@ -20509,6 +20585,13 @@ var PrefixedMcpServer = class _PrefixedMcpServer {
|
|
|
20509
20585
|
if (prior !== void 0 && prior !== tool2.name)
|
|
20510
20586
|
throw new Error("MCP model tool identity collision");
|
|
20511
20587
|
this.originalToolNames.set(name, tool2.name);
|
|
20588
|
+
const display = {
|
|
20589
|
+
toolName: tool2.name,
|
|
20590
|
+
...tool2.title ? { title: tool2.title } : {},
|
|
20591
|
+
...this.accountLabel ? { accountLabel: this.accountLabel } : {}
|
|
20592
|
+
};
|
|
20593
|
+
this.displayMetadata.set(name, display);
|
|
20594
|
+
this.displayMetadata.set(legacyMcpToolDigest(this.registryId, tool2.name), display);
|
|
20512
20595
|
return {
|
|
20513
20596
|
...tool2,
|
|
20514
20597
|
name,
|
|
@@ -20748,9 +20831,7 @@ async function restoreInterruptedRunState(agent, serializedRunState) {
|
|
|
20748
20831
|
}
|
|
20749
20832
|
return await RunState.fromString(agent, serializedRunState, {
|
|
20750
20833
|
clientToolSearchRehydration: "preserve_history",
|
|
20751
|
-
|
|
20752
|
-
resolveMissingFunctionTool: createResolveMissingFunctionTool(lazyRuntime)
|
|
20753
|
-
} : {}
|
|
20834
|
+
resolveMissingFunctionTool: mcpToolResolverForAgent(agent)
|
|
20754
20835
|
});
|
|
20755
20836
|
}
|
|
20756
20837
|
var TURN_OPERATIONAL_NOTICE_PREFIX = "[OpenGeni turn-scoped operational notice]\n";
|
|
@@ -21276,10 +21357,35 @@ function appendSandboxFileDownloadFailureNote(input, failures) {
|
|
|
21276
21357
|
}
|
|
21277
21358
|
function lazyToolRunBindings(agent) {
|
|
21278
21359
|
const runtime = lazyToolRuntimeForAgent(agent);
|
|
21279
|
-
if (!runtime) return {};
|
|
21280
21360
|
return {
|
|
21281
|
-
toolNotFoundBehavior: "return_error_to_model",
|
|
21282
|
-
resolveMissingFunctionTool:
|
|
21361
|
+
...runtime ? { toolNotFoundBehavior: "return_error_to_model" } : {},
|
|
21362
|
+
resolveMissingFunctionTool: mcpToolResolverForAgent(agent)
|
|
21363
|
+
};
|
|
21364
|
+
}
|
|
21365
|
+
function mcpToolResolverForAgent(agent) {
|
|
21366
|
+
const lazyRuntime = lazyToolRuntimeForAgent(agent);
|
|
21367
|
+
const resolveCurrent = lazyRuntime ? createResolveMissingFunctionTool(lazyRuntime) : null;
|
|
21368
|
+
return async (input) => {
|
|
21369
|
+
const current = await resolveCurrent?.(input);
|
|
21370
|
+
if (current) return current;
|
|
21371
|
+
if (!/^[a-f0-9]{64}$/.test(input.name)) return null;
|
|
21372
|
+
const tools = await agent.getMcpTools(new RunContext());
|
|
21373
|
+
let resolvedName;
|
|
21374
|
+
for (const server of agent.mcpServers) {
|
|
21375
|
+
if (!(server instanceof PrefixedMcpServer || server instanceof DeferredPreparedMcpServer))
|
|
21376
|
+
continue;
|
|
21377
|
+
for (const descriptor of await server.listTools()) {
|
|
21378
|
+
const rawName = await server.unprefixedToolName(descriptor.name);
|
|
21379
|
+
if (legacyMcpToolDigest(server.registryId, rawName) !== input.name) continue;
|
|
21380
|
+
if (resolvedName !== void 0 && resolvedName !== descriptor.name)
|
|
21381
|
+
throw new Error("MCP legacy model tool identity collision");
|
|
21382
|
+
resolvedName = descriptor.name;
|
|
21383
|
+
}
|
|
21384
|
+
}
|
|
21385
|
+
const tool2 = tools.find(
|
|
21386
|
+
(candidate) => candidate.type === "function" && candidate.name === resolvedName
|
|
21387
|
+
);
|
|
21388
|
+
return tool2?.type === "function" ? { ...tool2, name: input.name } : null;
|
|
21283
21389
|
};
|
|
21284
21390
|
}
|
|
21285
21391
|
function runScopedRunner(settings, agent, inputWaitYield) {
|
|
@@ -23828,6 +23934,8 @@ export {
|
|
|
23828
23934
|
mcpTransportErrorWithRetryMetadata,
|
|
23829
23935
|
safeMcpTransportError,
|
|
23830
23936
|
prefixedMcpToolName,
|
|
23937
|
+
mcpToolDisplayMetadata,
|
|
23938
|
+
withMcpToolDisplayMetadata,
|
|
23831
23939
|
PrefixedMcpServer,
|
|
23832
23940
|
restoreInterruptedRunState,
|
|
23833
23941
|
TURN_OPERATIONAL_NOTICE_PREFIX,
|
|
@@ -23872,4 +23980,4 @@ export {
|
|
|
23872
23980
|
runAzureCliLoginHook,
|
|
23873
23981
|
renderSessionGoalContext2 as renderSessionGoalContext
|
|
23874
23982
|
};
|
|
23875
|
-
//# sourceMappingURL=chunk-
|
|
23983
|
+
//# sourceMappingURL=chunk-ROCWOHGM.js.map
|