@cursor/july 0.1.95 → 0.1.96
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/AGENTS.md +3 -4
- package/dist/channels/deployments/types.d.ts +1 -1
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/deployments/types.js +1 -0
- package/dist/channels/origin/api.d.ts +59 -13
- package/dist/channels/origin/api.d.ts.map +1 -1
- package/dist/channels/origin/api.js +168 -27
- package/dist/channels/origin/binding.d.ts +2 -2
- package/dist/channels/origin/checks.d.ts +6 -6
- package/dist/channels/origin/checks.js +6 -6
- package/dist/channels/origin/cursor-account.d.ts +5 -3
- package/dist/channels/origin/cursor-account.d.ts.map +1 -1
- package/dist/channels/origin/cursor-account.js +5 -3
- package/dist/channels/slack/api.d.ts +9 -0
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +36 -5
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +17 -46
- package/dist/channels/slack/dispatch.d.ts +7 -1
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +47 -23
- package/dist/channels/slack/inbound.d.ts +8 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +32 -0
- package/dist/channels/slack/live-delivery.d.ts +26 -29
- package/dist/channels/slack/live-delivery.d.ts.map +1 -1
- package/dist/channels/slack/live-delivery.js +172 -73
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +5 -1
- package/dist/channels/slack/nudge-carrier.d.ts +2 -0
- package/dist/channels/slack/nudge-carrier.d.ts.map +1 -1
- package/dist/channels/slack/nudge-carrier.js +48 -1
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +2 -2
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.BBj0klBO.js → app.jXleCmOc.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DFoGuETX.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CUEXpL78.js → VPLocalSearchBox.8LhyglIT.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DabmQnia.js → theme.9ged-pr2.js} +2 -2
- package/dist/docs/assets/index.md.CI93Ltlb.js +5 -0
- package/dist/docs/assets/{index.md.BoHaMdeZ.lean.js → index.md.CI93Ltlb.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.BsMOxDvh.js → reference_cli.md.CCnG-nJx.js} +2 -1
- package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.js +2 -0
- package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.lean.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/evals.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +4 -4
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +4 -4
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +3 -1
- package/dist/docs/llms-full.txt +102 -3
- package/dist/docs/llms.txt +1 -0
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +7 -6
- package/dist/docs/reference/cli.md +3 -2
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/code-wiki.html +28 -0
- package/dist/docs/templates/code-wiki.md +91 -0
- package/dist/docs/templates/demo.html +5 -5
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +5 -5
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/files-backends/cursor-hosted.d.ts +26 -4
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +32 -4
- package/dist/internal/advertise-tools.d.ts +2 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +15 -1
- package/dist/internal/bounded.d.ts +7 -0
- package/dist/internal/bounded.d.ts.map +1 -0
- package/dist/internal/bounded.js +32 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +7 -1
- package/dist/internal/conversation-mirror.d.ts +11 -8
- package/dist/internal/conversation-mirror.d.ts.map +1 -1
- package/dist/internal/conversation-mirror.js +116 -55
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +22 -48
- package/dist/internal/cursor/session-token.d.ts +45 -0
- package/dist/internal/cursor/session-token.d.ts.map +1 -0
- package/dist/internal/cursor/session-token.js +99 -0
- package/dist/internal/cursor-agent-template.d.ts +1 -1
- package/dist/internal/cursor-agent-template.d.ts.map +1 -1
- package/dist/internal/cursor-agent-template.js +1 -0
- package/dist/internal/framework-file-storage.d.ts +61 -0
- package/dist/internal/framework-file-storage.d.ts.map +1 -0
- package/dist/internal/framework-file-storage.js +204 -0
- package/dist/internal/framework-storage-selection.d.ts +11 -5
- package/dist/internal/framework-storage-selection.d.ts.map +1 -1
- package/dist/internal/framework-storage-selection.js +38 -11
- package/dist/internal/hosted-delivery.d.ts +7 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +4 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +2 -0
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +1 -3
- package/dist/internal/managed-delivery.d.ts +80 -0
- package/dist/internal/managed-delivery.d.ts.map +1 -0
- package/dist/internal/managed-delivery.js +86 -0
- package/dist/internal/runtime-dispatch-runner.d.ts +5 -1
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
- package/dist/internal/runtime-dispatch-runner.js +7 -0
- package/dist/internal/sdk-runner.d.ts +11 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +39 -8
- package/dist/internal/server.js +1 -0
- package/dist/internal/session-engine.d.ts +13 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +62 -3
- package/dist/internal/steering.d.ts +15 -0
- package/dist/internal/steering.d.ts.map +1 -0
- package/dist/internal/steering.js +18 -0
- package/dist/playground/assets/index-B1DDvBeC.css +1 -0
- package/dist/playground/assets/{index-CZA1uEWA.js → index-Cx9CclK_.js} +51 -51
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted.d.ts +8 -5
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +4 -3
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +3 -1
- package/docs/reference/cli.md +3 -2
- package/docs/templates/code-wiki.md +96 -0
- package/package.json +2 -2
- package/skills/ab/SKILL.md +13 -97
- package/skills/create-agent/SKILL.md +123 -223
- package/skills/debug/SKILL.md +34 -68
- package/skills/evals/SKILL.md +55 -180
- package/skills/framework-map/SKILL.md +83 -145
- package/skills/github/SKILL.md +53 -111
- package/skills/hillclimb/SKILL.md +40 -163
- package/skills/mcp-auth/SKILL.md +48 -107
- package/skills/otel/SKILL.md +22 -68
- package/skills/setup-slack/SKILL.md +77 -208
- package/src/channels/deployments/types.ts +1 -0
- package/src/channels/origin/api.ts +242 -30
- package/src/channels/origin/binding.ts +2 -2
- package/src/channels/origin/checks.ts +6 -6
- package/src/channels/origin/cursor-account.ts +5 -3
- package/src/channels/slack/api.ts +41 -5
- package/src/channels/slack/defaults.ts +15 -49
- package/src/channels/slack/dispatch.ts +56 -22
- package/src/channels/slack/inbound.ts +43 -0
- package/src/channels/slack/live-delivery.ts +235 -114
- package/src/channels/slack/manifest.ts +5 -1
- package/src/channels/slack/nudge-carrier.ts +48 -1
- package/src/channels/slack/slack-channel.ts +2 -0
- package/src/files-backends/cursor-hosted.ts +40 -7
- package/src/internal/advertise-tools.ts +18 -2
- package/src/internal/bounded.ts +28 -0
- package/src/internal/cli-deploy.ts +12 -0
- package/src/internal/conversation-mirror.ts +145 -69
- package/src/internal/cursor/backend-client.ts +34 -58
- package/src/internal/cursor/session-token.ts +115 -0
- package/src/internal/cursor-agent-template.ts +1 -0
- package/src/internal/framework-file-storage.ts +222 -0
- package/src/internal/framework-storage-selection.ts +51 -11
- package/src/internal/hosted-delivery.ts +10 -0
- package/src/internal/init-project.ts +2 -0
- package/src/internal/install-cursor-skills.ts +1 -4
- package/src/internal/managed-delivery.ts +125 -0
- package/src/internal/runtime-dispatch-runner.ts +10 -0
- package/src/internal/sdk-runner.ts +56 -8
- package/src/internal/server.ts +2 -0
- package/src/internal/session-engine.ts +64 -4
- package/src/internal/steering.ts +17 -0
- package/src/storage-backends/cursor-hosted.ts +9 -7
- package/src/types.ts +2 -1
- package/templates/code-wiki/README.md +34 -0
- package/templates/code-wiki/agent/agent.ts +8 -0
- package/templates/code-wiki/agent/channels/github.ts +144 -0
- package/templates/code-wiki/agent/instructions.md +39 -0
- package/templates/code-wiki/agent/lib/repos.ts +5 -0
- package/templates/code-wiki/agent/lib/wiki.ts +22 -0
- package/templates/code-wiki/agent/tools/apply_wiki.ts +219 -0
- package/templates/code-wiki/evals/evals.config.ts +5 -0
- package/templates/code-wiki/evals/wiki.eval.ts +132 -0
- package/templates/code-wiki/init.json +25 -0
- package/templates/code-wiki/package.json +18 -0
- package/templates/code-wiki/tsconfig.json +12 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +0 -1
- package/dist/docs/assets/index.md.BoHaMdeZ.js +0 -5
- package/dist/internal/deployment-scm-event-stream.d.ts +0 -116
- package/dist/internal/deployment-scm-event-stream.d.ts.map +0 -1
- package/dist/internal/deployment-scm-event-stream.js +0 -474
- package/dist/playground/assets/index-CF7hUDnQ.css +0 -1
- package/src/internal/deployment-scm-event-stream.ts +0 -593
- /package/dist/docs/assets/{reference_cli.md.BsMOxDvh.lean.js → reference_cli.md.CCnG-nJx.lean.js} +0 -0
|
@@ -144,19 +144,32 @@ export function truncateTitle(title, max) {
|
|
|
144
144
|
// ---------------------------------------------------------------------------
|
|
145
145
|
// Assistant / stream helpers
|
|
146
146
|
// ---------------------------------------------------------------------------
|
|
147
|
+
/**
|
|
148
|
+
* Show or clear the Working chip. Agent UX ignores empty
|
|
149
|
+
* `assistant.threads.setStatus`; `agents.sessions.setStatus` `active` is
|
|
150
|
+
* what actually clears it. The assistant call stays for loading_messages
|
|
151
|
+
* and older workspaces.
|
|
152
|
+
*/
|
|
147
153
|
export function setThreadStatus(args) {
|
|
148
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
155
|
if (args.channelId === "" || args.threadTs === "") {
|
|
150
156
|
return { ok: false, error: "missing_channel_or_thread" };
|
|
151
157
|
}
|
|
152
158
|
const status = truncateTypingStatus(args.status);
|
|
159
|
+
const sessionResult = yield callSlackApiSoft({
|
|
160
|
+
botToken: args.botToken,
|
|
161
|
+
operation: "agents.sessions.setStatus",
|
|
162
|
+
body: {
|
|
163
|
+
channel_id: args.channelId,
|
|
164
|
+
thread_ts: args.threadTs,
|
|
165
|
+
status: status.length > 0 ? "processing" : "active",
|
|
166
|
+
},
|
|
167
|
+
});
|
|
153
168
|
const body = {
|
|
154
169
|
channel_id: args.channelId,
|
|
155
170
|
thread_ts: args.threadTs,
|
|
156
171
|
status,
|
|
157
172
|
};
|
|
158
|
-
// Empty status clears Slack's assistant chip ("App is working…").
|
|
159
|
-
// Sending loading_messages with it keeps the chip rotating.
|
|
160
173
|
if (status.length > 0) {
|
|
161
174
|
const loadingRaw = args.loadingMessages !== undefined && args.loadingMessages.length > 0
|
|
162
175
|
? args.loadingMessages
|
|
@@ -169,11 +182,18 @@ export function setThreadStatus(args) {
|
|
|
169
182
|
body.loading_messages = loading_messages;
|
|
170
183
|
}
|
|
171
184
|
}
|
|
172
|
-
|
|
185
|
+
const assistantResult = yield callSlackApiSoft({
|
|
173
186
|
botToken: args.botToken,
|
|
174
187
|
operation: "assistant.threads.setStatus",
|
|
175
188
|
body,
|
|
176
189
|
});
|
|
190
|
+
if (sessionResult.ok) {
|
|
191
|
+
return sessionResult;
|
|
192
|
+
}
|
|
193
|
+
if (sessionResult.unsupported === true || assistantResult.ok) {
|
|
194
|
+
return assistantResult;
|
|
195
|
+
}
|
|
196
|
+
return sessionResult;
|
|
177
197
|
});
|
|
178
198
|
}
|
|
179
199
|
export function setThreadTitle(args) {
|
|
@@ -214,12 +234,23 @@ export function startChatStream(args) {
|
|
|
214
234
|
const body = {
|
|
215
235
|
channel: args.channel,
|
|
216
236
|
};
|
|
237
|
+
// Empty markdown_text is rejected or opens a stream the assistant pane
|
|
238
|
+
// never attaches. Recipients are required outside DMs.
|
|
217
239
|
if (args.thread_ts !== undefined && args.thread_ts !== "") {
|
|
218
240
|
body.thread_ts = args.thread_ts;
|
|
219
241
|
}
|
|
220
|
-
if (args.markdown_text !== undefined) {
|
|
242
|
+
if (args.markdown_text !== undefined && args.markdown_text !== "") {
|
|
221
243
|
body.markdown_text = args.markdown_text;
|
|
222
244
|
}
|
|
245
|
+
if (args.chunks !== undefined && args.chunks.length > 0) {
|
|
246
|
+
body.chunks = args.chunks;
|
|
247
|
+
}
|
|
248
|
+
if (args.recipient_user_id !== undefined && args.recipient_user_id !== "") {
|
|
249
|
+
body.recipient_user_id = args.recipient_user_id;
|
|
250
|
+
}
|
|
251
|
+
if (args.recipient_team_id !== undefined && args.recipient_team_id !== "") {
|
|
252
|
+
body.recipient_team_id = args.recipient_team_id;
|
|
253
|
+
}
|
|
223
254
|
const result = yield callSlackApiSoft({
|
|
224
255
|
botToken: args.botToken,
|
|
225
256
|
operation: "chat.startStream",
|
|
@@ -477,7 +508,7 @@ export function buildSlackBinding(args) {
|
|
|
477
508
|
const result = yield setThreadStatus(Object.assign({ botToken: args.botToken, channelId: args.channelId, threadTs,
|
|
478
509
|
status }, (loadingMessages === undefined ? {} : { loadingMessages })));
|
|
479
510
|
if (!result.ok) {
|
|
480
|
-
log.warn("
|
|
511
|
+
log.warn("slack setStatus not-ok", {
|
|
481
512
|
error: result.error,
|
|
482
513
|
channel: args.channelId,
|
|
483
514
|
thread_ts: threadTs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAe3D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAMpB,wBA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,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,yBAA8B,GACtC,oBAAoB,CAAC,iBAAiB,CAAC,CA4WzC"}
|
|
@@ -114,7 +114,7 @@ export function buildDefaultEvents(options = {}) {
|
|
|
114
114
|
status: "",
|
|
115
115
|
});
|
|
116
116
|
if (!result.ok) {
|
|
117
|
-
getLog().warn("
|
|
117
|
+
getLog().warn("slack setStatus not-ok", {
|
|
118
118
|
error: result.error,
|
|
119
119
|
channel: channelId,
|
|
120
120
|
thread_ts: threadTs,
|
|
@@ -150,18 +150,6 @@ export function buildDefaultEvents(options = {}) {
|
|
|
150
150
|
status: "Working…",
|
|
151
151
|
loadingMessages,
|
|
152
152
|
});
|
|
153
|
-
// Retry streaming each turn unless a prior call proved the feature
|
|
154
|
-
// unsupported for this workspace/app. Thinking stays on setStatus
|
|
155
|
-
// (Cursor-account proxy pins agent username/icon on that method).
|
|
156
|
-
if (!streaming || state.streamingUnavailable === true) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
yield strategy.start({
|
|
160
|
-
channel,
|
|
161
|
-
channelId: state.channelId,
|
|
162
|
-
threadTs: state.threadTs,
|
|
163
|
-
sessionId: event.sessionId,
|
|
164
|
-
});
|
|
165
153
|
});
|
|
166
154
|
},
|
|
167
155
|
"message.appended"(event, channel) {
|
|
@@ -170,18 +158,14 @@ export function buildDefaultEvents(options = {}) {
|
|
|
170
158
|
if (!streaming || channel.state.streamingUnavailable === true) {
|
|
171
159
|
return;
|
|
172
160
|
}
|
|
173
|
-
const streamTs = channel.state.streamTs;
|
|
174
161
|
const channelId = (_a = channel.state.streamChannelId) !== null && _a !== void 0 ? _a : channel.state.channelId;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
channelId === null ||
|
|
178
|
-
channelId === "") {
|
|
162
|
+
const threadTs = channel.state.threadTs;
|
|
163
|
+
if (channelId === null || channelId === "" || threadTs === null) {
|
|
179
164
|
return;
|
|
180
165
|
}
|
|
181
166
|
yield strategy.append({
|
|
182
167
|
channel,
|
|
183
168
|
channelId,
|
|
184
|
-
streamTs,
|
|
185
169
|
text: event.data.text,
|
|
186
170
|
sessionId: event.sessionId,
|
|
187
171
|
});
|
|
@@ -235,19 +219,18 @@ export function buildDefaultEvents(options = {}) {
|
|
|
235
219
|
if (strategy.inlineToolSteps &&
|
|
236
220
|
thinkingSteps &&
|
|
237
221
|
streaming &&
|
|
238
|
-
channel.state.streamingUnavailable !== true
|
|
239
|
-
channel.state.streamTs !== null &&
|
|
240
|
-
channel.state.streamTs !== "") {
|
|
222
|
+
channel.state.streamingUnavailable !== true) {
|
|
241
223
|
const channelId = (_a = channel.state.streamChannelId) !== null && _a !== void 0 ? _a : channel.state.channelId;
|
|
242
|
-
|
|
224
|
+
const threadTs = channel.state.threadTs;
|
|
225
|
+
if (channelId !== null && channelId !== "" && threadTs !== null) {
|
|
243
226
|
const chunks = buildTaskChunksForCalls(event.data.calls, "in_progress");
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
ts: channel.state.streamTs,
|
|
227
|
+
const streamed = yield strategy.appendChunks({
|
|
228
|
+
channel,
|
|
229
|
+
channelId,
|
|
248
230
|
chunks,
|
|
231
|
+
sessionId: event.sessionId,
|
|
249
232
|
});
|
|
250
|
-
if (
|
|
233
|
+
if (streamed) {
|
|
251
234
|
if (channel.state.channelId !== null &&
|
|
252
235
|
channel.state.threadTs !== null) {
|
|
253
236
|
yield setThreadStatus({
|
|
@@ -301,7 +284,7 @@ export function buildDefaultEvents(options = {}) {
|
|
|
301
284
|
},
|
|
302
285
|
"message.completed"(event, channel) {
|
|
303
286
|
return __awaiter(this, void 0, void 0, function* () {
|
|
304
|
-
var _a, _b
|
|
287
|
+
var _a, _b;
|
|
305
288
|
const log = getLog();
|
|
306
289
|
if (event.data.finishReason === "tool_call") {
|
|
307
290
|
channel.state.pendingToolCallMessage = (_a = firstNonEmptyLine(event.data.text)) !== null && _a !== void 0 ? _a : null;
|
|
@@ -315,26 +298,15 @@ export function buildDefaultEvents(options = {}) {
|
|
|
315
298
|
// Empty final text: still close any open stream / clear the skeleton
|
|
316
299
|
// and clear typing.
|
|
317
300
|
if (event.data.text === "") {
|
|
318
|
-
|
|
319
|
-
yield strategy.finalizeEmpty({
|
|
320
|
-
channel,
|
|
321
|
-
channelId: (_b = state.streamChannelId) !== null && _b !== void 0 ? _b : state.channelId,
|
|
322
|
-
streamTs: state.streamTs,
|
|
323
|
-
});
|
|
324
|
-
channel.state.streamTs = null;
|
|
325
|
-
}
|
|
301
|
+
yield strategy.finalizeEmpty({ channel });
|
|
326
302
|
yield clearWorkingStatus(state.channelId, state.threadTs);
|
|
327
303
|
return;
|
|
328
304
|
}
|
|
329
|
-
const canStream = streaming &&
|
|
330
|
-
|
|
331
|
-
state.streamTs !== null &&
|
|
332
|
-
state.streamTs !== "";
|
|
333
|
-
if (canStream && state.streamTs !== null) {
|
|
305
|
+
const canStream = streaming && state.streamingUnavailable !== true;
|
|
306
|
+
if (canStream) {
|
|
334
307
|
const { delivered } = yield strategy.finalize({
|
|
335
308
|
channel,
|
|
336
|
-
channelId: (
|
|
337
|
-
streamTs: state.streamTs,
|
|
309
|
+
channelId: (_b = state.streamChannelId) !== null && _b !== void 0 ? _b : state.channelId,
|
|
338
310
|
text: event.data.text,
|
|
339
311
|
sessionId: event.sessionId,
|
|
340
312
|
});
|
|
@@ -414,11 +386,10 @@ export function buildDefaultEvents(options = {}) {
|
|
|
414
386
|
}
|
|
415
387
|
const errorText = formatSlackTurnFailureMessage(event.data.message);
|
|
416
388
|
let delivered = false;
|
|
417
|
-
if (
|
|
389
|
+
if (streaming && state.streamingUnavailable !== true) {
|
|
418
390
|
({ delivered } = yield strategy.fail({
|
|
419
391
|
channel,
|
|
420
392
|
channelId: (_a = state.streamChannelId) !== null && _a !== void 0 ? _a : state.channelId,
|
|
421
|
-
streamTs: state.streamTs,
|
|
422
393
|
errorText,
|
|
423
394
|
sessionId: event.sessionId,
|
|
424
395
|
}));
|
|
@@ -7,7 +7,7 @@ import type { SlackBotMentionGate } from "./bot-mentions.js";
|
|
|
7
7
|
import type { ChannelPostWatcher } from "./channel-watch.js";
|
|
8
8
|
import type { EventIdDedupe } from "./event-id-dedupe.js";
|
|
9
9
|
import { type SlackLog } from "./log.js";
|
|
10
|
-
import type { SlackChannelState, SlackContinuationProbes, SlackCredentials, SlackMessage, SlackMessageHandler } from "./types.js";
|
|
10
|
+
import type { SlackChannelState, SlackContinuationProbes, SlackCredentials, SlackMessage, SlackMessageHandler, SlackSuggestedPrompt } from "./types.js";
|
|
11
11
|
/** Blank per-session adapter state. */
|
|
12
12
|
export declare function emptySlackChannelState(patch?: Partial<SlackChannelState>): SlackChannelState;
|
|
13
13
|
export interface SlackInboundDispatchDeps extends SlackContinuationProbes {
|
|
@@ -51,6 +51,12 @@ export interface SlackInboundDispatchDeps extends SlackContinuationProbes {
|
|
|
51
51
|
* `false` to admit them (or when an upstream gate already refused them).
|
|
52
52
|
*/
|
|
53
53
|
blockExternals?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Suggested prompts written on `assistant_thread_started` so the
|
|
56
|
+
* assistant pane is not blank before the first user message.
|
|
57
|
+
*/
|
|
58
|
+
suggestedPrompts?: SlackSuggestedPrompt[];
|
|
59
|
+
suggestedPromptsTitle?: string;
|
|
54
60
|
}
|
|
55
61
|
export declare function dispatchInboundMessage(args: {
|
|
56
62
|
kind: "app_mention" | "direct_message" | "channel_post" | "reaction_added" | "block_action";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/dispatch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,oBAAoB,EAI1B,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/dispatch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAE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EAAE,oBAAoB,CAAC;CACrC,GAAG,OAAO,CAAC,IAAI,CAAC,CAgVhB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAiMT"}
|
|
@@ -12,12 +12,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import { continuationSource, normalizeIdentity, } from "../../internal/continuation-identity.js";
|
|
14
14
|
import { routeLocalIngressContinuation } from "../../internal/local-ingress.js";
|
|
15
|
+
import { steeringEnabled } from "../../internal/steering.js";
|
|
15
16
|
import { buildSlackBinding, slackContinuationKey } from "./api.js";
|
|
16
|
-
import { firstLineTitle, maybeSetThreadTitle } from "./assistant.js";
|
|
17
|
+
import { firstLineTitle, maybeSetSuggestedPrompts, maybeSetThreadTitle, } from "./assistant.js";
|
|
17
18
|
import { appendSlackAttachmentAnnotations, prepareSlackAttachments, SLACK_ATTACHMENT_ONLY_PROMPT, } from "./attachments.js";
|
|
18
19
|
import { handleSlackEvalDirective, parseSlackEvalDirective, } from "./eval-directive.js";
|
|
19
20
|
import { isExternalSlackSender } from "./external-policy.js";
|
|
20
|
-
import { formatSlackContextBlock, parseAppMentionEvent, parseChannelMessageEvent, parseDirectMessageEvent, parseReactionAddedEvent, } from "./inbound.js";
|
|
21
|
+
import { formatSlackContextBlock, parseAppMentionEvent, parseAssistantThreadStarted, parseChannelMessageEvent, parseDirectMessageEvent, parseReactionAddedEvent, } from "./inbound.js";
|
|
21
22
|
import { defaultSlackLog } from "./log.js";
|
|
22
23
|
import { isWholeMessageStop } from "./stop.js";
|
|
23
24
|
import { loadSlackThreadContextBlock, loadSlackThreadDeltaBlock, } from "./thread-context.js";
|
|
@@ -311,22 +312,24 @@ export function dispatchInboundMessage(args) {
|
|
|
311
312
|
continuation,
|
|
312
313
|
event_id: args.eventId,
|
|
313
314
|
});
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
315
|
+
if (!steeringEnabled()) {
|
|
316
|
+
try {
|
|
317
|
+
yield (_r = args.host.slackNudges) === null || _r === void 0 ? void 0 : _r.append({
|
|
318
|
+
continuationKey: continuation,
|
|
319
|
+
sourceTs: message.ts,
|
|
320
|
+
text: media.userText,
|
|
321
|
+
author: (_s = message.author) === null || _s === void 0 ? void 0 : _s.userName,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
catch (nudgeError) {
|
|
325
|
+
log.warn("nudge append failed", {
|
|
326
|
+
error: nudgeError instanceof Error
|
|
327
|
+
? nudgeError.message
|
|
328
|
+
: String(nudgeError),
|
|
329
|
+
continuation,
|
|
330
|
+
event_id: args.eventId,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
330
333
|
}
|
|
331
334
|
try {
|
|
332
335
|
if (args.followUpStatus !== false) {
|
|
@@ -361,9 +364,9 @@ export function dispatchInboundMessage(args) {
|
|
|
361
364
|
* present. Returns true when a handler was scheduled.
|
|
362
365
|
*/
|
|
363
366
|
export function dispatchInboundFromEventBody(body, deps) {
|
|
364
|
-
var _a, _b;
|
|
365
|
-
var
|
|
366
|
-
const log = (
|
|
367
|
+
var _a, _b, _c;
|
|
368
|
+
var _d, _e, _f, _g;
|
|
369
|
+
const log = (_d = deps.log) !== null && _d !== void 0 ? _d : defaultSlackLog;
|
|
367
370
|
let eventId;
|
|
368
371
|
if (body !== null && typeof body === "object" && !Array.isArray(body)) {
|
|
369
372
|
const root = body;
|
|
@@ -386,7 +389,7 @@ export function dispatchInboundFromEventBody(body, deps) {
|
|
|
386
389
|
if (((_a = mention.author) === null || _a === void 0 ? void 0 : _a.isBot) === true) {
|
|
387
390
|
// Parse only admits bot-authored mentions when a gate exists, so the
|
|
388
391
|
// fallback is defensive.
|
|
389
|
-
const verdict = (
|
|
392
|
+
const verdict = (_e = (_b = deps.botMentionGate) === null || _b === void 0 ? void 0 : _b.evaluate(mention)) !== null && _e !== void 0 ? _e : {
|
|
390
393
|
allow: false,
|
|
391
394
|
reason: "bot mentions not enabled",
|
|
392
395
|
};
|
|
@@ -395,7 +398,7 @@ export function dispatchInboundFromEventBody(body, deps) {
|
|
|
395
398
|
event_id: eventId,
|
|
396
399
|
channel: mention.channelId,
|
|
397
400
|
thread_ts: mention.threadTs,
|
|
398
|
-
from_bot: (
|
|
401
|
+
from_bot: (_f = mention.author.botId) !== null && _f !== void 0 ? _f : mention.author.userId,
|
|
399
402
|
reason: verdict.reason,
|
|
400
403
|
});
|
|
401
404
|
return false;
|
|
@@ -450,6 +453,27 @@ export function dispatchInboundFromEventBody(body, deps) {
|
|
|
450
453
|
: { interruptContinuation: deps.interruptContinuation })), (eventId === undefined ? {} : { eventId }))));
|
|
451
454
|
return true;
|
|
452
455
|
}
|
|
456
|
+
const assistantThread = parseAssistantThreadStarted(body);
|
|
457
|
+
if (assistantThread !== null) {
|
|
458
|
+
const prompts = (_g = deps.suggestedPrompts) !== null && _g !== void 0 ? _g : [];
|
|
459
|
+
log.info("assistant thread started", {
|
|
460
|
+
channel: assistantThread.channelId,
|
|
461
|
+
thread_ts: assistantThread.threadTs,
|
|
462
|
+
user: assistantThread.userId,
|
|
463
|
+
event_id: eventId,
|
|
464
|
+
});
|
|
465
|
+
if (prompts.length > 0) {
|
|
466
|
+
deps.waitUntil(maybeSetSuggestedPrompts({
|
|
467
|
+
botToken: (_c = deps.credentials) === null || _c === void 0 ? void 0 : _c.botToken,
|
|
468
|
+
channelId: assistantThread.channelId,
|
|
469
|
+
threadTs: assistantThread.threadTs,
|
|
470
|
+
prompts,
|
|
471
|
+
title: deps.suggestedPromptsTitle,
|
|
472
|
+
log,
|
|
473
|
+
}));
|
|
474
|
+
}
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
453
477
|
if (deps.channelWatch !== undefined) {
|
|
454
478
|
// Parse keeps bot-authored posts; the watcher enforces the per-channel
|
|
455
479
|
// policy (includeBotPosts, own-post loop safety) with skip logging.
|
|
@@ -14,6 +14,14 @@ export interface ParseAppMentionOptions {
|
|
|
14
14
|
includeBotAuthored?: boolean;
|
|
15
15
|
}
|
|
16
16
|
export declare function parseAppMentionEvent(body: unknown, options?: ParseAppMentionOptions): SlackMessage | null;
|
|
17
|
+
export interface SlackAssistantThreadStarted {
|
|
18
|
+
channelId: string;
|
|
19
|
+
threadTs: string;
|
|
20
|
+
userId?: string;
|
|
21
|
+
teamId?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Slack fires this when a user opens the assistant pane. No model turn. */
|
|
24
|
+
export declare function parseAssistantThreadStarted(body: unknown): SlackAssistantThreadStarted | null;
|
|
17
25
|
/**
|
|
18
26
|
* Parse DM / IM messages. More generous than a strict channel_type check:
|
|
19
27
|
* accepts `channel_type === "im"` or channel ids starting with `D`, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/inbound.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,YAAY,CAAC;AAe5D,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASxD;AAsDD,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,sBAAsB,GAC/B,YAAY,GAAG,IAAI,CAsBrB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CA8B1E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,O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
79
|
const delegation = parseDelegationMetadata(event);
|
|
80
80
|
return delegation === undefined ? message : Object.assign(Object.assign({}, message), { delegation });
|
|
81
81
|
}
|
|
82
|
+
/** Slack fires this when a user opens the assistant pane. No model turn. */
|
|
83
|
+
export function parseAssistantThreadStarted(body) {
|
|
84
|
+
var _a;
|
|
85
|
+
const root = asRecord(body);
|
|
86
|
+
if (root === null || root.type !== "event_callback") {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const event = asRecord(root.event);
|
|
90
|
+
if (event === null || event.type !== "assistant_thread_started") {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const thread = asRecord(event.assistant_thread);
|
|
94
|
+
if (thread === null) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const channelId = asString(thread.channel_id);
|
|
98
|
+
const threadTs = asString(thread.thread_ts);
|
|
99
|
+
if (channelId === undefined ||
|
|
100
|
+
channelId === "" ||
|
|
101
|
+
threadTs === undefined ||
|
|
102
|
+
threadTs === "") {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const userId = asString(thread.user_id);
|
|
106
|
+
const teamId = (_a = asString(root.team_id)) !== null && _a !== void 0 ? _a : asString(event.team_id);
|
|
107
|
+
return {
|
|
108
|
+
channelId,
|
|
109
|
+
threadTs,
|
|
110
|
+
userId: userId === undefined || userId === "" ? undefined : userId,
|
|
111
|
+
teamId: teamId === undefined || teamId === "" ? undefined : teamId,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
82
114
|
/**
|
|
83
115
|
* Parse DM / IM messages. More generous than a strict channel_type check:
|
|
84
116
|
* accepts `channel_type === "im"` or channel ids starting with `D`, and
|
|
@@ -4,68 +4,65 @@
|
|
|
4
4
|
* Cursor-account channels do not use this path — they reply with a single
|
|
5
5
|
* final `chat.postMessage` and put thinking on `assistant.threads.setStatus`
|
|
6
6
|
* (no message edits).
|
|
7
|
+
*
|
|
8
|
+
* Assistant-pane threads only render stream APIs. Start lazily with the
|
|
9
|
+
* first real markdown/chunks plus recipient ids — empty startStream is
|
|
10
|
+
* rejected or never attaches.
|
|
7
11
|
*/
|
|
8
12
|
import type { ChannelEventContext } from "../../types.js";
|
|
9
13
|
import type { SlackLog } from "./log.js";
|
|
14
|
+
import { type StreamTaskChunk } from "./stream.js";
|
|
10
15
|
import type { SlackBotToken, SlackChannelState } from "./types.js";
|
|
11
16
|
type SlackChannel = ChannelEventContext<SlackChannelState>;
|
|
12
17
|
export interface LiveDeliveryDeps {
|
|
13
18
|
botToken: SlackBotToken | undefined;
|
|
14
19
|
getLog: () => SlackLog;
|
|
15
20
|
}
|
|
21
|
+
type OpenArgs = {
|
|
22
|
+
channel: SlackChannel;
|
|
23
|
+
channelId: string;
|
|
24
|
+
threadTs: string;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
markdown_text?: string;
|
|
27
|
+
chunks?: StreamTaskChunk[];
|
|
28
|
+
};
|
|
29
|
+
type StreamArgs = {
|
|
30
|
+
channel: SlackChannel;
|
|
31
|
+
channelId: string;
|
|
32
|
+
sessionId: string;
|
|
33
|
+
};
|
|
16
34
|
/**
|
|
17
35
|
* How the default handlers deliver an in-progress reply. Methods write live
|
|
18
36
|
* delivery state (`streamTs`, `streamChannelId`, `lastPostedText`,
|
|
19
37
|
* `streamingUnavailable`) on `channel.state` directly.
|
|
20
38
|
*/
|
|
21
39
|
export interface LiveDeliveryStrategy {
|
|
22
|
-
/** True when tool-call thinking steps can be appended to the live message. */
|
|
23
40
|
readonly inlineToolSteps: boolean;
|
|
24
|
-
/** Open the live message
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
channelId: string;
|
|
28
|
-
threadTs: string;
|
|
29
|
-
sessionId: string;
|
|
30
|
-
}): Promise<void>;
|
|
31
|
-
/** Push the latest cumulative text to the live message (throttled). */
|
|
32
|
-
append(args: {
|
|
33
|
-
channel: SlackChannel;
|
|
34
|
-
channelId: string;
|
|
35
|
-
streamTs: string;
|
|
41
|
+
/** Open the live message with the first real markdown or task chunks. */
|
|
42
|
+
open(args: OpenArgs): Promise<boolean>;
|
|
43
|
+
append(args: StreamArgs & {
|
|
36
44
|
text: string;
|
|
37
|
-
sessionId: string;
|
|
38
45
|
}): Promise<void>;
|
|
46
|
+
appendChunks(args: StreamArgs & {
|
|
47
|
+
chunks: StreamTaskChunk[];
|
|
48
|
+
}): Promise<boolean>;
|
|
39
49
|
/**
|
|
40
50
|
* Flush the final reply text. `delivered` is false only when the caller must
|
|
41
51
|
* post the full reply as a fresh message (finalize failed on partial text).
|
|
42
52
|
*/
|
|
43
|
-
finalize(args: {
|
|
44
|
-
channel: SlackChannel;
|
|
45
|
-
channelId: string;
|
|
46
|
-
streamTs: string;
|
|
53
|
+
finalize(args: StreamArgs & {
|
|
47
54
|
text: string;
|
|
48
|
-
sessionId: string;
|
|
49
55
|
}): Promise<{
|
|
50
56
|
delivered: boolean;
|
|
51
57
|
}>;
|
|
52
|
-
/** Close the live message when the turn produced no final text. */
|
|
53
58
|
finalizeEmpty(args: {
|
|
54
59
|
channel: SlackChannel;
|
|
55
|
-
channelId: string;
|
|
56
|
-
streamTs: string;
|
|
57
60
|
}): Promise<void>;
|
|
58
|
-
/** Best-effort remove a live message left open after the turn ended. */
|
|
59
61
|
cleanupOrphan(args: {
|
|
60
62
|
channel: SlackChannel;
|
|
61
63
|
}): Promise<void>;
|
|
62
|
-
|
|
63
|
-
fail(args: {
|
|
64
|
-
channel: SlackChannel;
|
|
65
|
-
channelId: string;
|
|
66
|
-
streamTs: string;
|
|
64
|
+
fail(args: StreamArgs & {
|
|
67
65
|
errorText: string;
|
|
68
|
-
sessionId: string;
|
|
69
66
|
}): Promise<{
|
|
70
67
|
delivered: boolean;
|
|
71
68
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-delivery.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/live-delivery.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"live-delivery.d.ts","sourceRo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