opencode-a2a-server 0.2.1__tar.gz → 0.2.3__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 (89) hide show
  1. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/.secrets.baseline +2 -12
  2. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/PKG-INFO +140 -54
  3. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/README.md +139 -53
  4. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/SECURITY.md +4 -4
  5. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/docs/guide.md +51 -3
  6. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/pyproject.toml +1 -1
  7. opencode_a2a_server-0.2.3/scripts/README.md +22 -0
  8. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/app.py +14 -4
  9. opencode_a2a_server-0.2.3/src/opencode_a2a_server/cli.py +53 -0
  10. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/config.py +18 -1
  11. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/opencode_client.py +20 -4
  12. opencode_a2a_server-0.2.3/src/opencode_a2a_server/opencode_upstream.py +122 -0
  13. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server.egg-info/PKG-INFO +140 -54
  14. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server.egg-info/SOURCES.txt +4 -24
  15. opencode_a2a_server-0.2.3/src/opencode_a2a_server.egg-info/entry_points.txt +2 -0
  16. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/helpers.py +1 -1
  17. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_agent_card.py +1 -1
  18. opencode_a2a_server-0.2.3/tests/test_cli.py +58 -0
  19. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_directory_validation.py +1 -1
  20. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_opencode_client_params.py +7 -7
  21. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_opencode_session_extension.py +26 -26
  22. opencode_a2a_server-0.2.3/tests/test_opencode_upstream.py +162 -0
  23. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_settings.py +23 -0
  24. opencode_a2a_server-0.2.1/docs/agent_deploy_sop.md +0 -292
  25. opencode_a2a_server-0.2.1/docs/release_deploy_smoke_test.md +0 -188
  26. opencode_a2a_server-0.2.1/scripts/README.md +0 -34
  27. opencode_a2a_server-0.2.1/scripts/deploy/enable_instance.sh +0 -175
  28. opencode_a2a_server-0.2.1/scripts/deploy/install_release_runtime.sh +0 -52
  29. opencode_a2a_server-0.2.1/scripts/deploy/install_units.sh +0 -110
  30. opencode_a2a_server-0.2.1/scripts/deploy/provider_secret_env_keys.sh +0 -69
  31. opencode_a2a_server-0.2.1/scripts/deploy/run_a2a.sh +0 -18
  32. opencode_a2a_server-0.2.1/scripts/deploy/run_opencode.sh +0 -80
  33. opencode_a2a_server-0.2.1/scripts/deploy/setup_instance.sh +0 -483
  34. opencode_a2a_server-0.2.1/scripts/deploy/update_a2a.sh +0 -27
  35. opencode_a2a_server-0.2.1/scripts/deploy.sh +0 -344
  36. opencode_a2a_server-0.2.1/scripts/deploy_readme.md +0 -333
  37. opencode_a2a_server-0.2.1/scripts/deploy_release.sh +0 -8
  38. opencode_a2a_server-0.2.1/scripts/deploy_release_readme.md +0 -72
  39. opencode_a2a_server-0.2.1/scripts/init_release_system.sh +0 -15
  40. opencode_a2a_server-0.2.1/scripts/init_release_system_readme.md +0 -41
  41. opencode_a2a_server-0.2.1/scripts/init_system.sh +0 -852
  42. opencode_a2a_server-0.2.1/scripts/init_system_readme.md +0 -69
  43. opencode_a2a_server-0.2.1/scripts/init_system_uv_release_manifest.sh +0 -17
  44. opencode_a2a_server-0.2.1/scripts/shell_helpers.sh +0 -34
  45. opencode_a2a_server-0.2.1/scripts/uninstall.sh +0 -383
  46. opencode_a2a_server-0.2.1/scripts/uninstall_readme.md +0 -39
  47. opencode_a2a_server-0.2.1/src/opencode_a2a_server.egg-info/entry_points.txt +0 -2
  48. opencode_a2a_server-0.2.1/tests/test_deploy_security_contract.py +0 -164
  49. opencode_a2a_server-0.2.1/tests/test_init_system_security.py +0 -101
  50. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/.github/workflows/ci.yml +0 -0
  51. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/.github/workflows/dependency-health.yml +0 -0
  52. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/.github/workflows/publish.yml +0 -0
  53. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/.gitignore +0 -0
  54. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/.pre-commit-config.yaml +0 -0
  55. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/AGENTS.md +0 -0
  56. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/CONTRIBUTING.md +0 -0
  57. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/LICENSE +0 -0
  58. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/scripts/dependency_health.sh +0 -0
  59. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/scripts/doctor.sh +0 -0
  60. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/scripts/health_common.sh +0 -0
  61. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/scripts/lint.sh +0 -0
  62. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/scripts/smoke_test_built_cli.sh +0 -0
  63. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/setup.cfg +0 -0
  64. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/__init__.py +0 -0
  65. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/agent.py +0 -0
  66. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/extension_contracts.py +0 -0
  67. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/jsonrpc_ext.py +0 -0
  68. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/jsonrpc_models.py +0 -0
  69. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/parts_mapper.py +0 -0
  70. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server/text_parts.py +0 -0
  71. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server.egg-info/dependency_links.txt +0 -0
  72. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server.egg-info/requires.txt +0 -0
  73. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/src/opencode_a2a_server.egg-info/top_level.txt +0 -0
  74. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/__init__.py +0 -0
  75. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_agent_errors.py +0 -0
  76. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_call_context_builder.py +0 -0
  77. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_cancel_contract.py +0 -0
  78. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_cancellation.py +0 -0
  79. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_extension_contract_consistency.py +0 -0
  80. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_jsonrpc_models.py +0 -0
  81. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_jsonrpc_unsupported_method.py +0 -0
  82. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_metrics.py +0 -0
  83. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_multipart_input.py +0 -0
  84. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_opencode_agent_session_binding.py +0 -0
  85. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_script_health_contract.py +0 -0
  86. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_session_ownership.py +0 -0
  87. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_streaming_output_contract.py +0 -0
  88. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/tests/test_transport_contract.py +0 -0
  89. {opencode_a2a_server-0.2.1 → opencode_a2a_server-0.2.3}/uv.lock +0 -0
