File tree Expand file tree Collapse file tree 4 files changed +27
-16
lines changed
Expand file tree Collapse file tree 4 files changed +27
-16
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,6 @@ function ConnectionGate(props: ParentProps<{ disableHealthCheck?: boolean }>) {
182182 if ( checkMode ( ) === "background" || type === "http" ) return false
183183 }
184184 } ) . pipe (
185- effectMinDuration ( checkMode ( ) === "blocking" ? "1.2 seconds" : 0 ) ,
186185 Effect . timeoutOrElse ( { duration : "10 seconds" , orElse : ( ) => Effect . succeed ( false ) } ) ,
187186 Effect . ensuring ( Effect . sync ( ( ) => setCheckMode ( "background" ) ) ) ,
188187 Effect . runPromise ,
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ const dir = path.resolve(__dirname, "..")
1111
1212process . chdir ( dir )
1313
14+ await import ( "./generate.ts" )
15+
1416// Load migrations from migration directories
1517const migrationDirs = (
1618 await fs . promises . readdir ( path . join ( dir , "migration" ) , {
Original file line number Diff line number Diff line change @@ -12,24 +12,11 @@ const dir = path.resolve(__dirname, "..")
1212
1313process . chdir ( dir )
1414
15+ await import ( "./generate.ts" )
16+
1517import { Script } from "@opencode-ai/script"
1618import pkg from "../package.json"
1719
18- const modelsUrl = process . env . OPENCODE_MODELS_URL || "https://models.dev"
19- // Fetch and generate models.dev snapshot
20- const modelsData = process . env . MODELS_DEV_API_JSON
21- ? await Bun . file ( process . env . MODELS_DEV_API_JSON ) . text ( )
22- : await fetch ( `${ modelsUrl } /api.json` ) . then ( ( x ) => x . text ( ) )
23- await Bun . write (
24- path . join ( dir , "src/provider/models-snapshot.js" ) ,
25- `// @ts-nocheck\n// Auto-generated by build.ts - do not edit\nexport const snapshot = ${ modelsData } \n` ,
26- )
27- await Bun . write (
28- path . join ( dir , "src/provider/models-snapshot.d.ts" ) ,
29- `// Auto-generated by build.ts - do not edit\nexport declare const snapshot: Record<string, unknown>\n` ,
30- )
31- console . log ( "Generated models-snapshot.js" )
32-
3320// Load migrations from migration directories
3421const migrationDirs = (
3522 await fs . promises . readdir ( path . join ( dir , "migration" ) , {
Original file line number Diff line number Diff line change 1+ import path from "path"
2+ import { fileURLToPath } from "url"
3+
4+ const __filename = fileURLToPath ( import . meta. url )
5+ const __dirname = path . dirname ( __filename )
6+ const dir = path . resolve ( __dirname , ".." )
7+
8+ process . chdir ( dir )
9+
10+ const modelsUrl = process . env . OPENCODE_MODELS_URL || "https://models.dev"
11+ // Fetch and generate models.dev snapshot
12+ const modelsData = process . env . MODELS_DEV_API_JSON
13+ ? await Bun . file ( process . env . MODELS_DEV_API_JSON ) . text ( )
14+ : await fetch ( `${ modelsUrl } /api.json` ) . then ( ( x ) => x . text ( ) )
15+ await Bun . write (
16+ path . join ( dir , "src/provider/models-snapshot.js" ) ,
17+ `// @ts-nocheck\n// Auto-generated by build.ts - do not edit\nexport const snapshot = ${ modelsData } \n` ,
18+ )
19+ await Bun . write (
20+ path . join ( dir , "src/provider/models-snapshot.d.ts" ) ,
21+ `// Auto-generated by build.ts - do not edit\nexport declare const snapshot: Record<string, unknown>\n` ,
22+ )
23+ console . log ( "Generated models-snapshot.js" )
You can’t perform that action at this time.
0 commit comments