@open-everywhere/provider-discord 0.2.1 → 0.3.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/channels/discord-front.ts +5 -50
- package/agent/channels/discord-post-arm.ts +0 -34
- package/agent/channels/discord-post.ts +1 -9
- package/agent/surface-parity.ts +0 -6
- package/dist/agent/channels/discord-front.d.ts +0 -18
- package/dist/agent/channels/discord-front.d.ts.map +1 -1
- package/dist/agent/channels/discord-front.js +5 -35
- package/dist/agent/channels/discord-front.js.map +1 -1
- package/dist/agent/channels/discord-post-arm.d.ts.map +1 -1
- package/dist/agent/channels/discord-post-arm.js +0 -34
- package/dist/agent/channels/discord-post-arm.js.map +1 -1
- package/dist/agent/channels/discord-post.d.ts +2 -10
- package/dist/agent/channels/discord-post.d.ts.map +1 -1
- package/dist/agent/channels/discord-post.js +2 -9
- package/dist/agent/channels/discord-post.js.map +1 -1
- package/dist/agent/surface-parity.d.ts.map +1 -1
- package/dist/agent/surface-parity.js +0 -6
- package/dist/agent/surface-parity.js.map +1 -1
- package/package.json +2 -6
- package/agent/channels/discord-approval-card.ts +0 -373
|
@@ -33,11 +33,10 @@ import { POST, type Channel, type HttpRouteDefinition, type RouteHandlerArgs } f
|
|
|
33
33
|
import { verifyDiscordSignature } from "eve/channels/discord";
|
|
34
34
|
import { OE_DISCORD_APPROVAL_PREFIX } from "../approvals/discord-card.js";
|
|
35
35
|
import { handleDiscordApprovalInteraction, type DiscordInteractionResponse } from "../approvals/discord-flow.js";
|
|
36
|
-
import { LINK_CONSENT_CLICK_PREFIX, OE_GRANT_ACTION_PREFIX
|
|
36
|
+
import { LINK_CONSENT_CLICK_PREFIX, OE_GRANT_ACTION_PREFIX } from "@open-everywhere/core/agent/adapter-api.js";
|
|
37
37
|
import { handleDiscordLinkConsentInteraction } from "../identity/discord-link-consent.js";
|
|
38
38
|
import { handleDiscordGrantCardInteraction } from "../access/discord-grant-click.js";
|
|
39
|
-
import {
|
|
40
|
-
import { approvalCardRespondVia, oeCommandName, type AttachSessionForCancel } from "@open-everywhere/core/agent/adapter-api.js";
|
|
39
|
+
import { oeCommandName, type AttachSessionForCancel } from "@open-everywhere/core/agent/adapter-api.js";
|
|
41
40
|
import { handleDiscordOeCommandInteraction } from "../commands/discord-commands.js";
|
|
42
41
|
|
|
43
42
|
/** An HTTP route handler — `RouteHandler` isn't a public eve export, so we mirror its shape
|
|
@@ -117,11 +116,6 @@ export type DiscordFrontDecision =
|
|
|
117
116
|
/** An `oe_grant:` credential-grant card button click (core access/credential-grant-card.ts) — ours:
|
|
118
117
|
* the OWNER answering a request to spend their credential (OPE-1260). */
|
|
119
118
|
| { readonly kind: "grant-click"; readonly reason: string; readonly interaction: unknown }
|
|
120
|
-
/** An `oe_input:` BRIDGED-APPROVAL card button click (core channels/approval-card.ts) — ours: the
|
|
121
|
-
* room answering an eve `tool-approval` this deployment rendered onto a unified origin (OPE-1720).
|
|
122
|
-
* eve's own route cannot resolve it — the parked request lives on the UNIFIED window, not on the
|
|
123
|
-
* Discord channel's session — so forwarding it would drop the tap. */
|
|
124
|
-
| { readonly kind: "input-click"; readonly reason: string; readonly interaction: unknown }
|
|
125
119
|
| { readonly kind: "oe-command"; readonly reason: string; readonly interaction: unknown };
|
|
126
120
|
|
|
127
121
|
/**
|
|
@@ -164,13 +158,11 @@ export function classifyDiscordInteraction(rawBody: string): DiscordFrontDecisio
|
|
|
164
158
|
}
|
|
165
159
|
const data = typeof p.data === "object" && p.data !== null ? (p.data as Record<string, unknown>) : undefined;
|
|
166
160
|
const customId = typeof data?.custom_id === "string" ? data.custom_id : undefined;
|
|
167
|
-
//
|
|
161
|
+
// Three OE prefixes, and they are deliberately different strings so a log line names one
|
|
168
162
|
// feature: `oe-approval:` is the approvals plane, `oe-link:` is the identity-consent button
|
|
169
163
|
// (OPE-622), `oe_grant:` is the credential-grant card (OPE-1260 — before it, that card's buttons
|
|
170
|
-
// rendered here and fell through to eve, so the owner's tap was lost)
|
|
171
|
-
//
|
|
172
|
-
// Anything else — eve's own `eve_input:` HITL buttons included — forwards untouched, and the two
|
|
173
|
-
// spellings are one character apart on purpose: `oe_input:` is OURS and `eve_input:` is eve's.
|
|
164
|
+
// rendered here and fell through to eve, so the owner's tap was lost). Anything else — eve's own
|
|
165
|
+
// `eve_input:` HITL buttons included — forwards untouched.
|
|
174
166
|
if (customId?.startsWith(OE_DISCORD_APPROVAL_PREFIX)) {
|
|
175
167
|
return { kind: "approval-click", reason: "oe-approval: component click — ours, never forwarded", interaction: json };
|
|
176
168
|
}
|
|
@@ -180,9 +172,6 @@ export function classifyDiscordInteraction(rawBody: string): DiscordFrontDecisio
|
|
|
180
172
|
if (customId?.startsWith(OE_GRANT_ACTION_PREFIX)) {
|
|
181
173
|
return { kind: "grant-click", reason: "oe_grant: component click — ours, never forwarded", interaction: json };
|
|
182
174
|
}
|
|
183
|
-
if (customId?.startsWith(OE_INPUT_CLICK_PREFIX)) {
|
|
184
|
-
return { kind: "input-click", reason: "oe_input: component click — ours, never forwarded", interaction: json };
|
|
185
|
-
}
|
|
186
175
|
return { kind: "forward", reason: "component click — eve's HITL owns it" };
|
|
187
176
|
}
|
|
188
177
|
|
|
@@ -211,16 +200,6 @@ export interface DiscordFrontOptions {
|
|
|
211
200
|
raw: unknown,
|
|
212
201
|
deps?: { waitUntil?: (p: Promise<unknown>) => void },
|
|
213
202
|
) => Promise<DiscordInteractionResponse | null>;
|
|
214
|
-
/** Bridged-approval-card `oe_input:` tap handler (OPE-1720, defaults to
|
|
215
|
-
* `./discord-approval-card.ts`). Injectable so the classification and the branch are testable
|
|
216
|
-
* without a store, a bot token or eve's `respond` primitive. It takes the SETTLE delivery as its
|
|
217
|
-
* second argument because `args.from` is the only place eve hands that primitive out, so it is
|
|
218
|
-
* bound in the route and injected rather than reached for inside the handler. */
|
|
219
|
-
readonly handleApprovalCardInteraction?: (
|
|
220
|
-
raw: unknown,
|
|
221
|
-
respond: ApprovalRespondFn,
|
|
222
|
-
deps?: { waitUntil?: (p: Promise<unknown>) => void },
|
|
223
|
-
) => Promise<DiscordInteractionResponse | null>;
|
|
224
203
|
/** "/oe" zero-inference command handler (defaults to the real commands/discord-commands.ts).
|
|
225
204
|
* Injectable so tests can stub it without the spend/approval/memory machinery it may touch. */
|
|
226
205
|
readonly handleOeCommand?: (raw: unknown, attachSession?: AttachSessionForCancel) => Promise<DiscordInteractionResponse | null>;
|
|
@@ -243,7 +222,6 @@ export function buildDiscordFrontHandler(innerHandler: RouteHandler, opts: Disco
|
|
|
243
222
|
const handleClick = opts.handleApprovalInteraction ?? handleDiscordApprovalInteraction;
|
|
244
223
|
const handleLinkConsent = opts.handleLinkConsentInteraction ?? handleDiscordLinkConsentInteraction;
|
|
245
224
|
const handleGrantCard = opts.handleGrantCardInteraction ?? handleDiscordGrantCardInteraction;
|
|
246
|
-
const handleApprovalCard = opts.handleApprovalCardInteraction ?? handleDiscordApprovalCardInteraction;
|
|
247
225
|
const handleOeCommand = opts.handleOeCommand ?? handleDiscordOeCommandInteraction;
|
|
248
226
|
|
|
249
227
|
return async (req: Request, args: RouteHandlerArgs): Promise<Response> => {
|
|
@@ -295,29 +273,6 @@ export function buildDiscordFrontHandler(innerHandler: RouteHandler, opts: Disco
|
|
|
295
273
|
if (response) return interactionJson(response);
|
|
296
274
|
}
|
|
297
275
|
|
|
298
|
-
if (decision.kind === "input-click") {
|
|
299
|
-
// Ours (core channels/approval-card.ts): somebody tapped a bridged eve approval this deployment
|
|
300
|
-
// rendered onto a unified origin (OPE-1720). The handler resolves the ticket, admits the tap
|
|
301
|
-
// through the SAME floor the typed answer takes, and delivers
|
|
302
|
-
// `respond([{requestId, optionId}])` to the parked WINDOW session.
|
|
303
|
-
//
|
|
304
|
-
// 🔴 THE DELIVERY GOES BY SESSION ID (OPE-1863). `args.from` is CHANNEL-LOCAL — on this route
|
|
305
|
-
// it addresses `discord:<token>`, while the parked session lives at `unified:<token>` — so the
|
|
306
|
-
// settle threw "the target session was not found" and every tap left the approval parked.
|
|
307
|
-
// `args.attachSession` dispatches by durable session id from any channel, and
|
|
308
|
-
// `approvalCardRespondVia` is the one road every surface binds. Bound HERE and injected because
|
|
309
|
-
// the route handler is the only place eve hands out either primitive.
|
|
310
|
-
//
|
|
311
|
-
// 🔴 `args.waitUntil` RIDES ALONG, for the grant branch's reason and one more of this door's
|
|
312
|
-
// own: a settle RESUMES a parked turn, and Discord does not redeliver an interaction it never
|
|
313
|
-
// saw answered — so a slow settle without the defer shows the tapper a red failure over an
|
|
314
|
-
// approval that really did settle. A null means the payload carried our prefix but not a shape
|
|
315
|
-
// the handler could read: forward rather than swallow, exactly as the three branches above do.
|
|
316
|
-
const respondToApproval: ApprovalRespondFn = approvalCardRespondVia(args.attachSession);
|
|
317
|
-
const response = await handleApprovalCard(decision.interaction, respondToApproval, { waitUntil: args.waitUntil });
|
|
318
|
-
if (response) return interactionJson(response);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
276
|
if (decision.kind === "oe-command") {
|
|
322
277
|
// Ours: zero-inference — parsed, executed as pure logic (+ the approval-card path for
|
|
323
278
|
// budget raise/clear), answered synchronously as an interaction response. NEVER reaches
|
|
@@ -102,34 +102,6 @@ async function liveDiscordPost(origin: DiscordOrigin, text: string): Promise<str
|
|
|
102
102
|
return first;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
/**
|
|
106
|
-
* UNIFIED, WITH A COMPONENT PLANE (OPE-1720): the same single-window post as {@link liveDiscordPost},
|
|
107
|
-
* carrying a row of tappable actions under it. Discord is the SECOND surface to implement this
|
|
108
|
-
* member, and it may only do so because the tap lands: `discord-front.ts` classifies the `oe_input:`
|
|
109
|
-
* custom_id and `discord-approval-card.ts` settles it.
|
|
110
|
-
*
|
|
111
|
-
* 🔴 NO AUTO-THREAD BRANCH, DELIBERATELY. `liveDiscordPost` may open a thread off the mention and
|
|
112
|
-
* answer there. A governed approval card must not move: the people who can answer it are watching the
|
|
113
|
-
* conversation it was asked in, and burying the buttons in a freshly-created thread is how a card
|
|
114
|
-
* goes unanswered. The anchor still rides — the card hangs under the triggering message through the
|
|
115
|
-
* same `message_reference` a plain reply uses — so it is placed and never moved.
|
|
116
|
-
*
|
|
117
|
-
* 🔴 IT FALLS BACK TO TEXT RATHER THAN SPLITTING. Discord caps a message at 2000 characters and a
|
|
118
|
-
* button row cannot be split across messages: a row attached to the wrong part would sit under a
|
|
119
|
-
* fragment. So an over-cap card posts through the ordinary splitting path and loses the SHORTCUT,
|
|
120
|
-
* never the meaning — `DirectMessageAction`'s own rule, which the question bridge's text already
|
|
121
|
-
* satisfies (it prints the prompt, the options, and the line saying a reply may name one).
|
|
122
|
-
*/
|
|
123
|
-
async function liveDiscordPostWithActions(origin: DiscordOrigin, text: string, actions: readonly DirectMessageAction[]): Promise<string> {
|
|
124
|
-
const buttons = actions.map((a) => ({ customId: a.id, label: a.label, intent: a.intent }));
|
|
125
|
-
if (buttons.length === 0 || text.length > DISCORD_MESSAGE_MAX) return liveDiscordPost(origin, text);
|
|
126
|
-
try {
|
|
127
|
-
return await discordPostMessageWithButtons(origin.channelId, text, buttons, origin.messageId ? { replyToMessageId: origin.messageId } : undefined);
|
|
128
|
-
} catch {
|
|
129
|
-
throw new Error(`unified reply couldn't post to Discord — create-message with buttons failed on channel ${origin.channelId}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
105
|
/** EDIT (OPE-793): `PATCH /channels/{id}/messages/{mid}` through the same write seam the post path
|
|
134
106
|
* uses. Ownership was already decided upstream against the own-post ledger; this is transport only. */
|
|
135
107
|
async function editDiscordMessage(locus: EditLocus, messageId: string, text: string): Promise<void> {
|
|
@@ -199,12 +171,6 @@ export const discordPostArm: PostArm = {
|
|
|
199
171
|
},
|
|
200
172
|
dispatchReply: (target, text) => discordPostMessage((target as DiscordTarget).channelId, text),
|
|
201
173
|
dispatchUnified: (origin, text, deps: UnifiedReplyDeps) => (deps.postDiscord ?? liveDiscordPost)(origin as DiscordOrigin, text),
|
|
202
|
-
// OPE-1720: Discord declares the unified component plane because the tap route exists on it —
|
|
203
|
-
// `discord-front.ts` classifies the `oe_input:` custom_id and `discord-approval-card.ts` settles
|
|
204
|
-
// it. The injected `postDiscord` override is honoured VERBATIM and drops the buttons: a test that
|
|
205
|
-
// scripted a text-only post must not start receiving a card it never asked for.
|
|
206
|
-
dispatchUnifiedActions: (origin, text, actions, deps: UnifiedReplyDeps) =>
|
|
207
|
-
deps.postDiscord ? deps.postDiscord(origin as DiscordOrigin, text) : liveDiscordPostWithActions(origin as DiscordOrigin, text, actions),
|
|
208
174
|
describeRedriveTarget: (origin) => `discord channel ${(origin as DiscordOrigin).channelId}`,
|
|
209
175
|
redriveContainerId: (origin) => (origin as DiscordOrigin).channelId,
|
|
210
176
|
editMessage: editDiscordMessage,
|
|
@@ -213,13 +213,7 @@ export interface DiscordDmButton {
|
|
|
213
213
|
* 🔴 NO SPLIT, AND THAT IS DELIBERATE. `discordPostMessage` splits an over-cap reply into several
|
|
214
214
|
* messages; buttons cannot be split, and a row attached to the wrong part would sit under a
|
|
215
215
|
* fragment. So this refuses past Discord's 2000-character cap rather than truncating or fanning out,
|
|
216
|
-
* and
|
|
217
|
-
* (channels/discord-post-arm.ts), whose own caller falls back to the splitting path past the cap.
|
|
218
|
-
*
|
|
219
|
-
* `opts.replyToMessageId` hangs the message under the one it answers, through the same
|
|
220
|
-
* `message_reference` the plain post path uses and with the same `fail_if_not_exists: false` degrade
|
|
221
|
-
* when the trigger is gone (OPE-1720 — a card posted onto a unified origin must land where the
|
|
222
|
-
* conversation is looking, exactly as its prose sibling does). ABSENT ⇒ a plain channel post.
|
|
216
|
+
* and its caller (the DM-delivery arm, channels/discord-post-arm.ts) posts core-owned copy.
|
|
223
217
|
*
|
|
224
218
|
* The bot token rides only the header, like every call in this module.
|
|
225
219
|
*/
|
|
@@ -227,7 +221,6 @@ export async function discordPostMessageWithButtons(
|
|
|
227
221
|
channelId: string,
|
|
228
222
|
content: string,
|
|
229
223
|
buttons: readonly DiscordDmButton[],
|
|
230
|
-
opts?: { readonly replyToMessageId?: string },
|
|
231
224
|
): Promise<string> {
|
|
232
225
|
if (content.length > DISCORD_MESSAGE_MAX) {
|
|
233
226
|
throw markNotApplied(
|
|
@@ -239,7 +232,6 @@ export async function discordPostMessageWithButtons(
|
|
|
239
232
|
headers: botHeaders(botToken()),
|
|
240
233
|
body: JSON.stringify({
|
|
241
234
|
content,
|
|
242
|
-
...(opts?.replyToMessageId ? { message_reference: { message_id: opts.replyToMessageId, fail_if_not_exists: false } } : {}),
|
|
243
235
|
components: [
|
|
244
236
|
{
|
|
245
237
|
type: COMPONENT_ACTION_ROW,
|
package/agent/surface-parity.ts
CHANGED
|
@@ -13,12 +13,6 @@ export const DISCORD_SURFACE_PARITY: SurfaceParityDeclaration = {
|
|
|
13
13
|
"capability-manifest": "supported",
|
|
14
14
|
"post-arm": "supported",
|
|
15
15
|
"wake-origin-codec": "supported",
|
|
16
|
-
// The arm renders a Discord action row (`discord-post-arm.ts`), the front routes the tap back
|
|
17
|
-
// (`discord-front.ts` classifies the `oe_input:` custom_id, `discord-approval-card.ts` settles it),
|
|
18
|
-
// and the settle DELIVERS through core's `approvalCardRespondVia` — all three halves, as the row
|
|
19
|
-
// requires. The third is not a formality: this front bound its own `args.from(bareToken)` until
|
|
20
|
-
// OPE-1863, and that address is channel-local, so every tap threw and the approval stayed parked.
|
|
21
|
-
"unified-action-plane": "supported",
|
|
22
16
|
// `messageId` is the `message_reference` anchor and sits outside `threadRef`, which keys on the
|
|
23
17
|
// channel id alone — Slack's shape exactly. Both members are implemented; `autoThreadName` stays
|
|
24
18
|
// OUT of the axis because opening a thread MOVES a post rather than placing one.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Channel, type RouteHandlerArgs } from "eve/channels";
|
|
2
2
|
import { type DiscordInteractionResponse } from "../approvals/discord-flow.js";
|
|
3
|
-
import { type ApprovalRespondFn } from "./discord-approval-card.js";
|
|
4
3
|
import { type AttachSessionForCancel } from "@open-everywhere/core/agent/adapter-api.js";
|
|
5
4
|
/** An HTTP route handler — `RouteHandler` isn't a public eve export, so we mirror its shape
|
|
6
5
|
* (same workaround as slack-front.ts). */
|
|
@@ -37,15 +36,6 @@ export type DiscordFrontDecision = {
|
|
|
37
36
|
readonly kind: "grant-click";
|
|
38
37
|
readonly reason: string;
|
|
39
38
|
readonly interaction: unknown;
|
|
40
|
-
}
|
|
41
|
-
/** An `oe_input:` BRIDGED-APPROVAL card button click (core channels/approval-card.ts) — ours: the
|
|
42
|
-
* room answering an eve `tool-approval` this deployment rendered onto a unified origin (OPE-1720).
|
|
43
|
-
* eve's own route cannot resolve it — the parked request lives on the UNIFIED window, not on the
|
|
44
|
-
* Discord channel's session — so forwarding it would drop the tap. */
|
|
45
|
-
| {
|
|
46
|
-
readonly kind: "input-click";
|
|
47
|
-
readonly reason: string;
|
|
48
|
-
readonly interaction: unknown;
|
|
49
39
|
} | {
|
|
50
40
|
readonly kind: "oe-command";
|
|
51
41
|
readonly reason: string;
|
|
@@ -83,14 +73,6 @@ export interface DiscordFrontOptions {
|
|
|
83
73
|
readonly handleGrantCardInteraction?: (raw: unknown, deps?: {
|
|
84
74
|
waitUntil?: (p: Promise<unknown>) => void;
|
|
85
75
|
}) => Promise<DiscordInteractionResponse | null>;
|
|
86
|
-
/** Bridged-approval-card `oe_input:` tap handler (OPE-1720, defaults to
|
|
87
|
-
* `./discord-approval-card.ts`). Injectable so the classification and the branch are testable
|
|
88
|
-
* without a store, a bot token or eve's `respond` primitive. It takes the SETTLE delivery as its
|
|
89
|
-
* second argument because `args.from` is the only place eve hands that primitive out, so it is
|
|
90
|
-
* bound in the route and injected rather than reached for inside the handler. */
|
|
91
|
-
readonly handleApprovalCardInteraction?: (raw: unknown, respond: ApprovalRespondFn, deps?: {
|
|
92
|
-
waitUntil?: (p: Promise<unknown>) => void;
|
|
93
|
-
}) => Promise<DiscordInteractionResponse | null>;
|
|
94
76
|
/** "/oe" zero-inference command handler (defaults to the real commands/discord-commands.ts).
|
|
95
77
|
* Injectable so tests can stub it without the spend/approval/memory machinery it may touch. */
|
|
96
78
|
readonly handleOeCommand?: (raw: unknown, attachSession?: AttachSessionForCancel) => Promise<DiscordInteractionResponse | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-front.d.ts","sourceRoot":"","sources":["../../../agent/channels/discord-front.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAQ,KAAK,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGnG,OAAO,EAAoC,KAAK,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAIjH,OAAO,
|
|
1
|
+
{"version":3,"file":"discord-front.d.ts","sourceRoot":"","sources":["../../../agent/channels/discord-front.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAQ,KAAK,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGnG,OAAO,EAAoC,KAAK,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAIjH,OAAO,EAAiB,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGxG;2CAC2C;AAC3C,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEhF,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AACtD,oGAAoG;AACpG,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AAwCpE;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,GAAE,MAAmB,GACzB,OAAO,CAOT;AAED;+EAC+E;AAC/E,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,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C;IACrG;;;;;;6BAMyB;IACzB,QAAQ,CAAC,0BAA0B,CAAC,EAAE,CACpC,GAAG,EAAE,OAAO,EACZ,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;KAAE,KACjD,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;IAChD;oGACgG;IAChG,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;CACjI;AAMD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,YAAY,EAAE,IAAI,GAAE,mBAAwB,GAAG,YAAY,CAyEjH;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,GAAE,mBAAwB,GAAG,CAAC,CAYjH"}
|
|
@@ -32,11 +32,10 @@ import { POST } from "eve/channels";
|
|
|
32
32
|
import { verifyDiscordSignature } from "eve/channels/discord";
|
|
33
33
|
import { OE_DISCORD_APPROVAL_PREFIX } from "../approvals/discord-card.js";
|
|
34
34
|
import { handleDiscordApprovalInteraction } from "../approvals/discord-flow.js";
|
|
35
|
-
import { LINK_CONSENT_CLICK_PREFIX, OE_GRANT_ACTION_PREFIX
|
|
35
|
+
import { LINK_CONSENT_CLICK_PREFIX, OE_GRANT_ACTION_PREFIX } from "@open-everywhere/core/agent/adapter-api.js";
|
|
36
36
|
import { handleDiscordLinkConsentInteraction } from "../identity/discord-link-consent.js";
|
|
37
37
|
import { handleDiscordGrantCardInteraction } from "../access/discord-grant-click.js";
|
|
38
|
-
import {
|
|
39
|
-
import { approvalCardRespondVia, oeCommandName } from "@open-everywhere/core/agent/adapter-api.js";
|
|
38
|
+
import { oeCommandName } from "@open-everywhere/core/agent/adapter-api.js";
|
|
40
39
|
import { handleDiscordOeCommandInteraction } from "../commands/discord-commands.js";
|
|
41
40
|
/** The public URL Discord POSTs every interaction to (the app's Interactions Endpoint URL). */
|
|
42
41
|
export const PUBLIC_DISCORD_ROUTE = "/eve/v1/discord";
|
|
@@ -136,13 +135,11 @@ export function classifyDiscordInteraction(rawBody) {
|
|
|
136
135
|
}
|
|
137
136
|
const data = typeof p.data === "object" && p.data !== null ? p.data : undefined;
|
|
138
137
|
const customId = typeof data?.custom_id === "string" ? data.custom_id : undefined;
|
|
139
|
-
//
|
|
138
|
+
// Three OE prefixes, and they are deliberately different strings so a log line names one
|
|
140
139
|
// feature: `oe-approval:` is the approvals plane, `oe-link:` is the identity-consent button
|
|
141
140
|
// (OPE-622), `oe_grant:` is the credential-grant card (OPE-1260 — before it, that card's buttons
|
|
142
|
-
// rendered here and fell through to eve, so the owner's tap was lost)
|
|
143
|
-
//
|
|
144
|
-
// Anything else — eve's own `eve_input:` HITL buttons included — forwards untouched, and the two
|
|
145
|
-
// spellings are one character apart on purpose: `oe_input:` is OURS and `eve_input:` is eve's.
|
|
141
|
+
// rendered here and fell through to eve, so the owner's tap was lost). Anything else — eve's own
|
|
142
|
+
// `eve_input:` HITL buttons included — forwards untouched.
|
|
146
143
|
if (customId?.startsWith(OE_DISCORD_APPROVAL_PREFIX)) {
|
|
147
144
|
return { kind: "approval-click", reason: "oe-approval: component click — ours, never forwarded", interaction: json };
|
|
148
145
|
}
|
|
@@ -152,9 +149,6 @@ export function classifyDiscordInteraction(rawBody) {
|
|
|
152
149
|
if (customId?.startsWith(OE_GRANT_ACTION_PREFIX)) {
|
|
153
150
|
return { kind: "grant-click", reason: "oe_grant: component click — ours, never forwarded", interaction: json };
|
|
154
151
|
}
|
|
155
|
-
if (customId?.startsWith(OE_INPUT_CLICK_PREFIX)) {
|
|
156
|
-
return { kind: "input-click", reason: "oe_input: component click — ours, never forwarded", interaction: json };
|
|
157
|
-
}
|
|
158
152
|
return { kind: "forward", reason: "component click — eve's HITL owns it" };
|
|
159
153
|
}
|
|
160
154
|
function interactionJson(body) {
|
|
@@ -173,7 +167,6 @@ export function buildDiscordFrontHandler(innerHandler, opts = {}) {
|
|
|
173
167
|
const handleClick = opts.handleApprovalInteraction ?? handleDiscordApprovalInteraction;
|
|
174
168
|
const handleLinkConsent = opts.handleLinkConsentInteraction ?? handleDiscordLinkConsentInteraction;
|
|
175
169
|
const handleGrantCard = opts.handleGrantCardInteraction ?? handleDiscordGrantCardInteraction;
|
|
176
|
-
const handleApprovalCard = opts.handleApprovalCardInteraction ?? handleDiscordApprovalCardInteraction;
|
|
177
170
|
const handleOeCommand = opts.handleOeCommand ?? handleDiscordOeCommandInteraction;
|
|
178
171
|
return async (req, args) => {
|
|
179
172
|
const rawBody = await req.text();
|
|
@@ -223,29 +216,6 @@ export function buildDiscordFrontHandler(innerHandler, opts = {}) {
|
|
|
223
216
|
if (response)
|
|
224
217
|
return interactionJson(response);
|
|
225
218
|
}
|
|
226
|
-
if (decision.kind === "input-click") {
|
|
227
|
-
// Ours (core channels/approval-card.ts): somebody tapped a bridged eve approval this deployment
|
|
228
|
-
// rendered onto a unified origin (OPE-1720). The handler resolves the ticket, admits the tap
|
|
229
|
-
// through the SAME floor the typed answer takes, and delivers
|
|
230
|
-
// `respond([{requestId, optionId}])` to the parked WINDOW session.
|
|
231
|
-
//
|
|
232
|
-
// 🔴 THE DELIVERY GOES BY SESSION ID (OPE-1863). `args.from` is CHANNEL-LOCAL — on this route
|
|
233
|
-
// it addresses `discord:<token>`, while the parked session lives at `unified:<token>` — so the
|
|
234
|
-
// settle threw "the target session was not found" and every tap left the approval parked.
|
|
235
|
-
// `args.attachSession` dispatches by durable session id from any channel, and
|
|
236
|
-
// `approvalCardRespondVia` is the one road every surface binds. Bound HERE and injected because
|
|
237
|
-
// the route handler is the only place eve hands out either primitive.
|
|
238
|
-
//
|
|
239
|
-
// 🔴 `args.waitUntil` RIDES ALONG, for the grant branch's reason and one more of this door's
|
|
240
|
-
// own: a settle RESUMES a parked turn, and Discord does not redeliver an interaction it never
|
|
241
|
-
// saw answered — so a slow settle without the defer shows the tapper a red failure over an
|
|
242
|
-
// approval that really did settle. A null means the payload carried our prefix but not a shape
|
|
243
|
-
// the handler could read: forward rather than swallow, exactly as the three branches above do.
|
|
244
|
-
const respondToApproval = approvalCardRespondVia(args.attachSession);
|
|
245
|
-
const response = await handleApprovalCard(decision.interaction, respondToApproval, { waitUntil: args.waitUntil });
|
|
246
|
-
if (response)
|
|
247
|
-
return interactionJson(response);
|
|
248
|
-
}
|
|
249
219
|
if (decision.kind === "oe-command") {
|
|
250
220
|
// Ours: zero-inference — parsed, executed as pure logic (+ the approval-card path for
|
|
251
221
|
// budget raise/clear), answered synchronously as an interaction response. NEVER reaches
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-front.js","sourceRoot":"","sources":["../../../agent/channels/discord-front.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,oFAAoF;AACpF,yFAAyF;AACzF,gFAAgF;AAChF,wFAAwF;AACxF,4FAA4F;AAC5F,kFAAkF;AAClF,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,oGAAoG;AACpG,2FAA2F;AAC3F,oEAAoE;AACpE,8FAA8F;AAC9F,6FAA6F;AAC7F,wFAAwF;AACxF,EAAE;AACF,mBAAmB;AACnB,0FAA0F;AAC1F,0FAA0F;AAC1F,yFAAyF;AACzF,wFAAwF;AACxF,yCAAyC;AACzC,yFAAyF;AACzF,2FAA2F;AAC3F,gGAAgG;AAChG,yFAAyF;AACzF,6FAA6F;AAC7F,+FAA+F;AAC/F,+FAA+F;AAE/F,OAAO,EAAE,IAAI,EAAiE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC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[],"mappings":"AAkBA,OAAO,EAKL,KAAK,OAAO,EAUb,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"discord-post-arm.d.ts","sourceRoot":"","sources":["../../../agent/channels/discord-post-arm.ts"],"names":[],"mappings":"AAkBA,OAAO,EAKL,KAAK,OAAO,EAUb,MAAM,4CAA4C,CAAC;AAmIpD,eAAO,MAAM,cAAc,EAAE,OA+B5B,CAAC"}
|
|
@@ -67,35 +67,6 @@ async function liveDiscordPost(origin, text) {
|
|
|
67
67
|
}
|
|
68
68
|
return first;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* UNIFIED, WITH A COMPONENT PLANE (OPE-1720): the same single-window post as {@link liveDiscordPost},
|
|
72
|
-
* carrying a row of tappable actions under it. Discord is the SECOND surface to implement this
|
|
73
|
-
* member, and it may only do so because the tap lands: `discord-front.ts` classifies the `oe_input:`
|
|
74
|
-
* custom_id and `discord-approval-card.ts` settles it.
|
|
75
|
-
*
|
|
76
|
-
* 🔴 NO AUTO-THREAD BRANCH, DELIBERATELY. `liveDiscordPost` may open a thread off the mention and
|
|
77
|
-
* answer there. A governed approval card must not move: the people who can answer it are watching the
|
|
78
|
-
* conversation it was asked in, and burying the buttons in a freshly-created thread is how a card
|
|
79
|
-
* goes unanswered. The anchor still rides — the card hangs under the triggering message through the
|
|
80
|
-
* same `message_reference` a plain reply uses — so it is placed and never moved.
|
|
81
|
-
*
|
|
82
|
-
* 🔴 IT FALLS BACK TO TEXT RATHER THAN SPLITTING. Discord caps a message at 2000 characters and a
|
|
83
|
-
* button row cannot be split across messages: a row attached to the wrong part would sit under a
|
|
84
|
-
* fragment. So an over-cap card posts through the ordinary splitting path and loses the SHORTCUT,
|
|
85
|
-
* never the meaning — `DirectMessageAction`'s own rule, which the question bridge's text already
|
|
86
|
-
* satisfies (it prints the prompt, the options, and the line saying a reply may name one).
|
|
87
|
-
*/
|
|
88
|
-
async function liveDiscordPostWithActions(origin, text, actions) {
|
|
89
|
-
const buttons = actions.map((a) => ({ customId: a.id, label: a.label, intent: a.intent }));
|
|
90
|
-
if (buttons.length === 0 || text.length > DISCORD_MESSAGE_MAX)
|
|
91
|
-
return liveDiscordPost(origin, text);
|
|
92
|
-
try {
|
|
93
|
-
return await discordPostMessageWithButtons(origin.channelId, text, buttons, origin.messageId ? { replyToMessageId: origin.messageId } : undefined);
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
throw new Error(`unified reply couldn't post to Discord — create-message with buttons failed on channel ${origin.channelId}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
70
|
/** EDIT (OPE-793): `PATCH /channels/{id}/messages/{mid}` through the same write seam the post path
|
|
100
71
|
* uses. Ownership was already decided upstream against the own-post ledger; this is transport only. */
|
|
101
72
|
async function editDiscordMessage(locus, messageId, text) {
|
|
@@ -163,11 +134,6 @@ export const discordPostArm = {
|
|
|
163
134
|
},
|
|
164
135
|
dispatchReply: (target, text) => discordPostMessage(target.channelId, text),
|
|
165
136
|
dispatchUnified: (origin, text, deps) => (deps.postDiscord ?? liveDiscordPost)(origin, text),
|
|
166
|
-
// OPE-1720: Discord declares the unified component plane because the tap route exists on it —
|
|
167
|
-
// `discord-front.ts` classifies the `oe_input:` custom_id and `discord-approval-card.ts` settles
|
|
168
|
-
// it. The injected `postDiscord` override is honoured VERBATIM and drops the buttons: a test that
|
|
169
|
-
// scripted a text-only post must not start receiving a card it never asked for.
|
|
170
|
-
dispatchUnifiedActions: (origin, text, actions, deps) => deps.postDiscord ? deps.postDiscord(origin, text) : liveDiscordPostWithActions(origin, text, actions),
|
|
171
137
|
describeRedriveTarget: (origin) => `discord channel ${origin.channelId}`,
|
|
172
138
|
redriveContainerId: (origin) => origin.channelId,
|
|
173
139
|
editMessage: editDiscordMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-post-arm.js","sourceRoot":"","sources":["../../../agent/channels/discord-post-arm.ts"],"names":[],"mappings":"AAAA,gGAAgG;AA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G,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC;QACpD,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1E,CAAC;IACD,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACvB,MAAM,CAAC,GAAG,MAA4B,CAAC;QACvC,OAAO,kBAAkB,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC"}
|
|
@@ -53,19 +53,11 @@ export interface DiscordDmButton {
|
|
|
53
53
|
* 🔴 NO SPLIT, AND THAT IS DELIBERATE. `discordPostMessage` splits an over-cap reply into several
|
|
54
54
|
* messages; buttons cannot be split, and a row attached to the wrong part would sit under a
|
|
55
55
|
* fragment. So this refuses past Discord's 2000-character cap rather than truncating or fanning out,
|
|
56
|
-
* and
|
|
57
|
-
* (channels/discord-post-arm.ts), whose own caller falls back to the splitting path past the cap.
|
|
58
|
-
*
|
|
59
|
-
* `opts.replyToMessageId` hangs the message under the one it answers, through the same
|
|
60
|
-
* `message_reference` the plain post path uses and with the same `fail_if_not_exists: false` degrade
|
|
61
|
-
* when the trigger is gone (OPE-1720 — a card posted onto a unified origin must land where the
|
|
62
|
-
* conversation is looking, exactly as its prose sibling does). ABSENT ⇒ a plain channel post.
|
|
56
|
+
* and its caller (the DM-delivery arm, channels/discord-post-arm.ts) posts core-owned copy.
|
|
63
57
|
*
|
|
64
58
|
* The bot token rides only the header, like every call in this module.
|
|
65
59
|
*/
|
|
66
|
-
export declare function discordPostMessageWithButtons(channelId: string, content: string, buttons: readonly DiscordDmButton[]
|
|
67
|
-
readonly replyToMessageId?: string;
|
|
68
|
-
}): Promise<string>;
|
|
60
|
+
export declare function discordPostMessageWithButtons(channelId: string, content: string, buttons: readonly DiscordDmButton[]): Promise<string>;
|
|
69
61
|
/**
|
|
70
62
|
* Rewrite one already-posted message — `PATCH /channels/{id}/messages/{mid}` (OPE-793). Discord
|
|
71
63
|
* renders an "(edited)" marker, so the change is visible in the room.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-post.d.ts","sourceRoot":"","sources":["../../../agent/channels/discord-post.ts"],"names":[],"mappings":"AAkBA;8FAC8F;AAC9F,eAAO,MAAM,mBAAmB,OAAO,CAAC;AA6BxC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAsB,GAAG,MAAM,EAAE,CAUjF;AA+DD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAelI;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB1E;AAUD,kGAAkG;AAClG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACtC;AAED
|
|
1
|
+
{"version":3,"file":"discord-post.d.ts","sourceRoot":"","sources":["../../../agent/channels/discord-post.ts"],"names":[],"mappings":"AAkBA;8FAC8F;AAC9F,eAAO,MAAM,mBAAmB,OAAO,CAAC;AA6BxC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAsB,GAAG,MAAM,E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,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBxH"}
|
|
@@ -200,17 +200,11 @@ const BUTTON_STYLE_DANGER = 4; // red — the rejecting answer
|
|
|
200
200
|
* 🔴 NO SPLIT, AND THAT IS DELIBERATE. `discordPostMessage` splits an over-cap reply into several
|
|
201
201
|
* messages; buttons cannot be split, and a row attached to the wrong part would sit under a
|
|
202
202
|
* fragment. So this refuses past Discord's 2000-character cap rather than truncating or fanning out,
|
|
203
|
-
* and
|
|
204
|
-
* (channels/discord-post-arm.ts), whose own caller falls back to the splitting path past the cap.
|
|
205
|
-
*
|
|
206
|
-
* `opts.replyToMessageId` hangs the message under the one it answers, through the same
|
|
207
|
-
* `message_reference` the plain post path uses and with the same `fail_if_not_exists: false` degrade
|
|
208
|
-
* when the trigger is gone (OPE-1720 — a card posted onto a unified origin must land where the
|
|
209
|
-
* conversation is looking, exactly as its prose sibling does). ABSENT ⇒ a plain channel post.
|
|
203
|
+
* and its caller (the DM-delivery arm, channels/discord-post-arm.ts) posts core-owned copy.
|
|
210
204
|
*
|
|
211
205
|
* The bot token rides only the header, like every call in this module.
|
|
212
206
|
*/
|
|
213
|
-
export async function discordPostMessageWithButtons(channelId, content, buttons
|
|
207
|
+
export async function discordPostMessageWithButtons(channelId, content, buttons) {
|
|
214
208
|
if (content.length > DISCORD_MESSAGE_MAX) {
|
|
215
209
|
throw markNotApplied(new Error(`Discord create-message with buttons cannot split ${content.length} characters (cap ${DISCORD_MESSAGE_MAX}) for channel ${channelId}`));
|
|
216
210
|
}
|
|
@@ -219,7 +213,6 @@ export async function discordPostMessageWithButtons(channelId, content, buttons,
|
|
|
219
213
|
headers: botHeaders(botToken()),
|
|
220
214
|
body: JSON.stringify({
|
|
221
215
|
content,
|
|
222
|
-
...(opts?.replyToMessageId ? { message_reference: { message_id: opts.replyToMessageId, fail_if_not_exists: false } } : {}),
|
|
223
216
|
components: [
|
|
224
217
|
{
|
|
225
218
|
type: COMPONENT_ACTION_ROW,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-post.js","sourceRoot":"","sources":["../../../agent/channels/discord-post.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,gFAAgF;AAChF,mFAAmF;AACnF,+FAA+F;AAC/F,+FAA+F;AAC/F,qGAAqG;AACrG,uDAAuD;AACvD,EAAE;AACF,8FAA8F;AAC9F,+FAA+F;AAC/F,+FAA+F;AAC/F,mEAAmE;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,GAAG,GAAG,6BAA6B,CAAC;AAE1C;8FAC8F;AAC9F,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,EAAE,aAAa,EAAE,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;AAC/E,CAAC;AAED,SAAS,QAAQ;IACf,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,uFAAuF,CAAC,CAAC;IAC3G,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8FAA8F;AAC9F,6EAA6E;AAC7E,iGAAiG;AACjG,gGAAgG;AAChG,yCAAyC;AACzC,kGAAkG;AAClG,kGAAkG;AAClG,0EAA0E;AAC1E,gGAAgG;AAChG,qFAAqF;AACrF,iGAAiG;AACjG,kGAAkG;AAClG,gGAAgG;AAChG,iGAAiG;AACjG,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,GAAG,GAAG,mBAAmB;IACrE,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC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OAAO,MAAM,+BAA+B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-parity.d.ts","sourceRoot":"","sources":["../../agent/surface-parity.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAE3F,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"surface-parity.d.ts","sourceRoot":"","sources":["../../agent/surface-parity.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAE3F,eAAO,MAAM,sBAAsB,EAAE,wBA+EpC,CAAC"}
|
|
@@ -10,12 +10,6 @@ export const DISCORD_SURFACE_PARITY = {
|
|
|
10
10
|
"capability-manifest": "supported",
|
|
11
11
|
"post-arm": "supported",
|
|
12
12
|
"wake-origin-codec": "supported",
|
|
13
|
-
// The arm renders a Discord action row (`discord-post-arm.ts`), the front routes the tap back
|
|
14
|
-
// (`discord-front.ts` classifies the `oe_input:` custom_id, `discord-approval-card.ts` settles it),
|
|
15
|
-
// and the settle DELIVERS through core's `approvalCardRespondVia` — all three halves, as the row
|
|
16
|
-
// requires. The third is not a formality: this front bound its own `args.from(bareToken)` until
|
|
17
|
-
// OPE-1863, and that address is channel-local, so every tap threw and the approval stayed parked.
|
|
18
|
-
"unified-action-plane": "supported",
|
|
19
13
|
// `messageId` is the `message_reference` anchor and sits outside `threadRef`, which keys on the
|
|
20
14
|
// channel id alone — Slack's shape exactly. Both members are implemented; `autoThreadName` stays
|
|
21
15
|
// OUT of the axis because opening a thread MOVES a post rather than placing one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-parity.js","sourceRoot":"","sources":["../../agent/surface-parity.ts"],"names":[],"mappings":"AAAA,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AqE;IACrE,wBAAwB,EAAE,WAAW;IACrC,iGAAiG;IACjG,wEAAwE;IACxE,eAAe,EAAE,WAAW;IAC5B,iGAAiG;IACjG,iGAAiG;IACjG,4BAA4B;IAC5B,mBAAmB,EAAE,WAAW;IAChC,mBAAmB,EAAE,WAAW;IAChC,qFAAqF;IACrF,iGAAiG;IACjG,iGAAiG;IACjG,gEAAgE;IAChE,mBAAmB,EAAE,EAAE,WAAW,EAAE,2GAA2G,EAAE;IACjJ,sFAAsF;IACtF,OAAO,EAAE,EAAE,SAAS,EAAE,8BAA8B,EAAE;IACtD,KAAK,EAAE,WAAW;IAClB,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,WAAW;IAEjB,oBAAoB;IACpB,KAAK,EAAE,WAAW;IAClB,UAAU,EAAE,WAAW;IACvB,8FAA8F;IAC9F,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,WAAW;IACrB,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,EAAE,WAAW,EAAE,8EAA8E,EAAE;IACvG,YAAY,EAAE,WAAW;IACzB,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,WAAW;IAC5B,IAAI,EAAE,EAAE,SAAS,EAAE,yCAAyC,EAAE;IAC9D,cAAc,EAAE,WAAW;IAC3B,eAAe,EAAE,WAAW;IAC5B,UAAU,EAAE,EAAE,SAAS,EAAE,yEAAyE,EAAE;IACpG,SAAS,EAAE,WAAW;CACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-everywhere/provider-discord",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Open Everywhere Discord provider — Discord channel and DM surfaces, gateway wiring, identity mapping and approval cards.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -56,10 +56,6 @@
|
|
|
56
56
|
"types": "./dist/agent/approvals/discord-scope-label.d.ts",
|
|
57
57
|
"default": "./dist/agent/approvals/discord-scope-label.js"
|
|
58
58
|
},
|
|
59
|
-
"./agent/channels/discord-approval-card.js": {
|
|
60
|
-
"types": "./dist/agent/channels/discord-approval-card.d.ts",
|
|
61
|
-
"default": "./dist/agent/channels/discord-approval-card.js"
|
|
62
|
-
},
|
|
63
59
|
"./agent/channels/discord-backscroll.js": {
|
|
64
60
|
"types": "./dist/agent/channels/discord-backscroll.d.ts",
|
|
65
61
|
"default": "./dist/agent/channels/discord-backscroll.js"
|
|
@@ -172,7 +168,7 @@
|
|
|
172
168
|
"test": "echo 'provider-discord: its test suite runs at the APP TIER (root scripts/) because the discord surface composes deeply with core internals (a custom gateway, admin approval cards, guild-admin bypass, routine dispatch) — see the root test chain (test:discord*, test:scenarios*, test:oe-commands, and the read/dispatch/audit/wake integration tests). This keeps the core adapter-api barrel a small port surface rather than exporting test-only internals.'"
|
|
173
169
|
},
|
|
174
170
|
"dependencies": {
|
|
175
|
-
"@open-everywhere/core": "0.
|
|
171
|
+
"@open-everywhere/core": "0.3.0",
|
|
176
172
|
"zod": "4.5.4"
|
|
177
173
|
},
|
|
178
174
|
"peerDependencies": {
|
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
// THE DISCORD RETURN LEG FOR A BRIDGED APPROVAL CARD (OPE-1720) — what makes the button the unified
|
|
2
|
-
// post arm now renders actually settle the approval it names. The sibling of
|
|
3
|
-
// providers/slack/agent/channels/slack-approval-card.ts, funnelling through the SAME core decision
|
|
4
|
-
// (`resolveApprovalCardClick`) exactly as access/discord-grant-click.ts funnels through
|
|
5
|
-
// `resolveGrantCardClick`. Core decides; this file reads Discord's envelope and writes Discord's
|
|
6
|
-
// answer.
|
|
7
|
-
//
|
|
8
|
-
// WHY THIS EXISTS RATHER THAN EVE'S OWN HITL ROUTE — the Slack reasoning verbatim, and it is
|
|
9
|
-
// structural rather than a not-yet. eve's Discord channel resolves its own `eve_input:` component
|
|
10
|
-
// clicks against the DISCORD channel's state and session address. A DM seat's parked request lives on
|
|
11
|
-
// the UNIFIED window — another channel, another session, another state bag — so a click on a card OE
|
|
12
|
-
// posted there has nothing for eve's route to resolve. It is OE's card, so it is OE's click.
|
|
13
|
-
//
|
|
14
|
-
// 🔴 THE SAME ADMISSION, THOUGH, LEG B INCLUDED. `admitInputResponse` is the ONE decision both HITL
|
|
15
|
-
// answer doors take, and `ingressSpendGate` with door `"answer"` is the same spend floor, consulted
|
|
16
|
-
// FIRST for the same reason: a tap RESUMES a parked turn, which is a decision to spend more on a scope
|
|
17
|
-
// nobody asked whether it could afford. Leg B — the positive per-answerer guest verdict Slack supplies
|
|
18
|
-
// with `slackClickerIsGuest` — rides Discord's own envelope instead of a probe: `member.pending` is
|
|
19
|
-
// this platform's analogue of an unverified account, and the same bundle already reads it for the
|
|
20
|
-
// inbound trust grain. A DM tap carries no member record, so the leg is INERT there rather than a
|
|
21
|
-
// refusal: "we could not ask" is never a no.
|
|
22
|
-
//
|
|
23
|
-
// 🔴 A REFUSAL LEAVES THE CARD LIVE. Nothing here consumes a row on any outcome but a delivered
|
|
24
|
-
// answer: the approval stays parked, the card stays tappable for somebody who may answer it, and the
|
|
25
|
-
// question stays answerable IN WORDS through the text leg (`question-bridge.ts`), which is untouched.
|
|
26
|
-
//
|
|
27
|
-
// 🔴 ACK, THEN SETTLE, THEN EDIT — and Discord is the surface where that ordering is forced (the
|
|
28
|
-
// OPE-1282 finding this door inherits). A settle calls `respond` into eve, which resumes a parked
|
|
29
|
-
// turn; Discord does NOT redeliver an interaction it has not seen answered, and an expired token
|
|
30
|
-
// leaves the tapper on a red "This interaction failed" while the approval really did settle. So this
|
|
31
|
-
// door answers with a DEFERRED EPHEMERAL ack (`type 5`), hands the settle to the route's `waitUntil`,
|
|
32
|
-
// and edits that placeholder with the outcome. The ephemeral flag rides the ACK, because Discord
|
|
33
|
-
// fixes a response's visibility at the first response.
|
|
34
|
-
//
|
|
35
|
-
// 🔴 NO `waitUntil` ⇒ NO DEFER. Without somewhere to run the work a deferred ack would leave the
|
|
36
|
-
// tapper on a permanent "thinking…", which is strictly worse than a slow answer. The handler awaits
|
|
37
|
-
// and answers `type 4` instead, and says so in the log.
|
|
38
|
-
//
|
|
39
|
-
// NEVER THROWS. This endpoint answers a person who is waiting within three seconds, and an unhandled
|
|
40
|
-
// throw becomes a red "interaction failed" they cannot act on.
|
|
41
|
-
|
|
42
|
-
import {
|
|
43
|
-
admitInputResponse,
|
|
44
|
-
APPROVAL_BUTTON_LABELS,
|
|
45
|
-
APPROVAL_CARD_REFUSED_AUDIT_ACTION as CORE_APPROVAL_CARD_REFUSED_AUDIT_ACTION,
|
|
46
|
-
APPROVAL_CARD_SETTLED_AUDIT_ACTION as CORE_APPROVAL_CARD_SETTLED_AUDIT_ACTION,
|
|
47
|
-
auditApprovalCardTap,
|
|
48
|
-
deploymentOrg,
|
|
49
|
-
forgetApprovalCardTicket,
|
|
50
|
-
forgetBridgedQuestion,
|
|
51
|
-
getOperationalStore,
|
|
52
|
-
ingressSpendGate,
|
|
53
|
-
OE_INPUT_CLICK_PREFIX,
|
|
54
|
-
parseApprovalClickId,
|
|
55
|
-
readApprovalCardTicket,
|
|
56
|
-
readBridgedQuestion,
|
|
57
|
-
resolveApprovalCardClick,
|
|
58
|
-
resolvePartition,
|
|
59
|
-
unifiedThreadRef,
|
|
60
|
-
type ApprovalCardRespondFn,
|
|
61
|
-
type BindableContext,
|
|
62
|
-
} from "@open-everywhere/core/agent/adapter-api.js";
|
|
63
|
-
import { buildDiscordAuth } from "./discord-identity.js";
|
|
64
|
-
import { deferredEphemeralResponse, editOriginalInteractionResponse, interactionFollowUp, type InteractionFollowUp } from "./discord-interaction-defer.js";
|
|
65
|
-
|
|
66
|
-
const log = (m: string): void => console.log(`[open-everywhere:discord] approval card: ${m}`);
|
|
67
|
-
|
|
68
|
-
/** The `input_response.routed` sibling for a tap — the SAME two action strings the Slack leg writes,
|
|
69
|
-
* so "how often is a bridged approval settled by a button" is one query across surfaces rather than
|
|
70
|
-
* one per surface. RE-EXPORTED FROM CORE since OPE-1856: two files spelling one action name is two
|
|
71
|
-
* places it can drift, and the drift is silent. */
|
|
72
|
-
export const APPROVAL_CARD_SETTLED_AUDIT_ACTION = CORE_APPROVAL_CARD_SETTLED_AUDIT_ACTION;
|
|
73
|
-
export const APPROVAL_CARD_REFUSED_AUDIT_ACTION = CORE_APPROVAL_CARD_REFUSED_AUDIT_ACTION;
|
|
74
|
-
|
|
75
|
-
// Discord interaction-response wire constants, defined locally for the same reason every sibling
|
|
76
|
-
// handler in this bundle defines its own: importing eve's channel module for two integers would
|
|
77
|
-
// widen this leaf's graph.
|
|
78
|
-
const RESPONSE_CHANNEL_MESSAGE = 4; // CHANNEL_MESSAGE_WITH_SOURCE
|
|
79
|
-
const EPHEMERAL = 64; // MessageFlags.EPHEMERAL — only the tapper sees it
|
|
80
|
-
|
|
81
|
-
/** The interaction response body this handler returns. Loosely typed, exactly as its three sibling
|
|
82
|
-
* handlers type theirs, so the front route holds ONE seam type across all four. */
|
|
83
|
-
export type DiscordApprovalCardResponse = Record<string, unknown>;
|
|
84
|
-
|
|
85
|
-
/** The settle delivery this leg needs. CORE-OWNED and bound by the front route through
|
|
86
|
-
* `approvalCardRespondVia(args.attachSession)` — re-exported here, never re-spelled, so the address
|
|
87
|
-
* the answer takes cannot drift per surface (OPE-1863). */
|
|
88
|
-
export type ApprovalRespondFn = ApprovalCardRespondFn;
|
|
89
|
-
|
|
90
|
-
/** The host edges this door needs to defer. Both injected so a test drives the whole ack-then-edit
|
|
91
|
-
* sequence with no Discord and no host. */
|
|
92
|
-
export interface DiscordApprovalCardDeps {
|
|
93
|
-
/** The route's own `waitUntil`. ABSENT ⇒ no defer (see the header). */
|
|
94
|
-
readonly waitUntil?: (p: Promise<unknown>) => void;
|
|
95
|
-
/** The follow-up edit. Live default is {@link editOriginalInteractionResponse}. */
|
|
96
|
-
readonly edit?: (followUp: InteractionFollowUp, content: string) => Promise<boolean>;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** What one verified tap did, for the front route's log line and for the test to assert on. */
|
|
100
|
-
export interface ApprovalCardClickOutcome {
|
|
101
|
-
readonly handled: boolean;
|
|
102
|
-
readonly reason: string;
|
|
103
|
-
/** A line to show the tapper alone, or undefined when the outcome needs no note. */
|
|
104
|
-
readonly notice?: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** The interaction fields this leg reads, narrowed so nothing here needs Discord's own types. */
|
|
108
|
-
interface ParsedApprovalClick {
|
|
109
|
-
readonly actionId: string;
|
|
110
|
-
readonly channelId: string;
|
|
111
|
-
readonly userId: string;
|
|
112
|
-
readonly guildId?: string;
|
|
113
|
-
/**
|
|
114
|
-
* LEG B — Discord's own analogue of a guest: a guild member who has NOT cleared membership
|
|
115
|
-
* screening (`member.pending`). The same bundle already reads it off an interaction payload for the
|
|
116
|
-
* inbound trust grain (`discord-identity.ts`), and it is a POSITIVE per-person verdict, which is
|
|
117
|
-
* exactly what `admitInputResponse`'s guest leg takes. Absent ⇒ the probe could not be run (a DM tap
|
|
118
|
-
* carries no member record), and the leg is then INERT: "we could not ask" never becomes a refusal.
|
|
119
|
-
*/
|
|
120
|
-
readonly answererIsGuest?: boolean;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function isObject(v: unknown): v is Record<string, unknown> {
|
|
124
|
-
return typeof v === "object" && v !== null;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Read the `oe_input:` custom_id out of a VERIFIED MESSAGE_COMPONENT interaction. `undefined` when
|
|
129
|
-
* the payload is not one of ours or is missing a field the decision needs — the front route then
|
|
130
|
-
* forwards it rather than half-handling it.
|
|
131
|
-
*
|
|
132
|
-
* THE CLICKER AND THE CHANNEL COME FROM THE ENVELOPE, never from a payload field the card could
|
|
133
|
-
* carry: the front has already verified Discord's Ed25519 signature over the raw body, so these are
|
|
134
|
-
* Discord's own statements. Discord puts the clicker at `user` in a DM and at `member.user` in a
|
|
135
|
-
* guild; both are read, so a DM tap and a guild tap are equally attributable.
|
|
136
|
-
*/
|
|
137
|
-
export function parseDiscordApprovalClick(raw: unknown): ParsedApprovalClick | undefined {
|
|
138
|
-
if (!isObject(raw)) return undefined;
|
|
139
|
-
if (raw["type"] !== 3) return undefined; // not a MESSAGE_COMPONENT interaction
|
|
140
|
-
const data = isObject(raw["data"]) ? raw["data"] : undefined;
|
|
141
|
-
const actionId = typeof data?.["custom_id"] === "string" ? (data["custom_id"] as string) : undefined;
|
|
142
|
-
if (actionId === undefined || !actionId.startsWith(OE_INPUT_CLICK_PREFIX)) return undefined;
|
|
143
|
-
const direct = isObject(raw["user"]) ? raw["user"]["id"] : undefined;
|
|
144
|
-
const member = isObject(raw["member"]) ? raw["member"]["user"] : undefined;
|
|
145
|
-
const viaMember = isObject(member) ? member["id"] : undefined;
|
|
146
|
-
const userId = typeof direct === "string" && direct.length > 0 ? direct : typeof viaMember === "string" ? viaMember : undefined;
|
|
147
|
-
const channelRaw = raw["channel_id"];
|
|
148
|
-
const channelViaObject = isObject(raw["channel"]) ? raw["channel"]["id"] : undefined;
|
|
149
|
-
const channelId = typeof channelRaw === "string" && channelRaw.length > 0 ? channelRaw : typeof channelViaObject === "string" ? channelViaObject : undefined;
|
|
150
|
-
if (typeof userId !== "string" || userId.length === 0) return undefined;
|
|
151
|
-
if (typeof channelId !== "string" || channelId.length === 0) return undefined;
|
|
152
|
-
const guildId = typeof raw["guild_id"] === "string" && raw["guild_id"].length > 0 ? (raw["guild_id"] as string) : undefined;
|
|
153
|
-
// LEG B, read off the SAME verified envelope. `member.pending` is Discord's own statement that this
|
|
154
|
-
// account has not cleared the guild's membership screening; a payload that carries no member record
|
|
155
|
-
// (every DM tap) leaves the field absent, which the admission reads as "not asked".
|
|
156
|
-
const memberPending = isObject(raw["member"]) ? raw["member"]["pending"] : undefined;
|
|
157
|
-
return {
|
|
158
|
-
actionId,
|
|
159
|
-
channelId,
|
|
160
|
-
userId,
|
|
161
|
-
...(guildId ? { guildId } : {}),
|
|
162
|
-
...(typeof memberPending === "boolean" ? { answererIsGuest: memberPending } : {}),
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** The bindable a partition resolve and the spend gate need, built through the bundle's OWN auth
|
|
167
|
-
* builder rather than a hand-spelled attribute bag: the partition a tap files under must be the one
|
|
168
|
-
* a MESSAGE in the same conversation files under, and two spellings is how those drift. */
|
|
169
|
-
function bindableForClick(click: ParsedApprovalClick): BindableContext {
|
|
170
|
-
return {
|
|
171
|
-
channel: { kind: "discord" },
|
|
172
|
-
session: {
|
|
173
|
-
auth: {
|
|
174
|
-
current: buildDiscordAuth({
|
|
175
|
-
channelId: click.channelId,
|
|
176
|
-
userId: click.userId,
|
|
177
|
-
...(click.guildId ? { guildId: click.guildId } : {}),
|
|
178
|
-
}),
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
} as unknown as BindableContext;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* The host copy that rides the delivered answer's `text` — the LABEL THIS DEPLOYMENT PUT ON THE
|
|
186
|
-
* BUTTON, read back out of the same allowlist that minted it, so the transcript says what the person
|
|
187
|
-
* actually chose. A tap carries no words, and writing the person's prose for them is not an option.
|
|
188
|
-
* The DECISION is never this value: eve settles on `optionId` alone.
|
|
189
|
-
*/
|
|
190
|
-
function approvalAnswerText(optionId: string): string {
|
|
191
|
-
return APPROVAL_BUTTON_LABELS.get(optionId.toLowerCase())?.label ?? optionId.charAt(0).toUpperCase() + optionId.slice(1);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Settle one verified `oe_input:` tap: resolve it, admit it, deliver the answer to eve, consume the
|
|
196
|
-
* rows. NEVER THROWS.
|
|
197
|
-
*
|
|
198
|
-
* 🔴 CONSUME-ONCE, AND BOTH ROWS, and only after eve accepted the delivery. The ticket goes so a
|
|
199
|
-
* second tap cannot answer a request eve has already settled; the outstanding-question row goes so
|
|
200
|
-
* the room's NEXT message is an ordinary wake again rather than a second answer. A throw above skips
|
|
201
|
-
* both, which leaves the card tappable and the question answerable in words — the safe direction.
|
|
202
|
-
*
|
|
203
|
-
* THE LIMIT OF THAT, stated rather than implied and identical to the Slack leg's: the read and the
|
|
204
|
-
* delete are not one atomic step, so two deliveries arriving together each resolve against rows that
|
|
205
|
-
* are both still present. Both must be admitted and both must name an option the request offered, and
|
|
206
|
-
* eve's own resolution refuses the second delivery for a request it already settled — so one approval
|
|
207
|
-
* can READ as decided by two taps without being decided twice.
|
|
208
|
-
*/
|
|
209
|
-
export async function settleDiscordApprovalCardClick(click: ParsedApprovalClick, respond: ApprovalRespondFn): Promise<ApprovalCardClickOutcome> {
|
|
210
|
-
// 🔴 HOISTED OUT OF THE `try` SO THE `catch` CAN STAMP ITS ROW (OPE-1856) — the Slack sibling's
|
|
211
|
-
// reasoning verbatim. A throw anywhere below, the partition resolve included, must still leave a
|
|
212
|
-
// row saying this deployment took a tap and settled nothing.
|
|
213
|
-
let auditPartition: ReturnType<typeof resolvePartition> | undefined;
|
|
214
|
-
try {
|
|
215
|
-
const parsed = parseApprovalClickId(click.actionId);
|
|
216
|
-
if (parsed === undefined) return { handled: false, reason: "oe_input: custom_id did not parse" };
|
|
217
|
-
const org = deploymentOrg();
|
|
218
|
-
const store = getOperationalStore();
|
|
219
|
-
const bindable = bindableForClick(click);
|
|
220
|
-
const partition = resolvePartition(bindable);
|
|
221
|
-
auditPartition = partition;
|
|
222
|
-
// THE SPEND GATE FIRST, ahead of the identity admission — the same order and the same reason the
|
|
223
|
-
// Slack leg takes: over budget outranks identity, and a decline must not spend a roster lookup.
|
|
224
|
-
// A decline leaves the request PENDING.
|
|
225
|
-
// 🔴 THE `post` ARM CAPTURES, IT DOES NOT POST. The gate's refusal copy would otherwise land as
|
|
226
|
-
// a PUBLIC message in the channel the card sits in, telling the room that a person's tap was
|
|
227
|
-
// declined. This door already owns a private answer — the interaction response — so the copy is
|
|
228
|
-
// captured here and shown to the tapper alone, through the outcome's `notice`. The binding is
|
|
229
|
-
// local to this call, so two taps in flight cannot read each other's copy.
|
|
230
|
-
let declineNotice: string | undefined;
|
|
231
|
-
const spend = await ingressSpendGate({
|
|
232
|
-
bindable,
|
|
233
|
-
door: "answer",
|
|
234
|
-
principalId: click.userId,
|
|
235
|
-
...(click.guildId ? { workspaceRef: click.guildId } : {}),
|
|
236
|
-
post: async (text) => {
|
|
237
|
-
declineNotice = text;
|
|
238
|
-
},
|
|
239
|
-
});
|
|
240
|
-
if (spend === "declined") {
|
|
241
|
-
// AUDITED, not only logged (OPE-1856): a decline is this deployment refusing a person's tap,
|
|
242
|
-
// and a refusal nobody can count is indistinguishable from a tap that never arrived.
|
|
243
|
-
await auditApprovalCardTap({ platform: "discord", principalId: click.userId, partition, outcome: { kind: "refused", reason: "spend-declined" } });
|
|
244
|
-
log("tap declined by the spend gate — the approval stays parked");
|
|
245
|
-
return { handled: true, reason: "spend-declined", ...(declineNotice ? { notice: declineNotice } : {}) };
|
|
246
|
-
}
|
|
247
|
-
// The room the tap came from, in the SAME vocabulary the card's ticket stored — derived through
|
|
248
|
-
// core's own codec rather than spelled here, so the two sides cannot drift on the key's shape. A
|
|
249
|
-
// guild tap and a DM tap key differently, which is exactly what the codec already knows.
|
|
250
|
-
const containerKey = unifiedThreadRef(
|
|
251
|
-
click.guildId ? { platform: "discord", channelId: click.channelId, guildId: click.guildId } : { platform: "discord", channelId: click.channelId, dm: true },
|
|
252
|
-
).channelKey;
|
|
253
|
-
const routing = await resolveApprovalCardClick(
|
|
254
|
-
{ ticket: parsed.ticket, optionId: parsed.optionId, containerKey },
|
|
255
|
-
{
|
|
256
|
-
read: (ticket) => readApprovalCardTicket(store, org, ticket),
|
|
257
|
-
// The join with the TEXT leg — fail-CLOSED on an unreadable row: a store this leg cannot read
|
|
258
|
-
// cannot say the request is still parked, and settling on that guess is the one direction
|
|
259
|
-
// that spends a governed decision twice.
|
|
260
|
-
stillOutstanding: async (bareToken, requestId) => {
|
|
261
|
-
const outstanding = await readBridgedQuestion(store, org, bareToken).catch(() => undefined);
|
|
262
|
-
return outstanding?.requestId === requestId;
|
|
263
|
-
},
|
|
264
|
-
admit: async () => {
|
|
265
|
-
const verdict = await admitInputResponse({
|
|
266
|
-
org: partition.org,
|
|
267
|
-
platform: partition.platform,
|
|
268
|
-
workspace: partition.workspace,
|
|
269
|
-
surface: partition.surface,
|
|
270
|
-
surfaceKey: partition.surfaceKey,
|
|
271
|
-
principalId: click.userId,
|
|
272
|
-
responses: 1,
|
|
273
|
-
// Leg B — the positive per-answerer verdict, and INERT when the envelope could not answer
|
|
274
|
-
// it (`undefined` never refuses), exactly as the Slack sibling's probe is.
|
|
275
|
-
...(click.answererIsGuest === undefined ? {} : { answererIsGuest: click.answererIsGuest }),
|
|
276
|
-
});
|
|
277
|
-
return { ok: verdict.ok, floor: verdict.ok ? verdict.floor : "", notice: verdict.ok ? "" : verdict.notice };
|
|
278
|
-
},
|
|
279
|
-
},
|
|
280
|
-
);
|
|
281
|
-
if (routing.kind === "refuse") {
|
|
282
|
-
await auditApprovalCardTap({ platform: "discord", principalId: click.userId, partition, outcome: { kind: "refused", reason: routing.reason } });
|
|
283
|
-
log(`tap settled nothing (${routing.reason}) — the approval stays parked and answerable in words`);
|
|
284
|
-
return { handled: true, reason: routing.reason, ...(routing.notice ? { notice: routing.notice } : {}) };
|
|
285
|
-
}
|
|
286
|
-
const label = approvalAnswerText(routing.optionId);
|
|
287
|
-
// 🔴 DELIVERED BY SESSION ID, never by the window token (OPE-1863) — the Slack sibling's
|
|
288
|
-
// reasoning verbatim: a continuation token is channel-local, this route is the DISCORD channel's,
|
|
289
|
-
// and `from(bareToken)` here named a session that never existed. The token's job is the
|
|
290
|
-
// outstanding-question row on the two lines that follow.
|
|
291
|
-
await respond(routing.sessionId, { requestId: routing.requestId, optionId: routing.optionId, text: label });
|
|
292
|
-
await forgetApprovalCardTicket(store, org, parsed.ticket);
|
|
293
|
-
await forgetBridgedQuestion(store, org, routing.bareToken);
|
|
294
|
-
await auditApprovalCardTap({
|
|
295
|
-
platform: "discord",
|
|
296
|
-
principalId: click.userId,
|
|
297
|
-
partition,
|
|
298
|
-
outcome: { kind: "settled", requestId: routing.requestId, optionId: routing.optionId, floor: routing.floor },
|
|
299
|
-
});
|
|
300
|
-
log(`tap settled ${routing.requestId} as "${routing.optionId}" (floor ${routing.floor})`);
|
|
301
|
-
return { handled: true, reason: "settled", notice: `${label} — recorded. The request is settled.` };
|
|
302
|
-
} catch (err) {
|
|
303
|
-
// The approval is still parked and the card is still tappable, so the honest outcome is to say so
|
|
304
|
-
// and leave both rows in place.
|
|
305
|
-
// AUDITED, not only logged (OPE-1856): a tap that threw left no trace at all, so it could not be
|
|
306
|
-
// told apart from a tap that never arrived. `auditApprovalCardTap` never throws.
|
|
307
|
-
await auditApprovalCardTap({ platform: "discord", principalId: click.userId, ...(auditPartition === undefined ? {} : { partition: auditPartition }), outcome: { kind: "refused", reason: "error" } });
|
|
308
|
-
log(`tap failed (${(err as Error)?.message ?? String(err)}) — nothing was settled, the approval stays parked`);
|
|
309
|
-
return { handled: true, reason: "error", notice: "That could not be answered right now. Nothing was settled — the request is still open, and you can answer it in words." };
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* The line the tapper reads, for an outcome that carried no notice of its own.
|
|
315
|
-
*
|
|
316
|
-
* 🔴 A REFUSAL MUST NEVER READ AS A SETTLEMENT. This door ANSWERS — it edits a deferred placeholder —
|
|
317
|
-
* so a default of "Recorded." would tell somebody whose tap settled nothing that their approval had
|
|
318
|
-
* landed, and they would stop waiting for it. Core attaches a `notice` only to the `refused` arm, so
|
|
319
|
-
* `no-ticket`, `foreign-room`, `unoffered-option` and `already-answered` all arrive here bare. The
|
|
320
|
-
* Slack sibling can be SILENT in these cases, which is not a false statement; this one cannot, so the
|
|
321
|
-
* default is the honest sentence and "Recorded." is reserved for a settle.
|
|
322
|
-
*/
|
|
323
|
-
function tapperLine(outcome: ApprovalCardClickOutcome): string {
|
|
324
|
-
if (outcome.notice !== undefined && outcome.notice.length > 0) return outcome.notice;
|
|
325
|
-
if (outcome.reason === "settled") return "Recorded.";
|
|
326
|
-
return "Nothing was settled — the request is still open, and you can answer it in words.";
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Handle one verified `oe_input:` component click.
|
|
331
|
-
*
|
|
332
|
-
* Returns the interaction response body to send, or `null` for anything that is NOT one of ours —
|
|
333
|
-
* the front route then forwards it, so a click is never silently swallowed. NEVER throws.
|
|
334
|
-
*/
|
|
335
|
-
export async function handleDiscordApprovalCardInteraction(
|
|
336
|
-
raw: unknown,
|
|
337
|
-
respond: ApprovalRespondFn,
|
|
338
|
-
deps: DiscordApprovalCardDeps = {},
|
|
339
|
-
): Promise<DiscordApprovalCardResponse | null> {
|
|
340
|
-
const click = parseDiscordApprovalClick(raw);
|
|
341
|
-
if (click === undefined) return null;
|
|
342
|
-
const followUp = interactionFollowUp(raw);
|
|
343
|
-
if (deps.waitUntil === undefined || followUp === undefined) {
|
|
344
|
-
// NO PLACE TO RUN THE WORK, OR NO ADDRESS TO ANSWER AT ⇒ settle on the response path. Slow, and
|
|
345
|
-
// still correct: a deferred ack we could not follow up would leave a permanent "thinking…".
|
|
346
|
-
log(`tap answering synchronously (${deps.waitUntil === undefined ? "no waitUntil" : "no follow-up address"}) — a slow settle may outlive the interaction token`);
|
|
347
|
-
const outcome = await settleDiscordApprovalCardClick(click, respond);
|
|
348
|
-
if (!outcome.handled) return null;
|
|
349
|
-
return { type: RESPONSE_CHANNEL_MESSAGE, data: { content: tapperLine(outcome), flags: EPHEMERAL } };
|
|
350
|
-
}
|
|
351
|
-
const edit = deps.edit ?? editOriginalInteractionResponse;
|
|
352
|
-
deps.waitUntil(
|
|
353
|
-
(async () => {
|
|
354
|
-
// TOTAL. This runs after the response has gone; a throw here reaches the host's unhandled
|
|
355
|
-
// rejection handler and tells the tapper nothing. `settleDiscordApprovalCardClick` is already
|
|
356
|
-
// total, so the catch is for the edit's own transport.
|
|
357
|
-
let text: string;
|
|
358
|
-
try {
|
|
359
|
-
const outcome = await settleDiscordApprovalCardClick(click, respond);
|
|
360
|
-
text = tapperLine(outcome);
|
|
361
|
-
} catch (err) {
|
|
362
|
-
log(`deferred tap settle failed: ${(err as Error)?.message ?? String(err)}`);
|
|
363
|
-
text = "That could not be answered right now. Nothing was settled — the request is still open, and you can answer it in words.";
|
|
364
|
-
}
|
|
365
|
-
// 🔴 A FAILED EDIT IS LOUD BUT NOT FATAL: the settle has already landed and is audited by core.
|
|
366
|
-
// What is lost is the tapper's explanation — which is exactly what an expired token loses — so
|
|
367
|
-
// it must be findable in the log.
|
|
368
|
-
const shown = await edit(followUp, text);
|
|
369
|
-
if (!shown) log("tap answer could NOT be shown to the tapper — the settle landed and is audited, the tapper was not told");
|
|
370
|
-
})(),
|
|
371
|
-
);
|
|
372
|
-
return deferredEphemeralResponse();
|
|
373
|
-
}
|