@cuylabs/channel-slack-agent-core 0.10.0 → 0.12.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 +18 -11
- package/dist/{chunk-L5RAGYVJ.js → chunk-U6RC4SXN.js} +87 -1
- package/dist/history/index.d.ts +7 -17
- package/dist/index.d.ts +2 -29
- package/dist/index.js +12 -64
- package/dist/shared/index.d.ts +146 -10
- package/dist/shared/index.js +4 -4
- package/docs/README.md +2 -4
- package/docs/concepts/final-response-artifacts.md +9 -7
- package/docs/concepts/interactive-requests.md +31 -26
- package/docs/concepts/tool-task-rendering.md +2 -0
- package/docs/reference/boundary.md +6 -4
- package/docs/reference/exports.md +14 -20
- package/package.json +4 -59
- package/dist/adapter/index.d.ts +0 -26
- package/dist/adapter/index.js +0 -9
- package/dist/adapter-vbqtraAr.d.ts +0 -31
- package/dist/app-surface.d.ts +0 -82
- package/dist/app-surface.js +0 -10
- package/dist/app.d.ts +0 -60
- package/dist/app.js +0 -11
- package/dist/artifacts/index.d.ts +0 -57
- package/dist/artifacts/index.js +0 -6
- package/dist/assistant/index.d.ts +0 -22
- package/dist/assistant/index.js +0 -14
- package/dist/chunk-6EMFBOXD.js +0 -67
- package/dist/chunk-A2PLAVW6.js +0 -75
- package/dist/chunk-C7CHMYV6.js +0 -226
- package/dist/chunk-DS6E5OEJ.js +0 -85
- package/dist/chunk-ELR6MQD7.js +0 -12
- package/dist/chunk-GEFK72VO.js +0 -921
- package/dist/chunk-KQPUQJ57.js +0 -482
- package/dist/chunk-NNCVHQC4.js +0 -94
- package/dist/chunk-OP27SSZU.js +0 -409
- package/dist/chunk-P2DIC42J.js +0 -77
- package/dist/chunk-Q2GU4QLZ.js +0 -187
- package/dist/chunk-QFDXKCAQ.js +0 -82
- package/dist/express-assistant.d.ts +0 -106
- package/dist/express-assistant.js +0 -9
- package/dist/express.d.ts +0 -103
- package/dist/express.js +0 -8
- package/dist/feedback/index.d.ts +0 -1
- package/dist/feedback/index.js +0 -10
- package/dist/interactive/index.d.ts +0 -11
- package/dist/interactive/index.js +0 -6
- package/dist/interactive-BigrPKnu.d.ts +0 -30
- package/dist/options-ByNm2o89.d.ts +0 -323
- package/dist/options-CGUfVStV.d.ts +0 -119
- package/dist/socket.d.ts +0 -143
- package/dist/socket.js +0 -13
- package/dist/types-BeGPexio.d.ts +0 -381
- package/dist/types-Bz4OYEAV.d.ts +0 -87
- package/dist/types-CiwGU6zC.d.ts +0 -56
- package/dist/views/index.d.ts +0 -8
- package/dist/views/index.js +0 -10
- package/docs/concepts/view-workflows.md +0 -52
package/dist/chunk-QFDXKCAQ.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSlackChannelAdapter
|
|
3
|
-
} from "./chunk-KQPUQJ57.js";
|
|
4
|
-
|
|
5
|
-
// src/express.ts
|
|
6
|
-
import {
|
|
7
|
-
createSlackBoltApp
|
|
8
|
-
} from "@cuylabs/channel-slack/transports/http";
|
|
9
|
-
async function mountSlackAgent(source, options = {}) {
|
|
10
|
-
const {
|
|
11
|
-
botToken: providedToken,
|
|
12
|
-
signingSecret,
|
|
13
|
-
auth,
|
|
14
|
-
path,
|
|
15
|
-
processBeforeResponse,
|
|
16
|
-
signatureVerification,
|
|
17
|
-
boltAppOptions,
|
|
18
|
-
receiverOptions,
|
|
19
|
-
port: portOption,
|
|
20
|
-
host,
|
|
21
|
-
app: providedApp,
|
|
22
|
-
...adapterOptions
|
|
23
|
-
} = options;
|
|
24
|
-
const {
|
|
25
|
-
boltApp,
|
|
26
|
-
receiver,
|
|
27
|
-
app: expressApp,
|
|
28
|
-
authMode,
|
|
29
|
-
routePath
|
|
30
|
-
} = await createSlackBoltApp({
|
|
31
|
-
signingSecret,
|
|
32
|
-
path,
|
|
33
|
-
botToken: providedToken,
|
|
34
|
-
auth,
|
|
35
|
-
app: providedApp,
|
|
36
|
-
processBeforeResponse,
|
|
37
|
-
signatureVerification,
|
|
38
|
-
boltAppOptions,
|
|
39
|
-
receiverOptions
|
|
40
|
-
});
|
|
41
|
-
const channelAdapter = createSlackChannelAdapter({
|
|
42
|
-
source,
|
|
43
|
-
...adapterOptions
|
|
44
|
-
});
|
|
45
|
-
channelAdapter.mount(boltApp);
|
|
46
|
-
mountReceiverRouter(expressApp, receiver);
|
|
47
|
-
const port = portOption === void 0 ? resolvePort(process.env.PORT) : portOption;
|
|
48
|
-
let server;
|
|
49
|
-
if (!providedApp && port !== null) {
|
|
50
|
-
const onListen = () => {
|
|
51
|
-
process.stdout.write(
|
|
52
|
-
`Slack bot listening on port ${port} at ${routePath}
|
|
53
|
-
`
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
server = host ? expressApp.listen(port, host, onListen) : expressApp.listen(port, onListen);
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
app: expressApp,
|
|
60
|
-
boltApp,
|
|
61
|
-
receiver,
|
|
62
|
-
authMode,
|
|
63
|
-
routePath,
|
|
64
|
-
channelAdapter,
|
|
65
|
-
server
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function resolvePort(port) {
|
|
69
|
-
if (!port) return 3e3;
|
|
70
|
-
const parsed = Number(port);
|
|
71
|
-
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
72
|
-
throw new Error(`Invalid PORT value: ${port}`);
|
|
73
|
-
}
|
|
74
|
-
return parsed;
|
|
75
|
-
}
|
|
76
|
-
function mountReceiverRouter(app, receiver) {
|
|
77
|
-
app.use(receiver.router);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export {
|
|
81
|
-
mountSlackAgent
|
|
82
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { Server } from 'node:http';
|
|
2
|
-
import { Application } from 'express';
|
|
3
|
-
import { App, ExpressReceiver } from '@slack/bolt';
|
|
4
|
-
import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/http';
|
|
5
|
-
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
6
|
-
import { C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-ByNm2o89.js';
|
|
7
|
-
import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
|
|
8
|
-
import '@cuylabs/agent-core';
|
|
9
|
-
import '@slack/web-api';
|
|
10
|
-
import '@cuylabs/channel-slack/core';
|
|
11
|
-
import './interactive-BigrPKnu.js';
|
|
12
|
-
import '@cuylabs/channel-slack/interactive';
|
|
13
|
-
import './options-CGUfVStV.js';
|
|
14
|
-
import './artifacts/index.js';
|
|
15
|
-
import '@cuylabs/channel-slack/artifacts';
|
|
16
|
-
import '@cuylabs/channel-slack/assistant';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Express helper for mounting the Slack assistant bridge.
|
|
20
|
-
*
|
|
21
|
-
* Companion to `mountSlackAgent` (which wires the classic
|
|
22
|
-
* `app.message`/`app.event` listeners). This one uses
|
|
23
|
-
* `createSlackAssistantBridge` so the bot uses Bolt's
|
|
24
|
-
* `app.assistant(new Assistant({...}))` lifecycle — `setStatus`,
|
|
25
|
-
* `setSuggestedPrompts`, `chatStream`, feedback buttons.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { mountSlackAssistantAgent } from "@cuylabs/channel-slack-agent-core";
|
|
30
|
-
*
|
|
31
|
-
* await mountSlackAssistantAgent(agent, {
|
|
32
|
-
* getSuggestedPrompts: () => ({
|
|
33
|
-
* title: "Try one of these:",
|
|
34
|
-
* prompts: [
|
|
35
|
-
* { title: "Roll some dice", message: "Roll 2d20" },
|
|
36
|
-
* { title: "Summarize this thread", message: "Summarize the last 20 messages" },
|
|
37
|
-
* ],
|
|
38
|
-
* }),
|
|
39
|
-
* onFeedback: ({ verdict, sessionId }) => {
|
|
40
|
-
* metrics.increment(`feedback.${verdict}`, { sessionId });
|
|
41
|
-
* },
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
interface MountSlackAssistantAgentOptions extends Omit<CreateSlackAssistantBridgeOptions, "feedback">, Omit<CreateSlackBoltAppOptions, "app" | "path" | "botToken" | "signingSecret" | "auth"> {
|
|
47
|
-
/**
|
|
48
|
-
* Slack bot token (`xoxb-...`).
|
|
49
|
-
* @default process.env.SLACK_BOT_TOKEN
|
|
50
|
-
*/
|
|
51
|
-
botToken?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Slack signing secret used to verify incoming webhook requests.
|
|
54
|
-
* @default process.env.SLACK_SIGNING_SECRET
|
|
55
|
-
*/
|
|
56
|
-
signingSecret?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Structured direct-mode auth config (single-workspace, OAuth, custom).
|
|
59
|
-
* Defaults to `botToken` / `SLACK_BOT_TOKEN` single-workspace mode.
|
|
60
|
-
*/
|
|
61
|
-
auth?: SlackDirectAuthOptions;
|
|
62
|
-
/**
|
|
63
|
-
* Slack Events API callback path handled by Bolt.
|
|
64
|
-
*
|
|
65
|
-
* @default "/slack/events"
|
|
66
|
-
*/
|
|
67
|
-
path?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Port to listen on. Set to `null` to skip `app.listen()` — caller manages
|
|
70
|
-
* the server.
|
|
71
|
-
*
|
|
72
|
-
* @default process.env.PORT || 3000
|
|
73
|
-
*/
|
|
74
|
-
port?: number | null;
|
|
75
|
-
/** Optional host passed to `app.listen(port, host)`. */
|
|
76
|
-
host?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Pre-existing Express app. If not provided, a new one is created and the
|
|
79
|
-
* helper calls `app.listen()` itself.
|
|
80
|
-
*/
|
|
81
|
-
app?: Application;
|
|
82
|
-
/**
|
|
83
|
-
* Feedback config — block + handler. Pass `false` to omit feedback buttons
|
|
84
|
-
* entirely. Pass an object to override action ids, button labels, or the
|
|
85
|
-
* feedback handler. Pass a function as `onFeedback` for the most common
|
|
86
|
-
* case where only the handler differs.
|
|
87
|
-
*/
|
|
88
|
-
feedback?: SlackAssistantFeedbackConfig | false;
|
|
89
|
-
/**
|
|
90
|
-
* Convenience shorthand: `onFeedback: handler` is equivalent to
|
|
91
|
-
* `feedback: { onFeedback: handler }`. Ignored if `feedback` is set.
|
|
92
|
-
*/
|
|
93
|
-
onFeedback?: SlackFeedbackHandler;
|
|
94
|
-
}
|
|
95
|
-
interface MountSlackAssistantAgentResult {
|
|
96
|
-
app: Application;
|
|
97
|
-
boltApp: App;
|
|
98
|
-
receiver: ExpressReceiver;
|
|
99
|
-
authMode: SlackDirectAuthMode;
|
|
100
|
-
routePath: string;
|
|
101
|
-
bridge: SlackAssistantBridge;
|
|
102
|
-
server?: Server;
|
|
103
|
-
}
|
|
104
|
-
declare function mountSlackAssistantAgent(options: MountSlackAssistantAgentOptions): Promise<MountSlackAssistantAgentResult>;
|
|
105
|
-
|
|
106
|
-
export { type MountSlackAssistantAgentOptions, type MountSlackAssistantAgentResult, mountSlackAssistantAgent };
|
package/dist/express.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as _slack_bolt from '@slack/bolt';
|
|
2
|
-
import { Server } from 'node:http';
|
|
3
|
-
import { AgentTurnSource } from '@cuylabs/agent-core';
|
|
4
|
-
import { Application } from 'express';
|
|
5
|
-
import { c as createSlackChannelAdapter } from './adapter-vbqtraAr.js';
|
|
6
|
-
import { a as SlackChannelOptions } from './types-BeGPexio.js';
|
|
7
|
-
import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/http';
|
|
8
|
-
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
9
|
-
import '@cuylabs/channel-slack/core';
|
|
10
|
-
import './options-CGUfVStV.js';
|
|
11
|
-
import './artifacts/index.js';
|
|
12
|
-
import '@cuylabs/channel-slack/artifacts';
|
|
13
|
-
import './interactive-BigrPKnu.js';
|
|
14
|
-
import '@cuylabs/channel-slack/interactive';
|
|
15
|
-
|
|
16
|
-
interface MountSlackAgentOptions extends Omit<SlackChannelOptions, "agent" | "source">, Omit<CreateSlackBoltAppOptions, "app" | "path" | "botToken" | "signingSecret" | "auth"> {
|
|
17
|
-
/**
|
|
18
|
-
* Slack bot token (`xoxb-...`).
|
|
19
|
-
* @default process.env.SLACK_BOT_TOKEN
|
|
20
|
-
*/
|
|
21
|
-
botToken?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Slack signing secret used to verify incoming webhook requests.
|
|
24
|
-
* @default process.env.SLACK_SIGNING_SECRET
|
|
25
|
-
*/
|
|
26
|
-
signingSecret?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Structured direct-mode auth config.
|
|
29
|
-
*
|
|
30
|
-
* Use this for:
|
|
31
|
-
* - multi-workspace OAuth installs
|
|
32
|
-
* - custom Bolt authorize callbacks
|
|
33
|
-
*
|
|
34
|
-
* When omitted, `mountSlackAgent()` defaults to single-workspace mode
|
|
35
|
-
* using `botToken` / `SLACK_BOT_TOKEN`.
|
|
36
|
-
*/
|
|
37
|
-
auth?: SlackDirectAuthOptions;
|
|
38
|
-
/**
|
|
39
|
-
* Exact Slack Events API callback path handled by Bolt.
|
|
40
|
-
*
|
|
41
|
-
* This becomes the request URL you configure in the Slack app:
|
|
42
|
-
* `https://<your-host>${path}`.
|
|
43
|
-
*
|
|
44
|
-
* @default "/slack/events"
|
|
45
|
-
*/
|
|
46
|
-
path?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Port to listen on.
|
|
49
|
-
* Set to `null` to skip `app.listen()` — caller manages the server.
|
|
50
|
-
* @default process.env.PORT || 3000
|
|
51
|
-
*/
|
|
52
|
-
port?: number | null;
|
|
53
|
-
/**
|
|
54
|
-
* Optional host/interface passed to `app.listen(port, host)`.
|
|
55
|
-
*/
|
|
56
|
-
host?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Pre-existing Express app. If not provided, a new one is created.
|
|
59
|
-
*
|
|
60
|
-
* When provided, the Bolt receiver router is mounted on `path` and no
|
|
61
|
-
* internal `app.listen()` is called (the caller must start the server).
|
|
62
|
-
*/
|
|
63
|
-
app?: Application;
|
|
64
|
-
}
|
|
65
|
-
interface MountSlackAgentResult {
|
|
66
|
-
/** The Express application */
|
|
67
|
-
app: Application;
|
|
68
|
-
/** The Bolt App instance */
|
|
69
|
-
boltApp: _slack_bolt.App;
|
|
70
|
-
/** The Bolt ExpressReceiver */
|
|
71
|
-
receiver: _slack_bolt.ExpressReceiver;
|
|
72
|
-
/** Resolved direct Slack auth mode */
|
|
73
|
-
authMode: SlackDirectAuthMode;
|
|
74
|
-
/** Exact Slack callback path handled by Bolt */
|
|
75
|
-
routePath: string;
|
|
76
|
-
/** The Slack channel adapter */
|
|
77
|
-
channelAdapter: ReturnType<typeof createSlackChannelAdapter>;
|
|
78
|
-
/** The Node HTTP server when `listen()` was started internally */
|
|
79
|
-
server?: Server;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Mount an agent-core-compatible turn source as a Slack bot on an Express app.
|
|
83
|
-
*
|
|
84
|
-
* This is the simplest way to deploy an agent-core agent to Slack. It handles:
|
|
85
|
-
* 1. Creating a Bolt `ExpressReceiver` with request verification.
|
|
86
|
-
* 2. Creating a Bolt `App` using one of the supported direct auth modes.
|
|
87
|
-
* 3. Creating the Slack channel adapter and mounting it on the Bolt App.
|
|
88
|
-
* 4. Registering `receiver.router` on the Express app.
|
|
89
|
-
* 5. Optionally starting the server.
|
|
90
|
-
*
|
|
91
|
-
* Single-workspace mode environment variables (if not passed explicitly):
|
|
92
|
-
* - `SLACK_BOT_TOKEN` — Bot OAuth token (`xoxb-...`)
|
|
93
|
-
* - `SLACK_SIGNING_SECRET` — App signing secret for request verification
|
|
94
|
-
*
|
|
95
|
-
* OAuth mode environment variables:
|
|
96
|
-
* - `SLACK_SIGNING_SECRET`
|
|
97
|
-
* - `SLACK_CLIENT_ID`
|
|
98
|
-
* - `SLACK_CLIENT_SECRET`
|
|
99
|
-
* - `SLACK_STATE_SECRET` unless you provide a custom state store
|
|
100
|
-
*/
|
|
101
|
-
declare function mountSlackAgent(source: AgentTurnSource, options?: MountSlackAgentOptions): Promise<MountSlackAgentResult>;
|
|
102
|
-
|
|
103
|
-
export { type MountSlackAgentOptions, type MountSlackAgentResult, mountSlackAgent };
|
package/dist/express.js
DELETED
package/dist/feedback/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { RegisterSlackFeedbackOptions, SLACK_FEEDBACK_ACTION_ID, SlackFeedbackBlockOptions, SlackFeedbackButtonConfig, SlackFeedbackContext, SlackFeedbackContextBlock, SlackFeedbackHandler, SlackFeedbackVerdict, createSlackFeedbackBlock, registerSlackFeedbackAction } from '@cuylabs/channel-slack/feedback';
|
package/dist/feedback/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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';
|
|
3
|
-
import '@cuylabs/agent-core';
|
|
4
|
-
import '@cuylabs/channel-slack/interactive';
|
|
5
|
-
import '@slack/bolt';
|
|
6
|
-
import '../interactive-BigrPKnu.js';
|
|
7
|
-
import '@cuylabs/channel-slack/core';
|
|
8
|
-
|
|
9
|
-
declare function createSlackInteractiveController(options?: SlackInteractiveControllerOptions): SlackInteractiveController;
|
|
10
|
-
|
|
11
|
-
export { SlackInteractiveController, SlackInteractiveControllerOptions, createSlackInteractiveController };
|
|
@@ -1,30 +0,0 @@
|
|
|
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 };
|