@cuylabs/channel-slack-agent-core 0.9.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/adapter/index.js +2 -2
- package/dist/app-surface.js +4 -4
- package/dist/app.js +5 -5
- package/dist/assistant/index.js +2 -2
- package/dist/{chunk-HHXAXSG6.js → chunk-6EMFBOXD.js} +2 -2
- package/dist/{chunk-JU5R6JZG.js → chunk-DS6E5OEJ.js} +1 -1
- package/dist/{chunk-FJP6ZFUB.js → chunk-GEFK72VO.js} +1 -1
- package/dist/{chunk-XA7U3GRN.js → chunk-KQPUQJ57.js} +1 -1
- package/dist/chunk-L5RAGYVJ.js +245 -0
- package/dist/{chunk-KAEZPS3U.js → chunk-P2DIC42J.js} +1 -1
- package/dist/{chunk-GKZRDNEB.js → chunk-Q2GU4QLZ.js} +2 -2
- package/dist/{chunk-D4CSEAIF.js → chunk-QFDXKCAQ.js} +1 -1
- package/dist/express-assistant.js +3 -3
- package/dist/express.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -8
- package/dist/shared/index.d.ts +26 -14
- package/dist/shared/index.js +5 -1
- package/dist/socket.js +5 -5
- package/package.json +2 -2
- package/dist/chunk-VBGQD6JT.js +0 -1008
package/dist/adapter/index.js
CHANGED
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.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
|
};
|
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
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSlackAssistantBridge
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GEFK72VO.js";
|
|
4
4
|
import {
|
|
5
5
|
createSlackFeedbackBlock
|
|
6
6
|
} from "./chunk-ELR6MQD7.js";
|
|
7
7
|
import {
|
|
8
8
|
createSlackChannelAdapter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KQPUQJ57.js";
|
|
10
10
|
|
|
11
11
|
// src/app-surface.ts
|
|
12
12
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mountSlackAssistantAgent
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-DS6E5OEJ.js";
|
|
4
|
+
import "./chunk-GEFK72VO.js";
|
|
5
5
|
import "./chunk-ELR6MQD7.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-L5RAGYVJ.js";
|
|
7
7
|
export {
|
|
8
8
|
mountSlackAssistantAgent
|
|
9
9
|
};
|
package/dist/express.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
export { UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack } from './shared/index.js';
|
|
2
|
+
export { UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack, mapAgentEventToSlackTurnEvent, mapAgentSlackEventBridgeOptionsToRuntimeOptions } from './shared/index.js';
|
|
3
3
|
export { S as SlackEventBridgeOptions, r as resolveSlackEventBridgeOptions } from './options-CGUfVStV.js';
|
|
4
4
|
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';
|
|
5
5
|
export { c as createSlackChannelAdapter } from './adapter-vbqtraAr.js';
|
|
@@ -24,6 +24,7 @@ export { MountSlackAgentAppTurnRequestContext } from './app-surface.js';
|
|
|
24
24
|
import '@cuylabs/agent-core';
|
|
25
25
|
import '@cuylabs/channel-slack/core';
|
|
26
26
|
import '@cuylabs/channel-slack/responses';
|
|
27
|
+
import '@cuylabs/channel-slack/runtime';
|
|
27
28
|
import '@cuylabs/channel-slack/interactive';
|
|
28
29
|
import '@slack/bolt';
|
|
29
30
|
import '@slack/web-api';
|
package/dist/index.js
CHANGED
|
@@ -38,13 +38,13 @@ import {
|
|
|
38
38
|
} from "./chunk-C7CHMYV6.js";
|
|
39
39
|
import {
|
|
40
40
|
mountSlackAgentApp
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-P2DIC42J.js";
|
|
42
42
|
import {
|
|
43
43
|
mountSlackAssistantAgent
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-DS6E5OEJ.js";
|
|
45
45
|
import {
|
|
46
46
|
mountSlackAgent
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-QFDXKCAQ.js";
|
|
48
48
|
import {
|
|
49
49
|
SLACK_MCP_URL,
|
|
50
50
|
createSlackMcpServerConfig
|
|
@@ -52,24 +52,26 @@ import {
|
|
|
52
52
|
import {
|
|
53
53
|
mountSlackAgentAppSocket,
|
|
54
54
|
mountSlackAssistantAgentSocket
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
55
|
+
} from "./chunk-6EMFBOXD.js";
|
|
56
|
+
import "./chunk-Q2GU4QLZ.js";
|
|
57
57
|
import {
|
|
58
58
|
createSlackAssistantBridge,
|
|
59
59
|
createSlackAssistantThreadContextStore,
|
|
60
60
|
parseSlackMessageActivityFromMessageEvent,
|
|
61
61
|
resolveAssistantSessionId
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-GEFK72VO.js";
|
|
63
63
|
import "./chunk-ELR6MQD7.js";
|
|
64
64
|
import {
|
|
65
65
|
createSlackChannelAdapter,
|
|
66
66
|
createSlackSessionMap
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-KQPUQJ57.js";
|
|
68
68
|
import {
|
|
69
69
|
UnsupportedSlackInteractiveRequestError,
|
|
70
70
|
bridgeAgentEventsToSlack,
|
|
71
|
+
mapAgentEventToSlackTurnEvent,
|
|
72
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
71
73
|
resolveSlackEventBridgeOptions
|
|
72
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-L5RAGYVJ.js";
|
|
73
75
|
export {
|
|
74
76
|
DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
|
|
75
77
|
SLACK_MCP_URL,
|
|
@@ -98,6 +100,8 @@ export {
|
|
|
98
100
|
isSlackTerminalTurnPhase,
|
|
99
101
|
isSlackWaitingForHumanTurnPhase,
|
|
100
102
|
loadSlackAgentTurnHistoryContext,
|
|
103
|
+
mapAgentEventToSlackTurnEvent,
|
|
104
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
101
105
|
mountSlackAgent,
|
|
102
106
|
mountSlackAgentApp,
|
|
103
107
|
mountSlackAgentAppSocket,
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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 { SlackResponseSink } from '@cuylabs/channel-slack/responses';
|
|
3
4
|
import { S as SlackEventBridgeOptions } from '../options-CGUfVStV.js';
|
|
4
5
|
export { r as resolveSlackEventBridgeOptions } from '../options-CGUfVStV.js';
|
|
5
|
-
import {
|
|
6
|
+
import { SlackTurnEvent, SlackEventBridgeOptions as SlackEventBridgeOptions$1 } from '@cuylabs/channel-slack/runtime';
|
|
6
7
|
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
8
|
import '@cuylabs/channel-slack/core';
|
|
8
9
|
import '../artifacts/index.js';
|
|
@@ -10,27 +11,38 @@ import '@cuylabs/channel-slack/artifacts';
|
|
|
10
11
|
import '@cuylabs/channel-slack/interactive';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* conversation via a `SlackResponseSink`.
|
|
15
|
-
*
|
|
16
|
-
* | Mode | Behaviour |
|
|
17
|
-
* |----------------|--------------------------------------------------------|
|
|
18
|
-
* | `progressive` | Posts a placeholder, updates it as text accumulates. |
|
|
19
|
-
* | `accumulate` | Collects the full response then posts it in one shot. |
|
|
20
|
-
* | `chat-stream` | Uses Slack's native `chat.startStream` + append + stop |
|
|
14
|
+
* Agent Core compatibility bridge.
|
|
21
15
|
*
|
|
22
|
-
* The
|
|
23
|
-
*
|
|
24
|
-
*
|
|
16
|
+
* The Slack renderer itself lives in `@cuylabs/channel-slack/runtime` and
|
|
17
|
+
* consumes runtime-neutral `SlackTurnEvent`s. This adapter keeps the existing
|
|
18
|
+
* `bridgeAgentEventsToSlack` API and owns the explicit Agent Core to Slack
|
|
19
|
+
* runtime mapping.
|
|
25
20
|
*/
|
|
26
21
|
|
|
27
22
|
/**
|
|
28
|
-
* Stream
|
|
23
|
+
* Stream Agent Core events to a Slack conversation via `SlackResponseSink`.
|
|
29
24
|
*
|
|
30
25
|
* @returns The full accumulated response text.
|
|
31
26
|
*/
|
|
32
27
|
declare function bridgeAgentEventsToSlack(events: AsyncGenerator<AgentEvent>, sink: SlackResponseSink, options: SlackEventBridgeOptions): Promise<string>;
|
|
33
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Agent Core to Slack runtime event mapping.
|
|
31
|
+
*
|
|
32
|
+
* This file is the compatibility boundary between `@cuylabs/agent-core` and
|
|
33
|
+
* the runtime-neutral Slack renderer in `@cuylabs/channel-slack/runtime`.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
declare function mapAgentEventToSlackTurnEvent(event: AgentEvent): SlackTurnEvent;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Adapter from Agent Core bridge options to runtime-neutral Slack bridge
|
|
40
|
+
* options. Function-valued options are wrapped so Agent Core-specific event
|
|
41
|
+
* types do not leak into `@cuylabs/channel-slack/runtime`.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
declare function mapAgentSlackEventBridgeOptionsToRuntimeOptions(options: SlackEventBridgeOptions): SlackEventBridgeOptions$1;
|
|
45
|
+
|
|
34
46
|
/**
|
|
35
47
|
* Interactive-request error type raised when an `approval-request` or
|
|
36
48
|
* `human-input-request` event reaches the Slack transport in a mode that
|
|
@@ -45,4 +57,4 @@ declare class UnsupportedSlackInteractiveRequestError extends Error {
|
|
|
45
57
|
constructor(kind: "approval" | "human-input", requestId: string, message: string);
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
export { SlackEventBridgeOptions, UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack };
|
|
60
|
+
export { SlackEventBridgeOptions, UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack, mapAgentEventToSlackTurnEvent, mapAgentSlackEventBridgeOptionsToRuntimeOptions };
|
package/dist/shared/index.js
CHANGED
|
@@ -5,12 +5,16 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
UnsupportedSlackInteractiveRequestError,
|
|
7
7
|
bridgeAgentEventsToSlack,
|
|
8
|
+
mapAgentEventToSlackTurnEvent,
|
|
9
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
8
10
|
resolveSlackEventBridgeOptions
|
|
9
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-L5RAGYVJ.js";
|
|
10
12
|
export {
|
|
11
13
|
DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
|
|
12
14
|
UnsupportedSlackInteractiveRequestError,
|
|
13
15
|
bridgeAgentEventsToSlack,
|
|
14
16
|
createSlackContextFragmentMiddleware,
|
|
17
|
+
mapAgentEventToSlackTurnEvent,
|
|
18
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
15
19
|
resolveSlackEventBridgeOptions
|
|
16
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-6EMFBOXD.js";
|
|
5
|
+
import "./chunk-Q2GU4QLZ.js";
|
|
6
|
+
import "./chunk-GEFK72VO.js";
|
|
7
7
|
import "./chunk-ELR6MQD7.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-KQPUQJ57.js";
|
|
9
|
+
import "./chunk-L5RAGYVJ.js";
|
|
10
10
|
export {
|
|
11
11
|
mountSlackAgentAppSocket,
|
|
12
12
|
mountSlackAssistantAgentSocket
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuylabs/channel-slack-agent-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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.10.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@slack/bolt": ">=4.7.3",
|