@cuylabs/channel-slack 0.8.0 → 0.10.0

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/core.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { S as SlackActivityInfo, b as SlackUserIdentity, a as SlackChannelType } from './activity-ByrD9Ftr.js';
2
+ export { S as SlackApprovalRequest, a as SlackEventInteractiveRequestHandler, b as SlackHumanInputRequest, c as SlackInteractiveMessage, d as SlackInteractiveMessageRef, e as SlackInteractiveRequest, f as SlackInteractiveRequestBaseContext, g as SlackInteractiveRequestContext, h as SlackInteractiveRequestHandler, i as SlackInteractiveRequestKind, j as SlackInteractiveResponder } from './interactive-CbKYkkc_.js';
2
3
  export { RegisterSlackTurnCancelActionOptions, SLACK_TURN_CANCEL_ACTION_ID, SlackTurnCancelActionContext, SlackTurnCancelActionHandler, SlackTurnCancelButtonValue, SlackTurnCancelMessage, SlackTurnCancelMessageOptions, createSlackTurnCancelMessage, decodeSlackTurnCancelButtonValue, encodeSlackTurnCancelButtonValue, registerSlackTurnCancelAction, resolveSlackTurnCancelActionId } from './turn-controls/index.js';
3
4
  import '@slack/types';
4
5
  import '@slack/bolt';
@@ -178,45 +179,6 @@ interface SlackTurnPreparation {
178
179
  context?: Record<string, unknown>;
179
180
  }
180
181
 
