@mossbear/protocol 0.1.0-alpha.115 → 0.1.0-alpha.117

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 (57) hide show
  1. package/dist/bundles.d.ts +662 -0
  2. package/dist/bundles.d.ts.map +1 -0
  3. package/dist/bundles.js +454 -0
  4. package/dist/bundles.js.map +1 -0
  5. package/dist/bundles.test.d.ts +2 -0
  6. package/dist/bundles.test.d.ts.map +1 -0
  7. package/dist/bundles.test.js +61 -0
  8. package/dist/bundles.test.js.map +1 -0
  9. package/dist/guideHistory.d.ts +643 -0
  10. package/dist/guideHistory.d.ts.map +1 -0
  11. package/dist/guideHistory.js +343 -0
  12. package/dist/guideHistory.js.map +1 -0
  13. package/dist/guideHistory.test.d.ts +2 -0
  14. package/dist/guideHistory.test.d.ts.map +1 -0
  15. package/dist/guideHistory.test.js +35 -0
  16. package/dist/guideHistory.test.js.map +1 -0
  17. package/dist/guideImport.d.ts +398 -0
  18. package/dist/guideImport.d.ts.map +1 -0
  19. package/dist/guideImport.js +350 -0
  20. package/dist/guideImport.js.map +1 -0
  21. package/dist/guideImport.test.d.ts +2 -0
  22. package/dist/guideImport.test.d.ts.map +1 -0
  23. package/dist/guideImport.test.js +62 -0
  24. package/dist/guideImport.test.js.map +1 -0
  25. package/dist/guideSnapshot.d.ts +105 -0
  26. package/dist/guideSnapshot.d.ts.map +1 -0
  27. package/dist/guideSnapshot.js +101 -0
  28. package/dist/guideSnapshot.js.map +1 -0
  29. package/dist/guideSnapshot.test.d.ts +2 -0
  30. package/dist/guideSnapshot.test.d.ts.map +1 -0
  31. package/dist/guideSnapshot.test.js +49 -0
  32. package/dist/guideSnapshot.test.js.map +1 -0
  33. package/dist/pairing.d.ts +1 -1
  34. package/dist/schemas.d.ts +43 -2072
  35. package/dist/schemas.d.ts.map +1 -1
  36. package/dist/schemas.js +43 -1389
  37. package/dist/schemas.js.map +1 -1
  38. package/dist/search.d.ts +97 -0
  39. package/dist/search.d.ts.map +1 -1
  40. package/dist/search.js +14 -0
  41. package/dist/search.js.map +1 -1
  42. package/dist/search.test.js +22 -0
  43. package/dist/search.test.js.map +1 -1
  44. package/dist/sessionGrade.d.ts +12 -12
  45. package/dist/sessionGrade.d.ts.map +1 -1
  46. package/dist/sessionGrade.js +11 -11
  47. package/dist/sessionGrade.js.map +1 -1
  48. package/dist/types.d.ts +4 -27
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/types.js.map +1 -1
  51. package/dist/whatSyncs.js +4 -4
  52. package/dist/whatSyncs.js.map +1 -1
  53. package/dist/wirePrimitives.d.ts +90 -3
  54. package/dist/wirePrimitives.d.ts.map +1 -1
  55. package/dist/wirePrimitives.js +124 -3
  56. package/dist/wirePrimitives.js.map +1 -1
  57. package/package.json +1 -1
