Skip to content

Commit ad7a9e3

Browse files
authored
Merge branch 'dev' into feat/agent-order-field
2 parents cd2e518 + f954854 commit ad7a9e3

54 files changed

Lines changed: 3963 additions & 3066 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix/hashes.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"nodeModules": {
3-
"x86_64-linux": "sha256-g29OM3dy+sZ3ioTs8zjQOK1N+KnNr9ptP9xtdPcdr64=",
4-
"aarch64-linux": "sha256-Iu91KwDcV5omkf4Ngny1aYpyCkPLjuoWOVUDOJUhW1k=",
5-
"aarch64-darwin": "sha256-bk3G6m+Yo60Ea3Kyglc37QZf5Vm7MLMFcxemjc7HnL0=",
6-
"x86_64-darwin": "sha256-y3hooQw13Z3Cu0KFfXYdpkTEeKTyuKd+a/jsXHQLdqA="
3+
"x86_64-linux": "sha256-fiMi8VxyMhNTaZf0ButrMEwT/ZmfeEg1T3c6HwUz8p4=",
4+
"aarch64-linux": "sha256-1Mzjijq/INZGGEm4EerYN3hu1VxiQ8wuGg6t+XPDf6w=",
5+
"aarch64-darwin": "sha256-3SH8Q2kK/F2kM29FmFUMR1aA23rSei+mPJliRIGfvCM=",
6+
"x86_64-darwin": "sha256-RPsyoNXn84K93gunRFLsBvkZIQilfmUXdwkeieQjbd8="
77
}
88
}

packages/opencode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"bonjour-service": "1.3.0",
129129
"bun-pty": "0.4.8",
130130
"chokidar": "4.0.3",
131+
"cli-sound": "1.1.3",
131132
"clipboardy": "4.0.0",
132133
"cross-spawn": "catalog:",
133134
"decimal.js": "10.5.0",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Effect loose ends
2+
3+
Small follow-ups that do not fit neatly into the main facade, route, tool, or schema migration checklists.
4+
5+
## Config / TUI
6+
7+
- [ ] `config/tui.ts` - finish the internal Effect migration after the `Instance.state(...)` removal.
8+
Keep the current precedence and migration semantics intact while converting the remaining internal async helpers (`loadState`, `mergeFile`, `loadFile`, `load`) to `Effect.gen(...)` / `Effect.fn(...)`.
9+
- [ ] `config/tui.ts` callers - once the internal service is stable, migrate plain async callers to use `TuiConfig.Service` directly where that actually simplifies the code.
10+
Likely first callers: `cli/cmd/tui/attach.ts`, `cli/cmd/tui/thread.ts`, `cli/cmd/tui/plugin/runtime.ts`.
11+
- [ ] `env/index.ts` - move the last production `Instance.state(...)` usage onto `InstanceState` (or its replacement) so `Instance.state` can be deleted.
12+
13+
## ConfigPaths
14+
15+
- [ ] `config/paths.ts` - split pure helpers from effectful helpers.
16+
Keep `fileInDirectory(...)` as a plain function.
17+
- [ ] `config/paths.ts` - add a `ConfigPaths.Service` for the effectful operations so callers do not inherit `AppFileSystem.Service` directly.
18+
Initial service surface should cover:
19+
- `projectFiles(...)`
20+
- `directories(...)`
21+
- `readFile(...)`
22+
- `parseText(...)`
23+
- [ ] `config/config.ts` - switch internal config loading from `Effect.promise(() => ConfigPaths.*(...))` to `yield* paths.*(...)` once the service exists.
24+
- [ ] `config/tui.ts` - switch TUI config loading from async `ConfigPaths.*` wrappers to the `ConfigPaths.Service` once that service exists.
25+
- [ ] `config/tui-migrate.ts` - decide whether to leave this as a plain async module using wrapper functions or effectify it fully after `ConfigPaths.Service` lands.
26+
27+
## Instance cleanup
28+
29+
- [ ] `project/instance.ts` - remove `Instance.state(...)` once `env/index.ts` is migrated.
30+
- [ ] `project/state.ts` - delete the bespoke per-instance state helper after the last production caller is gone.
31+
- [ ] `test/project/state.test.ts` - replace or delete the old `Instance.state(...)` tests after the removal.
32+
33+
## Notes
34+
35+
- Prefer small, semantics-preserving config migrations. Config precedence, legacy key migration, and plugin origin tracking are easy to break accidentally.
36+
- When changing config loading internals, rerun the config and TUI suites first before broad package sweeps.

