feat(opencode): rename InstanceStore to InstanceRuntime and refine model schema

Rename the `InstanceStore` module to `InstanceRuntime` across all consumer
sites to better reflect its role as a runtime lifecycle manager rather than
a persistence layer. Update the kilo-gateway route dependency key from
`InstanceStore` to `Instances` for clarity.

Additional changes:
- Replace `Schema.Number` with `Schema.Finite` for `recommendedIndex` in
  both the provider and models schemas
- Inject `InstanceStore.Service` into the ProviderAuth layer and use its
  `disposeAll()` method instead of escaping to a raw promise
- Remove obsolete `getBootstrapRunEffect` usage from indexing startup tests
- Add missing `warnings` method to the test config fixture
This commit is contained in:
Imanol Maiztegui
2026-05-19 11:37:49 +02:00
parent 8e053f34b5
commit 4523bf99cb
15 changed files with 29 additions and 34 deletions
+1
View File
@@ -12,6 +12,7 @@ export function make(overrides: Partial<Config.Interface> = {}) {
invalidate: () => Effect.void,
directories: () => Effect.succeed([]),
waitForDependencies: () => Effect.void,
warnings: () => Effect.succeed([]),
...overrides,
})
}
@@ -3,7 +3,7 @@ import { Effect } from "effect"
import path from "path"
import type { Permission } from "../../src/permission"
import { Instance } from "../../src/project/instance"
import { InstanceStore } from "../../src/project/instance-store"
import { InstanceRuntime } from "../../src/project/instance-runtime"
import { WithInstance } from "../../src/project/with-instance"
import { SessionID, MessageID } from "../../src/session/schema"
import { assertExternalDirectory } from "../../src/tool/external-directory"
@@ -50,7 +50,7 @@ describe("kilocode external directory boundaries", () => {
try {
await assertExternalDirectory(ctx, file)
} finally {
await InstanceStore.disposeInstance(Instance.current)
await InstanceRuntime.disposeInstance(Instance.current)
}
},
})
@@ -74,7 +74,7 @@ describe("kilocode external directory boundaries", () => {
try {
await assertExternalDirectory(ctx, file)
} finally {
await InstanceStore.disposeInstance(Instance.current)
await InstanceRuntime.disposeInstance(Instance.current)
}
},
})
@@ -2,7 +2,6 @@ import { afterEach, describe, expect, spyOn, test } from "bun:test"
import { CodeIndexManager } from "@kilocode/kilo-indexing/engine"
import type { Config } from "../../src/config/config"
import { GlobalBus } from "../../src/bus/global"
import { getBootstrapRunEffect } from "../../src/effect/app-runtime"
import { KiloIndexing } from "../../src/kilocode/indexing"
import { WithInstance } from "../../src/project/with-instance"
import { Server } from "../../src/server/server"
@@ -185,7 +184,6 @@ describe("indexing startup degradation", () => {
try {
await WithInstance.provide({
directory: tmp.path,
init: await getBootstrapRunEffect(),
fn: async () => {
await called(init)
expect((await KiloIndexing.current()).state).toBe("In Progress")
@@ -213,7 +211,6 @@ describe("indexing startup degradation", () => {
try {
await WithInstance.provide({
directory: tmp.path,
init: await getBootstrapRunEffect(),
fn: async () => {
const status = await wait(() => KiloIndexing.current(), "Error")
@@ -238,7 +235,6 @@ describe("indexing startup degradation", () => {
try {
await WithInstance.provide({
directory: tmp.path,
init: await getBootstrapRunEffect(),
fn: async () => {
await called(init)
@@ -261,7 +257,6 @@ describe("indexing startup degradation", () => {
await WithInstance.provide({
directory: tmp.path,
init: await getBootstrapRunEffect(),
fn: async () => {
const status = await KiloIndexing.current()
@@ -302,7 +297,6 @@ describe("indexing startup degradation", () => {
try {
await WithInstance.provide({
directory: tmp.path,
init: await getBootstrapRunEffect(),
fn: async () => {
await called(init)
expect(init.mock.calls[0]?.[0]).toMatchObject({
@@ -335,7 +329,6 @@ describe("indexing startup degradation", () => {
try {
await WithInstance.provide({
directory: tmp.path,
init: await getBootstrapRunEffect(),
fn: async () => {
await called(init)
expect(init.mock.calls[0]?.[0]).toMatchObject({
@@ -360,7 +353,6 @@ describe("indexing startup degradation", () => {
try {
await WithInstance.provide({
directory: tmp.path,
init: await getBootstrapRunEffect(),
fn: async () => {
const status = await KiloIndexing.current()
@@ -5,7 +5,7 @@ import path from "path"
import { tmpdir } from "../fixture/fixture"
import { Global } from "@opencode-ai/core/global"
import { Instance } from "../../src/project/instance"
import { InstanceStore } from "../../src/project/instance-store"
import { InstanceRuntime } from "../../src/project/instance-runtime"
import { WithInstance } from "../../src/project/with-instance"
import { Plugin } from "../../src/plugin/index"
import { ModelsDev } from "@/provider/models"
@@ -2513,7 +2513,7 @@ test("plugin config providers persist after instance dispose", async () => {
// kilocode_change start
await WithInstance.provide({
directory: tmp.path,
fn: () => InstanceStore.disposeInstance(Instance.current),
fn: () => InstanceRuntime.disposeInstance(Instance.current),
})
// kilocode_change end