@cuylabs/channel-slack-agent-core 0.7.0 → 0.9.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/README.md +4 -2
- package/dist/adapter/index.d.ts +6 -5
- package/dist/adapter/index.js +2 -2
- package/dist/{adapter-B3CI611y.d.ts → adapter-vbqtraAr.d.ts} +1 -1
- package/dist/app-surface.d.ts +6 -5
- package/dist/app-surface.js +4 -4
- package/dist/app.d.ts +6 -5
- package/dist/app.js +5 -5
- package/dist/assistant/index.d.ts +5 -4
- package/dist/assistant/index.js +2 -2
- package/dist/{chunk-TCNJY7QA.js → chunk-D4CSEAIF.js} +1 -1
- package/dist/{chunk-MGBNGG4D.js → chunk-FJP6ZFUB.js} +241 -4
- package/dist/{chunk-7DUO5BMW.js → chunk-GKZRDNEB.js} +4 -25
- package/dist/{chunk-VMVQIDNR.js → chunk-HHXAXSG6.js} +2 -2
- package/dist/{chunk-DJPKRKGP.js → chunk-JU5R6JZG.js} +1 -1
- package/dist/{chunk-76SRS54H.js → chunk-KAEZPS3U.js} +1 -1
- package/dist/chunk-OP27SSZU.js +409 -0
- package/dist/{chunk-FQWFB54C.js → chunk-XA7U3GRN.js} +1 -1
- package/dist/express-assistant.d.ts +4 -3
- package/dist/express-assistant.js +3 -3
- package/dist/express.d.ts +5 -4
- package/dist/express.js +3 -3
- package/dist/history/index.d.ts +6 -5
- package/dist/index.d.ts +11 -10
- package/dist/index.js +10 -34
- package/dist/interactive/index.d.ts +5 -65
- package/dist/interactive/index.js +3 -27
- package/dist/interactive-BigrPKnu.d.ts +30 -0
- package/dist/{options-CdqBABcM.d.ts → options-ByNm2o89.d.ts} +38 -3
- package/dist/{options-BcDReOJv.d.ts → options-CGUfVStV.d.ts} +1 -1
- package/dist/shared/index.d.ts +7 -76
- package/dist/shared/index.js +1 -1
- package/dist/socket.d.ts +6 -5
- package/dist/socket.js +5 -5
- package/dist/{types-CRWzJB5G.d.ts → types-BeGPexio.d.ts} +2 -2
- package/dist/{types-Crpil4kb.d.ts → types-Bz4OYEAV.d.ts} +6 -55
- package/docs/concepts/interactive-requests.md +7 -7
- package/docs/reference/boundary.md +5 -3
- package/docs/reference/exports.md +18 -18
- package/package.json +2 -2
- package/dist/chunk-X7ILLZZP.js +0 -1046
- package/dist/interactive-o_NZb-Xg.d.ts +0 -47
- /package/dist/{chunk-TMADMHBN.js → chunk-VBGQD6JT.js} +0 -0
|
@@ -1,71 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { View } from '@slack/types';
|
|
1
|
+
import { b as SlackInteractiveControllerOptions, a as SlackInteractiveController } from '../types-Bz4OYEAV.js';
|
|
2
|
+
export { S as SlackInteractiveApprovalRequest, c as SlackInteractiveHumanInputRequest, d as SlackInteractivePendingWaiter, e as SlackInteractivePostedMessage, f as SlackInteractiveRequestWaitOptions, g as SlackInteractiveResolution } from '../types-Bz4OYEAV.js';
|
|
4
3
|
import '@cuylabs/agent-core';
|
|
4
|
+
import '@cuylabs/channel-slack/interactive';
|
|
5
5
|
import '@slack/bolt';
|
|
6
|
-
import '../interactive-
|
|
6
|
+
import '../interactive-BigrPKnu.js';
|
|
7
7
|
import '@cuylabs/channel-slack/core';
|
|
8
8
|
|
|
9
|
-
declare function createInMemorySlackInteractiveRequestStore(): SlackInteractiveRequestStore;
|
|
10
|
-
declare function nowIso(): string;
|
|
11
|
-
declare function cloneRecord(record: SlackInteractiveRequestRecord): SlackInteractiveRequestRecord;
|
|
12
|
-
|
|
13
|
-
interface SlackInteractivePostgresClient {
|
|
14
|
-
end?: () => Promise<void>;
|
|
15
|
-
query<T = unknown>(sql: string, values?: readonly unknown[]): Promise<{
|
|
16
|
-
rows: T[];
|
|
17
|
-
rowCount?: number | null;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
interface PostgresSlackInteractiveRequestStoreOptions {
|
|
21
|
-
client?: SlackInteractivePostgresClient;
|
|
22
|
-
connectionString?: string;
|
|
23
|
-
ensureSchema?: boolean;
|
|
24
|
-
onPruneError?: (error: unknown) => void;
|
|
25
|
-
pruneBatchSize?: number;
|
|
26
|
-
pruneIntervalMs?: number;
|
|
27
|
-
retentionMs?: number;
|
|
28
|
-
schema?: string;
|
|
29
|
-
tableName?: string;
|
|
30
|
-
}
|
|
31
|
-
interface PostgresSlackInteractiveRequestStore extends SlackInteractiveRequestStore {
|
|
32
|
-
close(): Promise<void>;
|
|
33
|
-
prune(): Promise<PostgresSlackInteractiveRequestPruneResult>;
|
|
34
|
-
}
|
|
35
|
-
interface PostgresSlackInteractiveRequestPruneResult {
|
|
36
|
-
deleted: number;
|
|
37
|
-
}
|
|
38
|
-
declare function createPostgresSlackInteractiveRequestStore({ client, connectionString, ensureSchema, onPruneError, pruneBatchSize, pruneIntervalMs, retentionMs, schema, tableName, }: PostgresSlackInteractiveRequestStoreOptions): PostgresSlackInteractiveRequestStore;
|
|
39
|
-
declare function initializePostgresSlackInteractiveRequestStore({ client, ensureSchema, schema, tableName, }: {
|
|
40
|
-
client: SlackInteractivePostgresClient;
|
|
41
|
-
ensureSchema?: boolean;
|
|
42
|
-
schema?: string;
|
|
43
|
-
tableName?: string;
|
|
44
|
-
}): Promise<void>;
|
|
45
|
-
declare function prunePostgresSlackInteractiveRequestStore({ client, pruneBatchSize, retentionMs, schema, tableName, }: {
|
|
46
|
-
client: SlackInteractivePostgresClient;
|
|
47
|
-
pruneBatchSize?: number;
|
|
48
|
-
retentionMs?: number;
|
|
49
|
-
schema?: string;
|
|
50
|
-
tableName?: string;
|
|
51
|
-
}): Promise<PostgresSlackInteractiveRequestPruneResult>;
|
|
52
|
-
|
|
53
|
-
declare function buildApprovalRequestMessage(request: SlackInteractiveApprovalRequest, actionIds: SlackInteractiveActionIds): {
|
|
54
|
-
text: string;
|
|
55
|
-
blocks: unknown[];
|
|
56
|
-
};
|
|
57
|
-
declare function buildHumanInputRequestMessage(request: SlackInteractiveHumanInputRequest, actionIds: SlackInteractiveActionIds): {
|
|
58
|
-
text: string;
|
|
59
|
-
blocks: unknown[];
|
|
60
|
-
};
|
|
61
|
-
declare function buildResolvedMessage(label: string, resolution: SlackInteractiveResolution): {
|
|
62
|
-
text: string;
|
|
63
|
-
blocks: unknown[];
|
|
64
|
-
};
|
|
65
|
-
declare function buildHumanInputModal(request: SlackInteractiveHumanInputRequest, actionIds: SlackInteractiveActionIds): View;
|
|
66
|
-
declare function encodeActionValue(payload: Record<string, unknown>): string;
|
|
67
|
-
declare function decodeActionValue(value: unknown): Record<string, unknown>;
|
|
68
|
-
|
|
69
9
|
declare function createSlackInteractiveController(options?: SlackInteractiveControllerOptions): SlackInteractiveController;
|
|
70
10
|
|
|
71
|
-
export {
|
|
11
|
+
export { SlackInteractiveController, SlackInteractiveControllerOptions, createSlackInteractiveController };
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
buildHumanInputRequestMessage,
|
|
5
|
-
buildResolvedMessage,
|
|
6
|
-
cloneRecord,
|
|
7
|
-
createInMemorySlackInteractiveRequestStore,
|
|
8
|
-
createPostgresSlackInteractiveRequestStore,
|
|
9
|
-
createSlackInteractiveController,
|
|
10
|
-
decodeActionValue,
|
|
11
|
-
encodeActionValue,
|
|
12
|
-
initializePostgresSlackInteractiveRequestStore,
|
|
13
|
-
nowIso,
|
|
14
|
-
prunePostgresSlackInteractiveRequestStore
|
|
15
|
-
} from "../chunk-X7ILLZZP.js";
|
|
2
|
+
createSlackInteractiveController
|
|
3
|
+
} from "../chunk-OP27SSZU.js";
|
|
16
4
|
export {
|
|
17
|
-
|
|
18
|
-
buildHumanInputModal,
|
|
19
|
-
buildHumanInputRequestMessage,
|
|
20
|
-
buildResolvedMessage,
|
|
21
|
-
cloneRecord,
|
|
22
|
-
createInMemorySlackInteractiveRequestStore,
|
|
23
|
-
createPostgresSlackInteractiveRequestStore,
|
|
24
|
-
createSlackInteractiveController,
|
|
25
|
-
decodeActionValue,
|
|
26
|
-
encodeActionValue,
|
|
27
|
-
initializePostgresSlackInteractiveRequestStore,
|
|
28
|
-
nowIso,
|
|
29
|
-
prunePostgresSlackInteractiveRequestStore
|
|
5
|
+
createSlackInteractiveController
|
|
30
6
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AgentEvent } from '@cuylabs/agent-core';
|
|
2
|
+
import { SlackInteractiveRequestBaseContext as SlackInteractiveRequestBaseContext$1, SlackInteractiveRequestContext as SlackInteractiveRequestContext$1 } from '@cuylabs/channel-slack/interactive';
|
|
3
|
+
import { SlackActivityInfo, SlackUserIdentity } from '@cuylabs/channel-slack/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Agent Core interactive request contracts for the Slack event bridge.
|
|
7
|
+
*
|
|
8
|
+
* Generic Slack message/responder primitives live in `@cuylabs/channel-slack`.
|
|
9
|
+
* This module narrows the request payloads to Agent Core events.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
type SlackApprovalRequest = Extract<AgentEvent, {
|
|
13
|
+
type: "approval-request";
|
|
14
|
+
}>["request"];
|
|
15
|
+
type SlackHumanInputRequest = Extract<AgentEvent, {
|
|
16
|
+
type: "human-input-request";
|
|
17
|
+
}>["request"];
|
|
18
|
+
type SlackInteractiveRequest = SlackApprovalRequest | SlackHumanInputRequest;
|
|
19
|
+
interface SlackInteractiveRequestBaseContext extends Omit<SlackInteractiveRequestBaseContext$1, "request"> {
|
|
20
|
+
request: SlackInteractiveRequest;
|
|
21
|
+
}
|
|
22
|
+
interface SlackInteractiveRequestContext extends Omit<SlackInteractiveRequestContext$1, "request"> {
|
|
23
|
+
slackActivity: SlackActivityInfo;
|
|
24
|
+
user: SlackUserIdentity;
|
|
25
|
+
request: SlackInteractiveRequest;
|
|
26
|
+
}
|
|
27
|
+
type SlackInteractiveRequestHandler = (context: SlackInteractiveRequestContext) => boolean | void | Promise<boolean | void>;
|
|
28
|
+
type SlackEventInteractiveRequestHandler = (context: SlackInteractiveRequestBaseContext) => boolean | void | Promise<boolean | void>;
|
|
29
|
+
|
|
30
|
+
export type { SlackApprovalRequest as S, SlackEventInteractiveRequestHandler as a, SlackHumanInputRequest as b, SlackInteractiveRequest as c, SlackInteractiveRequestBaseContext as d, SlackInteractiveRequestContext as e, SlackInteractiveRequestHandler as f };
|
|
@@ -2,11 +2,34 @@ import { AgentTurnSource, AgentEvent, Logger } from '@cuylabs/agent-core';
|
|
|
2
2
|
import { AssistantUserMessageMiddleware, AssistantThreadStartedMiddleware, Assistant, App } from '@slack/bolt';
|
|
3
3
|
import { WebClient } from '@slack/web-api';
|
|
4
4
|
import { SlackAuthContext, SlackAssistantThreadContext, SlackAssistantUtilities, SlackTurnPreparation, SlackAssistantTaskDisplayMode, SlackAssistantStatusUpdate, SlackAssistantSuggestedPrompts, SlackChatStreamStartArgs, SlackMessageFormattingOptions } from '@cuylabs/channel-slack/core';
|
|
5
|
-
import {
|
|
6
|
-
import { S as SlackEventBridgeOptions } from './options-
|
|
5
|
+
import { f as SlackInteractiveRequestHandler } from './interactive-BigrPKnu.js';
|
|
6
|
+
import { S as SlackEventBridgeOptions } from './options-CGUfVStV.js';
|
|
7
7
|
import { SlackFeedbackBlockOptions, SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
|
|
8
8
|
import { ParsedAssistantUserMessage } from '@cuylabs/channel-slack/assistant';
|
|
9
9
|
|
|
10
|
+
type SlackAssistantCancelControlVisibleWhen = "before-output" | "always-while-active";
|
|
11
|
+
interface SlackAssistantCancelControlOptions {
|
|
12
|
+
actionId?: string;
|
|
13
|
+
buttonText?: string;
|
|
14
|
+
messageText?: string;
|
|
15
|
+
visibleWhen?: SlackAssistantCancelControlVisibleWhen;
|
|
16
|
+
canceledAck?: string | false;
|
|
17
|
+
alreadyCompletedAck?: string | false;
|
|
18
|
+
unauthorizedAck?: string | false;
|
|
19
|
+
onCancel?: (context: SlackAssistantTurnCancelContext) => MaybePromise<void>;
|
|
20
|
+
}
|
|
21
|
+
interface SlackAssistantTurnControlsOptions {
|
|
22
|
+
cancel?: true | SlackAssistantCancelControlOptions;
|
|
23
|
+
}
|
|
24
|
+
interface SlackAssistantTurnCancelContext {
|
|
25
|
+
controlId: string;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
channelId: string;
|
|
28
|
+
threadTs: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
teamId?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
10
33
|
/**
|
|
11
34
|
* Session strategies for the Bolt Assistant bridge.
|
|
12
35
|
*
|
|
@@ -187,6 +210,13 @@ interface CreateSlackAssistantBridgeOptions {
|
|
|
187
210
|
* - `false`: omit the feedback block entirely.
|
|
188
211
|
*/
|
|
189
212
|
feedback?: SlackAssistantFeedbackConfig | false;
|
|
213
|
+
/**
|
|
214
|
+
* Optional active-turn controls rendered in Slack while an assistant turn is
|
|
215
|
+
* running. The cancel control aborts the underlying `AgentTurnSource` via
|
|
216
|
+
* the per-turn `AbortSignal`, so any runtime implementing that contract can
|
|
217
|
+
* participate without Slack-specific code.
|
|
218
|
+
*/
|
|
219
|
+
turnControls?: SlackAssistantTurnControlsOptions;
|
|
190
220
|
/**
|
|
191
221
|
* Bridge options forwarded to `bridgeAgentEventsToSlack`. Streaming mode is
|
|
192
222
|
* pinned to `"chat-stream"` and cannot be overridden here.
|
|
@@ -283,6 +313,11 @@ interface SlackAssistantBridge {
|
|
|
283
313
|
* The resolved feedback action id, or `undefined` when feedback is disabled.
|
|
284
314
|
*/
|
|
285
315
|
feedbackActionId?: string;
|
|
316
|
+
/**
|
|
317
|
+
* The resolved cancel action id, or `undefined` when turn cancel controls are
|
|
318
|
+
* disabled.
|
|
319
|
+
*/
|
|
320
|
+
turnCancelActionId?: string;
|
|
286
321
|
}
|
|
287
322
|
|
|
288
|
-
export { type AssistantLifecycleArgs as A, type CreateSlackAssistantBridgeOptions as C, type MaybePromise as M, type SlackAssistantBridge as S, type AssistantThreadStartedArgs as a, type
|
|
323
|
+
export { type AssistantLifecycleArgs as A, type CreateSlackAssistantBridgeOptions as C, type MaybePromise as M, type SlackAssistantBridge as S, type AssistantThreadStartedArgs as a, type SlackAssistantCancelControlOptions as b, type SlackAssistantCancelControlVisibleWhen as c, type SlackAssistantFeedbackConfig as d, type SlackAssistantSessionStrategy as e, type SlackAssistantStatusContext as f, type SlackAssistantThreadContextStoreLike as g, type SlackAssistantThreadStartedContext as h, type SlackAssistantTurnCancelContext as i, type SlackAssistantTurnControlsOptions as j, type SlackAssistantTurnPreparation as k, type SlackAssistantUserMessageContext as l, resolveAssistantSessionId as r };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentEvent, ApprovalEvent } from '@cuylabs/agent-core';
|
|
2
2
|
import { SlackFinalResponseArtifactPublisher, SlackFinalResponseArtifactDeliveryMode, SlackFinalResponseArtifactContext, SlackFinalResponseArtifactResult } from './artifacts/index.js';
|
|
3
|
-
import { a as SlackEventInteractiveRequestHandler } from './interactive-
|
|
3
|
+
import { a as SlackEventInteractiveRequestHandler } from './interactive-BigrPKnu.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Event-bridge configuration. The bridge is mode-aware (progressive,
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,82 +1,13 @@
|
|
|
1
1
|
export { D as DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY, S as SlackContextFragmentMiddlewareOptions, a as SlackContextFragmentPayload, b as SlackContextFragmentResolver, c as SlackContextFragmentResolverContext, d as createSlackContextFragmentMiddleware } from '../context-fragments-CQEDcjYR.js';
|
|
2
2
|
import { AgentEvent } from '@cuylabs/agent-core';
|
|
3
|
-
import { S as SlackEventBridgeOptions } from '../options-
|
|
4
|
-
export { r as resolveSlackEventBridgeOptions } from '../options-
|
|
5
|
-
import {
|
|
6
|
-
export { S as SlackApprovalRequest, a as SlackEventInteractiveRequestHandler, b as SlackHumanInputRequest, c as
|
|
3
|
+
import { S as SlackEventBridgeOptions } from '../options-CGUfVStV.js';
|
|
4
|
+
export { r as resolveSlackEventBridgeOptions } from '../options-CGUfVStV.js';
|
|
5
|
+
import { SlackResponseSink } from '@cuylabs/channel-slack/responses';
|
|
6
|
+
export { S as SlackApprovalRequest, a as SlackEventInteractiveRequestHandler, b as SlackHumanInputRequest, c as SlackInteractiveRequest, d as SlackInteractiveRequestBaseContext, e as SlackInteractiveRequestContext, f as SlackInteractiveRequestHandler } from '../interactive-BigrPKnu.js';
|
|
7
7
|
import '@cuylabs/channel-slack/core';
|
|
8
8
|
import '../artifacts/index.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Slack response-sink contracts consumed by the event bridge.
|
|
12
|
-
*
|
|
13
|
-
* The adapter constructs a `SlackResponseSink` from the Bolt `say` function
|
|
14
|
-
* and `WebClient` instance available in each handler. Keeping the sink
|
|
15
|
-
* interface separate makes the bridge testable without a live Slack
|
|
16
|
-
* connection.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
type SlackStreamTaskStatus = "pending" | "in_progress" | "complete" | "error";
|
|
20
|
-
type SlackStreamChunk = {
|
|
21
|
-
type: "markdown_text";
|
|
22
|
-
text: string;
|
|
23
|
-
} | {
|
|
24
|
-
type: "plan_update";
|
|
25
|
-
title: string;
|
|
26
|
-
} | {
|
|
27
|
-
type: "task_update";
|
|
28
|
-
id: string;
|
|
29
|
-
title: string;
|
|
30
|
-
status: SlackStreamTaskStatus;
|
|
31
|
-
details?: string;
|
|
32
|
-
output?: string;
|
|
33
|
-
};
|
|
34
|
-
interface SlackChatStream {
|
|
35
|
-
append(args: {
|
|
36
|
-
markdown_text?: string;
|
|
37
|
-
chunks?: SlackStreamChunk[];
|
|
38
|
-
}): Promise<unknown>;
|
|
39
|
-
stop(args?: {
|
|
40
|
-
markdown_text?: string;
|
|
41
|
-
chunks?: SlackStreamChunk[];
|
|
42
|
-
}): Promise<unknown>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Minimal Slack posting interface consumed by the event bridge.
|
|
46
|
-
*/
|
|
47
|
-
interface SlackArtifactPublicationTarget {
|
|
48
|
-
channelId: string;
|
|
49
|
-
threadTs?: string;
|
|
50
|
-
}
|
|
51
|
-
interface SlackResponseSink {
|
|
52
|
-
/**
|
|
53
|
-
* Slack Web API surface used by optional artifact publishers.
|
|
54
|
-
*/
|
|
55
|
-
artifactClient?: SlackArtifactClient;
|
|
56
|
-
/**
|
|
57
|
-
* Channel/thread target used by optional artifact publishers.
|
|
58
|
-
*/
|
|
59
|
-
artifactTarget?: SlackArtifactPublicationTarget;
|
|
60
|
-
/**
|
|
61
|
-
* Post a new message to the channel / thread.
|
|
62
|
-
* Returns the channel ID and message timestamp needed for updates.
|
|
63
|
-
*/
|
|
64
|
-
postMessage(text: string): Promise<{
|
|
65
|
-
channel: string;
|
|
66
|
-
ts: string;
|
|
67
|
-
}>;
|
|
68
|
-
/**
|
|
69
|
-
* Update an existing message by channel + ts.
|
|
70
|
-
*/
|
|
71
|
-
updateMessage(channel: string, ts: string, text: string): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Create a native Slack chat stream. Required when `streamingMode` is
|
|
74
|
-
* `"chat-stream"`.
|
|
75
|
-
*/
|
|
76
|
-
createChatStream?(options: {
|
|
77
|
-
bufferSize: number;
|
|
78
|
-
}): SlackChatStream;
|
|
79
|
-
}
|
|
9
|
+
import '@cuylabs/channel-slack/artifacts';
|
|
10
|
+
import '@cuylabs/channel-slack/interactive';
|
|
80
11
|
|
|
81
12
|
/**
|
|
82
13
|
* Event bridge — maps an agent-core `AgentEvent` stream to a Slack
|
|
@@ -114,4 +45,4 @@ declare class UnsupportedSlackInteractiveRequestError extends Error {
|
|
|
114
45
|
constructor(kind: "approval" | "human-input", requestId: string, message: string);
|
|
115
46
|
}
|
|
116
47
|
|
|
117
|
-
export {
|
|
48
|
+
export { SlackEventBridgeOptions, UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack };
|
package/dist/shared/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
UnsupportedSlackInteractiveRequestError,
|
|
7
7
|
bridgeAgentEventsToSlack,
|
|
8
8
|
resolveSlackEventBridgeOptions
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-VBGQD6JT.js";
|
|
10
10
|
export {
|
|
11
11
|
DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
|
|
12
12
|
UnsupportedSlackInteractiveRequestError,
|
package/dist/socket.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { App } from '@slack/bolt';
|
|
2
2
|
import { CreateSlackSocketBoltAppOptions } from '@cuylabs/channel-slack/transports/socket';
|
|
3
3
|
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
4
|
-
import { S as SlackAssistantBridge, C as CreateSlackAssistantBridgeOptions,
|
|
4
|
+
import { S as SlackAssistantBridge, C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig } from './options-ByNm2o89.js';
|
|
5
5
|
import { SlackAgentAppSurfaceOptions } from './app-surface.js';
|
|
6
6
|
import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
|
|
7
7
|
import '@cuylabs/agent-core';
|
|
8
8
|
import '@slack/web-api';
|
|
9
9
|
import '@cuylabs/channel-slack/core';
|
|
10
|
-
import './interactive-
|
|
11
|
-
import '
|
|
10
|
+
import './interactive-BigrPKnu.js';
|
|
11
|
+
import '@cuylabs/channel-slack/interactive';
|
|
12
|
+
import './options-CGUfVStV.js';
|
|
12
13
|
import './artifacts/index.js';
|
|
13
14
|
import '@cuylabs/channel-slack/artifacts';
|
|
14
15
|
import '@cuylabs/channel-slack/assistant';
|
|
15
|
-
import './types-
|
|
16
|
-
import './types-
|
|
16
|
+
import './types-BeGPexio.js';
|
|
17
|
+
import './types-Bz4OYEAV.js';
|
|
17
18
|
import './types-CiwGU6zC.js';
|
|
18
19
|
import '@cuylabs/channel-slack/views';
|
|
19
20
|
|
package/dist/socket.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mountSlackAgentAppSocket,
|
|
3
3
|
mountSlackAssistantAgentSocket
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-HHXAXSG6.js";
|
|
5
|
+
import "./chunk-GKZRDNEB.js";
|
|
6
|
+
import "./chunk-FJP6ZFUB.js";
|
|
7
7
|
import "./chunk-ELR6MQD7.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-XA7U3GRN.js";
|
|
9
|
+
import "./chunk-VBGQD6JT.js";
|
|
10
10
|
export {
|
|
11
11
|
mountSlackAgentAppSocket,
|
|
12
12
|
mountSlackAssistantAgentSocket
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Agent, AgentTurnSource, AgentEvent, ApprovalEvent, Logger } from '@cuylabs/agent-core';
|
|
2
2
|
import { SlackActivityInfo, SlackTurnRequestContext, SlackAssistantStatusUpdate, SlackChatStreamStartArgs, SlackUserIdentity, SlackTurnPreparation } from '@cuylabs/channel-slack/core';
|
|
3
|
-
import { S as SlackEventBridgeOptions } from './options-
|
|
4
|
-
import {
|
|
3
|
+
import { S as SlackEventBridgeOptions } from './options-CGUfVStV.js';
|
|
4
|
+
import { f as SlackInteractiveRequestHandler } from './interactive-BigrPKnu.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Channel-options + adapter contract for the direct Slack adapter
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApprovalRequest, ApprovalResolution, HumanInputRequest, HumanInputResponse, ApprovalAction, ApprovalRememberScope } from '@cuylabs/agent-core';
|
|
2
|
+
import { SlackInteractiveActionIds, SlackInteractiveRequestStore, SlackInteractiveRequestRecord, SlackInteractiveActor, SlackInteractiveHumanInputRequest as SlackInteractiveHumanInputRequest$1, SlackInteractiveMessageRef } from '@cuylabs/channel-slack/interactive';
|
|
2
3
|
import { App } from '@slack/bolt';
|
|
3
|
-
import {
|
|
4
|
+
import { e as SlackInteractiveRequestContext } from './interactive-BigrPKnu.js';
|
|
4
5
|
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type SlackInteractiveHumanInputRequest = SlackHumanInputRequest & Partial<Pick<HumanInputRequest, "sessionId" | "timestamp" | "toolCallId">>;
|
|
8
|
-
type SlackInteractiveStoredRequest = SlackInteractiveApprovalRequest | SlackInteractiveHumanInputRequest;
|
|
6
|
+
type SlackInteractiveApprovalRequest = ApprovalRequest;
|
|
7
|
+
type SlackInteractiveHumanInputRequest = SlackInteractiveHumanInputRequest$1 & Partial<Pick<HumanInputRequest, "sessionId" | "timestamp" | "toolCallId">>;
|
|
9
8
|
type SlackInteractiveResolution = {
|
|
10
9
|
kind: "approval";
|
|
11
10
|
action: ApprovalAction;
|
|
@@ -15,54 +14,6 @@ type SlackInteractiveResolution = {
|
|
|
15
14
|
kind: "human-input";
|
|
16
15
|
response: HumanInputResponse;
|
|
17
16
|
};
|
|
18
|
-
interface SlackInteractiveMessageTarget {
|
|
19
|
-
channel: string;
|
|
20
|
-
ts: string;
|
|
21
|
-
threadTs?: string;
|
|
22
|
-
userId: string;
|
|
23
|
-
teamId?: string;
|
|
24
|
-
}
|
|
25
|
-
interface SlackInteractiveRequestRecord {
|
|
26
|
-
id: string;
|
|
27
|
-
kind: SlackInteractiveResolution["kind"];
|
|
28
|
-
request: SlackInteractiveStoredRequest;
|
|
29
|
-
status: SlackInteractiveRequestStatus;
|
|
30
|
-
createdAt: string;
|
|
31
|
-
updatedAt: string;
|
|
32
|
-
target?: SlackInteractiveMessageTarget;
|
|
33
|
-
resolution?: SlackInteractiveResolution;
|
|
34
|
-
}
|
|
35
|
-
interface SlackInteractiveRequestStore {
|
|
36
|
-
get(requestId: string): Promise<SlackInteractiveRequestRecord | undefined>;
|
|
37
|
-
upsert(record: SlackInteractiveRequestRecord): Promise<SlackInteractiveRequestRecord>;
|
|
38
|
-
/**
|
|
39
|
-
* Attach the Slack message target for an already-upserted request.
|
|
40
|
-
*
|
|
41
|
-
* Implementations should return `undefined` when the request does not exist;
|
|
42
|
-
* callers must upsert before attaching a target.
|
|
43
|
-
*/
|
|
44
|
-
attachTarget(requestId: string, target: SlackInteractiveMessageTarget): Promise<SlackInteractiveRequestRecord | undefined>;
|
|
45
|
-
/**
|
|
46
|
-
* Mark a request resolved. Implementations must be idempotent: resolving an
|
|
47
|
-
* already-resolved request should return the existing record without
|
|
48
|
-
* overwriting the original resolution.
|
|
49
|
-
*/
|
|
50
|
-
resolve(requestId: string, resolution: SlackInteractiveResolution): Promise<SlackInteractiveRequestRecord | undefined>;
|
|
51
|
-
delete(requestId: string): Promise<void>;
|
|
52
|
-
}
|
|
53
|
-
interface SlackInteractiveActionIds {
|
|
54
|
-
approvalAllow: string;
|
|
55
|
-
approvalDeny: string;
|
|
56
|
-
approvalRemember: string;
|
|
57
|
-
humanConfirm: string;
|
|
58
|
-
humanDeny: string;
|
|
59
|
-
humanOpen: string;
|
|
60
|
-
humanSubmit: string;
|
|
61
|
-
}
|
|
62
|
-
interface SlackInteractiveActor {
|
|
63
|
-
userId: string;
|
|
64
|
-
teamId?: string;
|
|
65
|
-
}
|
|
66
17
|
interface SlackInteractiveRequestWaitOptions {
|
|
67
18
|
/**
|
|
68
19
|
* Abort waiting for this request. The controller removes its local waiter and
|
|
@@ -133,4 +84,4 @@ interface SlackInteractivePostedMessage {
|
|
|
133
84
|
ref: SlackInteractiveMessageRef;
|
|
134
85
|
}
|
|
135
86
|
|
|
136
|
-
export type {
|
|
87
|
+
export type { SlackInteractiveApprovalRequest as S, SlackInteractiveController as a, SlackInteractiveControllerOptions as b, SlackInteractiveHumanInputRequest as c, SlackInteractivePendingWaiter as d, SlackInteractivePostedMessage as e, SlackInteractiveRequestWaitOptions as f, SlackInteractiveResolution as g };
|
|
@@ -4,10 +4,8 @@ Slack interactive requests render Agent Core approval and human-input requests
|
|
|
4
4
|
as Slack buttons and modals.
|
|
5
5
|
|
|
6
6
|
```typescript
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
createSlackInteractiveController,
|
|
10
|
-
} from "@cuylabs/channel-slack-agent-core/interactive";
|
|
7
|
+
import { createSlackInteractiveController } from "@cuylabs/channel-slack-agent-core/interactive";
|
|
8
|
+
import { createPostgresSlackInteractiveRequestStore } from "@cuylabs/channel-slack/interactive";
|
|
11
9
|
|
|
12
10
|
const interactiveStore = createPostgresSlackInteractiveRequestStore({
|
|
13
11
|
connectionString: process.env.DATABASE_URL,
|
|
@@ -30,10 +28,12 @@ const interactive = createSlackInteractiveController({
|
|
|
30
28
|
|
|
31
29
|
## Store Choices
|
|
32
30
|
|
|
33
|
-
- `createInMemorySlackInteractiveRequestStore`
|
|
31
|
+
- `createInMemorySlackInteractiveRequestStore` from
|
|
32
|
+
`@cuylabs/channel-slack/interactive` is useful for tests and local
|
|
34
33
|
single-process apps.
|
|
35
|
-
- `createPostgresSlackInteractiveRequestStore`
|
|
36
|
-
|
|
34
|
+
- `createPostgresSlackInteractiveRequestStore` from
|
|
35
|
+
`@cuylabs/channel-slack/interactive` persists pending requests across restarts
|
|
36
|
+
and lets multiple Slack workers resolve the same request safely.
|
|
37
37
|
|
|
38
38
|
The Postgres store uses one table keyed by request ID. `resolve(...)` is
|
|
39
39
|
idempotent: the first resolution wins, and later duplicate button clicks return
|
|
@@ -6,16 +6,18 @@ This package owns only the `@cuylabs/agent-core` Slack binding.
|
|
|
6
6
|
|
|
7
7
|
- Mapping Slack turns to `AgentTurnSource.chat(...)`.
|
|
8
8
|
- Creating Agent Core scopes and context fragments.
|
|
9
|
-
- Converting `AgentEvent` streams
|
|
9
|
+
- Converting `AgentEvent` streams through Slack response sink contracts.
|
|
10
10
|
- Mounting Agent Core sources on Express Events API and Socket Mode surfaces.
|
|
11
11
|
- Binding Slack Assistant lifecycle handlers to Agent Core turns.
|
|
12
|
-
-
|
|
12
|
+
- Binding Agent Core approval and human-input requests to Slack interactive
|
|
13
|
+
request primitives.
|
|
13
14
|
- Agent Core helpers for Slack history context fragments and source events.
|
|
14
15
|
|
|
15
16
|
## Outside This Package
|
|
16
17
|
|
|
17
18
|
- Generic Slack activity parsing, formatting, setup, auth, policy, history,
|
|
18
|
-
targets, users, entrypoints, artifacts,
|
|
19
|
+
targets, users, entrypoints, artifacts, response sink contracts, interactive
|
|
20
|
+
request builders/stores, and transport factories.
|
|
19
21
|
- Product prompts, tools, audit policy, privacy rules, and deployment policy.
|
|
20
22
|
- Slack app configuration outside the reusable setup helpers.
|
|
21
23
|
|
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
Use feature subpaths when you only need one adapter surface. Generic Slack
|
|
4
4
|
primitives should be imported from `@cuylabs/channel-slack` directly.
|
|
5
5
|
|
|
6
|
-
| Export | Depends on
|
|
7
|
-
| ----------------------------------------------------- |
|
|
8
|
-
| `@cuylabs/channel-slack-agent-core` | `@cuylabs/agent-core`, selected Slack peers
|
|
9
|
-
| `@cuylabs/channel-slack-agent-core/adapter` | `@slack/bolt`, `@slack/web-api` types
|
|
10
|
-
| `@cuylabs/channel-slack-agent-core/app` | `@slack/bolt`, `@slack/web-api`
|
|
11
|
-
| `@cuylabs/channel-slack-agent-core/app-surface` | `@slack/bolt`, `@slack/web-api` types
|
|
12
|
-
| `@cuylabs/channel-slack-agent-core/artifacts` | `@cuylabs/channel-slack/artifacts`
|
|
13
|
-
| `@cuylabs/channel-slack-agent-core/assistant` | `@slack/bolt`, `@slack/web-api` types
|
|
14
|
-
| `@cuylabs/channel-slack-agent-core/express` | `@slack/bolt`, `express`
|
|
15
|
-
| `@cuylabs/channel-slack-agent-core/express-assistant` | `@slack/bolt`, `express`
|
|
16
|
-
| `@cuylabs/channel-slack-agent-core/feedback` | `@slack/bolt`, `@slack/types`
|
|
17
|
-
| `@cuylabs/channel-slack-agent-core/history` | `@slack/web-api`, `@cuylabs/agent-core` types
|
|
18
|
-
| `@cuylabs/channel-slack-agent-core/interactive` | `@slack/bolt`, `@slack/
|
|
19
|
-
| `@cuylabs/channel-slack-agent-core/mcp` | `@cuylabs/agent-core/mcp` types
|
|
20
|
-
| `@cuylabs/channel-slack-agent-core/shared` | `@cuylabs/agent-core` types
|
|
21
|
-
| `@cuylabs/channel-slack-agent-core/socket` | `@slack/bolt`
|
|
22
|
-
| `@cuylabs/channel-slack-agent-core/source` | `@cuylabs/agent-core` types
|
|
23
|
-
| `@cuylabs/channel-slack-agent-core/views` | `@cuylabs/channel-slack/views`, `@slack/bolt`
|
|
6
|
+
| Export | Depends on | Notes |
|
|
7
|
+
| ----------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
8
|
+
| `@cuylabs/channel-slack-agent-core` | `@cuylabs/agent-core`, selected Slack peers | Full adapter surface re-export |
|
|
9
|
+
| `@cuylabs/channel-slack-agent-core/adapter` | `@slack/bolt`, `@slack/web-api` types | Classic app mention, DM, and passive channel-message adapter |
|
|
10
|
+
| `@cuylabs/channel-slack-agent-core/app` | `@slack/bolt`, `@slack/web-api` | Direct app factory for mounted Slack surfaces |
|
|
11
|
+
| `@cuylabs/channel-slack-agent-core/app-surface` | `@slack/bolt`, `@slack/web-api` types | Shared surface installer for Assistant, mentions, DMs, feedback, and interactions |
|
|
12
|
+
| `@cuylabs/channel-slack-agent-core/artifacts` | `@cuylabs/channel-slack/artifacts` | Agent Core final-response artifact publishers for Slack surfaces |
|
|
13
|
+
| `@cuylabs/channel-slack-agent-core/assistant` | `@slack/bolt`, `@slack/web-api` types | Slack Assistant bridge and lifecycle handlers |
|
|
14
|
+
| `@cuylabs/channel-slack-agent-core/express` | `@slack/bolt`, `express` | Express Events API mounting for classic Slack surfaces |
|
|
15
|
+
| `@cuylabs/channel-slack-agent-core/express-assistant` | `@slack/bolt`, `express` | Express Events API mounting for Slack Assistant |
|
|
16
|
+
| `@cuylabs/channel-slack-agent-core/feedback` | `@slack/bolt`, `@slack/types` | Agent Core feedback binding helpers |
|
|
17
|
+
| `@cuylabs/channel-slack-agent-core/history` | `@slack/web-api`, `@cuylabs/agent-core` types | Agent Core turn history context fragment assembly |
|
|
18
|
+
| `@cuylabs/channel-slack-agent-core/interactive` | `@slack/bolt`, `@cuylabs/channel-slack/interactive` | Agent Core approval and human-input controller binding for Slack |
|
|
19
|
+
| `@cuylabs/channel-slack-agent-core/mcp` | `@cuylabs/agent-core/mcp` types | Slack OAuth token bridge for Agent Core MCP setup |
|
|
20
|
+
| `@cuylabs/channel-slack-agent-core/shared` | `@cuylabs/agent-core` types | Context fragments, event bridge, and Agent Core interactive request contracts |
|
|
21
|
+
| `@cuylabs/channel-slack-agent-core/socket` | `@slack/bolt` | Socket Mode mounting helpers |
|
|
22
|
+
| `@cuylabs/channel-slack-agent-core/source` | `@cuylabs/agent-core` types | Source event queue, response helpers, and status visibility helpers |
|
|
23
|
+
| `@cuylabs/channel-slack-agent-core/views` | `@cuylabs/channel-slack/views`, `@slack/bolt` | Agent/product Slack modal workflow controller and submitted state helpers |
|
|
24
24
|
|
|
25
25
|
For generic Slack package exports, see
|
|
26
26
|
`@cuylabs/channel-slack/docs/reference/exports.md`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuylabs/channel-slack-agent-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Slack adapter for @cuylabs/agent-core built on @cuylabs/channel-slack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
],
|
|
95
95
|
"dependencies": {
|
|
96
96
|
"@cuylabs/agent-core": "^7.2.0",
|
|
97
|
-
"@cuylabs/channel-slack": "^0.
|
|
97
|
+
"@cuylabs/channel-slack": "^0.9.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@slack/bolt": ">=4.7.3",
|