@@ -0,0 +1,662 @@
1
+ /** Bundle identity, subscriptions, membership, and authoring wire contracts. */
2
+ import * as v from 'valibot';
3
+ /** A bundle's display name. Bundles are addressed by slug; this is the label. */
4
+ export declare const BUNDLE_NAME_MAX_LENGTH = 200;
5
+ export declare const BundleSlugSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
6
+ /**
7
+ * A publisher's lowercase handle: the prefix of a published bundle's address,
8
+ * `<handle>/<slug>` (`mossbear/guides`). Slugs are unique per workspace, so a
9
+ * bare slug names one of the caller's own bundles and a published bundle is
10
+ * named through its publisher.
11
+ */
12
+ export declare const PUBLISHER_HANDLE_PATTERN: RegExp;
13
+ export declare const PublisherHandleSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
14
+ /** The longest publisher name a reader is shown. */
15
+ export declare const PUBLISHER_NAME_MAX_LENGTH = 100;
16
+ /**
17
+ * Who publishes a bundle, as a reader sees it. Present only on a bundle that is
18
+ * published; absent is the ordinary case, a bundle of the caller's own.
19
+ */
20
+ export declare const BundlePublisherSchema: v.ObjectSchema<{
21
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, undefined>]>;
22
+ readonly handle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
23
+ }, undefined>;
24
+ /** A published bundle's address, `<handle>/<slug>`. */
25
+ export declare const PublishedBundleAddressSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 104, undefined>, v.CheckAction<string, "address must be <publisher handle>/<bundle slug>">]>;
26
+ export declare const BundleSchema: v.ObjectSchema<{
27
+ /**
28
+ * The project id of the repo that owns this bundle's items, when one claims it
29
+ * (`subscription-delivery-target-plan.md` → slice 3). Absent is the ordinary
30
+ * case: a bundle with no home is edited wherever its owner likes.
31
+ *
32
+ * A home makes the named checkout the only writer — a PR there is the review
33
+ * — and every other writer, the dashboard included, is refused by name.
34
+ *
35
+ * Optional rather than nullable so a CLI built before this field parses a new
36
+ * server's listing unchanged.
37
+ */
38
+ readonly home: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
39
+ readonly publisher: v.OptionalSchema<v.ObjectSchema<{
40
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, undefined>]>;
41
+ readonly handle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
42
+ }, undefined>, undefined>;
43
+ readonly readOnly: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
44
+ readonly id: v.StringSchema<undefined>;
45
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
46
+ readonly name: v.StringSchema<undefined>;
47
+ readonly createdAt: v.StringSchema<undefined>;
48
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
49
+ }, undefined>;
50
+ export declare const BundleListResponseSchema: v.ObjectSchema<{
51
+ readonly bundles: v.ArraySchema<v.ObjectSchema<{
52
+ /**
53
+ * The project id of the repo that owns this bundle's items, when one claims it
54
+ * (`subscription-delivery-target-plan.md` → slice 3). Absent is the ordinary
55
+ * case: a bundle with no home is edited wherever its owner likes.
56
+ *
57
+ * A home makes the named checkout the only writer — a PR there is the review
58
+ * — and every other writer, the dashboard included, is refused by name.
59
+ *
60
+ * Optional rather than nullable so a CLI built before this field parses a new
61
+ * server's listing unchanged.
62
+ */
63
+ readonly home: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
64
+ readonly publisher: v.OptionalSchema<v.ObjectSchema<{
65
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, undefined>]>;
66
+ readonly handle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
67
+ }, undefined>, undefined>;
68
+ readonly readOnly: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
69
+ readonly id: v.StringSchema<undefined>;
70
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
71
+ readonly name: v.StringSchema<undefined>;
72
+ readonly createdAt: v.StringSchema<undefined>;
73
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
74
+ }, undefined>, undefined>;
75
+ }, undefined>;
76
+ /**
77
+ * How a bundle reaches a repo. Two scopes and no third:
78
+ *
79
+ * - `repo` — named by the committed `.mossbear/config.json`, shared with
80
+ * teammates by `git clone`.
81
+ * - `user` — recorded against the account, private, and on every machine.
82
+ *
83
+ * A bundle both scopes name carries **both** labels. An earlier shape reported a
84
+ * single winning `scope`, which made `status` and `doctor` — both of which count
85
+ * the account's subscriptions by filtering for `user` — report zero for a bundle
86
+ * that is genuinely subscribed at the account level and will keep delivering to
87
+ * every other repo. The scopes are not mutually exclusive, so the wire shape
88
+ * must not say they are. Raised by Codex on #735.
89
+ */
90
+ export declare const SubscriptionScopeSchema: v.PicklistSchema<["repo", "user"], undefined>;
91
+ /**
92
+ * Where a subscription's items are delivered, independent of where their source
93
+ * lives (`subscription-delivery-target-plan.md` → slice 2).
94
+ *
95
+ * - `repo` — land at the item's path in the checkout doing the sync, under the
96
+ * same git-owned write rule every project item obeys.
97
+ * - `global` — land in the machine-global namespace, unattended.
98
+ *
99
+ * **Absent is not a third value.** A subscription that names no target routes on
100
+ * the item's own `root`, which is what every subscription meant before this
101
+ * field existed — so the column and the config key are both nullable and the
102
+ * default bundle keeps behaving exactly as it does today.
103
+ */
104
+ export declare const DeliverTargetSchema: v.PicklistSchema<["repo", "global"], undefined>;
105
+ export declare const ResolvedSubscriptionSchema: v.ObjectSchema<{
106
+ /**
107
+ * The address this bundle was resolved from, when the caller named it as
108
+ * `<handle>/<slug>` in `repoBundleAddresses` rather than by id. Lets the
109
+ * caller pair each committed address with the id it stands for.
110
+ */
111
+ readonly address: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 104, undefined>, v.CheckAction<string, "address must be <publisher handle>/<bundle slug>">]>, undefined>;
112
+ readonly publisher: v.OptionalSchema<v.ObjectSchema<{
113
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, undefined>]>;
114
+ readonly handle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
115
+ }, undefined>, undefined>;
116
+ readonly readOnly: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
117
+ readonly id: v.StringSchema<undefined>;
118
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
119
+ readonly name: v.StringSchema<undefined>;
120
+ /** Every scope that names this bundle. Never empty; may hold both. */
121
+ readonly scopes: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["repo", "user"], undefined>, undefined>, v.MinLengthAction<("repo" | "user")[], 1, undefined>]>;
122
+ /**
123
+ * The **account** subscription's delivery target, when there is an account
124
+ * subscription and it names one.
125
+ *
126
+ * Only the account side, and deliberately so: the repo side's target lives in
127
+ * the committed `.mossbear/config.json` on the caller's own disk, which the
128
+ * server cannot read — the same asymmetry that makes this endpoint a round
129
+ * trip at all. Echoing a value the caller just sent would make the server look
130
+ * like the authority on a fact it does not hold. The caller pairs this with
131
+ * its own committed `deliver` to build the per-scope target set
132
+ * (`packages/cli/src/artifacts/delivery.ts` → `deliveryBundles`).
133
+ *
134
+ * Optional rather than nullable so a CLI built before this field parses a new
135
+ * server's response unchanged, and a new CLI reads an old server's response as
136
+ * "names no target" — which is the absent-field default either way.
137
+ */
138
+ readonly deliver: v.OptionalSchema<v.PicklistSchema<["repo", "global"], undefined>, undefined>;
139
+ /**
140
+ * The bundle's home repo, when one claims it. Sent on every resolved
141
+ * subscription regardless of scope, because it is a property of the *bundle*
142
+ * rather than of either subscription — unlike `deliver`, which each scope
143
+ * answers for itself.
144
+ */
145
+ readonly home: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
146
+ /**
147
+ * Ids this account has switched off for the asking machine, on a bundle that
148
+ * reaches it through the account subscription alone. An item whose own id or
149
+ * `guideId` is listed is not delivered.
150
+ *
151
+ * The server computes it per machine: artifacts switched off everywhere or
152
+ * on this machine that this bundle can deliver, plus every member when the
153
+ * bundle itself is switched off. Account-scoped and nowhere else: a repo
154
+ * subscription is a committed file shared by everyone who clones it, so a
155
+ * mute there would be one member deciding for the team. A muted guide leaves
156
+ * the desired delivery list, and the global namespace prunes it once no repo
157
+ * still refers to it — repo by repo, as each syncs, because the referrer
158
+ * record is machine-local repo ids.
159
+ */
160
+ readonly muted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
161
+ /**
162
+ * The same set as `muted`, sent instead of it when the calling repo's
163
+ * committed config also subscribes this bundle. It applies to the account
164
+ * target only: the repo's own subscription still delivers into the checkout,
165
+ * because an off removes only what reaches the machine through the account.
166
+ *
167
+ * A separate key rather than `muted`, because a CLI that predates it applies
168
+ * `muted` before either target is planned and would drop the repo delivery
169
+ * too. That CLI ignores this key and delivers to both targets, which fails
170
+ * toward the agent having the content.
171
+ */
172
+ readonly accountMuted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
173
+ }, undefined>;
174
+ /**
175
+ * The ids a repo's committed config names. Sent rather than looked up, because
176
+ * the committed file is on the caller's disk and the server has no way to read
177
+ * it — that asymmetry is the whole reason delivery used to be written back into
178
+ * the repo.
179
+ */
180
+ /**
181
+ * Capped, like the other batch endpoints. The route expands this into
182
+ * `inArray(bundles.id, …)`, one Postgres bind parameter per id, and the wire
183
+ * protocol tops out at 65,535 of them — so an uncapped array lets a body well
184
+ * under the request-size limit reach the database and fail as a 500 rather than
185
+ * being refused as bad input. Raised by Codex on #735.
186
+ */
187
+ export declare const MAX_REPO_BUNDLE_IDS = 500;
188
+ /** Capped for the reason `MAX_REPO_BUNDLE_IDS` gives. */
189
+ export declare const MAX_REPO_BUNDLE_ADDRESSES = 64;
190
+ export declare const ResolveSubscriptionsRequestSchema: v.ObjectSchema<{
191
+ readonly repoBundleIds: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MaxLengthAction<string[], 500, undefined>]>;
192
+ /**
193
+ * Published bundles the committed config names by address,
194
+ * `<handle>/<slug>`, rather than by id. Optional, so a CLI that sends only
195
+ * ids is answered as before.
196
+ */
197
+ readonly repoBundleAddresses: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 104, undefined>, v.CheckAction<string, "address must be <publisher handle>/<bundle slug>">]>, undefined>, v.MaxLengthAction<string[], 64, undefined>]>, undefined>;
198
+ /**
199
+ * The calling machine's stable id (`MachineIdSchema`). Optional, so an older
200
+ * CLI is answered as before; the server records it for the calling key only
201
+ * when that key has none yet.
202
+ */
203
+ readonly machineId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "not a machine id">]>, undefined>;
204
+ }, undefined>;
205
+ export declare const ResolveSubscriptionsResponseSchema: v.ObjectSchema<{
206
+ /** The effective delivery set, de-duplicated by bundle id. */
207
+ readonly bundles: v.ArraySchema<v.ObjectSchema<{
208
+ /**
209
+ * The address this bundle was resolved from, when the caller named it as
210
+ * `<handle>/<slug>` in `repoBundleAddresses` rather than by id. Lets the
211
+ * caller pair each committed address with the id it stands for.
212
+ */
213
+ readonly address: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 104, undefined>, v.CheckAction<string, "address must be <publisher handle>/<bundle slug>">]>, undefined>;
214
+ readonly publisher: v.OptionalSchema<v.ObjectSchema<{
215
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, undefined>]>;
216
+ readonly handle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
217
+ }, undefined>, undefined>;
218
+ readonly readOnly: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
219
+ readonly id: v.StringSchema<undefined>;
220
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
221
+ readonly name: v.StringSchema<undefined>;
222
+ /** Every scope that names this bundle. Never empty; may hold both. */
223
+ readonly scopes: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["repo", "user"], undefined>, undefined>, v.MinLengthAction<("repo" | "user")[], 1, undefined>]>;
224
+ /**
225
+ * The **account** subscription's delivery target, when there is an account
226
+ * subscription and it names one.
227
+ *
228
+ * Only the account side, and deliberately so: the repo side's target lives in
229
+ * the committed `.mossbear/config.json` on the caller's own disk, which the
230
+ * server cannot read — the same asymmetry that makes this endpoint a round
231
+ * trip at all. Echoing a value the caller just sent would make the server look
232
+ * like the authority on a fact it does not hold. The caller pairs this with
233
+ * its own committed `deliver` to build the per-scope target set
234
+ * (`packages/cli/src/artifacts/delivery.ts` → `deliveryBundles`).
235
+ *
236
+ * Optional rather than nullable so a CLI built before this field parses a new
237
+ * server's response unchanged, and a new CLI reads an old server's response as
238
+ * "names no target" — which is the absent-field default either way.
239
+ */
240
+ readonly deliver: v.OptionalSchema<v.PicklistSchema<["repo", "global"], undefined>, undefined>;
241
+ /**
242
+ * The bundle's home repo, when one claims it. Sent on every resolved
243
+ * subscription regardless of scope, because it is a property of the *bundle*
244
+ * rather than of either subscription — unlike `deliver`, which each scope
245
+ * answers for itself.
246
+ */
247
+ readonly home: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
248
+ /**
249
+ * Ids this account has switched off for the asking machine, on a bundle that
250
+ * reaches it through the account subscription alone. An item whose own id or
251
+ * `guideId` is listed is not delivered.
252
+ *
253
+ * The server computes it per machine: artifacts switched off everywhere or
254
+ * on this machine that this bundle can deliver, plus every member when the
255
+ * bundle itself is switched off. Account-scoped and nowhere else: a repo
256
+ * subscription is a committed file shared by everyone who clones it, so a
257
+ * mute there would be one member deciding for the team. A muted guide leaves
258
+ * the desired delivery list, and the global namespace prunes it once no repo
259
+ * still refers to it — repo by repo, as each syncs, because the referrer
260
+ * record is machine-local repo ids.
261
+ */
262
+ readonly muted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
263
+ /**
264
+ * The same set as `muted`, sent instead of it when the calling repo's
265
+ * committed config also subscribes this bundle. It applies to the account
266
+ * target only: the repo's own subscription still delivers into the checkout,
267
+ * because an off removes only what reaches the machine through the account.
268
+ *
269
+ * A separate key rather than `muted`, because a CLI that predates it applies
270
+ * `muted` before either target is planned and would drop the repo delivery
271
+ * too. That CLI ignores this key and delivers to both targets, which fails
272
+ * toward the agent having the content.
273
+ */
274
+ readonly accountMuted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
275
+ }, undefined>, undefined>;
276
+ /**
277
+ * Committed ids the caller cannot see. **Reported, never dropped** — the line
278
+ * was put in the config deliberately by whoever owns the repo, so a non-member
279
+ * gets a named failure rather than deletion advice.
280
+ *
281
+ * It also names the caller's **account** subscriptions whose bundle they can
282
+ * no longer read: one unpublished, or in a workspace they left. The row is
283
+ * still theirs, so a sync must hold retirement for it as for a repo id it
284
+ * cannot see, rather than read its absence as an empty bundle.
285
+ */
286
+ readonly unresolved: v.ArraySchema<v.ObjectSchema<{
287
+ readonly id: v.StringSchema<undefined>;
288
+ }, undefined>, undefined>;
289
+ /**
290
+ * Committed addresses (`repoBundleAddresses`) that name no published bundle.
291
+ * Kept apart from `unresolved`, whose entries are ids, so a CLI that reads
292
+ * `id` off every entry is never handed one without it. Absent when the
293
+ * request named no address.
294
+ */
295
+ readonly unresolvedAddresses: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
296
+ readonly address: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 104, undefined>, v.CheckAction<string, "address must be <publisher handle>/<bundle slug>">]>;
297
+ }, undefined>, undefined>, undefined>;
298
+ /**
299
+ * Account-level settings the sync needs, carried on the response every sync
300
+ * already fetches rather than on a request of their own.
301
+ *
302
+ * `deliverGlobalSkills` is the account's "Deliver my global skills" switch:
303
+ * whether guides scoped to every repo may be written to the global skills
304
+ * directories of every machine and cloud session this account syncs. Only a
305
+ * signed-in browser session can change it; it is reported here, never
306
+ * accepted. **Optional**, so a response from a server that predates it parses,
307
+ * and the CLI reads its absence as "the server did not say", which delivers
308
+ * nothing and removes nothing.
309
+ */
310
+ readonly account: v.OptionalSchema<v.ObjectSchema<{
311
+ readonly deliverGlobalSkills: v.BooleanSchema<undefined>;
312
+ }, undefined>, undefined>;
313
+ /**
314
+ * True when the caller's token is limited to certain bundles. Such a token
315
+ * resolves only what it was granted, so an id in `unresolved` may be a bundle
316
+ * the account can reach and the token cannot. Said once for the response,
317
+ * never per id, so it confirms nothing about any one bundle. Optional: absent
318
+ * means an ordinary token, and a server that predates it never sends it.
319
+ */
320
+ readonly limitedToken: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
321
+ }, undefined>;
322
+ /**
323
+ * Subscribe the calling account to a bundle it can see, or change the delivery
324
+ * target of a subscription it already has.
325
+ *
326
+ * **The product path to a non-default bundle** (`subscription-delivery-target-plan.md`
327
+ * → slice 2). Before this, the only insert into `user_bundle_subscriptions` was
328
+ * the one that mints an account's own capture bundle, so an account could not
329
+ * subscribe to anything else without a hand-written row.
330
+ *
331
+ * Idempotent by the table's composite key: subscribing twice is one
332
+ * subscription, and a second call carrying a different `deliver` updates it
333
+ * rather than failing.
334
+ */
335
+ /** No account should be able to make one sync unboundedly expensive. */
336
+ export declare const MAX_MUTED_GUIDE_IDS = 1000;
337
+ export declare const SubscribeBundleRequestSchema: v.ObjectSchema<{
338
+ readonly bundleId: v.StringSchema<undefined>;
339
+ /**
340
+ * Where this account's subscription delivers. **Three states, and all three
341
+ * are reachable**: a value sets the target, an explicit `null` clears it back
342
+ * to "route on the item's root", and omitting the field leaves whatever is
343
+ * stored.
344
+ *
345
+ * The first shipped version made omission clear the target, so that "route on
346
+ * the item's root" would stay reachable. It made a bare re-subscribe — the
347
+ * commonest call there is — silently reset routing the caller never mentioned:
348
+ * `mossbear pull <bundle> --account` a second time would wipe a target set the
349
+ * first time, and print a success line saying nothing about it. Found by the
350
+ * automated reviewer on #1246. A nullable field reaches the same state without
351
+ * making silence mean a write.
352
+ */
353
+ readonly deliver: v.OptionalSchema<v.NullableSchema<v.PicklistSchema<["repo", "global"], undefined>, undefined>, undefined>;
354
+ /**
355
+ * The ids to have switched off on every machine, as far as this bundle can
356
+ * deliver them — the whole set, replacing what is stored. `[]` switches them
357
+ * all back on, and omitting the field leaves the stored set alone.
358
+ *
359
+ * An id switched off here is off for the account, through every bundle that
360
+ * carries it. Switching one back on (an id this bundle delivers that is off
361
+ * now and absent here) needs a dashboard session: a CLI key is refused with
362
+ * 403, because an agent may narrow what it receives but never widen it.
363
+ *
364
+ * The same three states as `deliver` above, reached the same way: an explicit
365
+ * empty clears, and silence never means a write. So changing a delivery target
366
+ * cannot unmute anything, and muting cannot move a target.
367
+ */
368
+ readonly muted: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MaxLengthAction<string[], 1000, undefined>]>, undefined>;
369
+ }, undefined>;
370
+ export declare const SubscribeBundleResponseSchema: v.ObjectSchema<{
371
+ readonly bundleId: v.StringSchema<undefined>;
372
+ /** False when the subscription was already there and only its target moved. */
373
+ readonly created: v.BooleanSchema<undefined>;
374
+ readonly deliver: v.OptionalSchema<v.PicklistSchema<["repo", "global"], undefined>, undefined>;
375
+ /** The stored mute set after this write. Omitted when nothing is muted. */
376
+ readonly muted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
377
+ }, undefined>;
378
+ export declare const CreateBundleRequestSchema: v.ObjectSchema<{
379
+ readonly description: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "description must not be blank">, v.MaxLengthAction<string, 1000, "description must be at most 1000 characters">, v.CheckAction<string, "description must be one line of text, with no control characters">]>, undefined>, undefined>;
380
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
381
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>, v.CheckAction<string, "Remove the invisible characters from this name — copying text from another app often brings them along.">, v.RegexAction<string, "Remove the invisible characters from this name — copying text from another app often brings them along.">]>;
382
+ readonly workspaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
383
+ }, undefined>;
384
+ export declare const CreateBundleResponseSchema: v.ObjectSchema<{
385
+ readonly bundle: v.ObjectSchema<{
386
+ /**
387
+ * The project id of the repo that owns this bundle's items, when one claims it
388
+ * (`subscription-delivery-target-plan.md` → slice 3). Absent is the ordinary
389
+ * case: a bundle with no home is edited wherever its owner likes.
390
+ *
391
+ * A home makes the named checkout the only writer — a PR there is the review
392
+ * — and every other writer, the dashboard included, is refused by name.
393
+ *
394
+ * Optional rather than nullable so a CLI built before this field parses a new
395
+ * server's listing unchanged.
396
+ */
397
+ readonly home: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
398
+ readonly publisher: v.OptionalSchema<v.ObjectSchema<{
399
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, undefined>]>;
400
+ readonly handle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
401
+ }, undefined>, undefined>;
402
+ readonly readOnly: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
403
+ readonly id: v.StringSchema<undefined>;
404
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
405
+ readonly name: v.StringSchema<undefined>;
406
+ readonly createdAt: v.StringSchema<undefined>;
407
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
408
+ }, undefined>;
409
+ }, undefined>;
410
+ /**
411
+ * The member to attach, by its artifact id. `itemId` is the name a CLI from before
412
+ * release step 2 sends; both are read, and the parsed value is always `artifactId`.
413
+ * Drop `itemId` once no such CLI is left to send it.
414
+ */
415
+ /** The most artifacts one attach request may name. */
416
+ export declare const MAX_BUNDLE_MEMBERS_PER_ATTACH = 200;
417
+ export declare const AttachBundleMemberRequestSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
418
+ readonly artifactId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
419
+ readonly itemId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
420
+ readonly artifactIds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.TransformAction<string[], string[]>, v.MinLengthAction<string[], 1, undefined>, v.MaxLengthAction<string[], 200, undefined>]>, undefined>;
421
+ }, undefined>, v.CheckAction<{
422
+ artifactId?: string | undefined;
423
+ itemId?: string | undefined;
424
+ artifactIds?: string[] | undefined;
425
+ }, "A member needs an artifactId, or a list of artifactIds on its own.">, v.TransformAction<{
426
+ artifactId?: string | undefined;
427
+ itemId?: string | undefined;
428
+ artifactIds?: string[] | undefined;
429
+ }, {
430
+ artifactId: string;
431
+ } | {
432
+ artifactIds: string[];
433
+ }>]>;
434
+ export declare const AttachBundleMemberResponseSchema: v.ObjectSchema<{
435
+ readonly attached: v.BooleanSchema<undefined>;
436
+ }, undefined>;
437
+ /**
438
+ * One id's outcome in a list attach. `unavailable` is every refusal that is not
439
+ * a path collision, and reads the same whether the artifact is missing, not the
440
+ * caller's to file or in another workspace, so a list cannot probe which ids
441
+ * exist.
442
+ */
443
+ export declare const AttachBundleMembersResultSchema: v.ObjectSchema<{
444
+ readonly artifactId: v.StringSchema<undefined>;
445
+ readonly status: v.PicklistSchema<["added", "already_there", "unavailable", "path_taken"], undefined>;
446
+ }, undefined>;
447
+ export declare const AttachBundleMembersResponseSchema: v.ObjectSchema<{
448
+ readonly results: v.ArraySchema<v.ObjectSchema<{
449
+ readonly artifactId: v.StringSchema<undefined>;
450
+ readonly status: v.PicklistSchema<["added", "already_there", "unavailable", "path_taken"], undefined>;
451
+ }, undefined>, undefined>;
452
+ }, undefined>;
453
+ export declare const DetachBundleMemberResponseSchema: v.ObjectSchema<{
454
+ readonly detached: v.BooleanSchema<undefined>;
455
+ }, undefined>;
456
+ /**
457
+ * The most field keys a bundle's shared column list may hold, and the longest
458
+ * one. A key is a frontmatter key as written, so the bound is on what a
459
+ * dashboard could ever show as a column rather than on any real key's length;
460
+ * both are generous enough that a refusal means a client bug.
461
+ */
462
+ export declare const BUNDLE_COLUMNS_MAX_COUNT = 100;
463
+ export declare const BUNDLE_COLUMN_KEY_MAX_LENGTH = 200;
464
+ /**
465
+ * A bundle's shared column list: field keys in display order, no key twice.
466
+ * An array that repeats a key is refused rather than deduplicated, since the
467
+ * order is the content and a client that sent one has lost track of its own
468
+ * list.
469
+ */
470
+ export declare const BundleColumnsSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>, v.MaxLengthAction<string[], 100, undefined>, v.CheckAction<string[], "columns must not repeat a key">]>;
471
+ /**
472
+ * What `PATCH /api/v1/context/bundles/:id` may change: the display name, the
473
+ * home repo, the shared column list, or any of them. The slug stays immutable
474
+ * — repos address a bundle by id and name it by slug, so a slug change would
475
+ * rename a folder in every subscriber's checkout.
476
+ *
477
+ * Every field optional, with a check that at least one is present: a body that
478
+ * changes nothing is a request the caller did not mean to send, and answering it
479
+ * 200 would hide a client bug. `home: null` clears the claim, which is how a
480
+ * repo hands a bundle back — distinct from omitting the field, which leaves it.
481
+ * `columns: null` is the same for the column list: it returns the bundle to
482
+ * "not chosen", where every shared field shows.
483
+ */
484
+ export declare const UpdateBundleRequestSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
485
+ readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>, v.CheckAction<string, "Remove the invisible characters from this name — copying text from another app often brings them along.">, v.RegexAction<string, "Remove the invisible characters from this name — copying text from another app often brings them along.">]>, undefined>;
486
+ readonly home: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>, undefined>;
487
+ readonly columns: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>, v.MaxLengthAction<string[], 100, undefined>, v.CheckAction<string[], "columns must not repeat a key">]>, undefined>, undefined>;
488
+ readonly description: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "description must not be blank">, v.MaxLengthAction<string, 1000, "description must be at most 1000 characters">, v.CheckAction<string, "description must be one line of text, with no control characters">]>, undefined>, undefined>;
489
+ }, undefined>, v.CheckAction<{
490
+ name?: string | undefined;
491
+ home?: string | null | undefined;
492
+ columns?: string[] | null | undefined;
493
+ description?: string | null | undefined;
494
+ }, "name, home, columns or description is required">]>;
495
+ export declare const UpdateBundleResponseSchema: v.ObjectSchema<{
496
+ readonly bundle: v.ObjectSchema<{
497
+ /**
498
+ * The project id of the repo that owns this bundle's items, when one claims it
499
+ * (`subscription-delivery-target-plan.md` → slice 3). Absent is the ordinary
500
+ * case: a bundle with no home is edited wherever its owner likes.
501
+ *
502
+ * A home makes the named checkout the only writer — a PR there is the review
503
+ * — and every other writer, the dashboard included, is refused by name.
504
+ *
505
+ * Optional rather than nullable so a CLI built before this field parses a new
506
+ * server's listing unchanged.
507
+ */
508
+ readonly home: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
509
+ readonly publisher: v.OptionalSchema<v.ObjectSchema<{
510
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, undefined>]>;
511
+ readonly handle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "handle must be lowercase alphanumeric with hyphens">]>;
512
+ }, undefined>, undefined>;
513
+ readonly readOnly: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
514
+ readonly id: v.StringSchema<undefined>;
515
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "slug must be lowercase alphanumeric with hyphens, at most 64 characters">]>;
516
+ readonly name: v.StringSchema<undefined>;
517
+ readonly createdAt: v.StringSchema<undefined>;
518
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
519
+ }, undefined>;
520
+ }, undefined>;
521
+ export declare const DeleteBundleResponseSchema: v.ObjectSchema<{
522
+ readonly deleted: v.BooleanSchema<undefined>;
523
+ }, undefined>;
524
+ export type Bundle = v.InferOutput<typeof BundleSchema>;
525
+ export type BundleListResponse = v.InferOutput<typeof BundleListResponseSchema>;
526
+ export type SubscriptionScope = v.InferOutput<typeof SubscriptionScopeSchema>;
527
+ export type ResolvedSubscription = v.InferOutput<typeof ResolvedSubscriptionSchema>;
528
+ export type BundlePublisher = v.InferOutput<typeof BundlePublisherSchema>;
529
+ export type DeliverTarget = v.InferOutput<typeof DeliverTargetSchema>;
530
+ export type SubscribeBundleRequest = v.InferOutput<typeof SubscribeBundleRequestSchema>;
531
+ export type SubscribeBundleResponse = v.InferOutput<typeof SubscribeBundleResponseSchema>;
532
+ export type ResolveSubscriptionsRequest = v.InferOutput<typeof ResolveSubscriptionsRequestSchema>;
533
+ export type ResolveSubscriptionsResponse = v.InferOutput<typeof ResolveSubscriptionsResponseSchema>;
534
+ export type CreateBundleRequest = v.InferOutput<typeof CreateBundleRequestSchema>;
535
+ export type CreateBundleResponse = v.InferOutput<typeof CreateBundleResponseSchema>;
536
+ export type AttachBundleMemberRequest = v.InferOutput<typeof AttachBundleMemberRequestSchema>;
537
+ export type AttachBundleMembersResult = v.InferOutput<typeof AttachBundleMembersResultSchema>;
538
+ export type AttachBundleMembersResponse = v.InferOutput<typeof AttachBundleMembersResponseSchema>;
539
+ export type AttachBundleMemberResponse = v.InferOutput<typeof AttachBundleMemberResponseSchema>;
540
+ export type DetachBundleMemberResponse = v.InferOutput<typeof DetachBundleMemberResponseSchema>;
541
+ export declare function parseBundleListResponse(data: unknown): {
542
+ bundles: {
543
+ home?: string | undefined;
544
+ publisher?: {
545
+ name: string;
546
+ handle: string;
547
+ } | undefined;
548
+ readOnly?: true | undefined;
549
+ id: string;
550
+ slug: string;
551
+ name: string;
552
+ createdAt: string;
553
+ description?: string | null | undefined;
554
+ }[];
555
+ };
556
+ export declare function parseCreateBundleRequest(data: unknown): {
557
+ description?: string | null | undefined;
558
+ slug: string;
559
+ name: string;
560
+ workspaceId?: string | undefined;
561
+ };
562
+ export declare function parseCreateBundleResponse(data: unknown): {
563
+ bundle: {
564
+ home?: string | undefined;
565
+ publisher?: {
566
+ name: string;
567
+ handle: string;
568
+ } | undefined;
569
+ readOnly?: true | undefined;
570
+ id: string;
571
+ slug: string;
572
+ name: string;
573
+ createdAt: string;
574
+ description?: string | null | undefined;
575
+ };
576
+ };
577
+ export declare function parseAttachBundleMemberRequest(data: unknown): {
578
+ artifactId: string;
579
+ } | {
580
+ artifactIds: string[];
581
+ };
582
+ export declare function parseAttachBundleMemberResponse(data: unknown): {
583
+ attached: boolean;
584
+ };
585
+ export declare function parseAttachBundleMembersResponse(data: unknown): {
586
+ results: {
587
+ artifactId: string;
588
+ status: "added" | "already_there" | "unavailable" | "path_taken";
589
+ }[];
590
+ };
591
+ export declare function parseDetachBundleMemberResponse(data: unknown): {
592
+ detached: boolean;
593
+ };
594
+ export declare function parseSubscribeBundleRequest(data: unknown): {
595
+ bundleId: string;
596
+ deliver?: "global" | "repo" | null | undefined;
597
+ muted?: string[] | undefined;
598
+ };
599
+ export declare function parseSubscribeBundleResponse(data: unknown): {
600
+ bundleId: string;
601
+ created: boolean;
602
+ deliver?: "global" | "repo" | undefined;
603
+ muted?: string[] | undefined;
604
+ };
605
+ export declare function parseResolveSubscriptionsRequest(data: unknown): {
606
+ repoBundleIds: string[];
607
+ repoBundleAddresses?: string[] | undefined;
608
+ machineId?: string | undefined;
609
+ };
610
+ export declare function parseResolveSubscriptionsResponse(data: unknown): {
611
+ bundles: {
612
+ address?: string | undefined;
613
+ publisher?: {
614
+ name: string;
615
+ handle: string;
616
+ } | undefined;
617
+ readOnly?: true | undefined;
618
+ id: string;
619
+ slug: string;
620
+ name: string;
621
+ scopes: ("repo" | "user")[];
622
+ deliver?: "global" | "repo" | undefined;
623
+ home?: string | undefined;
624
+ muted?: string[] | undefined;
625
+ accountMuted?: string[] | undefined;
626
+ }[];
627
+ unresolved: {
628
+ id: string;
629
+ }[];
630
+ unresolvedAddresses?: {
631
+ address: string;
632
+ }[] | undefined;
633
+ account?: {
634
+ deliverGlobalSkills: boolean;
635
+ } | undefined;
636
+ limitedToken?: boolean | undefined;
637
+ };
638
+ export declare function parseUpdateBundleRequest(data: unknown): {
639
+ name?: string | undefined;
640
+ home?: string | null | undefined;
641
+ columns?: string[] | null | undefined;
642
+ description?: string | null | undefined;
643
+ };
644
+ export declare function parseUpdateBundleResponse(data: unknown): {
645
+ bundle: {
646
+ home?: string | undefined;
647
+ publisher?: {
648
+ name: string;
649
+ handle: string;
650
+ } | undefined;
651
+ readOnly?: true | undefined;
652
+ id: string;
653
+ slug: string;
654
+ name: string;
655
+ createdAt: string;
656
+ description?: string | null | undefined;
657
+ };
658
+ };
659
+ export declare function parseDeleteBundleResponse(data: unknown): {
660
+ deleted: boolean;
661
+ };
662
+ //# sourceMappingURL=bundles.d.ts.map