refactor: migrate extensions to plugin sdk

This commit is contained in:
Peter Steinberger
2026-01-18 02:51:42 +00:00
parent 5b4651d9ed
commit 1420d113d8
95 changed files with 380 additions and 208 deletions

View File

@@ -8,6 +8,7 @@ Docs: https://docs.clawd.bot
- Plugins: add exclusive plugin slots with a dedicated memory slot selector. - Plugins: add exclusive plugin slots with a dedicated memory slot selector.
- Memory: ship core memory tools + CLI as the bundled `memory-core` plugin. - Memory: ship core memory tools + CLI as the bundled `memory-core` plugin.
- Docs: document plugin slots and memory plugin behavior. - Docs: document plugin slots and memory plugin behavior.
- Plugins: migrate bundled messaging extensions to the plugin SDK; resolve plugin-sdk imports in loader.
## 2026.1.17-5 ## 2026.1.17-5

BIN
extensions/.DS_Store vendored Normal file

Binary file not shown.

BIN
extensions/matrix/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -1,12 +1,14 @@
import type { ClawdbotPluginApi } from "../../src/plugins/types.js"; import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
import { matrixPlugin } from "./src/channel.js"; import { matrixPlugin } from "./src/channel.js";
import { setMatrixRuntime } from "./src/runtime.js";
const plugin = { const plugin = {
id: "matrix", id: "matrix",
name: "Matrix", name: "Matrix",
description: "Matrix channel plugin (matrix-js-sdk)", description: "Matrix channel plugin (matrix-js-sdk)",
register(api: ClawdbotPluginApi) { register(api: ClawdbotPluginApi) {
setMatrixRuntime(api.runtime);
api.registerChannel({ plugin: matrixPlugin }); api.registerChannel({ plugin: matrixPlugin });
}, },
}; };

21
extensions/matrix/node_modules/.bin/.ignored_markdown-it generated vendored Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -z "$NODE_PATH" ]; then
export NODE_PATH="/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/bin/node_modules:/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/node_modules:/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/markdown-it@14.1.0/node_modules:/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/node_modules"
else
export NODE_PATH="/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/bin/node_modules:/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/node_modules:/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/markdown-it@14.1.0/node_modules:/Users/steipete/Projects/clawdbot4/node_modules/.pnpm/node_modules:$NODE_PATH"
fi
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../markdown-it/bin/markdown-it.mjs" "$@"
else
exec node "$basedir/../markdown-it/bin/markdown-it.mjs" "$@"
fi

1
extensions/matrix/node_modules/.bin/markdown-it generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../markdown-it/bin/markdown-it.mjs

1
extensions/matrix/node_modules/markdown-it generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it

1
extensions/matrix/node_modules/matrix-js-sdk generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../node_modules/.pnpm/matrix-js-sdk@40.0.0/node_modules/matrix-js-sdk

View File

