openclaw/extensions/slack/src/monitor/room-context.ts
scoootscooob 8746362f5e
refactor(slack): move Slack channel code to extensions/slack/src/ (#45621)
Move all Slack channel implementation files from src/slack/ to
extensions/slack/src/ and replace originals with shim re-exports.
This follows the extension migration pattern for channel plugins.

- Copy all .ts files to extensions/slack/src/ (preserving directory
  structure: monitor/, http/, monitor/events/, monitor/message-handler/)
- Transform import paths: external src/ imports use relative paths
  back to src/, internal slack imports stay relative within extension
- Replace all src/slack/ files with shim re-exports pointing to
  the extension copies
- Update tsconfig.plugin-sdk.dts.json rootDir from "src" to "." so
  the DTS build can follow shim chains into extensions/
- Update write-plugin-sdk-entry-dts.ts re-export path accordingly
- Preserve extensions/slack/index.ts, package.json, openclaw.plugin.json,
  src/channel.ts, src/runtime.ts, src/channel.test.ts (untouched)
2026-03-14 02:47:04 -07:00

32 lines
978 B
TypeScript

import { buildUntrustedChannelMetadata } from "../../../../src/security/channel-metadata.js";
export function resolveSlackRoomContextHints(params: {
isRoomish: boolean;
channelInfo?: { topic?: string; purpose?: string };
channelConfig?: { systemPrompt?: string | null } | null;
}): {
untrustedChannelMetadata?: ReturnType<typeof buildUntrustedChannelMetadata>;
groupSystemPrompt?: string;
} {
if (!params.isRoomish) {
return {};
}
const untrustedChannelMetadata = buildUntrustedChannelMetadata({
source: "slack",
label: "Slack channel description",
entries: [params.channelInfo?.topic, params.channelInfo?.purpose],
});
const systemPromptParts = [params.channelConfig?.systemPrompt?.trim() || null].filter(
(entry): entry is string => Boolean(entry),
);
const groupSystemPrompt =
systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : undefined;
return {
untrustedChannelMetadata,
groupSystemPrompt,
};
}