@imbue-ai/detent 1.0.1 → 1.0.2

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 (44) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +13 -7
  3. package/dist/src/patterns/builtin/aws.json +326 -0
  4. package/dist/src/patterns/builtin/builtin/coolify.json +57 -15
  5. package/dist/src/patterns/builtin/calendly.json +274 -0
  6. package/dist/src/patterns/builtin/coolify.json +280 -0
  7. package/dist/src/patterns/builtin/discord.json +157 -0
  8. package/dist/src/patterns/builtin/dropbox.json +115 -0
  9. package/dist/src/patterns/builtin/figma.json +228 -0
  10. package/dist/src/patterns/builtin/github.json +248 -0
  11. package/dist/src/patterns/builtin/gitlab.json +262 -0
  12. package/dist/src/patterns/builtin/google-analytics.json +155 -0
  13. package/dist/src/patterns/builtin/google-calendar.json +227 -0
  14. package/dist/src/patterns/builtin/google-directions.json +67 -0
  15. package/dist/src/patterns/builtin/google-docs.json +102 -0
  16. package/dist/src/patterns/builtin/google-drive.json +162 -0
  17. package/dist/src/patterns/builtin/google-gmail.json +257 -0
  18. package/dist/src/patterns/builtin/google-people.json +142 -0
  19. package/dist/src/patterns/builtin/google-sheets.json +115 -0
  20. package/dist/src/patterns/builtin/linear.json +12 -0
  21. package/dist/src/patterns/builtin/mailchimp.json +263 -0
  22. package/dist/src/patterns/builtin/notion.json +230 -0
  23. package/dist/src/patterns/builtin/sentry.json +172 -0
  24. package/dist/src/patterns/builtin/slack.json +221 -0
  25. package/dist/src/patterns/builtin/stripe.json +347 -0
  26. package/dist/src/patterns/builtin/telegram.json +89 -0
  27. package/dist/src/patterns/builtin/umami.json +172 -0
  28. package/dist/src/patterns/builtin/yelp.json +147 -0
  29. package/dist/src/patterns/builtin/zoom.json +192 -0
  30. package/package.json +3 -1
  31. package/dist/src/builtinPatterns/any.json +0 -3
  32. package/dist/src/builtinPatterns/builtinPatterns/any.json +0 -3
  33. package/dist/src/builtinPatterns.d.ts +0 -5
  34. package/dist/src/builtinPatterns.d.ts.map +0 -1
  35. package/dist/src/builtinPatterns.js +0 -50
  36. package/dist/src/builtinPatterns.js.map +0 -1
  37. package/dist/src/detentConfig.d.ts +0 -15
  38. package/dist/src/detentConfig.d.ts.map +0 -1
  39. package/dist/src/detentConfig.js +0 -169
  40. package/dist/src/detentConfig.js.map +0 -1
  41. package/dist/src/requestPattern.d.ts +0 -15
  42. package/dist/src/requestPattern.d.ts.map +0 -1
  43. package/dist/src/requestPattern.js +0 -35
  44. package/dist/src/requestPattern.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2026 Imbue, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Detent
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@imbue-ai/detent?style=flat-square)](https://npmjs.com/package/@imbue-ai/detent)
4
+ [![CI](https://img.shields.io/github/actions/workflow/status/imbue-ai/detent/ci.yml?style=flat-square)](https://github.com/imbue-ai/detent/actions)
5
+ [![license](https://img.shields.io/npm/l/@imbue-ai/detent?style=flat-square)](LICENSE)
6
+ [![downloads](https://img.shields.io/npm/dm/@imbue-ai/detent?style=flat-square)](https://npmjs.com/package/@imbue-ai/detent)
7
+
3
8
  Fine-grained HTTP permissions for AI agents.
4
9
 
5
10
  ## Quick example
@@ -21,7 +26,7 @@ detent curl -s https://api.github.com/repos/octocat/Hello-World/issues/1
21
26
  ## Installation
22
27
 
23
28
  ```bash
24
- npm install -g detent
29
+ npm install -g @imbue-ai/detent
25
30
  ```
26
31
 
27
32
  (This is not needed if you only intend to use Detent as a JavaScript library.)
@@ -49,9 +54,8 @@ whatever tool the agent uses to access third-party services.
49
54
  ### Latchkey
50
55
 
51
56
  [Latchkey](https://github.com/imbue-ai/latchkey) lets users
52
- point to Detent configs in order to keep control over what
53
- agents can and can't access. (This is currently a work in
54
- progress.)
57
+ point to a Detent config in order to control what agents can and
58
+ can't access.
55
59
 
56
60
  ## Details and architecture
57
61
 
@@ -94,7 +98,7 @@ environment variable to specify a different path.
94
98
  An HTTP(s) request can be represented as an object that has
95
99
  several well-defined properties: `protocol`, `domain`, `port`,
96
100
  `path`, `method`, `headers`, `queryParams` and `body`. Using this
97
- representation, the `detent` tool uses [JSON schemas](https://json-schema.org/) to:
101
+ representation, the `detent` tool uses [JSON schema](https://json-schema.org/) to:
98
102
 
99
103
  1. Match requests to permission checks.
100
104
  2. Define the "acceptable" shape of a request that is subject to a permission check.
@@ -147,6 +151,8 @@ like this:
147
151
  }
148
152
  ```
149
153
 
154
+ For a complete example config that defines custom patterns, see
155
+ [docs/example-cloudflare.json](docs/example-cloudflare.json).
150
156
 
151
157
  ### Permission rules
152
158
 
@@ -193,10 +199,10 @@ are automatically available and recognized in rule bodies:
193
199
  - `aws-s3-read` (to allow read operations on AWS S3)
194
200
  - `stripe-read-all` (to allow all read operations in Stripe API)
195
201
  - `google-drive-write-comments` (to allow adding comments to Google Drive items)
196
- - (... and many others)
202
+ - ... and many others, see [docs/builtin-patterns.md](docs/builtin-patterns.md) for the full list
197
203
 
198
204
  Run `detent dump` to see your current config together with all the
199
- existing built-in patterns. If you only want to list the pattern
205
+ available built-in patterns. If you only want to list the pattern
200
206
  names, run `detent dump | jq '.patterns | keys'`.
201
207
 
202
208
  If you don't want to use the built-in patterns, set the
@@ -0,0 +1,326 @@
1
+ {
2
+ "aws": {
3
+ "properties": {
4
+ "domain": {
5
+ "type": "string",
6
+ "pattern": "^([a-z0-9.-]+\\.)?amazonaws\\.com$"
7
+ }
8
+ },
9
+ "required": [
10
+ "domain"
11
+ ]
12
+ },
13
+ "aws-s3": {
14
+ "properties": {
15
+ "domain": {
16
+ "type": "string",
17
+ "pattern": "^(.*\\.)?s3(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
18
+ }
19
+ },
20
+ "required": [
21
+ "domain"
22
+ ]
23
+ },
24
+ "aws-s3-read": {
25
+ "properties": {
26
+ "domain": {
27
+ "type": "string",
28
+ "pattern": "^(.*\\.)?s3(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
29
+ },
30
+ "method": {
31
+ "enum": [
32
+ "GET",
33
+ "HEAD"
34
+ ]
35
+ }
36
+ },
37
+ "required": [
38
+ "domain",
39
+ "method"
40
+ ]
41
+ },
42
+ "aws-s3-write": {
43
+ "properties": {
44
+ "domain": {
45
+ "type": "string",
46
+ "pattern": "^(.*\\.)?s3(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
47
+ },
48
+ "method": {
49
+ "enum": [
50
+ "POST",
51
+ "PUT",
52
+ "PATCH",
53
+ "DELETE"
54
+ ]
55
+ }
56
+ },
57
+ "required": [
58
+ "domain",
59
+ "method"
60
+ ]
61
+ },
62
+ "aws-ec2": {
63
+ "properties": {
64
+ "domain": {
65
+ "type": "string",
66
+ "pattern": "^ec2(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
67
+ }
68
+ },
69
+ "required": [
70
+ "domain"
71
+ ]
72
+ },
73
+ "aws-iam": {
74
+ "properties": {
75
+ "domain": {
76
+ "type": "string",
77
+ "pattern": "^iam(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
78
+ }
79
+ },
80
+ "required": [
81
+ "domain"
82
+ ]
83
+ },
84
+ "aws-sts": {
85
+ "properties": {
86
+ "domain": {
87
+ "type": "string",
88
+ "pattern": "^sts(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
89
+ }
90
+ },
91
+ "required": [
92
+ "domain"
93
+ ]
94
+ },
95
+ "aws-lambda": {
96
+ "properties": {
97
+ "domain": {
98
+ "type": "string",
99
+ "pattern": "^lambda(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
100
+ }
101
+ },
102
+ "required": [
103
+ "domain"
104
+ ]
105
+ },
106
+ "aws-dynamodb": {
107
+ "properties": {
108
+ "domain": {
109
+ "type": "string",
110
+ "pattern": "^dynamodb(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
111
+ }
112
+ },
113
+ "required": [
114
+ "domain"
115
+ ]
116
+ },
117
+ "aws-cloudformation": {
118
+ "properties": {
119
+ "domain": {
120
+ "type": "string",
121
+ "pattern": "^cloudformation(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
122
+ }
123
+ },
124
+ "required": [
125
+ "domain"
126
+ ]
127
+ },
128
+ "aws-logs": {
129
+ "properties": {
130
+ "domain": {
131
+ "type": "string",
132
+ "pattern": "^logs(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
133
+ }
134
+ },
135
+ "required": [
136
+ "domain"
137
+ ]
138
+ },
139
+ "aws-cloudwatch": {
140
+ "properties": {
141
+ "domain": {
142
+ "type": "string",
143
+ "pattern": "^monitoring(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
144
+ }
145
+ },
146
+ "required": [
147
+ "domain"
148
+ ]
149
+ },
150
+ "aws-sns": {
151
+ "properties": {
152
+ "domain": {
153
+ "type": "string",
154
+ "pattern": "^sns(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
155
+ }
156
+ },
157
+ "required": [
158
+ "domain"
159
+ ]
160
+ },
161
+ "aws-sqs": {
162
+ "properties": {
163
+ "domain": {
164
+ "type": "string",
165
+ "pattern": "^sqs(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
166
+ }
167
+ },
168
+ "required": [
169
+ "domain"
170
+ ]
171
+ },
172
+ "aws-ssm": {
173
+ "properties": {
174
+ "domain": {
175
+ "type": "string",
176
+ "pattern": "^ssm(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
177
+ }
178
+ },
179
+ "required": [
180
+ "domain"
181
+ ]
182
+ },
183
+ "aws-secretsmanager": {
184
+ "properties": {
185
+ "domain": {
186
+ "type": "string",
187
+ "pattern": "^secretsmanager(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
188
+ }
189
+ },
190
+ "required": [
191
+ "domain"
192
+ ]
193
+ },
194
+ "aws-route53": {
195
+ "properties": {
196
+ "domain": {
197
+ "type": "string",
198
+ "pattern": "^route53(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
199
+ }
200
+ },
201
+ "required": [
202
+ "domain"
203
+ ]
204
+ },
205
+ "aws-ecs": {
206
+ "properties": {
207
+ "domain": {
208
+ "type": "string",
209
+ "pattern": "^ecs(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
210
+ }
211
+ },
212
+ "required": [
213
+ "domain"
214
+ ]
215
+ },
216
+ "aws-ecr": {
217
+ "properties": {
218
+ "domain": {
219
+ "type": "string",
220
+ "pattern": "^((api|dkr)\\.)?ecr(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
221
+ }
222
+ },
223
+ "required": [
224
+ "domain"
225
+ ]
226
+ },
227
+ "aws-eks": {
228
+ "properties": {
229
+ "domain": {
230
+ "type": "string",
231
+ "pattern": "^eks(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
232
+ }
233
+ },
234
+ "required": [
235
+ "domain"
236
+ ]
237
+ },
238
+ "aws-bedrock": {
239
+ "properties": {
240
+ "domain": {
241
+ "type": "string",
242
+ "pattern": "^bedrock(-[a-z]+)*(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
243
+ }
244
+ },
245
+ "required": [
246
+ "domain"
247
+ ]
248
+ },
249
+ "aws-cloudfront": {
250
+ "properties": {
251
+ "domain": {
252
+ "type": "string",
253
+ "pattern": "^cloudfront(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
254
+ }
255
+ },
256
+ "required": [
257
+ "domain"
258
+ ]
259
+ },
260
+ "aws-rds": {
261
+ "properties": {
262
+ "domain": {
263
+ "type": "string",
264
+ "pattern": "^rds(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
265
+ }
266
+ },
267
+ "required": [
268
+ "domain"
269
+ ]
270
+ },
271
+ "aws-kms": {
272
+ "properties": {
273
+ "domain": {
274
+ "type": "string",
275
+ "pattern": "^kms(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
276
+ }
277
+ },
278
+ "required": [
279
+ "domain"
280
+ ]
281
+ },
282
+ "aws-elb": {
283
+ "properties": {
284
+ "domain": {
285
+ "type": "string",
286
+ "pattern": "^elasticloadbalancing(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
287
+ }
288
+ },
289
+ "required": [
290
+ "domain"
291
+ ]
292
+ },
293
+ "aws-cloudtrail": {
294
+ "properties": {
295
+ "domain": {
296
+ "type": "string",
297
+ "pattern": "^cloudtrail(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
298
+ }
299
+ },
300
+ "required": [
301
+ "domain"
302
+ ]
303
+ },
304
+ "aws-eventbridge": {
305
+ "properties": {
306
+ "domain": {
307
+ "type": "string",
308
+ "pattern": "^events(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
309
+ }
310
+ },
311
+ "required": [
312
+ "domain"
313
+ ]
314
+ },
315
+ "aws-kinesis": {
316
+ "properties": {
317
+ "domain": {
318
+ "type": "string",
319
+ "pattern": "^kinesis(-[a-z]+)?(\\.[a-z0-9.-]+)?\\.amazonaws\\.com$"
320
+ }
321
+ },
322
+ "required": [
323
+ "domain"
324
+ ]
325
+ }
326
+ }
@@ -11,27 +11,69 @@
11
11
  },
12
12
  "coolify-read-all": {
13
13
  "properties": {
14
- "method": {
15
- "const": "GET"
16
- }
14
+ "method": { "const": "GET" }
17
15
  },
18
- "required": [
19
- "method"
16
+ "required": ["method"],
17
+ "allOf": [
18
+ {
19
+ "not": {
20
+ "properties": {
21
+ "path": {
22
+ "type": "string",
23
+ "pattern": "^/api/v[0-9]+/.+/(start|stop|restart|cancel|validate)$"
24
+ }
25
+ },
26
+ "required": ["path"]
27
+ }
28
+ },
29
+ {
30
+ "not": {
31
+ "properties": {
32
+ "path": {
33
+ "type": "string",
34
+ "pattern": "^/api/v[0-9]+/(deploy|enable|disable)(/.*)?$"
35
+ }
36
+ },
37
+ "required": ["path"]
38
+ }
39
+ }
20
40
  ]
21
41
  },
22
42
  "coolify-write-all": {
23
- "properties": {
24
- "method": {
25
- "enum": [
26
- "POST",
27
- "PUT",
28
- "PATCH",
29
- "DELETE"
43
+ "anyOf": [
44
+ {
45
+ "properties": {
46
+ "method": {
47
+ "enum": ["POST", "PUT", "PATCH", "DELETE"]
48
+ }
49
+ },
50
+ "required": ["method"]
51
+ },
52
+ {
53
+ "properties": {
54
+ "method": { "const": "GET" },
55
+ "path": {
56
+ "type": "string"
57
+ }
58
+ },
59
+ "required": ["method", "path"],
60
+ "anyOf": [
61
+ {
62
+ "properties": {
63
+ "path": {
64
+ "pattern": "^/api/v[0-9]+/.+/(start|stop|restart|cancel|validate)$"
65
+ }
66
+ }
67
+ },
68
+ {
69
+ "properties": {
70
+ "path": {
71
+ "pattern": "^/api/v[0-9]+/(deploy|enable|disable)(/.*)?$"
72
+ }
73
+ }
74
+ }
30
75
  ]
31
76
  }
32
- },
33
- "required": [
34
- "method"
35
77
  ]
36
78
  },
37
79
  "coolify-read-applications": {