feat(tui): refresh agents after update events

This commit is contained in:
Dax Raad 2026-06-29 18:52:00 -04:00
commit 02cb350880
17 changed files with 576 additions and 30 deletions

View file

@ -60,6 +60,7 @@ export const Plugin = define({
const configuredDefault = Config.latest(documents, "default_agent")
if (configuredDefault !== undefined) draft.default(AgentV2.ID.make(configuredDefault))
for (const current of draft.list()) {
yield* Effect.log({ msg: "applying permissions", id: current.id, permissions: global })
draft.update(current.id, (agent) => agent.permissions.push(...global))
}

View file

@ -76,7 +76,7 @@ export const Plugin = define({
? pathToFileURL(ref.package).href
: (yield* npm.add(ref.package)).entrypoint
if (!entrypoint) return
yield* Effect.log({ msg: "loading plugin", id: ref.package, entrypoint })
const mod = yield* Effect.promise(() => import(entrypoint))
const value = (yield* Schema.decodeUnknownEffect(PluginModule)(mod)).default
const plugin = "effect" in value ? value : PluginPromise.fromPromise(value)
@ -86,6 +86,6 @@ export const Plugin = define({
})
}).pipe(Effect.ignoreCause)
}
}).pipe(Effect.forkScoped({ startImmediately: true }))
})
}),
})