mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
deps: Bump tsup from 8.5.1 to 9.0.0 in /plugins/opencode (#4385)
Build the OpenCode plugin with the patched esbuild line inside tsup's supported range. Headroom's existing esbuild 0.28 security override is outside tsup 8.5.1's ^0.27.0 declaration. Tsup 9 declares ^0.28.2, so retain the major upgrade and raise the override floor from ^0.28.1 to ^0.28.2. The original tsup 9 lock still selected 0.28.1; this follow-up corrects that mismatch and documents the source-build requirements. ## Dependency assessment - **Version reason:** use an upstream-supported build combination for the existing dependency-security mitigation, rather than forcing the selected esbuild release outside the old bundler's range. This does not claim a new advisory in 0.28.1 or that the old built plugin was demonstrated broken. Tsup remains the existing builder; [v9](https://github.com/egoist/tsup/releases/tag/v9.0.0) also changes debug/obug, watchers and related toolchain packages. - **Maintenance/security:** reviewed the published release/manifest and resolved graph. Fresh audit reports zero vulnerabilities; this does not imply every upstream project has a spotless history. Platform-selector metadata outside the esbuild refresh is preserved instead of accepting unrelated npm-version normalization. - **Node/build boundary:** tsup requires `^22.18.0 || ^24.11.0 || >=26.0.0`; the current graph's ini 7 also requires `^22.22.2 || ^24.15.0 || >=26.0.0`. The README documents both and the verified Node 24.22.2 choice. Published plugin/host runtime declarations are unchanged. An earlier Node 22.22.0 pass emitted the existing ini warning; acceptance uses the supported Node 24 install. - **Native/install/network:** existing esbuild/Rollup platform code and lifecycle scripts remain build inputs. Rollup's optional GNU Linux-x64 LZMA and Android-x64 bindings are present; the LZMA entry is a real optional dependency, not an orphan. Windows x64 installation/build was tested; these non-Windows paths were not. No new install-script flag is introduced. Existing plugin runtime dependencies are unchanged; tsup remains a development dependency. npm and host support-dependency installation use the registry. No plugin is published and no inference/provider message is requested. The branch is synchronized with main's merged security and SDK updates. ## Real behavior proof Windows x64 / Node 24.22.2 / npm 10.9.4, fresh isolated checkout. From `plugins/opencode`, under that Node: ```bash npm ci --ignore-scripts=false --no-audit --no-fund npm test npm run typecheck npm run build npm run build:standalone npm audit --json node ../../scripts/verify_opencode_bundle.mjs . ``` The install has no engine warning; **61 tests pass**, typecheck and both builds succeed, audit reports zero vulnerabilities. The committed portable proof imports actual `dist/index.js` and `dist-standalone/index.js`, invokes the built server entry and performs real chat/retrieve HTTP requests against an ephemeral loopback fixture. It asserts original upstream/path, project/session headers, response and retrieval content; output reports PASS. The plugin routes the synthetic OpenAI URL to the fixture. Hooks/sockets/processes are disposed. This is built-artifact wire behavior, not a claim that the fixture is the Python service. **Actual host loading:** installed official `opencode-ai@1.19.4`, matching the installed 1.x plugin SDK, into a task-only prefix/cache. Its native Windows `opencode.cmd debug config --print-logs` ran from an isolated task workspace with the built main entry `file:///G:/git/headroom-dep4385/plugins/opencode/dist/index.js` configured directly. No wrapper was used for this check. It exited 0 with successful bootstrap/configuration/disposal and no loader error. A separate instrumentation probe preserved the exported object shape and delegated its actual `server` function; it recorded `id=headroom`, retrieval-tool registration and the shell-environment hook. It did not adapt the object into a legacy function. The host's XDG config/data/state/cache point at task-only directories. Enabled providers are empty; auto-update, remote model fetching and default plugins are disabled. Credential environment names are removed in the child shell only; user home/config/auth files are not repurposed. The CLI installed support dependencies in the isolated config, so registry traffic occurred. No inference command or provider action was requested. Node syntax and whitespace checks pass. Independent technical review found no code or dependency-policy blocker in the corrected build range/source-runtime boundaries. Untested: actual OpenCode 2.x, registry-tarball plugin installation, the Python compression proxy in this smoke, streaming, live providers, hook-shim spawning, non-Windows native installation, or production publishing. Current-head hosted CI must pass before approval. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
This commit is contained in:
co-authored by
JerrettDavis
parent
e666fd8e35
commit
99e223c0e2
@@ -11,6 +11,22 @@ OpenCode integration helpers for Headroom. The package supports two integration
|
||||
npm install headroom-opencode
|
||||
```
|
||||
|
||||
## Building from source
|
||||
|
||||
Tsup 9 requires Node.js `^22.18.0 || ^24.11.0 || >=26.0.0`. The current locked
|
||||
graph also includes ini 7, which requires `^22.22.2 || ^24.15.0 || >=26.0.0`.
|
||||
These are development-install requirements; the published plugin and its host
|
||||
retain their own runtime requirements. Node.js 24.22.2 is a verified choice
|
||||
for this dependency graph. From `plugins/opencode`, run:
|
||||
|
||||
```bash
|
||||
npm ci
|
||||
npm test
|
||||
npm run typecheck
|
||||
npm run build
|
||||
npm run build:standalone
|
||||
```
|
||||
|
||||
## Provider Config Helpers
|
||||
|
||||
Use these helpers when you need to generate OpenCode config that routes a `headroom` provider through a running Headroom proxy.
|
||||
|
||||
Generated
+325
-268
File diff suppressed because it is too large
Load Diff
@@ -41,12 +41,12 @@
|
||||
"@opencode/plugin": "^2.0.14",
|
||||
"@types/node": "^26.1.1",
|
||||
"@typescript/native": "npm:typescript@^7.0.2",
|
||||
"tsup": "^8.0.0",
|
||||
"tsup": "^9.0.0",
|
||||
"typescript": "^6.0.3",
|
||||
"vitest": "^5.0.0"
|
||||
},
|
||||
"overrides": {
|
||||
"esbuild": "^0.28.1",
|
||||
"esbuild": "^0.28.2",
|
||||
"glob": "14.0.3",
|
||||
"minimatch": "11.0.3",
|
||||
"zod": "4.6.7",
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import http from 'node:http';
|
||||
import {pathToFileURL, fileURLToPath} from 'node:url';
|
||||
import path from 'node:path';
|
||||
const root=path.resolve(process.argv[2] ?? fileURLToPath(new URL('../plugins/opencode/', import.meta.url)))+path.sep;
|
||||
const mod=await import(pathToFileURL(root+'dist/index.js'));
|
||||
const standalone=await import(pathToFileURL(root+'dist-standalone/index.js'));
|
||||
assert.equal(standalone.default.id,'headroom');
|
||||
const seen=[];
|
||||
const server=http.createServer(async(req,res)=>{let body='';for await(const c of req)body+=c;seen.push({url:req.url,headers:req.headers,body});res.setHeader('content-type','application/json');res.end(JSON.stringify(req.url.startsWith('/v1/retrieve/')?{content:'original fixture content'}:{choices:[{message:{content:'loopback response'}}]}));});
|
||||
await new Promise(r=>server.listen(0,'127.0.0.1',r));
|
||||
const proxyUrl=`http://127.0.0.1:${server.address().port}`;
|
||||
let hooks;
|
||||
try {
|
||||
hooks=await mod.default.server({directory:'isolated-smoke',project:{id:'smoke-project'}},{proxyUrl,sessionToken:'smoke-session'});
|
||||
const response=await fetch('https://api.openai.com/v1/chat/completions',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({model:'fixture',messages:[{role:'user',content:'local smoke'}]})});
|
||||
assert.equal((await response.json()).choices[0].message.content,'loopback response');
|
||||
assert.equal(seen[0].headers['x-headroom-base-url'],'https://api.openai.com');
|
||||
assert.equal(seen[0].headers['x-headroom-original-path'],'/v1/chat/completions');
|
||||
assert.equal(seen[0].headers['x-headroom-project'],'smoke-project');
|
||||
assert.equal(seen[0].headers['x-headroom-session-token'],'smoke-session');
|
||||
const retrieved=await hooks.tool.headroom_retrieve.execute({hash:'0123456789abcdef01234567'});
|
||||
assert.equal(JSON.parse(retrieved).content,'original fixture content');
|
||||
assert.equal(seen.length,2);
|
||||
console.log(JSON.stringify({node:process.version,artifacts:['dist/index.js','dist-standalone/index.js'],requests:seen.map(x=>({url:x.url,project:x.headers['x-headroom-project']})),result:'PASS: actual built plugin entry, transport interception, routing headers, JSON response and retrieve over real loopback HTTP'}));
|
||||
} finally {await hooks?.dispose();server.closeAllConnections();await new Promise(r=>server.close(r));}
|
||||
Reference in New Issue
Block a user