@@ -126,16 +126,6 @@
126
126
  "path": "detect_secrets.filters.heuristic.is_templated_secret"
127
127
  }
128
128
  ],
129
- "results": {
130
- "scripts/init_system.sh": [
131
- {
132
- "type": "Hex High Entropy String",
133
- "filename": "scripts/init_system.sh",
134
- "hashed_secret": "96183ea4ff07d786ed3233777364ddbf14eb74cc",
135
- "is_verified": false,
136
- "line_number": 25
137
- }
138
- ]
139
- },
140
- "generated_at": "2026-03-17T13:35:29Z"
129
+ "results": {},
130
+ "generated_at": "2026-03-19T03:57:43Z"
141
131
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opencode-a2a-server
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: A2A wrapper service for opencode
5
5
  Author: liujuanjuan1984@Intelligent-Internet
6
6
  License-Expression: Apache-2.0
@@ -38,12 +38,12 @@ Dynamic: license-file
38
38
 
39
39
  # opencode-a2a-server
40
40
 
41
- > Turn OpenCode into a stateful A2A service with a clear runtime boundary and production-friendly deployment workflow.
41
+ > Turn OpenCode into a stateful A2A service with a clear runtime boundary.
42
42
 
43
43
  `opencode-a2a-server` exposes OpenCode through standard A2A interfaces and adds
44
- the operational pieces that raw agent runtimes usually do not provide by
45
- default: authentication, session continuity, streaming contracts, interrupt
46
- handling, deployment tooling, and explicit security guidance.
44
+ the runtime pieces that raw agent runtimes usually do not provide by default:
45
+ authentication, session continuity, streaming contracts, interrupt handling,
46
+ and explicit security guidance.
47
47
 
48
48
  ## Why This Project Exists
49
49
 
@@ -52,7 +52,8 @@ need a stable service layer around it. This repository provides that layer by:
52
52
 
53
53
  - bridging A2A transport contracts to OpenCode session/message/event APIs
54
54
  - making session and interrupt behavior explicit and auditable
55
- - packaging release-first deployment scripts and operational guidance for long-running use
55
+ - keeping the server/runtime contract explicit while leaving deployment
56
+ supervision to the operator
56
57
 
57
58
  ## What It Already Provides
58
59
 
@@ -64,7 +65,7 @@ need a stable service layer around it. This repository provides that layer by:
64
65
  - session continuation via `metadata.shared.session.id`
65
66
  - request-scoped model selection via `metadata.shared.model`
66
67
  - OpenCode session query/control extensions and provider/model discovery
67
- - released CLI install/upgrade flow and release-based systemd deployment
68
+ - released CLI install/upgrade flow and a foreground runtime entrypoint
68
69
 
69
70
  ## Extension Capability Overview
70
71
 
@@ -96,7 +97,9 @@ Detailed consumption guidance:
96
97
  One `OpenCode + opencode-a2a-server` instance pair is treated as a
97
98
  single-tenant trust boundary.
98
99
 
99
- This repository's intended scaling model is parameterized self-deployment: consumers should launch their own isolated instance pairs through the provided deployment scripts instead of sharing one runtime across mutually untrusted tenants.
100
+ This repository's intended scaling model is parameterized self-deployment:
101
+ consumers should launch their own isolated instance pairs instead of sharing
102
+ one runtime across mutually untrusted tenants.
100
103
 
101
104
  - OpenCode may manage multiple projects/directories, but one deployed instance
102
105
  is not a secure multi-tenant runtime.
@@ -115,7 +118,6 @@ flowchart TD
115
118
  Mapping --> Runtime["OpenCode HTTP runtime"]
116
119
 
117
120
  Api --> Auth["Bearer auth + request logging controls"]
118
- Api --> Deploy["release-based deployment tooling"]
119
121
  Runtime --> Workspace["Shared workspace / environment boundary"]
