nookplot-runtime 0.5.53__tar.gz → 0.5.54__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 (22) hide show
  1. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/PKG-INFO +1 -1
  2. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/nookplot_runtime/action_catalog.py +2 -2
  3. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/nookplot_runtime/client.py +27 -4
  4. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/pyproject.toml +1 -1
  5. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/.gitignore +0 -0
  6. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/README.md +0 -0
  7. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/SKILL.md +0 -0
  8. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/nookplot_runtime/__init__.py +0 -0
  9. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/nookplot_runtime/autonomous.py +0 -0
  10. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/nookplot_runtime/content_safety.py +0 -0
  11. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/nookplot_runtime/events.py +0 -0
  12. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/nookplot_runtime/types.py +0 -0
  13. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/requirements.lock +0 -0
  14. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/__init__.py +0 -0
  15. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/helpers/__init__.py +0 -0
  16. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/helpers/mock_runtime.py +0 -0
  17. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/test_autonomous_action_dispatch.py +0 -0
  18. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/test_autonomous_dedup.py +0 -0
  19. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/test_autonomous_lifecycle.py +0 -0
  20. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/test_client.py +0 -0
  21. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/test_content_safety.py +0 -0
  22. {nookplot_runtime-0.5.53 → nookplot_runtime-0.5.54}/tests/test_get_available_actions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nookplot-runtime
3
- Version: 0.5.53
3
+ Version: 0.5.54
4
4
  Summary: Python Agent Runtime SDK for Nookplot — persistent connection, events, memory bridge, and economy for AI agents on Base
5
5
  Project-URL: Homepage, https://nookplot.com
6
6
  Project-URL: Repository, https://github.com/nookprotocol
@@ -348,8 +348,8 @@ ACTION_CATALOG: dict[str, ActionInfo] = {
348
348
  "params": "toolId (string), input (object)",
349
349
  },
350
350
  "exec_code": {
351
- "description": "Execute code in a sandboxed container. Supports Node.js, Python, and Deno.",
352
- "params": "command (string), image (string: node:20-slim | python:3.12-slim | denoland/deno:2.0), files (object: {filename: content}, optional), timeout (number in seconds, optional), projectId (string, optional)",
351
+ "description": "Execute code in a sandboxed E2B cloud container. Supports Node.js, Python, and Deno. Files are mounted in /home/user/.",
352
+ "params": "command (string), image (string: node:20-slim | node:22-slim | python:3.12-slim | python:3.13-slim | denoland/deno:2.0), files (object: {filename: content}, optional), timeout (number in seconds, max 300, default 60), projectId (string, optional)",
353
353
  },
354
354
  "call_mcp_tool": {
355
355
  "description": "Call a tool on a connected MCP server",
@@ -106,6 +106,8 @@ class _HttpClient:
106
106
  body: dict[str, Any] | None = None,
107
107
  _retries: int = 4,
108
108
  _attempt: int = 0,
109
+ *,
110
+ timeout: float | None = None,
109
111
  ) -> Any:
110
112
  """Make an authenticated request to the gateway.
111
113
 
@@ -116,6 +118,7 @@ class _HttpClient:
116
118
  method=method,
117
119
  url=path,
118
120
  json=body,
121
+ **({"timeout": timeout} if timeout is not None else {}),
119
122
  )
120
123
 
121
124
  # Auto-retry on 429 with exponential backoff + jitter
@@ -2224,15 +2227,35 @@ class _ToolManager:
2224
2227
  timeout: int | None = None,
2225
2228
  project_id: str | None = None,
2226
2229
  ) -> dict[str, Any]:
2227
- """Execute code in a sandboxed container."""
2230
+ """Execute code in a sandboxed E2B container."""
2231
+ # Normalize files — handle case where files arrives as a JSON string
2232
+ normalized_files = files
2233
+ if isinstance(files, str):
2234
+ import json as _json
2235
+ import re as _re
2236
+ try:
2237
+ normalized_files = _json.loads(files)
2238
+ except (ValueError, TypeError):
2239
+ try:
2240
+ escaped = _re.sub(
2241
+ r"[\x00-\x1f\x7f]",
2242
+ lambda m: f"\\u{ord(m.group()):04x}",
2243
+ files,
2244
+ )
2245
+ normalized_files = _json.loads(escaped)
2246
+ except (ValueError, TypeError):
2247
+ raise ValueError("Invalid files: must be a dict mapping filenames to content")
2248
+
2228
2249
  body: dict[str, Any] = {"command": command, "image": image}
2229
- if files:
2230
- body["files"] = files
2250
+ if normalized_files:
2251
+ body["files"] = normalized_files
2231
2252
  if timeout is not None:
2232
2253
  body["timeout"] = timeout
2233
2254
  if project_id:
2234
2255
  body["projectId"] = project_id
2235
- return await self._http.request("POST", "/v1/exec", body)
2256
+ # Use longer timeout for sandbox execution (timeout + 30s buffer, up to 330s)
2257
+ exec_timeout = min((timeout or 60) + 30, 330)
2258
+ return await self._http.request("POST", "/v1/exec", body, timeout=float(exec_timeout))
2236
2259
 
2237
2260
  async def connect_mcp_server(
2238
2261
  self,
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "nookplot-runtime"
7
- version = "0.5.53"
7
+ version = "0.5.54"
8
8
  description = "Python Agent Runtime SDK for Nookplot — persistent connection, events, memory bridge, and economy for AI agents on Base"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"