@cuylabs/channel-slack-agent-core 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/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-YSDFYHPC.js → chunk-6EMFBOXD.js} +2 -2
- package/dist/{chunk-2R7B7NJR.js → chunk-DS6E5OEJ.js} +1 -1
- package/dist/{chunk-7YZWCSML.js → chunk-GEFK72VO.js} +1 -1
- package/dist/{chunk-FQWFB54C.js → chunk-KQPUQJ57.js} +1 -1
- package/dist/chunk-L5RAGYVJ.js +245 -0
- package/dist/chunk-OP27SSZU.js +409 -0
- package/dist/{chunk-236WN6JD.js → chunk-P2DIC42J.js} +1 -1
- package/dist/{chunk-6T6N4MRK.js → chunk-Q2GU4QLZ.js} +2 -2
- package/dist/{chunk-TCNJY7QA.js → chunk-QFDXKCAQ.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 +12 -10
- package/dist/index.js +14 -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-C7-VXmhD.d.ts → options-ByNm2o89.d.ts} +2 -2
- package/dist/{options-BcDReOJv.d.ts → options-CGUfVStV.d.ts} +1 -1
- package/dist/shared/index.d.ts +27 -84
- package/dist/shared/index.js +5 -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-TMADMHBN.js +0 -1008
- package/dist/chunk-X7ILLZZP.js +0 -1046
- package/dist/interactive-o_NZb-Xg.d.ts +0 -47
package/README.md
CHANGED
|
@@ -8,7 +8,8 @@ surfaces for Express Events API, Socket Mode, Slack Assistant, app mentions,
|
|
|
8
8
|
DMs, feedback, approvals, or human input.
|
|
9
9
|
|
|
10
10
|
Generic Slack mechanics such as parsing, policy, history, setup, auth, targets,
|
|
11
|
-
users, entrypoints, artifacts,
|
|
11
|
+
users, entrypoints, artifacts, interactive stores/builders, response sinks, and
|
|
12
|
+
transports live in `@cuylabs/channel-slack`.
|
|
12
13
|
|
|
13
14
|
## Install
|
|
14
15
|
|
|
@@ -22,7 +23,8 @@ Install Slack peer dependencies for the surfaces you use:
|
|
|
22
23
|
npm install @slack/bolt @slack/web-api express
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
Postgres-backed interactive request storage
|
|
26
|
+
Postgres-backed interactive request storage lives in
|
|
27
|
+
`@cuylabs/channel-slack/interactive` and lazy-loads `pg` when you pass a
|
|
26
28
|
connection string. Install `pg` only when your application uses that helper
|
|
27
29
|
without injecting its own client.
|
|
28
30
|
|
package/dist/adapter/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { c as createSlackChannelAdapter } from '../adapter-
|
|
2
|
-
import { a as SlackChannelOptions } from '../types-
|
|
3
|
-
export { S as SlackChannelAdapter, b as SlackSessionStrategy, c as SlackStreamingMode, d as SlackToolStartEvent } from '../types-
|
|
1
|
+
export { c as createSlackChannelAdapter } from '../adapter-vbqtraAr.js';
|
|
2
|
+
import { a as SlackChannelOptions } from '../types-BeGPexio.js';
|
|
3
|
+
export { S as SlackChannelAdapter, b as SlackSessionStrategy, c as SlackStreamingMode, d as SlackToolStartEvent } from '../types-BeGPexio.js';
|
|
4
4
|
import { SlackActivityInfo } from '@cuylabs/channel-slack/core';
|
|
5
5
|
import '@cuylabs/agent-core';
|
|
6
|
-
import '../options-
|
|
6
|
+
import '../options-CGUfVStV.js';
|
|
7
7
|
import '../artifacts/index.js';
|
|
8
8
|
import '@cuylabs/channel-slack/artifacts';
|
|
9
|
-
import '../interactive-
|
|
9
|
+
import '../interactive-BigrPKnu.js';
|
|
10
|
+
import '@cuylabs/channel-slack/interactive';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Session mapping — Slack activity info to agent-core session IDs.
|
package/dist/adapter/index.js
CHANGED
package/dist/app-surface.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AgentTurnSource, Logger } from '@cuylabs/agent-core';
|
|
2
2
|
import { App } from '@slack/bolt';
|
|
3
3
|
import { WebClient } from '@slack/web-api';
|
|
4
|
-
import { C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-
|
|
5
|
-
import { a as SlackChannelOptions } from './types-
|
|
4
|
+
import { C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-ByNm2o89.js';
|
|
5
|
+
import { a as SlackChannelOptions } from './types-BeGPexio.js';
|
|
6
6
|
import { SlackTurnRequestContext, SlackAssistantUtilities, SlackTurnPreparation } from '@cuylabs/channel-slack/core';
|
|
7
7
|
import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
|
|
8
|
-
import {
|
|
8
|
+
import { a as SlackInteractiveController } from './types-Bz4OYEAV.js';
|
|
9
9
|
import { d as SlackAgentViewWorkflowController } from './types-CiwGU6zC.js';
|
|
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';
|
package/dist/app-surface.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
installSlackAgentAppSurface
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-Q2GU4QLZ.js";
|
|
4
|
+
import "./chunk-GEFK72VO.js";
|
|
5
5
|
import "./chunk-ELR6MQD7.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-KQPUQJ57.js";
|
|
7
|
+
import "./chunk-L5RAGYVJ.js";
|
|
8
8
|
export {
|
|
9
9
|
installSlackAgentAppSurface
|
|
10
10
|
};
|
package/dist/app.d.ts
CHANGED
|
@@ -5,17 +5,18 @@ import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/htt
|
|
|
5
5
|
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
6
6
|
import { SlackAgentAppSurfaceOptions } from './app-surface.js';
|
|
7
7
|
export { MountSlackAgentAppTurnRequestContext } from './app-surface.js';
|
|
8
|
-
import { S as SlackAssistantBridge } from './options-
|
|
8
|
+
import { S as SlackAssistantBridge } from './options-ByNm2o89.js';
|
|
9
9
|
import '@cuylabs/agent-core';
|
|
10
10
|
import '@slack/web-api';
|
|
11
|
-
import './types-
|
|
11
|
+
import './types-BeGPexio.js';
|
|
12
12
|
import '@cuylabs/channel-slack/core';
|
|
13
|
-
import './options-
|
|
13
|
+
import './options-CGUfVStV.js';
|
|
14
14
|
import './artifacts/index.js';
|
|
15
15
|
import '@cuylabs/channel-slack/artifacts';
|
|
16
|
-
import './interactive-
|
|
16
|
+
import './interactive-BigrPKnu.js';
|
|
17
|
+
import '@cuylabs/channel-slack/interactive';
|
|
17
18
|
import '@cuylabs/channel-slack/feedback';
|
|
18
|
-
import './types-
|
|
19
|
+
import './types-Bz4OYEAV.js';
|
|
19
20
|
import './types-CiwGU6zC.js';
|
|
20
21
|
import '@cuylabs/channel-slack/views';
|
|
21
22
|
import '@cuylabs/channel-slack/assistant';
|
package/dist/app.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mountSlackAgentApp
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-P2DIC42J.js";
|
|
4
|
+
import "./chunk-Q2GU4QLZ.js";
|
|
5
|
+
import "./chunk-GEFK72VO.js";
|
|
6
6
|
import "./chunk-ELR6MQD7.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-KQPUQJ57.js";
|
|
8
|
+
import "./chunk-L5RAGYVJ.js";
|
|
9
9
|
export {
|
|
10
10
|
mountSlackAgentApp
|
|
11
11
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { C as CreateSlackAssistantBridgeOptions, S as SlackAssistantBridge } from '../options-
|
|
2
|
-
export { A as AssistantLifecycleArgs, a as AssistantThreadStartedArgs, M as MaybePromise, b as SlackAssistantCancelControlOptions, c as SlackAssistantCancelControlVisibleWhen, d as SlackAssistantFeedbackConfig, e as SlackAssistantSessionStrategy, f as SlackAssistantStatusContext, g as SlackAssistantThreadContextStoreLike, h as SlackAssistantThreadStartedContext, i as SlackAssistantTurnCancelContext, j as SlackAssistantTurnControlsOptions, k as SlackAssistantTurnPreparation, l as SlackAssistantUserMessageContext, r as resolveAssistantSessionId } from '../options-
|
|
1
|
+
import { C as CreateSlackAssistantBridgeOptions, S as SlackAssistantBridge } from '../options-ByNm2o89.js';
|
|
2
|
+
export { A as AssistantLifecycleArgs, a as AssistantThreadStartedArgs, M as MaybePromise, b as SlackAssistantCancelControlOptions, c as SlackAssistantCancelControlVisibleWhen, d as SlackAssistantFeedbackConfig, e as SlackAssistantSessionStrategy, f as SlackAssistantStatusContext, g as SlackAssistantThreadContextStoreLike, h as SlackAssistantThreadStartedContext, i as SlackAssistantTurnCancelContext, j as SlackAssistantTurnControlsOptions, k as SlackAssistantTurnPreparation, l as SlackAssistantUserMessageContext, r as resolveAssistantSessionId } from '../options-ByNm2o89.js';
|
|
3
3
|
export { ParsedAssistantUserMessage, createSlackAssistantThreadContextStore, parseSlackMessageActivityFromMessageEvent } from '@cuylabs/channel-slack/assistant';
|
|
4
4
|
import '@cuylabs/agent-core';
|
|
5
5
|
import '@slack/bolt';
|
|
6
6
|
import '@slack/web-api';
|
|
7
7
|
import '@cuylabs/channel-slack/core';
|
|
8
|
-
import '../interactive-
|
|
9
|
-
import '
|
|
8
|
+
import '../interactive-BigrPKnu.js';
|
|
9
|
+
import '@cuylabs/channel-slack/interactive';
|
|
10
|
+
import '../options-CGUfVStV.js';
|
|
10
11
|
import '../artifacts/index.js';
|
|
11
12
|
import '@cuylabs/channel-slack/artifacts';
|
|
12
13
|
import '@cuylabs/channel-slack/feedback';
|
package/dist/assistant/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
createSlackAssistantThreadContextStore,
|
|
4
4
|
parseSlackMessageActivityFromMessageEvent,
|
|
5
5
|
resolveAssistantSessionId
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-GEFK72VO.js";
|
|
7
7
|
import "../chunk-ELR6MQD7.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-L5RAGYVJ.js";
|
|
9
9
|
export {
|
|
10
10
|
createSlackAssistantBridge,
|
|
11
11
|
createSlackAssistantThreadContextStore,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
installSlackAgentAppSurface
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q2GU4QLZ.js";
|
|
4
4
|
import {
|
|
5
5
|
createSlackAssistantBridge
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GEFK72VO.js";
|
|
7
7
|
|
|
8
8
|
// src/socket.ts
|
|
9
9
|
import { createSlackSocketBoltApp } from "@cuylabs/channel-slack/transports/socket";
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// src/shared/event-bridge/agent-event-mapper.ts
|
|
2
|
+
function mapAgentEventToSlackTurnEvent(event) {
|
|
3
|
+
switch (event.type) {
|
|
4
|
+
case "text-start":
|
|
5
|
+
case "text-delta":
|
|
6
|
+
case "text-end":
|
|
7
|
+
case "reasoning-start":
|
|
8
|
+
case "reasoning-end":
|
|
9
|
+
case "tool-start":
|
|
10
|
+
case "tool-result":
|
|
11
|
+
case "tool-error":
|
|
12
|
+
case "subagent-start":
|
|
13
|
+
case "subagent-complete":
|
|
14
|
+
case "subagent-error":
|
|
15
|
+
case "status":
|
|
16
|
+
case "complete":
|
|
17
|
+
case "error":
|
|
18
|
+
case "approval-request":
|
|
19
|
+
case "approval-resolved":
|
|
20
|
+
case "human-input-request":
|
|
21
|
+
case "human-input-resolved":
|
|
22
|
+
return { ...event };
|
|
23
|
+
case "subagent-event":
|
|
24
|
+
return {
|
|
25
|
+
...event,
|
|
26
|
+
event: mapAgentEventToSlackTurnEvent(event.event)
|
|
27
|
+
};
|
|
28
|
+
case "reasoning-delta":
|
|
29
|
+
case "step-start":
|
|
30
|
+
case "step-finish":
|
|
31
|
+
case "turn-boundary":
|
|
32
|
+
case "message":
|
|
33
|
+
case "computer-call":
|
|
34
|
+
case "computer-result":
|
|
35
|
+
case "intervention-applied":
|
|
36
|
+
case "follow-up-queued":
|
|
37
|
+
case "doom-loop":
|
|
38
|
+
case "context-overflow":
|
|
39
|
+
case "context-compaction":
|
|
40
|
+
case "turn-summary":
|
|
41
|
+
case "retry":
|
|
42
|
+
return mapIgnoredAgentEvent(event);
|
|
43
|
+
default:
|
|
44
|
+
return mapIgnoredAgentEvent(event);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function mapIgnoredAgentEvent(event) {
|
|
48
|
+
return { ...event };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/shared/event-bridge/options-adapter.ts
|
|
52
|
+
function mapAgentSlackEventBridgeOptionsToRuntimeOptions(options) {
|
|
53
|
+
return {
|
|
54
|
+
showReasoning: options.showReasoning,
|
|
55
|
+
showToolUsage: options.showToolUsage,
|
|
56
|
+
showSubagentToolUsage: options.showSubagentToolUsage,
|
|
57
|
+
showSubagentResultInTask: options.showSubagentResultInTask,
|
|
58
|
+
...options.formatToolTitle ? { formatToolTitle: options.formatToolTitle } : {},
|
|
59
|
+
formatToolUpdate: options.formatToolUpdate,
|
|
60
|
+
...options.formatToolDetails ? {
|
|
61
|
+
formatToolDetails: (event) => options.formatToolDetails?.(
|
|
62
|
+
event
|
|
63
|
+
)
|
|
64
|
+
} : {},
|
|
65
|
+
...options.formatToolResultOutput ? {
|
|
66
|
+
formatToolResultOutput: (event) => options.formatToolResultOutput?.(
|
|
67
|
+
event
|
|
68
|
+
)
|
|
69
|
+
} : {},
|
|
70
|
+
formatToolError: options.formatToolError,
|
|
71
|
+
formatReasoningUpdate: options.formatReasoningUpdate,
|
|
72
|
+
formatMessageText: options.formatMessageText,
|
|
73
|
+
streamingMode: options.streamingMode,
|
|
74
|
+
progressiveUpdateThreshold: options.progressiveUpdateThreshold,
|
|
75
|
+
progressiveUpdateIntervalMs: options.progressiveUpdateIntervalMs,
|
|
76
|
+
chatStreamBufferSize: options.chatStreamBufferSize,
|
|
77
|
+
maxTaskUpdates: options.maxTaskUpdates,
|
|
78
|
+
maxTaskUpdateTextChars: options.maxTaskUpdateTextChars,
|
|
79
|
+
maxTaskUpdateFieldChars: options.maxTaskUpdateFieldChars,
|
|
80
|
+
interactiveMode: options.interactiveMode,
|
|
81
|
+
...options.handleInteractiveRequest ? {
|
|
82
|
+
handleInteractiveRequest: (context) => options.handleInteractiveRequest?.(
|
|
83
|
+
context
|
|
84
|
+
)
|
|
85
|
+
} : {},
|
|
86
|
+
formatApprovalRequired: (request) => options.formatApprovalRequired(request),
|
|
87
|
+
formatHumanInputRequired: (request) => options.formatHumanInputRequired(request),
|
|
88
|
+
...options.onStatusChange ? {
|
|
89
|
+
onStatusChange: (label, event) => options.onStatusChange?.(
|
|
90
|
+
label,
|
|
91
|
+
event
|
|
92
|
+
)
|
|
93
|
+
} : {},
|
|
94
|
+
...options.chatStreamFinalArgs ? { chatStreamFinalArgs: options.chatStreamFinalArgs } : {},
|
|
95
|
+
...options.publishFinalResponseArtifact ? { publishFinalResponseArtifact: options.publishFinalResponseArtifact } : {},
|
|
96
|
+
...options.finalResponseArtifactMode ? { finalResponseArtifactMode: options.finalResponseArtifactMode } : {},
|
|
97
|
+
...options.finalResponseArtifactStreamThreshold ? {
|
|
98
|
+
finalResponseArtifactStreamThreshold: options.finalResponseArtifactStreamThreshold
|
|
99
|
+
} : {},
|
|
100
|
+
...options.formatFinalResponseArtifactContinuationNotice ? {
|
|
101
|
+
formatFinalResponseArtifactContinuationNotice: options.formatFinalResponseArtifactContinuationNotice
|
|
102
|
+
} : {},
|
|
103
|
+
...options.formatFinalResponseArtifactMessage ? {
|
|
104
|
+
formatFinalResponseArtifactMessage: options.formatFinalResponseArtifactMessage
|
|
105
|
+
} : {},
|
|
106
|
+
...options.onFinalResponseArtifactError ? { onFinalResponseArtifactError: options.onFinalResponseArtifactError } : {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/shared/event-bridge/bridge.ts
|
|
111
|
+
import {
|
|
112
|
+
bridgeSlackTurnEventsToSlack
|
|
113
|
+
} from "@cuylabs/channel-slack/runtime";
|
|
114
|
+
async function bridgeAgentEventsToSlack(events, sink, options) {
|
|
115
|
+
return bridgeSlackTurnEventsToSlack(
|
|
116
|
+
toSlackTurnEvents(events),
|
|
117
|
+
sink,
|
|
118
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions(options)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
async function* toSlackTurnEvents(events) {
|
|
122
|
+
for await (const event of events) {
|
|
123
|
+
yield mapAgentEventToSlackTurnEvent(event);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/shared/event-bridge/options.ts
|
|
128
|
+
var DEFAULT_OPTIONS = {
|
|
129
|
+
showReasoning: false,
|
|
130
|
+
showToolUsage: true,
|
|
131
|
+
showSubagentToolUsage: false,
|
|
132
|
+
showSubagentResultInTask: false,
|
|
133
|
+
formatToolTitle: (toolName) => toolName,
|
|
134
|
+
formatToolUpdate: (toolName) => `\u{1F50D} Using tool: ${toolName}...`,
|
|
135
|
+
formatToolError: (toolName, _error) => `\u26A0\uFE0F Tool ${toolName} encountered an error`,
|
|
136
|
+
formatReasoningUpdate: () => "Thinking...",
|
|
137
|
+
formatMessageText: (text) => text,
|
|
138
|
+
streamingMode: "progressive",
|
|
139
|
+
progressiveUpdateThreshold: 150,
|
|
140
|
+
progressiveUpdateIntervalMs: 3e3,
|
|
141
|
+
chatStreamBufferSize: 256,
|
|
142
|
+
maxTaskUpdates: 200,
|
|
143
|
+
maxTaskUpdateTextChars: 2e4,
|
|
144
|
+
maxTaskUpdateFieldChars: 500,
|
|
145
|
+
interactiveMode: "message-and-error",
|
|
146
|
+
formatApprovalRequired: (request) => `This turn requires approval for "${request.tool}", but in-channel approval is not configured for this Slack host.`,
|
|
147
|
+
formatHumanInputRequired: (request) => `This turn is waiting for input: ${request.title}. In-channel human input is not configured for this Slack host.`,
|
|
148
|
+
finalResponseArtifactMode: "supplemental",
|
|
149
|
+
finalResponseArtifactStreamThreshold: 4e3,
|
|
150
|
+
formatFinalResponseArtifactContinuationNotice: () => "\n\nFull response is long. I will publish the complete answer as a Slack artifact when it finishes.",
|
|
151
|
+
formatFinalResponseArtifactMessage: (result) => {
|
|
152
|
+
const title = result.publication.artifact.title.trim() || "Agent response";
|
|
153
|
+
if (result.publication.method === "canvas") {
|
|
154
|
+
return `I created a Slack Canvas for the full response: ${title}`;
|
|
155
|
+
}
|
|
156
|
+
if (result.publication.method === "file") {
|
|
157
|
+
return `I uploaded the full response as a file: ${title}`;
|
|
158
|
+
}
|
|
159
|
+
return `I published the full response as a Slack artifact: ${title}`;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
function resolveSlackEventBridgeOptions(partial) {
|
|
163
|
+
return {
|
|
164
|
+
showReasoning: partial.showReasoning ?? DEFAULT_OPTIONS.showReasoning,
|
|
165
|
+
showToolUsage: partial.showToolUsage ?? DEFAULT_OPTIONS.showToolUsage,
|
|
166
|
+
showSubagentToolUsage: partial.showSubagentToolUsage ?? DEFAULT_OPTIONS.showSubagentToolUsage,
|
|
167
|
+
showSubagentResultInTask: partial.showSubagentResultInTask ?? DEFAULT_OPTIONS.showSubagentResultInTask,
|
|
168
|
+
formatToolTitle: partial.formatToolTitle ?? DEFAULT_OPTIONS.formatToolTitle,
|
|
169
|
+
formatToolUpdate: partial.formatToolUpdate ?? DEFAULT_OPTIONS.formatToolUpdate,
|
|
170
|
+
...partial.formatToolDetails ? { formatToolDetails: partial.formatToolDetails } : {},
|
|
171
|
+
...partial.formatToolResultOutput ? { formatToolResultOutput: partial.formatToolResultOutput } : {},
|
|
172
|
+
formatToolError: partial.formatToolError ?? DEFAULT_OPTIONS.formatToolError,
|
|
173
|
+
formatReasoningUpdate: partial.formatReasoningUpdate ?? DEFAULT_OPTIONS.formatReasoningUpdate,
|
|
174
|
+
formatMessageText: partial.formatMessageText ?? DEFAULT_OPTIONS.formatMessageText,
|
|
175
|
+
streamingMode: partial.streamingMode ?? DEFAULT_OPTIONS.streamingMode,
|
|
176
|
+
progressiveUpdateThreshold: partial.progressiveUpdateThreshold ?? DEFAULT_OPTIONS.progressiveUpdateThreshold,
|
|
177
|
+
progressiveUpdateIntervalMs: partial.progressiveUpdateIntervalMs ?? DEFAULT_OPTIONS.progressiveUpdateIntervalMs,
|
|
178
|
+
chatStreamBufferSize: partial.chatStreamBufferSize ?? DEFAULT_OPTIONS.chatStreamBufferSize,
|
|
179
|
+
maxTaskUpdates: resolveNonNegativeInteger(
|
|
180
|
+
partial.maxTaskUpdates,
|
|
181
|
+
DEFAULT_OPTIONS.maxTaskUpdates
|
|
182
|
+
),
|
|
183
|
+
maxTaskUpdateTextChars: resolveNonNegativeInteger(
|
|
184
|
+
partial.maxTaskUpdateTextChars,
|
|
185
|
+
DEFAULT_OPTIONS.maxTaskUpdateTextChars
|
|
186
|
+
),
|
|
187
|
+
maxTaskUpdateFieldChars: resolveNonNegativeInteger(
|
|
188
|
+
partial.maxTaskUpdateFieldChars,
|
|
189
|
+
DEFAULT_OPTIONS.maxTaskUpdateFieldChars
|
|
190
|
+
),
|
|
191
|
+
interactiveMode: partial.interactiveMode ?? DEFAULT_OPTIONS.interactiveMode,
|
|
192
|
+
...partial.handleInteractiveRequest ? { handleInteractiveRequest: partial.handleInteractiveRequest } : {},
|
|
193
|
+
formatApprovalRequired: partial.formatApprovalRequired ?? DEFAULT_OPTIONS.formatApprovalRequired,
|
|
194
|
+
formatHumanInputRequired: partial.formatHumanInputRequired ?? DEFAULT_OPTIONS.formatHumanInputRequired,
|
|
195
|
+
...partial.onStatusChange ? { onStatusChange: partial.onStatusChange } : {},
|
|
196
|
+
...partial.chatStreamFinalArgs ? { chatStreamFinalArgs: partial.chatStreamFinalArgs } : {},
|
|
197
|
+
...partial.publishFinalResponseArtifact ? { publishFinalResponseArtifact: partial.publishFinalResponseArtifact } : {},
|
|
198
|
+
finalResponseArtifactMode: partial.finalResponseArtifactMode ?? DEFAULT_OPTIONS.finalResponseArtifactMode,
|
|
199
|
+
finalResponseArtifactStreamThreshold: resolvePositiveInteger(
|
|
200
|
+
partial.finalResponseArtifactStreamThreshold,
|
|
201
|
+
DEFAULT_OPTIONS.finalResponseArtifactStreamThreshold ?? 4e3
|
|
202
|
+
),
|
|
203
|
+
formatFinalResponseArtifactContinuationNotice: partial.formatFinalResponseArtifactContinuationNotice ?? DEFAULT_OPTIONS.formatFinalResponseArtifactContinuationNotice,
|
|
204
|
+
formatFinalResponseArtifactMessage: partial.formatFinalResponseArtifactMessage ?? DEFAULT_OPTIONS.formatFinalResponseArtifactMessage,
|
|
205
|
+
...partial.onFinalResponseArtifactError ? { onFinalResponseArtifactError: partial.onFinalResponseArtifactError } : {}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function resolveNonNegativeInteger(value, fallback) {
|
|
209
|
+
if (value === void 0) {
|
|
210
|
+
return fallback;
|
|
211
|
+
}
|
|
212
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
213
|
+
return fallback;
|
|
214
|
+
}
|
|
215
|
+
return Math.floor(value);
|
|
216
|
+
}
|
|
217
|
+
function resolvePositiveInteger(value, fallback) {
|
|
218
|
+
if (value === void 0) {
|
|
219
|
+
return fallback;
|
|
220
|
+
}
|
|
221
|
+
if (!Number.isFinite(value) || value < 1) {
|
|
222
|
+
return fallback;
|
|
223
|
+
}
|
|
224
|
+
return Math.floor(value);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// src/shared/event-bridge/interactive.ts
|
|
228
|
+
var UnsupportedSlackInteractiveRequestError = class extends Error {
|
|
229
|
+
kind;
|
|
230
|
+
requestId;
|
|
231
|
+
constructor(kind, requestId, message) {
|
|
232
|
+
super(message);
|
|
233
|
+
this.name = "UnsupportedSlackInteractiveRequestError";
|
|
234
|
+
this.kind = kind;
|
|
235
|
+
this.requestId = requestId;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
mapAgentEventToSlackTurnEvent,
|
|
241
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
242
|
+
bridgeAgentEventsToSlack,
|
|
243
|
+
resolveSlackEventBridgeOptions,
|
|
244
|
+
UnsupportedSlackInteractiveRequestError
|
|
245
|
+
};
|