agentshim 0.6.3__tar.gz → 0.6.4__tar.gz

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 (54) hide show
  1. {agentshim-0.6.3 → agentshim-0.6.4}/CHANGELOG.md +7 -0
  2. {agentshim-0.6.3 → agentshim-0.6.4}/PKG-INFO +1 -1
  3. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/__init__.py +1 -1
  4. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/mcp.py +11 -7
  5. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/provider.py +3 -0
  6. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/codex/provider.py +12 -7
  7. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/copilot/provider.py +3 -0
  8. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/gemini/provider.py +3 -0
  9. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/opencode/provider.py +3 -0
  10. {agentshim-0.6.3 → agentshim-0.6.4}/pyproject.toml +1 -1
  11. {agentshim-0.6.3 → agentshim-0.6.4}/.gitignore +0 -0
  12. {agentshim-0.6.3 → agentshim-0.6.4}/README.md +0 -0
  13. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/agent.py +0 -0
  14. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/__init__.py +0 -0
  15. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/_files.py +0 -0
  16. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/env.py +0 -0
  17. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/errors.py +0 -0
  18. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/events.py +0 -0
  19. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/profile.py +0 -0
  20. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/provider.py +0 -0
  21. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/schema.py +0 -0
  22. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/stream.py +0 -0
  23. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/turn.py +0 -0
  24. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/core/usage.py +0 -0
  25. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/execution/__init__.py +0 -0
  26. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/execution/executor.py +0 -0
  27. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/execution/host.py +0 -0
  28. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/execution/transform.py +0 -0
  29. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/__init__.py +0 -0
  30. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/__init__.py +0 -0
  31. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/events.py +0 -0
  32. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/hooks/__init__.py +0 -0
  33. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/hooks/confine_reads.py +0 -0
  34. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/parser.py +0 -0
  35. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/sandbox.py +0 -0
  36. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/claude/scripted.py +0 -0
  37. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/codex/__init__.py +0 -0
  38. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/codex/events.py +0 -0
  39. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/codex/parser.py +0 -0
  40. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/codex/scripted.py +0 -0
  41. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/copilot/__init__.py +0 -0
  42. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/copilot/events.py +0 -0
  43. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/copilot/parser.py +0 -0
  44. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/copilot/scripted.py +0 -0
  45. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/gemini/__init__.py +0 -0
  46. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/gemini/events.py +0 -0
  47. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/gemini/parser.py +0 -0
  48. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/gemini/scripted.py +0 -0
  49. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/opencode/__init__.py +0 -0
  50. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/opencode/events.py +0 -0
  51. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/opencode/parser.py +0 -0
  52. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/providers/opencode/scripted.py +0 -0
  53. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/py.typed +0 -0
  54. {agentshim-0.6.3 → agentshim-0.6.4}/agentshim/testing/__init__.py +0 -0
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.4 (2026-09-27)
4
+
5
+ - Add optional positive finite `startup_timeout_s` to stdio and HTTP MCP
6
+ server specs. Codex renders it as an invocation-scoped
7
+ `startup_timeout_sec` override, so slow-starting servers can initialize
8
+ without modifying the user's config file.
9
+
3
10
  ## 0.6.3 (2026-09-26)
4
11
 
5
12
  - Narrow Codex `auth_files` to `.codex/auth.json`. User `config.toml` is not
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agentshim
3
- Version: 0.6.3
3
+ Version: 0.6.4
4
4
  Summary: Provider-agnostic coding-agent CLI shims
5
5
  Requires-Python: >=3.10
6
6
  Provides-Extra: test
@@ -84,7 +84,7 @@ from .providers.copilot import CopilotProvider
84
84
  from .providers.gemini import GeminiProvider
85
85
  from .providers.opencode import OpencodeProvider
86
86
 
87
- __version__ = "0.6.3"
87
+ __version__ = "0.6.4"
88
88
 
