@opengeni/runtime 4.0.0 → 4.0.1

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.
@@ -26,7 +26,7 @@ import {
26
26
  withRunCredentialsClient,
27
27
  withRunCredentialsSession,
28
28
  wrapCapabilityToolsForTurnCancellation
29
- } from "./chunk-WIHICNWS.js";
29
+ } from "./chunk-J5AR5XAJ.js";
30
30
  import {
31
31
  MemorySession,
32
32
  connectMcpServers
@@ -10316,6 +10316,8 @@ Display images with ![descriptive alt text](artifact:<artifactId>). 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. ![Preview](artifact:<artifactId>) 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.0",
12351
+ version: "7.1.0",
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.0",
12503
+ version: "7.1.0",
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.0",
12756
+ version: "0.6.1",
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.42",
12806
+ version: "0.3.43",
12803
12807
  description: "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
12804
12808
  license: "Apache-2.0",
12805
12809
  repository: {
@@ -18430,6 +18434,7 @@ var DeferredPreparedMcpServer = class {
18430
18434
  deferredPreparation = true;
18431
18435
  name;
18432
18436
  listedModelNames = /* @__PURE__ */ new Set();
18437
+ preparedTarget = null;
18433
18438
  toolMetaResolver = async (context) => {
18434
18439
  const target = await this.resolveTarget();
18435
18440
  return await target?.toolMetaResolver?.(context);
@@ -18446,6 +18451,7 @@ var DeferredPreparedMcpServer = class {
18446
18451
  if (!this.isPrepared()) return [];
18447
18452
  const target = await this.resolveTarget();
18448
18453
  const tools = target ? await target.listTools() : [];
18454
+ this.preparedTarget = target instanceof PrefixedMcpServer ? target : null;
18449
18455
  this.listedModelNames.clear();
18450
18456
  for (const tool2 of tools) this.listedModelNames.add(tool2.name);
18451
18457
  return tools;
@@ -18453,6 +18459,9 @@ var DeferredPreparedMcpServer = class {
18453
18459
  modelToolNames() {
18454
18460
  return this.listedModelNames.values();
18455
18461
  }
18462
+ toolDisplayMetadata(name) {
18463
+ return this.preparedTarget?.toolDisplayMetadata(name);
18464
+ }
18456
18465
  async unprefixedToolName(name) {
18457
18466
  const target = await this.requiredTarget();
18458
18467
  if (!(target instanceof PrefixedMcpServer)) throw new Error("Unknown prepared MCP identity");
@@ -20201,7 +20210,31 @@ function normalizeUrl(raw) {
20201
20210
  }
20202
20211
  function prefixedMcpToolName(registryId, toolName) {
20203
20212
  const name = sharedPrefixedMcpToolName(registryId, toolName);
20204
- return name.length <= 64 && /^[A-Za-z0-9_]+$/.test(name) ? name : createHash5("sha256").update(JSON.stringify([registryId, toolName])).digest("hex");
20213
+ if (name.length <= 64 && /^[A-Za-z0-9_]+$/.test(name)) return name;
20214
+ const digest = legacyMcpToolDigest(registryId, toolName).slice(0, 24);
20215
+ const leaf = toolName.replace(/[^A-Za-z0-9_]/g, "_").slice(0, 34) || "tool";
20216
+ return `mcp_${digest}__${leaf}`;
20217
+ }
20218
+ function legacyMcpToolDigest(registryId, toolName) {
20219
+ return createHash5("sha256").update(JSON.stringify([registryId, toolName])).digest("hex");
20220
+ }
20221
+ function mcpToolDisplayMetadata(servers, name) {
20222
+ for (const server of servers) {
20223
+ if (server instanceof PrefixedMcpServer || server instanceof DeferredPreparedMcpServer) {
20224
+ const display = server.toolDisplayMetadata(name);
20225
+ if (display) return display;
20226
+ }
20227
+ }
20228
+ return void 0;
20229
+ }
20230
+ function withMcpToolDisplayMetadata(servers, payload) {
20231
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return payload;
20232
+ const item = payload;
20233
+ const raw = item.rawItem && typeof item.rawItem === "object" ? item.rawItem : {};
20234
+ const name = item.name ?? item.toolName ?? raw.name;
20235
+ if (typeof name !== "string") return payload;
20236
+ const display = mcpToolDisplayMetadata(servers, name);
20237
+ return display ? { ...item, display } : payload;
20205
20238
  }
20206
20239
  var MCP_SDK_LIFECYCLE_NAME = "opengeni-mcp-lifecycle";
20207
20240
  function publicMcpLifecycleError(error, phase, serverId, options = {}) {
@@ -20364,6 +20397,10 @@ var PrefixedMcpServer = class _PrefixedMcpServer {
20364
20397
  listedToolSchemaTokens = 0;
20365
20398
  frozenTools = null;
20366
20399
  originalToolNames = /* @__PURE__ */ new Map();
20400
+ displayMetadata = /* @__PURE__ */ new Map();
20401
+ toolDisplayMetadata(name) {
20402
+ return this.displayMetadata.get(name);
20403
+ }
20367
20404
  /** Exact attempt-local classification, including names too long for a prefix. */
20368
20405
  modelToolNames() {
20369
20406
  return this.originalToolNames.keys();
@@ -20509,6 +20546,13 @@ var PrefixedMcpServer = class _PrefixedMcpServer {
20509
20546
  if (prior !== void 0 && prior !== tool2.name)
20510
20547
  throw new Error("MCP model tool identity collision");
20511
20548
  this.originalToolNames.set(name, tool2.name);
20549
+ const display = {
20550
+ toolName: tool2.name,
20551
+ ...tool2.title ? { title: tool2.title } : {},
20552
+ ...this.accountLabel ? { accountLabel: this.accountLabel } : {}
20553
+ };
20554
+ this.displayMetadata.set(name, display);
20555
+ this.displayMetadata.set(legacyMcpToolDigest(this.registryId, tool2.name), display);
20512
20556
  return {
20513
20557
  ...tool2,
20514
20558
  name,
@@ -20748,9 +20792,7 @@ async function restoreInterruptedRunState(agent, serializedRunState) {
20748
20792
  }
20749
20793
  return await RunState.fromString(agent, serializedRunState, {
20750
20794
  clientToolSearchRehydration: "preserve_history",
20751
- ...lazyRuntime ? {
20752
- resolveMissingFunctionTool: createResolveMissingFunctionTool(lazyRuntime)
20753
- } : {}
20795
+ resolveMissingFunctionTool: mcpToolResolverForAgent(agent)
20754
20796
  });
20755
20797
  }
20756
20798
  var TURN_OPERATIONAL_NOTICE_PREFIX = "[OpenGeni turn-scoped operational notice]\n";
@@ -21276,10 +21318,35 @@ function appendSandboxFileDownloadFailureNote(input, failures) {
21276
21318
  }
21277
21319
  function lazyToolRunBindings(agent) {
21278
21320
  const runtime = lazyToolRuntimeForAgent(agent);
21279
- if (!runtime) return {};
21280
21321
  return {
21281
- toolNotFoundBehavior: "return_error_to_model",
21282
- resolveMissingFunctionTool: createResolveMissingFunctionTool(runtime)
21322
+ ...runtime ? { toolNotFoundBehavior: "return_error_to_model" } : {},
21323
+ resolveMissingFunctionTool: mcpToolResolverForAgent(agent)
21324
+ };
21325
+ }
21326
+ function mcpToolResolverForAgent(agent) {
21327
+ const lazyRuntime = lazyToolRuntimeForAgent(agent);
21328
+ const resolveCurrent = lazyRuntime ? createResolveMissingFunctionTool(lazyRuntime) : null;
21329
+ return async (input) => {
21330
+ const current = await resolveCurrent?.(input);
21331
+ if (current) return current;
21332
+ if (!/^[a-f0-9]{64}$/.test(input.name)) return null;
21333
+ const tools = await agent.getMcpTools(new RunContext());
21334
+ let resolvedName;
21335
+ for (const server of agent.mcpServers) {
21336
+ if (!(server instanceof PrefixedMcpServer || server instanceof DeferredPreparedMcpServer))
21337
+ continue;
21338
+ for (const descriptor of await server.listTools()) {
21339
+ const rawName = await server.unprefixedToolName(descriptor.name);
21340
+ if (legacyMcpToolDigest(server.registryId, rawName) !== input.name) continue;
21341
+ if (resolvedName !== void 0 && resolvedName !== descriptor.name)
21342
+ throw new Error("MCP legacy model tool identity collision");
21343
+ resolvedName = descriptor.name;
21344
+ }
21345
+ }
21346
+ const tool2 = tools.find(
21347
+ (candidate) => candidate.type === "function" && candidate.name === resolvedName
21348
+ );
21349
+ return tool2?.type === "function" ? { ...tool2, name: input.name } : null;
21283
21350
  };
21284
21351
  }
21285
21352
  function runScopedRunner(settings, agent, inputWaitYield) {
@@ -23828,6 +23895,8 @@ export {
23828
23895
  mcpTransportErrorWithRetryMetadata,
23829
23896
  safeMcpTransportError,
23830
23897
  prefixedMcpToolName,
23898
+ mcpToolDisplayMetadata,
23899
+ withMcpToolDisplayMetadata,
23831
23900
  PrefixedMcpServer,
23832
23901
  restoreInterruptedRunState,
23833
23902
  TURN_OPERATIONAL_NOTICE_PREFIX,
@@ -23872,4 +23941,4 @@ export {
23872
23941
  runAzureCliLoginHook,
23873
23942
  renderSessionGoalContext2 as renderSessionGoalContext
23874
23943
  };
23875
- //# sourceMappingURL=chunk-5HJEVOMJ.js.map
23944
+ //# sourceMappingURL=chunk-J6J3VYFW.js.map