@mono-agent/agent-runtime 0.15.2 → 0.15.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.
package/README.md CHANGED
@@ -650,7 +650,7 @@ Per-call options (a non-exhaustive selection):
650
650
  | `cwd` | `string` | Working directory for the agent's tools. |
651
651
  | `allowedTools` | `string[]` | Built-in tool allowlist. Default: all. |
652
652
  | `disallowedTools` | `string[]` | Block list. |
653
- | `mcpServers` | `Record<string, McpServerConfig>` | Configured MCP servers (stdio / sse / http). |
653
+ | `mcpServers` | `Record<string, McpServerConfig>` | Configured MCP servers (stdio / sse / http); on direct Codex, each forwarded server authorizes its own tool calls. |
654
654
  | `sandboxPolicy` | `SandboxPolicy` | Optional fail-closed sandbox policy for built-in tools and stdio MCP process startup. |
655
655
  | `maxTurns` | `number` | Hard cap on agent turns. |
656
656
  | `outputSchema` | `JSONSchema` | Requests structured JSON on capable bridges; see “Structured output” below for bridge-specific return behavior. |
@@ -760,6 +760,17 @@ truncation is explicitly desired; omitting it is not a separate hidden limit.
760
760
  The standard 256 KiB tool-payload guard still applies to oversized tool results.
761
761
 
762
762
  Override or extend the tool surface by passing `mcpServers` for MCP-backed tools.
763
+ On direct Codex normal runs, each valid server that survives translation into
764
+ the app-server config is the authorization boundary for the tools it exposes.
765
+ The bridge accepts Codex's synthesized `mcp_tool_call` elicitation for that exact
766
+ server without persisting an approval. Inherited or otherwise unconfigured
767
+ server names, genuine downstream MCP elicitations, and other app-server requests
768
+ remain fail-closed.
769
+
770
+ This also applies under direct Codex `permissionMode: "plan"`: the read-only
771
+ sandbox constrains Codex-owned filesystem and command execution, but a declared
772
+ MCP tool can still change state managed by its server. Do not declare a server
773
+ whose complete tool surface is not authorized for the run.
763
774
 
764
775
  ### Structured output
765
776
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-agent/agent-runtime",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "description": "Agent runtime supporting Claude SDK/CLI, Codex, OpenCode, and Pi SDK bridges out of the box",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0-only",
@@ -617,6 +617,19 @@ function codexMcpConfig(mcpServers = {}) {
617
617
  return servers;
618
618
  }
619
619
 
620
+ function codexConfiguredMcpApprovalResponse(request, configuredMcpServerNames) {
621
+ const params = request?.params;
622
+ if (
623
+ request?.method !== "mcpServer/elicitation/request"
624
+ || params?._meta?.codex_approval_kind !== "mcp_tool_call"
625
+ || typeof params?.serverName !== "string"
626
+ || !configuredMcpServerNames.has(params.serverName)
627
+ ) {
628
+ return null;
629
+ }
630
+ return { action: "accept", content: {}, _meta: null };
631
+ }
632
+
620
633
  function codexErrorMessage(error) {
621
634
  if (!error) return "Codex app-server error";
622
635
  if (typeof error === "string") return error;
@@ -1109,6 +1122,7 @@ export async function generateCodexAppResponse(systemPrompt, options = {}) {
1109
1122
  const makeClient = options.codexClientFactory || createCodexAppServerClient;
1110
1123
  const keepAlive = options.sessionKeepAlive === true;
1111
1124
  const noToolsProbe = options.codexNoToolsProbe === true;
1125
+ const configuredMcpServerNames = new Set(Object.keys(codexMcpConfig(options.mcpServers)));
1112
1126
  // The bridge TTL is a backstop behind the host's session policy; the grace
1113
1127
  // keeps the host's lazy expiry firing first so eviction stays host-driven.
1114
1128
  const sessionTtlMs = Number.isFinite(Number(options.sessionIdleTimeoutMs))
@@ -1446,6 +1460,10 @@ export async function generateCodexAppResponse(systemPrompt, options = {}) {
1446
1460
  ),
1447
1461
  onServerRequest: (request) => {
1448
1462
  const method = typeof request?.method === "string" ? request.method : "unknown";
1463
+ const approval = noToolsProbe
1464
+ ? null
1465
+ : codexConfiguredMcpApprovalResponse(request, configuredMcpServerNames);
1466
+ if (approval) return approval;
1449
1467
  failUnsupportedServerRequest(method);
1450
1468
  throw new Error(`Unsupported Codex app-server request: ${method}`);
1451
1469
  },
@@ -0,0 +1,57 @@
1
+ export function backendCapabilities(sdkOrModel: any): any;
2
+ export function backendUsesExecenvConfig(sdk: any): boolean;
3
+ export function backendSupportsSessionResume(sdk: any): boolean;
4
+ export const BACKEND_CAPABILITIES: {
5
+ claude: {
6
+ supports_session_resume: boolean;
7
+ streaming: boolean;
8
+ structured_output: boolean;
9
+ native_runtime_config: any;
10
+ supports_mcp: boolean;
11
+ supports_skills: boolean;
12
+ supports_builtin_tools: boolean;
13
+ supports_live_input: boolean;
14
+ supports_native_subagents: boolean;
15
+ supports_fast_mode: boolean;
16
+ runtime: string;
17
+ };
18
+ pi: {
19
+ supports_session_resume: boolean;
20
+ supports_native_subagents: boolean;
21
+ streaming: boolean;
22
+ structured_output: boolean;
23
+ native_runtime_config: any;
24
+ supports_mcp: boolean;
25
+ supports_skills: boolean;
26
+ supports_builtin_tools: boolean;
27
+ supports_live_input: boolean;
28
+ supports_fast_mode: boolean;
29
+ runtime: string;
30
+ };
31
+ codex: {
32
+ supports_session_resume: boolean;
33
+ supports_fast_mode: boolean;
34
+ streaming: boolean;
35
+ structured_output: boolean;
36
+ native_runtime_config: any;
37
+ supports_mcp: boolean;
38
+ supports_skills: boolean;
39
+ supports_builtin_tools: boolean;
40
+ supports_live_input: boolean;
41
+ supports_native_subagents: boolean;
42
+ runtime: string;
43
+ };
44
+ opencode: {
45
+ structured_output: boolean;
46
+ supports_session_resume: boolean;
47
+ supports_mcp: boolean;
48
+ supports_skills: boolean;
49
+ supports_live_input: boolean;
50
+ supports_native_subagents: boolean;
51
+ streaming: boolean;
52
+ native_runtime_config: any;
53
+ supports_builtin_tools: boolean;
54
+ supports_fast_mode: boolean;
55
+ runtime: string;
56
+ };
57
+ };
@@ -0,0 +1 @@
1
+ export { listRuntimeBridges as listProviders, resolveRuntimeBridge as findProviderForModel, runtimeCapabilities } from "./runtime/registry.js";