120
122
  ```
121
123
 
@@ -141,13 +143,14 @@ hard multi-tenant isolation layer.
141
143
  isolation boundary inside one deployed instance.
142
144
  - LLM provider keys are consumed by the OpenCode process. Prompt injection or
143
145
  indirect exfiltration attempts may still expose sensitive values.
144
- - systemd deploy defaults use operator-provisioned root-only secret files
145
- unless `ENABLE_SECRET_PERSISTENCE=true` is explicitly enabled.
146
+ - Deployment supervision is intentionally BYO. If you wrap this runtime with
147
+ `systemd`, Docker, Kubernetes, or another supervisor, you own the service
148
+ user, secret storage, restart policy, and hardening choices.
146
149
 
147
150
  Read before deployment:
148
151
 
149
152
  - [SECURITY.md](SECURITY.md)
150
- - [scripts/deploy_release_readme.md](scripts/deploy_release_readme.md)
153
+ - [docs/guide.md](docs/guide.md)
151
154
 
152
155
  ## User Paths
153
156
 
@@ -183,16 +186,59 @@ OPENCODE_MODEL_ID=gemini-3.1-pro-preview \
183
186
  opencode serve
184
187
 
185
188
  A2A_BEARER_TOKEN=prod-token \
189
+ A2A_HOST=127.0.0.1 \
190
+ A2A_PORT=8000 \
186
191
  A2A_PUBLIC_URL=http://127.0.0.1:8000 \
187
- OPENCODE_DIRECTORY=/abs/path/to/workspace \
188
- opencode-a2a-server
192
+ OPENCODE_MANAGED_SERVER=true \
193
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
194
+ opencode-a2a-server serve
189
195
  ```
190
196
 
197
+ `OPENCODE_WORKSPACE_ROOT` is the default workspace root that this runtime
198
+ exposes to OpenCode.
199
+
191
200
  Default address: `http://127.0.0.1:8000`
192
201
 
202
+ OpenCode upstream modes:
203
+
204
+ - Managed upstream: set `OPENCODE_MANAGED_SERVER=true` and
205
+ `opencode-a2a-server` will start a local `opencode serve`, capture its actual
206
+ listening URL, and stop it on shutdown.
207
+ - External upstream: you start and manage `opencode serve` yourself, then point
208
+ `OPENCODE_BASE_URL` at that HTTP endpoint.
209
+
210
+ Common runtime variables:
211
+
212
+ | Variable | Required | Default | Purpose |
213
+ | --- | --- | --- | --- |
214
+ | `A2A_BEARER_TOKEN` | Yes | None | Bearer token required for authenticated runtime requests. |
215
+ | `OPENCODE_BASE_URL` | No | `http://127.0.0.1:4096` | Upstream OpenCode HTTP endpoint for externally managed upstream mode. |
216
+ | `OPENCODE_MANAGED_SERVER` | No | `false` | Start and manage a local `opencode serve` child process. |
217
+ | `OPENCODE_MANAGED_SERVER_HOST` | No | `127.0.0.1` | Bind host used when managed upstream mode is enabled. |
218
+ | `OPENCODE_MANAGED_SERVER_PORT` | No | auto-pick | Bind port used when managed upstream mode is enabled. |
219
+ | `OPENCODE_COMMAND` | No | `opencode` | OpenCode CLI executable used for managed upstream mode. |
220
+ | `OPENCODE_STARTUP_TIMEOUT` | No | `20` | Seconds to wait for managed upstream startup. |
221
+ | `OPENCODE_WORKSPACE_ROOT` | No | None | Default workspace root exposed to OpenCode. |
222
+ | `OPENCODE_PROVIDER_ID` | No | None | Default provider for the upstream runtime. |
223
+ | `OPENCODE_MODEL_ID` | No | None | Default model for the upstream runtime. Set together with `OPENCODE_PROVIDER_ID`. |
224
+ | `A2A_HOST` | No | `127.0.0.1` | Bind host for the A2A server. |
225
+ | `A2A_PORT` | No | `8000` | Bind port for the A2A server. |
226
+ | `A2A_PUBLIC_URL` | No | `http://127.0.0.1:8000` | Public base URL advertised by the Agent Card. |
227
+ | `A2A_LOG_LEVEL` | No | `WARNING` | Server log level. |
228
+ | `A2A_LOG_PAYLOADS` | No | `false` | Enable request/response payload logging. |
229
+ | `A2A_LOG_BODY_LIMIT` | No | `0` | Payload preview size used when payload logging is enabled. |
230
+ | `A2A_MAX_REQUEST_BODY_BYTES` | No | `1048576` | Maximum accepted request size. |
231
+ | `A2A_ALLOW_DIRECTORY_OVERRIDE` | No | `true` | Allow request-level `metadata.opencode.directory` overrides. |
232
+ | `A2A_ENABLE_SESSION_SHELL` | No | `false` | Enable high-risk `opencode.sessions.shell`. |
233
+ | `OPENCODE_TIMEOUT` | No | `120` | Upstream OpenCode request timeout in seconds. |
234
+ | `OPENCODE_TIMEOUT_STREAM` | No | None | Upstream OpenCode stream timeout override in seconds. |
235
+
193
236
  If you omit `OPENCODE_PROVIDER_ID` / `OPENCODE_MODEL_ID`, `opencode serve`
