@openclaw/slack 2026.6.6 → 2026.6.8-beta.2
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/api.js +3 -3
- package/dist/{channel-i43aT1rv.js → channel-BxD37X5Y.js} +13 -3
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DrCTObMp.js → channel.setup-W5YnieWd.js} +1 -1
- package/dist/{monitor-Szm2LjsM.js → monitor-DwDmBYfl.js} +2 -2
- package/dist/{pipeline.runtime-Dvqs0AT-.js → pipeline.runtime-1FYOQOt_.js} +182 -22
- package/dist/{provider-LH_j-bLA.js → provider-ChhYGpXx.js} +10 -3
- package/dist/replies-Bt4nWmSd.js +285 -0
- package/dist/runtime-api.js +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BB_ivsoR.js → setup-surface-NNMjGpXc.js} +1 -1
- package/dist/{shared-Bviszgb6.js → shared-Bkkmro6q.js} +88 -26
- package/dist/{slash-dispatch.runtime-CoFAysiw.js → slash-dispatch.runtime-Dvvs747S.js} +1 -1
- package/node_modules/form-data/CHANGELOG.md +26 -1
- package/node_modules/form-data/README.md +4 -4
- package/node_modules/form-data/lib/form_data.js +7 -2
- package/node_modules/form-data/package.json +11 -10
- package/npm-shrinkwrap.json +7 -15
- package/package.json +5 -5
- package/dist/replies-FEOdgSlE.js +0 -142
- package/node_modules/form-data/README.md.bak +0 -350
- package/node_modules/has-own/.travis.yml +0 -4
- package/node_modules/has-own/History.md +0 -5
- package/node_modules/has-own/LICENSE +0 -22
- package/node_modules/has-own/Makefile +0 -5
- package/node_modules/has-own/README.md +0 -19
- package/node_modules/has-own/index.js +0 -8
- package/node_modules/has-own/package.json +0 -19
- package/node_modules/has-own/test/index.js +0 -36
package/dist/api.js
CHANGED
|
@@ -3,16 +3,16 @@ import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, l as resol
|
|
|
3
3
|
import { t as inspectSlackAccount } from "./account-inspect-CdGk6R7l.js";
|
|
4
4
|
import { i as resolveSlackChannelId, n as normalizeSlackMessagingTarget, r as parseSlackTarget, t as looksLikeSlackTargetId } from "./target-parsing-C7eeWg7M.js";
|
|
5
5
|
import "./targets-nUqxHGgg.js";
|
|
6
|
-
import { a as resolveSlackAutoThreadId, i as resolveSlackChannelType, n as buildSlackThreadingToolContext, r as resetSlackChannelTypeCacheForTest, t as slackPlugin } from "./channel-
|
|
6
|
+
import { a as resolveSlackAutoThreadId, i as resolveSlackChannelType, n as buildSlackThreadingToolContext, r as resetSlackChannelTypeCacheForTest, t as slackPlugin } from "./channel-BxD37X5Y.js";
|
|
7
7
|
import { _ as buildSlackInteractiveBlocks, a as parseSlackBlocksInput, c as resolveSlackGroupRequireMention, d as normalizeAllowList, f as normalizeAllowListLower, g as resolveSlackUserAllowed, h as resolveSlackAllowListMatch, i as SLACK_MAX_BLOCKS, l as resolveSlackGroupToolPolicy, m as normalizeSlackSlug, o as validateSlackBlocksArray, p as normalizeSlackAllowOwnerEntry, u as allowListMatches, v as buildSlackPresentationBlocks } from "./thread-ts-Cffag8e2.js";
|
|
8
8
|
import { a as getSlackWriteClient, c as resolveSlackWebClientOptions, i as createSlackWriteClient, l as resolveSlackWriteClientOptions, n as createSlackTokenCacheKey, o as SLACK_DEFAULT_RETRY_OPTIONS, r as createSlackWebClient, s as SLACK_WRITE_RETRY_OPTIONS, t as clearSlackWriteClientCacheForTest } from "./client-Cn2WwpcA.js";
|
|
9
9
|
import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-B9M0zzlQ.js";
|
|
10
10
|
import { n as isSlackInteractiveRepliesEnabled, r as parseSlackOptionsLine, t as compileSlackInteractiveReplies } from "./interactive-replies-DrBq4Mld.js";
|
|
11
|
-
import { t as slackSetupPlugin } from "./channel.setup-
|
|
11
|
+
import { t as slackSetupPlugin } from "./channel.setup-W5YnieWd.js";
|
|
12
12
|
import { a as recordSlackThreadParticipation, n as clearSlackThreadParticipationCache, r as hasSlackThreadParticipation } from "./send-rekB-Xjp.js";
|
|
13
13
|
import { a as listSlackEmojis, c as pinSlackMessage, d as removeOwnSlackReactions, f as removeSlackReaction, i as getSlackMemberInfo, l as reactSlackMessage, m as unpinSlackMessage, n as downloadSlackFile, o as listSlackPins, p as sendSlackMessage, r as editSlackMessage, s as listSlackReactions, t as deleteSlackMessage, u as readSlackMessages } from "./actions-YkhEE5f1.js";
|
|
14
14
|
import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-8UPAEyNg.js";
|
|
15
15
|
import { t as probeSlack } from "./probe-BTKzLT2u.js";
|
|
16
16
|
import { t as collectSlackSecurityAuditFindings } from "./security-audit-CikQhBUY.js";
|
|
17
|
-
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-
|
|
17
|
+
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-ChhYGpXx.js";
|
|
18
18
|
export { SLACK_DEFAULT_RETRY_OPTIONS, SLACK_MAX_BLOCKS, SLACK_WRITE_RETRY_OPTIONS, resetSlackChannelTypeCacheForTest as __resetSlackChannelTypeCacheForTest, resetSlackChannelTypeCacheForTest, allowListMatches, buildSlackInteractiveBlocks, buildSlackPresentationBlocks, buildSlackThreadingToolContext, clearSlackThreadParticipationCache, clearSlackWriteClientCacheForTest, collectSlackSecurityAuditFindings, compileSlackInteractiveReplies, createSlackTokenCacheKey, createSlackWebClient, createSlackWriteClient, deleteSlackMessage, downloadSlackFile, editSlackMessage, extractSlackToolSend, getSlackMemberInfo, getSlackWriteClient, handleSlackHttpRequest, hasSlackThreadParticipation, inspectSlackAccount, isSlackInteractiveRepliesEnabled, listEnabledSlackAccounts, listSlackAccountIds, listSlackDirectoryGroupsFromConfig, listSlackDirectoryPeersFromConfig, listSlackEmojis, listSlackMessageActions, listSlackPins, listSlackReactions, looksLikeSlackTargetId, mergeSlackAccountConfig, normalizeAllowList, normalizeAllowListLower, normalizeSlackAllowOwnerEntry, normalizeSlackMessagingTarget, normalizeSlackSlug, normalizeSlackWebhookPath, parseSlackBlocksInput, parseSlackOptionsLine, parseSlackTarget, pinSlackMessage, probeSlack, reactSlackMessage, readSlackMessages, recordSlackThreadParticipation, registerSlackHttpHandler, removeOwnSlackReactions, removeSlackReaction, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackAllowListMatch, resolveSlackAutoThreadId, resolveSlackChannelId, resolveSlackChannelType, resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, resolveSlackReplyToMode, resolveSlackRuntimeGroupPolicy, resolveSlackUserAllowed, resolveSlackWebClientOptions, resolveSlackWriteClientOptions, sendSlackMessage, slackPlugin, slackSetupPlugin, unpinSlackMessage, validateSlackBlocksArray };
|
|
@@ -6,7 +6,7 @@ import { d as PAIRING_APPROVED_MESSAGE, h as isSlackPluginAccountConfigured, m a
|
|
|
6
6
|
import { n as extractSlackToolSend, t as describeSlackMessageTool } from "./message-tool-api-B9M0zzlQ.js";
|
|
7
7
|
import { n as isSlackInteractiveRepliesEnabled, t as compileSlackInteractiveReplies } from "./interactive-replies-DrBq4Mld.js";
|
|
8
8
|
import { t as getOptionalSlackRuntime } from "./runtime-BOk7xkOl.js";
|
|
9
|
-
import { n as slackConfigAdapter, r as slackSecurityAdapter, t as createSlackPluginBase } from "./shared-
|
|
9
|
+
import { n as slackConfigAdapter, r as slackSecurityAdapter, t as createSlackPluginBase } from "./shared-Bkkmro6q.js";
|
|
10
10
|
import { i as SLACK_CHANNEL, n as createSlackSetupWizardProxy, r as slackSetupAdapter } from "./setup-core-POfI_bgP.js";
|
|
11
11
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
@@ -345,6 +345,15 @@ async function handleSlackMessageAction(params) {
|
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region extensions/slack/src/channel-actions.ts
|
|
347
347
|
let slackActionRuntimePromise$1;
|
|
348
|
+
const SLACK_TOOL_DELIVERY_ACTIONS = new Set([
|
|
349
|
+
"deleteMessage",
|
|
350
|
+
"editMessage",
|
|
351
|
+
"pinMessage",
|
|
352
|
+
"react",
|
|
353
|
+
"sendMessage",
|
|
354
|
+
"unpinMessage",
|
|
355
|
+
"uploadFile"
|
|
356
|
+
]);
|
|
348
357
|
async function loadSlackActionRuntime$1() {
|
|
349
358
|
slackActionRuntimePromise$1 ??= import("./action-runtime.runtime-D05xDf1s.js");
|
|
350
359
|
return await slackActionRuntimePromise$1;
|
|
@@ -361,6 +370,7 @@ function createSlackActions(providerId, options) {
|
|
|
361
370
|
return {
|
|
362
371
|
describeMessageTool: describeSlackMessageTool,
|
|
363
372
|
extractToolSend: ({ args }) => extractSlackToolSend(args),
|
|
373
|
+
isToolDeliveryAction: ({ args }) => typeof args.action === "string" && SLACK_TOOL_DELIVERY_ACTIONS.has(args.action),
|
|
364
374
|
prepareSendPayload: ({ ctx, payload }) => ctx.action === "send" ? payload : null,
|
|
365
375
|
handleAction: async (ctx) => {
|
|
366
376
|
return await handleSlackMessageAction({
|
|
@@ -476,7 +486,7 @@ const EXTENSION_SHARED_MODULE_ID = "openclaw/plugin-sdk/extension-shared";
|
|
|
476
486
|
const TARGET_RESOLVER_RUNTIME_MODULE_ID = "openclaw/plugin-sdk/target-resolver-runtime";
|
|
477
487
|
const loadExtensionSharedSdk = createLazyRuntimeModule(() => import(EXTENSION_SHARED_MODULE_ID));
|
|
478
488
|
const loadTargetResolverRuntimeSdk = createLazyRuntimeModule(() => import(TARGET_RESOLVER_RUNTIME_MODULE_ID));
|
|
479
|
-
const loadSlackSetupSurfaceModule = createLazyRuntimeModule(() => import("./setup-surface-
|
|
489
|
+
const loadSlackSetupSurfaceModule = createLazyRuntimeModule(() => import("./setup-surface-NNMjGpXc.js"));
|
|
480
490
|
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-CErQL0td.js"));
|
|
481
491
|
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-DvXnHfDP.js"));
|
|
482
492
|
async function resolveSlackHandleAction() {
|
|
@@ -514,7 +524,7 @@ async function loadSlackProbeModule() {
|
|
|
514
524
|
return await slackProbeModulePromise;
|
|
515
525
|
}
|
|
516
526
|
async function loadSlackMonitorModule() {
|
|
517
|
-
slackMonitorModulePromise ??= import("./monitor-
|
|
527
|
+
slackMonitorModulePromise ??= import("./monitor-DwDmBYfl.js").then((n) => n.t);
|
|
518
528
|
return await slackMonitorModulePromise;
|
|
519
529
|
}
|
|
520
530
|
async function loadSlackDirectoryLiveModule() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as slackPlugin } from "./channel-
|
|
1
|
+
import { t as slackPlugin } from "./channel-BxD37X5Y.js";
|
|
2
2
|
export { slackPlugin };
|
|
@@ -4,7 +4,7 @@ import { t as SlackChannelConfigSchema } from "./config-schema-BjAjs8_6.js";
|
|
|
4
4
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
5
5
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
6
6
|
//#region extensions/slack/src/channel.setup.ts
|
|
7
|
-
const slackSetupWizard = createSlackSetupWizardProxy(async () => ({ slackSetupWizard: (await import("./setup-surface-
|
|
7
|
+
const slackSetupWizard = createSlackSetupWizardProxy(async () => ({ slackSetupWizard: (await import("./setup-surface-NNMjGpXc.js")).slackSetupWizard }));
|
|
8
8
|
const slackSetupConfigAdapter = createScopedChannelConfigAdapter({
|
|
9
9
|
sectionKey: SLACK_CHANNEL,
|
|
10
10
|
listAccountIds: listSlackAccountIds,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { t as monitorSlackProvider, y as buildSlackSlashCommandMatcher } from "./provider-
|
|
2
|
+
import { t as monitorSlackProvider, y as buildSlackSlashCommandMatcher } from "./provider-ChhYGpXx.js";
|
|
3
3
|
import { t as isSlackChannelAllowedByPolicy } from "./policy-DT3mRh58.js";
|
|
4
|
-
import { o as resolveSlackThreadTs } from "./replies-
|
|
4
|
+
import { o as resolveSlackThreadTs } from "./replies-Bt4nWmSd.js";
|
|
5
5
|
//#region extensions/slack/src/monitor.ts
|
|
6
6
|
var monitor_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
buildSlackSlashCommandMatcher: () => buildSlackSlashCommandMatcher,
|
|
@@ -7,9 +7,9 @@ import { n as resolveSlackNativeStreaming, r as resolveSlackStreamingMode, t as
|
|
|
7
7
|
import { a as recordSlackThreadParticipation, i as hasSlackThreadParticipationWithPersistence, s as normalizeSlackOutboundText, t as sendMessageSlack } from "./send-rekB-Xjp.js";
|
|
8
8
|
import { _ as resolveSlackThreadStarter, b as buildSlackEditTextPayload, f as removeSlackReaction, g as resolveSlackThreadHistory, l as reactSlackMessage, r as editSlackMessage, t as deleteSlackMessage, y as formatSlackFileReference } from "./actions-YkhEE5f1.js";
|
|
9
9
|
import { t as formatSlackError } from "./errors-CZtmv-h0.js";
|
|
10
|
-
import { _ as resolveStorePath, a as escapeSlackMrkdwn, b as stripSlackMentionsForCommandDetection, c as authorizeSlackBotRoomMessage, d as buildSlackAssistantThreadMetadata, f as parseSlackAssistantThreadMetadata, g as resolveChannelContextVisibilityMode, h as readSessionUpdatedAt, i as authorizeSlackDirectMessage, l as resolveSlackCommandIngress, m as resolveSlackChatType, o as recordInboundSession, p as normalizeSlackChannelType, r as resolveSlackRoomContextHints, s as resolveConversationLabel$1, u as resolveSlackEffectiveAllowFrom, v as updateLastRoute } from "./provider-
|
|
10
|
+
import { _ as resolveStorePath, a as escapeSlackMrkdwn, b as stripSlackMentionsForCommandDetection, c as authorizeSlackBotRoomMessage, d as buildSlackAssistantThreadMetadata, f as parseSlackAssistantThreadMetadata, g as resolveChannelContextVisibilityMode, h as readSessionUpdatedAt, i as authorizeSlackDirectMessage, l as resolveSlackCommandIngress, m as resolveSlackChatType, o as recordInboundSession, p as normalizeSlackChannelType, r as resolveSlackRoomContextHints, s as resolveConversationLabel$1, u as resolveSlackEffectiveAllowFrom, v as updateLastRoute } from "./provider-ChhYGpXx.js";
|
|
11
11
|
import { n as resolveSlackChannelConfig } from "./policy-DT3mRh58.js";
|
|
12
|
-
import { a as resolveDeliveredSlackReplyThreadTs, i as readSlackReplyBlocks, n as deliverReplies, o as resolveSlackThreadTs, t as createSlackReplyDeliveryPlan } from "./replies-
|
|
12
|
+
import { a as resolveDeliveredSlackReplyThreadTs, i as readSlackReplyBlocks, n as deliverReplies, o as resolveSlackThreadTs, s as emitSlackMessageSentHooks, t as createSlackReplyDeliveryPlan } from "./replies-Bt4nWmSd.js";
|
|
13
13
|
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
14
|
import { resolveAgentRoute, resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
15
15
|
import { buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelMessageReplyPipeline, createChannelProgressDraftGate, createDraftStreamLoop, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, mergeChannelProgressDraftLine, resolveAgentOutboundIdentity, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelProgressDraftConfig, resolveChannelProgressDraftMaxLineChars, resolveChannelProgressDraftMaxLines, resolveChannelProgressDraftRender, resolveChannelStreamingBlockEnabled, resolveChannelStreamingNativeTransport, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingSuppressDefaultToolProgressMessages } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -415,36 +415,41 @@ async function appendSlackStream(params) {
|
|
|
415
415
|
* text so the caller can deliver it through the normal Slack reply path.
|
|
416
416
|
*
|
|
417
417
|
* All other errors propagate unchanged.
|
|
418
|
+
*
|
|
419
|
+
* On success, returns the finalized message's Slack `ts` (when reported) so the
|
|
420
|
+
* caller can emit the `message_sent` hook with a populated `messageId`.
|
|
418
421
|
*/
|
|
419
422
|
async function stopSlackStream(params) {
|
|
420
423
|
const { session, text, chunks, metadata } = params;
|
|
421
424
|
if (session.stopped) {
|
|
422
425
|
logVerbose("slack-stream: stream already stopped, ignoring duplicate stop");
|
|
423
|
-
return;
|
|
426
|
+
return {};
|
|
424
427
|
}
|
|
425
428
|
session.stopped = true;
|
|
426
429
|
if (text) session.pendingText += text;
|
|
427
430
|
logVerbose(`slack-stream: stopping stream in ${session.channel} thread=${session.threadTs}${text ? ` (final text: ${text.length} chars)` : ""}`);
|
|
428
431
|
try {
|
|
429
|
-
await session.streamer.stop(text || chunks?.length || metadata ? {
|
|
432
|
+
const stopResponse = await session.streamer.stop(text || chunks?.length || metadata ? {
|
|
430
433
|
...text ? { markdown_text: text } : {},
|
|
431
434
|
...chunks?.length ? { chunks } : {},
|
|
432
435
|
...metadata ? { metadata } : {}
|
|
433
436
|
} : void 0);
|
|
434
437
|
session.delivered = true;
|
|
435
438
|
session.pendingText = "";
|
|
439
|
+
logVerbose("slack-stream: stream stopped");
|
|
440
|
+
const messageId = stopResponse?.ts ?? stopResponse?.message?.ts;
|
|
441
|
+
return messageId ? { messageId } : {};
|
|
436
442
|
} catch (err) {
|
|
437
443
|
if (isBenignSlackFinalizeError(err)) {
|
|
438
444
|
const code = extractSlackErrorCode(err) ?? "unknown";
|
|
439
445
|
if (session.pendingText) throw new SlackStreamNotDeliveredError(session.pendingText, code);
|
|
440
446
|
if (session.delivered) {
|
|
441
447
|
logVerbose(`slack-stream: finalize rejected by Slack (${code}); prior appends delivered, treating stream as stopped`);
|
|
442
|
-
return;
|
|
448
|
+
return {};
|
|
443
449
|
}
|
|
444
450
|
}
|
|
445
451
|
throw err;
|
|
446
452
|
}
|
|
447
|
-
logVerbose("slack-stream: stream stopped");
|
|
448
453
|
}
|
|
449
454
|
/**
|
|
450
455
|
* Slack API error codes that indicate `chat.stopStream` (or the
|
|
@@ -473,10 +478,10 @@ function extractSlackErrorCode(err) {
|
|
|
473
478
|
return (typeof record.message === "string" ? record.message : "").match(/An API error occurred:\s*([a-z_][a-z0-9_]*)/i)?.[1];
|
|
474
479
|
}
|
|
475
480
|
function markSlackStreamFallbackDelivered(session) {
|
|
476
|
-
const
|
|
481
|
+
const nativeStreamWasStarted = session.delivered;
|
|
477
482
|
session.pendingText = "";
|
|
478
|
-
session.
|
|
479
|
-
|
|
483
|
+
session.streamer.buffer = "";
|
|
484
|
+
session.stopped = !nativeStreamWasStarted;
|
|
480
485
|
}
|
|
481
486
|
//#endregion
|
|
482
487
|
//#region extensions/slack/src/threading.ts
|
|
@@ -848,6 +853,16 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
848
853
|
ctx: prepared.ctxPayload
|
|
849
854
|
});
|
|
850
855
|
const sourceRepliesAreToolOnly = sourceReplyDeliveryMode === "message_tool_only";
|
|
856
|
+
const messageSentHookTarget = prepared.ctxPayload.OriginatingTo ?? prepared.ctxPayload.To ?? prepared.replyTarget;
|
|
857
|
+
const messageSentHookContext = {
|
|
858
|
+
sessionKeyForInternalHooks: prepared.ctxPayload.SessionKey ?? route.sessionKey,
|
|
859
|
+
isGroup: prepared.isRoomish,
|
|
860
|
+
groupId: prepared.isRoomish ? message.channel : void 0
|
|
861
|
+
};
|
|
862
|
+
const messageSentDeliveryHookContext = {
|
|
863
|
+
...messageSentHookContext,
|
|
864
|
+
messageSentHookTarget
|
|
865
|
+
};
|
|
851
866
|
const reactionMessageTs = prepared.ackReactionMessageTs;
|
|
852
867
|
const messageTs = message.ts ?? message.event_ts;
|
|
853
868
|
const incomingThreadTs = message.thread_ts;
|
|
@@ -998,7 +1013,79 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
998
1013
|
let usedBlockReplyThreadTs;
|
|
999
1014
|
let observedReplyDelivery = false;
|
|
1000
1015
|
let observedFinalReplyDelivery = false;
|
|
1016
|
+
const streamedDeliveries = [];
|
|
1017
|
+
const streamedFailuresOwnedByDispatcher = {
|
|
1018
|
+
tool: 0,
|
|
1019
|
+
block: 0,
|
|
1020
|
+
final: 0
|
|
1021
|
+
};
|
|
1022
|
+
const refreshStreamedAcknowledgements = (session) => {
|
|
1023
|
+
if (session.pendingText.length === 0) for (const delivery of streamedDeliveries) delivery.acknowledged = true;
|
|
1024
|
+
};
|
|
1025
|
+
const recordStreamedDelivery = (kind, content) => {
|
|
1026
|
+
const delivery = {
|
|
1027
|
+
kind,
|
|
1028
|
+
content,
|
|
1029
|
+
acknowledged: false
|
|
1030
|
+
};
|
|
1031
|
+
streamedDeliveries.push(delivery);
|
|
1032
|
+
return delivery;
|
|
1033
|
+
};
|
|
1034
|
+
const rememberStreamedDelivery = (kind, content, session) => {
|
|
1035
|
+
recordStreamedDelivery(kind, content);
|
|
1036
|
+
refreshStreamedAcknowledgements(session);
|
|
1037
|
+
};
|
|
1038
|
+
const emitAcknowledgedStreamedDeliveries = (messageId) => {
|
|
1039
|
+
for (const delivery of streamedDeliveries) {
|
|
1040
|
+
if (!delivery.acknowledged || delivery.outcome) continue;
|
|
1041
|
+
emitSlackMessageSentHooks({
|
|
1042
|
+
...messageSentHookContext,
|
|
1043
|
+
to: messageSentHookTarget,
|
|
1044
|
+
accountId: account.accountId,
|
|
1045
|
+
content: delivery.content,
|
|
1046
|
+
success: true,
|
|
1047
|
+
...messageId ? { messageId } : {}
|
|
1048
|
+
});
|
|
1049
|
+
delivery.outcome = "success";
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
const emitFailedPendingStreamedDeliveries = (error) => {
|
|
1053
|
+
for (const delivery of streamedDeliveries) {
|
|
1054
|
+
if (delivery.acknowledged || delivery.outcome) continue;
|
|
1055
|
+
emitSlackMessageSentHooks({
|
|
1056
|
+
...messageSentHookContext,
|
|
1057
|
+
to: messageSentHookTarget,
|
|
1058
|
+
accountId: account.accountId,
|
|
1059
|
+
content: delivery.content,
|
|
1060
|
+
success: false,
|
|
1061
|
+
error
|
|
1062
|
+
});
|
|
1063
|
+
delivery.outcome = "failure";
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
const emitSuccessfulPendingStreamedDeliveries = (messageId) => {
|
|
1067
|
+
for (const delivery of streamedDeliveries) {
|
|
1068
|
+
if (delivery.acknowledged || delivery.outcome) continue;
|
|
1069
|
+
emitSlackMessageSentHooks({
|
|
1070
|
+
...messageSentHookContext,
|
|
1071
|
+
to: messageSentHookTarget,
|
|
1072
|
+
accountId: account.accountId,
|
|
1073
|
+
content: delivery.content,
|
|
1074
|
+
success: true,
|
|
1075
|
+
...messageId ? { messageId } : {}
|
|
1076
|
+
});
|
|
1077
|
+
delivery.outcome = "success";
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1001
1080
|
const deliveryTracker = createSlackEventDeliveryTracker();
|
|
1081
|
+
const markPreviewPayloadDelivered = (params) => {
|
|
1082
|
+
deliveryTracker.markDelivered(params);
|
|
1083
|
+
const nextThreadTs = replyPlan.peekThreadTs();
|
|
1084
|
+
if (nextThreadTs !== params.threadTs) deliveryTracker.markDelivered({
|
|
1085
|
+
...params,
|
|
1086
|
+
threadTs: nextThreadTs
|
|
1087
|
+
});
|
|
1088
|
+
};
|
|
1002
1089
|
const resolveDeliveryThreadTs = (params) => {
|
|
1003
1090
|
const plannedThreadTs = params.forcedThreadTs ? void 0 : replyPlan.nextThreadTs();
|
|
1004
1091
|
return params.forcedThreadTs ?? plannedThreadTs ?? (params.kind === "block" ? usedBlockReplyThreadTs : void 0);
|
|
@@ -1009,7 +1096,23 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1009
1096
|
if (kind === "block") usedBlockReplyThreadTs = deliveredThreadTs;
|
|
1010
1097
|
};
|
|
1011
1098
|
const deliverPendingStreamFallback = async (session, err) => {
|
|
1012
|
-
|
|
1099
|
+
let fallbackError = err;
|
|
1100
|
+
if (!session.stopped) try {
|
|
1101
|
+
const stopResult = await stopSlackStream({
|
|
1102
|
+
session,
|
|
1103
|
+
...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
|
|
1104
|
+
});
|
|
1105
|
+
for (const delivery of streamedDeliveries) delivery.acknowledged = true;
|
|
1106
|
+
emitAcknowledgedStreamedDeliveries(stopResult.messageId);
|
|
1107
|
+
observedReplyDelivery = true;
|
|
1108
|
+
usedReplyThreadTs ??= session.threadTs;
|
|
1109
|
+
return true;
|
|
1110
|
+
} catch (stopErr) {
|
|
1111
|
+
if (stopErr instanceof SlackStreamNotDeliveredError) fallbackError = stopErr;
|
|
1112
|
+
else runtime.error?.(danger(`slack-stream: failed to finalize buffered text before fallback: ${formatSlackError(stopErr)}`));
|
|
1113
|
+
}
|
|
1114
|
+
emitAcknowledgedStreamedDeliveries();
|
|
1115
|
+
const fallbackText = fallbackError.pendingText.trim();
|
|
1013
1116
|
if (!fallbackText) return false;
|
|
1014
1117
|
try {
|
|
1015
1118
|
await deliverReplies({
|
|
@@ -1023,15 +1126,27 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1023
1126
|
replyThreadTs: session.threadTs,
|
|
1024
1127
|
replyToMode: replyDeliveryMode,
|
|
1025
1128
|
...slackIdentity ? { identity: slackIdentity } : {},
|
|
1026
|
-
...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
|
|
1129
|
+
...slackMessageMetadata ? { metadata: slackMessageMetadata } : {},
|
|
1130
|
+
...messageSentDeliveryHookContext,
|
|
1131
|
+
deferMessageSentHooks: true
|
|
1027
1132
|
});
|
|
1028
1133
|
markSlackStreamFallbackDelivered(session);
|
|
1134
|
+
if (!session.stopped) try {
|
|
1135
|
+
await stopSlackStream({
|
|
1136
|
+
session,
|
|
1137
|
+
...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
|
|
1138
|
+
});
|
|
1139
|
+
} catch (finalizeErr) {
|
|
1140
|
+
runtime.error?.(danger(`slack-stream: failed to finalize native stream after fallback delivery: ${formatSlackError(finalizeErr)}`));
|
|
1141
|
+
}
|
|
1142
|
+
emitSuccessfulPendingStreamedDeliveries();
|
|
1029
1143
|
observedReplyDelivery = true;
|
|
1030
1144
|
usedReplyThreadTs ??= session.threadTs;
|
|
1031
|
-
logVerbose(`slack-stream: streamed delivery failed (${
|
|
1145
|
+
logVerbose(`slack-stream: streamed delivery failed (${fallbackError.slackCode}); delivered ${fallbackText.length} chars via deliverReplies fallback`);
|
|
1032
1146
|
return true;
|
|
1033
1147
|
} catch (postErr) {
|
|
1034
|
-
|
|
1148
|
+
emitFailedPendingStreamedDeliveries(formatErrorMessage(postErr));
|
|
1149
|
+
runtime.error?.(danger(`slack-stream: fallback deliverReplies failed after ${fallbackError.slackCode}: ${formatErrorMessage(postErr)}`));
|
|
1035
1150
|
return false;
|
|
1036
1151
|
}
|
|
1037
1152
|
};
|
|
@@ -1045,7 +1160,7 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1045
1160
|
threadTs: deliveryReplyThreadTs
|
|
1046
1161
|
})) {
|
|
1047
1162
|
logVerbose("slack: suppressed duplicate normal delivery within the same turn");
|
|
1048
|
-
return;
|
|
1163
|
+
return deliveryReplyThreadTs;
|
|
1049
1164
|
}
|
|
1050
1165
|
await deliverReplies({
|
|
1051
1166
|
cfg: ctx.cfg,
|
|
@@ -1058,7 +1173,8 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1058
1173
|
replyThreadTs: deliveryReplyThreadTs,
|
|
1059
1174
|
replyToMode: replyDeliveryMode,
|
|
1060
1175
|
...slackIdentity ? { identity: slackIdentity } : {},
|
|
1061
|
-
...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
|
|
1176
|
+
...slackMessageMetadata ? { metadata: slackMessageMetadata } : {},
|
|
1177
|
+
...messageSentDeliveryHookContext
|
|
1062
1178
|
});
|
|
1063
1179
|
observedReplyDelivery = true;
|
|
1064
1180
|
if (params.kind === "final") observedFinalReplyDelivery = true;
|
|
@@ -1074,9 +1190,13 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1074
1190
|
payload: params.payload,
|
|
1075
1191
|
threadTs: deliveryReplyThreadTs
|
|
1076
1192
|
});
|
|
1193
|
+
return deliveryReplyThreadTs;
|
|
1077
1194
|
};
|
|
1078
1195
|
const deliverBufferedStreamFallback = async (params) => {
|
|
1079
|
-
if (!await deliverPendingStreamFallback(params.session, params.err))
|
|
1196
|
+
if (!await deliverPendingStreamFallback(params.session, params.err)) {
|
|
1197
|
+
streamedFailuresOwnedByDispatcher[params.kind] += 1;
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1080
1200
|
replyPlan.markSent();
|
|
1081
1201
|
if (params.kind === "final") observedFinalReplyDelivery = true;
|
|
1082
1202
|
deliveryTracker.markDelivered({
|
|
@@ -1152,10 +1272,12 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1152
1272
|
}),
|
|
1153
1273
|
userId: message.user
|
|
1154
1274
|
});
|
|
1275
|
+
refreshStreamedAcknowledgements(streamSession);
|
|
1155
1276
|
if (streamSession.delivered) {
|
|
1156
1277
|
observedReplyDelivery = true;
|
|
1157
1278
|
if (params.kind === "final") observedFinalReplyDelivery = true;
|
|
1158
1279
|
}
|
|
1280
|
+
if (text) rememberStreamedDelivery(params.kind, text, streamSession);
|
|
1159
1281
|
rememberDeliveredThreadTs(params.kind, streamThreadTs);
|
|
1160
1282
|
replyPlan.markSent();
|
|
1161
1283
|
deliveryTracker.markDelivered({
|
|
@@ -1197,11 +1319,13 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1197
1319
|
});
|
|
1198
1320
|
return;
|
|
1199
1321
|
}
|
|
1322
|
+
if (text) recordStreamedDelivery(params.kind, text);
|
|
1200
1323
|
await appendSlackStream({
|
|
1201
1324
|
session: streamSession,
|
|
1202
1325
|
text: "\n" + text,
|
|
1203
1326
|
chunks: completionChunks
|
|
1204
1327
|
});
|
|
1328
|
+
refreshStreamedAcknowledgements(streamSession);
|
|
1205
1329
|
if (completionChunks?.length) nativeProgressCompletionSent = true;
|
|
1206
1330
|
if (streamSession.delivered) {
|
|
1207
1331
|
observedReplyDelivery = true;
|
|
@@ -1244,6 +1368,7 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1244
1368
|
kind: params.kind,
|
|
1245
1369
|
textOverride: text
|
|
1246
1370
|
})) return;
|
|
1371
|
+
throw err;
|
|
1247
1372
|
}
|
|
1248
1373
|
await deliverNormally({
|
|
1249
1374
|
payload: params.payload,
|
|
@@ -1313,7 +1438,7 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1313
1438
|
kind: info.kind,
|
|
1314
1439
|
forcedThreadTs: finalThreadTs
|
|
1315
1440
|
});
|
|
1316
|
-
|
|
1441
|
+
markPreviewPayloadDelivered({
|
|
1317
1442
|
kind: info.kind,
|
|
1318
1443
|
payload,
|
|
1319
1444
|
threadTs: finalThreadTs
|
|
@@ -1363,6 +1488,14 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1363
1488
|
...edit.blocks?.length ? { blocks: edit.blocks } : {},
|
|
1364
1489
|
threadTs: edit.threadTs
|
|
1365
1490
|
});
|
|
1491
|
+
if (!ttsSupplement) emitSlackMessageSentHooks({
|
|
1492
|
+
...messageSentHookContext,
|
|
1493
|
+
to: messageSentHookTarget,
|
|
1494
|
+
accountId: account.accountId,
|
|
1495
|
+
content: trimmedFinalText,
|
|
1496
|
+
success: true,
|
|
1497
|
+
messageId: preview.messageId
|
|
1498
|
+
});
|
|
1366
1499
|
draftPreviewCommitted = true;
|
|
1367
1500
|
observedFinalReplyDelivery = true;
|
|
1368
1501
|
},
|
|
@@ -1372,7 +1505,7 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1372
1505
|
const finalThreadTs = usedReplyThreadTs ?? statusThreadTs;
|
|
1373
1506
|
observedReplyDelivery = true;
|
|
1374
1507
|
replyPlan.markSent();
|
|
1375
|
-
|
|
1508
|
+
if (!ttsSupplement) markPreviewPayloadDelivered({
|
|
1376
1509
|
kind: info.kind,
|
|
1377
1510
|
payload,
|
|
1378
1511
|
threadTs: finalThreadTs
|
|
@@ -1380,9 +1513,16 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1380
1513
|
},
|
|
1381
1514
|
buildSupplementalPayload: () => ttsSupplement ? buildTtsSupplementMediaPayload(payload) : void 0,
|
|
1382
1515
|
deliverSupplemental: async (supplementalPayload) => {
|
|
1383
|
-
|
|
1516
|
+
const previewThreadTs = usedReplyThreadTs ?? statusThreadTs;
|
|
1517
|
+
const supplementalThreadTs = await deliverNormally({
|
|
1384
1518
|
payload: supplementalPayload,
|
|
1385
|
-
kind: info.kind
|
|
1519
|
+
kind: info.kind,
|
|
1520
|
+
forcedThreadTs: previewThreadTs
|
|
1521
|
+
});
|
|
1522
|
+
markPreviewPayloadDelivered({
|
|
1523
|
+
kind: info.kind,
|
|
1524
|
+
payload,
|
|
1525
|
+
threadTs: supplementalThreadTs
|
|
1386
1526
|
});
|
|
1387
1527
|
},
|
|
1388
1528
|
logPreviewEditFailure: (err) => {
|
|
@@ -1792,15 +1932,35 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
1792
1932
|
finalInProgressStatus: dispatchError ? "error" : "complete"
|
|
1793
1933
|
}) : void 0;
|
|
1794
1934
|
if (completionChunks?.length) nativeProgressCompletionSent = true;
|
|
1795
|
-
await stopSlackStream({
|
|
1935
|
+
const stopResult = await stopSlackStream({
|
|
1796
1936
|
session: finalStream,
|
|
1797
1937
|
...completionChunks?.length ? { chunks: completionChunks } : {},
|
|
1798
1938
|
...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
|
|
1799
1939
|
});
|
|
1940
|
+
for (const delivery of streamedDeliveries) delivery.acknowledged = true;
|
|
1941
|
+
emitAcknowledgedStreamedDeliveries(stopResult?.messageId);
|
|
1800
1942
|
} catch (err) {
|
|
1801
1943
|
if (err instanceof SlackStreamNotDeliveredError) streamFallbackDelivered = await deliverPendingStreamFallback(finalStream, err);
|
|
1802
|
-
else
|
|
1944
|
+
else {
|
|
1945
|
+
const error = formatSlackError(err);
|
|
1946
|
+
emitAcknowledgedStreamedDeliveries();
|
|
1947
|
+
emitFailedPendingStreamedDeliveries(error);
|
|
1948
|
+
runtime.error?.(danger(`slack-stream: failed to stop stream: ${error}`));
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
for (const kind of [
|
|
1952
|
+
"tool",
|
|
1953
|
+
"block",
|
|
1954
|
+
"final"
|
|
1955
|
+
]) {
|
|
1956
|
+
const failedStreamedCount = streamedDeliveries.filter((delivery) => delivery.kind === kind && delivery.outcome === "failure").length;
|
|
1957
|
+
const additionalFailedStreamed = Math.max(0, failedStreamedCount - streamedFailuresOwnedByDispatcher[kind]);
|
|
1958
|
+
if (additionalFailedStreamed > 0) counts = {
|
|
1959
|
+
...counts,
|
|
1960
|
+
[kind]: Math.max(0, (counts[kind] ?? 0) - additionalFailedStreamed)
|
|
1961
|
+
};
|
|
1803
1962
|
}
|
|
1963
|
+
queuedFinal = queuedFinal && (counts.final ?? 0) > 0;
|
|
1804
1964
|
const anyReplyDelivered = hasVisibleInboundReplyDispatch({
|
|
1805
1965
|
queuedFinal,
|
|
1806
1966
|
counts
|
|
@@ -2699,7 +2699,7 @@ function createSlackThreadTsResolver(params) {
|
|
|
2699
2699
|
//#region extensions/slack/src/monitor/message-handler.ts
|
|
2700
2700
|
let slackMessagePipelinePromise;
|
|
2701
2701
|
function loadSlackMessagePipeline() {
|
|
2702
|
-
slackMessagePipelinePromise ??= import("./pipeline.runtime-
|
|
2702
|
+
slackMessagePipelinePromise ??= import("./pipeline.runtime-1FYOQOt_.js");
|
|
2703
2703
|
return slackMessagePipelinePromise;
|
|
2704
2704
|
}
|
|
2705
2705
|
const APP_MENTION_RETRY_TTL_MS = 6e4;
|
|
@@ -3341,7 +3341,7 @@ function loadSlashCommandsRuntime() {
|
|
|
3341
3341
|
return slashCommandsRuntimePromise;
|
|
3342
3342
|
}
|
|
3343
3343
|
function loadSlashDispatchRuntime() {
|
|
3344
|
-
slashDispatchRuntimePromise ??= import("./slash-dispatch.runtime-
|
|
3344
|
+
slashDispatchRuntimePromise ??= import("./slash-dispatch.runtime-Dvvs747S.js");
|
|
3345
3345
|
return slashDispatchRuntimePromise;
|
|
3346
3346
|
}
|
|
3347
3347
|
function loadSlackPluginCommandsRuntime() {
|
|
@@ -3777,6 +3777,7 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
3777
3777
|
targetSessionKey: route.sessionKey,
|
|
3778
3778
|
lowercaseSessionKey: true
|
|
3779
3779
|
});
|
|
3780
|
+
const slashReplyTarget = !slashCommand.ephemeral && isRoomish ? `channel:${command.channel_id}` : `user:${command.user_id}`;
|
|
3780
3781
|
const ctxPayload = finalizeInboundContext({
|
|
3781
3782
|
Body: prompt,
|
|
3782
3783
|
BodyForAgent: prompt,
|
|
@@ -3809,7 +3810,7 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
3809
3810
|
CommandSource: "native",
|
|
3810
3811
|
CommandAuthorized: commandAuthorized,
|
|
3811
3812
|
OriginatingChannel: "slack",
|
|
3812
|
-
OriginatingTo:
|
|
3813
|
+
OriginatingTo: slashReplyTarget
|
|
3813
3814
|
});
|
|
3814
3815
|
await recordInboundSessionMetaSafe({
|
|
3815
3816
|
cfg,
|
|
@@ -3831,12 +3832,18 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
3831
3832
|
}) ? compileSlackInteractiveReplies(payload) : payload;
|
|
3832
3833
|
}
|
|
3833
3834
|
});
|
|
3835
|
+
const messageSentHookTarget = ctxPayload.OriginatingTo ?? ctxPayload.To ?? slashReplyTarget;
|
|
3834
3836
|
const deliverSlashPayloads = async (replies) => {
|
|
3835
3837
|
await deliverSlackSlashReplies({
|
|
3836
3838
|
replies,
|
|
3837
3839
|
respond,
|
|
3838
3840
|
ephemeral: slashCommand.ephemeral,
|
|
3839
3841
|
textLimit: ctx.textLimit,
|
|
3842
|
+
messageSentHookTarget,
|
|
3843
|
+
accountId: route.accountId,
|
|
3844
|
+
sessionKeyForInternalHooks: ctxPayload.SessionKey ?? route.sessionKey,
|
|
3845
|
+
isGroup: isRoomish,
|
|
3846
|
+
groupId: isRoomish ? command.channel_id : void 0,
|
|
3840
3847
|
chunkMode: resolveChunkMode(cfg, "slack", route.accountId),
|
|
3841
3848
|
tableMode: resolveMarkdownTableMode({
|
|
3842
3849
|
cfg,
|