@open-everywhere/provider-slack 0.7.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/agent/access/slack-attachment-fetch.ts +2 -1
- package/agent/app-manifest.ts +15 -1
- package/agent/channels/slack-agent-session.ts +249 -0
- package/agent/channels/slack-attachments.ts +20 -11
- package/agent/channels/slack-commands.ts +172 -12
- package/agent/channels/slack-context.ts +0 -5
- package/agent/channels/slack-events.ts +103 -29
- package/agent/channels/slack-follow-ups.ts +148 -0
- package/agent/channels/slack-front.ts +232 -26
- package/agent/channels/slack-home.ts +9 -3
- package/agent/channels/slack-identity.ts +9 -1
- package/agent/channels/slack-memory-canvas.ts +192 -51
- package/agent/channels/slack-origin-codec.ts +9 -0
- package/agent/channels/slack-post-arm.ts +68 -11
- package/agent/channels/slack-read.ts +27 -2
- package/agent/channels/slack-reply-blocks.ts +180 -0
- package/agent/channels/slack-reply-feedback.ts +75 -0
- package/agent/channels/slack-shortcut.ts +1 -1
- package/agent/channels/slack-voice-clips.ts +82 -0
- package/agent/channels/slack-wake-backscroll.ts +0 -5
- package/agent/channels/slack.ts +74 -13
- package/agent/docs-generated.ts +1282 -2
- package/agent/ops.ts +14 -21
- package/agent/register.ts +13 -0
- package/agent/setup/credentials.ts +17 -0
- package/agent/setup/page.ts +6 -3
- package/agent/surface-parity.ts +2 -0
- package/dist/agent/access/slack-attachment-fetch.d.ts.map +1 -1
- package/dist/agent/access/slack-attachment-fetch.js.map +1 -1
- package/dist/agent/app-manifest.d.ts.map +1 -1
- package/dist/agent/app-manifest.js +15 -1
- package/dist/agent/app-manifest.js.map +1 -1
- package/dist/agent/channels/slack-agent-session.d.ts +81 -0
- package/dist/agent/channels/slack-agent-session.d.ts.map +1 -0
- package/dist/agent/channels/slack-agent-session.js +198 -0
- package/dist/agent/channels/slack-agent-session.js.map +1 -0
- package/dist/agent/channels/slack-attachments.d.ts +11 -0
- package/dist/agent/channels/slack-attachments.d.ts.map +1 -1
- package/dist/agent/channels/slack-attachments.js +21 -14
- package/dist/agent/channels/slack-attachments.js.map +1 -1
- package/dist/agent/channels/slack-commands.d.ts +113 -10
- package/dist/agent/channels/slack-commands.d.ts.map +1 -1
- package/dist/agent/channels/slack-commands.js +146 -13
- package/dist/agent/channels/slack-commands.js.map +1 -1
- package/dist/agent/channels/slack-context.d.ts +1 -2
- package/dist/agent/channels/slack-context.d.ts.map +1 -1
- package/dist/agent/channels/slack-context.js +0 -4
- package/dist/agent/channels/slack-context.js.map +1 -1
- package/dist/agent/channels/slack-events.d.ts +46 -97
- package/dist/agent/channels/slack-events.d.ts.map +1 -1
- package/dist/agent/channels/slack-events.js +86 -21
- package/dist/agent/channels/slack-events.js.map +1 -1
- package/dist/agent/channels/slack-follow-ups.d.ts +44 -0
- package/dist/agent/channels/slack-follow-ups.d.ts.map +1 -0
- package/dist/agent/channels/slack-follow-ups.js +129 -0
- package/dist/agent/channels/slack-follow-ups.js.map +1 -0
- package/dist/agent/channels/slack-front.d.ts +28 -45
- package/dist/agent/channels/slack-front.d.ts.map +1 -1
- package/dist/agent/channels/slack-front.js +207 -22
- package/dist/agent/channels/slack-front.js.map +1 -1
- package/dist/agent/channels/slack-home.d.ts.map +1 -1
- package/dist/agent/channels/slack-home.js +10 -3
- package/dist/agent/channels/slack-home.js.map +1 -1
- package/dist/agent/channels/slack-identity.d.ts +7 -21
- package/dist/agent/channels/slack-identity.d.ts.map +1 -1
- package/dist/agent/channels/slack-identity.js +3 -1
- package/dist/agent/channels/slack-identity.js.map +1 -1
- package/dist/agent/channels/slack-memory-canvas.d.ts +21 -5
- package/dist/agent/channels/slack-memory-canvas.d.ts.map +1 -1
- package/dist/agent/channels/slack-memory-canvas.js +162 -52
- package/dist/agent/channels/slack-memory-canvas.js.map +1 -1
- package/dist/agent/channels/slack-origin-codec.d.ts.map +1 -1
- package/dist/agent/channels/slack-origin-codec.js +10 -0
- package/dist/agent/channels/slack-origin-codec.js.map +1 -1
- package/dist/agent/channels/slack-post-arm.d.ts +21 -1
- package/dist/agent/channels/slack-post-arm.d.ts.map +1 -1
- package/dist/agent/channels/slack-post-arm.js +57 -10
- package/dist/agent/channels/slack-post-arm.js.map +1 -1
- package/dist/agent/channels/slack-read.d.ts +11 -1
- package/dist/agent/channels/slack-read.d.ts.map +1 -1
- package/dist/agent/channels/slack-read.js +27 -3
- package/dist/agent/channels/slack-read.js.map +1 -1
- package/dist/agent/channels/slack-reply-blocks.d.ts +29 -0
- package/dist/agent/channels/slack-reply-blocks.d.ts.map +1 -0
- package/dist/agent/channels/slack-reply-blocks.js +172 -0
- package/dist/agent/channels/slack-reply-blocks.js.map +1 -0
- package/dist/agent/channels/slack-reply-feedback.d.ts +23 -0
- package/dist/agent/channels/slack-reply-feedback.d.ts.map +1 -0
- package/dist/agent/channels/slack-reply-feedback.js +63 -0
- package/dist/agent/channels/slack-reply-feedback.js.map +1 -0
- package/dist/agent/channels/slack-shortcut.d.ts +10 -0
- package/dist/agent/channels/slack-shortcut.d.ts.map +1 -1
- package/dist/agent/channels/slack-shortcut.js +1 -1
- package/dist/agent/channels/slack-shortcut.js.map +1 -1
- package/dist/agent/channels/slack-voice-clips.d.ts +16 -0
- package/dist/agent/channels/slack-voice-clips.d.ts.map +1 -0
- package/dist/agent/channels/slack-voice-clips.js +80 -0
- package/dist/agent/channels/slack-voice-clips.js.map +1 -0
- package/dist/agent/channels/slack-wake-backscroll.d.ts +0 -2
- package/dist/agent/channels/slack-wake-backscroll.d.ts.map +1 -1
- package/dist/agent/channels/slack-wake-backscroll.js +0 -4
- package/dist/agent/channels/slack-wake-backscroll.js.map +1 -1
- package/dist/agent/channels/slack.d.ts +22 -1
- package/dist/agent/channels/slack.d.ts.map +1 -1
- package/dist/agent/channels/slack.js +63 -13
- package/dist/agent/channels/slack.js.map +1 -1
- package/dist/agent/docs-generated.d.ts.map +1 -1
- package/dist/agent/docs-generated.js +1282 -2
- package/dist/agent/docs-generated.js.map +1 -1
- package/dist/agent/ops.d.ts +1 -1
- package/dist/agent/ops.d.ts.map +1 -1
- package/dist/agent/ops.js +15 -21
- package/dist/agent/ops.js.map +1 -1
- package/dist/agent/register.d.ts.map +1 -1
- package/dist/agent/register.js +12 -1
- package/dist/agent/register.js.map +1 -1
- package/dist/agent/setup/credentials.d.ts +12 -0
- package/dist/agent/setup/credentials.d.ts.map +1 -1
- package/dist/agent/setup/credentials.js +17 -0
- package/dist/agent/setup/credentials.js.map +1 -1
- package/dist/agent/setup/page.d.ts.map +1 -1
- package/dist/agent/setup/page.js +6 -3
- package/dist/agent/setup/page.js.map +1 -1
- package/dist/agent/surface-parity.d.ts.map +1 -1
- package/dist/agent/surface-parity.js +2 -0
- package/dist/agent/surface-parity.js.map +1 -1
- package/package.json +31 -3
|
@@ -109,6 +109,26 @@ export async function resolveSlackAttachmentDurable(fileId, org) {
|
|
|
109
109
|
return undefined;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* The size-guarded byte pull over a TRUSTED `url_private`: the bot-token, host-pinned fetch, then the Content-Length
|
|
114
|
+
* pre-check (rejects with {@link AttachmentOversizeError} phase "declared" BEFORE the body is read), then the post-read
|
|
115
|
+
* cap (phase "actual"). Two callers: the guarded resolver below, and the voice-clip loader (slack-voice-clips.ts),
|
|
116
|
+
* which reads a clip off the event that woke the agent. Both pass an event-supplied URL, never a model string.
|
|
117
|
+
*/
|
|
118
|
+
export async function pullSlackAttachmentBytes(ctx, ref, maxBytes) {
|
|
119
|
+
const res = await fetchSlackAttachment(ctx, ref);
|
|
120
|
+
if (!res.ok)
|
|
121
|
+
throw new Error(`fetching the upload failed (HTTP ${res.status})`);
|
|
122
|
+
// Content-Length pre-check off the declared length — reject before reading the body.
|
|
123
|
+
const declared = Number.parseInt(res.headers.get("content-length") ?? "", 10);
|
|
124
|
+
if (Number.isFinite(declared) && declared > maxBytes)
|
|
125
|
+
throw new AttachmentOversizeError(declared, "declared", maxBytes);
|
|
126
|
+
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
127
|
+
// Post-read cap — a chunked response can exceed the (possibly-absent) Content-Length.
|
|
128
|
+
if (bytes.byteLength > maxBytes)
|
|
129
|
+
throw new AttachmentOversizeError(bytes.byteLength, "actual", maxBytes);
|
|
130
|
+
return bytes;
|
|
131
|
+
}
|
|
112
132
|
/**
|
|
113
133
|
* Register Slack as an attachment-plane resolver (channels/attachments.ts) — the neutral seam
|
|
114
134
|
* describe_image consults so its contract carries no per-platform union arm. The resolver wraps the
|
|
@@ -146,20 +166,7 @@ export function registerSlackAttachmentResolver() {
|
|
|
146
166
|
ref: `slack-file:${attachmentId}`,
|
|
147
167
|
mimeType: rec.mimeType,
|
|
148
168
|
name: rec.name,
|
|
149
|
-
|
|
150
|
-
const res = await fetchSlackAttachment(ctx, { urlPrivate: rec.urlPrivate, id: attachmentId });
|
|
151
|
-
if (!res.ok)
|
|
152
|
-
throw new Error(`fetching the upload failed (HTTP ${res.status})`);
|
|
153
|
-
// Content-Length pre-check off the declared length — reject before reading the body.
|
|
154
|
-
const declared = Number.parseInt(res.headers.get("content-length") ?? "", 10);
|
|
155
|
-
if (Number.isFinite(declared) && declared > maxBytes)
|
|
156
|
-
throw new AttachmentOversizeError(declared, "declared", maxBytes);
|
|
157
|
-
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
158
|
-
// Post-read cap — a chunked response can exceed the (possibly-absent) Content-Length.
|
|
159
|
-
if (bytes.byteLength > maxBytes)
|
|
160
|
-
throw new AttachmentOversizeError(bytes.byteLength, "actual", maxBytes);
|
|
161
|
-
return bytes;
|
|
162
|
-
},
|
|
169
|
+
pull: ({ maxBytes }) => pullSlackAttachmentBytes(ctx, { urlPrivate: rec.urlPrivate, id: attachmentId }, maxBytes),
|
|
163
170
|
};
|
|
164
171
|
},
|
|
165
172
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-attachments.js","sourceRoot":"","sources":["../../../agent/channels/slack-attachments.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,uDAAuD;AACvD,EAAE;AACF,+FAA+F;AAC/F,gGAAgG;AAChG,iGAAiG;AACjG,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,kGAAkG;AAClG,mGAAmG;AACnG,gGAAgG;AAChG,EAAE;AACF,kGAAkG;AAClG,gGAAgG;AAChG,+FAA+F;AAC/F,sFAAsF;AACtF,EAAE;AACF,gGAAgG;AAChG,qGAAqG;AACrG,iGAAiG;AACjG,iGAAiG;AACjG,kGAAkG;AAClG,qGAAqG;AACrG,gGAAgG;AAChG,mGAAmG;AACnG,4FAA4F;AAE5F,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"slack-attachments.js","sourceRoot":"","sources":["../../../agent/channels/slack-attachments.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,uDAAuD;AACvD,EAAE;AACF,+FAA+F;AAC/F,gGAAgG;AAChG,iGAAiG;AACjG,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,kGAAkG;AAClG,mGAAmG;AACnG,gGAAgG;AAChG,EAAE;AACF,kGAAkG;AAClG,gGAAgG;AAChG,+FAA+F;AAC/F,sFAAsF;AACtF,EAAE;AACF,gGAAgG;AAChG,qGAAqG;AACrG,iGAAiG;AACjG,iGAAiG;AACjG,kGAAkG;AAClG,qGAAqG;AACrG,gGAAgG;AAChG,mGAAmG;AACnG,4FAA4F;AAE5F,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,GAGxB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAoB3E;;kDAEkD;AAClD,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpD,MAAM,WAAW,GAAG,IAAI,CAAC;AAC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AAC,CAAC;YAC9F,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,YAAY,kBAAkB,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;YACxG,OAAO,EAAE,KAAK,EAAE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,GAAG,EAAE,cAAc,YAAY,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;QACvH,CAAC;QACD,+FAA+F;QAC/F,+FAA+F;QAC/F,yFAAyF;QACzF,6FAA6F;QAC7F,8FAA8F;QAC9F,KAAK,CAAC,cAAc,CAAC,YAAY,EAAE,GAAG;YACpC,MAAM,GAAG,GAAG,MAAM,6BAA6B,CAAC,YAAY,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACzF,IAAI,CAAC,GAAG;gBAAE,OAAO,SAAS,CAAC,CAAC,oDAAoD;YAChF,OAAO;gBACL,GAAG,EAAE,cAAc,YAAY,EAAE;gBACjC,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,wBAAwB,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,QAAQ,CAAC;aAClH,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,mGAAmG;AACnG,mGAAmG;AACnG,iGAAiG;AAEjG,2EAA2E;AAC3E,MAAM,UAAU,6BAA6B;IAC3C,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import { type BindableContext } from "@open-everywhere/core/agent/adapter-api.js";
|
|
1
|
+
import { type BindableContext, type SurfaceBinding } from "@open-everywhere/core/agent/adapter-api.js";
|
|
2
2
|
/** The public URL Slack POSTs the "/oe" slash command to (the app's Slash Command Request URL). */
|
|
3
3
|
export declare const SLACK_COMMANDS_ROUTE = "/eve/v1/slack/commands";
|
|
4
|
+
/** What the route learned about a command's trust before it binds. `dmPartnerTrust` is the invoker's own
|
|
5
|
+
* verdict in a 1:1 DM. `room` is a channel's `conversations.info` verdict, present whenever Slack answered
|
|
6
|
+
* it, whoever typed the command. `invokerMember` is present only when `users.info` CONFIRMED the invoker a
|
|
7
|
+
* member (see {@link slashRoomVerdict}). The person's binding stamps `room` only beside `invokerMember`;
|
|
8
|
+
* the room's binding stamps it alone (OPE-2588). */
|
|
9
|
+
export interface SlashTrustFacts {
|
|
10
|
+
readonly dmPartnerTrust?: "internal" | "external";
|
|
11
|
+
readonly room?: {
|
|
12
|
+
readonly extShared: boolean;
|
|
13
|
+
};
|
|
14
|
+
readonly invokerMember?: true;
|
|
15
|
+
}
|
|
16
|
+
/** Which verdict a slash binding resolves: the PERSON's (the room's verdict folded with the invoker
|
|
17
|
+
* check, which every member gate reads) or the ROOM's alone (which the room's budget reads). */
|
|
18
|
+
export type SlashTrustLeg = "person" | "room";
|
|
4
19
|
/** Build the BindableContext the identity seam (bindFrom/bindSlack) expects from Slack's
|
|
5
20
|
* slash-command form fields. Slack's slash-command payload carries no `channel_type` /
|
|
6
21
|
* `is_private` bit (unlike an app_mention/message event) — `bindSlack`'s existing fallbacks
|
|
@@ -13,15 +28,103 @@ export declare const SLACK_COMMANDS_ROUTE = "/eve/v1/slack/commands";
|
|
|
13
28
|
* reads — so a Grid declared once now answers here the same way it answers at every other door,
|
|
14
29
|
* instead of resolving as though the line were absent.
|
|
15
30
|
*
|
|
16
|
-
* 🔴 STATE ITS REACH EXACTLY
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
31
|
+
* 🔴 STATE ITS REACH EXACTLY. For a CHANNEL command the rung does NOT change `binding.trust`: the
|
|
32
|
+
* room's own verdict answers there (see below), and `bindFrom` takes that raw verdict ahead of any
|
|
33
|
+
* vouch. The rung reaches `binding.trust` only on a DM-shaped `/oe` (a `D…` channel id), and only
|
|
34
|
+
* when the invoker probe gave no verdict: the mapper then leaves trust undefined and the vouch
|
|
35
|
+
* answers (see below). Spread conditionally, like every other door: a single-workspace install
|
|
36
|
+
* stamps nothing.
|
|
37
|
+
*
|
|
38
|
+
* 🔴 A CHANNEL COMMAND CARRIES THE ROOM'S OWN VERDICT (OPE-2579). Slack's slash payload carries no
|
|
39
|
+
* sharing bit, so before this every channel `/oe` bound `slackTrust(undefined, undefined,
|
|
40
|
+
* "channel")`, which fails closed to `external`. A member in an internal channel was then refused
|
|
41
|
+
* `/oe suggest on` as an outsider. The route now passes {@link slashRoomVerdict}'s answer as
|
|
42
|
+
* `is_ext_shared` + `trust_checked`, the two attributes a channel message stamps from the same
|
|
43
|
+
* TTL-cached `conversations.info`. So a channel command reads the room's `internal` or `external` as a
|
|
44
|
+
* message in that room does. On the `person` leg (the default) the verdict is stamped only for an
|
|
45
|
+
* invoker `users.info` confirms a member. On the `room` leg it is stamped for anybody, because that
|
|
46
|
+
* leg answers the room's budget, not a member gate (OPE-2588, {@link bindSlashCommand}). No verdict
|
|
47
|
+
* stamps nothing, and the command stays fail-closed `external`.
|
|
48
|
+
*
|
|
49
|
+
* 🔴 A DM COMMAND CARRIES THE INVOKER'S OWN VERDICT (OPE-2579). In a 1:1 DM the invoker IS the
|
|
50
|
+
* partner, and the route passes {@link slashInvokerDmTrust}'s answer as `dm_partner_trust`, the
|
|
51
|
+
* attribute the chat DM leg stamps from the same `users.info` probe. Before this, a workspace vouch
|
|
52
|
+
* alone answered a DM command, so a guest or a Connect stranger in their DM with the app read
|
|
53
|
+
* `internal` here while the same person read `external` in a DM turn. A verdict outranks the vouch
|
|
54
|
+
* in both directions, exactly as in a DM turn: a guest reads `external` under a workspace vouch, and
|
|
55
|
+
* a confirmed member reads `internal` with no declaration at all. No verdict leaves the attribute
|
|
56
|
+
* unset and the binding resolves as before. This reaches every `/oe` command typed in a DM, not
|
|
57
|
+
* only `watch`. */
|
|
58
|
+
export declare function bindableForSlashCommand(params: URLSearchParams, invoker?: SlashTrustFacts, leg?: SlashTrustLeg): BindableContext;
|
|
59
|
+
/**
|
|
60
|
+
* The invoker's own membership verdict for a 1:1 DM command, in `dm_partner_trust`'s vocabulary, or
|
|
61
|
+
* `{}` when there is none to give (OPE-2579). It is the chat DM leg's reading of the same probe
|
|
62
|
+
* (slack-front.ts `liveDmPartnerTrust`): `slackAuthorIsMember` decides, so the two doors cannot
|
|
63
|
+
* drift on what a guest is. A channel or group DM asks nothing here: there the ROOM's verdict is the
|
|
64
|
+
* binding's trust, and {@link slashRoomVerdict} reads it.
|
|
65
|
+
*
|
|
66
|
+
* 🔴 NO VERDICT IS NOT A VERDICT. No user id, no bot token, a refused `users.info`, a transport
|
|
67
|
+
* failure or a probe slower than {@link INVOKER_PROBE_MS} all answer `{}`, which leaves the binding
|
|
68
|
+
* exactly as it resolved before this probe existed. An unanswered probe never invents a guest, and
|
|
69
|
+
* never invents a member.
|
|
70
|
+
*/
|
|
71
|
+
export declare function slashInvokerDmTrust(params: URLSearchParams, probe?: (userId: string, teamId: string | undefined) => Promise<boolean | undefined>): Promise<{
|
|
72
|
+
readonly dmPartnerTrust?: "internal" | "external";
|
|
73
|
+
}>;
|
|
74
|
+
/** The room facts {@link slashRoomVerdict} reads: `slackChannelFactsFor`'s shape, which every channel wake reads. */
|
|
75
|
+
export type SlashRoomFacts = (channelId: string) => Promise<{
|
|
76
|
+
readonly channelType?: string;
|
|
77
|
+
readonly extShared?: boolean;
|
|
78
|
+
readonly trustChecked?: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* A CHANNEL command's room verdict and invoker check, or `{}` when there is no room verdict to give
|
|
82
|
+
* (OPE-2579). The room read is `slackChannelFactsFor`, the TTL-cached `conversations.info` every
|
|
83
|
+
* channel wake reads, so the command door and the message door cannot disagree about one room.
|
|
84
|
+
*
|
|
85
|
+
* 🔴 THE INVOKER LEG, AND IT FAILS CLOSED. A channel message keeps the room's verdict on the auth and marks
|
|
86
|
+
* a guest author on the side (slack-events.ts `slackWakeAuthorFacts`), because one guest's message must not
|
|
87
|
+
* demote the channel's memory for everybody. A command has no session to protect: its binding exists for
|
|
88
|
+
* one answer, and `/oe suggest on` and `/oe watch more|less` read `binding.trust` as "is this person a
|
|
89
|
+
* member". So the route folds the author leg into the binding's `trust`, the composition Discord and
|
|
90
|
+
* Teams make: `invokerMember` is set only when `users.info` CONFIRMS the invoker a member, and the
|
|
91
|
+
* person's binding stamps the room's verdict only beside it. A guest, a Slack Connect stranger, and a
|
|
92
|
+
* person the probe could not check (no `users:read`, a refusal, a timeout) all leave `trust` fail-closed
|
|
93
|
+
* `external`. The message door fails OPEN on an unanswered probe because it marks a turn. Here `trust`
|
|
94
|
+
* IS the member gate, and a channel has no declaration to fall back to the way a DM command does.
|
|
95
|
+
*
|
|
96
|
+
* 🔴 THE ROOM'S VERDICT IS RETURNED FOR EVERY INVOKER (OPE-2588). `/oe budget` names the room's budget,
|
|
97
|
+
* and a channel's turns are charged under the room's domain, whoever typed them. So {@link bindSlashCommand}
|
|
98
|
+
* binds the room's verdict alone into `roomTrust`, and the budget reads that. A guest's `trust` is
|
|
99
|
+
* unchanged, and `/oe budget` reads both to refuse a guest in an internal channel (commands/core.ts
|
|
100
|
+
* `budgetWithheldFrom`). `/oe cover on` refuses outside a DM before it reads trust.
|
|
101
|
+
*
|
|
102
|
+
* 🔴 ONLY A ROOM IN THE CHANNEL MODE IS STAMPED. A 1:1 DM has its own leg ({@link slashInvokerDmTrust}).
|
|
103
|
+
* A group DM, or a room whose type Slack did not report, stamps nothing, so its binding is unchanged.
|
|
104
|
+
* Stamping a sharing verdict on a group DM the binding still calls a channel would mix two modes' rules.
|
|
105
|
+
*
|
|
106
|
+
* 🔴 NO VERDICT IS NOT A VERDICT. A failed or refused `conversations.info`, a response without the check,
|
|
107
|
+
* or a read slower than {@link INVOKER_PROBE_MS} answers `{}`. The command then binds `external`, as
|
|
108
|
+
* before this read existed. The room read and the invoker probe run in parallel inside one ack budget.
|
|
109
|
+
*/
|
|
110
|
+
export declare function slashRoomVerdict(params: URLSearchParams, roomFacts?: SlashRoomFacts, probe?: (userId: string, teamId: string | undefined) => Promise<boolean | undefined>): Promise<SlashTrustFacts>;
|
|
111
|
+
/** Both legs, for whichever kind of room the command came from. Never throws. */
|
|
112
|
+
export declare function slashTrustFacts(params: URLSearchParams): Promise<SlashTrustFacts>;
|
|
113
|
+
/**
|
|
114
|
+
* The slash command's binding, with the room's trust and the person's trust kept apart (OPE-2588).
|
|
115
|
+
*
|
|
116
|
+
* `trust` is the PERSON leg: the member gate `/oe suggest on`, `/oe watch more|less` and `/oe cover on`
|
|
117
|
+
* read. `roomTrust` is the ROOM leg: the same `bindFrom` walk over the room's verdict alone, so the
|
|
118
|
+
* declarations and the fail-closed default apply to it unchanged. `/oe budget` and the caps behind
|
|
119
|
+
* `raise` and `clear` read it through `roomTrustOf`. Before this the binding carried one value, so a
|
|
120
|
+
* guest in an internal channel read the external domain's budget while that channel's turns were
|
|
121
|
+
* charged under the internal domain. Now `/oe budget` refuses that guest, because a guest must not read
|
|
122
|
+
* an internal room's caps and spend (Tommy's ruling on #1431).
|
|
123
|
+
*
|
|
124
|
+
* In a DM both legs bind the same context, so the two values are equal. Every other field comes from
|
|
125
|
+
* the person's binding. The two bindings differ only in the two trust attributes, which move no key.
|
|
126
|
+
*/
|
|
127
|
+
export declare function bindSlashCommand(params: URLSearchParams, facts: SlashTrustFacts): SurfaceBinding;
|
|
25
128
|
declare const _default: import("eve/channels").Channel<undefined, Record<string, unknown>, Record<string, unknown>>;
|
|
26
129
|
export default _default;
|
|
27
130
|
//# sourceMappingURL=slack-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-commands.d.ts","sourceRoot":"","sources":["../../../agent/channels/slack-commands.ts"],"names":[],"mappings":"AAqCA,OAAO,
|
|
1
|
+
{"version":3,"file":"slack-commands.d.ts","sourceRoot":"","sources":["../../../agent/channels/slack-commands.ts"],"names":[],"mappings":"AAqCA,OAAO,EAYL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,4CAA4C,CAAC;AASpD,mGAAmG;AACnG,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAS7D;;;;qDAIqD;AACrD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;CAC/B;AAED;iGACiG;AACjG,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAsCoB;AACpB,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,eAAe,EAAE,GAAG,GAAE,aAAwB,GAAG,eAAe,CAqB1I;AAMD;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,eAAe,EACvB,KAAK,GAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAuB,GACxG,OAAO,CAAC;IAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;CAAE,CAAC,CAKhE;AAED,qHAAqH;AACrH,MAAM,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE9J;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,eAAe,EACvB,SAAS,GAAE,cAAqC,EAChD,KAAK,GAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAuB,GACxG,OAAO,CAAC,eAAe,CAAC,CAW1B;AAED,iFAAiF;AACjF,wBAAsB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAEvF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,cAAc,CAIhG"}
|
|
@@ -34,8 +34,10 @@
|
|
|
34
34
|
import { defineChannel, POST } from "eve/channels";
|
|
35
35
|
import { verifySlackSignature } from "./slack-front.js";
|
|
36
36
|
import { slackSigningSecret } from "../setup/credentials.js";
|
|
37
|
-
import { commandFailureText, bindFrom, runOeCommand, oeSlash, parseSlackCommandText, resolvePartition, getOperationalStore, admittedTenantsFromConfig, unadmittedTenantLog, UNADMITTED_TENANT_DROP_REASON, } from "@open-everywhere/core/agent/adapter-api.js";
|
|
37
|
+
import { commandFailureText, bindFrom, runOeCommand, oeSlash, parseSlackCommandText, resolvePartition, auditSurfaceModeFrom, getOperationalStore, admittedTenantsFromConfig, unadmittedTenantLog, UNADMITTED_TENANT_DROP_REASON, } from "@open-everywhere/core/agent/adapter-api.js";
|
|
38
38
|
import { slackTenantAdmission } from "./slack-tenant-fence.js";
|
|
39
|
+
import { slackAuthorIsMember, slackChannelFactsFor } from "./slack-events.js";
|
|
40
|
+
import { slackMode } from "./slack-identity.js";
|
|
39
41
|
function log(msg) {
|
|
40
42
|
console.log(`[open-everywhere:slack-commands] ${msg}`);
|
|
41
43
|
}
|
|
@@ -59,16 +61,36 @@ function formField(params, name) {
|
|
|
59
61
|
* reads — so a Grid declared once now answers here the same way it answers at every other door,
|
|
60
62
|
* instead of resolving as though the line were absent.
|
|
61
63
|
*
|
|
62
|
-
* 🔴 STATE ITS REACH EXACTLY
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
|
|
64
|
+
* 🔴 STATE ITS REACH EXACTLY. For a CHANNEL command the rung does NOT change `binding.trust`: the
|
|
65
|
+
* room's own verdict answers there (see below), and `bindFrom` takes that raw verdict ahead of any
|
|
66
|
+
* vouch. The rung reaches `binding.trust` only on a DM-shaped `/oe` (a `D…` channel id), and only
|
|
67
|
+
* when the invoker probe gave no verdict: the mapper then leaves trust undefined and the vouch
|
|
68
|
+
* answers (see below). Spread conditionally, like every other door: a single-workspace install
|
|
69
|
+
* stamps nothing.
|
|
70
|
+
*
|
|
71
|
+
* 🔴 A CHANNEL COMMAND CARRIES THE ROOM'S OWN VERDICT (OPE-2579). Slack's slash payload carries no
|
|
72
|
+
* sharing bit, so before this every channel `/oe` bound `slackTrust(undefined, undefined,
|
|
73
|
+
* "channel")`, which fails closed to `external`. A member in an internal channel was then refused
|
|
74
|
+
* `/oe suggest on` as an outsider. The route now passes {@link slashRoomVerdict}'s answer as
|
|
75
|
+
* `is_ext_shared` + `trust_checked`, the two attributes a channel message stamps from the same
|
|
76
|
+
* TTL-cached `conversations.info`. So a channel command reads the room's `internal` or `external` as a
|
|
77
|
+
* message in that room does. On the `person` leg (the default) the verdict is stamped only for an
|
|
78
|
+
* invoker `users.info` confirms a member. On the `room` leg it is stamped for anybody, because that
|
|
79
|
+
* leg answers the room's budget, not a member gate (OPE-2588, {@link bindSlashCommand}). No verdict
|
|
80
|
+
* stamps nothing, and the command stays fail-closed `external`.
|
|
81
|
+
*
|
|
82
|
+
* 🔴 A DM COMMAND CARRIES THE INVOKER'S OWN VERDICT (OPE-2579). In a 1:1 DM the invoker IS the
|
|
83
|
+
* partner, and the route passes {@link slashInvokerDmTrust}'s answer as `dm_partner_trust`, the
|
|
84
|
+
* attribute the chat DM leg stamps from the same `users.info` probe. Before this, a workspace vouch
|
|
85
|
+
* alone answered a DM command, so a guest or a Connect stranger in their DM with the app read
|
|
86
|
+
* `internal` here while the same person read `external` in a DM turn. A verdict outranks the vouch
|
|
87
|
+
* in both directions, exactly as in a DM turn: a guest reads `external` under a workspace vouch, and
|
|
88
|
+
* a confirmed member reads `internal` with no declaration at all. No verdict leaves the attribute
|
|
89
|
+
* unset and the binding resolves as before. This reaches every `/oe` command typed in a DM, not
|
|
90
|
+
* only `watch`. */
|
|
91
|
+
export function bindableForSlashCommand(params, invoker, leg = "person") {
|
|
71
92
|
const enterpriseId = formField(params, "enterprise_id");
|
|
93
|
+
const room = invoker?.room && (leg === "room" || invoker.invokerMember === true) ? invoker.room : undefined;
|
|
72
94
|
return {
|
|
73
95
|
channel: { kind: "slack" },
|
|
74
96
|
session: {
|
|
@@ -78,6 +100,8 @@ export function bindableForSlashCommand(params) {
|
|
|
78
100
|
team_id: formField(params, "team_id") ?? "",
|
|
79
101
|
channel_id: formField(params, "channel_id") ?? "",
|
|
80
102
|
...(enterpriseId ? { enterprise_id: enterpriseId } : {}),
|
|
103
|
+
...(invoker?.dmPartnerTrust ? { dm_partner_trust: invoker.dmPartnerTrust } : {}),
|
|
104
|
+
...(room ? { is_ext_shared: String(room.extShared), trust_checked: "true" } : {}),
|
|
81
105
|
},
|
|
82
106
|
principalId: formField(params, "user_id") ?? "",
|
|
83
107
|
principalType: "slack-user",
|
|
@@ -86,6 +110,109 @@ export function bindableForSlashCommand(params) {
|
|
|
86
110
|
},
|
|
87
111
|
};
|
|
88
112
|
}
|
|
113
|
+
/** How long each trust read (the invoker probe, the room read) may take before the route answers without
|
|
114
|
+
* it. Slack wants its ack inside three seconds, and `slackForm`'s 429 backoff can wait longer than that. */
|
|
115
|
+
const INVOKER_PROBE_MS = 1_500;
|
|
116
|
+
/**
|
|
117
|
+
* The invoker's own membership verdict for a 1:1 DM command, in `dm_partner_trust`'s vocabulary, or
|
|
118
|
+
* `{}` when there is none to give (OPE-2579). It is the chat DM leg's reading of the same probe
|
|
119
|
+
* (slack-front.ts `liveDmPartnerTrust`): `slackAuthorIsMember` decides, so the two doors cannot
|
|
120
|
+
* drift on what a guest is. A channel or group DM asks nothing here: there the ROOM's verdict is the
|
|
121
|
+
* binding's trust, and {@link slashRoomVerdict} reads it.
|
|
122
|
+
*
|
|
123
|
+
* 🔴 NO VERDICT IS NOT A VERDICT. No user id, no bot token, a refused `users.info`, a transport
|
|
124
|
+
* failure or a probe slower than {@link INVOKER_PROBE_MS} all answer `{}`, which leaves the binding
|
|
125
|
+
* exactly as it resolved before this probe existed. An unanswered probe never invents a guest, and
|
|
126
|
+
* never invents a member.
|
|
127
|
+
*/
|
|
128
|
+
export async function slashInvokerDmTrust(params, probe = slackAuthorIsMember) {
|
|
129
|
+
const userId = formField(params, "user_id");
|
|
130
|
+
if (!userId || slackMode(undefined, formField(params, "channel_id")) !== "dm")
|
|
131
|
+
return {};
|
|
132
|
+
const member = await withinAckBudget(probe(userId, formField(params, "team_id")));
|
|
133
|
+
return member === undefined ? {} : { dmPartnerTrust: member ? "internal" : "external" };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A CHANNEL command's room verdict and invoker check, or `{}` when there is no room verdict to give
|
|
137
|
+
* (OPE-2579). The room read is `slackChannelFactsFor`, the TTL-cached `conversations.info` every
|
|
138
|
+
* channel wake reads, so the command door and the message door cannot disagree about one room.
|
|
139
|
+
*
|
|
140
|
+
* 🔴 THE INVOKER LEG, AND IT FAILS CLOSED. A channel message keeps the room's verdict on the auth and marks
|
|
141
|
+
* a guest author on the side (slack-events.ts `slackWakeAuthorFacts`), because one guest's message must not
|
|
142
|
+
* demote the channel's memory for everybody. A command has no session to protect: its binding exists for
|
|
143
|
+
* one answer, and `/oe suggest on` and `/oe watch more|less` read `binding.trust` as "is this person a
|
|
144
|
+
* member". So the route folds the author leg into the binding's `trust`, the composition Discord and
|
|
145
|
+
* Teams make: `invokerMember` is set only when `users.info` CONFIRMS the invoker a member, and the
|
|
146
|
+
* person's binding stamps the room's verdict only beside it. A guest, a Slack Connect stranger, and a
|
|
147
|
+
* person the probe could not check (no `users:read`, a refusal, a timeout) all leave `trust` fail-closed
|
|
148
|
+
* `external`. The message door fails OPEN on an unanswered probe because it marks a turn. Here `trust`
|
|
149
|
+
* IS the member gate, and a channel has no declaration to fall back to the way a DM command does.
|
|
150
|
+
*
|
|
151
|
+
* 🔴 THE ROOM'S VERDICT IS RETURNED FOR EVERY INVOKER (OPE-2588). `/oe budget` names the room's budget,
|
|
152
|
+
* and a channel's turns are charged under the room's domain, whoever typed them. So {@link bindSlashCommand}
|
|
153
|
+
* binds the room's verdict alone into `roomTrust`, and the budget reads that. A guest's `trust` is
|
|
154
|
+
* unchanged, and `/oe budget` reads both to refuse a guest in an internal channel (commands/core.ts
|
|
155
|
+
* `budgetWithheldFrom`). `/oe cover on` refuses outside a DM before it reads trust.
|
|
156
|
+
*
|
|
157
|
+
* 🔴 ONLY A ROOM IN THE CHANNEL MODE IS STAMPED. A 1:1 DM has its own leg ({@link slashInvokerDmTrust}).
|
|
158
|
+
* A group DM, or a room whose type Slack did not report, stamps nothing, so its binding is unchanged.
|
|
159
|
+
* Stamping a sharing verdict on a group DM the binding still calls a channel would mix two modes' rules.
|
|
160
|
+
*
|
|
161
|
+
* 🔴 NO VERDICT IS NOT A VERDICT. A failed or refused `conversations.info`, a response without the check,
|
|
162
|
+
* or a read slower than {@link INVOKER_PROBE_MS} answers `{}`. The command then binds `external`, as
|
|
163
|
+
* before this read existed. The room read and the invoker probe run in parallel inside one ack budget.
|
|
164
|
+
*/
|
|
165
|
+
export async function slashRoomVerdict(params, roomFacts = slackChannelFactsFor, probe = slackAuthorIsMember) {
|
|
166
|
+
const channelId = formField(params, "channel_id");
|
|
167
|
+
if (!channelId || slackMode(undefined, channelId) === "dm")
|
|
168
|
+
return {};
|
|
169
|
+
const userId = formField(params, "user_id");
|
|
170
|
+
const [facts, member] = await Promise.all([
|
|
171
|
+
withinAckBudget(roomFacts(channelId)),
|
|
172
|
+
userId ? withinAckBudget(probe(userId, formField(params, "team_id"))) : Promise.resolve(undefined),
|
|
173
|
+
]);
|
|
174
|
+
if (!facts || facts.trustChecked !== true || typeof facts.extShared !== "boolean")
|
|
175
|
+
return {};
|
|
176
|
+
if (facts.channelType !== "channel" && facts.channelType !== "group")
|
|
177
|
+
return {};
|
|
178
|
+
return { room: { extShared: facts.extShared }, ...(member === true ? { invokerMember: true } : {}) };
|
|
179
|
+
}
|
|
180
|
+
/** Both legs, for whichever kind of room the command came from. Never throws. */
|
|
181
|
+
export async function slashTrustFacts(params) {
|
|
182
|
+
return slackMode(undefined, formField(params, "channel_id")) === "dm" ? slashInvokerDmTrust(params) : slashRoomVerdict(params);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The slash command's binding, with the room's trust and the person's trust kept apart (OPE-2588).
|
|
186
|
+
*
|
|
187
|
+
* `trust` is the PERSON leg: the member gate `/oe suggest on`, `/oe watch more|less` and `/oe cover on`
|
|
188
|
+
* read. `roomTrust` is the ROOM leg: the same `bindFrom` walk over the room's verdict alone, so the
|
|
189
|
+
* declarations and the fail-closed default apply to it unchanged. `/oe budget` and the caps behind
|
|
190
|
+
* `raise` and `clear` read it through `roomTrustOf`. Before this the binding carried one value, so a
|
|
191
|
+
* guest in an internal channel read the external domain's budget while that channel's turns were
|
|
192
|
+
* charged under the internal domain. Now `/oe budget` refuses that guest, because a guest must not read
|
|
193
|
+
* an internal room's caps and spend (Tommy's ruling on #1431).
|
|
194
|
+
*
|
|
195
|
+
* In a DM both legs bind the same context, so the two values are equal. Every other field comes from
|
|
196
|
+
* the person's binding. The two bindings differ only in the two trust attributes, which move no key.
|
|
197
|
+
*/
|
|
198
|
+
export function bindSlashCommand(params, facts) {
|
|
199
|
+
const person = bindFrom(bindableForSlashCommand(params, facts, "person"));
|
|
200
|
+
const room = bindFrom(bindableForSlashCommand(params, facts, "room"));
|
|
201
|
+
return { ...person, roomTrust: room.trust };
|
|
202
|
+
}
|
|
203
|
+
/** `p`'s answer, or `undefined` when it throws or takes longer than {@link INVOKER_PROBE_MS}. */
|
|
204
|
+
async function withinAckBudget(p) {
|
|
205
|
+
let timer;
|
|
206
|
+
const timeout = new Promise((resolve) => {
|
|
207
|
+
timer = setTimeout(() => resolve(undefined), INVOKER_PROBE_MS);
|
|
208
|
+
});
|
|
209
|
+
try {
|
|
210
|
+
return await Promise.race([p.catch(() => undefined), timeout]);
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
clearTimeout(timer);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
89
216
|
/**
|
|
90
217
|
* Make a refused slash command OBSERVABLE, the same way `slack.ts`'s `auditWakeDropped` makes a
|
|
91
218
|
* refused wake observable: the webhook function's console output never reaches `vercel logs`, so
|
|
@@ -105,16 +232,18 @@ export function bindableForSlashCommand(params) {
|
|
|
105
232
|
*/
|
|
106
233
|
async function auditCommandDropped(teamId, channelId, reason, enterpriseId) {
|
|
107
234
|
try {
|
|
108
|
-
const
|
|
235
|
+
const bindable = {
|
|
109
236
|
channel: { kind: "slack" },
|
|
110
237
|
session: { auth: { current: { attributes: { team_id: teamId ?? "", channel_id: channelId ?? "" }, principalId: "", principalType: "slack-user" } } },
|
|
111
|
-
}
|
|
238
|
+
};
|
|
239
|
+
const p = resolvePartition(bindable);
|
|
112
240
|
await getOperationalStore().appendAudit({
|
|
113
241
|
ts: new Date().toISOString(),
|
|
114
242
|
org: p.org,
|
|
115
243
|
platform: p.platform,
|
|
116
244
|
workspace: p.workspace,
|
|
117
245
|
surface: p.surface,
|
|
246
|
+
...auditSurfaceModeFrom(bindable),
|
|
118
247
|
action: "surface.wake_dropped",
|
|
119
248
|
detail: { reason, door: "slash-command", channel: channelId ?? null, team: teamId ?? null, enterprise: enterpriseId ?? null },
|
|
120
249
|
});
|
|
@@ -124,6 +253,10 @@ async function auditCommandDropped(teamId, channelId, reason, enterpriseId) {
|
|
|
124
253
|
}
|
|
125
254
|
}
|
|
126
255
|
function ephemeralResponse(text) {
|
|
256
|
+
// OPE-2490: an empty reply means the command's card posted in this channel and IS the answer. An
|
|
257
|
+
// empty 200 acknowledges the command, and Slack then shows nothing beside the card.
|
|
258
|
+
if (text.length === 0)
|
|
259
|
+
return new Response(null, { status: 200 });
|
|
127
260
|
return new Response(JSON.stringify({ response_type: "ephemeral", text }), {
|
|
128
261
|
status: 200,
|
|
129
262
|
headers: { "content-type": "application/json" },
|
|
@@ -196,7 +329,7 @@ export default defineChannel({
|
|
|
196
329
|
return ephemeralResponse(`This endpoint only handles "${expected}" — check your Slack app's Slash Command configuration.`);
|
|
197
330
|
}
|
|
198
331
|
const cmd = parseSlackCommandText(formField(params, "text"));
|
|
199
|
-
const binding =
|
|
332
|
+
const binding = bindSlashCommand(params, await slashTrustFacts(params));
|
|
200
333
|
try {
|
|
201
334
|
const reply = await runOeCommand(cmd, binding, { attachSession });
|
|
202
335
|
return ephemeralResponse(reply);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-commands.js","sourceRoot":"","sources":["../../../agent/channels/slack-commands.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,8FAA8F;AAC9F,uFAAuF;AACvF,iFAAiF;AACjF,EAAE;AACF,sFAAsF;AACtF,4FAA4F;AAC5F,+FAA+F;AAC/F,6FAA6F;AAC7F,8FAA8F;AAC9F,oFAAoF;AACpF,4FAA4F;AAC5F,sFAAsF;AACtF,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,qFAAqF;AACrF,8FAA8F;AAC9F,mCAAmC;AACnC,EAAE;AACF,6FAA6F;AAC7F,6FAA6F;AAC7F,6FAA6F;AAC7F,8FAA8F;AAC9F,qFAAqF;AACrF,6FAA6F;AAC7F,EAAE;AACF,iFAAiF;AACjF,EAAE;AACF,iGAAiG;AACjG,8FAA8F;AAC9F,iGAAiG;AACjG,sDAAsD;AAEtD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,
|
|
1
|
+
{"version":3,"file":"slack-commands.js","sourceRoot":"","sources":["../../../agent/channels/slack-commands.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,8FAA8F;AAC9F,uFAAuF;AACvF,iFAAiF;AACjF,EAAE;AACF,sFAAsF;AACtF,4FAA4F;AAC5F,+FAA+F;AAC/F,6FAA6F;AAC7F,8FAA8F;AAC9F,oFAAoF;AACpF,4FAA4F;AAC5F,sFAAsF;AACtF,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,qFAAqF;AACrF,8FAA8F;AAC9F,mCAAmC;AACnC,EAAE;AACF,6FAA6F;AAC7F,6FAA6F;AAC7F,6FAA6F;AAC7F,8FAA8F;AAC9F,qFAAqF;AACrF,6FAA6F;AAC7F,EAAE;AACF,iFAAiF;AACjF,EAAE;AACF,iGAAiG;AACjG,8FAA8F;AAC9F,iGAAiG;AACjG,sDAAsD;AAEtD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,kBAAkB,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AO,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,yFAAyF;gBACzF,2FAA2F;gBAC3F,wFAAwF;gBACxF,+FAA+F;gBAC/F,GAAG,CAAC,IAAI,QAAQ,4BAA4B,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC3D,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;YACpD,CAAC;QACH,CAAC,CAAC;KACH;CACF,CAAC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { SlackContext } from "eve/channels/slack";
|
|
2
2
|
import type { SlackMessage } from "eve/channels/slack";
|
|
3
|
-
import {
|
|
4
|
-
export { renderContext, type ContextLine };
|
|
3
|
+
import { type ContextLine } from "@open-everywhere/core/agent/adapter-api.js";
|
|
5
4
|
export declare function readMoreHint(): string;
|
|
6
5
|
/**
|
|
7
6
|
* Map raw Slack message objects (from `conversations.history` / `conversations.replies` — raw
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-context.d.ts","sourceRoot":"","sources":["../../../agent/channels/slack-context.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"slack-context.d.ts","sourceRoot":"","sources":["../../../agent/channels/slack-context.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAmB3G,wBAAgB,YAAY,IAAI,MAAM,CAKrC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC3C,GAAG,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD,WAAW,EAAE,CAiBf;AA0BD,kDAAkD;AAClD,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAgDD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAKzG"}
|
|
@@ -34,10 +34,6 @@
|
|
|
34
34
|
// stays here and is fed into renderContext; a surface with no read tools passes no hint.
|
|
35
35
|
import { loadThreadContextMessages } from "eve/channels/slack";
|
|
36
36
|
import { MAX_MESSAGES, renderContext } from "@open-everywhere/core/agent/adapter-api.js";
|
|
37
|
-
// Re-export the shared render + line shape so slack-wake-backscroll.ts (which imports them from
|
|
38
|
-
// here) keeps compiling unchanged after the extraction, and any future Slack consumer has one
|
|
39
|
-
// import site. The mapping (`linesFromMessages`) is defined below — it's Slack-message-shaped.
|
|
40
|
-
export { renderContext };
|
|
41
37
|
// When the rendered slice fills MAX_MESSAGES exactly, there's very likely more history above
|
|
42
38
|
// it (both fetchers below request MAX_MESSAGES-worth from Slack, so filling the cap usually
|
|
43
39
|
// means older messages were left out) — tell the model this is a bounded slice, not the whole
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-context.js","sourceRoot":"","sources":["../../../agent/channels/slack-context.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qFAAqF;AACrF,sFAAsF;AACtF,sFAAsF;AACtF,yFAAyF;AACzF,0FAA0F;AAC1F,EAAE;AACF,iFAAiF;AACjF,qFAAqF;AACrF,yFAAyF;AACzF,0FAA0F;AAC1F,uFAAuF;AACvF,wFAAwF;AACxF,2FAA2F;AAC3F,qFAAqF;AACrF,wFAAwF;AACxF,mEAAmE;AACnE,EAAE;AACF,0FAA0F;AAC1F,uFAAuF;AACvF,wFAAwF;AACxF,6DAA6D;AAC7D,EAAE;AACF,mFAAmF;AACnF,qEAAqE;AACrE,EAAE;AACF,4FAA4F;AAC5F,0FAA0F;AAC1F,6FAA6F;AAC7F,4FAA4F;AAC5F,8FAA8F;AAC9F,iGAAiG;AACjG,6FAA6F;AAC7F,yFAAyF;AAGzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAoB,MAAM,4CAA4C,CAAC;AAE3G,
|
|
1
|
+
{"version":3,"file":"slack-context.js","sourceRoot":"","sources":["../../../agent/channels/slack-context.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qFAAqF;AACrF,sFAAsF;AACtF,sFAAsF;AACtF,yFAAyF;AACzF,0FAA0F;AAC1F,EAAE;AACF,iFAAiF;AACjF,qFAAqF;AACrF,yFAAyF;AACzF,0FAA0F;AAC1F,uFAAuF;AACvF,wFAAwF;AACxF,2FAA2F;AAC3F,qFAAqF;AACrF,wFAAwF;AACxF,mEAAmE;AACnE,EAAE;AACF,0FAA0F;AAC1F,uFAAuF;AACvF,wFAAwF;AACxF,6DAA6D;AAC7D,EAAE;AACF,mFAAmF;AACnF,qEAAqE;AACrE,EAAE;AACF,4FAA4F;AAC5F,0FAA0F;AAC1F,6FAA6F;AAC7F,4FAA4F;AAC5F,8FAA8F;AAC9F,iGAAiG;AACjG,6FAA6F;AAC7F,yFAAyF;AAGzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAoB,MAAM,4CAA4C,CAAC;AAE3G,6FAA6F;AAC7F,4FAA4F;AAC5F,8FAA8F;AAC9F,6FAA6F;AAC7F,2FAA2F;AAC3F,oGAAoG;AACpG,sCAAsC;AACtC,EAAE;AACF,oGAAoG;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