194
237
  uses your local OpenCode defaults (for example `~/.config/opencode/opencode.json`).
195
238
 
239
+ When `OPENCODE_MANAGED_SERVER=true`, `OPENCODE_BASE_URL` is ignored and the
240
+ runtime binds itself to the managed child process instead.
241
+
196
242
  For provider-specific auth, model IDs, and config details, use the OpenCode
197
243
  official docs and CLI:
198
244
 
@@ -201,36 +247,90 @@ official docs and CLI:
201
247
  - Local checks: `opencode auth list`, `opencode models`, `opencode models <provider>`
202
248
 
203
249
  This path is for users who already manage their own shell, workspace, and
204
- process lifecycle. No host bootstrap script is required.
250
+ process lifecycle.
251
+
252
+ Use any supervisor you prefer for long-running operation:
253
+
254
+ - `systemd`
255
+ - Docker / container runtimes
256
+ - Kubernetes
257
+ - `supervisord`, `pm2`, or similar process managers
258
+
259
+ The project no longer ships built-in host bootstrap or process-manager
260
+ wrappers. The official product surface is the runtime entrypoint itself.
261
+
262
+ Minimal self-managed `systemd` example:
263
+
264
+ 1. Create an env file such as `/etc/opencode-a2a/alpha.env`:
265
+
266
+ ```bash
267
+ A2A_BEARER_TOKEN=replace-me
268
+ A2A_HOST=127.0.0.1
269
+ A2A_PORT=8000
270
+ A2A_PUBLIC_URL=https://a2a.example.com
271
+ OPENCODE_MANAGED_SERVER=true
272
+ OPENCODE_WORKSPACE_ROOT=/srv/my-workspace
273
+ ```
274
+
275
+ 2. Create a unit file such as `/etc/systemd/system/opencode-a2a-server.service`:
276
+
277
+ ```ini
278
+ [Unit]
279
+ Description=OpenCode A2A Server
280
+ After=network-online.target
281
+ Wants=network-online.target
205
282
 
206
- ### Path 2: Formal systemd Deploy From a Released Version
283
+ [Service]
284
+ Type=simple
285
+ WorkingDirectory=/srv/my-workspace
286
+ EnvironmentFile=/etc/opencode-a2a/alpha.env
287
+ ExecStart=/home/dev/.local/bin/opencode-a2a-server serve
288
+ Restart=on-failure
289
+ RestartSec=2
207
290
 
208
- For long-running systemd deployments, use the release-based scripts:
291
+ [Install]
292
+ WantedBy=multi-user.target
293
+ ```
294
+
295
+ Replace `ExecStart` with the absolute path returned by `command -v opencode-a2a-server`.
296
+
297
+ Minimal managed-upstream foreground example:
209
298
 
210
299
  ```bash
211
- ./scripts/init_release_system.sh
212
- ./scripts/deploy_release.sh project=alpha a2a_port=8010 a2a_host=127.0.0.1
300
+ A2A_BEARER_TOKEN=dev-token \
301
+ A2A_HOST=127.0.0.1 \
302
+ A2A_PORT=8000 \
303
+ A2A_PUBLIC_URL=http://127.0.0.1:8000 \
304
+ OPENCODE_MANAGED_SERVER=true \
305
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
306
+ opencode-a2a-server serve
213
307
  ```
214
308
 
215
- This path is for users who want:
309
+ Advanced: externally managed upstream
310
+
311
+ Use this mode when you intentionally want `opencode serve` and
312
+ `opencode-a2a-server` to be supervised independently.
216
313
 
217
- - isolated Linux users and per-project directories
218
- - systemd-managed restart behavior
219
- - root-only secret files
220
- - published package versions as the deployment boundary
314
+ ```bash
315
+ OPENCODE_BASE_URL=http://127.0.0.1:4096 \
316
+ A2A_BEARER_TOKEN=dev-token \
317
+ A2A_HOST=127.0.0.1 \
318
+ A2A_PORT=8000 \
319
+ A2A_PUBLIC_URL=http://127.0.0.1:8000 \
320
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
321
+ opencode-a2a-server serve
322
+ ```
221
323
 
222
- Primary operator docs:
324
+ Migration notes:
223
325
 
224
- - [scripts/init_release_system.sh](scripts/init_release_system.sh)
225
- - [scripts/deploy_release.sh](scripts/deploy_release.sh)
226
- - [scripts/deploy_release_readme.md](scripts/deploy_release_readme.md)
227
- - [docs/release_deploy_smoke_test.md](docs/release_deploy_smoke_test.md)
326
+ - `OPENCODE_DIRECTORY` has been removed. Use `OPENCODE_WORKSPACE_ROOT`.
327
+ - Built-in `init-release-system`, `deploy-release`, and `uninstall-instance` have been removed.
328
+ - Secret storage, service users, restart policy, and supervisor configuration are now operator-managed.
228
329
 
229
330
  ## Contributor Paths
230
331
 
231
332
  Use the repository checkout directly only for development, local debugging, or