@@ -1,13 +1,15 @@
import { createActionGate, readNumberParam, readStringParam } from "../../../src/agents/tools/common.js"; import {
createActionGate,
readNumberParam,
readStringParam,
type ChannelMessageActionAdapter,
type ChannelMessageActionContext,
type ChannelMessageActionName,
type ChannelToolSend,
} from "clawdbot/plugin-sdk";
import { resolveMatrixAccount } from "./matrix/accounts.js"; import { resolveMatrixAccount } from "./matrix/accounts.js";
import { handleMatrixAction } from "./tool-actions.js"; import { handleMatrixAction } from "./tool-actions.js";
import type { CoreConfig } from "./types.js"; import type { CoreConfig } from "./types.js";
import type {
ChannelMessageActionAdapter,
ChannelMessageActionContext,
ChannelMessageActionName,
ChannelToolSend,
} from "../../../src/channels/plugins/types.js";
export const matrixMessageActions: ChannelMessageActionAdapter = { export const matrixMessageActions: ChannelMessageActionAdapter = {
listActions: ({ cfg }) => { listActions: ({ cfg }) => {

View File

@@ -1,13 +1,14 @@
import type { ChannelPlugin } from "../../../src/channels/plugins/types.js";
import { import {
applyAccountNameToChannelSection,
buildChannelConfigSchema,
DEFAULT_ACCOUNT_ID,
deleteAccountFromConfigSection, deleteAccountFromConfigSection,
formatPairingApproveHint,
normalizeAccountId,
PAIRING_APPROVED_MESSAGE,
setAccountEnabledInConfigSection, setAccountEnabledInConfigSection,
} from "../../../src/channels/plugins/config-helpers.js"; type ChannelPlugin,
import { buildChannelConfigSchema } from "../../../src/channels/plugins/config-schema.js"; } from "clawdbot/plugin-sdk";
import { formatPairingApproveHint } from "../../../src/channels/plugins/helpers.js";
import { PAIRING_APPROVED_MESSAGE } from "../../../src/channels/plugins/pairing-message.js";
import { applyAccountNameToChannelSection } from "../../../src/channels/plugins/setup-helpers.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../../src/routing/session-key.js";
import { matrixMessageActions } from "./actions.js"; import { matrixMessageActions } from "./actions.js";
import { MatrixConfigSchema } from "./config-schema.js"; import { MatrixConfigSchema } from "./config-schema.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelDirectoryEntry } from "../../../src/channels/plugins/types.js"; import type { ChannelDirectoryEntry } from "clawdbot/plugin-sdk";
import { resolveMatrixAuth } from "./matrix/client.js"; import { resolveMatrixAuth } from "./matrix/client.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelGroupContext } from "../../../src/channels/plugins/types.js"; import type { ChannelGroupContext } from "clawdbot/plugin-sdk";
import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js"; import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js";
import type { CoreConfig } from "./types.js"; import type { CoreConfig } from "./types.js";

View File

@@ -1,4 +1,4 @@
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../../../src/routing/session-key.js"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "clawdbot/plugin-sdk";
import type { CoreConfig, MatrixConfig } from "../types.js"; import type { CoreConfig, MatrixConfig } from "../types.js";
import { resolveMatrixConfig } from "./client.js"; import { resolveMatrixConfig } from "./client.js";
import { credentialsMatchConfig, loadMatrixCredentials } from "./credentials.js"; import { credentialsMatchConfig, loadMatrixCredentials } from "./credentials.js";

View File

@@ -15,7 +15,7 @@ import type {
RoomTopicEventContent, RoomTopicEventContent,
} from "matrix-js-sdk/lib/@types/state_events.js"; } from "matrix-js-sdk/lib/@types/state_events.js";
import { loadConfig } from "../../../../src/config/config.js"; import { loadConfig } from "clawdbot/plugin-sdk";
import type { CoreConfig } from "../types.js"; import type { CoreConfig } from "../types.js";
import { getActiveMatrixClient } from "./active-client.js"; import { getActiveMatrixClient } from "./active-client.js";
import { import {

View File

@@ -1,6 +1,6 @@
import { ClientEvent, type MatrixClient, SyncState } from "matrix-js-sdk"; import { ClientEvent, type MatrixClient, SyncState } from "matrix-js-sdk";
import { loadConfig } from "../../../../src/config/config.js"; import { loadConfig } from "clawdbot/plugin-sdk";
import type { CoreConfig } from "../types.js"; import type { CoreConfig } from "../types.js";
export type MatrixResolvedConfig = { export type MatrixResolvedConfig = {

View File

@@ -2,7 +2,7 @@ import fs from "node:fs";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import { resolveStateDir } from "../../../../src/config/paths.js"; import { resolveStateDir } from "clawdbot/plugin-sdk";
export type MatrixStoredCredentials = { export type MatrixStoredCredentials = {
homeserver: string; homeserver: string;

View File

@@ -3,8 +3,7 @@ import path from "node:path";
import { createRequire } from "node:module"; import { createRequire } from "node:module";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { runCommandWithTimeout } from "../../../../src/process/exec.js"; import { runCommandWithTimeout, type RuntimeEnv } from "clawdbot/plugin-sdk";
import type { RuntimeEnv } from "../../../../src/runtime.js";
const MATRIX_SDK_PACKAGE = "matrix-js-sdk"; const MATRIX_SDK_PACKAGE = "matrix-js-sdk";

View File

@@ -1,4 +1,4 @@
import type { AllowlistMatch } from "../../../../../src/channels/plugins/allowlist-match.js"; import type { AllowlistMatch } from "clawdbot/plugin-sdk";
function normalizeAllowList(list?: Array<string | number>) { function normalizeAllowList(list?: Array<string | number>) {
return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean); return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean);

View File

@@ -1,8 +1,7 @@
import type { MatrixClient, MatrixEvent, RoomMember } from "matrix-js-sdk"; import type { MatrixClient, MatrixEvent, RoomMember } from "matrix-js-sdk";
import { RoomMemberEvent } from "matrix-js-sdk"; import { RoomMemberEvent } from "matrix-js-sdk";
import { danger, logVerbose } from "../../../../../src/globals.js"; import { danger, logVerbose, type RuntimeEnv } from "clawdbot/plugin-sdk";
import type { RuntimeEnv } from "../../../../../src/runtime.js";
import type { CoreConfig } from "../../types.js"; import type { CoreConfig } from "../../types.js";
export function registerMatrixAutoJoin(params: { export function registerMatrixAutoJoin(params: {

View File

@@ -2,36 +2,38 @@ import type { MatrixEvent, Room } from "matrix-js-sdk";
import { EventType, RelationType, RoomEvent } from "matrix-js-sdk"; import { EventType, RelationType, RoomEvent } from "matrix-js-sdk";
import type { RoomMessageEventContent } from "matrix-js-sdk/lib/@types/events.js"; import type { RoomMessageEventContent } from "matrix-js-sdk/lib/@types/events.js";
import { resolveEffectiveMessagesConfig, resolveHumanDelayConfig } from "../../../../../src/agents/identity.js";
import { chunkMarkdownText, resolveTextChunkLimit } from "../../../../../src/auto-reply/chunk.js";
import { hasControlCommand } from "../../../../../src/auto-reply/command-detection.js";
import { shouldHandleTextCommands } from "../../../../../src/auto-reply/commands-registry.js";
import { formatAgentEnvelope } from "../../../../../src/auto-reply/envelope.js";
import { dispatchReplyFromConfig } from "../../../../../src/auto-reply/reply/dispatch-from-config.js";
import { finalizeInboundContext } from "../../../../../src/auto-reply/reply/inbound-context.js";
import { import {
buildMentionRegexes, buildMentionRegexes,
chunkMarkdownText,
createReplyDispatcherWithTyping,
danger,
dispatchReplyFromConfig,
enqueueSystemEvent,
finalizeInboundContext,
formatAgentEnvelope,
formatAllowlistMatchMeta,
getChildLogger,
hasControlCommand,
loadConfig,
logVerbose,
mergeAllowlist,
matchesMentionPatterns, matchesMentionPatterns,
} from "../../../../../src/auto-reply/reply/mentions.js";
import { createReplyDispatcherWithTyping } from "../../../../../src/auto-reply/reply/reply-dispatcher.js";
import type { ReplyPayload } from "../../../../../src/auto-reply/types.js";
import { resolveCommandAuthorizedFromAuthorizers } from "../../../../../src/channels/command-gating.js";
import { formatAllowlistMatchMeta } from "../../../../../src/channels/plugins/allowlist-match.js";
import { loadConfig } from "../../../../../src/config/config.js";
import {
recordSessionMetaFromInbound,
resolveStorePath,
updateLastRoute,
} from "../../../../../src/config/sessions.js";
import { danger, logVerbose, shouldLogVerbose } from "../../../../../src/globals.js";
import { enqueueSystemEvent } from "../../../../../src/infra/system-events.js";
import { getChildLogger } from "../../../../../src/logging.js";
import {
readChannelAllowFromStore, readChannelAllowFromStore,
recordSessionMetaFromInbound,
resolveAgentRoute,
resolveCommandAuthorizedFromAuthorizers,
resolveEffectiveMessagesConfig,
resolveHumanDelayConfig,
resolveStorePath,
resolveTextChunkLimit,
shouldHandleTextCommands,
shouldLogVerbose,
summarizeMapping,
updateLastRoute,
upsertChannelPairingRequest, upsertChannelPairingRequest,
} from "../../../../../src/pairing/pairing-store.js"; type ReplyPayload,
import { resolveAgentRoute } from "../../../../../src/routing/resolve-route.js"; type RuntimeEnv,
import type { RuntimeEnv } from "../../../../../src/runtime.js"; } from "clawdbot/plugin-sdk";
import type { CoreConfig, ReplyToMode } from "../../types.js"; import type { CoreConfig, ReplyToMode } from "../../types.js";
import { setActiveMatrixClient } from "../active-client.js"; import { setActiveMatrixClient } from "../active-client.js";
import { import {
@@ -51,7 +53,6 @@ import {
resolveMatrixAllowListMatches, resolveMatrixAllowListMatches,
normalizeAllowListLower, normalizeAllowListLower,
} from "./allowlist.js"; } from "./allowlist.js";
import { mergeAllowlist, summarizeMapping } from "../../../../../src/channels/allowlists/resolve-utils.js";
import { registerMatrixAutoJoin } from "./auto-join.js"; import { registerMatrixAutoJoin } from "./auto-join.js";
import { createDirectRoomTracker } from "./direct.js"; import { createDirectRoomTracker } from "./direct.js";
import { downloadMatrixMedia } from "./media.js"; import { downloadMatrixMedia } from "./media.js";

View File

@@ -1,6 +1,6 @@
import type { MatrixClient } from "matrix-js-sdk"; import type { MatrixClient } from "matrix-js-sdk";
import { saveMediaBuffer } from "../../../../../src/media/store.js"; import { saveMediaBuffer } from "clawdbot/plugin-sdk";
async function fetchMatrixMediaBuffer(params: { async function fetchMatrixMediaBuffer(params: {
client: MatrixClient; client: MatrixClient;

View File

@@ -1,6 +1,6 @@
import type { RoomMessageEventContent } from "matrix-js-sdk/lib/@types/events.js"; import type { RoomMessageEventContent } from "matrix-js-sdk/lib/@types/events.js";
import { matchesMentionPatterns } from "../../../../../src/auto-reply/reply/mentions.js"; import { matchesMentionPatterns } from "clawdbot/plugin-sdk";
export function resolveMentions(params: { export function resolveMentions(params: {
content: RoomMessageEventContent; content: RoomMessageEventContent;

View File

@@ -1,9 +1,12 @@
import type { MatrixClient } from "matrix-js-sdk"; import type { MatrixClient } from "matrix-js-sdk";
import { chunkMarkdownText } from "../../../../../src/auto-reply/chunk.js"; import {
import type { ReplyPayload } from "../../../../../src/auto-reply/types.js"; chunkMarkdownText,
import { danger, logVerbose } from "../../../../../src/globals.js"; danger,
import type { RuntimeEnv } from "../../../../../src/runtime.js"; logVerbose,
type ReplyPayload,
type RuntimeEnv,
} from "clawdbot/plugin-sdk";
import { sendMessageMatrix } from "../send.js"; import { sendMessageMatrix } from "../send.js";
export async function deliverMatrixReplies(params: { export async function deliverMatrixReplies(params: {

View File

@@ -1,8 +1,5 @@
import type { MatrixConfig, MatrixRoomConfig } from "../../types.js"; import type { MatrixConfig, MatrixRoomConfig } from "../../types.js";
import { import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "clawdbot/plugin-sdk";
buildChannelKeyCandidates,
resolveChannelEntryMatch,
} from "../../../../../src/channels/plugins/channel-config.js";
export type MatrixRoomConfigResolved = { export type MatrixRoomConfigResolved = {
allowed: boolean; allowed: boolean;

View File

@@ -9,7 +9,7 @@
import type { TimelineEvents } from "matrix-js-sdk/lib/@types/event.js"; import type { TimelineEvents } from "matrix-js-sdk/lib/@types/event.js";
import type { ExtensibleAnyMessageEventContent } from "matrix-js-sdk/lib/@types/extensible_events.js"; import type { ExtensibleAnyMessageEventContent } from "matrix-js-sdk/lib/@types/extensible_events.js";
import type { PollInput } from "../../../../src/polls.js"; import type { PollInput } from "clawdbot/plugin-sdk";
export const M_POLL_START = "m.poll.start" as const; export const M_POLL_START = "m.poll.start" as const;
export const M_POLL_RESPONSE = "m.poll.response" as const; export const M_POLL_RESPONSE = "m.poll.response" as const;

View File

@@ -18,20 +18,18 @@ vi.mock("matrix-js-sdk", () => ({
}, },
})); }));
vi.mock("../../../../src/config/config.js", () => ({ vi.mock("clawdbot/plugin-sdk", () => ({
loadConfig: () => ({}), loadConfig: () => ({}),
})); resolveTextChunkLimit: () => 4000,
chunkMarkdownText: (text: string) => (text ? [text] : []),
vi.mock("../../../../src/web/media.js", () => ({
loadWebMedia: vi.fn().mockResolvedValue({ loadWebMedia: vi.fn().mockResolvedValue({
buffer: Buffer.from("media"), buffer: Buffer.from("media"),
fileName: "photo.png", fileName: "photo.png",
contentType: "image/png", contentType: "image/png",
kind: "image", kind: "image",
}), }),
})); mediaKindFromMime: () => "image",
isVoiceCompatibleAudio: () => false,
vi.mock("../../../../src/media/image-ops.js", () => ({
getImageMetadata: vi.fn().mockResolvedValue(null), getImageMetadata: vi.fn().mockResolvedValue(null),
resizeToJpeg: vi.fn(), resizeToJpeg: vi.fn(),
})); }));

View File

@@ -5,13 +5,17 @@ import type {
ReactionEventContent, ReactionEventContent,
} from "matrix-js-sdk/lib/@types/events.js"; } from "matrix-js-sdk/lib/@types/events.js";
import { chunkMarkdownText, resolveTextChunkLimit } from "../../../../src/auto-reply/chunk.js"; import {
import { loadConfig } from "../../../../src/config/config.js"; chunkMarkdownText,
import { isVoiceCompatibleAudio } from "../../../../src/media/audio.js"; getImageMetadata,
import { mediaKindFromMime } from "../../../../src/media/constants.js"; isVoiceCompatibleAudio,
import { getImageMetadata, resizeToJpeg } from "../../../../src/media/image-ops.js"; loadConfig,
import type { PollInput } from "../../../../src/polls.js"; loadWebMedia,
import { loadWebMedia } from "../../../../src/web/media.js"; mediaKindFromMime,
type PollInput,
resolveTextChunkLimit,
resizeToJpeg,
} from "clawdbot/plugin-sdk";
import { getActiveMatrixClient } from "./active-client.js"; import { getActiveMatrixClient } from "./active-client.js";
import { import {
createMatrixClient, createMatrixClient,

View File

@@ -1,11 +1,11 @@
import { addWildcardAllowFrom } from "../../../src/channels/plugins/onboarding/helpers.js"; import {
import type { addWildcardAllowFrom,
ChannelOnboardingAdapter, formatDocsLink,
ChannelOnboardingDmPolicy, promptChannelAccessConfig,
} from "../../../src/channels/plugins/onboarding-types.js"; type ChannelOnboardingAdapter,
import { promptChannelAccessConfig } from "../../../src/channels/plugins/onboarding/channel-access.js"; type ChannelOnboardingDmPolicy,
import { formatDocsLink } from "../../../src/terminal/links.js"; type WizardPrompter,
import type { WizardPrompter } from "../../../src/wizard/prompts.js"; } from "clawdbot/plugin-sdk";
import { listMatrixDirectoryGroupsLive } from "./directory-live.js"; import { listMatrixDirectoryGroupsLive } from "./directory-live.js";
import { resolveMatrixAccount } from "./matrix/accounts.js"; import { resolveMatrixAccount } from "./matrix/accounts.js";
import { ensureMatrixSdkInstalled, isMatrixSdkAvailable } from "./matrix/deps.js"; import { ensureMatrixSdkInstalled, isMatrixSdkAvailable } from "./matrix/deps.js";

View File

@@ -1,10 +1,11 @@
import { chunkMarkdownText } from "../../../src/auto-reply/chunk.js"; import type { ChannelOutboundAdapter } from "clawdbot/plugin-sdk";
import type { ChannelOutboundAdapter } from "../../../src/channels/plugins/types.js";
import { getMatrixRuntime } from "./runtime.js";
import { sendMessageMatrix, sendPollMatrix } from "./matrix/send.js"; import { sendMessageMatrix, sendPollMatrix } from "./matrix/send.js";
export const matrixOutbound: ChannelOutboundAdapter = { export const matrixOutbound: ChannelOutboundAdapter = {
deliveryMode: "direct", deliveryMode: "direct",
chunker: chunkMarkdownText, chunker: (text, limit) => getMatrixRuntime().channel.text.chunkMarkdownText(text, limit),
textChunkLimit: 4000, textChunkLimit: 4000,
sendText: async ({ to, text, deps, replyToId, threadId }) => { sendText: async ({ to, text, deps, replyToId, threadId }) => {
const send = deps?.sendMatrix ?? sendMessageMatrix; const send = deps?.sendMatrix ?? sendMessageMatrix;

View File

@@ -2,8 +2,8 @@ import type {
ChannelDirectoryEntry, ChannelDirectoryEntry,
ChannelResolveKind, ChannelResolveKind,
ChannelResolveResult, ChannelResolveResult,
} from "../../../src/channels/plugins/types.js"; RuntimeEnv,
import type { RuntimeEnv } from "../../../src/runtime.js"; } from "clawdbot/plugin-sdk";
import { import {
listMatrixDirectoryGroupsLive, listMatrixDirectoryGroupsLive,

View File

@@ -0,0 +1,14 @@
import type { PluginRuntime } from "clawdbot/plugin-sdk";
let runtime: PluginRuntime | null = null;
export function setMatrixRuntime(next: PluginRuntime) {
runtime = next;
}
export function getMatrixRuntime(): PluginRuntime {
if (!runtime) {
throw new Error("Matrix runtime not initialized");
}
return runtime;
}

View File

@@ -21,7 +21,7 @@ import {
readNumberParam, readNumberParam,
readReactionParams, readReactionParams,
readStringParam, readStringParam,
} from "../../../src/agents/tools/common.js"; } from "clawdbot/plugin-sdk";
const messageActions = new Set(["sendMessage", "editMessage", "deleteMessage", "readMessages"]); const messageActions = new Set(["sendMessage", "editMessage", "deleteMessage", "readMessages"]);
const reactionActions = new Set(["react", "reactions"]); const reactionActions = new Set(["react", "reactions"]);

View File

@@ -1,7 +1,10 @@
import type { ClawdbotPluginApi } from "../../src/plugins/types.js"; import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
import { createMemoryGetTool, createMemorySearchTool } from "../../src/agents/tools/memory-tool.js"; import {
import { registerMemoryCli } from "../../src/cli/memory-cli.js"; createMemoryGetTool,
createMemorySearchTool,
registerMemoryCli,
} from "clawdbot/plugin-sdk";
const memoryCorePlugin = { const memoryCorePlugin = {
id: "memory-core", id: "memory-core",

BIN
extensions/msteams/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -1,4 +1,4 @@
import type { ClawdbotPluginApi } from "../../src/plugins/types.js"; import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
import { msteamsPlugin } from "./src/channel.js"; import { msteamsPlugin } from "./src/channel.js";

View File

@@ -0,0 +1 @@
../../../../node_modules/.pnpm/@microsoft+agents-hosting@1.1.1/node_modules/@microsoft/agents-hosting

View File

@@ -0,0 +1 @@
../../../../node_modules/.pnpm/@microsoft+agents-hosting-express@1.1.1/node_modules/@microsoft/agents-hosting-express

View File

@@ -0,0 +1 @@
../../../../node_modules/.pnpm/@microsoft+agents-hosting-extensions-teams@1.1.1/node_modules/@microsoft/agents-hosting-extensions-teams

1
extensions/msteams/node_modules/express generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../node_modules/.pnpm/express@5.2.1/node_modules/express

1
extensions/msteams/node_modules/proper-lockfile generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile

View File

@@ -6,19 +6,8 @@ const saveMediaBufferMock = vi.fn(async () => ({
contentType: "image/png", contentType: "image/png",
})); }));
const modulePaths = vi.hoisted(() => { vi.mock("clawdbot/plugin-sdk", () => ({
const downloadModuleUrl = new URL("./attachments/download.js", import.meta.url);
return {
mimeModulePath: new URL("../../../../src/media/mime.js", downloadModuleUrl).pathname,
storeModulePath: new URL("../../../../src/media/store.js", downloadModuleUrl).pathname,
};
});
vi.mock(modulePaths.mimeModulePath, () => ({
detectMime: (...args: unknown[]) => detectMimeMock(...args), detectMime: (...args: unknown[]) => detectMimeMock(...args),
}));
vi.mock(modulePaths.storeModulePath, () => ({
saveMediaBuffer: (...args: unknown[]) => saveMediaBufferMock(...args), saveMediaBuffer: (...args: unknown[]) => saveMediaBufferMock(...args),
})); }));

View File

@@ -1,5 +1,4 @@
import { detectMime } from "../../../../src/media/mime.js"; import { detectMime, saveMediaBuffer } from "clawdbot/plugin-sdk";
import { saveMediaBuffer } from "../../../../src/media/store.js";
import { import {
extractInlineImageCandidates, extractInlineImageCandidates,
inferPlaceholder, inferPlaceholder,

View File

@@ -1,5 +1,4 @@
import { detectMime } from "../../../../src/media/mime.js"; import { detectMime, saveMediaBuffer } from "clawdbot/plugin-sdk";
import { saveMediaBuffer } from "../../../../src/media/store.js";
import { downloadMSTeamsImageAttachments } from "./download.js"; import { downloadMSTeamsImageAttachments } from "./download.js";
import { GRAPH_ROOT, isRecord, normalizeContentType, resolveAllowedHosts } from "./shared.js"; import { GRAPH_ROOT, isRecord, normalizeContentType, resolveAllowedHosts } from "./shared.js";
import type { import type {

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../../src/config/config.js"; import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
import { msteamsPlugin } from "./channel.js"; import { msteamsPlugin } from "./channel.js";

View File

@@ -1,9 +1,10 @@
import type { ClawdbotConfig } from "../../../src/config/config.js"; import type { ChannelMessageActionName, ChannelPlugin, ClawdbotConfig } from "clawdbot/plugin-sdk";
import { MSTeamsConfigSchema } from "../../../src/config/zod-schema.providers-core.js"; import {
import { buildChannelConfigSchema } from "../../../src/channels/plugins/config-schema.js"; buildChannelConfigSchema,
import { PAIRING_APPROVED_MESSAGE } from "../../../src/channels/plugins/pairing-message.js"; DEFAULT_ACCOUNT_ID,
import type { ChannelMessageActionName, ChannelPlugin } from "../../../src/channels/plugins/types.js"; MSTeamsConfigSchema,
import { DEFAULT_ACCOUNT_ID } from "../../../src/routing/session-key.js"; PAIRING_APPROVED_MESSAGE,
} from "clawdbot/plugin-sdk";
import { msteamsOnboardingAdapter } from "./onboarding.js"; import { msteamsOnboardingAdapter } from "./onboarding.js";
import { msteamsOutbound } from "./outbound.js"; import { msteamsOutbound } from "./outbound.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelDirectoryEntry } from "../../../src/channels/plugins/types.js"; import type { ChannelDirectoryEntry } from "clawdbot/plugin-sdk";
import { GRAPH_ROOT } from "./attachments/shared.js"; import { GRAPH_ROOT } from "./attachments/shared.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js"; import { loadMSTeamsSdkWithAuth } from "./sdk.js";

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { SILENT_REPLY_TOKEN } from "../../../src/auto-reply/tokens.js"; import { SILENT_REPLY_TOKEN } from "clawdbot/plugin-sdk";
import type { StoredConversationReference } from "./conversation-store.js"; import type { StoredConversationReference } from "./conversation-store.js";
import { import {
type MSTeamsAdapter, type MSTeamsAdapter,

View File

@@ -1,7 +1,10 @@
import { chunkMarkdownText } from "../../../src/auto-reply/chunk.js"; import {
import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../../../src/auto-reply/tokens.js"; chunkMarkdownText,
import type { ReplyPayload } from "../../../src/auto-reply/types.js"; isSilentReplyText,
import type { MSTeamsReplyStyle } from "../../../src/config/types.js"; type MSTeamsReplyStyle,
type ReplyPayload,
SILENT_REPLY_TOKEN,
} from "clawdbot/plugin-sdk";
import type { StoredConversationReference } from "./conversation-store.js"; import type { StoredConversationReference } from "./conversation-store.js";
import { classifyMSTeamsSendError } from "./errors.js"; import { classifyMSTeamsSendError } from "./errors.js";

View File

@@ -1,6 +1,5 @@
import type { ClawdbotConfig } from "../../../src/config/types.js"; import type { ClawdbotConfig, RuntimeEnv } from "clawdbot/plugin-sdk";
import { danger } from "../../../src/globals.js"; import { danger } from "clawdbot/plugin-sdk";
import type { RuntimeEnv } from "../../../src/runtime.js";
import type { MSTeamsConversationStore } from "./conversation-store.js"; import type { MSTeamsConversationStore } from "./conversation-store.js";
import type { MSTeamsAdapter } from "./messenger.js"; import type { MSTeamsAdapter } from "./messenger.js";
import { createMSTeamsMessageHandler } from "./monitor-handler/message-handler.js"; import { createMSTeamsMessageHandler } from "./monitor-handler/message-handler.js";

View File

@@ -1,29 +1,27 @@
import { hasControlCommand } from "../../../../src/auto-reply/command-detection.js";
import { formatAgentEnvelope } from "../../../../src/auto-reply/envelope.js";
import {
createInboundDebouncer,
resolveInboundDebounceMs,
} from "../../../../src/auto-reply/inbound-debounce.js";
import { dispatchReplyFromConfig } from "../../../../src/auto-reply/reply/dispatch-from-config.js";
import { finalizeInboundContext } from "../../../../src/auto-reply/reply/inbound-context.js";
import { import {
buildPendingHistoryContextFromMap, buildPendingHistoryContextFromMap,
clearHistoryEntries, clearHistoryEntries,
createInboundDebouncer,
danger,
DEFAULT_GROUP_HISTORY_LIMIT, DEFAULT_GROUP_HISTORY_LIMIT,
recordPendingHistoryEntry,
type HistoryEntry,
} from "../../../../src/auto-reply/reply/history.js";
import { resolveMentionGating } from "../../../../src/channels/mention-gating.js";
import { resolveCommandAuthorizedFromAuthorizers } from "../../../../src/channels/command-gating.js";
import { formatAllowlistMatchMeta } from "../../../../src/channels/plugins/allowlist-match.js";
import { danger, logVerbose, shouldLogVerbose } from "../../../../src/globals.js";
import { enqueueSystemEvent } from "../../../../src/infra/system-events.js";
import { recordSessionMetaFromInbound, resolveStorePath } from "../../../../src/config/sessions.js";
import {
readChannelAllowFromStore, readChannelAllowFromStore,
recordSessionMetaFromInbound,
recordPendingHistoryEntry,
resolveAgentRoute,
resolveCommandAuthorizedFromAuthorizers,
resolveInboundDebounceMs,
resolveMentionGating,
resolveStorePath,
dispatchReplyFromConfig,
finalizeInboundContext,
formatAgentEnvelope,
formatAllowlistMatchMeta,
hasControlCommand,
logVerbose,
shouldLogVerbose,
upsertChannelPairingRequest, upsertChannelPairingRequest,
} from "../../../../src/pairing/pairing-store.js"; type HistoryEntry,
import { resolveAgentRoute } from "../../../../src/routing/resolve-route.js"; } from "clawdbot/plugin-sdk";
import { import {
buildMSTeamsAttachmentPlaceholder, buildMSTeamsAttachmentPlaceholder,

View File

@@ -1,9 +1,12 @@
import type { Request, Response } from "express"; import type { Request, Response } from "express";
import { resolveTextChunkLimit } from "../../../src/auto-reply/chunk.js"; import {
import { mergeAllowlist, summarizeMapping } from "../../../src/channels/allowlists/resolve-utils.js"; getChildLogger,
import type { ClawdbotConfig } from "../../../src/config/types.js"; mergeAllowlist,
import { getChildLogger } from "../../../src/logging.js"; resolveTextChunkLimit,
import type { RuntimeEnv } from "../../../src/runtime.js"; summarizeMapping,
type ClawdbotConfig,
type RuntimeEnv,
} from "clawdbot/plugin-sdk";
import type { MSTeamsConversationStore } from "./conversation-store.js"; import type { MSTeamsConversationStore } from "./conversation-store.js";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js"; import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import { formatUnknownError } from "./errors.js"; import { formatUnknownError } from "./errors.js";

View File

@@ -1,14 +1,16 @@
import type { ClawdbotConfig } from "../../../src/config/config.js";
import type { DmPolicy } from "../../../src/config/types.js";
import { DEFAULT_ACCOUNT_ID } from "../../../src/routing/session-key.js";
import { formatDocsLink } from "../../../src/terminal/links.js";
import type { WizardPrompter } from "../../../src/wizard/prompts.js";
import type { import type {
ChannelOnboardingAdapter, ChannelOnboardingAdapter,
ChannelOnboardingDmPolicy, ChannelOnboardingDmPolicy,
} from "../../../src/channels/plugins/onboarding-types.js"; ClawdbotConfig,
import { promptChannelAccessConfig } from "../../../src/channels/plugins/onboarding/channel-access.js"; DmPolicy,
import { addWildcardAllowFrom } from "../../../src/channels/plugins/onboarding/helpers.js"; WizardPrompter,
} from "clawdbot/plugin-sdk";
import {
addWildcardAllowFrom,
DEFAULT_ACCOUNT_ID,
formatDocsLink,
promptChannelAccessConfig,
} from "clawdbot/plugin-sdk";
import { resolveMSTeamsCredentials } from "./token.js"; import { resolveMSTeamsCredentials } from "./token.js";
import { import {

View File

@@ -1,5 +1,4 @@
import { chunkMarkdownText } from "../../../src/auto-reply/chunk.js"; import { chunkMarkdownText, type ChannelOutboundAdapter } from "clawdbot/plugin-sdk";
import type { ChannelOutboundAdapter } from "../../../src/channels/plugins/types.js";
import { createMSTeamsPollStoreFs } from "./polls.js"; import { createMSTeamsPollStoreFs } from "./polls.js";
import { sendMessageMSTeams, sendPollMSTeams } from "./send.js"; import { sendMessageMSTeams, sendPollMSTeams } from "./send.js";

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import type { MSTeamsConfig } from "../../../src/config/types.js"; import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
import { import {
isMSTeamsGroupAllowed, isMSTeamsGroupAllowed,
resolveMSTeamsReplyPolicy, resolveMSTeamsReplyPolicy,

View File

@@ -1,17 +1,17 @@
import type { import type {
AllowlistMatch,
GroupPolicy, GroupPolicy,
MSTeamsChannelConfig, MSTeamsChannelConfig,
MSTeamsConfig, MSTeamsConfig,
MSTeamsReplyStyle, MSTeamsReplyStyle,
MSTeamsTeamConfig, MSTeamsTeamConfig,
} from "../../../src/config/types.js"; } from "clawdbot/plugin-sdk";
import { import {
buildChannelKeyCandidates, buildChannelKeyCandidates,
normalizeChannelSlug, normalizeChannelSlug,
resolveChannelEntryMatchWithFallback, resolveChannelEntryMatchWithFallback,
resolveNestedAllowlistDecision, resolveNestedAllowlistDecision,
} from "../../../src/channels/plugins/channel-config.js"; } from "clawdbot/plugin-sdk";
import type { AllowlistMatch } from "../../../src/channels/plugins/allowlist-match.js";
export type MSTeamsResolvedRouteConfig = { export type MSTeamsResolvedRouteConfig = {
teamConfig?: MSTeamsTeamConfig; teamConfig?: MSTeamsTeamConfig;

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import type { MSTeamsConfig } from "../../../src/config/types.js"; import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
const hostMockState = vi.hoisted(() => ({ const hostMockState = vi.hoisted(() => ({
tokenError: null as Error | null, tokenError: null as Error | null,

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "../../../src/config/types.js"; import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
import { formatUnknownError } from "./errors.js"; import { formatUnknownError } from "./errors.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js"; import { loadMSTeamsSdkWithAuth } from "./sdk.js";
import { resolveMSTeamsCredentials } from "./token.js"; import { resolveMSTeamsCredentials } from "./token.js";

View File

@@ -1,8 +1,12 @@
import { resolveEffectiveMessagesConfig, resolveHumanDelayConfig } from "../../../src/agents/identity.js"; import {
import { createReplyDispatcherWithTyping } from "../../../src/auto-reply/reply/reply-dispatcher.js"; createReplyDispatcherWithTyping,
import type { ClawdbotConfig, MSTeamsReplyStyle } from "../../../src/config/types.js"; danger,
import { danger } from "../../../src/globals.js"; resolveEffectiveMessagesConfig,
import type { RuntimeEnv } from "../../../src/runtime.js"; resolveHumanDelayConfig,
type ClawdbotConfig,
type MSTeamsReplyStyle,
type RuntimeEnv,
} from "clawdbot/plugin-sdk";
import type { StoredConversationReference } from "./conversation-store.js"; import type { StoredConversationReference } from "./conversation-store.js";
import { import {
classifyMSTeamsSendError, classifyMSTeamsSendError,

View File

@@ -1,5 +1,5 @@
import type { ClawdbotConfig } from "../../../src/config/types.js"; import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
import type { getChildLogger as getChildLoggerFn } from "../../../src/logging.js"; import type { getChildLogger as getChildLoggerFn } from "clawdbot/plugin-sdk";
import type { import type {
MSTeamsConversationStore, MSTeamsConversationStore,
StoredConversationReference, StoredConversationReference,

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../../src/config/types.js"; import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
import type { StoredConversationReference } from "./conversation-store.js"; import type { StoredConversationReference } from "./conversation-store.js";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js"; import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import { import {

View File

@@ -1,6 +1,6 @@
import path from "node:path"; import path from "node:path";
import { resolveStateDir } from "../../../src/config/paths.js"; import { resolveStateDir } from "clawdbot/plugin-sdk";
export type MSTeamsStorePathOptions = { export type MSTeamsStorePathOptions = {
env?: NodeJS.ProcessEnv; env?: NodeJS.ProcessEnv;

View File

@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "../../../src/config/types.js"; import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
export type MSTeamsCredentials = { export type MSTeamsCredentials = {
appId: string; appId: string;

BIN
extensions/voice-call/.DS_Store vendored Normal file

Binary file not shown.

1
extensions/voice-call/node_modules/@sinclair/typebox generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../../node_modules/.pnpm/@sinclair+typebox@0.34.47/node_modules/@sinclair/typebox

1
extensions/voice-call/node_modules/ws generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws

1
extensions/voice-call/node_modules/zod generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../node_modules/.pnpm/zod@4.3.5/node_modules/zod

BIN
extensions/zalo/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -1,4 +1,4 @@
import type { ClawdbotPluginApi } from "../../src/plugins/types.js"; import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
import { zaloDock, zaloPlugin } from "./src/channel.js"; import { zaloDock, zaloPlugin } from "./src/channel.js";
import { handleZaloWebhookRequest } from "./src/monitor.js"; import { handleZaloWebhookRequest } from "./src/monitor.js";

1
extensions/zalo/node_modules/undici generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../node_modules/.pnpm/undici@7.18.2/node_modules/undici

View File

@@ -1,4 +1,7 @@
import type { ChannelMessageActionAdapter, ChannelMessageActionName } from "../../src/channels/plugins/types.js"; import type {
ChannelMessageActionAdapter,
ChannelMessageActionName,
} from "clawdbot/plugin-sdk";
import type { CoreConfig } from "./types.js"; import type { CoreConfig } from "./types.js";
import { listEnabledZaloAccounts } from "./accounts.js"; import { listEnabledZaloAccounts } from "./accounts.js";

View File

@@ -1,6 +1,5 @@
import type { ChannelAccountSnapshot } from "../../../src/channels/plugins/types.js"; import type { ChannelAccountSnapshot, ChannelDock, ChannelPlugin } from "clawdbot/plugin-sdk";
import type { ChannelDock, ChannelPlugin } from "../../../src/channels/plugins/types.js"; import { buildChannelConfigSchema } from "clawdbot/plugin-sdk";
import { buildChannelConfigSchema } from "../../../src/channels/plugins/config-schema.js";
import { listZaloAccountIds, resolveDefaultZaloAccountId, resolveZaloAccount, type ResolvedZaloAccount } from "./accounts.js"; import { listZaloAccountIds, resolveDefaultZaloAccountId, resolveZaloAccount, type ResolvedZaloAccount } from "./accounts.js";
import { zaloMessageActions } from "./actions.js"; import { zaloMessageActions } from "./actions.js";

View File

@@ -2,12 +2,13 @@ import type { IncomingMessage, ServerResponse } from "node:http";
import type { ResolvedZaloAccount } from "./accounts.js"; import type { ResolvedZaloAccount } from "./accounts.js";
import { import {
finalizeInboundContext,
isControlCommandMessage, isControlCommandMessage,
recordSessionMetaFromInbound,
resolveCommandAuthorizedFromAuthorizers,
resolveStorePath,
shouldComputeCommandAuthorized, shouldComputeCommandAuthorized,
} from "../../../src/auto-reply/command-detection.js"; } from "clawdbot/plugin-sdk";
import { finalizeInboundContext } from "../../../src/auto-reply/reply/inbound-context.js";
import { resolveCommandAuthorizedFromAuthorizers } from "../../../src/channels/command-gating.js";
import { recordSessionMetaFromInbound, resolveStorePath } from "../../../src/config/sessions.js";
import { import {
ZaloApiError, ZaloApiError,
deleteWebhook, deleteWebhook,

View File

@@ -1,5 +1,8 @@
import type { ChannelOnboardingAdapter, ChannelOnboardingDmPolicy } from "../../src/channels/plugins/onboarding-types.js"; import type {
import type { WizardPrompter } from "../../src/wizard/prompts.js"; ChannelOnboardingAdapter,
ChannelOnboardingDmPolicy,
WizardPrompter,
} from "clawdbot/plugin-sdk";
import { addWildcardAllowFrom, promptAccountId } from "./shared/onboarding.js"; import { addWildcardAllowFrom, promptAccountId } from "./shared/onboarding.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "./shared/account-ids.js"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "./shared/account-ids.js";

View File

@@ -1,4 +1,4 @@
import type { WizardPrompter } from "../../../src/wizard/prompts.js"; import type { WizardPrompter } from "clawdbot/plugin-sdk";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "./account-ids.js"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "./account-ids.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "../../src/channels/plugins/types.js"; import type { ChannelAccountSnapshot, ChannelStatusIssue } from "clawdbot/plugin-sdk";
type ZaloAccountStatus = { type ZaloAccountStatus = {
accountId?: unknown; accountId?: unknown;

BIN
extensions/zalouser/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -1,4 +1,4 @@
import type { ClawdbotPluginApi } from "../../src/plugins/types.js"; import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
import { zalouserPlugin } from "./src/channel.js"; import { zalouserPlugin } from "./src/channel.js";
import { ZalouserToolSchema, executeZalouserTool } from "./src/tool.js"; import { ZalouserToolSchema, executeZalouserTool } from "./src/tool.js";

1
extensions/zalouser/node_modules/@sinclair/typebox generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../../node_modules/.pnpm/@sinclair+typebox@0.34.47/node_modules/@sinclair/typebox

View File

@@ -1,10 +1,6 @@
import type { ChannelPlugin } from "../../../src/channels/plugins/types.plugin.js"; import type { ChannelAccountSnapshot, ChannelDirectoryEntry, ChannelPlugin } from "clawdbot/plugin-sdk";
import type {
ChannelAccountSnapshot,
ChannelDirectoryEntry,
} from "../../../src/channels/plugins/types.core.js";
import { formatPairingApproveHint } from "../../../src/channels/plugins/helpers.js"; import { formatPairingApproveHint } from "clawdbot/plugin-sdk";
import { import {
listZalouserAccountIds, listZalouserAccountIds,
resolveDefaultZalouserAccountId, resolveDefaultZalouserAccountId,

View File

@@ -1,14 +1,16 @@
import type { ChildProcess } from "node:child_process"; import type { ChildProcess } from "node:child_process";
import type { RuntimeEnv } from "../../../src/runtime.js"; import type { RuntimeEnv } from "clawdbot/plugin-sdk";
import { import {
finalizeInboundContext,
isControlCommandMessage, isControlCommandMessage,
mergeAllowlist,
recordSessionMetaFromInbound,
resolveCommandAuthorizedFromAuthorizers,
resolveStorePath,
shouldComputeCommandAuthorized, shouldComputeCommandAuthorized,
} from "../../../src/auto-reply/command-detection.js"; summarizeMapping,
import { mergeAllowlist, summarizeMapping } from "../../../src/channels/allowlists/resolve-utils.js"; } from "clawdbot/plugin-sdk";
import { finalizeInboundContext } from "../../../src/auto-reply/reply/inbound-context.js";
import { resolveCommandAuthorizedFromAuthorizers } from "../../../src/channels/command-gating.js";
import { recordSessionMetaFromInbound, resolveStorePath } from "../../../src/config/sessions.js";
import { loadCoreChannelDeps, type CoreChannelDeps } from "./core-bridge.js"; import { loadCoreChannelDeps, type CoreChannelDeps } from "./core-bridge.js";
import { sendMessageZalouser } from "./send.js"; import { sendMessageZalouser } from "./send.js";
import type { import type {

View File

@@ -1,6 +1,9 @@
import type { ChannelOnboardingAdapter, ChannelOnboardingDmPolicy } from "../../../src/channels/plugins/onboarding-types.js"; import type {
import type { WizardPrompter } from "../../../src/wizard/prompts.js"; ChannelOnboardingAdapter,
import { promptChannelAccessConfig } from "../../../src/channels/plugins/onboarding/channel-access.js"; ChannelOnboardingDmPolicy,
WizardPrompter,
} from "clawdbot/plugin-sdk";
import { promptChannelAccessConfig } from "clawdbot/plugin-sdk";
import { import {
listZalouserAccountIds, listZalouserAccountIds,

BIN
src/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/agents/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/channels/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/cli/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/commands/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/cron/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/gateway/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/infra/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -53,6 +53,76 @@ export type {
ChannelToolSend, ChannelToolSend,
} from "../channels/plugins/types.js"; } from "../channels/plugins/types.js";
export type { ChannelConfigSchema, ChannelPlugin } from "../channels/plugins/types.plugin.js"; export type { ChannelConfigSchema, ChannelPlugin } from "../channels/plugins/types.plugin.js";
export type { ClawdbotPluginApi } from "../plugins/types.js";
export type { ClawdbotConfig } from "../config/config.js";
export type { ChannelDock } from "../channels/dock.js";
export type {
DmPolicy,
GroupPolicy,
MSTeamsChannelConfig,
MSTeamsConfig,
MSTeamsReplyStyle,
MSTeamsTeamConfig,
} from "../config/types.js";
export { MSTeamsConfigSchema } from "../config/zod-schema.providers-core.js";
export type { RuntimeEnv } from "../runtime.js";
export type { WizardPrompter } from "../wizard/prompts.js";
export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js";
export type { ReplyPayload } from "../auto-reply/types.js";
export { SILENT_REPLY_TOKEN, isSilentReplyText } from "../auto-reply/tokens.js";
export { chunkMarkdownText, resolveTextChunkLimit } from "../auto-reply/chunk.js";
export {
hasControlCommand,
isControlCommandMessage,
shouldComputeCommandAuthorized,
} from "../auto-reply/command-detection.js";
export { shouldHandleTextCommands } from "../auto-reply/commands-registry.js";
export { formatAgentEnvelope } from "../auto-reply/envelope.js";
export {
createInboundDebouncer,
resolveInboundDebounceMs,
} from "../auto-reply/inbound-debounce.js";
export { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
export { finalizeInboundContext } from "../auto-reply/reply/inbound-context.js";
export {
buildPendingHistoryContextFromMap,
clearHistoryEntries,
DEFAULT_GROUP_HISTORY_LIMIT,
recordPendingHistoryEntry,
} from "../auto-reply/reply/history.js";
export type { HistoryEntry } from "../auto-reply/reply/history.js";
export { buildMentionRegexes, matchesMentionPatterns } from "../auto-reply/reply/mentions.js";
export { createReplyDispatcherWithTyping } from "../auto-reply/reply/reply-dispatcher.js";
export { resolveEffectiveMessagesConfig, resolveHumanDelayConfig } from "../agents/identity.js";
export { mergeAllowlist, summarizeMapping } from "../channels/allowlists/resolve-utils.js";
export { resolveCommandAuthorizedFromAuthorizers } from "../channels/command-gating.js";
export { resolveMentionGating } from "../channels/mention-gating.js";
export {
buildChannelKeyCandidates,
normalizeChannelSlug,
resolveChannelEntryMatch,
resolveChannelEntryMatchWithFallback,
resolveNestedAllowlistDecision,
} from "../channels/plugins/channel-config.js";
export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js";
export { formatAllowlistMatchMeta } from "../channels/plugins/allowlist-match.js";
export { readChannelAllowFromStore, upsertChannelPairingRequest } from "../pairing/pairing-store.js";
export { resolveAgentRoute } from "../routing/resolve-route.js";
export { recordSessionMetaFromInbound, resolveStorePath, updateLastRoute } from "../config/sessions.js";
export { resolveStateDir } from "../config/paths.js";
export { loadConfig } from "../config/config.js";
export { danger } from "../globals.js";
export { logVerbose, shouldLogVerbose } from "../globals.js";
export { getChildLogger } from "../logging.js";
export { enqueueSystemEvent } from "../infra/system-events.js";
export { runCommandWithTimeout } from "../process/exec.js";
export { loadWebMedia } from "../web/media.js";
export { isVoiceCompatibleAudio } from "../media/audio.js";
export { mediaKindFromMime } from "../media/constants.js";
export { detectMime } from "../media/mime.js";
export { getImageMetadata, resizeToJpeg } from "../media/image-ops.js";
export { saveMediaBuffer } from "../media/store.js";
export type { PollInput } from "../polls.js";
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
export { export {
@@ -63,7 +133,10 @@ export { applyAccountNameToChannelSection } from "../channels/plugins/setup-help
export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; export { formatPairingApproveHint } from "../channels/plugins/helpers.js";
export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js";
export type { ChannelOnboardingAdapter } from "../channels/plugins/onboarding-types.js"; export type {
ChannelOnboardingAdapter,
ChannelOnboardingDmPolicy,
} from "../channels/plugins/onboarding-types.js";
export { addWildcardAllowFrom } from "../channels/plugins/onboarding/helpers.js"; export { addWildcardAllowFrom } from "../channels/plugins/onboarding/helpers.js";
export { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js"; export { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js";
@@ -74,5 +147,7 @@ export {
readReactionParams, readReactionParams,
readStringParam, readStringParam,
} from "../agents/tools/common.js"; } from "../agents/tools/common.js";
export { createMemoryGetTool, createMemorySearchTool } from "../agents/tools/memory-tool.js";
export { registerMemoryCli } from "../cli/memory-cli.js";
export { formatDocsLink } from "../terminal/links.js"; export { formatDocsLink } from "../terminal/links.js";

View File

@@ -1,3 +1,6 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { createJiti } from "jiti"; import { createJiti } from "jiti";
import type { ClawdbotConfig } from "../config/config.js"; import type { ClawdbotConfig } from "../config/config.js";
@@ -92,6 +95,24 @@ const normalizePluginsConfig = (config?: ClawdbotConfig["plugins"]): NormalizedP
}; };
}; };
const resolvePluginSdkAlias = (): string | null => {
try {
let cursor = path.dirname(fileURLToPath(import.meta.url));
for (let i = 0; i < 6; i += 1) {
const distCandidate = path.join(cursor, "dist", "plugin-sdk", "index.js");
if (fs.existsSync(distCandidate)) return distCandidate;
const srcCandidate = path.join(cursor, "src", "plugin-sdk", "index.ts");
if (fs.existsSync(srcCandidate)) return srcCandidate;
const parent = path.dirname(cursor);
if (parent === cursor) break;
cursor = parent;
}
} catch {
// ignore
}
return null;
};
function buildCacheKey(params: { function buildCacheKey(params: {
workspaceDir?: string; workspaceDir?: string;
plugins: NormalizedPluginsConfig; plugins: NormalizedPluginsConfig;
@@ -289,8 +310,10 @@ export function loadClawdbotPlugins(options: PluginLoadOptions = {}): PluginRegi
}); });
pushDiagnostics(registry.diagnostics, discovery.diagnostics); pushDiagnostics(registry.diagnostics, discovery.diagnostics);
const pluginSdkAlias = resolvePluginSdkAlias();
const jiti = createJiti(import.meta.url, { const jiti = createJiti(import.meta.url, {
interopDefault: true, interopDefault: true,
...(pluginSdkAlias ? { alias: { "clawdbot/plugin-sdk": pluginSdkAlias } } : {}),
}); });
const seenIds = new Map<string, PluginRecord["origin"]>(); const seenIds = new Map<string, PluginRecord["origin"]>();

View File

@@ -6,6 +6,7 @@ import { createInboundDebouncer, resolveInboundDebounceMs } from "../../auto-rep
import { buildMentionRegexes, matchesMentionPatterns } from "../../auto-reply/reply/mentions.js"; import { buildMentionRegexes, matchesMentionPatterns } from "../../auto-reply/reply/mentions.js";
import { dispatchReplyWithBufferedBlockDispatcher } from "../../auto-reply/reply/provider-dispatcher.js"; import { dispatchReplyWithBufferedBlockDispatcher } from "../../auto-reply/reply/provider-dispatcher.js";
import { createReplyDispatcherWithTyping } from "../../auto-reply/reply/reply-dispatcher.js"; import { createReplyDispatcherWithTyping } from "../../auto-reply/reply/reply-dispatcher.js";
import { resolveEffectiveMessagesConfig, resolveHumanDelayConfig } from "../../agents/identity.js";
import { resolveCommandAuthorizedFromAuthorizers } from "../../channels/command-gating.js"; import { resolveCommandAuthorizedFromAuthorizers } from "../../channels/command-gating.js";
import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "../../config/group-policy.js"; import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "../../config/group-policy.js";
import { resolveStateDir } from "../../config/paths.js"; import { resolveStateDir } from "../../config/paths.js";
@@ -46,6 +47,8 @@ export function createPluginRuntime(): PluginRuntime {
reply: { reply: {
dispatchReplyWithBufferedBlockDispatcher, dispatchReplyWithBufferedBlockDispatcher,
createReplyDispatcherWithTyping, createReplyDispatcherWithTyping,
resolveEffectiveMessagesConfig,
resolveHumanDelayConfig,
}, },
routing: { routing: {
resolveAgentRoute, resolveAgentRoute,

View File

@@ -25,6 +25,15 @@ export type PluginRuntime = {
}; };
}) => Promise<void>; }) => Promise<void>;
createReplyDispatcherWithTyping: (...args: unknown[]) => unknown; createReplyDispatcherWithTyping: (...args: unknown[]) => unknown;
resolveEffectiveMessagesConfig: (
cfg: ClawdbotConfig,
agentId: string,
opts?: { hasAllowFrom?: boolean; fallbackMessagePrefix?: string },
) => { messagePrefix: string; responsePrefix?: string };
resolveHumanDelayConfig: (
cfg: ClawdbotConfig,
agentId: string,
) => { mode?: string; minMs?: number; maxMs?: number } | undefined;
}; };
routing: { routing: {
resolveAgentRoute: (params: { resolveAgentRoute: (params: {

BIN
src/tui/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/web/.DS_Store vendored Normal file

Binary file not shown.