@openclaw/slack 2026.9.1-beta.1 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-CN2hBsim.js → account-inspect-C3sePHWa.js} +3 -3
- package/dist/account-inspect-api.js +1 -1
- package/dist/{action-runtime-BoSeX09X.js → action-runtime-DND4Pyp2.js} +84 -66
- package/dist/action-runtime.runtime-CEhbmS-Z.js +2 -0
- package/dist/{actions-XdQyjG_p.js → actions-fh66A6lc.js} +198 -54
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-DxXfGX_Z.js → approval-handler.runtime-D7d8sKM0.js} +18 -12
- package/dist/{channel-C_vnTgxo.js → channel-4m8IAdMD.js} +70 -128
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-j-2lalcC.js → channel-type-3-SqEMVc.js} +2 -2
- package/dist/{channel.setup-aal8tokM.js → channel.setup-t_ghLGb_.js} +23 -22
- package/dist/{config-schema-CN3XZRX5.js → config-schema-bP3eV2ra.js} +25 -16
- package/dist/{conversation-binding-route-DFVLUdYF.js → conversation-binding-route-Vee8Dgbf.js} +2 -2
- package/dist/{cursor-pages-eX7p8Wwt.js → cursor-pages-ByFwo-Py.js} +7 -1
- package/dist/{directory-config-DqfQ42OV.js → directory-config-Bmw4ykSy.js} +4 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-lC6X_Ru-.js → directory-live-q32AW7N1.js} +3 -8
- package/dist/{doctor-contract-BAy7-EUQ.js → doctor-contract-BNjw9bxb.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-CU1tEGpS.js → group-policy-BKjMqT-8.js} +161 -260
- package/dist/{message-tool-api-CWosHSi5.js → message-tool-api-uNEfQYGY.js} +19 -2
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-DrNCGneD.js → monitor-Chwu_SiZ.js} +3 -3
- package/dist/{outbound-adapter-DkT2vUE9.js → outbound-adapter-BB8wAjm5.js} +95 -91
- package/dist/{pipeline.runtime-CRRng_Nw.js → pipeline.runtime-BklS_NEj.js} +347 -505
- package/dist/{policy-BoP6t88v.js → policy-D7PKkiet.js} +7 -4
- package/dist/{probe-4_aHtVT3.js → probe-gj5yQgN2.js} +210 -3
- package/dist/{provider-D4nDgxCh.js → provider-Do50wMWn.js} +168 -153
- package/dist/{relay-source-CEmze11m.js → relay-source-DWuduiJ2.js} +6 -4
- package/dist/{replies-D9XMM_S0.js → replies-Dc6WVh_Q.js} +20 -16
- package/dist/{resolve-channels-DSamDgVs.js → resolve-channels-CU7Bg5Ka.js} +6 -10
- package/dist/{resolve-users-CIzwbaJR.js → resolve-users-DrhttvRQ.js} +5 -4
- package/dist/runtime-api.js +10 -10
- package/dist/{scopes-BBrUzpBH.js → scopes-B9HRguDe.js} +1 -1
- package/dist/{send-DtjEnlLh.js → send-Djswy6lf.js} +24 -16
- package/dist/send-results-eeOu_HYm.js +23 -0
- package/dist/{send.runtime-DQeNKa2J.js → send.runtime-__WVTWLQ.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-CsBCM4rP.js → setup-surface-DO0e-MMS.js} +5 -5
- package/dist/{shared-D9GeeR9K.js → shared-DEQBEKBL.js} +7 -5
- package/dist/{slash-dispatch.runtime-Chr3YHnT.js → slash-dispatch.runtime-C3B4h5ZM.js} +2 -2
- package/dist/{target-parsing-BnMD2ZqZ.js → target-parsing-PbxGDbr9.js} +11 -6
- package/dist/{targets-Cx5W_n3W.js → targets-7FexXJ62.js} +1 -1
- package/dist/{thread-ts-DUGhaYKq.js → thread-ts-CukseRVL.js} +5 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/package.json +16 -10
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +15 -7
- package/package.json +5 -5
- package/dist/action-runtime.runtime-Dpa16J87.js +0 -2
- package/dist/slack-client-kind-hSfjXyUM.js +0 -94
- package/node_modules/@slack/bolt/node_modules/negotiator/HISTORY.md +0 -114
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as formatUnknownError, m as SLACK_SOCKET_RECONNECT_POLICY } from "./provider-
|
|
1
|
+
import { h as formatUnknownError, m as SLACK_SOCKET_RECONNECT_POLICY } from "./provider-Do50wMWn.js";
|
|
2
2
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { computeBackoff, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
4
4
|
import { isIP } from "node:net";
|
|
@@ -10,7 +10,7 @@ const SLACK_RELAY_ROUTE_KINDS = /* @__PURE__ */ new Set([
|
|
|
10
10
|
"thread_affinity",
|
|
11
11
|
"channel_default"
|
|
12
12
|
]);
|
|
13
|
-
const SLACK_RELAY_MAX_PAYLOAD_BYTES =
|
|
13
|
+
const SLACK_RELAY_MAX_PAYLOAD_BYTES = 1048576;
|
|
14
14
|
async function monitorSlackRelaySource(params) {
|
|
15
15
|
let reconnectAttempts = 0;
|
|
16
16
|
while (!params.abortSignal?.aborted) {
|
|
@@ -56,7 +56,8 @@ async function monitorSlackRelaySource(params) {
|
|
|
56
56
|
function openRelayWebSocket(config, abortSignal) {
|
|
57
57
|
if (abortSignal?.aborted) return Promise.reject(/* @__PURE__ */ new Error("Slack relay websocket aborted before connect"));
|
|
58
58
|
return new Promise((resolve, reject) => {
|
|
59
|
-
const
|
|
59
|
+
const url = buildRelayWebSocketUrl(config);
|
|
60
|
+
const ws = new WebSocket(url, buildRelayWebSocketOptions(config.authToken));
|
|
60
61
|
const cleanup = () => {
|
|
61
62
|
ws.off("open", onOpen);
|
|
62
63
|
ws.off("error", onError);
|
|
@@ -210,7 +211,8 @@ function extractRelaySlackMessageEvent(frame) {
|
|
|
210
211
|
const routeRecord = asOptionalRecord(record.route);
|
|
211
212
|
const routeKind = stringValue(routeRecord?.kind);
|
|
212
213
|
const routeKey = stringValue(routeRecord?.key);
|
|
213
|
-
const
|
|
214
|
+
const payload = asOptionalRecord(record.payload);
|
|
215
|
+
const event = asOptionalRecord(payload?.event);
|
|
214
216
|
if (event?.type !== "message" || typeof event.channel !== "string") return;
|
|
215
217
|
if (!deliveryId || !routeKind || !SLACK_RELAY_ROUTE_KINDS.has(routeKind) || !routeKey) return;
|
|
216
218
|
return {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { C as isSlackNativeResponseUrlRejection, M as SLACK_TEXT_LIMIT, S as isSlackInvalidBlocksResponse, T as buildSlackBlocksFallbackText, Z as markdownToSlackMrkdwnChunks, b as hasSlackNativeDataBlock, d as resolveSlackReplyBlockResolution, f as resolveSlackReplyBlocks, l as hasSlackReplyStructuredContent, v as buildSlackNativeDataAccessibilityText } from "./group-policy-BKjMqT-8.js";
|
|
2
|
+
import { n as resolveSlackReplyThreadTs } from "./thread-ts-CukseRVL.js";
|
|
3
|
+
import { h as chunkSlackTextAtHardLimit, m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-Djswy6lf.js";
|
|
4
|
+
import { a as createSlackResponseUrlBudget, i as SlackResponseAlreadyReportedError } from "./provider-Do50wMWn.js";
|
|
4
5
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
6
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
6
7
|
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
|
|
8
|
+
import { deliverTextOrMediaReply, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
7
9
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
8
10
|
import { SILENT_REPLY_TOKEN, chunkMarkdownTextWithMode, isSilentReplyText } from "openclaw/plugin-sdk/reply-chunking";
|
|
9
|
-
import { deliverTextOrMediaReply, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
10
11
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
11
12
|
import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
12
13
|
import { buildCanonicalSentMessageHookContext, createInternalHookEvent, fireAndForgetHook, toInternalMessageSentContext, toPluginMessageContext, toPluginMessageSentEvent, triggerInternalHook } from "openclaw/plugin-sdk/hook-runtime";
|
|
@@ -127,21 +128,20 @@ function sanitizeSlackMonitorReplyPayload(payload) {
|
|
|
127
128
|
function resolveSlackMediaHookSpokenText(payload) {
|
|
128
129
|
return (getReplyPayloadTtsSupplement(payload)?.spokenText ?? payload.spokenText)?.trim() || void 0;
|
|
129
130
|
}
|
|
130
|
-
function resolveDeliveredSlackReplyThreadTs(params) {
|
|
131
|
-
return (params.replyToMode === "off" ? void 0 : params.payloadReplyToId) ?? params.replyThreadTs;
|
|
132
|
-
}
|
|
133
131
|
async function deliverReplies(params) {
|
|
134
132
|
let latestResult;
|
|
135
133
|
for (const payload of params.replies) {
|
|
136
134
|
if (payload.isReasoning === true) continue;
|
|
137
|
-
const threadTs =
|
|
135
|
+
const threadTs = resolveSlackReplyThreadTs({
|
|
138
136
|
replyToMode: params.replyToMode,
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
replyToId: payload.replyToId,
|
|
138
|
+
threadId: params.replyThreadTs,
|
|
139
|
+
replyToCurrent: payload.replyToCurrent
|
|
141
140
|
});
|
|
142
141
|
const reply = resolveSendableOutboundReplyParts(payload);
|
|
143
142
|
const textRaw = reply.hasText && !isSilentReplyText(reply.trimmedText, SILENT_REPLY_TOKEN) ? reply.trimmedText : void 0;
|
|
144
|
-
const
|
|
143
|
+
const materializeAuthoredText = !reply.hasMedia && hasSlackReplyStructuredContent(payload);
|
|
144
|
+
const { authoredTextPlacement, segments } = resolveSlackReplyBlockResolution(payload, { materializeAuthoredText });
|
|
145
145
|
if (!textRaw && !reply.hasMedia && segments.length === 0) continue;
|
|
146
146
|
const acceptedResults = [];
|
|
147
147
|
const sendReply = async (input) => {
|
|
@@ -297,8 +297,9 @@ function resolveSlackThreadTs(params) {
|
|
|
297
297
|
}).use();
|
|
298
298
|
}
|
|
299
299
|
function createSlackReplyReferencePlanner(params) {
|
|
300
|
+
const effectiveMode = params.isThreadReply ?? Boolean(params.incomingThreadTs && params.incomingThreadTs !== params.messageTs) ? "all" : params.replyToMode;
|
|
300
301
|
return createReplyReferencePlanner({
|
|
301
|
-
replyToMode:
|
|
302
|
+
replyToMode: effectiveMode,
|
|
302
303
|
existingId: params.incomingThreadTs,
|
|
303
304
|
startId: params.messageTs,
|
|
304
305
|
hasReplied: params.hasReplied
|
|
@@ -345,7 +346,8 @@ async function deliverSlackSlashReplies(params) {
|
|
|
345
346
|
if (payload.isReasoning === true) continue;
|
|
346
347
|
const reply = resolveSendableOutboundReplyParts(payload);
|
|
347
348
|
const textRaw = reply.hasText && !isSilentReplyText(reply.trimmedText, SILENT_REPLY_TOKEN) ? reply.trimmedText : void 0;
|
|
348
|
-
const
|
|
349
|
+
const materializeAuthoredText = hasSlackReplyStructuredContent(payload);
|
|
350
|
+
const { authoredTextPlacement, segments } = resolveSlackReplyBlockResolution(payload, { materializeAuthoredText });
|
|
349
351
|
let outsideText = authoredTextPlacement === "outside-blocks" ? textRaw ?? "" : "";
|
|
350
352
|
const messages = [];
|
|
351
353
|
const hookParts = [];
|
|
@@ -457,7 +459,8 @@ async function deliverSlackSlashReplies(params) {
|
|
|
457
459
|
if (initialRemaining !== void 0 && initialMinimumCalls > initialRemaining) await failOversizedDelivery();
|
|
458
460
|
const deliverNativeFallback = async (messages, onVisible) => {
|
|
459
461
|
for (const message of messages) {
|
|
460
|
-
|
|
462
|
+
const response = await respond(message);
|
|
463
|
+
if (await isSlackInvalidBlocksResponse(response)) throw new Error("Slack rejected the native-data fallback blocks with invalid_blocks.");
|
|
461
464
|
onVisible();
|
|
462
465
|
}
|
|
463
466
|
};
|
|
@@ -484,7 +487,8 @@ async function deliverSlackSlashReplies(params) {
|
|
|
484
487
|
}
|
|
485
488
|
let rejectedNativeBlocks = false;
|
|
486
489
|
try {
|
|
487
|
-
|
|
490
|
+
const response = await respond(planned.message);
|
|
491
|
+
rejectedNativeBlocks = await isSlackInvalidBlocksResponse(response);
|
|
488
492
|
if (!rejectedNativeBlocks) markVisible();
|
|
489
493
|
} catch (error) {
|
|
490
494
|
if (!isSlackNativeResponseUrlRejection(error)) throw error;
|
|
@@ -521,4 +525,4 @@ async function deliverSlackSlashReplies(params) {
|
|
|
521
525
|
}
|
|
522
526
|
}
|
|
523
527
|
//#endregion
|
|
524
|
-
export {
|
|
528
|
+
export { resolveSlackThreadTs as a, readSlackReplyBlocks as i, deliverReplies as n, sanitizeSlackMonitorReplyPayload as o, deliverSlackSlashReplies as r, emitSlackMessageSentHooks as s, createSlackReplyDeliveryPlan as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-
|
|
3
|
-
import {
|
|
4
|
-
import { t as collectSlackCursorPages } from "./cursor-pages-
|
|
2
|
+
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
3
|
+
import { s as createSlackLookupClient } from "./probe-gj5yQgN2.js";
|
|
4
|
+
import { n as fetchSlackChannelListPage, t as collectSlackCursorPages } from "./cursor-pages-ByFwo-Py.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { resolveDirectoryAllowlistEntries } from "openclaw/plugin-sdk/directory-runtime";
|
|
7
7
|
//#region extensions/slack/src/resolve-channels.ts
|
|
@@ -39,12 +39,7 @@ function parseSlackChannelMention(raw) {
|
|
|
39
39
|
}
|
|
40
40
|
async function listSlackChannels(client) {
|
|
41
41
|
return collectSlackCursorPages({
|
|
42
|
-
fetchPage: (cursor) => client
|
|
43
|
-
types: "public_channel,private_channel",
|
|
44
|
-
exclude_archived: false,
|
|
45
|
-
limit: 1e3,
|
|
46
|
-
cursor
|
|
47
|
-
}),
|
|
42
|
+
fetchPage: (cursor) => fetchSlackChannelListPage(client, cursor),
|
|
48
43
|
collectPageItems: (res) => (res.channels ?? []).map((channel) => {
|
|
49
44
|
const id = channel.id?.trim();
|
|
50
45
|
const name = channel.name?.trim();
|
|
@@ -83,9 +78,10 @@ async function resolveSlackChannelAllowlist(params) {
|
|
|
83
78
|
let resolvedIndex = 0;
|
|
84
79
|
return workspaceResolved.map((entry) => entry ?? resolved[resolvedIndex++]);
|
|
85
80
|
}
|
|
81
|
+
const channels = await listSlackChannels(params.client ?? createSlackLookupClient(params.token));
|
|
86
82
|
const resolved = resolveDirectoryAllowlistEntries({
|
|
87
83
|
entries: lookupEntries,
|
|
88
|
-
lookup:
|
|
84
|
+
lookup: channels,
|
|
89
85
|
parseInput: parseSlackChannelMention,
|
|
90
86
|
findById: (lookup, id) => lookup.find((channel) => channel.id === id),
|
|
91
87
|
buildIdResolved: ({ input, parsed, match }) => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-
|
|
3
|
-
import {
|
|
4
|
-
import { t as collectSlackCursorPages } from "./cursor-pages-
|
|
2
|
+
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
3
|
+
import { s as createSlackLookupClient } from "./probe-gj5yQgN2.js";
|
|
4
|
+
import { t as collectSlackCursorPages } from "./cursor-pages-ByFwo-Py.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { resolveDirectoryAllowlistEntries } from "openclaw/plugin-sdk/directory-runtime";
|
|
7
7
|
//#region extensions/slack/src/resolve-users.ts
|
|
@@ -98,9 +98,10 @@ async function resolveSlackUserAllowlist(params) {
|
|
|
98
98
|
const workspaceResolved = params.entries.map(resolveWorkspaceQualifiedUser);
|
|
99
99
|
const lookupEntries = params.entries.filter((_, index) => !workspaceResolved[index]);
|
|
100
100
|
if (lookupEntries.length === 0) return workspaceResolved.filter((entry) => entry !== void 0);
|
|
101
|
+
const users = await listSlackUsers(params.client ?? createSlackLookupClient(params.token));
|
|
101
102
|
const resolved = resolveDirectoryAllowlistEntries({
|
|
102
103
|
entries: lookupEntries,
|
|
103
|
-
lookup:
|
|
104
|
+
lookup: users,
|
|
104
105
|
parseInput: parseSlackUserInput,
|
|
105
106
|
findById: (lookup, id) => lookup.find((user) => user.id === id),
|
|
106
107
|
buildIdResolved: ({ input, parsed, match }) => ({
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as registerSlackPluginHttpRoutes } from "./plugin-routes-CLp4obpN.js";
|
|
2
2
|
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, t as listEnabledSlackAccounts } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { i as resolveSlackGroupToolPolicy, r as resolveSlackGroupRequireMention } from "./group-policy-
|
|
4
|
-
import { t as probeSlack } from "./probe-
|
|
3
|
+
import { i as resolveSlackGroupToolPolicy, r as resolveSlackGroupRequireMention } from "./group-policy-BKjMqT-8.js";
|
|
4
|
+
import { t as probeSlack } from "./probe-gj5yQgN2.js";
|
|
5
5
|
import { r as setSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
6
|
-
import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, s as listSlackEmojis, u as pinSlackMessage } from "./actions-
|
|
7
|
-
import { r as sendMessageSlack } from "./send-
|
|
8
|
-
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-
|
|
9
|
-
import { t as resolveSlackUserAllowlist } from "./resolve-users-
|
|
10
|
-
import { t as monitorSlackProvider } from "./provider-
|
|
11
|
-
import { n as slackActionRuntime, t as handleSlackAction } from "./action-runtime-
|
|
12
|
-
import { n as listSlackDirectoryGroupsLive, r as listSlackDirectoryPeersLive } from "./directory-live-
|
|
13
|
-
import "./monitor-
|
|
6
|
+
import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, s as listSlackEmojis, u as pinSlackMessage } from "./actions-fh66A6lc.js";
|
|
7
|
+
import { r as sendMessageSlack } from "./send-Djswy6lf.js";
|
|
8
|
+
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-CU7Bg5Ka.js";
|
|
9
|
+
import { t as resolveSlackUserAllowlist } from "./resolve-users-DrhttvRQ.js";
|
|
10
|
+
import { t as monitorSlackProvider } from "./provider-Do50wMWn.js";
|
|
11
|
+
import { n as slackActionRuntime, t as handleSlackAction } from "./action-runtime-DND4Pyp2.js";
|
|
12
|
+
import { n as listSlackDirectoryGroupsLive, r as listSlackDirectoryPeersLive } from "./directory-live-q32AW7N1.js";
|
|
13
|
+
import "./monitor-Chwu_SiZ.js";
|
|
14
14
|
export { deleteSlackMessage, editSlackMessage, getSlackMemberInfo, handleSlackAction, listEnabledSlackAccounts, listSlackAccountIds, listSlackDirectoryGroupsLive, listSlackDirectoryPeersLive, listSlackEmojis, listSlackPins, listSlackReactions, monitorSlackProvider, pinSlackMessage, probeSlack, reactSlackMessage, readSlackMessages, registerSlackPluginHttpRoutes, removeOwnSlackReactions, removeSlackReaction, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackAppToken, resolveSlackBotToken, resolveSlackChannelAllowlist, resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, resolveSlackUserAllowlist, sendMessageSlack, sendSlackMessage, setSlackRuntime, slackActionRuntime, unpinSlackMessage };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as createSlackReadClient, o as formatSlackError } from "./probe-gj5yQgN2.js";
|
|
2
2
|
import { isRecord, normalizeOptionalString, normalizeStringEntries, sortUniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/slack/src/scopes.ts
|
|
4
4
|
function collectScopes(value, into) {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { a as resolveSlackAccount, l as resolveSlackOperationToken } from "./accounts-Dm_H77gH.js";
|
|
2
|
-
import { a as parseSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { a as parseSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-PbxGDbr9.js";
|
|
3
|
+
import { A as SLACK_MESSAGE_TEXT_HARD_LIMIT, D as renderSlackBlockFallbackText, E as buildSlackCompleteBlocksFallbackText, L as truncateSlackText, M as SLACK_TEXT_LIMIT, R as truncateSlackTextByUtf8Bytes, X as chunkSlackMrkdwnText, Z as markdownToSlackMrkdwnChunks, _ as appendSlackNativeDataPlainTextFallback, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, j as SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT, k as SLACK_EDIT_TEXT_MAX_BYTES, q as resolveSlackQuestionActionIds, st as validateSlackBlocksArray, v as buildSlackNativeDataAccessibilityText, w as stripSlackNativeDataBlocks, x as isSlackInvalidBlocksError, y as createSlackNativeDataBaseTextConsumer, z as SLACK_QUESTION_FINALIZATION_BLOCKS } from "./group-policy-BKjMqT-8.js";
|
|
4
|
+
import { c as createSlackReadClient, m as getSlackWriteClient, o as formatSlackError, u as createSlackTokenCacheKey } from "./probe-gj5yQgN2.js";
|
|
5
|
+
import { r as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-CukseRVL.js";
|
|
6
6
|
import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
7
7
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
9
9
|
import { logVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
10
10
|
import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
11
11
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
12
|
+
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
13
|
+
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
12
14
|
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
13
15
|
import { createHash, createHmac } from "node:crypto";
|
|
14
16
|
import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
|
|
15
17
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
16
18
|
import { PlatformMessageNotDispatchedError, extractErrorCode, readErrorName } from "openclaw/plugin-sdk/error-runtime";
|
|
17
19
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
18
|
-
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
19
20
|
import { chunkMarkdownTextWithMode, resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
20
|
-
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
21
21
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
22
22
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
23
23
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
@@ -135,7 +135,8 @@ function isSlackCustomizeScopeError(err) {
|
|
|
135
135
|
}
|
|
136
136
|
function isSlackCustomIdentityRejectedError(err) {
|
|
137
137
|
if (isSlackCustomizeScopeError(err)) return true;
|
|
138
|
-
const
|
|
138
|
+
const data = getSlackWebApiErrorData$1(err);
|
|
139
|
+
const code = normalizeLowercaseStringOrEmpty(normalizeOptionalString(data?.error));
|
|
139
140
|
return code === "invalid_arguments" || code === "invalid_arg_name";
|
|
140
141
|
}
|
|
141
142
|
function hasCustomIdentity$1(identity) {
|
|
@@ -422,7 +423,8 @@ async function uploadSlackFile(params) {
|
|
|
422
423
|
await release();
|
|
423
424
|
}
|
|
424
425
|
} catch (error) {
|
|
425
|
-
|
|
426
|
+
const outcome = uploadTimeoutSignal?.aborted ? "timed out" : "failed";
|
|
427
|
+
throw new PlatformMessageNotDispatchedError(`Slack external upload ${outcome} before completion dispatch`, { cause: buildSlackUploadFailureCause(error) });
|
|
426
428
|
} finally {
|
|
427
429
|
cleanupUploadTimeout();
|
|
428
430
|
}
|
|
@@ -531,7 +533,7 @@ const SLACK_DELIVERY_METADATA_PART_INDEX_KEY = "openclaw_delivery_part_index";
|
|
|
531
533
|
const SLACK_DELIVERY_METADATA_PART_COUNT_KEY = "openclaw_delivery_part_count";
|
|
532
534
|
const SLACK_DELIVERY_METADATA_SIGNATURE_KEY = "openclaw_delivery_signature";
|
|
533
535
|
const SLACK_RECONCILE_LOOKBACK_MS = 3e4;
|
|
534
|
-
const SLACK_RECONCILE_CLOCK_SKEW_MS =
|
|
536
|
+
const SLACK_RECONCILE_CLOCK_SKEW_MS = 3e5;
|
|
535
537
|
const SLACK_RECONCILE_LIMIT = 100;
|
|
536
538
|
const SLACK_RECONCILE_MAX_PAGES = 10;
|
|
537
539
|
const SLACK_ENTERPRISE_LISTENER_QUEUE_CREDENTIAL = "listener-scoped-enterprise";
|
|
@@ -600,16 +602,18 @@ function resolvePostedMessageThreadTs(response) {
|
|
|
600
602
|
return typeof threadTs === "string" ? normalizeSlackThreadTsCandidate(threadTs) : void 0;
|
|
601
603
|
}
|
|
602
604
|
async function updateMessageSlack(params) {
|
|
605
|
+
const cfg = requireRuntimeConfig(params.cfg, "Slack update");
|
|
603
606
|
const account = resolveSlackAccount({
|
|
604
|
-
cfg
|
|
607
|
+
cfg,
|
|
605
608
|
accountId: params.accountId
|
|
606
609
|
});
|
|
607
610
|
assertSlackDetachedTargetAllowed(account.accountId, params.teamId);
|
|
608
|
-
|
|
611
|
+
const token = resolveToken({
|
|
609
612
|
accountId: account.accountId,
|
|
610
613
|
fallbackToken: account.botToken,
|
|
611
614
|
fallbackSource: account.botTokenSource
|
|
612
|
-
})
|
|
615
|
+
});
|
|
616
|
+
await getSlackWriteClient(token, { teamId: params.teamId }).chat.update({
|
|
613
617
|
channel: params.channelId,
|
|
614
618
|
ts: params.messageTs,
|
|
615
619
|
text: truncateSlackTextByUtf8Bytes(params.text, SLACK_EDIT_TEXT_MAX_BYTES),
|
|
@@ -617,8 +621,9 @@ async function updateMessageSlack(params) {
|
|
|
617
621
|
});
|
|
618
622
|
}
|
|
619
623
|
function createSlackSendReceipt(params) {
|
|
624
|
+
const platformMessageIds = params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown");
|
|
620
625
|
return createMessageReceiptFromOutboundResults({
|
|
621
|
-
results:
|
|
626
|
+
results: platformMessageIds.map((messageId) => {
|
|
622
627
|
const result = {
|
|
623
628
|
channel: "slack",
|
|
624
629
|
messageId
|
|
@@ -736,7 +741,8 @@ function resolveSlackTextChunks(params) {
|
|
|
736
741
|
...params.accountId ? { accountId: params.accountId } : {}
|
|
737
742
|
});
|
|
738
743
|
const chunkMode = resolveChunkMode(params.cfg, "slack", params.accountId);
|
|
739
|
-
|
|
744
|
+
const chunks = (chunkMode === "newline" ? chunkMarkdownTextWithMode(text, chunkLimit, chunkMode) : [text]).flatMap((markdown) => markdownToSlackMrkdwnChunks(markdown, chunkLimit, { tableMode }));
|
|
745
|
+
return resolveTextChunksWithFallback(text, chunks);
|
|
740
746
|
}
|
|
741
747
|
function createSlackSendQueueKey(params) {
|
|
742
748
|
const recipientKey = `${params.recipient.kind}:${params.recipient.id}`;
|
|
@@ -985,8 +991,9 @@ async function scanSlackConversationForDelivery(params) {
|
|
|
985
991
|
};
|
|
986
992
|
}
|
|
987
993
|
async function reconcileSlackUnknownSend(ctx) {
|
|
994
|
+
const cfg = requireRuntimeConfig(ctx.cfg, "Slack delivery reconciliation");
|
|
988
995
|
const account = resolveSlackAccount({
|
|
989
|
-
cfg
|
|
996
|
+
cfg,
|
|
990
997
|
accountId: ctx.accountId ?? void 0
|
|
991
998
|
});
|
|
992
999
|
const deliveryId = createSlackDeliveryMetadataId(ctx.queueId);
|
|
@@ -1021,8 +1028,9 @@ async function reconcileSlackUnknownSend(ctx) {
|
|
|
1021
1028
|
const readClient = createSlackReadClient(readToken, { teamId: recipient.teamId });
|
|
1022
1029
|
const writeClient = writeToken ? getSlackWriteClient(writeToken, { teamId: recipient.teamId }) : void 0;
|
|
1023
1030
|
const payloadReplyToId = ctx.payloads[0]?.replyToId;
|
|
1031
|
+
const effectiveReplyToId = Object.hasOwn(ctx, "effectiveReplyToId") ? normalizeOptionalString(ctx.effectiveReplyToId) : payloadReplyToId != null ? normalizeOptionalString(payloadReplyToId) : ctx.replyToMode === "off" ? void 0 : normalizeOptionalString(ctx.replyToId);
|
|
1024
1032
|
const threadTs = resolveSlackThreadTsValue({
|
|
1025
|
-
replyToId:
|
|
1033
|
+
replyToId: effectiveReplyToId,
|
|
1026
1034
|
threadId: ctx.threadId
|
|
1027
1035
|
});
|
|
1028
1036
|
const searchStartedAt = ctx.platformSendStartedAt ?? ctx.enqueuedAt;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
2
|
+
//#region extensions/slack/src/send-results.ts
|
|
3
|
+
function mergeSlackSendResults(results) {
|
|
4
|
+
const lastResult = results.at(-1);
|
|
5
|
+
if (!lastResult) throw new Error("Slack send plan produced no delivery.");
|
|
6
|
+
if (results.length === 1) return lastResult;
|
|
7
|
+
const receipt = createMessageReceiptFromOutboundResults({ results });
|
|
8
|
+
receipt.parts = receipt.parts.map((part, index) => ({
|
|
9
|
+
...part,
|
|
10
|
+
index
|
|
11
|
+
}));
|
|
12
|
+
const questionResult = results.find((result) => result.meta?.slackQuestionActionIds.length);
|
|
13
|
+
return {
|
|
14
|
+
...lastResult,
|
|
15
|
+
receipt,
|
|
16
|
+
...questionResult?.meta ? { meta: {
|
|
17
|
+
...questionResult.meta,
|
|
18
|
+
slackQuestionMessageId: questionResult.meta.slackQuestionMessageId ?? questionResult.messageId
|
|
19
|
+
} } : {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { mergeSlackSendResults as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as updateMessageSlack, n as resolveSlackDmChannelId, r as sendMessageSlack, t as reconcileSlackUnknownSend } from "./send-
|
|
1
|
+
import { a as updateMessageSlack, n as resolveSlackDmChannelId, r as sendMessageSlack, t as reconcileSlackUnknownSend } from "./send-Djswy6lf.js";
|
|
2
2
|
export { reconcileSlackUnknownSend, resolveSlackDmChannelId, sendMessageSlack, updateMessageSlack };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as slackSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as slackSetupPlugin } from "./channel.setup-t_ghLGb_.js";
|
|
2
2
|
export { slackSetupPlugin };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom } from "./accounts-Dm_H77gH.js";
|
|
2
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
3
|
-
import "./shared-
|
|
4
|
-
import { o as SLACK_CHANNEL, r as createSlackSetupWizardBase } from "./channel.setup-
|
|
5
|
-
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-
|
|
6
|
-
import { t as resolveSlackUserAllowlist } from "./resolve-users-
|
|
2
|
+
import { t as inspectSlackAccount } from "./account-inspect-C3sePHWa.js";
|
|
3
|
+
import "./shared-DEQBEKBL.js";
|
|
4
|
+
import { o as SLACK_CHANNEL, r as createSlackSetupWizardBase } from "./channel.setup-t_ghLGb_.js";
|
|
5
|
+
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-CU7Bg5Ka.js";
|
|
6
|
+
import { t as resolveSlackUserAllowlist } from "./resolve-users-DrhttvRQ.js";
|
|
7
7
|
import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { resolveBasicAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
9
9
|
import { createSetupTranslator, noteChannelLookupFailure, noteChannelLookupSummary, parseMentionOrPrefixedId, patchChannelConfigForAccount, promptResolvedAllowFrom, resolveEntriesWithOptionalToken, resolveSetupAccountId, splitSetupEntries } from "openclaw/plugin-sdk/setup-runtime";
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { n as isSlackPluginAccountConfigured } from "./account-configured-sUohAxZr.js";
|
|
2
2
|
import { n as listSlackAccountIds, o as resolveSlackAccountAllowFrom, r as mergeSlackAccountConfig, s as resolveSlackAccountDmPolicy } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
4
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
5
|
-
import { t as probeSlack } from "./probe-
|
|
6
|
-
import { n as slackBaseConfigAdapter, t as slackSetupPlugin } from "./channel.setup-
|
|
7
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
3
|
+
import { t as inspectSlackAccount } from "./account-inspect-C3sePHWa.js";
|
|
4
|
+
import { a as parseSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
5
|
+
import { a as slackIngressIdentity, t as probeSlack } from "./probe-gj5yQgN2.js";
|
|
6
|
+
import { n as slackBaseConfigAdapter, t as slackSetupPlugin } from "./channel.setup-t_ghLGb_.js";
|
|
7
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BNjw9bxb.js";
|
|
8
8
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DxmvbxBF.js";
|
|
9
9
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
|
|
10
10
|
import { adaptScopedAccountAccessor, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
11
11
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
12
12
|
import { PAIRING_APPROVED_MESSAGE, projectCredentialSnapshotFields, resolveConfiguredFromRequiredCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
|
|
13
13
|
import { buildMutableAllowEntryDetector, collectStandardAllowlistLists, createConditionalWarningCollector, createDangerousNameMatchingMutableAllowlistWarningCollector, createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
14
|
+
import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
14
15
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
15
16
|
import { asObjectRecord } from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
16
17
|
//#region extensions/slack/src/channel-api.ts
|
|
@@ -45,6 +46,7 @@ const resolveSlackDmPolicy = createScopedDmSecurityResolver({
|
|
|
45
46
|
})
|
|
46
47
|
}),
|
|
47
48
|
policyPathSuffix: "dmPolicy",
|
|
49
|
+
classifyEntryAuthentication: identityEntryAuthenticationClassifier(slackIngressIdentity),
|
|
48
50
|
normalizeEntry: (raw) => raw.trim().replace(/^(slack|user):/i, "").trim()
|
|
49
51
|
});
|
|
50
52
|
const collectSlackSecurityWarnings = createOpenProviderConfiguredRouteWarningCollector({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as sanitizeSlackMonitorReplyPayload, r as deliverSlackSlashReplies$1 } from "./replies-Dc6WVh_Q.js";
|
|
2
2
|
import { resolveAgentRoute as resolveAgentRoute$1 } from "openclaw/plugin-sdk/routing";
|
|
3
|
-
import { resolveConversationLabel as resolveConversationLabel$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
4
3
|
import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
4
|
+
import { resolveConversationLabel as resolveConversationLabel$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
5
5
|
import { dispatchChannelInboundTurn as dispatchChannelInboundTurn$1, isChannelPartialDeliveryError as isChannelPartialDeliveryError$1 } from "openclaw/plugin-sdk/channel-inbound";
|
|
6
6
|
import { finalizeInboundContext as finalizeInboundContext$1, resolveChunkMode as resolveChunkMode$1 } from "openclaw/plugin-sdk/reply-runtime";
|
|
7
7
|
//#region extensions/slack/src/monitor/slash-dispatch.runtime.ts
|
|
@@ -73,19 +73,24 @@ function parseSlackTarget(raw, options = {}) {
|
|
|
73
73
|
atUserErrorMessage: "Slack DMs require a user id (use user:<id> or <@id>)"
|
|
74
74
|
});
|
|
75
75
|
if (userTarget) return userTarget;
|
|
76
|
-
if (trimmed.startsWith("#"))
|
|
77
|
-
candidate
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
if (trimmed.startsWith("#")) {
|
|
77
|
+
const candidate = trimmed.slice(1).trim();
|
|
78
|
+
const id = ensureTargetId({
|
|
79
|
+
candidate,
|
|
80
|
+
pattern: /^[A-Z0-9]+$/i,
|
|
81
|
+
errorMessage: "Slack channels require a channel id (use channel:<id>)"
|
|
82
|
+
});
|
|
83
|
+
return buildMessagingTarget("channel", id, trimmed);
|
|
84
|
+
}
|
|
81
85
|
if (isUnambiguousSlackUserId(trimmed)) return buildMessagingTarget("user", trimmed, trimmed);
|
|
82
86
|
if (options.defaultKind) return buildMessagingTarget(options.defaultKind, trimmed, trimmed);
|
|
83
87
|
return buildMessagingTarget("channel", trimmed, trimmed);
|
|
84
88
|
}
|
|
85
89
|
function resolveSlackChannelId(raw) {
|
|
90
|
+
const target = parseSlackTarget(raw, { defaultKind: "channel" });
|
|
86
91
|
return canonicalizeSlackApiTargetId("channel", requireTargetKind({
|
|
87
92
|
platform: "Slack",
|
|
88
|
-
target
|
|
93
|
+
target,
|
|
89
94
|
kind: "channel"
|
|
90
95
|
}), raw);
|
|
91
96
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as parseSlackTarget, s as slackTargetsMatch } from "./target-parsing-
|
|
1
|
+
import { a as parseSlackTarget, s as slackTargetsMatch } from "./target-parsing-PbxGDbr9.js";
|
|
2
2
|
//#region extensions/slack/src/targets.ts
|
|
3
3
|
function matchesResolvedUserTarget(target, currentMessagingTarget) {
|
|
4
4
|
const resolvedId = target.trim();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
//#region extensions/slack/src/thread-ts.ts
|
|
3
3
|
const SLACK_THREAD_TS_PATTERN = /^\d+\.\d+$/;
|
|
4
|
+
function resolveSlackReplyThreadTs(params) {
|
|
5
|
+
const replyToId = params.replyToMode === "off" ? void 0 : params.replyToId;
|
|
6
|
+
return params.replyToCurrent || params.replyToIsExplicit === false ? params.threadId ?? replyToId : replyToId ?? params.threadId;
|
|
7
|
+
}
|
|
4
8
|
function normalizeSlackThreadTsCandidate(value) {
|
|
5
9
|
if (typeof value !== "string") return;
|
|
6
10
|
const normalized = normalizeOptionalString(value);
|
|
@@ -10,4 +14,4 @@ function resolveSlackThreadTsValue(params) {
|
|
|
10
14
|
return normalizeSlackThreadTsCandidate(params.replyToId) ?? normalizeSlackThreadTsCandidate(params.threadId);
|
|
11
15
|
}
|
|
12
16
|
//#endregion
|
|
13
|
-
export {
|
|
17
|
+
export { resolveSlackReplyThreadTs as n, resolveSlackThreadTsValue as r, normalizeSlackThreadTsCandidate as t };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* negotiator
|
|
3
|
+
* Copyright(c) 2026 Blake Embrey
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var contentType = require('content-type');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Module exports.
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
module.exports = parseAccept;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Parse an Accept-style header.
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function parseAccept(header) {
|
|
24
|
+
var values = [];
|
|
25
|
+
var index = 0;
|
|
26
|
+
|
|
27
|
+
while (index < header.length) {
|
|
28
|
+
var start = skipOptionalWhitespace(header, index);
|
|
29
|
+
var parsed = contentType.parse(header, { comma: true, start: start });
|
|
30
|
+
|
|
31
|
+
// `content-type` normalizes the type, but accept methods return original casing.
|
|
32
|
+
parsed.type = header.slice(start, start + parsed.type.length);
|
|
33
|
+
values.push(parsed);
|
|
34
|
+
|
|
35
|
+
index = parsed.index + 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return values;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Skip optional whitespace.
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
function skipOptionalWhitespace(header, index) {
|
|
47
|
+
var cursor = index;
|
|
48
|
+
|
|
49
|
+
while (header.charCodeAt(cursor) === 0x20 || header.charCodeAt(cursor) === 0x09) {
|
|
50
|
+
cursor++;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return cursor;
|
|
54
|
+
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
11
|
+
var parseAccept = require('./accept');
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* Module exports.
|
|
13
15
|
* @public
|
|
@@ -21,55 +23,29 @@ module.exports.preferredCharsets = preferredCharsets;
|
|
|
21
23
|
* @private
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
|
-
var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Parse the Accept-Charset header.
|
|
28
|
-
* @private
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
26
|
function parseAcceptCharset(accept) {
|
|
32
|
-
var accepts = accept
|
|
27
|
+
var accepts = parseAccept(accept);
|
|
33
28
|
|
|
34
29
|
for (var i = 0, j = 0; i < accepts.length; i++) {
|
|
35
|
-
var charset =
|
|
36
|
-
|
|
37
|
-
if (charset) {
|
|
38
|
-
accepts[j++] = charset;
|
|
39
|
-
}
|
|
30
|
+
var charset = formatCharset(accepts[i], i);
|
|
31
|
+
if (charset) accepts[j++] = charset;
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
// trim accepts
|
|
43
34
|
accepts.length = j;
|
|
44
|
-
|
|
45
35
|
return accepts;
|
|
46
36
|
}
|
|
47
37
|
|
|
48
38
|
/**
|
|
49
|
-
*
|
|
39
|
+
* Format a parsed charset for negotiation.
|
|
50
40
|
* @private
|
|
51
41
|
*/
|
|
52
42
|
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
if (!match) return null;
|
|
56
|
-
|
|
57
|
-
var charset = match[1];
|
|
58
|
-
var q = 1;
|
|
59
|
-
if (match[2]) {
|
|
60
|
-
var params = match[2].split(';')
|
|
61
|
-
for (var j = 0; j < params.length; j++) {
|
|
62
|
-
var p = params[j].trim().split('=');
|
|
63
|
-
if (p[0] === 'q') {
|
|
64
|
-
q = parseFloat(p[1]);
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
43
|
+
function formatCharset(parsed, i) {
|
|
44
|
+
if (!parsed.type) return null;
|
|
69
45
|
|
|
70
46
|
return {
|
|
71
|
-
charset:
|
|
72
|
-
q: q,
|
|
47
|
+
charset: parsed.type,
|
|
48
|
+
q: parsed.parameters.q ? parseFloat(parsed.parameters.q) : 1,
|
|
73
49
|
i: i
|
|
74
50
|
};
|
|
75
51
|
}
|