@dudousxd/nestjs-agent-opencode 0.1.0 → 0.1.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.
- package/README.md +26 -2
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +1 -1
- package/dist/durable/index.d.ts +1 -1
- package/dist/durable/index.js.map +1 -1
- package/dist/{engine-C_WSZ0cZ.d.cts → engine-Bij6AdoF.d.cts} +5 -2
- package/dist/{engine-C_WSZ0cZ.d.ts → engine-Bij6AdoF.d.ts} +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -103,14 +103,38 @@ kept session's turns once half-way through). Use the same `secret` in every proc
|
|
|
103
103
|
AgentModule.forRoot({
|
|
104
104
|
engine: openCode({
|
|
105
105
|
host: MyOpenCodeHost,
|
|
106
|
-
// Where OpenCode reaches
|
|
107
|
-
tools: { url:
|
|
106
|
+
// Where the OpenCode server reaches this app's endpoint — see "The tools URL" below.
|
|
107
|
+
tools: { url: process.env.OPENCODE_TOOLS_URL!, secret: process.env.OPENCODE_TOOLS_SECRET },
|
|
108
108
|
}),
|
|
109
109
|
memory: { provider }, // a provider with `write` → OpenCode gets `remember`
|
|
110
110
|
...
|
|
111
111
|
}),
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
### The tools URL
|
|
115
|
+
|
|
116
|
+
`tools.url` has no default and is not derived from anything: the engine passes it verbatim to
|
|
117
|
+
OpenCode (`mcp.add` with `{ type: 'remote', url, headers: { Authorization: 'Bearer <token>' } }`),
|
|
118
|
+
and it is the **OpenCode server** — a separate process, often in another container or sandbox — that
|
|
119
|
+
calls it back. So it must be an address of this Nest app **as seen from the OpenCode server**, ending
|
|
120
|
+
in `<path>/opencode/mcp` (`path` is `AgentModule`'s route prefix, `agent` by default; a global prefix
|
|
121
|
+
is part of it too). There is no special hostname: `app.internal` in older examples was only a
|
|
122
|
+
placeholder. Keep it in an env variable (`OPENCODE_TOOLS_URL`) so each deployment sets its own.
|
|
123
|
+
|
|
124
|
+
| Where OpenCode runs | `OPENCODE_TOOLS_URL` |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| Same machine as the app | `http://127.0.0.1:3000/agent/opencode/mcp` |
|
|
127
|
+
| Docker Compose | the app's service name: `http://api:3000/agent/opencode/mcp` |
|
|
128
|
+
| Kubernetes | the app's Service DNS: `http://api.my-namespace.svc.cluster.local:3000/agent/opencode/mcp` |
|
|
129
|
+
| Anywhere else | the app's public URL works (`https://app.example.com/agent/opencode/mcp`) |
|
|
130
|
+
|
|
131
|
+
Prefer an internal network address: the endpoint only ever serves OpenCode, and a public URL puts it
|
|
132
|
+
on the internet (it stays guarded by the token, below). It must reach a process that mounts
|
|
133
|
+
controllers — `surface: 'engine'` mounts none. If several processes sit behind that address (or the
|
|
134
|
+
turns run on engine workers and the endpoint on HTTP pods), give them all the same `tools.secret`, so
|
|
135
|
+
a token signed by one is accepted by the others; without it each process signs with its own random
|
|
136
|
+
secret and the engine logs a warning.
|
|
137
|
+
|
|
114
138
|
The endpoint serves turns, nothing else. A token alone runs nothing:
|
|
115
139
|
|
|
116
140
|
- a call runs only while the token's actor has a turn running on the session the call names (OpenCode
|