packages/opencode/src/agent/agent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export namespace Agent {
7474
Effect.gen(function* () {
7575
const config = yield* Config.Service
7676
const auth = yield* Auth.Service
77+
const plugin = yield* Plugin.Service
7778
const skill = yield* Skill.Service
7879
const provider = yield* Provider.Service
7980

@@ -338,9 +339,7 @@ export namespace Agent {
338339
const language = yield* provider.getLanguage(resolved)
339340

340341
const system = [PROMPT_GENERATE]
341-
yield* Effect.promise(() =>
342-
Plugin.trigger("experimental.chat.system.transform", { model: resolved }, { system }),
343-
)
342+
yield* plugin.trigger("experimental.chat.system.transform", { model: resolved }, { system })
344343
const existing = yield* InstanceState.useEffect(state, (s) => s.list())
345344

346345
// TODO: clean this up so provider specific logic doesnt bleed over
@@ -401,6 +400,7 @@ export namespace Agent {
401400
)
402401

403402
export const defaultLayer = layer.pipe(
403+
Layer.provide(Plugin.defaultLayer),
404404
Layer.provide(Provider.defaultLayer),
405405
Layer.provide(Auth.defaultLayer),
406406
Layer.provide(Config.defaultLayer),

packages/opencode/src/audio.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.wav" {
2+
const file: string
3+
export default file
4+
}

packages/opencode/src/cli/cmd/debug/snapshot.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { AppRuntime } from "@/effect/app-runtime"
12
import { Snapshot } from "../../../snapshot"
23
import { bootstrap } from "../../bootstrap"
34
import { cmd } from "../cmd"
@@ -14,7 +15,7 @@ const TrackCommand = cmd({
1415
describe: "track current snapshot state",
1516
async handler() {
1617
await bootstrap(process.cwd(), async () => {
17-
console.log(await Snapshot.track())
18+
console.log(await AppRuntime.runPromise(Snapshot.Service.use((svc) => svc.track())))
1819
})
1920
},
2021
})
@@ -30,7 +31,7 @@ const PatchCommand = cmd({
3031
}),
3132
async handler(args) {
3233
await bootstrap(process.cwd(), async () => {
33-
console.log(await Snapshot.patch(args.hash))
34+
console.log(await AppRuntime.runPromise(Snapshot.Service.use((svc) => svc.patch(args.hash))))
3435
})
3536
},
3637
})
@@ -46,7 +47,7 @@ const DiffCommand = cmd({
4647
}),
4748
async handler(args) {
4849
await bootstrap(process.cwd(), async () => {
49-
console.log(await Snapshot.diff(args.hash))
50+
console.log(await AppRuntime.runPromise(Snapshot.Service.use((svc) => svc.diff(args.hash))))
5051
})
5152
},
5253
})

packages/opencode/src/cli/cmd/providers.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ export const ProvidersLoginCommand = cmd({
340340
}
341341
return filtered
342342
})
343+
const hooks = await AppRuntime.runPromise(
344+
Effect.gen(function* () {
345+
const plugin = yield* Plugin.Service
346+
return yield* plugin.list()
347+
}),
348+
)
343349

344350
const priority: Record<string, number> = {
345351
opencode: 0,
@@ -351,7 +357,7 @@ export const ProvidersLoginCommand = cmd({
351357
vercel: 6,
352358
}
353359
const pluginProviders = resolvePluginProviders({
354-
hooks: await Plugin.list(),
360+
hooks,
355361
existingProviders: providers,
356362
disabled,
357363
enabled,
@@ -408,7 +414,7 @@ export const ProvidersLoginCommand = cmd({
408414
provider = selected as string
409415
}
410416

411-
const plugin = await Plugin.list().then((x) => x.findLast((x) => x.auth?.provider === provider))
417+
const plugin = hooks.findLast((x) => x.auth?.provider === provider)
412418
if (plugin && plugin.auth) {
413419
const handled = await handlePluginAuth({ auth: plugin.auth }, provider, args.method)
414420
if (handled) return
@@ -422,7 +428,7 @@ export const ProvidersLoginCommand = cmd({
422428
if (prompts.isCancel(custom)) throw new UI.CancelledError()
423429
provider = custom.replace(/^@ai-sdk\//, "")
424430

425-
const customPlugin = await Plugin.list().then((x) => x.findLast((x) => x.auth?.provider === provider))
431+
const customPlugin = hooks.findLast((x) => x.auth?.provider === provider)
426432
if (customPlugin && customPlugin.auth) {
427433
const handled = await handlePluginAuth({ auth: customPlugin.auth }, provider, args.method)
428434
if (handled) return
577 KB
Binary file not shown.
172 KB
Binary file not shown.

0 commit comments

Comments
 (0)