Files
bot/extensions/test-utils/start-account-context.ts
zooqueen 8d829d5305 fix: restore corrupted files from upstream merge
The -X ours merge strategy corrupted ~55 files by mixing our code
with upstream structural changes. Restored correct versions from
the rebrand bridge branch which has properly-rebranded upstream code.

Also includes: lint error fixes for agent.acp.test, cron.ts, channels
intent test, Android duplicate declarations, and missing imports.
2026-03-03 10:03:28 -08:00

30 lines
973 B
TypeScript

import type { ChannelAccountSnapshot, ChannelGatewayContext, BotConfig } from "bot/plugin-sdk";
import { vi } from "vitest";
import { createRuntimeEnv } from "./runtime-env.js";
export function createStartAccountContext<TAccount extends { accountId: string }>(params: {
account: TAccount;
abortSignal: AbortSignal;
statusPatchSink?: (next: ChannelAccountSnapshot) => void;
}): ChannelGatewayContext<TAccount> {
const snapshot: ChannelAccountSnapshot = {
accountId: params.account.accountId,
configured: true,
enabled: true,
running: false,
};
return {
accountId: params.account.accountId,
account: params.account,
cfg: {} as BotConfig,
runtime: createRuntimeEnv(),
abortSignal: params.abortSignal,
log: { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() },
getStatus: () => snapshot,
setStatus: (next) => {
Object.assign(snapshot, next);
params.statusPatchSink?.(snapshot);
},
};
}