@open-everywhere/provider-discord 0.1.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/LICENSE +201 -0
- package/NOTICE +21 -0
- package/README.md +47 -0
- package/agent/access/discord-grant-click.ts +237 -0
- package/agent/approvals/discord-admin.ts +227 -0
- package/agent/approvals/discord-card.ts +248 -0
- package/agent/approvals/discord-flow.ts +469 -0
- package/agent/approvals/discord-scope-label.ts +27 -0
- package/agent/channels/discord-approval-card.ts +373 -0
- package/agent/channels/discord-backscroll.ts +593 -0
- package/agent/channels/discord-bot-name.ts +113 -0
- package/agent/channels/discord-channel-info.ts +83 -0
- package/agent/channels/discord-directory.ts +179 -0
- package/agent/channels/discord-dispatch-target.ts +103 -0
- package/agent/channels/discord-events.ts +175 -0
- package/agent/channels/discord-front.ts +355 -0
- package/agent/channels/discord-gateway.ts +3256 -0
- package/agent/channels/discord-identity.ts +269 -0
- package/agent/channels/discord-interaction-defer.ts +123 -0
- package/agent/channels/discord-message-ops.ts +127 -0
- package/agent/channels/discord-origin-codec.ts +105 -0
- package/agent/channels/discord-post-arm.ts +230 -0
- package/agent/channels/discord-post.ts +463 -0
- package/agent/channels/discord-read.ts +140 -0
- package/agent/channels/discord-rest.ts +85 -0
- package/agent/channels/discord.ts +244 -0
- package/agent/commands/discord-command-sync.ts +285 -0
- package/agent/commands/discord-commands.ts +291 -0
- package/agent/contributions.ts +31 -0
- package/agent/docs-generated.ts +15 -0
- package/agent/identity/discord-link-consent.ts +124 -0
- package/agent/ops.ts +14 -0
- package/agent/provider-events.ts +86 -0
- package/agent/register.ts +147 -0
- package/agent/surface-parity.ts +95 -0
- package/dist/agent/access/discord-grant-click.d.ts +25 -0
- package/dist/agent/access/discord-grant-click.d.ts.map +1 -0
- package/dist/agent/access/discord-grant-click.js +210 -0
- package/dist/agent/access/discord-grant-click.js.map +1 -0
- package/dist/agent/approvals/discord-admin.d.ts +63 -0
- package/dist/agent/approvals/discord-admin.d.ts.map +1 -0
- package/dist/agent/approvals/discord-admin.js +219 -0
- package/dist/agent/approvals/discord-admin.js.map +1 -0
- package/dist/agent/approvals/discord-card.d.ts +102 -0
- package/dist/agent/approvals/discord-card.d.ts.map +1 -0
- package/dist/agent/approvals/discord-card.js +217 -0
- package/dist/agent/approvals/discord-card.js.map +1 -0
- package/dist/agent/approvals/discord-flow.d.ts +109 -0
- package/dist/agent/approvals/discord-flow.d.ts.map +1 -0
- package/dist/agent/approvals/discord-flow.js +375 -0
- package/dist/agent/approvals/discord-flow.js.map +1 -0
- package/dist/agent/approvals/discord-scope-label.d.ts +3 -0
- package/dist/agent/approvals/discord-scope-label.d.ts.map +1 -0
- package/dist/agent/approvals/discord-scope-label.js +27 -0
- package/dist/agent/approvals/discord-scope-label.js.map +1 -0
- package/dist/agent/channels/discord-approval-card.d.ts +81 -0
- package/dist/agent/channels/discord-approval-card.d.ts.map +1 -0
- package/dist/agent/channels/discord-approval-card.js +303 -0
- package/dist/agent/channels/discord-approval-card.js.map +1 -0
- package/dist/agent/channels/discord-backscroll.d.ts +209 -0
- package/dist/agent/channels/discord-backscroll.d.ts.map +1 -0
- package/dist/agent/channels/discord-backscroll.js +505 -0
- package/dist/agent/channels/discord-backscroll.js.map +1 -0
- package/dist/agent/channels/discord-bot-name.d.ts +19 -0
- package/dist/agent/channels/discord-bot-name.d.ts.map +1 -0
- package/dist/agent/channels/discord-bot-name.js +98 -0
- package/dist/agent/channels/discord-bot-name.js.map +1 -0
- package/dist/agent/channels/discord-channel-info.d.ts +22 -0
- package/dist/agent/channels/discord-channel-info.d.ts.map +1 -0
- package/dist/agent/channels/discord-channel-info.js +65 -0
- package/dist/agent/channels/discord-channel-info.js.map +1 -0
- package/dist/agent/channels/discord-directory.d.ts +11 -0
- package/dist/agent/channels/discord-directory.d.ts.map +1 -0
- package/dist/agent/channels/discord-directory.js +170 -0
- package/dist/agent/channels/discord-directory.js.map +1 -0
- package/dist/agent/channels/discord-dispatch-target.d.ts +15 -0
- package/dist/agent/channels/discord-dispatch-target.d.ts.map +1 -0
- package/dist/agent/channels/discord-dispatch-target.js +99 -0
- package/dist/agent/channels/discord-dispatch-target.js.map +1 -0
- package/dist/agent/channels/discord-events.d.ts +58 -0
- package/dist/agent/channels/discord-events.d.ts.map +1 -0
- package/dist/agent/channels/discord-events.js +150 -0
- package/dist/agent/channels/discord-events.js.map +1 -0
- package/dist/agent/channels/discord-front.d.ts +115 -0
- package/dist/agent/channels/discord-front.d.ts.map +1 -0
- package/dist/agent/channels/discord-front.js +279 -0
- package/dist/agent/channels/discord-front.js.map +1 -0
- package/dist/agent/channels/discord-gateway.d.ts +783 -0
- package/dist/agent/channels/discord-gateway.d.ts.map +1 -0
- package/dist/agent/channels/discord-gateway.js +2591 -0
- package/dist/agent/channels/discord-gateway.js.map +1 -0
- package/dist/agent/channels/discord-identity.d.ts +110 -0
- package/dist/agent/channels/discord-identity.d.ts.map +1 -0
- package/dist/agent/channels/discord-identity.js +201 -0
- package/dist/agent/channels/discord-identity.js.map +1 -0
- package/dist/agent/channels/discord-interaction-defer.d.ts +33 -0
- package/dist/agent/channels/discord-interaction-defer.d.ts.map +1 -0
- package/dist/agent/channels/discord-interaction-defer.js +102 -0
- package/dist/agent/channels/discord-interaction-defer.js.map +1 -0
- package/dist/agent/channels/discord-message-ops.d.ts +3 -0
- package/dist/agent/channels/discord-message-ops.d.ts.map +1 -0
- package/dist/agent/channels/discord-message-ops.js +123 -0
- package/dist/agent/channels/discord-message-ops.js.map +1 -0
- package/dist/agent/channels/discord-origin-codec.d.ts +7 -0
- package/dist/agent/channels/discord-origin-codec.d.ts.map +1 -0
- package/dist/agent/channels/discord-origin-codec.js +98 -0
- package/dist/agent/channels/discord-origin-codec.js.map +1 -0
- package/dist/agent/channels/discord-post-arm.d.ts +3 -0
- package/dist/agent/channels/discord-post-arm.d.ts.map +1 -0
- package/dist/agent/channels/discord-post-arm.js +195 -0
- package/dist/agent/channels/discord-post-arm.js.map +1 -0
- package/dist/agent/channels/discord-post.d.ts +120 -0
- package/dist/agent/channels/discord-post.d.ts.map +1 -0
- package/dist/agent/channels/discord-post.js +426 -0
- package/dist/agent/channels/discord-post.js.map +1 -0
- package/dist/agent/channels/discord-read.d.ts +40 -0
- package/dist/agent/channels/discord-read.d.ts.map +1 -0
- package/dist/agent/channels/discord-read.js +128 -0
- package/dist/agent/channels/discord-read.js.map +1 -0
- package/dist/agent/channels/discord-rest.d.ts +33 -0
- package/dist/agent/channels/discord-rest.d.ts.map +1 -0
- package/dist/agent/channels/discord-rest.js +75 -0
- package/dist/agent/channels/discord-rest.js.map +1 -0
- package/dist/agent/channels/discord.d.ts +3 -0
- package/dist/agent/channels/discord.d.ts.map +1 -0
- package/dist/agent/channels/discord.js +230 -0
- package/dist/agent/channels/discord.js.map +1 -0
- package/dist/agent/commands/discord-command-sync.d.ts +66 -0
- package/dist/agent/commands/discord-command-sync.d.ts.map +1 -0
- package/dist/agent/commands/discord-command-sync.js +224 -0
- package/dist/agent/commands/discord-command-sync.js.map +1 -0
- package/dist/agent/commands/discord-commands.d.ts +45 -0
- package/dist/agent/commands/discord-commands.d.ts.map +1 -0
- package/dist/agent/commands/discord-commands.js +266 -0
- package/dist/agent/commands/discord-commands.js.map +1 -0
- package/dist/agent/contributions.d.ts +17 -0
- package/dist/agent/contributions.d.ts.map +1 -0
- package/dist/agent/contributions.js +31 -0
- package/dist/agent/contributions.js.map +1 -0
- package/dist/agent/docs-generated.d.ts +3 -0
- package/dist/agent/docs-generated.d.ts.map +1 -0
- package/dist/agent/docs-generated.js +13 -0
- package/dist/agent/docs-generated.js.map +1 -0
- package/dist/agent/identity/discord-link-consent.d.ts +13 -0
- package/dist/agent/identity/discord-link-consent.d.ts.map +1 -0
- package/dist/agent/identity/discord-link-consent.js +111 -0
- package/dist/agent/identity/discord-link-consent.js.map +1 -0
- package/dist/agent/ops.d.ts +2 -0
- package/dist/agent/ops.d.ts.map +1 -0
- package/dist/agent/ops.js +13 -0
- package/dist/agent/ops.js.map +1 -0
- package/dist/agent/provider-events.d.ts +3 -0
- package/dist/agent/provider-events.d.ts.map +1 -0
- package/dist/agent/provider-events.js +78 -0
- package/dist/agent/provider-events.js.map +1 -0
- package/dist/agent/register.d.ts +5 -0
- package/dist/agent/register.d.ts.map +1 -0
- package/dist/agent/register.js +125 -0
- package/dist/agent/register.js.map +1 -0
- package/dist/agent/surface-parity.d.ts +3 -0
- package/dist/agent/surface-parity.d.ts.map +1 -0
- package/dist/agent/surface-parity.js +90 -0
- package/dist/agent/surface-parity.js.map +1 -0
- package/package.json +185 -0
- package/tsconfig.build.json +22 -0
- package/tsconfig.json +15 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your Exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Tommy Long
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Open Everywhere
|
|
2
|
+
Copyright 2026 Tommy Long
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Built on Vercel Eve (https://github.com/vercel/eve), licensed under the
|
|
9
|
+
Apache License, Version 2.0.
|
|
10
|
+
|
|
11
|
+
@open-everywhere/core also ships a patch that modifies Vercel Eve (the file in
|
|
12
|
+
its patches/ directory), with the oe-eve-patch command that applies it to a
|
|
13
|
+
consumer's own installed copy. The patch is licensed under the Apache License,
|
|
14
|
+
Version 2.0. No modified Vercel Eve files are distributed.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
Open Everywhere is an independent, open-source project. It is NOT affiliated
|
|
19
|
+
with, endorsed by, or sponsored by Anthropic. "Claude", "Claude Code", and
|
|
20
|
+
"Claude Tag" are referenced only to describe the prior art Open Everywhere is
|
|
21
|
+
inspired by, and are trademarks of their respective owner.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @open-everywhere/provider-discord
|
|
2
|
+
|
|
3
|
+
Discord channel and DM surfaces for Open Everywhere.
|
|
4
|
+
|
|
5
|
+
Part of [Open Everywhere](https://github.com/open-everywhere/open-everywhere) β an open, self-hostable autonomous teammate you tag where your
|
|
6
|
+
team works. This package is the Discord provider. It supplies the identity mapper, the capability manifest, the post arm, the wake-origin codec, the read adapter, the reaction surface, the message operations, the approval cards, the gateway wiring and the guild-admin check.
|
|
7
|
+
|
|
8
|
+
`@open-everywhere/core` owns the runtime β access and approvals, identity, memory, spend, the
|
|
9
|
+
audit chain. This package holds the Discord half. The boundary between them is a vendor-coupling
|
|
10
|
+
one, and `packages/core/scripts/boundary-test.ts` checks it per provider: it names one or more
|
|
11
|
+
vendor fingerprint strings, asserts that **at least one** of them appears under this package, and
|
|
12
|
+
asserts that **every** one of them is absent from `packages/core/agent`. For Discord those strings are
|
|
13
|
+
the Bot API host `discord.com/api`. Core's registries refuse a provider the deployment has not selected.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm i @open-everywhere/core @open-everywhere/provider-discord eve@0.54.3
|
|
19
|
+
npx oe-eve-patch
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Both commands are required.** Core refuses to boot on an unpatched `eve`. A registry `eve` carries
|
|
23
|
+
no patch, so `npx oe-eve-patch` applies the copy `@open-everywhere/core` ships.
|
|
24
|
+
|
|
25
|
+
`eve` is a peer dependency, pinned to the exact version above, which is the pin
|
|
26
|
+
`@open-everywhere/core` declares as `peerDependencies.eve`. Node 24 or newer.
|
|
27
|
+
|
|
28
|
+
## Use
|
|
29
|
+
|
|
30
|
+
One call registers the bundle:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { registerDiscordProvider } from "@open-everywhere/provider-discord/agent/register.js";
|
|
34
|
+
|
|
35
|
+
registerDiscordProvider();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Credentials, the webhook and the Discord app setup are in the runbook below.
|
|
39
|
+
|
|
40
|
+
## Docs
|
|
41
|
+
|
|
42
|
+
- [Discord runbook](https://github.com/open-everywhere/open-everywhere/blob/main/docs/deploy/surfaces/discord.md)
|
|
43
|
+
- [Documentation index](https://github.com/open-everywhere/open-everywhere/blob/main/docs/README.md)
|
|
44
|
+
|
|
45
|
+
## Licence
|
|
46
|
+
|
|
47
|
+
Apache 2.0. The tarball carries `LICENSE` and `NOTICE`.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// THE DISCORD HALF OF THE CREDENTIAL-GRANT CARD BUTTON (OPE-1260) β the sibling of
|
|
2
|
+
// identity/discord-link-consent.ts, funnelling through core's own `resolveGrantCardClick` exactly as
|
|
3
|
+
// that file funnels through `resolveLinkConsentClick`. Core decides; this file only reads Discord's
|
|
4
|
+
// envelope and writes Discord's answer.
|
|
5
|
+
//
|
|
6
|
+
// WHAT WAS WRONG BEFORE THIS FILE. The owner's grant card is delivered as a DM with an actions row,
|
|
7
|
+
// and the Discord DM arm renders those actions as real components (channels/discord-post-arm.ts). The
|
|
8
|
+
// front route classified only `oe-approval:` and `oe-link:`, so an `oe_grant:` tap FORWARDED to eve's
|
|
9
|
+
// HITL decoder, which no-ops it. The owner saw four buttons, tapped one, and nothing happened β
|
|
10
|
+
// no approval, no decline, no answer, and the ask then lapsed on its own.
|
|
11
|
+
//
|
|
12
|
+
// π΄ THE CLICKER IS READ FROM THE ENVELOPE, NEVER FROM A PAYLOAD FIELD. A grant answer is scoped to
|
|
13
|
+
// BEING the owner the card was sent to, so whose hand it was is the whole security content of this
|
|
14
|
+
// file. The front route has already verified Discord's Ed25519 signature over the RAW body, so every
|
|
15
|
+
// field read below is Discord's own statement. Core then compares that clicker to the ask row's
|
|
16
|
+
// `ownerPrincipalId`; an ask id names an ask, it never answers one.
|
|
17
|
+
//
|
|
18
|
+
// π΄ DM-ONLY, REFUSED RATHER THAN TOLERATED β the same rule, for the same reason, as the consent
|
|
19
|
+
// button. A grant card is only ever delivered through `deliverDirectMessage`, so it only ever lands
|
|
20
|
+
// in a 1:1. A guild click therefore cannot be a tap on a real card: the message was forwarded, or the
|
|
21
|
+
// id was guessed. `interaction.guild_id` present β refuse, and say so.
|
|
22
|
+
//
|
|
23
|
+
// WHERE THIS DIFFERS FROM THE SLACK DOOR, and why. Slack's `handleGrantCardClick` posts its private
|
|
24
|
+
// answer with a second API call (`chat.postEphemeral`), because a Slack interactivity POST answers
|
|
25
|
+
// with an empty 200. Discord's interaction response IS the private answer β `type 4` + `flags 64` β
|
|
26
|
+
// so the answer rides the click's own reply and no second call is made. The DECISION, the copy and
|
|
27
|
+
// the audit row are core's, identical on both surfaces.
|
|
28
|
+
//
|
|
29
|
+
// β οΈ THIS FILE NEVER TOUCHES THE CARD β CORE REWRITES IT AFTER THE DECISION (OPE-1278). The answer
|
|
30
|
+
// here is ephemeral, so the handler leaves the owner's message alone. Core's `rewriteGrantCard`
|
|
31
|
+
// (access/credential-grant-card.ts) rewrites that card to a terminal APPROVED or DECLINED body once
|
|
32
|
+
// the CAS has closed the ask, and the Discord edit arm's `components: []` takes the four buttons
|
|
33
|
+
// with it (channels/discord-message-ops.ts). THAT REWRITE IS BEST-EFFORT: an ask row with no pinned
|
|
34
|
+
// card locus, or an edit the surface refuses, still leaves live buttons over a closed request. The
|
|
35
|
+
// CAS is what makes that safe β core's approve is conjunct on `status = 'pending'`, so a second tap
|
|
36
|
+
// mints nothing and is answered "that request is no longer open", which is the truth.
|
|
37
|
+
//
|
|
38
|
+
// NEVER THROWS. Discord's interactions endpoint must answer within three seconds, and a throw there
|
|
39
|
+
// becomes a red "This interaction failed" the person cannot act on.
|
|
40
|
+
//
|
|
41
|
+
// π΄ THE RESOLUTION IS DEFERRED, BECAUSE IT IS NOT FAST AND DISCORD DOES NOT REDELIVER (OPE-1282).
|
|
42
|
+
// `resolveGrantCardClick` used to be awaited to completion before this returned. An APPROVE inside it
|
|
43
|
+
// reads the owner's own MCP connection before it CASes β a consent probe, a token mint, an MCP
|
|
44
|
+
// handshake and a `tools/list`, all four sharing one `BORROW_APPROVE_READ_BUDGET_MS` deadline (core
|
|
45
|
+
// connections/grant-mcp-borrow.ts, five seconds) β and then does the CAS, the grant insert, the audit rows
|
|
46
|
+
// and an AWAITED post into the requesting room. That can exceed Discord's three seconds.
|
|
47
|
+
//
|
|
48
|
+
// WHAT THAT COST, AND WHY IT WAS WORSE HERE THAN ON SLACK. Slack redelivers an interactivity payload
|
|
49
|
+
// it has not seen answered, so a slow approve there is retried (slack-front.ts's own note). Discord
|
|
50
|
+
// does NOT redeliver an expired interaction token: the owner saw a red "This interaction failed" and
|
|
51
|
+
// this handler's ephemeral answer was never rendered β while the grant really was minted and the
|
|
52
|
+
// requesting room really was told. A second tap then read "that request is no longer open", which is
|
|
53
|
+
// true and reads like a failure. It was never a correctness problem β the approve CAS still yields
|
|
54
|
+
// exactly one grant β but the owner believed their approval had failed while a conversation could
|
|
55
|
+
// already spend their credential.
|
|
56
|
+
//
|
|
57
|
+
// SO THIS DOOR IS NOW "ACK, THEN DECIDE, THEN EDIT": it answers with a DEFERRED ephemeral response
|
|
58
|
+
// (`type 5`, channels/discord-interaction-defer.ts), hands the resolution to the host's `waitUntil`,
|
|
59
|
+
// and edits the placeholder with core's own decision copy when it lands. The ephemeral flag rides
|
|
60
|
+
// the ACK β Discord fixes visibility at the first response β so the answer is still private.
|
|
61
|
+
//
|
|
62
|
+
// π΄ THE FAST REFUSALS DO NOT DEFER, and that is deliberate. A guild click, an unattributable
|
|
63
|
+
// clicker and an unreadable action id are all decided from the envelope alone, in no time at all.
|
|
64
|
+
// Deferring them would trade an instant answer for a placeholder plus a second round trip, and each
|
|
65
|
+
// one is a `type 4` today because that is the correct shape for an answer that is already known.
|
|
66
|
+
//
|
|
67
|
+
// π΄ NO `waitUntil` β NO DEFER. Without somewhere to run the work, a deferred ack would leave the
|
|
68
|
+
// owner on a permanent "thinkingβ¦" β strictly worse than the slow answer. The handler falls back to
|
|
69
|
+
// the original await-then-answer shape instead, and says so in the log.
|
|
70
|
+
//
|
|
71
|
+
// β οΈ approvals/discord-flow.ts IS ONLY HALF THIS SHAPE, and cannot take the other half as written
|
|
72
|
+
// (OPE-1407). Its `deliverDecisionFeedback` β the notice post and the decision wake β now runs under
|
|
73
|
+
// the route's `waitUntil` WHEN THE ROUTE SUPPLIES ONE, which takes that leg out of the three-second
|
|
74
|
+
// budget; a host that supplies none still awaits it inside the budget. Its `resolveApprovalClick`
|
|
75
|
+
// stays on the response path because that door answers with THREE response KINDS chosen by the
|
|
76
|
+
// resolution (`type 7` replaces the card, `type 6` acks silently, `type 4` sends an ephemeral), and
|
|
77
|
+
// Discord fixes a response's kind at the first response. This door answers with one `type 4` on
|
|
78
|
+
// every path, which is what lets it defer as `type 5` and say the same thing later. Closing the
|
|
79
|
+
// other half needs a follow-up MESSAGE rather than the `@original` edit this module provides.
|
|
80
|
+
|
|
81
|
+
import { OE_GRANT_ACTION_PREFIX, parseGrantCardActionId, resolveGrantCardClick, deploymentOrg } from "@open-everywhere/core/agent/adapter-api.js";
|
|
82
|
+
import { deferredEphemeralResponse, editOriginalInteractionResponse, interactionFollowUp, type InteractionFollowUp } from "../channels/discord-interaction-defer.js";
|
|
83
|
+
|
|
84
|
+
function log(msg: string): void {
|
|
85
|
+
console.log(`[open-everywhere:discord-grant] ${msg}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Discord interaction-response wire constants, defined locally for the same reason
|
|
89
|
+
// identity/discord-link-consent.ts and approvals/discord-flow.ts define their own.
|
|
90
|
+
const RESPONSE_CHANNEL_MESSAGE = 4; // CHANNEL_MESSAGE_WITH_SOURCE
|
|
91
|
+
const EPHEMERAL = 64; // MessageFlags.EPHEMERAL β only the clicker sees it
|
|
92
|
+
|
|
93
|
+
/** The interaction response body this handler returns. Loosely typed, exactly as its two sibling
|
|
94
|
+
* handlers type theirs, so the front route can hold one seam type across all three. */
|
|
95
|
+
export type DiscordGrantClickResponse = Record<string, unknown>;
|
|
96
|
+
|
|
97
|
+
/** The host edges this door needs to defer. Both are injected so a test can drive the whole
|
|
98
|
+
* ack-then-edit sequence with no Discord and no host. */
|
|
99
|
+
export interface DiscordGrantClickDeps {
|
|
100
|
+
/** The route's own `waitUntil` β keeps the resolution alive past the interaction response on a
|
|
101
|
+
* serverless host. ABSENT β no defer (see the header): the handler awaits and answers as before. */
|
|
102
|
+
readonly waitUntil?: (p: Promise<unknown>) => void;
|
|
103
|
+
/** The follow-up edit. Live default is {@link editOriginalInteractionResponse}. */
|
|
104
|
+
readonly edit?: (followUp: InteractionFollowUp, content: string) => Promise<boolean>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function ephemeral(content: string): DiscordGrantClickResponse {
|
|
108
|
+
return { type: RESPONSE_CHANNEL_MESSAGE, data: { content, flags: EPHEMERAL } };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function isObject(v: unknown): v is Record<string, unknown> {
|
|
112
|
+
return typeof v === "object" && v !== null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The clicking user's Discord id, from the envelope's own fields. Discord puts the clicker at
|
|
116
|
+
* `interaction.user` in a DM and at `interaction.member.user` in a guild; both are read so the
|
|
117
|
+
* guild refusal below is a DELIBERATE refusal rather than an accident of which field was absent. */
|
|
118
|
+
function clickerIdOf(interaction: Record<string, unknown>): string | undefined {
|
|
119
|
+
const direct = isObject(interaction["user"]) ? interaction["user"]["id"] : undefined;
|
|
120
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
121
|
+
const member = isObject(interaction["member"]) ? interaction["member"]["user"] : undefined;
|
|
122
|
+
const viaMember = isObject(member) ? member["id"] : undefined;
|
|
123
|
+
return typeof viaMember === "string" && viaMember.length > 0 ? viaMember : undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** The channel the click happened in β the audit row's `surface`. Absent on a body that carries
|
|
127
|
+
* none, which is a stamp we leave off rather than invent. */
|
|
128
|
+
function channelIdOf(interaction: Record<string, unknown>): string | undefined {
|
|
129
|
+
const id = interaction["channel_id"];
|
|
130
|
+
if (typeof id === "string" && id.length > 0) return id;
|
|
131
|
+
const channel = isObject(interaction["channel"]) ? interaction["channel"]["id"] : undefined;
|
|
132
|
+
return typeof channel === "string" && channel.length > 0 ? channel : undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Handle one verified `oe_grant:` component click.
|
|
137
|
+
*
|
|
138
|
+
* Returns the interaction response body to send, or `null` for anything that is NOT one of ours β
|
|
139
|
+
* the front route then forwards it, so a click is never silently swallowed. NEVER throws.
|
|
140
|
+
*
|
|
141
|
+
* π΄ ON THE RESOLUTION PATH IT RETURNS BEFORE THE DECISION IS MADE (OPE-1282). The body is a
|
|
142
|
+
* DEFERRED ephemeral ack; the decision runs under `deps.waitUntil` and edits that placeholder when
|
|
143
|
+
* it lands. See the header for why, and for the two cases that still answer synchronously.
|
|
144
|
+
*/
|
|
145
|
+
export async function handleDiscordGrantCardInteraction(
|
|
146
|
+
raw: unknown,
|
|
147
|
+
deps: DiscordGrantClickDeps = {},
|
|
148
|
+
): Promise<DiscordGrantClickResponse | null> {
|
|
149
|
+
try {
|
|
150
|
+
if (!isObject(raw)) return null;
|
|
151
|
+
const data = isObject(raw["data"]) ? raw["data"] : undefined;
|
|
152
|
+
const customId = typeof data?.["custom_id"] === "string" ? (data["custom_id"] as string) : undefined;
|
|
153
|
+
if (!customId?.startsWith(OE_GRANT_ACTION_PREFIX)) return null;
|
|
154
|
+
const parsed = parseGrantCardActionId(customId);
|
|
155
|
+
if (parsed === undefined) {
|
|
156
|
+
// Ours by prefix, unreadable by grammar. Returning null lets the front route forward it rather
|
|
157
|
+
// than swallow it β the same defensive shape both sibling handlers take.
|
|
158
|
+
log("grant card custom_id did not parse β forwarding");
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (typeof raw["guild_id"] === "string" && raw["guild_id"].length > 0) {
|
|
163
|
+
// See the header: a grant card only ever lands in a DM, so a guild click is not the owner
|
|
164
|
+
// answering their own card.
|
|
165
|
+
return ephemeral(
|
|
166
|
+
"I only take an answer to a credential request in our direct messages β this one came from a server. Open our DM and answer it there. Nothing was granted.",
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const clicker = clickerIdOf(raw);
|
|
171
|
+
if (clicker === undefined) {
|
|
172
|
+
log("grant card click carried no attributable user β refusing");
|
|
173
|
+
return ephemeral("I could not tell who pressed that, so I did nothing and nothing was granted.");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const channelId = channelIdOf(raw);
|
|
177
|
+
const resolve = (): Promise<{ text: string }> =>
|
|
178
|
+
resolveGrantCardClick({
|
|
179
|
+
askId: parsed.askId,
|
|
180
|
+
answer: parsed.answer,
|
|
181
|
+
// π΄ NO TENANT RUNG, AND THAT IS THE CORRECT SPELLING RATHER THAN A GAP. Discord is not a
|
|
182
|
+
// tenant-scoped platform (identity/principal-key.ts), so the owner's key is `discord/<user-id>`
|
|
183
|
+
// β the exact string the ask row's `ownerPrincipalId` was minted as. Passing a guild here would
|
|
184
|
+
// compose a three-segment key that matches nobody and refuse every genuine owner.
|
|
185
|
+
clicker: { platform: "discord", nativeId: clicker },
|
|
186
|
+
// READ WHEN THE RESOLUTION RUNS, not when the ack is sent β it is the clock the ask's expiry
|
|
187
|
+
// is judged against, and the defer puts real time between the two.
|
|
188
|
+
nowMs: Date.now(),
|
|
189
|
+
// ONE deployment serves ONE org, and the ask row was written under that partition. Reading it
|
|
190
|
+
// from the deployment rather than the payload is what stops a forged body naming another
|
|
191
|
+
// tenant's asks β the same reason both sibling handlers read it this way.
|
|
192
|
+
org: deploymentOrg(),
|
|
193
|
+
platform: "discord",
|
|
194
|
+
// A DM has no guild, and the Discord identity mapper's own convention for that partition is the
|
|
195
|
+
// user's id in the `workspace` rung (channels/discord-identity.ts `guildId ?? userId`). Spelled
|
|
196
|
+
// the same way here so this audit row files where every other Discord DM row files.
|
|
197
|
+
workspace: clicker,
|
|
198
|
+
...(channelId === undefined ? {} : { surface: channelId }),
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const followUp = interactionFollowUp(raw);
|
|
202
|
+
if (deps.waitUntil === undefined || followUp === undefined) {
|
|
203
|
+
// NO PLACE TO RUN THE WORK, OR NO ADDRESS TO ANSWER AT β the pre-OPE-1282 shape. Slow, and
|
|
204
|
+
// still correct: a deferred ack we could not follow up would leave a permanent "thinkingβ¦".
|
|
205
|
+
log(`grant card click answering synchronously (${deps.waitUntil === undefined ? "no waitUntil" : "no follow-up address"}) β a slow approve may outlive the interaction token`);
|
|
206
|
+
return ephemeral((await resolve()).text);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const edit = deps.edit ?? editOriginalInteractionResponse;
|
|
210
|
+
deps.waitUntil(
|
|
211
|
+
(async () => {
|
|
212
|
+
// TOTAL. This runs after the response has gone; a throw here reaches the host's unhandled
|
|
213
|
+
// rejection handler and tells the owner nothing. Core's resolver is already total, so the
|
|
214
|
+
// catch is for the edit's own transport and for an impossible throw above it.
|
|
215
|
+
let text: string;
|
|
216
|
+
try {
|
|
217
|
+
text = (await resolve()).text;
|
|
218
|
+
} catch (err) {
|
|
219
|
+
log(`deferred grant card resolution failed: ${(err as Error)?.message ?? String(err)}`);
|
|
220
|
+
text = "That could not be answered right now. Nothing changed, and nothing was granted. Try the button again.";
|
|
221
|
+
}
|
|
222
|
+
// π΄ A FAILED EDIT IS LOUD BUT NOT FATAL: the DECISION has already landed and been audited by
|
|
223
|
+
// core. What is lost is the owner's explanation, which is exactly what the pre-fix expired
|
|
224
|
+
// token lost β so this is never a regression, and it must be findable in the log.
|
|
225
|
+
const shown = await edit(followUp, text);
|
|
226
|
+
if (!shown) log(`grant card answer could NOT be shown to the owner β the decision landed and is audited, the owner was not told`);
|
|
227
|
+
})(),
|
|
228
|
+
);
|
|
229
|
+
return deferredEphemeralResponse();
|
|
230
|
+
} catch (err) {
|
|
231
|
+
// A three-second endpoint: an unhandled throw is a red "interaction failed" the person cannot act
|
|
232
|
+
// on. Core's resolver is already total and guards every write, so an honest answer here costs the
|
|
233
|
+
// owner an explanation and never an outcome.
|
|
234
|
+
log(`grant card click failed: ${(err as Error)?.message ?? String(err)}`);
|
|
235
|
+
return ephemeral("That could not be answered right now. Nothing changed, and nothing was granted. Try the button again.");
|
|
236
|
+
}
|
|
237
|
+
}
|