mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-07 22:44:16 +00:00
refactor: migrate extensions to plugin sdk
This commit is contained in:
@@ -8,6 +8,7 @@ Docs: https://docs.clawd.bot
|
||||
- Plugins: add exclusive plugin slots with a dedicated memory slot selector.
|
||||
- Memory: ship core memory tools + CLI as the bundled `memory-core` plugin.
|
||||
- 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
|
||||
|
||||
|
||||
BIN
extensions/.DS_Store
vendored
Normal file
BIN
extensions/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
extensions/matrix/.DS_Store
vendored
Normal file
BIN
extensions/matrix/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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 { setMatrixRuntime } from "./src/runtime.js";
|
||||
|
||||
const plugin = {
|
||||
id: "matrix",
|
||||
name: "Matrix",
|
||||
description: "Matrix channel plugin (matrix-js-sdk)",
|
||||
register(api: ClawdbotPluginApi) {
|
||||
setMatrixRuntime(api.runtime);
|
||||
api.registerChannel({ plugin: matrixPlugin });
|
||||
},
|
||||
};
|
||||
|
||||
21
extensions/matrix/node_modules/.bin/.ignored_markdown-it
generated
vendored
Executable file
21
extensions/matrix/node_modules/.bin/.ignored_markdown-it
generated
vendored
Executable 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
1
extensions/matrix/node_modules/.bin/markdown-it
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../markdown-it/bin/markdown-it.mjs
|
||||
1
extensions/matrix/node_modules/markdown-it
generated
vendored
Symbolic link
1
extensions/matrix/node_modules/markdown-it
generated
vendored
Symbolic link
@@ -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
1
extensions/matrix/node_modules/matrix-js-sdk
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../node_modules/.pnpm/matrix-js-sdk@40.0.0/node_modules/matrix-js-sdk
|
||||
@@ -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 { handleMatrixAction } from "./tool-actions.js";
|
||||
import type { CoreConfig } from "./types.js";
|
||||
import type {
|
||||
ChannelMessageActionAdapter,
|
||||
ChannelMessageActionContext,
|
||||
ChannelMessageActionName,
|
||||
ChannelToolSend,
|
||||
} from "../../../src/channels/plugins/types.js";
|
||||
|
||||
export const matrixMessageActions: ChannelMessageActionAdapter = {
|
||||
listActions: ({ cfg }) => {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import type { ChannelPlugin } from "../../../src/channels/plugins/types.js";
|
||||
import {
|
||||
applyAccountNameToChannelSection,
|
||||
buildChannelConfigSchema,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
deleteAccountFromConfigSection,
|
||||
formatPairingApproveHint,
|
||||
normalizeAccountId,
|
||||
PAIRING_APPROVED_MESSAGE,
|
||||
setAccountEnabledInConfigSection,
|
||||
} from "../../../src/channels/plugins/config-helpers.js";
|
||||
import { buildChannelConfigSchema } from "../../../src/channels/plugins/config-schema.js";
|
||||
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";
|
||||
type ChannelPlugin,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
import { matrixMessageActions } from "./actions.js";
|
||||
import { MatrixConfigSchema } from "./config-schema.js";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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 type { CoreConfig } from "./types.js";
|
||||
|
||||
@@ -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 { resolveMatrixConfig } from "./client.js";
|
||||
import { credentialsMatchConfig, loadMatrixCredentials } from "./credentials.js";
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
RoomTopicEventContent,
|
||||
} 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 { getActiveMatrixClient } from "./active-client.js";
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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";
|
||||
|
||||
export type MatrixResolvedConfig = {
|
||||
|
||||
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { resolveStateDir } from "../../../../src/config/paths.js";
|
||||
import { resolveStateDir } from "clawdbot/plugin-sdk";
|
||||
|
||||
export type MatrixStoredCredentials = {
|
||||
homeserver: string;
|
||||
|
||||
@@ -3,8 +3,7 @@ import path from "node:path";
|
||||
import { createRequire } from "node:module";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { runCommandWithTimeout } from "../../../../src/process/exec.js";
|
||||
import type { RuntimeEnv } from "../../../../src/runtime.js";
|
||||
import { runCommandWithTimeout, type RuntimeEnv } from "clawdbot/plugin-sdk";
|
||||
|
||||
const MATRIX_SDK_PACKAGE = "matrix-js-sdk";
|
||||
|
||||
|
||||
@@ -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>) {
|
||||
return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { MatrixClient, MatrixEvent, RoomMember } from "matrix-js-sdk";
|
||||
import { RoomMemberEvent } from "matrix-js-sdk";
|
||||
|
||||
import { danger, logVerbose } from "../../../../../src/globals.js";
|
||||
import type { RuntimeEnv } from "../../../../../src/runtime.js";
|
||||
import { danger, logVerbose, type RuntimeEnv } from "clawdbot/plugin-sdk";
|
||||
import type { CoreConfig } from "../../types.js";
|
||||
|
||||
export function registerMatrixAutoJoin(params: {
|
||||
|
||||
@@ -2,36 +2,38 @@ import type { MatrixEvent, Room } from "matrix-js-sdk";
|
||||
import { EventType, RelationType, RoomEvent } from "matrix-js-sdk";
|
||||
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 {
|
||||
buildMentionRegexes,
|
||||
chunkMarkdownText,
|
||||
createReplyDispatcherWithTyping,
|
||||
danger,
|
||||
dispatchReplyFromConfig,
|
||||
enqueueSystemEvent,
|
||||
finalizeInboundContext,
|
||||
formatAgentEnvelope,
|
||||
formatAllowlistMatchMeta,
|
||||
getChildLogger,
|
||||
hasControlCommand,
|
||||
loadConfig,
|
||||
logVerbose,
|
||||
mergeAllowlist,
|
||||
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,
|
||||
recordSessionMetaFromInbound,
|
||||
resolveAgentRoute,
|
||||
resolveCommandAuthorizedFromAuthorizers,
|
||||
resolveEffectiveMessagesConfig,
|
||||
resolveHumanDelayConfig,
|
||||
resolveStorePath,
|
||||
resolveTextChunkLimit,
|
||||
shouldHandleTextCommands,
|
||||
shouldLogVerbose,
|
||||
summarizeMapping,
|
||||
updateLastRoute,
|
||||
upsertChannelPairingRequest,
|
||||
} from "../../../../../src/pairing/pairing-store.js";
|
||||
import { resolveAgentRoute } from "../../../../../src/routing/resolve-route.js";
|
||||
import type { RuntimeEnv } from "../../../../../src/runtime.js";
|
||||
type ReplyPayload,
|
||||
type RuntimeEnv,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import type { CoreConfig, ReplyToMode } from "../../types.js";
|
||||
import { setActiveMatrixClient } from "../active-client.js";
|
||||
import {
|
||||
@@ -51,7 +53,6 @@ import {
|
||||
resolveMatrixAllowListMatches,
|
||||
normalizeAllowListLower,
|
||||
} from "./allowlist.js";
|
||||
import { mergeAllowlist, summarizeMapping } from "../../../../../src/channels/allowlists/resolve-utils.js";
|
||||
import { registerMatrixAutoJoin } from "./auto-join.js";
|
||||
import { createDirectRoomTracker } from "./direct.js";
|
||||
import { downloadMatrixMedia } from "./media.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MatrixClient } from "matrix-js-sdk";
|
||||
|
||||
import { saveMediaBuffer } from "../../../../../src/media/store.js";
|
||||
import { saveMediaBuffer } from "clawdbot/plugin-sdk";
|
||||
|
||||
async function fetchMatrixMediaBuffer(params: {
|
||||
client: MatrixClient;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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: {
|
||||
content: RoomMessageEventContent;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import type { MatrixClient } from "matrix-js-sdk";
|
||||
|
||||
import { chunkMarkdownText } from "../../../../../src/auto-reply/chunk.js";
|
||||
import type { ReplyPayload } from "../../../../../src/auto-reply/types.js";
|
||||
import { danger, logVerbose } from "../../../../../src/globals.js";
|
||||
import type { RuntimeEnv } from "../../../../../src/runtime.js";
|
||||
import {
|
||||
chunkMarkdownText,
|
||||
danger,
|
||||
logVerbose,
|
||||
type ReplyPayload,
|
||||
type RuntimeEnv,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import { sendMessageMatrix } from "../send.js";
|
||||
|
||||
export async function deliverMatrixReplies(params: {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import type { MatrixConfig, MatrixRoomConfig } from "../../types.js";
|
||||
import {
|
||||
buildChannelKeyCandidates,
|
||||
resolveChannelEntryMatch,
|
||||
} from "../../../../../src/channels/plugins/channel-config.js";
|
||||
import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "clawdbot/plugin-sdk";
|
||||
|
||||
export type MatrixRoomConfigResolved = {
|
||||
allowed: boolean;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
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 { 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_RESPONSE = "m.poll.response" as const;
|
||||
|
||||
@@ -18,20 +18,18 @@ vi.mock("matrix-js-sdk", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("../../../../src/config/config.js", () => ({
|
||||
vi.mock("clawdbot/plugin-sdk", () => ({
|
||||
loadConfig: () => ({}),
|
||||
}));
|
||||
|
||||
vi.mock("../../../../src/web/media.js", () => ({
|
||||
resolveTextChunkLimit: () => 4000,
|
||||
chunkMarkdownText: (text: string) => (text ? [text] : []),
|
||||
loadWebMedia: vi.fn().mockResolvedValue({
|
||||
buffer: Buffer.from("media"),
|
||||
fileName: "photo.png",
|
||||
contentType: "image/png",
|
||||
kind: "image",
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("../../../../src/media/image-ops.js", () => ({
|
||||
mediaKindFromMime: () => "image",
|
||||
isVoiceCompatibleAudio: () => false,
|
||||
getImageMetadata: vi.fn().mockResolvedValue(null),
|
||||
resizeToJpeg: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -5,13 +5,17 @@ import type {
|
||||
ReactionEventContent,
|
||||
} from "matrix-js-sdk/lib/@types/events.js";
|
||||
|
||||
import { chunkMarkdownText, resolveTextChunkLimit } from "../../../../src/auto-reply/chunk.js";
|
||||
import { loadConfig } from "../../../../src/config/config.js";
|
||||
import { isVoiceCompatibleAudio } from "../../../../src/media/audio.js";
|
||||
import { mediaKindFromMime } from "../../../../src/media/constants.js";
|
||||
import { getImageMetadata, resizeToJpeg } from "../../../../src/media/image-ops.js";
|
||||
import type { PollInput } from "../../../../src/polls.js";
|
||||
import { loadWebMedia } from "../../../../src/web/media.js";
|
||||
import {
|
||||
chunkMarkdownText,
|
||||
getImageMetadata,
|
||||
isVoiceCompatibleAudio,
|
||||
loadConfig,
|
||||
loadWebMedia,
|
||||
mediaKindFromMime,
|
||||
type PollInput,
|
||||
resolveTextChunkLimit,
|
||||
resizeToJpeg,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import { getActiveMatrixClient } from "./active-client.js";
|
||||
import {
|
||||
createMatrixClient,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { addWildcardAllowFrom } from "../../../src/channels/plugins/onboarding/helpers.js";
|
||||
import type {
|
||||
ChannelOnboardingAdapter,
|
||||
ChannelOnboardingDmPolicy,
|
||||
} from "../../../src/channels/plugins/onboarding-types.js";
|
||||
import { promptChannelAccessConfig } from "../../../src/channels/plugins/onboarding/channel-access.js";
|
||||
import { formatDocsLink } from "../../../src/terminal/links.js";
|
||||
import type { WizardPrompter } from "../../../src/wizard/prompts.js";
|
||||
import {
|
||||
addWildcardAllowFrom,
|
||||
formatDocsLink,
|
||||
promptChannelAccessConfig,
|
||||
type ChannelOnboardingAdapter,
|
||||
type ChannelOnboardingDmPolicy,
|
||||
type WizardPrompter,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import { listMatrixDirectoryGroupsLive } from "./directory-live.js";
|
||||
import { resolveMatrixAccount } from "./matrix/accounts.js";
|
||||
import { ensureMatrixSdkInstalled, isMatrixSdkAvailable } from "./matrix/deps.js";
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { chunkMarkdownText } from "../../../src/auto-reply/chunk.js";
|
||||
import type { ChannelOutboundAdapter } from "../../../src/channels/plugins/types.js";
|
||||
import type { ChannelOutboundAdapter } from "clawdbot/plugin-sdk";
|
||||
|
||||
import { getMatrixRuntime } from "./runtime.js";
|
||||
import { sendMessageMatrix, sendPollMatrix } from "./matrix/send.js";
|
||||
|
||||
export const matrixOutbound: ChannelOutboundAdapter = {
|
||||
deliveryMode: "direct",
|
||||
chunker: chunkMarkdownText,
|
||||
chunker: (text, limit) => getMatrixRuntime().channel.text.chunkMarkdownText(text, limit),
|
||||
textChunkLimit: 4000,
|
||||
sendText: async ({ to, text, deps, replyToId, threadId }) => {
|
||||
const send = deps?.sendMatrix ?? sendMessageMatrix;
|
||||
|
||||
@@ -2,8 +2,8 @@ import type {
|
||||
ChannelDirectoryEntry,
|
||||
ChannelResolveKind,
|
||||
ChannelResolveResult,
|
||||
} from "../../../src/channels/plugins/types.js";
|
||||
import type { RuntimeEnv } from "../../../src/runtime.js";
|
||||
RuntimeEnv,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
import {
|
||||
listMatrixDirectoryGroupsLive,
|
||||
|
||||
14
extensions/matrix/src/runtime.ts
Normal file
14
extensions/matrix/src/runtime.ts
Normal 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;
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
readNumberParam,
|
||||
readReactionParams,
|
||||
readStringParam,
|
||||
} from "../../../src/agents/tools/common.js";
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
const messageActions = new Set(["sendMessage", "editMessage", "deleteMessage", "readMessages"]);
|
||||
const reactionActions = new Set(["react", "reactions"]);
|
||||
|
||||
@@ -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 { registerMemoryCli } from "../../src/cli/memory-cli.js";
|
||||
import {
|
||||
createMemoryGetTool,
|
||||
createMemorySearchTool,
|
||||
registerMemoryCli,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
const memoryCorePlugin = {
|
||||
id: "memory-core",
|
||||
|
||||
BIN
extensions/msteams/.DS_Store
vendored
Normal file
BIN
extensions/msteams/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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";
|
||||
|
||||
|
||||
1
extensions/msteams/node_modules/@microsoft/agents-hosting
generated
vendored
Symbolic link
1
extensions/msteams/node_modules/@microsoft/agents-hosting
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../node_modules/.pnpm/@microsoft+agents-hosting@1.1.1/node_modules/@microsoft/agents-hosting
|
||||
1
extensions/msteams/node_modules/@microsoft/agents-hosting-express
generated
vendored
Symbolic link
1
extensions/msteams/node_modules/@microsoft/agents-hosting-express
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../node_modules/.pnpm/@microsoft+agents-hosting-express@1.1.1/node_modules/@microsoft/agents-hosting-express
|
||||
1
extensions/msteams/node_modules/@microsoft/agents-hosting-extensions-teams
generated
vendored
Symbolic link
1
extensions/msteams/node_modules/@microsoft/agents-hosting-extensions-teams
generated
vendored
Symbolic link
@@ -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
1
extensions/msteams/node_modules/express
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../node_modules/.pnpm/express@5.2.1/node_modules/express
|
||||
1
extensions/msteams/node_modules/proper-lockfile
generated
vendored
Symbolic link
1
extensions/msteams/node_modules/proper-lockfile
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile
|
||||
@@ -6,19 +6,8 @@ const saveMediaBufferMock = vi.fn(async () => ({
|
||||
contentType: "image/png",
|
||||
}));
|
||||
|
||||
const modulePaths = vi.hoisted(() => {
|
||||
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, () => ({
|
||||
vi.mock("clawdbot/plugin-sdk", () => ({
|
||||
detectMime: (...args: unknown[]) => detectMimeMock(...args),
|
||||
}));
|
||||
|
||||
vi.mock(modulePaths.storeModulePath, () => ({
|
||||
saveMediaBuffer: (...args: unknown[]) => saveMediaBufferMock(...args),
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { detectMime } from "../../../../src/media/mime.js";
|
||||
import { saveMediaBuffer } from "../../../../src/media/store.js";
|
||||
import { detectMime, saveMediaBuffer } from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
extractInlineImageCandidates,
|
||||
inferPlaceholder,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { detectMime } from "../../../../src/media/mime.js";
|
||||
import { saveMediaBuffer } from "../../../../src/media/store.js";
|
||||
import { detectMime, saveMediaBuffer } from "clawdbot/plugin-sdk";
|
||||
import { downloadMSTeamsImageAttachments } from "./download.js";
|
||||
import { GRAPH_ROOT, isRecord, normalizeContentType, resolveAllowedHosts } from "./shared.js";
|
||||
import type {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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";
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { ClawdbotConfig } from "../../../src/config/config.js";
|
||||
import { MSTeamsConfigSchema } from "../../../src/config/zod-schema.providers-core.js";
|
||||
import { buildChannelConfigSchema } from "../../../src/channels/plugins/config-schema.js";
|
||||
import { PAIRING_APPROVED_MESSAGE } from "../../../src/channels/plugins/pairing-message.js";
|
||||
import type { ChannelMessageActionName, ChannelPlugin } from "../../../src/channels/plugins/types.js";
|
||||
import { DEFAULT_ACCOUNT_ID } from "../../../src/routing/session-key.js";
|
||||
import type { ChannelMessageActionName, ChannelPlugin, ClawdbotConfig } from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
buildChannelConfigSchema,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
MSTeamsConfigSchema,
|
||||
PAIRING_APPROVED_MESSAGE,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
import { msteamsOnboardingAdapter } from "./onboarding.js";
|
||||
import { msteamsOutbound } from "./outbound.js";
|
||||
|
||||
@@ -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 { loadMSTeamsSdkWithAuth } from "./sdk.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 MSTeamsAdapter,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { chunkMarkdownText } from "../../../src/auto-reply/chunk.js";
|
||||
import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../../../src/auto-reply/tokens.js";
|
||||
import type { ReplyPayload } from "../../../src/auto-reply/types.js";
|
||||
import type { MSTeamsReplyStyle } from "../../../src/config/types.js";
|
||||
import {
|
||||
chunkMarkdownText,
|
||||
isSilentReplyText,
|
||||
type MSTeamsReplyStyle,
|
||||
type ReplyPayload,
|
||||
SILENT_REPLY_TOKEN,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import type { StoredConversationReference } from "./conversation-store.js";
|
||||
import { classifyMSTeamsSendError } from "./errors.js";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { ClawdbotConfig } from "../../../src/config/types.js";
|
||||
import { danger } from "../../../src/globals.js";
|
||||
import type { RuntimeEnv } from "../../../src/runtime.js";
|
||||
import type { ClawdbotConfig, RuntimeEnv } from "clawdbot/plugin-sdk";
|
||||
import { danger } from "clawdbot/plugin-sdk";
|
||||
import type { MSTeamsConversationStore } from "./conversation-store.js";
|
||||
import type { MSTeamsAdapter } from "./messenger.js";
|
||||
import { createMSTeamsMessageHandler } from "./monitor-handler/message-handler.js";
|
||||
|
||||
@@ -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 {
|
||||
buildPendingHistoryContextFromMap,
|
||||
clearHistoryEntries,
|
||||
createInboundDebouncer,
|
||||
danger,
|
||||
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,
|
||||
recordSessionMetaFromInbound,
|
||||
recordPendingHistoryEntry,
|
||||
resolveAgentRoute,
|
||||
resolveCommandAuthorizedFromAuthorizers,
|
||||
resolveInboundDebounceMs,
|
||||
resolveMentionGating,
|
||||
resolveStorePath,
|
||||
dispatchReplyFromConfig,
|
||||
finalizeInboundContext,
|
||||
formatAgentEnvelope,
|
||||
formatAllowlistMatchMeta,
|
||||
hasControlCommand,
|
||||
logVerbose,
|
||||
shouldLogVerbose,
|
||||
upsertChannelPairingRequest,
|
||||
} from "../../../../src/pairing/pairing-store.js";
|
||||
import { resolveAgentRoute } from "../../../../src/routing/resolve-route.js";
|
||||
type HistoryEntry,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
import {
|
||||
buildMSTeamsAttachmentPlaceholder,
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import type { Request, Response } from "express";
|
||||
import { resolveTextChunkLimit } from "../../../src/auto-reply/chunk.js";
|
||||
import { mergeAllowlist, summarizeMapping } from "../../../src/channels/allowlists/resolve-utils.js";
|
||||
import type { ClawdbotConfig } from "../../../src/config/types.js";
|
||||
import { getChildLogger } from "../../../src/logging.js";
|
||||
import type { RuntimeEnv } from "../../../src/runtime.js";
|
||||
import {
|
||||
getChildLogger,
|
||||
mergeAllowlist,
|
||||
resolveTextChunkLimit,
|
||||
summarizeMapping,
|
||||
type ClawdbotConfig,
|
||||
type RuntimeEnv,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import type { MSTeamsConversationStore } from "./conversation-store.js";
|
||||
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
|
||||
import { formatUnknownError } from "./errors.js";
|
||||
|
||||
@@ -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 {
|
||||
ChannelOnboardingAdapter,
|
||||
ChannelOnboardingDmPolicy,
|
||||
} from "../../../src/channels/plugins/onboarding-types.js";
|
||||
import { promptChannelAccessConfig } from "../../../src/channels/plugins/onboarding/channel-access.js";
|
||||
import { addWildcardAllowFrom } from "../../../src/channels/plugins/onboarding/helpers.js";
|
||||
ClawdbotConfig,
|
||||
DmPolicy,
|
||||
WizardPrompter,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
addWildcardAllowFrom,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
formatDocsLink,
|
||||
promptChannelAccessConfig,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
import { resolveMSTeamsCredentials } from "./token.js";
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { chunkMarkdownText } from "../../../src/auto-reply/chunk.js";
|
||||
import type { ChannelOutboundAdapter } from "../../../src/channels/plugins/types.js";
|
||||
import { chunkMarkdownText, type ChannelOutboundAdapter } from "clawdbot/plugin-sdk";
|
||||
|
||||
import { createMSTeamsPollStoreFs } from "./polls.js";
|
||||
import { sendMessageMSTeams, sendPollMSTeams } from "./send.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { MSTeamsConfig } from "../../../src/config/types.js";
|
||||
import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
isMSTeamsGroupAllowed,
|
||||
resolveMSTeamsReplyPolicy,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type {
|
||||
AllowlistMatch,
|
||||
GroupPolicy,
|
||||
MSTeamsChannelConfig,
|
||||
MSTeamsConfig,
|
||||
MSTeamsReplyStyle,
|
||||
MSTeamsTeamConfig,
|
||||
} from "../../../src/config/types.js";
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
buildChannelKeyCandidates,
|
||||
normalizeChannelSlug,
|
||||
resolveChannelEntryMatchWithFallback,
|
||||
resolveNestedAllowlistDecision,
|
||||
} from "../../../src/channels/plugins/channel-config.js";
|
||||
import type { AllowlistMatch } from "../../../src/channels/plugins/allowlist-match.js";
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
export type MSTeamsResolvedRouteConfig = {
|
||||
teamConfig?: MSTeamsTeamConfig;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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(() => ({
|
||||
tokenError: null as Error | null,
|
||||
|
||||
@@ -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 { loadMSTeamsSdkWithAuth } from "./sdk.js";
|
||||
import { resolveMSTeamsCredentials } from "./token.js";
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { resolveEffectiveMessagesConfig, resolveHumanDelayConfig } from "../../../src/agents/identity.js";
|
||||
import { createReplyDispatcherWithTyping } from "../../../src/auto-reply/reply/reply-dispatcher.js";
|
||||
import type { ClawdbotConfig, MSTeamsReplyStyle } from "../../../src/config/types.js";
|
||||
import { danger } from "../../../src/globals.js";
|
||||
import type { RuntimeEnv } from "../../../src/runtime.js";
|
||||
import {
|
||||
createReplyDispatcherWithTyping,
|
||||
danger,
|
||||
resolveEffectiveMessagesConfig,
|
||||
resolveHumanDelayConfig,
|
||||
type ClawdbotConfig,
|
||||
type MSTeamsReplyStyle,
|
||||
type RuntimeEnv,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import type { StoredConversationReference } from "./conversation-store.js";
|
||||
import {
|
||||
classifyMSTeamsSendError,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ClawdbotConfig } from "../../../src/config/types.js";
|
||||
import type { getChildLogger as getChildLoggerFn } from "../../../src/logging.js";
|
||||
import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
|
||||
import type { getChildLogger as getChildLoggerFn } from "clawdbot/plugin-sdk";
|
||||
import type {
|
||||
MSTeamsConversationStore,
|
||||
StoredConversationReference,
|
||||
|
||||
@@ -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 { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { resolveStateDir } from "../../../src/config/paths.js";
|
||||
import { resolveStateDir } from "clawdbot/plugin-sdk";
|
||||
|
||||
export type MSTeamsStorePathOptions = {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MSTeamsConfig } from "../../../src/config/types.js";
|
||||
import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
|
||||
|
||||
export type MSTeamsCredentials = {
|
||||
appId: string;
|
||||
|
||||
BIN
extensions/voice-call/.DS_Store
vendored
Normal file
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
1
extensions/voice-call/node_modules/@sinclair/typebox
generated
vendored
Symbolic link
@@ -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
1
extensions/voice-call/node_modules/ws
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws
|
||||
1
extensions/voice-call/node_modules/zod
generated
vendored
Symbolic link
1
extensions/voice-call/node_modules/zod
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../node_modules/.pnpm/zod@4.3.5/node_modules/zod
|
||||
BIN
extensions/zalo/.DS_Store
vendored
Normal file
BIN
extensions/zalo/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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 { handleZaloWebhookRequest } from "./src/monitor.js";
|
||||
|
||||
1
extensions/zalo/node_modules/undici
generated
vendored
Symbolic link
1
extensions/zalo/node_modules/undici
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../node_modules/.pnpm/undici@7.18.2/node_modules/undici
|
||||
@@ -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 { listEnabledZaloAccounts } from "./accounts.js";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { ChannelAccountSnapshot } from "../../../src/channels/plugins/types.js";
|
||||
import type { ChannelDock, ChannelPlugin } from "../../../src/channels/plugins/types.js";
|
||||
import { buildChannelConfigSchema } from "../../../src/channels/plugins/config-schema.js";
|
||||
import type { ChannelAccountSnapshot, ChannelDock, ChannelPlugin } from "clawdbot/plugin-sdk";
|
||||
import { buildChannelConfigSchema } from "clawdbot/plugin-sdk";
|
||||
|
||||
import { listZaloAccountIds, resolveDefaultZaloAccountId, resolveZaloAccount, type ResolvedZaloAccount } from "./accounts.js";
|
||||
import { zaloMessageActions } from "./actions.js";
|
||||
|
||||
@@ -2,12 +2,13 @@ import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
|
||||
import type { ResolvedZaloAccount } from "./accounts.js";
|
||||
import {
|
||||
finalizeInboundContext,
|
||||
isControlCommandMessage,
|
||||
recordSessionMetaFromInbound,
|
||||
resolveCommandAuthorizedFromAuthorizers,
|
||||
resolveStorePath,
|
||||
shouldComputeCommandAuthorized,
|
||||
} from "../../../src/auto-reply/command-detection.js";
|
||||
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";
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
ZaloApiError,
|
||||
deleteWebhook,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { ChannelOnboardingAdapter, ChannelOnboardingDmPolicy } from "../../src/channels/plugins/onboarding-types.js";
|
||||
import type { WizardPrompter } from "../../src/wizard/prompts.js";
|
||||
import type {
|
||||
ChannelOnboardingAdapter,
|
||||
ChannelOnboardingDmPolicy,
|
||||
WizardPrompter,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
|
||||
import { addWildcardAllowFrom, promptAccountId } from "./shared/onboarding.js";
|
||||
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "./shared/account-ids.js";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "../../src/channels/plugins/types.js";
|
||||
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "clawdbot/plugin-sdk";
|
||||
|
||||
type ZaloAccountStatus = {
|
||||
accountId?: unknown;
|
||||
|
||||
BIN
extensions/zalouser/.DS_Store
vendored
Normal file
BIN
extensions/zalouser/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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 { ZalouserToolSchema, executeZalouserTool } from "./src/tool.js";
|
||||
|
||||
1
extensions/zalouser/node_modules/@sinclair/typebox
generated
vendored
Symbolic link
1
extensions/zalouser/node_modules/@sinclair/typebox
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../node_modules/.pnpm/@sinclair+typebox@0.34.47/node_modules/@sinclair/typebox
|
||||
@@ -1,10 +1,6 @@
|
||||
import type { ChannelPlugin } from "../../../src/channels/plugins/types.plugin.js";
|
||||
import type {
|
||||
ChannelAccountSnapshot,
|
||||
ChannelDirectoryEntry,
|
||||
} from "../../../src/channels/plugins/types.core.js";
|
||||
import type { ChannelAccountSnapshot, ChannelDirectoryEntry, ChannelPlugin } from "clawdbot/plugin-sdk";
|
||||
|
||||
import { formatPairingApproveHint } from "../../../src/channels/plugins/helpers.js";
|
||||
import { formatPairingApproveHint } from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
listZalouserAccountIds,
|
||||
resolveDefaultZalouserAccountId,
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import type { ChildProcess } from "node:child_process";
|
||||
|
||||
import type { RuntimeEnv } from "../../../src/runtime.js";
|
||||
import type { RuntimeEnv } from "clawdbot/plugin-sdk";
|
||||
import {
|
||||
finalizeInboundContext,
|
||||
isControlCommandMessage,
|
||||
mergeAllowlist,
|
||||
recordSessionMetaFromInbound,
|
||||
resolveCommandAuthorizedFromAuthorizers,
|
||||
resolveStorePath,
|
||||
shouldComputeCommandAuthorized,
|
||||
} from "../../../src/auto-reply/command-detection.js";
|
||||
import { mergeAllowlist, summarizeMapping } from "../../../src/channels/allowlists/resolve-utils.js";
|
||||
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";
|
||||
summarizeMapping,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import { loadCoreChannelDeps, type CoreChannelDeps } from "./core-bridge.js";
|
||||
import { sendMessageZalouser } from "./send.js";
|
||||
import type {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import type { ChannelOnboardingAdapter, ChannelOnboardingDmPolicy } from "../../../src/channels/plugins/onboarding-types.js";
|
||||
import type { WizardPrompter } from "../../../src/wizard/prompts.js";
|
||||
import { promptChannelAccessConfig } from "../../../src/channels/plugins/onboarding/channel-access.js";
|
||||
import type {
|
||||
ChannelOnboardingAdapter,
|
||||
ChannelOnboardingDmPolicy,
|
||||
WizardPrompter,
|
||||
} from "clawdbot/plugin-sdk";
|
||||
import { promptChannelAccessConfig } from "clawdbot/plugin-sdk";
|
||||
|
||||
import {
|
||||
listZalouserAccountIds,
|
||||
|
||||
BIN
src/.DS_Store
vendored
Normal file
BIN
src/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/agents/.DS_Store
vendored
Normal file
BIN
src/agents/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/channels/.DS_Store
vendored
Normal file
BIN
src/channels/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/cli/.DS_Store
vendored
Normal file
BIN
src/cli/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/commands/.DS_Store
vendored
Normal file
BIN
src/commands/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/cron/.DS_Store
vendored
Normal file
BIN
src/cron/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/gateway/.DS_Store
vendored
Normal file
BIN
src/gateway/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/infra/.DS_Store
vendored
Normal file
BIN
src/infra/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -53,6 +53,76 @@ export type {
|
||||
ChannelToolSend,
|
||||
} from "../channels/plugins/types.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 {
|
||||
@@ -63,7 +133,10 @@ export { applyAccountNameToChannelSection } from "../channels/plugins/setup-help
|
||||
export { formatPairingApproveHint } from "../channels/plugins/helpers.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 { promptChannelAccessConfig } from "../channels/plugins/onboarding/channel-access.js";
|
||||
|
||||
@@ -74,5 +147,7 @@ export {
|
||||
readReactionParams,
|
||||
readStringParam,
|
||||
} 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";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createJiti } from "jiti";
|
||||
|
||||
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: {
|
||||
workspaceDir?: string;
|
||||
plugins: NormalizedPluginsConfig;
|
||||
@@ -289,8 +310,10 @@ export function loadClawdbotPlugins(options: PluginLoadOptions = {}): PluginRegi
|
||||
});
|
||||
pushDiagnostics(registry.diagnostics, discovery.diagnostics);
|
||||
|
||||
const pluginSdkAlias = resolvePluginSdkAlias();
|
||||
const jiti = createJiti(import.meta.url, {
|
||||
interopDefault: true,
|
||||
...(pluginSdkAlias ? { alias: { "clawdbot/plugin-sdk": pluginSdkAlias } } : {}),
|
||||
});
|
||||
|
||||
const seenIds = new Map<string, PluginRecord["origin"]>();
|
||||
|
||||
@@ -6,6 +6,7 @@ import { createInboundDebouncer, resolveInboundDebounceMs } from "../../auto-rep
|
||||
import { buildMentionRegexes, matchesMentionPatterns } from "../../auto-reply/reply/mentions.js";
|
||||
import { dispatchReplyWithBufferedBlockDispatcher } from "../../auto-reply/reply/provider-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 { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "../../config/group-policy.js";
|
||||
import { resolveStateDir } from "../../config/paths.js";
|
||||
@@ -46,6 +47,8 @@ export function createPluginRuntime(): PluginRuntime {
|
||||
reply: {
|
||||
dispatchReplyWithBufferedBlockDispatcher,
|
||||
createReplyDispatcherWithTyping,
|
||||
resolveEffectiveMessagesConfig,
|
||||
resolveHumanDelayConfig,
|
||||
},
|
||||
routing: {
|
||||
resolveAgentRoute,
|
||||
|
||||
@@ -25,6 +25,15 @@ export type PluginRuntime = {
|
||||
};
|
||||
}) => Promise<void>;
|
||||
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: {
|
||||
resolveAgentRoute: (params: {
|
||||
|
||||
BIN
src/tui/.DS_Store
vendored
Normal file
BIN
src/tui/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
src/web/.DS_Store
vendored
Normal file
BIN
src/web/.DS_Store
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user