181
- /**
182
- * Transport-neutral interactive request contracts.
183
- *
184
- * These types let callers delegate approval and human-input requests to a
185
- * Slack-specific renderer without importing Bolt or Web API types into
186
- * `shared/`.
187
- */
188
-
189
- type SlackInteractiveRequestKind = "approval" | "human-input";
190
- type SlackApprovalRequest = Record<string, unknown>;
191
- type SlackHumanInputRequest = Record<string, unknown>;
192
- type SlackInteractiveRequest = SlackApprovalRequest | SlackHumanInputRequest;
193
- interface SlackInteractiveMessageRef {
194
- channel: string;
195
- ts: string;
196
- }
197
- interface SlackInteractiveMessage {
198
- text: string;
199
- blocks?: unknown[];
200
- }
201
- interface SlackInteractiveResponder {
202
- postMessage(message: SlackInteractiveMessage): Promise<SlackInteractiveMessageRef>;
203
- updateMessage(ref: SlackInteractiveMessageRef, message: SlackInteractiveMessage): Promise<void>;
204
- }
205
- interface SlackInteractiveRequestBaseContext {
206
- kind: SlackInteractiveRequestKind;
207
- request: SlackInteractiveRequest;
208
- fallbackText: string;
209
- }
210
- interface SlackInteractiveRequestContext extends SlackInteractiveRequestBaseContext {
211
- slackActivity: SlackActivityInfo;
212
- user: SlackUserIdentity;
213
- sessionId: string;
214
- message: string;
215
- responder: SlackInteractiveResponder;
216
- }
217
- type SlackInteractiveRequestHandler = (context: SlackInteractiveRequestContext) => boolean | void | Promise<boolean | void>;
218
- type SlackEventInteractiveRequestHandler = (context: SlackInteractiveRequestBaseContext) => boolean | void | Promise<boolean | void>;
219
-
220
182
  /**
221
183
  * Raw Slack event payload parsers — produce `SlackActivityInfo` from the
222
184
  * shapes Bolt delivers for `message` and `app_mention` events.
@@ -425,4 +387,4 @@ interface SlackAmbientTurnContext extends SlackTurnRequestContext {
425
387
  declare function currentSlackTurnContext(): Readonly<SlackAmbientTurnContext> | undefined;
426
388
  declare function runWithSlackTurnContext<T>(value: SlackAmbientTurnContext, fn: () => T | Promise<T>): Promise<T>;
427
389
 
428
- export { type ExtractSlackMessageTextOptions, type RawSlackActionTokenPayload, type RawSlackAppMentionPayload, type RawSlackAssistantThreadPayload, type RawSlackMessagePayload, SlackActivityInfo, type SlackAmbientTurnContext, type SlackApprovalRequest, type SlackAssistantStatusUpdate, type SlackAssistantSuggestedPrompt, type SlackAssistantSuggestedPrompts, type SlackAssistantTaskDisplayMode, type SlackAssistantThreadContext, type SlackAssistantUtilities, type SlackAuthContext, SlackChannelType, type SlackChatStreamStartArgs, type SlackEventInteractiveRequestHandler, type SlackHumanInputRequest, type SlackInteractiveMessage, type SlackInteractiveMessageRef, type SlackInteractiveRequest, type SlackInteractiveRequestBaseContext, type SlackInteractiveRequestContext, type SlackInteractiveRequestHandler, type SlackInteractiveRequestKind, type SlackInteractiveResponder, type SlackMessageAuthorshipOptions, type SlackMessageFormatter, type SlackMessageFormattingOptions, type SlackMessageTextPayload, type SlackThreadStatusSetter, type SlackTurnPreparation, type SlackTurnRequestContext, SlackUserIdentity, currentSlackTurnContext, extractSlackActionToken, extractSlackAttachmentsText, extractSlackAuthContext, extractSlackBlocksText, extractSlackMessageText, extractSlackUserIdentity, formatSlackAttributedFollowUp, isProcessableMessage, markdownToSlackMrkdwn, parseSlackMentionActivity, parseSlackMessageActivity, resolveSlackChannelType, resolveSlackMessageFormatter, resolveThreadAwareSlackSessionId, runWithSlackTurnContext, stripLeadingMentions };
390
+ export { type ExtractSlackMessageTextOptions, type RawSlackActionTokenPayload, type RawSlackAppMentionPayload, type RawSlackAssistantThreadPayload, type RawSlackMessagePayload, SlackActivityInfo, type SlackAmbientTurnContext, type SlackAssistantStatusUpdate, type SlackAssistantSuggestedPrompt, type SlackAssistantSuggestedPrompts, type SlackAssistantTaskDisplayMode, type SlackAssistantThreadContext, type SlackAssistantUtilities, type SlackAuthContext, SlackChannelType, type SlackChatStreamStartArgs, type SlackMessageAuthorshipOptions, type SlackMessageFormatter, type SlackMessageFormattingOptions, type SlackMessageTextPayload, type SlackThreadStatusSetter, type SlackTurnPreparation, type SlackTurnRequestContext, SlackUserIdentity, currentSlackTurnContext, extractSlackActionToken, extractSlackAttachmentsText, extractSlackAuthContext, extractSlackBlocksText, extractSlackMessageText, extractSlackUserIdentity, formatSlackAttributedFollowUp, isProcessableMessage, markdownToSlackMrkdwn, parseSlackMentionActivity, parseSlackMessageActivity, resolveSlackChannelType, resolveSlackMessageFormatter, resolveThreadAwareSlackSessionId, runWithSlackTurnContext, stripLeadingMentions };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  export { S as SlackActivityInfo, a as SlackChannelType, b as SlackUserIdentity } from './activity-ByrD9Ftr.js';
2
- export { ExtractSlackMessageTextOptions, RawSlackActionTokenPayload, RawSlackAppMentionPayload, RawSlackAssistantThreadPayload, RawSlackMessagePayload, SlackAmbientTurnContext, SlackApprovalRequest, SlackAssistantStatusUpdate, SlackAssistantSuggestedPrompt, SlackAssistantSuggestedPrompts, SlackAssistantTaskDisplayMode, SlackAssistantThreadContext, SlackAssistantUtilities, SlackAuthContext, SlackChatStreamStartArgs, SlackEventInteractiveRequestHandler, SlackHumanInputRequest, SlackInteractiveMessage, SlackInteractiveMessageRef, SlackInteractiveRequest, SlackInteractiveRequestBaseContext, SlackInteractiveRequestContext, SlackInteractiveRequestHandler, SlackInteractiveRequestKind, SlackInteractiveResponder, SlackMessageAuthorshipOptions, SlackMessageFormatter, SlackMessageFormattingOptions, SlackMessageTextPayload, SlackThreadStatusSetter, SlackTurnPreparation, SlackTurnRequestContext, currentSlackTurnContext, extractSlackActionToken, extractSlackAttachmentsText, extractSlackAuthContext, extractSlackBlocksText, extractSlackMessageText, extractSlackUserIdentity, formatSlackAttributedFollowUp, isProcessableMessage, markdownToSlackMrkdwn, parseSlackMentionActivity, parseSlackMessageActivity, resolveSlackChannelType, resolveSlackMessageFormatter, resolveThreadAwareSlackSessionId, runWithSlackTurnContext, stripLeadingMentions } from './core.js';
2
+ export { ExtractSlackMessageTextOptions, RawSlackActionTokenPayload, RawSlackAppMentionPayload, RawSlackAssistantThreadPayload, RawSlackMessagePayload, SlackAmbientTurnContext, SlackAssistantStatusUpdate, SlackAssistantSuggestedPrompt, SlackAssistantSuggestedPrompts, SlackAssistantTaskDisplayMode, SlackAssistantThreadContext, SlackAssistantUtilities, SlackAuthContext, SlackChatStreamStartArgs, SlackMessageAuthorshipOptions, SlackMessageFormatter, SlackMessageFormattingOptions, SlackMessageTextPayload, SlackThreadStatusSetter, SlackTurnPreparation, SlackTurnRequestContext, currentSlackTurnContext, extractSlackActionToken, extractSlackAttachmentsText, extractSlackAuthContext, extractSlackBlocksText, extractSlackMessageText, extractSlackUserIdentity, formatSlackAttributedFollowUp, isProcessableMessage, markdownToSlackMrkdwn, parseSlackMentionActivity, parseSlackMessageActivity, resolveSlackChannelType, resolveSlackMessageFormatter, resolveThreadAwareSlackSessionId, runWithSlackTurnContext, stripLeadingMentions } from './core.js';
3
+ export { S as SlackApprovalRequest, a as SlackEventInteractiveRequestHandler, b as SlackHumanInputRequest, c as SlackInteractiveMessage, d as SlackInteractiveMessageRef, e as SlackInteractiveRequest, f as SlackInteractiveRequestBaseContext, g as SlackInteractiveRequestContext, h as SlackInteractiveRequestHandler, i as SlackInteractiveRequestKind, j as SlackInteractiveResponder } from './interactive-CbKYkkc_.js';
3
4
  export { RegisterSlackTurnCancelActionOptions, SLACK_TURN_CANCEL_ACTION_ID, SlackTurnCancelActionContext, SlackTurnCancelActionHandler, SlackTurnCancelButtonValue, SlackTurnCancelMessage, SlackTurnCancelMessageOptions, createSlackTurnCancelMessage, decodeSlackTurnCancelButtonValue, encodeSlackTurnCancelButtonValue, registerSlackTurnCancelAction, resolveSlackTurnCancelActionId } from './turn-controls/index.js';
4
5
  export { InMemorySlackThreadParticipationStateStoreOptions, PostgresSlackMessagePolicyPruneResult, PostgresSlackMessagePolicyStateStore, PostgresSlackMessagePolicyStateStoreOptions, PostgresSlackThreadParticipationStateStore, PostgresSlackThreadParticipationStateStoreOptions, SlackAsyncMessagePolicyConfig, SlackAsyncMessagePolicyResolver, SlackChannelMessagePolicy, SlackMentionedThreadState, SlackMessagePolicyAcceptReason, SlackMessagePolicyAcceptedDecision, SlackMessagePolicyConfig, SlackMessagePolicyDecision, SlackMessagePolicyPostgresClient, SlackMessagePolicyRejectReason, SlackMessagePolicyRejectedDecision, SlackMessagePolicyResolver, SlackMessagePolicyStateContext, SlackMessagePolicyStateStore, SlackQuietThreadRejectedDecision, SlackSyncMessagePolicyStateStore, SlackThreadAwareMessagePolicyConfig, SlackThreadAwareMessagePolicyDecision, SlackThreadAwareMessagePolicyResolver, SlackThreadParticipationEligibility, SlackThreadParticipationEligibilityOptions, SlackThreadParticipationMode, SlackThreadParticipationPostgresClient, SlackThreadParticipationPruneResult, SlackThreadParticipationReactivation, SlackThreadParticipationState, SlackThreadParticipationStateContext, SlackThreadParticipationStateStore, SlackThreadReplyPolicy, createAsyncSlackMessagePolicyResolver, createAsyncSlackThreadAwareMessagePolicyResolver, createInMemorySlackMessagePolicyStateStore, createInMemorySlackThreadParticipationStateStore, createPostgresSlackMessagePolicyStateStore, createPostgresSlackThreadParticipationStateStore, createSlackMessagePolicyMessageKey, createSlackMessagePolicyResolver, createSlackMessagePolicyThreadKey, initializePostgresSlackMessagePolicyState, initializePostgresSlackThreadParticipationState, prunePostgresSlackMessagePolicyState, prunePostgresSlackThreadParticipationState, resolveSlackThreadParticipationEligibility, shouldRegisterSlackPassiveChannelMessages } from './policy/index.js';
6
+ export { SlackEventBridgeOptions, SlackFinalResponseArtifactContext, SlackFinalResponseArtifactDeliveryMode, SlackFinalResponseArtifactPublisher, SlackFinalResponseArtifactResult, SlackTurnApprovalRequestEvent, SlackTurnApprovalResolvedEvent, SlackTurnCompleteEvent, SlackTurnErrorEvent, SlackTurnEvent, SlackTurnEventBase, SlackTurnHumanInputRequestEvent, SlackTurnHumanInputResolvedEvent, SlackTurnReasoningEndEvent, SlackTurnReasoningStartEvent, SlackTurnSource, SlackTurnSourceChatOptions, SlackTurnStatus, SlackTurnStatusEvent, SlackTurnSubagentCompleteEvent, SlackTurnSubagentErrorEvent, SlackTurnSubagentEventBase, SlackTurnSubagentEventEvent, SlackTurnSubagentStartEvent, SlackTurnTextDeltaEvent, SlackTurnTextEndEvent, SlackTurnTextStartEvent, SlackTurnToolErrorEvent, SlackTurnToolResultEvent, SlackTurnToolStartEvent, UnsupportedSlackInteractiveRequestError, bridgeSlackTurnEventsToSlack, resolveSlackEventBridgeOptions } from './runtime/index.js';
5
7
  export { L as Logger } from './logging-Bl3HfcC8.js';
6
8
  import '@slack/types';
7
9
  import '@slack/bolt';
10
+ import './types-C8nkPuD4.js';
11
+ import './types-Cywfj8Mj.js';
12
+ import './responses/index.js';
package/dist/index.js CHANGED
@@ -15,6 +15,11 @@ import {
15
15
  resolveSlackThreadParticipationEligibility,
16
16
  shouldRegisterSlackPassiveChannelMessages
17
17
  } from "./chunk-DNVSH7H5.js";
18
+ import {
19
+ UnsupportedSlackInteractiveRequestError,
20
+ bridgeSlackTurnEventsToSlack,
21
+ resolveSlackEventBridgeOptions
22
+ } from "./chunk-IAQXQESO.js";
18
23
  import {
19
24
  currentSlackTurnContext,
20
25
  formatSlackAttributedFollowUp,
@@ -50,6 +55,8 @@ import {
50
55
  } from "./chunk-FPCE5V5Y.js";
51
56
  export {
52
57
  SLACK_TURN_CANCEL_ACTION_ID,
58
+ UnsupportedSlackInteractiveRequestError,
59
+ bridgeSlackTurnEventsToSlack,
53
60
  createAsyncSlackMessagePolicyResolver,
54
61
  createAsyncSlackThreadAwareMessagePolicyResolver,
55
62
  createInMemorySlackMessagePolicyStateStore,
@@ -80,6 +87,7 @@ export {
80
87
  prunePostgresSlackThreadParticipationState,
81
88
  registerSlackTurnCancelAction,
82
89
  resolveSlackChannelType,
90
+ resolveSlackEventBridgeOptions,
83
91
  resolveSlackMessageFormatter,
84
92
  resolveSlackThreadParticipationEligibility,
85
93
  resolveSlackTurnCancelActionId,
@@ -0,0 +1,67 @@
1
+ import { c as SlackInteractiveApprovalRequest, S as SlackInteractiveActionIds, e as SlackInteractiveHumanInputRequest, l as SlackInteractiveResolution, i as SlackInteractiveRequestRecord, k as SlackInteractiveRequestStore } from '../types-Cywfj8Mj.js';
2
+ export { a as SlackInteractiveActor, b as SlackInteractiveApprovalAction, d as SlackInteractiveHumanInputOption, f as SlackInteractiveHumanInputResponse, g as SlackInteractiveMessageTarget, h as SlackInteractiveRequestHandler, j as SlackInteractiveRequestStatus, m as SlackInteractiveStoredRequest } from '../types-Cywfj8Mj.js';
3
+ import { View } from '@slack/types';
4
+ export { c as SlackInteractiveMessage, d as SlackInteractiveMessageRef, f as SlackInteractiveRequestBaseContext, g as SlackInteractiveRequestContext, i as SlackInteractiveRequestKind, j as SlackInteractiveResponder } from '../interactive-CbKYkkc_.js';
5
+ import '../activity-ByrD9Ftr.js';
6
+
7
+ declare function buildApprovalRequestMessage(request: SlackInteractiveApprovalRequest, actionIds: SlackInteractiveActionIds): {
8
+ text: string;
9
+ blocks: unknown[];
10
+ };
11
+ declare function buildHumanInputRequestMessage(request: SlackInteractiveHumanInputRequest, actionIds: SlackInteractiveActionIds): {
12
+ text: string;
13
+ blocks: unknown[];
14
+ };
15
+ declare function buildResolvedMessage(label: string, resolution: SlackInteractiveResolution): {
16
+ text: string;
17
+ blocks: unknown[];
18
+ };
19
+ declare function buildHumanInputModal(request: SlackInteractiveHumanInputRequest, actionIds: SlackInteractiveActionIds): View;
20
+ declare function encodeActionValue(payload: Record<string, unknown>): string;
21
+ declare function decodeActionValue(value: unknown): Record<string, unknown>;
22
+
23
+ declare function createInMemorySlackInteractiveRequestStore(): SlackInteractiveRequestStore;
24
+ declare function nowIso(): string;
25
+ declare function cloneRecord(record: SlackInteractiveRequestRecord): SlackInteractiveRequestRecord;
26
+
27
+ interface SlackInteractivePostgresClient {
28
+ end?: () => Promise<void>;
29
+ query<T = unknown>(sql: string, values?: readonly unknown[]): Promise<{
30
+ rows: T[];
31
+ rowCount?: number | null;
32
+ }>;
33
+ }
34
+ interface PostgresSlackInteractiveRequestStoreOptions {
35
+ client?: SlackInteractivePostgresClient;
36
+ connectionString?: string;
37
+ ensureSchema?: boolean;
38
+ onPruneError?: (error: unknown) => void;
39
+ pruneBatchSize?: number;
40
+ pruneIntervalMs?: number;
41
+ retentionMs?: number;
42
+ schema?: string;
43
+ tableName?: string;
44
+ }
45
+ interface PostgresSlackInteractiveRequestStore extends SlackInteractiveRequestStore {
46
+ close(): Promise<void>;
47
+ prune(): Promise<PostgresSlackInteractiveRequestPruneResult>;
48
+ }
49
+ interface PostgresSlackInteractiveRequestPruneResult {
50
+ deleted: number;
51
+ }
52
+ declare function createPostgresSlackInteractiveRequestStore({ client, connectionString, ensureSchema, onPruneError, pruneBatchSize, pruneIntervalMs, retentionMs, schema, tableName, }: PostgresSlackInteractiveRequestStoreOptions): PostgresSlackInteractiveRequestStore;
53
+ declare function initializePostgresSlackInteractiveRequestStore({ client, ensureSchema, schema, tableName, }: {
54
+ client: SlackInteractivePostgresClient;
55
+ ensureSchema?: boolean;
56
+ schema?: string;
57
+ tableName?: string;
58
+ }): Promise<void>;
59
+ declare function prunePostgresSlackInteractiveRequestStore({ client, pruneBatchSize, retentionMs, schema, tableName, }: {
60
+ client: SlackInteractivePostgresClient;
61
+ pruneBatchSize?: number;
62
+ retentionMs?: number;
63
+ schema?: string;
64
+ tableName?: string;
65
+ }): Promise<PostgresSlackInteractiveRequestPruneResult>;
66
+
67
+ export { type PostgresSlackInteractiveRequestPruneResult, type PostgresSlackInteractiveRequestStore, type PostgresSlackInteractiveRequestStoreOptions, SlackInteractiveActionIds, SlackInteractiveApprovalRequest, SlackInteractiveHumanInputRequest, type SlackInteractivePostgresClient, SlackInteractiveRequestRecord, SlackInteractiveRequestStore, SlackInteractiveResolution, buildApprovalRequestMessage, buildHumanInputModal, buildHumanInputRequestMessage, buildResolvedMessage, cloneRecord, createInMemorySlackInteractiveRequestStore, createPostgresSlackInteractiveRequestStore, decodeActionValue, encodeActionValue, initializePostgresSlackInteractiveRequestStore, nowIso, prunePostgresSlackInteractiveRequestStore };