89
89
  __all__ = [
90
90
  "AgentEvent",
@@ -40,15 +40,16 @@ def _no_env() -> Mapping[str, str]:
40
40
  class StdioMcpServer:
41
41
  """MCP server launched as a subprocess over stdio.
42
42
 
43
- ``tool_timeout_s`` is the maximum time one tool call may run. Providers
44
- that cannot express a per-server tool timeout reject a non-``None`` value
45
- rather than silently dropping it.
43
+ ``startup_timeout_s`` bounds initialization and the first tool listing;
44
+ ``tool_timeout_s`` bounds one tool call. Providers that cannot express a
45
+ requested per-server timeout reject it rather than silently dropping it.
46
46
  """
47
47
 
48
48
  name: str
49
49
  command: str
50
50
  args: Sequence[str] = ()
51
51
  env: Mapping[str, str] = field(default_factory=_no_env)
52
+ startup_timeout_s: float | None = None
52
53
  tool_timeout_s: float | None = None
53
54
 
54
55
  def __post_init__(self) -> None:
@@ -63,7 +64,8 @@ class StdioMcpServer:
63
64
  if not self.command:
64
65
  msg = f"MCP server {self.name!r} must declare a command"
65
66
  raise ValueError(msg)
66
- _validate_tool_timeout(self.name, self.tool_timeout_s)
67
+ _validate_timeout(self.name, "startup_timeout_s", self.startup_timeout_s)
68
+ _validate_timeout(self.name, "tool_timeout_s", self.tool_timeout_s)
67
69
 
68
70
 
69
71
  #: The two remote MCP transports the CLIs distinguish.
@@ -87,6 +89,7 @@ class HttpMcpServer:
87
89
  url: str
88
90
  headers: Mapping[str, str] = field(default_factory=_no_env)
89
91
  transport: McpTransport = "http"
92
+ startup_timeout_s: float | None = None
90
93
  tool_timeout_s: float | None = None
91
94
 
92
95
  def __post_init__(self) -> None:
@@ -104,15 +107,16 @@ class HttpMcpServer:
104
107
  if self.transport not in _TRANSPORTS:
105
108
  msg = f"MCP server {self.name!r} transport must be one of {_TRANSPORTS}"
106
109
  raise ValueError(msg)
107
- _validate_tool_timeout(self.name, self.tool_timeout_s)
110
+ _validate_timeout(self.name, "startup_timeout_s", self.startup_timeout_s)
111
+ _validate_timeout(self.name, "tool_timeout_s", self.tool_timeout_s)
108
112
 
109
113
 
110
- def _validate_tool_timeout(name: str, timeout_s: float | None) -> None:
114
+ def _validate_timeout(name: str, field_name: str, timeout_s: float | None) -> None:
111
115
  """Reject timeout values no provider can apply meaningfully."""
112
116
  if timeout_s is None:
113
117
  return
114
118
  if isinstance(timeout_s, bool) or not math.isfinite(timeout_s) or timeout_s <= 0:
115
- msg = f"MCP server {name!r} tool_timeout_s must be a positive finite number"
119
+ msg = f"MCP server {name!r} {field_name} must be a positive finite number"
116
120
  raise ValueError(msg)
117
121
 
118
122
 
@@ -162,6 +162,9 @@ def _resumed_session_id(argv: Sequence[str]) -> str | None:
162
162
 
163
163
  def mcp_entry(server: McpServer) -> dict[str, Any]:
164
164
  """Render one server the way ``.mcp.json`` describes it."""
165
+ if server.startup_timeout_s is not None:
166
+ msg = "claude cannot configure a per-server MCP startup timeout"
167
+ raise ProviderCapabilityError(msg)
165
168
  if server.tool_timeout_s is not None:
166
169
  msg = "claude cannot configure a per-server MCP tool timeout"
167
170
  raise ProviderCapabilityError(msg)
@@ -190,7 +190,7 @@ def _server_flags(server: McpServer) -> list[str]:
190
190
  # A ``--config`` override carries the address and nothing else, so
191
191
  # Codex works the transport out from the endpoint itself.
192
192
  flags = ["--config", f"{prefix}.url={_toml_str(server.url)}"]
193
- return flags + _tool_timeout_flags(prefix, server.tool_timeout_s)
193
+ return flags + _timeout_flags(prefix, server)
194
194
  flags = [
195
195
  "--config",
196
196
  f"{prefix}.command={_toml_str(server.command)}",
@@ -199,14 +199,17 @@ def _server_flags(server: McpServer) -> list[str]:
199
199
  ]
200
200
  for env_key, env_value in server.env.items():
201
201
  flags += ["--config", f"{prefix}.env.{env_key}={_toml_str(env_value)}"]
202
- return flags + _tool_timeout_flags(prefix, server.tool_timeout_s)
202
+ return flags + _timeout_flags(prefix, server)
203
203
 
204
204
 
205
- def _tool_timeout_flags(prefix: str, timeout_s: float | None) -> list[str]:
206
- """Render Codex's per-server tool timeout as an invocation override."""
207
- if timeout_s is None:
208
- return []
209
- return ["--config", f"{prefix}.tool_timeout_sec={timeout_s}"]
205
+ def _timeout_flags(prefix: str, server: McpServer) -> list[str]:
206
+ """Render Codex's per-server timeouts as invocation overrides."""
207
+ flags: list[str] = []
208
+ if server.startup_timeout_s is not None:
209
+ flags += ["--config", f"{prefix}.startup_timeout_sec={server.startup_timeout_s}"]
210
+ if server.tool_timeout_s is not None:
211
+ flags += ["--config", f"{prefix}.tool_timeout_sec={server.tool_timeout_s}"]
212
+ return flags
210
213
 
211
214
 
212
215
  def _toml_str(value: str) -> str:
@@ -280,6 +283,8 @@ def _apply_mcp_override(entry: dict[str, Any], field: str, raw_value: str) -> No
280
283
  entry["transport"] = "http"
281
284
  elif field == "tool_timeout_sec":
282
285
  entry["tool_timeout_s"] = float(raw_value)
286
+ elif field == "startup_timeout_sec":
287
+ entry["startup_timeout_s"] = float(raw_value)
283
288
  elif field.startswith("env."):
284
289
  entry.setdefault("env", {})[field.removeprefix("env.")] = _parse_toml_str(raw_value)
285
290
 
@@ -135,6 +135,9 @@ class CopilotProvider:
135
135
 
136
136
  def mcp_entry(server: McpServer) -> dict[str, Any]:
137
137
  """Render one server the way ``--additional-mcp-config`` describes it."""
138
+ if server.startup_timeout_s is not None:
139
+ msg = "copilot cannot configure a per-server MCP startup timeout"
140
+ raise ProviderCapabilityError(msg)
138
141
  if server.tool_timeout_s is not None:
139
142
  msg = "copilot cannot configure a per-server MCP tool timeout"
140
143
  raise ProviderCapabilityError(msg)
@@ -154,6 +154,9 @@ def mcp_entry(server: McpServer) -> dict[str, Any]:
154
154
  ``trust: true`` skips Gemini's per-tool approval prompt for servers the
155
155
  caller installed on purpose.
156
156
  """
157
+ if server.startup_timeout_s is not None:
158
+ msg = "gemini cannot configure a per-server MCP startup timeout"
159
+ raise ProviderCapabilityError(msg)
157
160
  if server.tool_timeout_s is not None:
158
161
  msg = "gemini cannot configure a per-server MCP tool timeout"
159
162
  raise ProviderCapabilityError(msg)
@@ -159,6 +159,9 @@ def mcp_entry(server: McpServer) -> dict[str, Any]:
159
159
  non-interactive ``run`` mode auto-answers permission prompts, so no
160
160
  extra ``permission`` block is needed.
161
161
  """
162
+ if server.startup_timeout_s is not None:
163
+ msg = "opencode cannot configure a per-server MCP startup timeout"
164
+ raise ProviderCapabilityError(msg)
162
165
  if server.tool_timeout_s is not None:
163
166
  msg = "opencode cannot configure a per-server MCP tool timeout"
164
167
  raise ProviderCapabilityError(msg)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentshim"
3
- version = "0.6.3"
3
+ version = "0.6.4"
4
4
  description = "Provider-agnostic coding-agent CLI shims"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
File without changes
File without changes
File without changes
File without changes