232
- validation against unreleased changes. Source-based deploy/bootstrap docs are
233
- kept for contributors and internal debugging, not as the recommended user path.
333
+ validation against unreleased changes.
234
334
 
235
335
  Quick source run:
236
336
 
@@ -243,8 +343,11 @@ OPENCODE_MODEL_ID=gemini-3.1-pro-preview \
243
343
  opencode serve
244
344
 
245
345
  A2A_BEARER_TOKEN=dev-token \
246
- OPENCODE_DIRECTORY=/abs/path/to/workspace \
247
- uv run opencode-a2a-server
346
+ OPENCODE_BASE_URL=http://127.0.0.1:4096 \
347
+ A2A_HOST=127.0.0.1 \
348
+ A2A_PORT=8000 \
349
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
350
+ uv run opencode-a2a-server serve
248
351
  ```
249
352
 
250
353
  Baseline validation:
@@ -256,34 +359,17 @@ uv run pytest
256
359
 
257
360
  ## Documentation Map
258
361
 
259
- ### User / Operator Docs
362
+ ### User Docs
260
363
 
261
364
  - [docs/guide.md](docs/guide.md)
262
365
  Product behavior, API contracts, and detailed streaming/session/interrupt
263
366
  consumption guidance.
367
+ - [SECURITY.md](SECURITY.md)
368
+ Threat model, deployment caveats, and vulnerability disclosure guidance.
264
369
  - [CONTRIBUTING.md](CONTRIBUTING.md)
265
370
  Contributor workflow, validation baseline, and documentation expectations.
266
- - [docs/agent_deploy_sop.md](docs/agent_deploy_sop.md)
267
- Operator-facing SOP for release-based deployment, verification, and uninstall.
268
- - [docs/release_deploy_smoke_test.md](docs/release_deploy_smoke_test.md)
269
- Real-host smoke test checklist for release-based systemd deployment.
270
- - [scripts/deploy_release_readme.md](scripts/deploy_release_readme.md)
271
- Release-based systemd deployment guide for published package versions.
272
- - [scripts/init_release_system_readme.md](scripts/init_release_system_readme.md)
273
- Release-based host bootstrap guide that avoids source checkout.
274
- - [scripts/uninstall_readme.md](scripts/uninstall_readme.md)
275
- Preview-first uninstall flow for deployed instances.
276
371
  - [scripts/README.md](scripts/README.md)
277
- Full script index, including contributor/internal paths.
278
-
279
- ### Contributor / Internal Docs
280
-
281
- - [scripts/deploy_readme.md](scripts/deploy_readme.md)
282
- Source-based systemd deployment for development/debugging only.
283
- - [scripts/init_system_readme.md](scripts/init_system_readme.md)
284
- Source-based host bootstrap for contributor/internal workflows.
285
- - [SECURITY.md](SECURITY.md)
286
- threat model, deployment caveats, and vulnerability disclosure guidance.
372
+ Contributor helper script index.
287
373
 
288
374
  ## License
289
375
 
@@ -1,11 +1,11 @@
1
1
  # opencode-a2a-server
2
2
 
3
- > Turn OpenCode into a stateful A2A service with a clear runtime boundary and production-friendly deployment workflow.
3
+ > Turn OpenCode into a stateful A2A service with a clear runtime boundary.
4
4
 
5
5
  `opencode-a2a-server` exposes OpenCode through standard A2A interfaces and adds
6
- the operational pieces that raw agent runtimes usually do not provide by
7
- default: authentication, session continuity, streaming contracts, interrupt
8
- handling, deployment tooling, and explicit security guidance.
6
+ the runtime pieces that raw agent runtimes usually do not provide by default:
7
+ authentication, session continuity, streaming contracts, interrupt handling,
8
+ and explicit security guidance.
9
9
 
10
10
  ## Why This Project Exists
11
11
 
@@ -14,7 +14,8 @@ need a stable service layer around it. This repository provides that layer by:
14
14
 
15
15
  - bridging A2A transport contracts to OpenCode session/message/event APIs
16
16
  - making session and interrupt behavior explicit and auditable
17
- - packaging release-first deployment scripts and operational guidance for long-running use
17
+ - keeping the server/runtime contract explicit while leaving deployment
18
+ supervision to the operator
18
19
 
19
20
  ## What It Already Provides
20
21
 
@@ -26,7 +27,7 @@ need a stable service layer around it. This repository provides that layer by:
26
27
  - session continuation via `metadata.shared.session.id`
27
28
  - request-scoped model selection via `metadata.shared.model`
28
29
  - OpenCode session query/control extensions and provider/model discovery
29
- - released CLI install/upgrade flow and release-based systemd deployment
30
+ - released CLI install/upgrade flow and a foreground runtime entrypoint
30
31
 
31
32
  ## Extension Capability Overview
32
33
 
@@ -58,7 +59,9 @@ Detailed consumption guidance:
58
59
  One `OpenCode + opencode-a2a-server` instance pair is treated as a
59
60
  single-tenant trust boundary.
60
61
 
61
- This repository's intended scaling model is parameterized self-deployment: consumers should launch their own isolated instance pairs through the provided deployment scripts instead of sharing one runtime across mutually untrusted tenants.
62
+ This repository's intended scaling model is parameterized self-deployment:
63
+ consumers should launch their own isolated instance pairs instead of sharing
64
+ one runtime across mutually untrusted tenants.
62
65
 
63
66
  - OpenCode may manage multiple projects/directories, but one deployed instance
64
67
  is not a secure multi-tenant runtime.
@@ -77,7 +80,6 @@ flowchart TD
77
80
  Mapping --> Runtime["OpenCode HTTP runtime"]
78
81
 
79
82
  Api --> Auth["Bearer auth + request logging controls"]
80
- Api --> Deploy["release-based deployment tooling"]
81
83
  Runtime --> Workspace["Shared workspace / environment boundary"]
82
84
  ```
