@antasphere/chassis-contract 1.5.1 → 1.6.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.
@@ -0,0 +1,416 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Connections (PRDCT-3773): every inbound webhook source a tool receives from
4
+ * and every outbound key it holds, declared by the tool (the `connections`
5
+ * slot: a key, a name, a kind, a verifier, the fields the source carries, a
6
+ * handler), stored by the chassis (one row per workspace and source: the
7
+ * sealed secret or key, the receiving token's hash, who connected it and
8
+ * when, the declared fields, the last delivery), served on ONE page
9
+ * (Settings › Connections, one card per source), one CLI group and one set
10
+ * of MCP tools. The door, `POST /hooks/{source}/{token}`, lives outside
11
+ * `/api/v1`: the signature is the credential.
12
+ *
13
+ * No answer ever carries a secret, a key or the receiving URL's token: the
14
+ * URL is answered once, when it is made or rotated, and the secret never.
15
+ */
16
+ /** A source key: lowercase, digits and underscores, starting with a letter (`meet`, `lemlist`). */
17
+ export declare const connectionSourceKeySchema: z.ZodString;
18
+ /** `inbound`: a source that posts to this instance; `key`: a key this instance holds; `both`. */
19
+ export declare const connectionKindSchema: z.ZodEnum<{
20
+ key: "key";
21
+ inbound: "inbound";
22
+ both: "both";
23
+ }>;
24
+ export type ConnectionKind = z.infer<typeof connectionKindSchema>;
25
+ /** The path of the door, outside `/api/v1`: `<PUBLIC_BASE_URL>/hooks/<source>/<token>`. */
26
+ export declare const CONNECTION_HOOK_PATH = "/hooks";
27
+ /** One declared field of a source, as the page and the CLI show it. */
28
+ export declare const connectionFieldDeclarationSchema: z.ZodObject<{
29
+ key: z.ZodString;
30
+ label: z.ZodString;
31
+ description: z.ZodNullable<z.ZodString>;
32
+ required: z.ZodBoolean;
33
+ multiple: z.ZodBoolean;
34
+ }, z.core.$strip>;
35
+ export type ConnectionFieldDeclaration = z.infer<typeof connectionFieldDeclarationSchema>;
36
+ /** What the tool declared about a source: the static half of a card. */
37
+ export declare const connectionDeclaredSchema: z.ZodObject<{
38
+ description: z.ZodNullable<z.ZodString>;
39
+ verifier: z.ZodNullable<z.ZodString>;
40
+ events: z.ZodArray<z.ZodString>;
41
+ secretHint: z.ZodNullable<z.ZodString>;
42
+ fields: z.ZodArray<z.ZodObject<{
43
+ key: z.ZodString;
44
+ label: z.ZodString;
45
+ description: z.ZodNullable<z.ZodString>;
46
+ required: z.ZodBoolean;
47
+ multiple: z.ZodBoolean;
48
+ }, z.core.$strip>>;
49
+ sibling: z.ZodNullable<z.ZodObject<{
50
+ toolSlug: z.ZodString;
51
+ events: z.ZodArray<z.ZodString>;
52
+ }, z.core.$strip>>;
53
+ }, z.core.$strip>;
54
+ export type ConnectionDeclared = z.infer<typeof connectionDeclaredSchema>;
55
+ /** A field's stored value: a string, a list of strings, or null (unset). */
56
+ export declare const connectionFieldValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>;
57
+ export type ConnectionFieldValue = z.infer<typeof connectionFieldValueSchema>;
58
+ /** The stored fields of a connection, by declared key. */
59
+ export declare const connectionFieldsSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
60
+ export type ConnectionFields = z.infer<typeof connectionFieldsSchema>;
61
+ /** The outcome of one delivery the door took. */
62
+ export declare const connectionDeliveryOutcomeSchema: z.ZodEnum<{
63
+ failed: "failed";
64
+ processed: "processed";
65
+ ignored: "ignored";
66
+ }>;
67
+ export type ConnectionDeliveryOutcome = z.infer<typeof connectionDeliveryOutcomeSchema>;
68
+ /**
69
+ * One source as the page, the CLI and an agent read it: the declaration,
70
+ * whether it is connected, who made the receiving URL and when (never the
71
+ * URL), whether the secret is set and readable, by whom and when (never the
72
+ * secret), the stored fields, the last delivery and the last test.
73
+ */
74
+ export declare const connectionSchema: z.ZodObject<{
75
+ source: z.ZodString;
76
+ name: z.ZodString;
77
+ kind: z.ZodEnum<{
78
+ key: "key";
79
+ inbound: "inbound";
80
+ both: "both";
81
+ }>;
82
+ declared: z.ZodObject<{
83
+ description: z.ZodNullable<z.ZodString>;
84
+ verifier: z.ZodNullable<z.ZodString>;
85
+ events: z.ZodArray<z.ZodString>;
86
+ secretHint: z.ZodNullable<z.ZodString>;
87
+ fields: z.ZodArray<z.ZodObject<{
88
+ key: z.ZodString;
89
+ label: z.ZodString;
90
+ description: z.ZodNullable<z.ZodString>;
91
+ required: z.ZodBoolean;
92
+ multiple: z.ZodBoolean;
93
+ }, z.core.$strip>>;
94
+ sibling: z.ZodNullable<z.ZodObject<{
95
+ toolSlug: z.ZodString;
96
+ events: z.ZodArray<z.ZodString>;
97
+ }, z.core.$strip>>;
98
+ }, z.core.$strip>;
99
+ connected: z.ZodBoolean;
100
+ receiving: z.ZodNullable<z.ZodObject<{
101
+ madeAt: z.ZodString;
102
+ madeBy: z.ZodNullable<z.ZodObject<{
103
+ id: z.ZodString;
104
+ name: z.ZodString;
105
+ email: z.ZodString;
106
+ }, z.core.$strip>>;
107
+ }, z.core.$strip>>;
108
+ secretState: z.ZodObject<{
109
+ set: z.ZodBoolean;
110
+ readable: z.ZodBoolean;
111
+ setAt: z.ZodNullable<z.ZodString>;
112
+ setBy: z.ZodNullable<z.ZodObject<{
113
+ id: z.ZodString;
114
+ name: z.ZodString;
115
+ email: z.ZodString;
116
+ }, z.core.$strip>>;
117
+ }, z.core.$strip>;
118
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
119
+ connectedAt: z.ZodNullable<z.ZodString>;
120
+ connectedBy: z.ZodNullable<z.ZodObject<{
121
+ id: z.ZodString;
122
+ name: z.ZodString;
123
+ email: z.ZodString;
124
+ }, z.core.$strip>>;
125
+ lastDelivery: z.ZodNullable<z.ZodObject<{
126
+ at: z.ZodString;
127
+ type: z.ZodString;
128
+ outcome: z.ZodEnum<{
129
+ failed: "failed";
130
+ processed: "processed";
131
+ ignored: "ignored";
132
+ }>;
133
+ }, z.core.$strip>>;
134
+ check: z.ZodNullable<z.ZodObject<{
135
+ at: z.ZodString;
136
+ ok: z.ZodBoolean;
137
+ detail: z.ZodString;
138
+ }, z.core.$strip>>;
139
+ sibling: z.ZodNullable<z.ZodObject<{
140
+ endpointId: z.ZodNullable<z.ZodString>;
141
+ }, z.core.$strip>>;
142
+ }, z.core.$strip>;
143
+ export type Connection = z.infer<typeof connectionSchema>;
144
+ export declare const connectionsListSchema: z.ZodObject<{
145
+ connections: z.ZodArray<z.ZodObject<{
146
+ source: z.ZodString;
147
+ name: z.ZodString;
148
+ kind: z.ZodEnum<{
149
+ key: "key";
150
+ inbound: "inbound";
151
+ both: "both";
152
+ }>;
153
+ declared: z.ZodObject<{
154
+ description: z.ZodNullable<z.ZodString>;
155
+ verifier: z.ZodNullable<z.ZodString>;
156
+ events: z.ZodArray<z.ZodString>;
157
+ secretHint: z.ZodNullable<z.ZodString>;
158
+ fields: z.ZodArray<z.ZodObject<{
159
+ key: z.ZodString;
160
+ label: z.ZodString;
161
+ description: z.ZodNullable<z.ZodString>;
162
+ required: z.ZodBoolean;
163
+ multiple: z.ZodBoolean;
164
+ }, z.core.$strip>>;
165
+ sibling: z.ZodNullable<z.ZodObject<{
166
+ toolSlug: z.ZodString;
167
+ events: z.ZodArray<z.ZodString>;
168
+ }, z.core.$strip>>;
169
+ }, z.core.$strip>;
170
+ connected: z.ZodBoolean;
171
+ receiving: z.ZodNullable<z.ZodObject<{
172
+ madeAt: z.ZodString;
173
+ madeBy: z.ZodNullable<z.ZodObject<{
174
+ id: z.ZodString;
175
+ name: z.ZodString;
176
+ email: z.ZodString;
177
+ }, z.core.$strip>>;
178
+ }, z.core.$strip>>;
179
+ secretState: z.ZodObject<{
180
+ set: z.ZodBoolean;
181
+ readable: z.ZodBoolean;
182
+ setAt: z.ZodNullable<z.ZodString>;
183
+ setBy: z.ZodNullable<z.ZodObject<{
184
+ id: z.ZodString;
185
+ name: z.ZodString;
186
+ email: z.ZodString;
187
+ }, z.core.$strip>>;
188
+ }, z.core.$strip>;
189
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
190
+ connectedAt: z.ZodNullable<z.ZodString>;
191
+ connectedBy: z.ZodNullable<z.ZodObject<{
192
+ id: z.ZodString;
193
+ name: z.ZodString;
194
+ email: z.ZodString;
195
+ }, z.core.$strip>>;
196
+ lastDelivery: z.ZodNullable<z.ZodObject<{
197
+ at: z.ZodString;
198
+ type: z.ZodString;
199
+ outcome: z.ZodEnum<{
200
+ failed: "failed";
201
+ processed: "processed";
202
+ ignored: "ignored";
203
+ }>;
204
+ }, z.core.$strip>>;
205
+ check: z.ZodNullable<z.ZodObject<{
206
+ at: z.ZodString;
207
+ ok: z.ZodBoolean;
208
+ detail: z.ZodString;
209
+ }, z.core.$strip>>;
210
+ sibling: z.ZodNullable<z.ZodObject<{
211
+ endpointId: z.ZodNullable<z.ZodString>;
212
+ }, z.core.$strip>>;
213
+ }, z.core.$strip>>;
214
+ }, z.core.$strip>;
215
+ export type ConnectionsList = z.infer<typeof connectionsListSchema>;
216
+ /** `POST /connections/{source}`: the connection and the receiving URL, shown this once. */
217
+ export declare const connectionUrlMadeSchema: z.ZodObject<{
218
+ connection: z.ZodObject<{
219
+ source: z.ZodString;
220
+ name: z.ZodString;
221
+ kind: z.ZodEnum<{
222
+ key: "key";
223
+ inbound: "inbound";
224
+ both: "both";
225
+ }>;
226
+ declared: z.ZodObject<{
227
+ description: z.ZodNullable<z.ZodString>;
228
+ verifier: z.ZodNullable<z.ZodString>;
229
+ events: z.ZodArray<z.ZodString>;
230
+ secretHint: z.ZodNullable<z.ZodString>;
231
+ fields: z.ZodArray<z.ZodObject<{
232
+ key: z.ZodString;
233
+ label: z.ZodString;
234
+ description: z.ZodNullable<z.ZodString>;
235
+ required: z.ZodBoolean;
236
+ multiple: z.ZodBoolean;
237
+ }, z.core.$strip>>;
238
+ sibling: z.ZodNullable<z.ZodObject<{
239
+ toolSlug: z.ZodString;
240
+ events: z.ZodArray<z.ZodString>;
241
+ }, z.core.$strip>>;
242
+ }, z.core.$strip>;
243
+ connected: z.ZodBoolean;
244
+ receiving: z.ZodNullable<z.ZodObject<{
245
+ madeAt: z.ZodString;
246
+ madeBy: z.ZodNullable<z.ZodObject<{
247
+ id: z.ZodString;
248
+ name: z.ZodString;
249
+ email: z.ZodString;
250
+ }, z.core.$strip>>;
251
+ }, z.core.$strip>>;
252
+ secretState: z.ZodObject<{
253
+ set: z.ZodBoolean;
254
+ readable: z.ZodBoolean;
255
+ setAt: z.ZodNullable<z.ZodString>;
256
+ setBy: z.ZodNullable<z.ZodObject<{
257
+ id: z.ZodString;
258
+ name: z.ZodString;
259
+ email: z.ZodString;
260
+ }, z.core.$strip>>;
261
+ }, z.core.$strip>;
262
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
263
+ connectedAt: z.ZodNullable<z.ZodString>;
264
+ connectedBy: z.ZodNullable<z.ZodObject<{
265
+ id: z.ZodString;
266
+ name: z.ZodString;
267
+ email: z.ZodString;
268
+ }, z.core.$strip>>;
269
+ lastDelivery: z.ZodNullable<z.ZodObject<{
270
+ at: z.ZodString;
271
+ type: z.ZodString;
272
+ outcome: z.ZodEnum<{
273
+ failed: "failed";
274
+ processed: "processed";
275
+ ignored: "ignored";
276
+ }>;
277
+ }, z.core.$strip>>;
278
+ check: z.ZodNullable<z.ZodObject<{
279
+ at: z.ZodString;
280
+ ok: z.ZodBoolean;
281
+ detail: z.ZodString;
282
+ }, z.core.$strip>>;
283
+ sibling: z.ZodNullable<z.ZodObject<{
284
+ endpointId: z.ZodNullable<z.ZodString>;
285
+ }, z.core.$strip>>;
286
+ }, z.core.$strip>;
287
+ receivingUrl: z.ZodString;
288
+ }, z.core.$strip>;
289
+ export type ConnectionUrlMade = z.infer<typeof connectionUrlMadeSchema>;
290
+ /** `PUT /connections/{source}/secret`: the secret or the key as the source showed it. */
291
+ export declare const connectionSecretSchema: z.ZodObject<{
292
+ secret: z.ZodString;
293
+ }, z.core.$strip>;
294
+ export type ConnectionSecret = z.input<typeof connectionSecretSchema>;
295
+ /** `PATCH /connections/{source}`: the declared fields to store (a key absent keeps its value; null clears it). */
296
+ export declare const connectionFieldsUpdateSchema: z.ZodObject<{
297
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
298
+ }, z.core.$strip>;
299
+ export type ConnectionFieldsUpdate = z.infer<typeof connectionFieldsUpdateSchema>;
300
+ /** `POST /connections/{source}/test`: what the test found, and the connection after it. */
301
+ export declare const connectionTestResultSchema: z.ZodObject<{
302
+ ok: z.ZodBoolean;
303
+ detail: z.ZodString;
304
+ connection: z.ZodObject<{
305
+ source: z.ZodString;
306
+ name: z.ZodString;
307
+ kind: z.ZodEnum<{
308
+ key: "key";
309
+ inbound: "inbound";
310
+ both: "both";
311
+ }>;
312
+ declared: z.ZodObject<{
313
+ description: z.ZodNullable<z.ZodString>;
314
+ verifier: z.ZodNullable<z.ZodString>;
315
+ events: z.ZodArray<z.ZodString>;
316
+ secretHint: z.ZodNullable<z.ZodString>;
317
+ fields: z.ZodArray<z.ZodObject<{
318
+ key: z.ZodString;
319
+ label: z.ZodString;
320
+ description: z.ZodNullable<z.ZodString>;
321
+ required: z.ZodBoolean;
322
+ multiple: z.ZodBoolean;
323
+ }, z.core.$strip>>;
324
+ sibling: z.ZodNullable<z.ZodObject<{
325
+ toolSlug: z.ZodString;
326
+ events: z.ZodArray<z.ZodString>;
327
+ }, z.core.$strip>>;
328
+ }, z.core.$strip>;
329
+ connected: z.ZodBoolean;
330
+ receiving: z.ZodNullable<z.ZodObject<{
331
+ madeAt: z.ZodString;
332
+ madeBy: z.ZodNullable<z.ZodObject<{
333
+ id: z.ZodString;
334
+ name: z.ZodString;
335
+ email: z.ZodString;
336
+ }, z.core.$strip>>;
337
+ }, z.core.$strip>>;
338
+ secretState: z.ZodObject<{
339
+ set: z.ZodBoolean;
340
+ readable: z.ZodBoolean;
341
+ setAt: z.ZodNullable<z.ZodString>;
342
+ setBy: z.ZodNullable<z.ZodObject<{
343
+ id: z.ZodString;
344
+ name: z.ZodString;
345
+ email: z.ZodString;
346
+ }, z.core.$strip>>;
347
+ }, z.core.$strip>;
348
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
349
+ connectedAt: z.ZodNullable<z.ZodString>;
350
+ connectedBy: z.ZodNullable<z.ZodObject<{
351
+ id: z.ZodString;
352
+ name: z.ZodString;
353
+ email: z.ZodString;
354
+ }, z.core.$strip>>;
355
+ lastDelivery: z.ZodNullable<z.ZodObject<{
356
+ at: z.ZodString;
357
+ type: z.ZodString;
358
+ outcome: z.ZodEnum<{
359
+ failed: "failed";
360
+ processed: "processed";
361
+ ignored: "ignored";
362
+ }>;
363
+ }, z.core.$strip>>;
364
+ check: z.ZodNullable<z.ZodObject<{
365
+ at: z.ZodString;
366
+ ok: z.ZodBoolean;
367
+ detail: z.ZodString;
368
+ }, z.core.$strip>>;
369
+ sibling: z.ZodNullable<z.ZodObject<{
370
+ endpointId: z.ZodNullable<z.ZodString>;
371
+ }, z.core.$strip>>;
372
+ }, z.core.$strip>;
373
+ }, z.core.$strip>;
374
+ export type ConnectionTestResult = z.infer<typeof connectionTestResultSchema>;
375
+ /** One delivery the door took for a source of a workspace. */
376
+ export declare const connectionDeliverySchema: z.ZodObject<{
377
+ id: z.ZodString;
378
+ source: z.ZodString;
379
+ deliveryId: z.ZodString;
380
+ type: z.ZodString;
381
+ receivedAt: z.ZodString;
382
+ outcome: z.ZodEnum<{
383
+ failed: "failed";
384
+ processed: "processed";
385
+ ignored: "ignored";
386
+ }>;
387
+ detail: z.ZodNullable<z.ZodString>;
388
+ error: z.ZodNullable<z.ZodString>;
389
+ }, z.core.$strip>;
390
+ export type ConnectionDelivery = z.infer<typeof connectionDeliverySchema>;
391
+ export declare const connectionDeliveriesListSchema: z.ZodObject<{
392
+ deliveries: z.ZodArray<z.ZodObject<{
393
+ id: z.ZodString;
394
+ source: z.ZodString;
395
+ deliveryId: z.ZodString;
396
+ type: z.ZodString;
397
+ receivedAt: z.ZodString;
398
+ outcome: z.ZodEnum<{
399
+ failed: "failed";
400
+ processed: "processed";
401
+ ignored: "ignored";
402
+ }>;
403
+ detail: z.ZodNullable<z.ZodString>;
404
+ error: z.ZodNullable<z.ZodString>;
405
+ }, z.core.$strip>>;
406
+ nextCursor: z.ZodNullable<z.ZodString>;
407
+ }, z.core.$strip>;
408
+ export type ConnectionDeliveriesList = z.infer<typeof connectionDeliveriesListSchema>;
409
+ export declare const connectionDeliveriesListQuerySchema: z.ZodObject<{
410
+ cursor: z.ZodOptional<z.ZodString>;
411
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
412
+ }, z.core.$strip>;
413
+ export declare const connectionParamsSchema: z.ZodObject<{
414
+ source: z.ZodString;
415
+ }, z.core.$strip>;
416
+ //# sourceMappingURL=connections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/schemas/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;GAaG;AAEH,mGAAmG;AACnG,eAAO,MAAM,yBAAyB,aAI4D,CAAC;AAEnG,iGAAiG;AACjG,eAAO,MAAM,oBAAoB;;;;EAAqC,CAAC;AACvE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C,uEAAuE;AACvE,eAAO,MAAM,gCAAgC;;;;;;iBAO3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC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AC;AAExE,yFAAyF;AACzF,eAAO,MAAM,sBAAsB;;iBASjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,kHAAkH;AAClH,eAAO,MAAM,4BAA4B;;iBAA+C,CAAC;AACzF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,2FAA2F;AAC3F,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,8DAA8D;AAC9D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;iBAYnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;iBAGzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,mCAAmC;;;iBAAwB,CAAC;AAEzE,eAAO,MAAM,sBAAsB;;iBAAkD,CAAC"}
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+ import { cursorPageQuerySchema, hasControlChars, plainText } from './common.js';
3
+ /**
4
+ * Connections (PRDCT-3773): every inbound webhook source a tool receives from
5
+ * and every outbound key it holds, declared by the tool (the `connections`
6
+ * slot: a key, a name, a kind, a verifier, the fields the source carries, a
7
+ * handler), stored by the chassis (one row per workspace and source: the
8
+ * sealed secret or key, the receiving token's hash, who connected it and
9
+ * when, the declared fields, the last delivery), served on ONE page
10
+ * (Settings › Connections, one card per source), one CLI group and one set
11
+ * of MCP tools. The door, `POST /hooks/{source}/{token}`, lives outside
12
+ * `/api/v1`: the signature is the credential.
13
+ *
14
+ * No answer ever carries a secret, a key or the receiving URL's token: the
15
+ * URL is answered once, when it is made or rotated, and the secret never.
16
+ */
17
+ /** A source key: lowercase, digits and underscores, starting with a letter (`meet`, `lemlist`). */
18
+ export const connectionSourceKeySchema = z
19
+ .string()
20
+ .min(1)
21
+ .max(40)
22
+ .regex(/^[a-z][a-z0-9_]*$/, 'lowercase letters, digits and underscores, starting with a letter');
23
+ /** `inbound`: a source that posts to this instance; `key`: a key this instance holds; `both`. */
24
+ export const connectionKindSchema = z.enum(['inbound', 'key', 'both']);
25
+ /** The path of the door, outside `/api/v1`: `<PUBLIC_BASE_URL>/hooks/<source>/<token>`. */
26
+ export const CONNECTION_HOOK_PATH = '/hooks';
27
+ /** One declared field of a source, as the page and the CLI show it. */
28
+ export const connectionFieldDeclarationSchema = z.object({
29
+ key: z.string(),
30
+ label: z.string(),
31
+ description: z.string().nullable(),
32
+ required: z.boolean(),
33
+ /** The value is a list of strings rather than one string. */
34
+ multiple: z.boolean()
35
+ });
36
+ /** What the tool declared about a source: the static half of a card. */
37
+ export const connectionDeclaredSchema = z.object({
38
+ description: z.string().nullable(),
39
+ /** `standard-webhooks`, `stripe`, or `custom` (the tool's own function); null for a key source. */
40
+ verifier: z.string().nullable(),
41
+ /** The event types the source sends (an inbound source); informative. */
42
+ events: z.array(z.string()),
43
+ /** What the secret looks like, for the form's placeholder (`whsec_…`); never a value. */
44
+ secretHint: z.string().nullable(),
45
+ fields: z.array(connectionFieldDeclarationSchema),
46
+ /** The source is a sibling tool of the same hub (PRDCT-3774): its registry slug and the events to subscribe. */
47
+ sibling: z.object({ toolSlug: z.string(), events: z.array(z.string()) }).nullable()
48
+ });
49
+ const member = z.object({ id: z.string(), name: z.string(), email: z.string() });
50
+ /** A field's stored value: a string, a list of strings, or null (unset). */
51
+ export const connectionFieldValueSchema = z.union([
52
+ plainText(0, 2000),
53
+ z.array(plainText(1, 2000)).max(200),
54
+ z.null()
55
+ ]);
56
+ /** The stored fields of a connection, by declared key. */
57
+ export const connectionFieldsSchema = z.record(connectionSourceKeySchema, connectionFieldValueSchema);
58
+ /** The outcome of one delivery the door took. */
59
+ export const connectionDeliveryOutcomeSchema = z.enum(['processed', 'ignored', 'failed']);
60
+ /**
61
+ * One source as the page, the CLI and an agent read it: the declaration,
62
+ * whether it is connected, who made the receiving URL and when (never the
63
+ * URL), whether the secret is set and readable, by whom and when (never the
64
+ * secret), the stored fields, the last delivery and the last test.
65
+ */
66
+ export const connectionSchema = z.object({
67
+ source: connectionSourceKeySchema,
68
+ name: z.string(),
69
+ kind: connectionKindSchema,
70
+ declared: connectionDeclaredSchema,
71
+ /** An inbound source: the URL is made and the secret set; a key source: the key is set. */
72
+ connected: z.boolean(),
73
+ /** The receiving URL's state (an inbound source): when the current one was made and by whom; null until made. Never the URL. */
74
+ receiving: z.object({ madeAt: z.string(), madeBy: member.nullable() }).nullable(),
75
+ /** The secret's state: never the secret. */
76
+ secretState: z.object({
77
+ set: z.boolean(),
78
+ /** False when the stored value no longer opens (the instance's auth secret changed): set it again. */
79
+ readable: z.boolean(),
80
+ setAt: z.string().nullable(),
81
+ setBy: member.nullable()
82
+ }),
83
+ fields: connectionFieldsSchema,
84
+ /** When the connection row was first made, by whom. */
85
+ connectedAt: z.string().nullable(),
86
+ connectedBy: member.nullable(),
87
+ lastDelivery: z
88
+ .object({ at: z.string(), type: z.string(), outcome: connectionDeliveryOutcomeSchema })
89
+ .nullable(),
90
+ /** The last test or probe: when, whether it passed, what it said. */
91
+ check: z.object({ at: z.string(), ok: z.boolean(), detail: z.string() }).nullable(),
92
+ /** A sibling source (PRDCT-3774): the endpoint registered on the sibling, null until connected as the person. */
93
+ sibling: z.object({ endpointId: z.string().nullable() }).nullable()
94
+ });
95
+ export const connectionsListSchema = z.object({ connections: z.array(connectionSchema) });
96
+ /** `POST /connections/{source}`: the connection and the receiving URL, shown this once. */
97
+ export const connectionUrlMadeSchema = z.object({
98
+ connection: connectionSchema,
99
+ /** `<PUBLIC_BASE_URL>/hooks/<source>/<token>`: only the token's hash is kept, so the URL is never shown again. */
100
+ receivingUrl: z.string()
101
+ });
102
+ /** `PUT /connections/{source}/secret`: the secret or the key as the source showed it. */
103
+ export const connectionSecretSchema = z.object({
104
+ secret: z
105
+ .string()
106
+ .trim()
107
+ .min(1)
108
+ .max(4096)
109
+ .refine((v) => !/\s/.test(v) && !hasControlChars(v), {
110
+ error: 'must not contain whitespace or control characters'
111
+ })
112
+ });
113
+ /** `PATCH /connections/{source}`: the declared fields to store (a key absent keeps its value; null clears it). */
114
+ export const connectionFieldsUpdateSchema = z.object({ fields: connectionFieldsSchema });
115
+ /** `POST /connections/{source}/test`: what the test found, and the connection after it. */
116
+ export const connectionTestResultSchema = z.object({
117
+ ok: z.boolean(),
118
+ detail: z.string(),
119
+ connection: connectionSchema
120
+ });
121
+ /** One delivery the door took for a source of a workspace. */
122
+ export const connectionDeliverySchema = z.object({
123
+ id: z.string(),
124
+ source: connectionSourceKeySchema,
125
+ /** The sender's own id of the delivery (the `webhook-id` header, Stripe's event id): the dedupe key. */
126
+ deliveryId: z.string(),
127
+ type: z.string(),
128
+ receivedAt: z.string(),
129
+ outcome: connectionDeliveryOutcomeSchema,
130
+ /** What the handler said, or null. */
131
+ detail: z.string().nullable(),
132
+ /** Why the handler failed, or null. */
133
+ error: z.string().nullable()
134
+ });
135
+ export const connectionDeliveriesListSchema = z.object({
136
+ deliveries: z.array(connectionDeliverySchema),
137
+ nextCursor: z.string().nullable()
138
+ });
139
+ export const connectionDeliveriesListQuerySchema = cursorPageQuerySchema;
140
+ export const connectionParamsSchema = z.object({ source: connectionSourceKeySchema });
141
+ //# sourceMappingURL=connections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.js","sourceRoot":"","sources":["../../src/schemas/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;A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MAAM,EAAE;IACtB,OAAO,EAAE,+BAA+B;IACxC,sCAAsC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,uCAAuC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;IAC7C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,mCAAmC,GAAG,qBAAqB,CAAC;AAEzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antasphere/chassis-contract",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,9 +28,9 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@antasphere/contract": "^0.19.0",
31
+ "@antasphere/contract": "^0.20.0",
32
32
  "@hono/zod-openapi": "^1.4.0",
