refactor: migrate all 7 bridge clusters to BackendAdapter (WIP)

70+ files changed, net -688 lines. Bridge files being replaced with
BackendAdapter calls. Clusters 2-8 in progress: theme, groups/workspace,
agent, PTY/terminal, files, orchestration, infrastructure.
This commit is contained in:
Hibryda 2026-03-22 04:28:12 +01:00
parent 579157f6da
commit 105107dd84
72 changed files with 1835 additions and 2523 deletions

View file

@ -12,13 +12,8 @@
* On unload, the Worker is terminated all plugin state is destroyed.
*/
import type { PluginMeta } from '../adapters/plugins-bridge';
import { readPluginFile } from '../adapters/plugins-bridge';
import { listTasks, getTaskComments } from '../adapters/bttask-bridge';
import {
getUnreadMessages,
getChannels,
} from '../adapters/btmsg-bridge';
import type { PluginMeta } from '@agor/types';
import { getBackend } from '../backend/backend';
import {
addPluginCommand,
removePluginCommands,
@ -189,7 +184,7 @@ export async function loadPlugin(
// Read the plugin's entry file
let code: string;
try {
code = await readPluginFile(meta.id, meta.main);
code = await getBackend().readPluginFile(meta.id, meta.main);
} catch (e) {
throw new Error(`Failed to read plugin '${meta.id}' entry file '${meta.main}': ${e}`);
}
@ -253,16 +248,16 @@ export async function loadPlugin(
let result: unknown;
switch (method) {
case 'tasks.list':
result = await listTasks(groupId);
result = await getBackend().bttaskList(groupId);
break;
case 'tasks.comments':
result = await getTaskComments(args.taskId);
result = await getBackend().bttaskComments(args.taskId);
break;
case 'messages.inbox':
result = await getUnreadMessages(agentId);
result = await getBackend().btmsgUnreadMessages(agentId);
break;
case 'messages.channels':
result = await getChannels(groupId);
result = await getBackend().btmsgGetChannels(groupId);
break;
default:
throw new Error(`Unknown RPC method: ${method}`);