83
85
 
@@ -103,13 +105,14 @@ hard multi-tenant isolation layer.
103
105
  isolation boundary inside one deployed instance.
104
106
  - LLM provider keys are consumed by the OpenCode process. Prompt injection or
105
107
  indirect exfiltration attempts may still expose sensitive values.
106
- - systemd deploy defaults use operator-provisioned root-only secret files
107
- unless `ENABLE_SECRET_PERSISTENCE=true` is explicitly enabled.
108
+ - Deployment supervision is intentionally BYO. If you wrap this runtime with
109
+ `systemd`, Docker, Kubernetes, or another supervisor, you own the service
110
+ user, secret storage, restart policy, and hardening choices.
108
111
 
109
112
  Read before deployment:
110
113
 
111
114
  - [SECURITY.md](SECURITY.md)
112
- - [scripts/deploy_release_readme.md](scripts/deploy_release_readme.md)
115
+ - [docs/guide.md](docs/guide.md)
113
116
 
114
117
  ## User Paths
115
118
 
@@ -145,16 +148,59 @@ OPENCODE_MODEL_ID=gemini-3.1-pro-preview \
145
148
  opencode serve
146
149
 
147
150
  A2A_BEARER_TOKEN=prod-token \
151
+ A2A_HOST=127.0.0.1 \
152
+ A2A_PORT=8000 \
148
153
  A2A_PUBLIC_URL=http://127.0.0.1:8000 \
149
- OPENCODE_DIRECTORY=/abs/path/to/workspace \
150
- opencode-a2a-server
154
+ OPENCODE_MANAGED_SERVER=true \
155
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
156
+ opencode-a2a-server serve
151
157
  ```
152
158
 
159
+ `OPENCODE_WORKSPACE_ROOT` is the default workspace root that this runtime
160
+ exposes to OpenCode.
161
+
153
162
  Default address: `http://127.0.0.1:8000`
154
163
 
164
+ OpenCode upstream modes:
165
+
166
+ - Managed upstream: set `OPENCODE_MANAGED_SERVER=true` and
167
+ `opencode-a2a-server` will start a local `opencode serve`, capture its actual
168
+ listening URL, and stop it on shutdown.
169
+ - External upstream: you start and manage `opencode serve` yourself, then point
170
+ `OPENCODE_BASE_URL` at that HTTP endpoint.
171
+
172
+ Common runtime variables:
173
+
174
+ | Variable | Required | Default | Purpose |
175
+ | --- | --- | --- | --- |
176
+ | `A2A_BEARER_TOKEN` | Yes | None | Bearer token required for authenticated runtime requests. |
177
+ | `OPENCODE_BASE_URL` | No | `http://127.0.0.1:4096` | Upstream OpenCode HTTP endpoint for externally managed upstream mode. |
178
+ | `OPENCODE_MANAGED_SERVER` | No | `false` | Start and manage a local `opencode serve` child process. |
179
+ | `OPENCODE_MANAGED_SERVER_HOST` | No | `127.0.0.1` | Bind host used when managed upstream mode is enabled. |
180
+ | `OPENCODE_MANAGED_SERVER_PORT` | No | auto-pick | Bind port used when managed upstream mode is enabled. |
181
+ | `OPENCODE_COMMAND` | No | `opencode` | OpenCode CLI executable used for managed upstream mode. |
182
+ | `OPENCODE_STARTUP_TIMEOUT` | No | `20` | Seconds to wait for managed upstream startup. |
183
+ | `OPENCODE_WORKSPACE_ROOT` | No | None | Default workspace root exposed to OpenCode. |
184
+ | `OPENCODE_PROVIDER_ID` | No | None | Default provider for the upstream runtime. |
185
+ | `OPENCODE_MODEL_ID` | No | None | Default model for the upstream runtime. Set together with `OPENCODE_PROVIDER_ID`. |
186
+ | `A2A_HOST` | No | `127.0.0.1` | Bind host for the A2A server. |
187
+ | `A2A_PORT` | No | `8000` | Bind port for the A2A server. |
188
+ | `A2A_PUBLIC_URL` | No | `http://127.0.0.1:8000` | Public base URL advertised by the Agent Card. |
189
+ | `A2A_LOG_LEVEL` | No | `WARNING` | Server log level. |
190
+ | `A2A_LOG_PAYLOADS` | No | `false` | Enable request/response payload logging. |
191
+ | `A2A_LOG_BODY_LIMIT` | No | `0` | Payload preview size used when payload logging is enabled. |
192
+ | `A2A_MAX_REQUEST_BODY_BYTES` | No | `1048576` | Maximum accepted request size. |
193
+ | `A2A_ALLOW_DIRECTORY_OVERRIDE` | No | `true` | Allow request-level `metadata.opencode.directory` overrides. |
194
+ | `A2A_ENABLE_SESSION_SHELL` | No | `false` | Enable high-risk `opencode.sessions.shell`. |
195
+ | `OPENCODE_TIMEOUT` | No | `120` | Upstream OpenCode request timeout in seconds. |
196
+ | `OPENCODE_TIMEOUT_STREAM` | No | None | Upstream OpenCode stream timeout override in seconds. |
197
+
155
198
  If you omit `OPENCODE_PROVIDER_ID` / `OPENCODE_MODEL_ID`, `opencode serve`