33
- "zod": "^4.1.0"
33
+ "zod": "^4.6.6"
34
34
  },
35
35
  "devDependencies": {
36
36
  "vitest": "^3.2.0"
package/src/fleet.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The fleet (PRDCT-3772): the origins of the hub's registry tools, the list
3
+ * a tool's webhook delivery guard reads from the hub's public
4
+ * `GET /api/v1/tool-origins`. The hub owns the shape and publishes it as
5
+ * `@antasphere/contract` (PRDCT-3325); re-exported here under the chassis's
6
+ * names like the billing rail's messages (`entitlements.ts`), never
7
+ * redefined.
8
+ */
9
+ export { toolOriginSchema, toolOriginsSchema, type ToolOrigin, type ToolOrigins } from '@antasphere/contract';
package/src/index.ts CHANGED
@@ -32,8 +32,10 @@ export * from './schemas/files.js';
32
32
  export * from './schemas/projects.js';
33
33
  export * from './schemas/teams.js';
34
34
  export * from './schemas/webhooks.js';
35
+ export * from './schemas/connections.js';
35
36
  export * from './schemas/demo-passes.js';
36
37
  export * from './schemas/apps.js';
38
+ export * from './fleet.js';
37
39
  export * from './tools.js';
38
40
  export * from './seams.js';
39
41
  export * from './entitlements.js';