fix: sync protocol outputs
This commit is contained in:
@@ -1632,6 +1632,51 @@ public struct LogsTailResult: Codable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct ExecApprovalsGetParams: Codable, Sendable {
|
||||
}
|
||||
|
||||
public struct ExecApprovalsSetParams: Codable, Sendable {
|
||||
public let file: [String: AnyCodable]
|
||||
public let basehash: String?
|
||||
|
||||
public init(
|
||||
file: [String: AnyCodable],
|
||||
basehash: String?
|
||||
) {
|
||||
self.file = file
|
||||
self.basehash = basehash
|
||||
}
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case file
|
||||
case basehash = "baseHash"
|
||||
}
|
||||
}
|
||||
|
||||
public struct ExecApprovalsSnapshot: Codable, Sendable {
|
||||
public let path: String
|
||||
public let exists: Bool
|
||||
public let hash: String
|
||||
public let file: [String: AnyCodable]
|
||||
|
||||
public init(
|
||||
path: String,
|
||||
exists: Bool,
|
||||
hash: String,
|
||||
file: [String: AnyCodable]
|
||||
) {
|
||||
self.path = path
|
||||
self.exists = exists
|
||||
self.hash = hash
|
||||
self.file = file
|
||||
}
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case path
|
||||
case exists
|
||||
case hash
|
||||
case file
|
||||
}
|
||||
}
|
||||
|
||||
public struct ChatHistoryParams: Codable, Sendable {
|
||||
public let sessionkey: String
|
||||
public let limit: Int?
|
||||
|
||||
@@ -56,9 +56,8 @@ const buildAssistantErrorMessage = (model: { api: string; provider: string; id:
|
||||
|
||||
const mockPiAi = () => {
|
||||
vi.doMock("@mariozechner/pi-ai", async () => {
|
||||
const actual = await vi.importActual<typeof import("@mariozechner/pi-ai")>(
|
||||
"@mariozechner/pi-ai",
|
||||
);
|
||||
const actual =
|
||||
await vi.importActual<typeof import("@mariozechner/pi-ai")>("@mariozechner/pi-ai");
|
||||
return {
|
||||
...actual,
|
||||
complete: async (model: { api: string; provider: string; id: string }) => {
|
||||
|
||||
@@ -352,7 +352,11 @@ const emptyRegistry = createRegistry([]);
|
||||
const defaultRegistry = createTestRegistry([
|
||||
{
|
||||
pluginId: "discord",
|
||||
plugin: createOutboundTestPlugin({ id: "discord", outbound: discordOutbound, label: "Discord" }),
|
||||
plugin: createOutboundTestPlugin({
|
||||
id: "discord",
|
||||
outbound: discordOutbound,
|
||||
label: "Discord",
|
||||
}),
|
||||
source: "test",
|
||||
},
|
||||
{
|
||||
|
||||
@@ -130,9 +130,7 @@ export const execApprovalsHandlers: GatewayRequestHandlers = {
|
||||
const currentSocketPath = snapshot.file.socket?.path?.trim();
|
||||
const currentToken = snapshot.file.socket?.token?.trim();
|
||||
const socketPath =
|
||||
normalized.socket?.path?.trim() ??
|
||||
currentSocketPath ??
|
||||
resolveExecApprovalsSocketPath();
|
||||
normalized.socket?.path?.trim() ?? currentSocketPath ?? resolveExecApprovalsSocketPath();
|
||||
const token = normalized.socket?.token?.trim() ?? currentToken ?? "";
|
||||
const next: ExecApprovalsFile = {
|
||||
...normalized,
|
||||
|
||||
@@ -9,9 +9,8 @@ const mocks = vi.hoisted(() => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../config/config.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../../config/config.js")>(
|
||||
"../../config/config.js",
|
||||
);
|
||||
const actual =
|
||||
await vi.importActual<typeof import("../../config/config.js")>("../../config/config.js");
|
||||
return {
|
||||
...actual,
|
||||
loadConfig: () => ({}),
|
||||
|
||||
@@ -212,11 +212,11 @@ export {
|
||||
resolveDiscordAccount,
|
||||
type ResolvedDiscordAccount,
|
||||
} from "../discord/accounts.js";
|
||||
export { auditDiscordChannelPermissions, collectDiscordAuditChannelIds } from "../discord/audit.js";
|
||||
export {
|
||||
auditDiscordChannelPermissions,
|
||||
collectDiscordAuditChannelIds,
|
||||
} from "../discord/audit.js";
|
||||
export { listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive } from "../discord/directory-live.js";
|
||||
listDiscordDirectoryGroupsLive,
|
||||
listDiscordDirectoryPeersLive,
|
||||
} from "../discord/directory-live.js";
|
||||
export { probeDiscord } from "../discord/probe.js";
|
||||
export { resolveDiscordChannelAllowlist } from "../discord/resolve-channels.js";
|
||||
export { resolveDiscordUserAllowlist } from "../discord/resolve-users.js";
|
||||
@@ -238,7 +238,10 @@ export {
|
||||
resolveSlackAccount,
|
||||
type ResolvedSlackAccount,
|
||||
} from "../slack/accounts.js";
|
||||
export { listSlackDirectoryGroupsLive, listSlackDirectoryPeersLive } from "../slack/directory-live.js";
|
||||
export {
|
||||
listSlackDirectoryGroupsLive,
|
||||
listSlackDirectoryPeersLive,
|
||||
} from "../slack/directory-live.js";
|
||||
export { probeSlack } from "../slack/probe.js";
|
||||
export { resolveSlackChannelAllowlist } from "../slack/resolve-channels.js";
|
||||
export { resolveSlackUserAllowlist } from "../slack/resolve-users.js";
|
||||
|
||||
@@ -46,13 +46,7 @@ const registryCache = new Map<string, PluginRegistry>();
|
||||
|
||||
const defaultLogger = () => createSubsystemLogger("plugins");
|
||||
|
||||
const BUNDLED_ENABLED_BY_DEFAULT = new Set([
|
||||
"telegram",
|
||||
"whatsapp",
|
||||
"discord",
|
||||
"slack",
|
||||
"signal",
|
||||
]);
|
||||
const BUNDLED_ENABLED_BY_DEFAULT = new Set(["telegram", "whatsapp", "discord", "slack", "signal"]);
|
||||
|
||||
const normalizeList = (value: unknown): string[] => {
|
||||
if (!Array.isArray(value)) return [];
|
||||
|
||||
@@ -8,9 +8,7 @@ import type {
|
||||
import type { PluginRegistry } from "../plugins/registry.js";
|
||||
import { normalizeIMessageHandle } from "../imessage/targets.js";
|
||||
|
||||
export const createTestRegistry = (
|
||||
channels: PluginRegistry["channels"] = [],
|
||||
): PluginRegistry => ({
|
||||
export const createTestRegistry = (channels: PluginRegistry["channels"] = []): PluginRegistry => ({
|
||||
plugins: [],
|
||||
tools: [],
|
||||
hooks: [],
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { afterEach, beforeEach, vi } from "vitest";
|
||||
|
||||
import type { ChannelId, ChannelOutboundAdapter, ChannelPlugin } from "../src/channels/plugins/types.js";
|
||||
import type {
|
||||
ChannelId,
|
||||
ChannelOutboundAdapter,
|
||||
ChannelPlugin,
|
||||
} from "../src/channels/plugins/types.js";
|
||||
import type { ClawdbotConfig } from "../src/config/config.js";
|
||||
import type { OutboundSendDeps } from "../src/infra/outbound/deliver.js";
|
||||
import { setActivePluginRegistry } from "../src/plugins/runtime.js";
|
||||
@@ -97,8 +101,16 @@ const createStubPlugin = (params: {
|
||||
|
||||
const createDefaultRegistry = () =>
|
||||
createTestRegistry([
|
||||
{ pluginId: "discord", plugin: createStubPlugin({ id: "discord", label: "Discord" }), source: "test" },
|
||||
{ pluginId: "slack", plugin: createStubPlugin({ id: "slack", label: "Slack" }), source: "test" },
|
||||
{
|
||||
pluginId: "discord",
|
||||
plugin: createStubPlugin({ id: "discord", label: "Discord" }),
|
||||
source: "test",
|
||||
},
|
||||
{
|
||||
pluginId: "slack",
|
||||
plugin: createStubPlugin({ id: "slack", label: "Slack" }),
|
||||
source: "test",
|
||||
},
|
||||
{
|
||||
pluginId: "telegram",
|
||||
plugin: {
|
||||
@@ -122,7 +134,11 @@ const createDefaultRegistry = () =>
|
||||
}),
|
||||
source: "test",
|
||||
},
|
||||
{ pluginId: "signal", plugin: createStubPlugin({ id: "signal", label: "Signal" }), source: "test" },
|
||||
{
|
||||
pluginId: "signal",
|
||||
plugin: createStubPlugin({ id: "signal", label: "Signal" }),
|
||||
source: "test",
|
||||
},
|
||||
{
|
||||
pluginId: "imessage",
|
||||
plugin: createStubPlugin({ id: "imessage", label: "iMessage", aliases: ["imsg"] }),
|
||||
|
||||
Reference in New Issue
Block a user