156
199
  uses your local OpenCode defaults (for example `~/.config/opencode/opencode.json`).
157
200
 
201
+ When `OPENCODE_MANAGED_SERVER=true`, `OPENCODE_BASE_URL` is ignored and the
202
+ runtime binds itself to the managed child process instead.
203
+
158
204
  For provider-specific auth, model IDs, and config details, use the OpenCode
159
205
  official docs and CLI:
160
206
 
@@ -163,36 +209,90 @@ official docs and CLI:
163
209
  - Local checks: `opencode auth list`, `opencode models`, `opencode models <provider>`
164
210
 
165
211
  This path is for users who already manage their own shell, workspace, and
166
- process lifecycle. No host bootstrap script is required.
212
+ process lifecycle.
213
+
214
+ Use any supervisor you prefer for long-running operation:
215
+
216
+ - `systemd`
217
+ - Docker / container runtimes
218
+ - Kubernetes
219
+ - `supervisord`, `pm2`, or similar process managers
220
+
221
+ The project no longer ships built-in host bootstrap or process-manager
222
+ wrappers. The official product surface is the runtime entrypoint itself.
223
+
224
+ Minimal self-managed `systemd` example:
225
+
226
+ 1. Create an env file such as `/etc/opencode-a2a/alpha.env`:
227
+
228
+ ```bash
229
+ A2A_BEARER_TOKEN=replace-me
230
+ A2A_HOST=127.0.0.1
231
+ A2A_PORT=8000
232
+ A2A_PUBLIC_URL=https://a2a.example.com
233
+ OPENCODE_MANAGED_SERVER=true
234
+ OPENCODE_WORKSPACE_ROOT=/srv/my-workspace
235
+ ```
236
+
237
+ 2. Create a unit file such as `/etc/systemd/system/opencode-a2a-server.service`:
238
+
239
+ ```ini
240
+ [Unit]
241
+ Description=OpenCode A2A Server
242
+ After=network-online.target
243
+ Wants=network-online.target
167
244
 
168
- ### Path 2: Formal systemd Deploy From a Released Version
245
+ [Service]
246
+ Type=simple
247
+ WorkingDirectory=/srv/my-workspace
248
+ EnvironmentFile=/etc/opencode-a2a/alpha.env
249
+ ExecStart=/home/dev/.local/bin/opencode-a2a-server serve
250
+ Restart=on-failure
251
+ RestartSec=2
169
252
 
170
- For long-running systemd deployments, use the release-based scripts:
253
+ [Install]
254
+ WantedBy=multi-user.target
255
+ ```
256
+
257
+ Replace `ExecStart` with the absolute path returned by `command -v opencode-a2a-server`.
258
+
259
+ Minimal managed-upstream foreground example:
171
260
 
172
261
  ```bash
173
- ./scripts/init_release_system.sh
174
- ./scripts/deploy_release.sh project=alpha a2a_port=8010 a2a_host=127.0.0.1
262
+ A2A_BEARER_TOKEN=dev-token \
263
+ A2A_HOST=127.0.0.1 \
264
+ A2A_PORT=8000 \
265
+ A2A_PUBLIC_URL=http://127.0.0.1:8000 \
266
+ OPENCODE_MANAGED_SERVER=true \
267
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
268
+ opencode-a2a-server serve
175
269
  ```
176
270
 
177
- This path is for users who want:
271
+ Advanced: externally managed upstream
272
+
273
+ Use this mode when you intentionally want `opencode serve` and
274
+ `opencode-a2a-server` to be supervised independently.
178
275
 
179
- - isolated Linux users and per-project directories
180
- - systemd-managed restart behavior
181
- - root-only secret files
182
- - published package versions as the deployment boundary
276
+ ```bash
277
+ OPENCODE_BASE_URL=http://127.0.0.1:4096 \
278
+ A2A_BEARER_TOKEN=dev-token \
279
+ A2A_HOST=127.0.0.1 \
280
+ A2A_PORT=8000 \
281
+ A2A_PUBLIC_URL=http://127.0.0.1:8000 \
282
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
283
+ opencode-a2a-server serve
284
+ ```
183
285
 
184
- Primary operator docs:
286
+ Migration notes:
185
287
 
