Skip to content

Commit 0271189

Browse files
committed
fix(plugin): make refresh optional in the plugin model domain
`ModelApi` gained a required `refresh` when the `model.refresh` endpoint was added (see anomalyco#53682). The plugin model domain inherits it, which forces every host to implement `refresh`. Since forcing a models.dev cache update is a server/CLI concern, keep it out of the plugin model domain surface so hosts and integration tests are not required to provide it.
1 parent 1c3eeab commit 0271189

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎packages/plugin/src/effect/model.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export interface ModelEditor {
2222
}
2323
}
2424

25-
export interface ModelDomain extends ModelApi<unknown> {
25+
// `refresh` is a server/CLI concern (force a models.dev cache update) and is not
26+
// exposed through the plugin model domain, so hosts are not required to provide it.
27+
export interface ModelDomain extends Omit<ModelApi<unknown>, "refresh"> {
2628
readonly transform: Transform<ModelEditor>
2729
readonly reload: () => Effect.Effect<void>
2830
}

‎packages/plugin/src/promise/model.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export interface ModelEditor {
2222
}
2323
}
2424

25-
export interface ModelDomain extends ModelApi {
25+
// `refresh` is a server/CLI concern (force a models.dev cache update) and is not
26+
// exposed through the plugin model domain, so hosts are not required to provide it.
27+
export interface ModelDomain extends Omit<ModelApi, "refresh"> {
2628
readonly transform: Transform<ModelEditor>
2729
readonly reload: () => Promise<void>
2830
}

0 commit comments

Comments
 (0)