Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/core/src/models-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,13 @@ export const layer = Layer.effect(
return yield* fetchAndWrite()
}),
)
return JSON.parse(text) as Record<string, Provider>
return yield* Effect.try({
try: () => JSON.parse(text) as Record<string, Provider>,
catch: () => new Error(`Failed to parse models JSON from ${source}`),
}).pipe(
Effect.tapError((e) => Effect.logWarning(e.message)),
Effect.orElse(() => Effect.succeed({} as Record<string, Provider>)),
)
}).pipe(Effect.withSpan("ModelsDev.populate"), Effect.orDie)

const [cachedGet, invalidate] = yield* Effect.cachedInvalidateWithTTL(populate, Duration.infinity)
Expand Down
6 changes: 3 additions & 3 deletions packages/opencode/src/snapshot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const layer: Layer.Layer<Service, never, AppFileSystem.Service | AppProce
"-z",
],
{
cwd: state.directory,
cwd: state.worktree,
stdin: feed(files),
},
)
Expand All @@ -138,7 +138,7 @@ export const layer: Layer.Layer<Service, never, AppFileSystem.Service | AppProce
...args(["rm", "--cached", "-f", "--ignore-unmatch", "--pathspec-from-file=-", "--pathspec-file-nul"]),
],
{
cwd: state.directory,
cwd: state.worktree,
stdin: feed(files),
},
)
Expand All @@ -149,7 +149,7 @@ export const layer: Layer.Layer<Service, never, AppFileSystem.Service | AppProce
const result = yield* git(
[...cfg, ...args(["add", "--all", "--sparse", "--pathspec-from-file=-", "--pathspec-file-nul"])],
{
cwd: state.directory,
cwd: state.worktree,
stdin: feed(files),
},
)
Expand Down
Loading