186
- - [scripts/init_release_system.sh](scripts/init_release_system.sh)
187
- - [scripts/deploy_release.sh](scripts/deploy_release.sh)
188
- - [scripts/deploy_release_readme.md](scripts/deploy_release_readme.md)
189
- - [docs/release_deploy_smoke_test.md](docs/release_deploy_smoke_test.md)
288
+ - `OPENCODE_DIRECTORY` has been removed. Use `OPENCODE_WORKSPACE_ROOT`.
289
+ - Built-in `init-release-system`, `deploy-release`, and `uninstall-instance` have been removed.
290
+ - Secret storage, service users, restart policy, and supervisor configuration are now operator-managed.
190
291
 
191
292
  ## Contributor Paths
192
293
 
193
294
  Use the repository checkout directly only for development, local debugging, or
194
- validation against unreleased changes. Source-based deploy/bootstrap docs are
195
- kept for contributors and internal debugging, not as the recommended user path.
295
+ validation against unreleased changes.
196
296
 
197
297
  Quick source run:
198
298
 
@@ -205,8 +305,11 @@ OPENCODE_MODEL_ID=gemini-3.1-pro-preview \
205
305
  opencode serve
206
306
 
207
307
  A2A_BEARER_TOKEN=dev-token \
208
- OPENCODE_DIRECTORY=/abs/path/to/workspace \
209
- uv run opencode-a2a-server
308
+ OPENCODE_BASE_URL=http://127.0.0.1:4096 \
309
+ A2A_HOST=127.0.0.1 \
310
+ A2A_PORT=8000 \
311
+ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
312
+ uv run opencode-a2a-server serve
210
313
  ```
211
314
 
212
315
  Baseline validation:
@@ -218,34 +321,17 @@ uv run pytest
218
321
 
219
322
  ## Documentation Map
220
323
 
221
- ### User / Operator Docs
324
+ ### User Docs
222
325
 
223
326
  - [docs/guide.md](docs/guide.md)
224
327
  Product behavior, API contracts, and detailed streaming/session/interrupt
225
328
  consumption guidance.
329
+ - [SECURITY.md](SECURITY.md)
330
+ Threat model, deployment caveats, and vulnerability disclosure guidance.
226
331
  - [CONTRIBUTING.md](CONTRIBUTING.md)
227
332
  Contributor workflow, validation baseline, and documentation expectations.
228
- - [docs/agent_deploy_sop.md](docs/agent_deploy_sop.md)
229
- Operator-facing SOP for release-based deployment, verification, and uninstall.
230
- - [docs/release_deploy_smoke_test.md](docs/release_deploy_smoke_test.md)
231
- Real-host smoke test checklist for release-based systemd deployment.
232
- - [scripts/deploy_release_readme.md](scripts/deploy_release_readme.md)
233
- Release-based systemd deployment guide for published package versions.
234
- - [scripts/init_release_system_readme.md](scripts/init_release_system_readme.md)
235
- Release-based host bootstrap guide that avoids source checkout.
236
- - [scripts/uninstall_readme.md](scripts/uninstall_readme.md)
237
- Preview-first uninstall flow for deployed instances.
238
333
  - [scripts/README.md](scripts/README.md)
239
- Full script index, including contributor/internal paths.
240
-
241
- ### Contributor / Internal Docs
242
-
243
- - [scripts/deploy_readme.md](scripts/deploy_readme.md)
244
- Source-based systemd deployment for development/debugging only.
245
- - [scripts/init_system_readme.md](scripts/init_system_readme.md)
246
- Source-based host bootstrap for contributor/internal workflows.
247
- - [SECURITY.md](SECURITY.md)
248
- threat model, deployment caveats, and vulnerability disclosure guidance.
334
+ Contributor helper script index.
249
335
 
250
336
  ## License
251
337
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  This repository is an adapter layer that exposes OpenCode through A2A
6
6
  HTTP+JSON and JSON-RPC interfaces. It adds authentication, task/session
7
- contracts, streaming, interrupt handling, and deployment tooling, but it does
7
+ contracts, streaming, interrupt handling, and runtime guidance, but it does
8
8
  not fully isolate upstream model credentials from OpenCode runtime behavior.
9
9
 
10
10
  ## Security Boundary
@@ -20,9 +20,9 @@ not fully isolate upstream model credentials from OpenCode runtime behavior.
20
20
  indirect exfiltration attempts may still expose sensitive values.
21
21
  - Payload logging is opt-in. When `A2A_LOG_PAYLOADS=true`, operators should
22
22
  treat logs as potentially sensitive operational data.
23
- - In systemd deployment mode, secret persistence is opt-in. The deploy scripts
24
- should not write `GH_TOKEN`, `A2A_BEARER_TOKEN`, or provider keys to disk
25
- unless `ENABLE_SECRET_PERSISTENCE=true` is explicitly set.
23
+ - This project does not ship host bootstrap or process-manager wrappers as an
24
+ official product capability. Operators remain responsible for file
25
+ permissions, secret storage, service users, and supervisor-specific hardening.
26
26
 
27
27
  ## Threat Model
28
28