@cuylabs/channel-slack-agent-core 0.6.0 → 0.8.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 +7 -0
- package/dist/adapter/index.d.ts +6 -3
- package/dist/adapter/index.js +2 -2
- package/dist/{adapter-Cmd2C90g.d.ts → adapter-B3CI611y.d.ts} +1 -1
- package/dist/app-surface.d.ts +13 -3
- package/dist/app-surface.js +4 -4
- package/dist/app.d.ts +7 -3
- package/dist/app.js +5 -5
- package/dist/artifacts/index.d.ts +57 -0
- package/dist/artifacts/index.js +6 -0
- package/dist/assistant/index.d.ts +5 -3
- package/dist/assistant/index.js +2 -2
- package/dist/{chunk-FNT4TXNQ.js → chunk-236WN6JD.js} +1 -1
- package/dist/{chunk-5NQYLOAW.js → chunk-2R7B7NJR.js} +1 -1
- package/dist/{chunk-P7KK5GQG.js → chunk-6T6N4MRK.js} +13 -25
- package/dist/{chunk-ZDVD46RT.js → chunk-7YZWCSML.js} +263 -4
- package/dist/chunk-C7CHMYV6.js +226 -0
- package/dist/{chunk-TIQGJ52F.js → chunk-FQWFB54C.js} +14 -2
- package/dist/chunk-NNCVHQC4.js +94 -0
- package/dist/{chunk-VCXPNQRB.js → chunk-TCNJY7QA.js} +1 -1
- package/dist/{chunk-NOVWLAVP.js → chunk-TMADMHBN.js} +209 -20
- package/dist/{chunk-J6CW2RGO.js → chunk-X7ILLZZP.js} +359 -2
- package/dist/{chunk-QEJ7TAZJ.js → chunk-YSDFYHPC.js} +2 -2
- package/dist/express-assistant.d.ts +4 -2
- package/dist/express-assistant.js +3 -3
- package/dist/express.d.ts +5 -2
- package/dist/express.js +3 -3
- package/dist/history/index.d.ts +7 -3
- package/dist/index.d.ts +12 -6
- package/dist/index.js +28 -10
- package/dist/interactive/index.d.ts +43 -2
- package/dist/interactive/index.js +9 -3
- package/dist/{options-C7OYeNR-.d.ts → options-BcDReOJv.d.ts} +48 -0
- package/dist/{options-Uf-qmQKN.d.ts → options-C7-VXmhD.d.ts} +62 -2
- package/dist/shared/index.d.ts +20 -6
- package/dist/shared/index.js +1 -1
- package/dist/socket.d.ts +7 -3
- package/dist/socket.js +5 -5
- package/dist/{types-BqRzb_Cd.d.ts → types-CRWzJB5G.d.ts} +35 -0
- package/dist/types-CiwGU6zC.d.ts +56 -0
- package/dist/views/index.d.ts +8 -0
- package/dist/views/index.js +10 -0
- package/docs/README.md +7 -0
- package/docs/concepts/final-response-artifacts.md +39 -0
- package/docs/concepts/interactive-requests.md +43 -0
- package/docs/concepts/tool-task-rendering.md +46 -0
- package/docs/concepts/view-workflows.md +52 -0
- package/docs/reference/exports.md +18 -16
- package/package.json +14 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Tool Task Rendering
|
|
2
|
+
|
|
3
|
+
`chat-stream` mode can render Agent Core tool activity as Slack task updates.
|
|
4
|
+
The bridge owns the generic event-to-Slack mapping, while applications can
|
|
5
|
+
format titles, in-progress details, and completed output.
|
|
6
|
+
|
|
7
|
+
Use these hooks when a tool result has structured metadata that should be shown
|
|
8
|
+
more cleanly than the generic stringified result:
|
|
9
|
+
|
|
10
|
+
- `formatToolTitle(toolName)` controls the Slack task title.
|
|
11
|
+
- `formatToolDetails(event)` controls the in-progress task details for a
|
|
12
|
+
`tool-start` event.
|
|
13
|
+
- `formatToolResultOutput(event)` controls the completed task output for a
|
|
14
|
+
`tool-result` event.
|
|
15
|
+
|
|
16
|
+
`formatToolResultOutput` receives the full `tool-result` event, including
|
|
17
|
+
`toolName`, `toolCallId`, `result`, and any tool metadata preserved by Agent
|
|
18
|
+
Core. Return `undefined` to use the default formatter. Return `null` to omit the
|
|
19
|
+
completed task output intentionally.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
createSlackChannelAdapter({
|
|
23
|
+
source,
|
|
24
|
+
streamingMode: "chat-stream",
|
|
25
|
+
formatToolTitle: (toolName) => (toolName === "plan" ? "Plan" : toolName),
|
|
26
|
+
formatToolResultOutput: (event) => {
|
|
27
|
+
if (event.toolName !== "plan") {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const entries = readPlanEntries(event.metadata);
|
|
32
|
+
if (!entries) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return entries
|
|
37
|
+
.map(
|
|
38
|
+
(entry) => `${entry.status === "done" ? "[x]" : "[ ]"} ${entry.title}`,
|
|
39
|
+
)
|
|
40
|
+
.join("\n");
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Keep task rows compact. Slack task updates are a visible progress projection for
|
|
46
|
+
the current turn, not a durable audit log or replacement for the final answer.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# View Workflows
|
|
2
|
+
|
|
3
|
+
Agent view workflows connect Slack modal submissions to agent or product logic.
|
|
4
|
+
They sit above `@cuylabs/channel-slack/views`: the lower package owns Slack Web
|
|
5
|
+
API/Bolt mechanics, while this package adds namespaced callback ids, decoded
|
|
6
|
+
metadata, submitted state values, and app-surface mounting.
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
import {
|
|
10
|
+
encodeSlackViewPrivateMetadata,
|
|
11
|
+
openSlackModal,
|
|
12
|
+
} from "@cuylabs/channel-slack/views";
|
|
13
|
+
import { createSlackAgentViewWorkflowController } from "@cuylabs/channel-slack-agent-core/views";
|
|
14
|
+
|
|
15
|
+
const viewWorkflows = createSlackAgentViewWorkflowController({
|
|
16
|
+
namespace: "cdo",
|
|
17
|
+
workflows: [
|
|
18
|
+
{
|
|
19
|
+
id: "incident_triage",
|
|
20
|
+
onSubmission: async ({ metadata, stateValues, getStateValue, actor }) => {
|
|
21
|
+
const severity = getStateValue("severity", "value");
|
|
22
|
+
// Load product-owned workflow state by metadata.workflowId, validate the
|
|
23
|
+
// submitted values, then continue an agent turn or product workflow.
|
|
24
|
+
return { response_action: "clear" };
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
await openSlackModal({
|
|
31
|
+
client,
|
|
32
|
+
triggerId,
|
|
33
|
+
view: {
|
|
34
|
+
type: "modal",
|
|
35
|
+
callback_id: viewWorkflows.callbackIdFor("incident_triage"),
|
|
36
|
+
private_metadata: encodeSlackViewPrivateMetadata({
|
|
37
|
+
workflowId: "triage-123",
|
|
38
|
+
}),
|
|
39
|
+
title: { type: "plain_text", text: "Triage incident" },
|
|
40
|
+
submit: { type: "plain_text", text: "Continue" },
|
|
41
|
+
blocks: [],
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Pass the controller to `mountSlackAgentApp` / `installSlackAgentAppSurface` as
|
|
47
|
+
`viewWorkflows`. The controller installs `view_submission` and `view_closed`
|
|
48
|
+
handlers on the underlying Bolt app.
|
|
49
|
+
|
|
50
|
+
Keep `private_metadata` compact. Store durable workflow state in an application
|
|
51
|
+
database or existing request store and put only routing keys, such as
|
|
52
|
+
`workflowId`, `requestId`, or `sessionId`, into the modal.
|
|
@@ -3,22 +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
|
|
7
|
-
|
|
|
8
|
-
| `@cuylabs/channel-slack-agent-core`
|
|
9
|
-
| `@cuylabs/channel-slack-agent-core/adapter`
|
|
10
|
-
| `@cuylabs/channel-slack-agent-core/app`
|
|
11
|
-
| `@cuylabs/channel-slack-agent-core/app-surface`
|
|
12
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
13
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
14
|
-
| `@cuylabs/channel-slack-agent-core/express
|
|
15
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
16
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
17
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
18
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
19
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
20
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
21
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
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`, `@slack/types`; `pg` only when using connection-string Postgres storage | Agent Core approval and human-input 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 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 |
|
|
22
24
|
|
|
23
25
|
For generic Slack package exports, see
|
|
24
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.8.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",
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"import": "./dist/app-surface.js",
|
|
27
27
|
"default": "./dist/app-surface.js"
|
|
28
28
|
},
|
|
29
|
+
"./artifacts": {
|
|
30
|
+
"types": "./dist/artifacts/index.d.ts",
|
|
31
|
+
"import": "./dist/artifacts/index.js",
|
|
32
|
+
"default": "./dist/artifacts/index.js"
|
|
33
|
+
},
|
|
29
34
|
"./assistant": {
|
|
30
35
|
"types": "./dist/assistant/index.d.ts",
|
|
31
36
|
"import": "./dist/assistant/index.js",
|
|
@@ -75,6 +80,11 @@
|
|
|
75
80
|
"types": "./dist/source/index.d.ts",
|
|
76
81
|
"import": "./dist/source/index.js",
|
|
77
82
|
"default": "./dist/source/index.js"
|
|
83
|
+
},
|
|
84
|
+
"./views": {
|
|
85
|
+
"types": "./dist/views/index.d.ts",
|
|
86
|
+
"import": "./dist/views/index.js",
|
|
87
|
+
"default": "./dist/views/index.js"
|
|
78
88
|
}
|
|
79
89
|
},
|
|
80
90
|
"files": [
|
|
@@ -84,7 +94,7 @@
|
|
|
84
94
|
],
|
|
85
95
|
"dependencies": {
|
|
86
96
|
"@cuylabs/agent-core": "^7.2.0",
|
|
87
|
-
"@cuylabs/channel-slack": "^0.
|
|
97
|
+
"@cuylabs/channel-slack": "^0.8.0"
|
|
88
98
|
},
|
|
89
99
|
"peerDependencies": {
|
|
90
100
|
"@slack/bolt": ">=4.7.3",
|
|
@@ -134,9 +144,9 @@
|
|
|
134
144
|
"node": ">=20"
|
|
135
145
|
},
|
|
136
146
|
"scripts": {
|
|
137
|
-
"build": "tsup src/index.ts src/shared/index.ts src/adapter/index.ts src/app.ts src/app-surface.ts src/assistant/index.ts src/express.ts src/express-assistant.ts src/feedback/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/socket.ts src/source/index.ts --format esm --dts --clean",
|
|
147
|
+
"build": "tsup src/index.ts src/shared/index.ts src/adapter/index.ts src/app.ts src/app-surface.ts src/artifacts/index.ts src/assistant/index.ts src/express.ts src/express-assistant.ts src/feedback/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/socket.ts src/source/index.ts src/views/index.ts --format esm --dts --clean",
|
|
138
148
|
"clean": "rm -rf dist",
|
|
139
|
-
"dev": "tsup src/index.ts src/shared/index.ts src/adapter/index.ts src/app.ts src/app-surface.ts src/assistant/index.ts src/express.ts src/express-assistant.ts src/feedback/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/socket.ts src/source/index.ts --format esm --dts --watch",
|
|
149
|
+
"dev": "tsup src/index.ts src/shared/index.ts src/adapter/index.ts src/app.ts src/app-surface.ts src/artifacts/index.ts src/assistant/index.ts src/express.ts src/express-assistant.ts src/feedback/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/socket.ts src/source/index.ts src/views/index.ts --format esm --dts --watch",
|
|
140
150
|
"lint": "eslint \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\" --max-warnings=0",
|
|
141
151
|
"test": "vitest run",
|
|
142
152
|
"test:watch": "vitest",
|