refactor(agent): dedupe harness and command workflows

This commit is contained in:
Peter Steinberger
2026-02-16 14:52:09 +00:00
parent 04892ee230
commit f717a13039
204 changed files with 7366 additions and 11540 deletions

View File

@@ -117,26 +117,47 @@ const createStubPlugin = (params: {
outbound: params.outbound,
});
const createDiscordPollPluginRegistration = () => ({
pluginId: "discord",
source: "test",
plugin: createStubPlugin({
id: "discord",
label: "Discord",
actions: {
listActions: () => ["poll"],
handleAction: async ({ action, params, cfg, accountId }) =>
await handleDiscordAction(
{ action, to: params.to, accountId: accountId ?? undefined },
cfg,
),
},
}),
});
const createTelegramSendPluginRegistration = () => ({
pluginId: "telegram",
source: "test",
plugin: createStubPlugin({
id: "telegram",
label: "Telegram",
actions: {
listActions: () => ["send"],
handleAction: async ({ action, params, cfg, accountId }) =>
await handleTelegramAction(
{ action, to: params.to, accountId: accountId ?? undefined },
cfg,
),
},
}),
});
describe("messageCommand", () => {
it("defaults channel when only one configured", async () => {
process.env.TELEGRAM_BOT_TOKEN = "token-abc";
await setRegistry(
createTestRegistry([
{
pluginId: "telegram",
source: "test",
plugin: createStubPlugin({
id: "telegram",
label: "Telegram",
actions: {
listActions: () => ["send"],
handleAction: async ({ action, params, cfg, accountId }) =>
await handleTelegramAction(
{ action, to: params.to, accountId: accountId ?? undefined },
cfg,
),
},
}),
...createTelegramSendPluginRegistration(),
},
]),
);
@@ -159,36 +180,10 @@ describe("messageCommand", () => {
await setRegistry(
createTestRegistry([
{
pluginId: "telegram",
source: "test",
plugin: createStubPlugin({
id: "telegram",
label: "Telegram",
actions: {
listActions: () => ["send"],
handleAction: async ({ action, params, cfg, accountId }) =>
await handleTelegramAction(
{ action, to: params.to, accountId: accountId ?? undefined },
cfg,
),
},
}),
...createTelegramSendPluginRegistration(),
},
{
pluginId: "discord",
source: "test",
plugin: createStubPlugin({
id: "discord",
label: "Discord",
actions: {
listActions: () => ["poll"],
handleAction: async ({ action, params, cfg, accountId }) =>
await handleDiscordAction(
{ action, to: params.to, accountId: accountId ?? undefined },
cfg,
),
},
}),
...createDiscordPollPluginRegistration(),
},
]),
);
@@ -242,20 +237,7 @@ describe("messageCommand", () => {
await setRegistry(
createTestRegistry([
{
pluginId: "discord",
source: "test",
plugin: createStubPlugin({
id: "discord",
label: "Discord",
actions: {
listActions: () => ["poll"],
handleAction: async ({ action, params, cfg, accountId }) =>
await handleDiscordAction(
{ action, to: params.to, accountId: accountId ?? undefined },
cfg,
),
},
}),
...createDiscordPollPluginRegistration(),
},
]),
);