mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-16 06:12:40 +00:00
* fix(opencode): support v2 while preserving v1 provider behavior * fix(opencode): target v2.0.7, keeping v1 support OpenCode 2.0.4 removed the /api/health endpoint and the plugin await-activation endpoint, and moved form reply/cancel under the session namespace. The v2 adapter was pinned to the 2.0.3 SDK, so any 2.0.4+ binary failed at helper-server startup with an opaque HTTP 404. - Pin @opencode/client to 2.0.7 and require v2 >= 2.0.4 at runtime selection, with a clear error for older binaries. - Use server.info for helper-server readiness. - Move form reply/cancel/list to session.form and send the permission decision field instead of reply. - Replace plugin.awaitActivation with a plugin.list readiness wait. A cold location registers its config-derived commands, skills, and providers asynchronously; an empty inventory means it is still warming. - Send session.command.name, which replaced command, and drop the removed SkillInfo.slash field. - Update the v2 test harness, unit tests, dependency lockfile, CI matrix, and provider docs to 2.0.7. * fix(opencode): target 2.0.10 and address v2 review findings * test(opencode): colocate v2 suites with their modules Greptile's review flagged that the v2 tests lived in top-level opencode-agent.*.test.ts files and imported the readiness helper, v2 client, harness, and API types from a distance. Move each v2 suite beside the module it describes and leave the top-level files to the v1 public path: - opencode/v2/agent.test.ts: session lifecycle, structured output, resume, reconciliation, interrupt/replacement, helper isolation. - opencode/v2/readiness.test.ts: location readiness deadline behavior. - opencode/v2/permissions.test.ts: question and approval routing. - opencode/v2/configuration.test.ts: permissionRules, feature flags, and helper-isolation decisions, exercised directly through the module. - opencode/v2/mapping.test.ts: model and mode normalization. - opencode/runtime-client.test.ts: runtime version selection. The v1 recovery, permission-action, and catalog-deadline suites stay in place. Test counts are preserved, with deeper per-module coverage for configuration. * test(opencode): split v2 local E2E by behavior and add harness helpers The re-review flagged the v2 scenarios in opencode-bridge.local.e2e.test.ts for inline event filtering, permission-kind branching, and polling in test bodies. Move stream, permission, and subagent coordination behind helpers in opencode/test-utils/v2-local-e2e-helpers.ts, and split the session scenarios into opencode-v2.local.e2e.test.ts so each file covers one behavior: - opencode-bridge.local.e2e.test.ts: process sharing, shell.env scoping, the native tool bridge, and runtime version selection. - opencode-v2.local.e2e.test.ts: session lifecycle, structured output, streaming, approvals, MCP preapproval, stop/replacement, rewind and subagents, commands, and skills/attachments. Each helper waits on or answers the provider directly, so the tests state domain intent and assert the collected result instead of polling or branching inline. The CI-selected "versioned runtime" case stays in the bridge file, and the live approvals and stop/replacement scenarios were re-run green through the new helpers. * fix(ci): preserve required server checks across OpenCode versions Run v1 and v2 integration coverage sequentially so branch protection keeps its existing static check names. * fix(agents): load startup history before registering sessions A failed history stream while adding a runtime notice must close the unregistered session instead of leaving an initializing agent behind. * fix(agents): limit startup history before buffering it Apply the existing timeline content limits to each incoming history event so raw cumulative tool output is not retained until registration completes. * fix(opencode): resolve Windows executables from platform packages Recent v1 npm releases place opencode.exe in the architecture dependency rather than the CLI bin directory. Resolve that dependency from the CLI package while retaining support for the older layout. * refactor(opencode): name public runtime option types * test(opencode): let the spec own both runtime versions Install each version in an isolated temporary directory and select it through provider configuration. Restore the CI workflow unchanged so version coverage is owned by the spec rather than workflow orchestration. * test(opencode): launch native Windows binaries in isolated specs Avoid npm command wrappers retaining locked executable files after helper shutdown during temporary installation cleanup. * fix(opencode): preserve the legacy path when adding v2 support Fall back to the existing client when version probing is inconclusive. Load v2 code and its bridge plugin only after positive v2 selection, keep v1 sessions undecorated, and restore original v1 discovery errors. * fix(opencode): retry inconclusive version selection A failed or unrecognized version probe previously cached the legacy fallback, pinning an upgraded binary to the v1 API until client recreation. Retry detection on the next operation while keeping the legacy path available. * fix(opencode): release legacy runtime after inconclusive probe Retryable version detection can clear the selected client after falling back to v1. Track whether the legacy client was selected so shutdown still releases its server without touching an unused v1 manager during a v2-only run. * test(opencode): assert full runtime notice history * fix(opencode): restore notice and retry behavior after rebase --------- Co-authored-by: Jonathan karras <6307688+karrots@users.noreply.github.com> Co-authored-by: Dhruv Singal <dhruvsingalabc@gmail.com>
31 lines
789 B
JavaScript
31 lines
789 B
JavaScript
import { mkdir } from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { build } from "esbuild";
|
|
|
|
for (const directory of ["", "v2/"]) {
|
|
const sourcePath = fileURLToPath(
|
|
new URL(
|
|
`../src/server/agent/providers/opencode/${directory}bridge-plugin.mjs`,
|
|
import.meta.url,
|
|
),
|
|
);
|
|
const outputPath = fileURLToPath(
|
|
new URL(
|
|
`../dist/server/server/agent/providers/opencode/${directory}bridge-plugin.bundle.mjs`,
|
|
import.meta.url,
|
|
),
|
|
);
|
|
await mkdir(path.dirname(outputPath), { recursive: true });
|
|
await build({
|
|
entryPoints: [sourcePath],
|
|
bundle: true,
|
|
format: "esm",
|
|
platform: "neutral",
|
|
mainFields: ["module", "main"],
|
|
target: "es2022",
|
|
outfile: outputPath,
|
|
});
|
|
}
|