mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 03:03:24 +08:00
fix: complete per-bot agent preset lifecycle
This commit is contained in:
parent
8ab4b9e7de
commit
01576f65c6
27 changed files with 721 additions and 208 deletions
|
|
@ -60,7 +60,9 @@ export async function createTokenProductionController(ctx, config, internals, de
|
|||
?? await new WorkspaceStore(paths.workspaces, { defaultWorkspace }).load();
|
||||
const configuredBots = configStore.list();
|
||||
await workspaces.reconcile(configuredBots.map((bot) => bot.botId));
|
||||
await Promise.all(configuredBots.map((bot) => workspaces.ensure(bot.botId)));
|
||||
await Promise.all(configuredBots.map((bot) => workspaces.ensure(bot.botId, {
|
||||
defaultAgentPreset: config.agentPreset,
|
||||
})));
|
||||
const observedConfigStore = typeof configStore.remove === 'function'
|
||||
? observeBotWorkspaceRemovals(configStore, { workspaces })
|
||||
: configStore;
|
||||
|
|
@ -82,7 +84,6 @@ export async function createTokenProductionController(ctx, config, internals, de
|
|||
const harness = new ResolvedHarness({
|
||||
baseUrl: harnessOrigin(ctx.webServer, config.harnessBaseUrl),
|
||||
workspace: defaultWorkspace,
|
||||
...(config.agentPreset == null ? {} : { agentPreset: config.agentPreset }),
|
||||
autostart: false,
|
||||
dshBin: config.dshBin ?? 'dsh',
|
||||
...(commandExecutor ? { commandExecutor } : {}),
|
||||
|
|
@ -96,7 +97,7 @@ export async function createTokenProductionController(ctx, config, internals, de
|
|||
...(internals.inspectToken ? { inspectToken: internals.inspectToken } : {}),
|
||||
createRuntime: async ({ botId, config: botConfig, token }) => {
|
||||
const state = await stateFor(botId);
|
||||
await workspaces.ensure(botId);
|
||||
await workspaces.ensure(botId, { defaultAgentPreset: config.agentPreset });
|
||||
const workspaceScope = createBotWorkspaceScope(harness, { botId, workspaces, state });
|
||||
return new ResolvedRuntime({
|
||||
...channelRuntimeOptions,
|
||||
|
|
@ -131,7 +132,7 @@ export async function createTokenProductionController(ctx, config, internals, de
|
|||
const controller = createWorkspaceAwareController(coreController, {
|
||||
workspaces,
|
||||
stateFor,
|
||||
agentPresetCatalog: await listAgentPresetCatalog(ctx),
|
||||
agentPresetCatalog: () => listAgentPresetCatalog(ctx),
|
||||
});
|
||||
const supervisor = createSupervisor({
|
||||
channel,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue