@open-everywhere/provider-slack 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.
Files changed (151) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +21 -0
  3. package/README.md +47 -0
  4. package/agent/access/slack-attachment-fetch.ts +168 -0
  5. package/agent/app-manifest.ts +149 -0
  6. package/agent/channels/slack-approval-card.ts +275 -0
  7. package/agent/channels/slack-attachments.ts +195 -0
  8. package/agent/channels/slack-commands.ts +227 -0
  9. package/agent/channels/slack-context.ts +185 -0
  10. package/agent/channels/slack-events.ts +5406 -0
  11. package/agent/channels/slack-front.ts +2349 -0
  12. package/agent/channels/slack-identity.ts +520 -0
  13. package/agent/channels/slack-input-response.ts +162 -0
  14. package/agent/channels/slack-mrkdwn.ts +61 -0
  15. package/agent/channels/slack-origin-codec.ts +62 -0
  16. package/agent/channels/slack-post-arm.ts +314 -0
  17. package/agent/channels/slack-read.ts +248 -0
  18. package/agent/channels/slack-route-hold.ts +107 -0
  19. package/agent/channels/slack-shortcut.ts +336 -0
  20. package/agent/channels/slack-signature.ts +53 -0
  21. package/agent/channels/slack-spend-gate.ts +62 -0
  22. package/agent/channels/slack-tenant-fence.ts +99 -0
  23. package/agent/channels/slack-wake-backscroll.ts +604 -0
  24. package/agent/channels/slack-web-api.ts +178 -0
  25. package/agent/channels/slack-webhook-verifier.ts +116 -0
  26. package/agent/channels/slack.ts +1266 -0
  27. package/agent/contributions.ts +32 -0
  28. package/agent/docs-generated.ts +15 -0
  29. package/agent/ops.ts +50 -0
  30. package/agent/provider-events.ts +91 -0
  31. package/agent/register.ts +144 -0
  32. package/agent/surface-parity.ts +99 -0
  33. package/dist/agent/access/slack-attachment-fetch.d.ts +15 -0
  34. package/dist/agent/access/slack-attachment-fetch.d.ts.map +1 -0
  35. package/dist/agent/access/slack-attachment-fetch.js +151 -0
  36. package/dist/agent/access/slack-attachment-fetch.js.map +1 -0
  37. package/dist/agent/app-manifest.d.ts +15 -0
  38. package/dist/agent/app-manifest.d.ts.map +1 -0
  39. package/dist/agent/app-manifest.js +141 -0
  40. package/dist/agent/app-manifest.js.map +1 -0
  41. package/dist/agent/channels/slack-approval-card.d.ts +71 -0
  42. package/dist/agent/channels/slack-approval-card.d.ts.map +1 -0
  43. package/dist/agent/channels/slack-approval-card.js +232 -0
  44. package/dist/agent/channels/slack-approval-card.js.map +1 -0
  45. package/dist/agent/channels/slack-attachments.d.ts +66 -0
  46. package/dist/agent/channels/slack-attachments.d.ts.map +1 -0
  47. package/dist/agent/channels/slack-attachments.js +174 -0
  48. package/dist/agent/channels/slack-attachments.js.map +1 -0
  49. package/dist/agent/channels/slack-commands.d.ts +27 -0
  50. package/dist/agent/channels/slack-commands.d.ts.map +1 -0
  51. package/dist/agent/channels/slack-commands.js +208 -0
  52. package/dist/agent/channels/slack-commands.js.map +1 -0
  53. package/dist/agent/channels/slack-context.d.ts +26 -0
  54. package/dist/agent/channels/slack-context.d.ts.map +1 -0
  55. package/dist/agent/channels/slack-context.js +178 -0
  56. package/dist/agent/channels/slack-context.js.map +1 -0
  57. package/dist/agent/channels/slack-events.d.ts +1654 -0
  58. package/dist/agent/channels/slack-events.d.ts.map +1 -0
  59. package/dist/agent/channels/slack-events.js +4240 -0
  60. package/dist/agent/channels/slack-events.js.map +1 -0
  61. package/dist/agent/channels/slack-front.d.ts +387 -0
  62. package/dist/agent/channels/slack-front.d.ts.map +1 -0
  63. package/dist/agent/channels/slack-front.js +1958 -0
  64. package/dist/agent/channels/slack-front.js.map +1 -0
  65. package/dist/agent/channels/slack-identity.d.ts +245 -0
  66. package/dist/agent/channels/slack-identity.d.ts.map +1 -0
  67. package/dist/agent/channels/slack-identity.js +405 -0
  68. package/dist/agent/channels/slack-identity.js.map +1 -0
  69. package/dist/agent/channels/slack-input-response.d.ts +26 -0
  70. package/dist/agent/channels/slack-input-response.d.ts.map +1 -0
  71. package/dist/agent/channels/slack-input-response.js +127 -0
  72. package/dist/agent/channels/slack-input-response.js.map +1 -0
  73. package/dist/agent/channels/slack-mrkdwn.d.ts +3 -0
  74. package/dist/agent/channels/slack-mrkdwn.d.ts.map +1 -0
  75. package/dist/agent/channels/slack-mrkdwn.js +53 -0
  76. package/dist/agent/channels/slack-mrkdwn.js.map +1 -0
  77. package/dist/agent/channels/slack-origin-codec.d.ts +7 -0
  78. package/dist/agent/channels/slack-origin-codec.d.ts.map +1 -0
  79. package/dist/agent/channels/slack-origin-codec.js +55 -0
  80. package/dist/agent/channels/slack-origin-codec.js.map +1 -0
  81. package/dist/agent/channels/slack-post-arm.d.ts +54 -0
  82. package/dist/agent/channels/slack-post-arm.d.ts.map +1 -0
  83. package/dist/agent/channels/slack-post-arm.js +268 -0
  84. package/dist/agent/channels/slack-post-arm.js.map +1 -0
  85. package/dist/agent/channels/slack-read.d.ts +84 -0
  86. package/dist/agent/channels/slack-read.d.ts.map +1 -0
  87. package/dist/agent/channels/slack-read.js +205 -0
  88. package/dist/agent/channels/slack-read.js.map +1 -0
  89. package/dist/agent/channels/slack-route-hold.d.ts +34 -0
  90. package/dist/agent/channels/slack-route-hold.d.ts.map +1 -0
  91. package/dist/agent/channels/slack-route-hold.js +97 -0
  92. package/dist/agent/channels/slack-route-hold.js.map +1 -0
  93. package/dist/agent/channels/slack-shortcut.d.ts +162 -0
  94. package/dist/agent/channels/slack-shortcut.d.ts.map +1 -0
  95. package/dist/agent/channels/slack-shortcut.js +262 -0
  96. package/dist/agent/channels/slack-shortcut.js.map +1 -0
  97. package/dist/agent/channels/slack-signature.d.ts +19 -0
  98. package/dist/agent/channels/slack-signature.d.ts.map +1 -0
  99. package/dist/agent/channels/slack-signature.js +50 -0
  100. package/dist/agent/channels/slack-signature.js.map +1 -0
  101. package/dist/agent/channels/slack-spend-gate.d.ts +22 -0
  102. package/dist/agent/channels/slack-spend-gate.d.ts.map +1 -0
  103. package/dist/agent/channels/slack-spend-gate.js +48 -0
  104. package/dist/agent/channels/slack-spend-gate.js.map +1 -0
  105. package/dist/agent/channels/slack-tenant-fence.d.ts +61 -0
  106. package/dist/agent/channels/slack-tenant-fence.d.ts.map +1 -0
  107. package/dist/agent/channels/slack-tenant-fence.js +88 -0
  108. package/dist/agent/channels/slack-tenant-fence.js.map +1 -0
  109. package/dist/agent/channels/slack-wake-backscroll.d.ts +188 -0
  110. package/dist/agent/channels/slack-wake-backscroll.d.ts.map +1 -0
  111. package/dist/agent/channels/slack-wake-backscroll.js +473 -0
  112. package/dist/agent/channels/slack-wake-backscroll.js.map +1 -0
  113. package/dist/agent/channels/slack-web-api.d.ts +46 -0
  114. package/dist/agent/channels/slack-web-api.d.ts.map +1 -0
  115. package/dist/agent/channels/slack-web-api.js +147 -0
  116. package/dist/agent/channels/slack-web-api.js.map +1 -0
  117. package/dist/agent/channels/slack-webhook-verifier.d.ts +5 -0
  118. package/dist/agent/channels/slack-webhook-verifier.d.ts.map +1 -0
  119. package/dist/agent/channels/slack-webhook-verifier.js +112 -0
  120. package/dist/agent/channels/slack-webhook-verifier.js.map +1 -0
  121. package/dist/agent/channels/slack.d.ts +37 -0
  122. package/dist/agent/channels/slack.d.ts.map +1 -0
  123. package/dist/agent/channels/slack.js +1169 -0
  124. package/dist/agent/channels/slack.js.map +1 -0
  125. package/dist/agent/contributions.d.ts +17 -0
  126. package/dist/agent/contributions.d.ts.map +1 -0
  127. package/dist/agent/contributions.js +32 -0
  128. package/dist/agent/contributions.js.map +1 -0
  129. package/dist/agent/docs-generated.d.ts +3 -0
  130. package/dist/agent/docs-generated.d.ts.map +1 -0
  131. package/dist/agent/docs-generated.js +13 -0
  132. package/dist/agent/docs-generated.js.map +1 -0
  133. package/dist/agent/ops.d.ts +3 -0
  134. package/dist/agent/ops.d.ts.map +1 -0
  135. package/dist/agent/ops.js +38 -0
  136. package/dist/agent/ops.js.map +1 -0
  137. package/dist/agent/provider-events.d.ts +3 -0
  138. package/dist/agent/provider-events.d.ts.map +1 -0
  139. package/dist/agent/provider-events.js +84 -0
  140. package/dist/agent/provider-events.js.map +1 -0
  141. package/dist/agent/register.d.ts +5 -0
  142. package/dist/agent/register.d.ts.map +1 -0
  143. package/dist/agent/register.js +118 -0
  144. package/dist/agent/register.js.map +1 -0
  145. package/dist/agent/surface-parity.d.ts +3 -0
  146. package/dist/agent/surface-parity.d.ts.map +1 -0
  147. package/dist/agent/surface-parity.js +95 -0
  148. package/dist/agent/surface-parity.js.map +1 -0
  149. package/package.json +209 -0
  150. package/tsconfig.build.json +22 -0
  151. 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-slack
2
+
3
+ Slack 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 Slack provider. It supplies the identity mapper, the capability manifest, the post arm, the wake-origin codec, the channel and DM read adapter, the reaction surface, the approval and connector cards, and the slash commands.
7
+
8
+ `@open-everywhere/core` owns the runtime — access and approvals, identity, memory, spend, the
9
+ audit chain. This package holds the Slack 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 Slack those strings are
13
+ `SLACK_SIGNING_SECRET` and `SLACK_BOT_TOKEN`. 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-slack 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`. `undici` is a dependency. Node 24 or newer.
27
+
28
+ ## Use
29
+
30
+ One call registers the bundle:
31
+
32
+ ```ts
33
+ import { registerSlackProvider } from "@open-everywhere/provider-slack/agent/register.js";
34
+
35
+ registerSlackProvider();
36
+ ```
37
+
38
+ Credentials, the webhook and the Slack app setup are in the runbook below.
39
+
40
+ ## Docs
41
+
42
+ - [Slack runbook](https://github.com/open-everywhere/open-everywhere/blob/main/docs/deploy/surfaces/slack.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,168 @@
1
+ // Trusted-provenance Slack attachment fetch — the ONE seam that attaches the Slack BOT TOKEN to
2
+ // a file download, and ONLY ever sends it to a validated Slack file host.
3
+ //
4
+ // WHY THIS EXISTS, DISTINCT FROM oeFetch (access/host-egress.ts). `oeFetch` is the guard for a
5
+ // MODEL-SUPPLIED URL: it sends NO credentials, precisely because a model-chosen destination must
6
+ // never receive one (P0-1, the EXFIL leg). But a Slack image sits behind `url_private`, which
7
+ // 302/403s without the bot token — so pasted Slack screenshots (the main describe_image use case)
8
+ // are unfetchable credential-less. This helper closes that gap under two hard constraints that
9
+ // oeFetch's blanket "send nothing" rule made moot there:
10
+ //
11
+ // 1. TRUSTED PROVENANCE — the URL is NOT a tool argument. It arrives as an already-resolved
12
+ // record whose `urlPrivate` came from a Slack event's `files[].url_private`
13
+ // (channels/slack-attachments.ts, populated only by parseMessageEvent). describe_image
14
+ // resolves a model-named FILE ID through that registry and passes the resulting record here.
15
+ // A model-chosen URL string can never reach this function — the signature takes a record, not
16
+ // a raw URL, and describe_image only ever builds that record from the registry.
17
+ //
18
+ // 2. HOST-PINNED CREDENTIAL — the bot token rides ONLY to a Slack file host (files.slack.com).
19
+ // Any other host is refused and the token is NEVER sent (nor is the host even resolved). So
20
+ // even if provenance were somehow subverted, the credential cannot leak to an attacker host.
21
+ //
22
+ // Plus the SAME SSRF posture as oeFetch: resolve-then-check-then-PIN (reusing
23
+ // `assertSafeFetchUrl`) so even files.slack.com gets the DNS-rebind check — a poisoned resolver
24
+ // pointing files.slack.com at an internal IP is refused — and `redirect:"error"` so a 3xx can't
25
+ // bounce the token to another host.
26
+ //
27
+ // ONE TIER-DEPENDENT CAVEAT (OPE-322). `assertSafeFetchUrl` now routes through the forward proxy
28
+ // when `*_PROXY` is set (the self-host/docker stack), because the app container has no WAN route at
29
+ // all — without it this download simply fails there. On that path the IP-pin cannot operate (the
30
+ // proxy resolves the CONNECT target itself) and anti-rebind is delegated to the proxy's default-deny
31
+ // ACL; the returned `antiRebind` says which held, and this seam records it on the allow row. The
32
+ // HOST-PIN above — the property that actually protects the token — is unaffected, and it is decided
33
+ // before any dispatch. The token does traverse the operator's own proxy: Tier A tunnels it
34
+ // undecrypted (CONNECT), Tier B decrypts with the operator's CA, which is what Tier B is for.
35
+
36
+ import {
37
+ assertSafeFetchUrl,
38
+ auditToolAction,
39
+ hostCallAuditFields,
40
+ type BindableContext,
41
+ type EgressDispatch,
42
+ type EgressRefusalCause,
43
+ } from "@open-everywhere/core/agent/adapter-api.js";
44
+
45
+ // THE CREDENTIAL'S IDENTITY, FOR THE AUDIT ROW (OPE-1547) — the ref NAME, never the value. This is
46
+ // the one host-side seam that attaches a credential, so before this ticket it was the one place
47
+ // where a plane both saw the call and knew whose credential rode it, and said neither on the row.
48
+ // The shared cross-plane row shape (core access/egress.ts) is what it fills now.
49
+ const SLACK_BOT_TOKEN_REF = "SLACK_BOT_TOKEN";
50
+
51
+ /** Every attachment download is a GET — Slack's `url_private` is a file read. */
52
+ const ATTACHMENT_VERB = "GET";
53
+
54
+ // Slack serves `url_private` downloads from `files.slack.com` (Enterprise Grid included — same
55
+ // host). The bot token is sent to NO other host. If Slack ever documents a second legitimate file
56
+ // host, add it here — the pin is a closed set on purpose (a `*.slack.com` wildcard would let the
57
+ // API host `slack.com` receive the token, which it must not).
58
+ const SLACK_FILE_HOSTS: ReadonlySet<string> = new Set(["files.slack.com"]);
59
+
60
+ /** Is `hostname` a Slack file host the bot token may be sent to? Exact-match, case-insensitive. */
61
+ function isSlackFileHost(hostname: string): boolean {
62
+ return SLACK_FILE_HOSTS.has(hostname.toLowerCase());
63
+ }
64
+
65
+ /** A resolved, TRUSTED attachment reference: its `urlPrivate` came from a Slack event's
66
+ * `files[].url_private`, never a model-supplied string (see the file header). */
67
+ export interface TrustedSlackAttachment {
68
+ readonly urlPrivate: string;
69
+ /** Slack file id — for the audit trail only; the fetch decision is the URL's host. */
70
+ readonly id?: string;
71
+ }
72
+
73
+ /**
74
+ * Download a Slack attachment with the bot token, host-pinned to a Slack file host and SSRF-guarded.
75
+ * Refuses (and never sends the token) if the URL is not HTTPS on a Slack file host. Returns the raw
76
+ * Response — the caller (describe_image) reads the bytes.
77
+ */
78
+ export async function fetchSlackAttachment(ctx: BindableContext, ref: TrustedSlackAttachment): Promise<Response> {
79
+ let url: URL;
80
+ try {
81
+ url = new URL(ref.urlPrivate);
82
+ } catch {
83
+ throw new Error("describe_image: the Slack attachment URL is not a valid URL.");
84
+ }
85
+ // HTTPS-only: a bearer token must never ride cleartext.
86
+ if (url.protocol !== "https:") {
87
+ throw new Error(`describe_image: refusing to send the Slack bot token over a non-HTTPS URL ("${url.protocol}").`);
88
+ }
89
+ // HOST-PIN (before any DNS): the token may ONLY go to a Slack file host. A non-Slack host is
90
+ // refused HERE — the token is never sent and the host isn't even resolved.
91
+ if (!isSlackFileHost(url.hostname)) {
92
+ await auditToolAction(ctx, "slack.attachment.deny", {
93
+ // `credential: null` is the load-bearing claim on every deny here: the host-pin is decided
94
+ // BEFORE the token is read, so a refused download never had one attached.
95
+ ...hostCallAuditFields({ host: url.hostname, verb: ATTACHMENT_VERB, outcome: "denied" }),
96
+ reason: "not-slack-file-host",
97
+ id: ref.id,
98
+ });
99
+ throw new Error(`describe_image: refusing to send the Slack bot token to non-Slack host "${url.hostname}".`);
100
+ }
101
+ // SSRF resolve-then-check-then-PIN — even Slack's own host gets the rebind check, and the
102
+ // connection is pinned to the validated public IP so it can't be re-resolved between check and
103
+ // connect. `redirect:"error"` (below) stops a 3xx bouncing the token to another host.
104
+ let safe: EgressDispatch;
105
+ try {
106
+ safe = await assertSafeFetchUrl(ref.urlPrivate);
107
+ } catch (err) {
108
+ const resolveFailed = (err as { oeEgressCause?: EgressRefusalCause })?.oeEgressCause === "resolve-failed";
109
+ await auditToolAction(ctx, "slack.attachment.deny", {
110
+ // `denied` rather than `failed` — the SSRF guard refuses on POLICY before any dispatch. A
111
+ // resolver that could not ANSWER is a different event and core tags it, so this seam reports
112
+ // it as `failed` under its own reason rather than as an SSRF refusal.
113
+ ...hostCallAuditFields({ host: url.hostname, verb: ATTACHMENT_VERB, outcome: resolveFailed ? "failed" : "denied" }),
114
+ reason: resolveFailed ? "resolve-failed" : "ssrf",
115
+ id: ref.id,
116
+ });
117
+ throw err;
118
+ }
119
+ // Defence-in-depth: assertSafeFetchUrl preserves the hostname, but re-assert it so the token can
120
+ // NEVER ride a host that isn't a Slack file host, whatever the parse produced.
121
+ if (!isSlackFileHost(safe.url.hostname)) {
122
+ await auditToolAction(ctx, "slack.attachment.deny", {
123
+ ...hostCallAuditFields({ host: safe.url.hostname, verb: ATTACHMENT_VERB, outcome: "denied" }),
124
+ reason: "not-slack-file-host",
125
+ id: ref.id,
126
+ });
127
+ throw new Error(`describe_image: refusing to send the Slack bot token to non-Slack host "${safe.url.hostname}".`);
128
+ }
129
+ const token = process.env.SLACK_BOT_TOKEN;
130
+ if (!token) {
131
+ throw new Error("describe_image: SLACK_BOT_TOKEN is not set — the bot token is required to download a Slack attachment.");
132
+ }
133
+ // ONE row per call, carrying the OUTCOME — so it is written after the dispatch settles, not
134
+ // before it starts (the same trade core's `oeFetch` states: the refusal paths above still record
135
+ // before anything leaves, and what is lost is a process death mid-flight).
136
+ //
137
+ // šŸ”“ `credential` NAMES THE REF, NEVER THE TOKEN. `token` is read one line above and is not
138
+ // referenced here; the row carries the ref name only, which is the identity an operator looks up.
139
+ // `route` is the dispatch route — it was called `via` until OPE-1547, the same field name the
140
+ // SANDBOX plane used for the stamping connection.
141
+ const row = (outcome: "allowed" | "failed", extra: Record<string, unknown> = {}): Record<string, unknown> => ({
142
+ ...hostCallAuditFields({
143
+ host: safe.url.hostname,
144
+ verb: ATTACHMENT_VERB,
145
+ outcome,
146
+ credential: SLACK_BOT_TOKEN_REF,
147
+ }),
148
+ id: ref.id,
149
+ route: safe.via,
150
+ antiRebind: safe.antiRebind,
151
+ ...extra,
152
+ });
153
+ let response: Response;
154
+ try {
155
+ // Bot token ONLY to the pinned Slack file host; NO redirect follow (a 3xx must not bounce the
156
+ // token elsewhere); connection pinned to the validated IP.
157
+ response = await fetch(safe.url, {
158
+ dispatcher: safe.dispatcher,
159
+ redirect: "error",
160
+ headers: { authorization: `Bearer ${token}` },
161
+ } as unknown as RequestInit);
162
+ } catch (err) {
163
+ await auditToolAction(ctx, "slack.attachment.allow", row("failed"));
164
+ throw err;
165
+ }
166
+ await auditToolAction(ctx, "slack.attachment.allow", row("allowed", { status: response.status }));
167
+ return response;
168
+ }
@@ -0,0 +1,149 @@
1
+ // THE Slack app manifest — one definition, three readers (OPE-1603).
2
+ //
3
+ // This file is the only place the manifest exists. The install wizard's Slack step
4
+ // (packages/create/src/steps/slack.ts) prints it, the ops MCP tool `surface_manifest` serves it
5
+ // with this deployment's host substituted, and `scripts/slack-scope-audit-test.ts` parses the bot
6
+ // scope array below against the runbook's documented scopes. It used to live in the wizard, where
7
+ // the ops server could not reach it at all.
8
+ //
9
+ // šŸ”“ THIS MODULE IMPORTS NOTHING, DELIBERATELY. The install wizard depends on the bundle for this
10
+ // document alone, so a leaf module costs it no transitive weight — not the adapter-api barrel, not
11
+ // eve, not the Slack Web API client. `agent/ops.ts` does the typed registration; this file holds
12
+ // only the vendor's own knowledge.
13
+
14
+ /** The token the request URLs carry where the deployment's own host belongs. The ops plane
15
+ * substitutes it (packages/core/agent/ops/surface-manifest.ts); the wizard leaves it for the
16
+ * operator, who has usually not deployed yet when they run it. */
17
+ export const SLACK_DEPLOY_HOST_PLACEHOLDER = "YOUR-DEPLOY-URL";
18
+
19
+ /** A ready-to-paste Slack app manifest (Slack's "create from manifest" flow) with the minimal
20
+ * scope/event set docs/deploy/surfaces/slack.md walks through by hand. */
21
+ export function slackAppManifestTemplate(): string {
22
+ return JSON.stringify(
23
+ {
24
+ display_information: { name: "Open Everywhere" },
25
+ features: {
26
+ bot_user: { display_name: "Open Everywhere", always_online: true },
27
+ // The "/oe" ZERO-INFERENCE control command (agent/commands/core.ts). Declared here rather
28
+ // than left to a manual setup step because one of its subcommands is `/oe stop` (OPE-418),
29
+ // and stop is not a convenience: it is the affordance a person reaches for when the agent
30
+ // is doing the wrong thing. An install where stop has to be wired by hand is an install
31
+ // where stop is missing. NOTE the request URL is the SLASH-COMMAND endpoint, which Slack
32
+ // configures SEPARATELY from the Events request URL above.
33
+ slash_commands: [
34
+ {
35
+ command: "/oe",
36
+ url: `https://${SLACK_DEPLOY_HOST_PLACEHOLDER}/eve/v1/slack/commands`,
37
+ description: "Open Everywhere control commands — status, budget, stop.",
38
+ usage_hint: "stop | status | budget",
39
+ should_escape: false,
40
+ },
41
+ ],
42
+ // SHORTCUTS AS A WAKE (OPE-1376). Both kinds are declared, because they answer two
43
+ // different needs and neither substitutes for the other: the MESSAGE shortcut hands the
44
+ // agent one message somebody is looking at, and the GLOBAL shortcut starts a conversation
45
+ // from the composer with no room in scope (it wakes the invoker's own DM window). Both
46
+ // arrive on the interactivity Request URL declared under `settings` below, which is why
47
+ // that block is no longer optional in this manifest.
48
+ //
49
+ // The `callback_id`s are free-form: the front route owns EVERY shortcut payload the app
50
+ // receives, so renaming one here changes only the trigger name the model is told about.
51
+ shortcuts: [
52
+ {
53
+ name: "Send to Open Everywhere",
54
+ type: "message",
55
+ callback_id: "oe_message_shortcut",
56
+ description: "Wake the agent on this message.",
57
+ },
58
+ {
59
+ name: "Ask Open Everywhere",
60
+ type: "global",
61
+ callback_id: "oe_global_shortcut",
62
+ description: "Wake the agent in a DM.",
63
+ },
64
+ ],
65
+ },
66
+ oauth_config: {
67
+ scopes: {
68
+ bot: [
69
+ "app_mentions:read",
70
+ "chat:write",
71
+ "channels:history",
72
+ // Slack's own description: "Add shortcuts and slash commands that people can use". It
73
+ // grants no read access — it is what lets this manifest DECLARE the `/oe` command above
74
+ // and the two shortcuts beside it. Both entry points are wakes an install needs.
75
+ "commands",
76
+ // conversations.info/conversations.members (channel trust gate, join intros, the
77
+ // governance roster) — public and private channel halves. Without these, EVERY
78
+ // channel binds `external` (fail-closed) on a fresh install, silently (OPE-175).
79
+ "channels:read",
80
+ "groups:read",
81
+ "im:history",
82
+ // conversations.info/conversations.members on a `D…` DM — the `im` half of the SAME two
83
+ // calls channels:read/groups:read cover for channels. The governance roster
84
+ // (slackGovernanceRoster) is keyed on whatever room a click or a card lands in, and DMs
85
+ // are rooms: on a member-tier approve-click in a DM the roster resolves the `D…` id, so
86
+ // without this both calls return `missing_scope`, the roster comes back unresolved, and
87
+ // the clicker floor's beneficiary leg refuses the click citing the roster (OPE-332,
88
+ // live-proven 2026-08-09). channels:read/groups:read do NOT cover an `im`.
89
+ "im:read",
90
+ // conversations.open — the governance DM-delivery arm (OPE-44): org-scope admin output
91
+ // asked in an ordinary room is delivered to the requester's DM, never rendered there.
92
+ "im:write",
93
+ "groups:history",
94
+ // The group-DM (`mpim`) half of `im:read` — same two calls, same call sites. Code-derived
95
+ // rather than live-proven: the roster/disclosure paths are keyed on the room, and a
96
+ // member-tier click or a card can land in a group DM exactly as it can in a 1:1.
97
+ "mpim:read",
98
+ "reactions:write",
99
+ "reactions:read",
100
+ "pins:read",
101
+ "pins:write",
102
+ // users.info — the DM-partner trust check. Without this, EVERY DM binds `external`
103
+ // (fail-closed) on a fresh install, silently (OPE-175).
104
+ "users:read",
105
+ ],
106
+ },
107
+ },
108
+ settings: {
109
+ event_subscriptions: {
110
+ request_url: `https://${SLACK_DEPLOY_HOST_PLACEHOLDER}/eve/v1/slack`,
111
+ bot_events: ["app_mention", "message.im", "reaction_added", "reaction_removed"],
112
+ },
113
+ // The INTERACTIVITY Request URL — the SAME public route Event Subscriptions uses. Every
114
+ // button click and every shortcut lands here, and the front route classifies which handler
115
+ // owns it. Required by the `shortcuts` above; without it Slack refuses to deliver a
116
+ // shortcut at all, and the approval / connector / "Set API key" cards' buttons fail with
117
+ // "the app is not configured to handle interactive responses".
118
+ interactivity: {
119
+ is_enabled: true,
120
+ request_url: `https://${SLACK_DEPLOY_HOST_PLACEHOLDER}/eve/v1/slack`,
121
+ },
122
+ org_deploy_enabled: false,
123
+ socket_mode_enabled: false,
124
+ token_rotation_enabled: false,
125
+ },
126
+ },
127
+ null,
128
+ 2,
129
+ );
130
+ }
131
+
132
+ /** Where the operator pastes the manifest. */
133
+ export const SLACK_APP_CONSOLE_URL = "https://api.slack.com/apps";
134
+
135
+ /** The ordered clicks. Slack reserves every one of them for a workspace admin. */
136
+ export const SLACK_APP_MANIFEST_STEPS: readonly string[] = [
137
+ "Open https://api.slack.com/apps and sign in to the workspace that will host the agent.",
138
+ "Create New App → From an app manifest.",
139
+ "Pick the workspace, choose JSON, and paste the manifest below.",
140
+ "Next → Create.",
141
+ "Install to Workspace, and approve the scopes Slack lists.",
142
+ ];
143
+
144
+ /** What the operator brings back. Both are environment variables, not credential-store secrets:
145
+ * the bundle reads them from the environment (agent/ops.ts). */
146
+ export const SLACK_APP_MANIFEST_COLLECT: readonly string[] = [
147
+ "OAuth & Permissions → Bot User OAuth Token (xoxb-…) = SLACK_BOT_TOKEN",
148
+ "Basic Information → App Credentials → Signing Secret = SLACK_SIGNING_SECRET",
149
+ ];