@@ -43,6 +43,7 @@ import type { ServerProviderDraft } from "../providerSnapshot.ts";
4343import { mergeProviderInstanceEnvironment } from "../ProviderInstanceEnvironment.ts" ;
4444import {
4545 enrichProviderSnapshotWithVersionAdvisory ,
46+ makeManualOnlyProviderMaintenanceCapabilities ,
4647 makePackageManagedProviderMaintenanceResolver ,
4748 normalizeCommandPath ,
4849 resolveProviderMaintenanceCapabilitiesEffect ,
@@ -64,7 +65,7 @@ function isOpenCodeNativeCommandPath(commandPath: string): boolean {
6465 ) ;
6566}
6667
67- const UPDATE = makePackageManagedProviderMaintenanceResolver ( {
68+ const LEGACY_UPDATE = makePackageManagedProviderMaintenanceResolver ( {
6869 provider : DRIVER_KIND ,
6970 npmPackageName : "opencode-ai" ,
7071 homebrewFormula : "anomalyco/tap/opencode" ,
@@ -76,6 +77,25 @@ const UPDATE = makePackageManagedProviderMaintenanceResolver({
7677 } ,
7778} ) ;
7879
80+ const UPDATE = {
81+ resolve ( options ?: Parameters < typeof LEGACY_UPDATE . resolve > [ 0 ] ) {
82+ const paths = [ options ?. binaryPath , options ?. resolvedCommandPath , options ?. realCommandPath ] ;
83+ const isOpenCodeV2 = paths . some (
84+ ( commandPath ) =>
85+ typeof commandPath === "string" &&
86+ / (?: ^ | \/ ) o p e n c o d e 2 (?: \. (?: c m d | b a t | e x e ) ) ? $ / . test ( normalizeCommandPath ( commandPath ) ) ,
87+ ) ;
88+ const isUnresolvedDefault =
89+ options ?. binaryPath === "opencode" &&
90+ ! options . resolvedCommandPath &&
91+ ! options . realCommandPath ;
92+
93+ return isOpenCodeV2 || isUnresolvedDefault
94+ ? makeManualOnlyProviderMaintenanceCapabilities ( { provider : DRIVER_KIND , packageName : null } )
95+ : LEGACY_UPDATE . resolve ( options ) ;
96+ } ,
97+ } ;
98+
7999export type OpenCodeDriverEnv =
80100 | BackgroundPolicy . BackgroundPolicy
81101 | ChildProcessSpawner . ChildProcessSpawner
0 commit comments