@cat-factory/contracts 0.339.0 → 0.341.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap.d.ts +135 -4
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +82 -3
- package/dist/bootstrap.js.map +1 -1
- package/dist/environment-reachability.d.ts +139 -16
- package/dist/environment-reachability.d.ts.map +1 -1
- package/dist/environment-reachability.js +108 -12
- package/dist/environment-reachability.js.map +1 -1
- package/dist/environments.d.ts +311 -1
- package/dist/environments.d.ts.map +1 -1
- package/dist/environments.js +14 -0
- package/dist/environments.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +14 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/monorepo-adoption.d.ts +220 -0
- package/dist/monorepo-adoption.d.ts.map +1 -0
- package/dist/monorepo-adoption.js +201 -0
- package/dist/monorepo-adoption.js.map +1 -0
- package/dist/public-provisioning.d.ts +13 -2
- package/dist/public-provisioning.d.ts.map +1 -1
- package/dist/public-provisioning.js +12 -1
- package/dist/public-provisioning.js.map +1 -1
- package/dist/routes/agent-runs.d.ts +94 -2
- package/dist/routes/agent-runs.d.ts.map +1 -1
- package/dist/routes/bootstrap.d.ts +289 -3
- package/dist/routes/bootstrap.d.ts.map +1 -1
- package/dist/routes/bootstrap.js +19 -0
- package/dist/routes/bootstrap.js.map +1 -1
- package/dist/routes/environmentUserHandlers.d.ts +6 -0
- package/dist/routes/environmentUserHandlers.d.ts.map +1 -1
- package/dist/routes/environments.d.ts +35 -5
- package/dist/routes/environments.d.ts.map +1 -1
- package/dist/routes/public-provisioning.d.ts +4 -2
- package/dist/routes/public-provisioning.d.ts.map +1 -1
- package/dist/routes/workspaces.d.ts +94 -2
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/snapshot.d.ts +47 -1
- package/dist/snapshot.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.d.ts
CHANGED
|
@@ -33,9 +33,57 @@ export declare const updateReferenceArchitectureSchema: v.ObjectSchema<{
|
|
|
33
33
|
readonly defaultInstructions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, undefined>;
|
|
34
34
|
}, undefined>;
|
|
35
35
|
export type UpdateReferenceArchitectureInput = v.InferOutput<typeof updateReferenceArchitectureSchema>;
|
|
36
|
-
/**
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Lifecycle of a single "bootstrap repo" run.
|
|
38
|
+
*
|
|
39
|
+
* `awaiting_review` is the monorepo flow's park: the run has surveyed the monorepo and the
|
|
40
|
+
* reference template and is holding on a human's adoption decisions. It is NOT terminal and it
|
|
41
|
+
* is not `running` either: nothing is executing, so a sweeper must not treat it as a dropped
|
|
42
|
+
* run, and a caller polling for completion must not treat it as one. It waits indefinitely by
|
|
43
|
+
* design (see `awaiting_review` in `docs/initiatives/monorepo-service-bootstrap.md`).
|
|
44
|
+
*/
|
|
45
|
+
export declare const bootstrapStatusSchema: v.PicklistSchema<["pending", "running", "awaiting_review", "succeeded", "failed"], undefined>;
|
|
38
46
|
export type BootstrapStatus = v.InferOutput<typeof bootstrapStatusSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* Which half of a monorepo bootstrap a run is in. Null for a plain new-repo bootstrap, which
|
|
49
|
+
* is one phase and has no adoption decision to make.
|
|
50
|
+
*
|
|
51
|
+
* - `survey`: read both sides, produce the adoption plan, park for review.
|
|
52
|
+
* - `apply`: write the service into the monorepo under the settled plan and open a PR.
|
|
53
|
+
*/
|
|
54
|
+
export declare const bootstrapPhaseSchema: v.PicklistSchema<["survey", "apply"], undefined>;
|
|
55
|
+
export type BootstrapPhase = v.InferOutput<typeof bootstrapPhaseSchema>;
|
|
56
|
+
/**
|
|
57
|
+
* Bootstrap INTO an existing monorepo instead of into a new repository of its own.
|
|
58
|
+
*
|
|
59
|
+
* The target is a repository the workspace already projects (so it is already reachable, and
|
|
60
|
+
* its `isMonorepo` flag is already the board's) plus the subdirectory the new service will
|
|
61
|
+
* live in. There is no repo creation and no force-push: the run opens a pull request against
|
|
62
|
+
* the monorepo's default branch, which is the only shape that is safe against a repository
|
|
63
|
+
* holding other people's services.
|
|
64
|
+
*/
|
|
65
|
+
export declare const monorepoBootstrapTargetSchema: v.ObjectSchema<{
|
|
66
|
+
/** The monorepo's numeric VCS id, as the workspace's repo projection lists it. */
|
|
67
|
+
readonly repoGithubId: v.NumberSchema<undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* The new service's subdirectory, relative to the repo root (e.g. `services/billing`).
|
|
70
|
+
* Must not already exist: a bootstrap writes a service, it never merges into one.
|
|
71
|
+
*/
|
|
72
|
+
readonly directory: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 400, undefined>]>;
|
|
73
|
+
}, undefined>;
|
|
74
|
+
export type MonorepoBootstrapTarget = v.InferOutput<typeof monorepoBootstrapTargetSchema>;
|
|
75
|
+
/** The resolved monorepo target as a run reports it (the input plus what it resolved to). */
|
|
76
|
+
export declare const monorepoBootstrapRefSchema: v.ObjectSchema<{
|
|
77
|
+
readonly repoGithubId: v.NumberSchema<undefined>;
|
|
78
|
+
readonly directory: v.StringSchema<undefined>;
|
|
79
|
+
/** Owner of the monorepo, resolved from the projection at start. */
|
|
80
|
+
readonly repoOwner: v.StringSchema<undefined>;
|
|
81
|
+
/** Name of the monorepo, resolved from the projection at start. */
|
|
82
|
+
readonly repoName: v.StringSchema<undefined>;
|
|
83
|
+
/** The branch the run pushes its work to; null until the apply phase dispatches. */
|
|
84
|
+
readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
85
|
+
}, undefined>;
|
|
86
|
+
export type MonorepoBootstrapRef = v.InferOutput<typeof monorepoBootstrapRefSchema>;
|
|
39
87
|
/**
|
|
40
88
|
* How a bootstrap run faulted, so the board can classify the failure (and decide
|
|
41
89
|
* whether a retry is likely to help):
|
|
@@ -91,7 +139,7 @@ export declare const bootstrapJobSchema: v.ObjectSchema<{
|
|
|
91
139
|
readonly repoUrl: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
92
140
|
/** Effective bootstrapper instructions (defaults + per-run), for transparency. */
|
|
93
141
|
readonly instructions: v.StringSchema<undefined>;
|
|
94
|
-
readonly status: v.PicklistSchema<["pending", "running", "succeeded", "failed"], undefined>;
|
|
142
|
+
readonly status: v.PicklistSchema<["pending", "running", "awaiting_review", "succeeded", "failed"], undefined>;
|
|
95
143
|
/**
|
|
96
144
|
* The board service frame this run materialises. Created up front (in
|
|
97
145
|
* `running` state) so the bootstrap shows on the board immediately as a
|
|
@@ -135,6 +183,67 @@ export declare const bootstrapJobSchema: v.ObjectSchema<{
|
|
|
135
183
|
}, undefined>, undefined>;
|
|
136
184
|
readonly stepIndex: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
137
185
|
}, undefined>, undefined>;
|
|
186
|
+
/**
|
|
187
|
+
* The monorepo this run is bootstrapping a service INTO, or null for a run that creates a
|
|
188
|
+
* repository of its own. Its presence is what puts the run on the two-phase, human-reviewed
|
|
189
|
+
* path; every other field below is null on a new-repo run.
|
|
190
|
+
*/
|
|
191
|
+
readonly monorepo: v.NullableSchema<v.ObjectSchema<{
|
|
192
|
+
readonly repoGithubId: v.NumberSchema<undefined>;
|
|
193
|
+
readonly directory: v.StringSchema<undefined>;
|
|
194
|
+
/** Owner of the monorepo, resolved from the projection at start. */
|
|
195
|
+
readonly repoOwner: v.StringSchema<undefined>;
|
|
196
|
+
/** Name of the monorepo, resolved from the projection at start. */
|
|
197
|
+
readonly repoName: v.StringSchema<undefined>;
|
|
198
|
+
/** The branch the run pushes its work to; null until the apply phase dispatches. */
|
|
199
|
+
readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
200
|
+
}, undefined>, undefined>;
|
|
201
|
+
/** Which half of the monorepo flow the run is in; null on a new-repo run. */
|
|
202
|
+
readonly phase: v.NullableSchema<v.PicklistSchema<["survey", "apply"], undefined>, undefined>;
|
|
203
|
+
/** The suggestion the human is reviewing (or the stated reason there is none). */
|
|
204
|
+
readonly adoptionPlan: v.NullableSchema<v.ObjectSchema<{
|
|
205
|
+
readonly status: v.PicklistSchema<["ready", "unavailable"], undefined>;
|
|
206
|
+
readonly unavailableReason: v.NullableSchema<v.PicklistSchema<["model_unavailable", "repo_unreadable", "budget_exhausted", "analysis_unusable"], undefined>, undefined>;
|
|
207
|
+
readonly unavailableDetail: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
208
|
+
readonly survey: v.ObjectSchema<{
|
|
209
|
+
readonly monorepoPaths: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>;
|
|
210
|
+
readonly templatePaths: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>;
|
|
211
|
+
readonly unreadablePaths: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>;
|
|
212
|
+
readonly siblingService: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>;
|
|
213
|
+
}, undefined>;
|
|
214
|
+
readonly decisions: v.ArraySchema<v.ObjectSchema<{
|
|
215
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
|
|
216
|
+
readonly area: v.PicklistSchema<["build-tooling", "dependencies", "lint-format", "typecheck", "testing", "ci", "containerization", "runtime-config", "observability", "source-layout", "docs", "other"], undefined>;
|
|
217
|
+
readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
|
|
218
|
+
readonly monorepoPractice: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
219
|
+
readonly templatePractice: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
220
|
+
readonly recommended: v.PicklistSchema<["monorepo", "template", "both", "neither"], undefined>;
|
|
221
|
+
readonly rationale: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 600, undefined>]>;
|
|
222
|
+
readonly evidence: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>;
|
|
223
|
+
}, undefined>, undefined>;
|
|
224
|
+
readonly droppedUnevidenced: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>, v.MaxLengthAction<string[], number, undefined>]>;
|
|
225
|
+
readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
226
|
+
readonly generatedAt: v.NumberSchema<undefined>;
|
|
227
|
+
}, undefined>, undefined>;
|
|
228
|
+
/** What the human settled; null until the review is submitted. */
|
|
229
|
+
readonly adoptionReview: v.NullableSchema<v.ObjectSchema<{
|
|
230
|
+
readonly decisions: v.ArraySchema<v.ObjectSchema<{
|
|
231
|
+
readonly id: v.StringSchema<undefined>;
|
|
232
|
+
readonly area: v.PicklistSchema<["build-tooling", "dependencies", "lint-format", "typecheck", "testing", "ci", "containerization", "runtime-config", "observability", "source-layout", "docs", "other"], undefined>;
|
|
233
|
+
readonly title: v.StringSchema<undefined>;
|
|
234
|
+
readonly choice: v.PicklistSchema<["monorepo", "template", "both", "neither"], undefined>;
|
|
235
|
+
readonly overrodeRecommendation: v.BooleanSchema<undefined>;
|
|
236
|
+
readonly note: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
237
|
+
}, undefined>, undefined>;
|
|
238
|
+
readonly notes: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
239
|
+
readonly reviewedByUserId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
240
|
+
readonly reviewedAt: v.NumberSchema<undefined>;
|
|
241
|
+
}, undefined>, undefined>;
|
|
242
|
+
/**
|
|
243
|
+
* The pull request the apply phase opened against the monorepo; null until it does.
|
|
244
|
+
* A monorepo bootstrap's deliverable IS a PR: nothing is merged for the reviewer.
|
|
245
|
+
*/
|
|
246
|
+
readonly prUrl: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
138
247
|
readonly createdAt: v.NumberSchema<undefined>;
|
|
139
248
|
readonly updatedAt: v.NumberSchema<undefined>;
|
|
140
249
|
}, undefined>;
|
|
@@ -150,8 +259,26 @@ export type BootstrapJob = v.InferOutput<typeof bootstrapJobSchema>;
|
|
|
150
259
|
export declare const bootstrapRepoSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
151
260
|
/** Reference architecture to clone from; omit to bootstrap from a freeform prompt. */
|
|
152
261
|
readonly referenceArchitectureId: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, undefined>;
|
|
153
|
-
/**
|
|
262
|
+
/**
|
|
263
|
+
* Name of the thing being created: the new REPOSITORY on a plain run, and the new SERVICE
|
|
264
|
+
* (the board frame's title, and the default leaf of its directory) on a monorepo run.
|
|
265
|
+
*/
|
|
154
266
|
readonly repoName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, "Only letters, digits, '.', '_' and '-' are allowed">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
|
|
267
|
+
/**
|
|
268
|
+
* Bootstrap into an existing monorepo at this subdirectory instead of creating a new
|
|
269
|
+
* repository. Present ⇒ the run is two-phase: it surveys the monorepo and the reference
|
|
270
|
+
* template, parks on `awaiting_review` with an adoption plan, and only writes the service
|
|
271
|
+
* once a human has settled it.
|
|
272
|
+
*/
|
|
273
|
+
readonly monorepo: v.OptionalSchema<v.ObjectSchema<{
|
|
274
|
+
/** The monorepo's numeric VCS id, as the workspace's repo projection lists it. */
|
|
275
|
+
readonly repoGithubId: v.NumberSchema<undefined>;
|
|
276
|
+
/**
|
|
277
|
+
* The new service's subdirectory, relative to the repo root (e.g. `services/billing`).
|
|
278
|
+
* Must not already exist: a bootstrap writes a service, it never merges into one.
|
|
279
|
+
*/
|
|
280
|
+
readonly directory: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 400, undefined>]>;
|
|
281
|
+
}, undefined>, undefined>;
|
|
155
282
|
/**
|
|
156
283
|
* The repository role for the bootstrapped frame (backend service / frontend / library /
|
|
157
284
|
* document repository). Omitted → `service`, so existing callers are unchanged.
|
|
@@ -169,6 +296,10 @@ export declare const bootstrapRepoSchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
169
296
|
}, undefined>, v.CheckAction<{
|
|
170
297
|
referenceArchitectureId?: string | null | undefined;
|
|
171
298
|
repoName: string;
|
|
299
|
+
monorepo?: {
|
|
300
|
+
repoGithubId: number;
|
|
301
|
+
directory: string;
|
|
302
|
+
} | undefined;
|
|
172
303
|
type?: "document" | "frontend" | "library" | "service" | undefined;
|
|
173
304
|
description: string;
|
|
174
305
|
private: boolean;
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAoC5B,iEAAiE;AACjE,eAAO,MAAM,2BAA2B;;;;;IAKtC,mDAAmD;;IAEnD,8DAA8D;;IAE9D,gFAAgF;;;;aAIhF,CAAA;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAErF,6CAA6C;AAC7C,eAAO,MAAM,iCAAiC;;;;;;aAM5C,CAAA;AACF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,WAAW,CAC1D,OAAO,iCAAiC,CACzC,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,iCAAiC;;;;;;aAM5C,CAAA;AACF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,WAAW,CAC1D,OAAO,iCAAiC,CACzC,CAAA;AAID;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,+FAMhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,kDAAkC,CAAA;AACnE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B;IACxC,kFAAkF;;IAElF;;;OAGG;;aAEH,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,O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GG;;;;;;;;;;;;;oFAON,CAAA;AACD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
import { agentFailureSchema, stepSubtasksSchema } from './execution.js';
|
|
3
|
+
import { adoptionPlanSchema, resolvedAdoptionSchema } from './monorepo-adoption.js';
|
|
3
4
|
import { frameRepoTypeSchema } from './primitives.js';
|
|
4
5
|
// ---------------------------------------------------------------------------
|
|
5
6
|
// Repo-bootstrap wire contracts. A "reference architecture" is a named base repo
|
|
@@ -55,8 +56,59 @@ export const updateReferenceArchitectureSchema = v.object({
|
|
|
55
56
|
defaultInstructions: v.optional(instructionsField),
|
|
56
57
|
});
|
|
57
58
|
// ---- Bootstrap jobs --------------------------------------------------------
|
|
58
|
-
/**
|
|
59
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Lifecycle of a single "bootstrap repo" run.
|
|
61
|
+
*
|
|
62
|
+
* `awaiting_review` is the monorepo flow's park: the run has surveyed the monorepo and the
|
|
63
|
+
* reference template and is holding on a human's adoption decisions. It is NOT terminal and it
|
|
64
|
+
* is not `running` either: nothing is executing, so a sweeper must not treat it as a dropped
|
|
65
|
+
* run, and a caller polling for completion must not treat it as one. It waits indefinitely by
|
|
66
|
+
* design (see `awaiting_review` in `docs/initiatives/monorepo-service-bootstrap.md`).
|
|
67
|
+
*/
|
|
68
|
+
export const bootstrapStatusSchema = v.picklist([
|
|
69
|
+
'pending',
|
|
70
|
+
'running',
|
|
71
|
+
'awaiting_review',
|
|
72
|
+
'succeeded',
|
|
73
|
+
'failed',
|
|
74
|
+
]);
|
|
75
|
+
/**
|
|
76
|
+
* Which half of a monorepo bootstrap a run is in. Null for a plain new-repo bootstrap, which
|
|
77
|
+
* is one phase and has no adoption decision to make.
|
|
78
|
+
*
|
|
79
|
+
* - `survey`: read both sides, produce the adoption plan, park for review.
|
|
80
|
+
* - `apply`: write the service into the monorepo under the settled plan and open a PR.
|
|
81
|
+
*/
|
|
82
|
+
export const bootstrapPhaseSchema = v.picklist(['survey', 'apply']);
|
|
83
|
+
/**
|
|
84
|
+
* Bootstrap INTO an existing monorepo instead of into a new repository of its own.
|
|
85
|
+
*
|
|
86
|
+
* The target is a repository the workspace already projects (so it is already reachable, and
|
|
87
|
+
* its `isMonorepo` flag is already the board's) plus the subdirectory the new service will
|
|
88
|
+
* live in. There is no repo creation and no force-push: the run opens a pull request against
|
|
89
|
+
* the monorepo's default branch, which is the only shape that is safe against a repository
|
|
90
|
+
* holding other people's services.
|
|
91
|
+
*/
|
|
92
|
+
export const monorepoBootstrapTargetSchema = v.object({
|
|
93
|
+
/** The monorepo's numeric VCS id, as the workspace's repo projection lists it. */
|
|
94
|
+
repoGithubId: v.number(),
|
|
95
|
+
/**
|
|
96
|
+
* The new service's subdirectory, relative to the repo root (e.g. `services/billing`).
|
|
97
|
+
* Must not already exist: a bootstrap writes a service, it never merges into one.
|
|
98
|
+
*/
|
|
99
|
+
directory: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(400)),
|
|
100
|
+
});
|
|
101
|
+
/** The resolved monorepo target as a run reports it (the input plus what it resolved to). */
|
|
102
|
+
export const monorepoBootstrapRefSchema = v.object({
|
|
103
|
+
repoGithubId: v.number(),
|
|
104
|
+
directory: v.string(),
|
|
105
|
+
/** Owner of the monorepo, resolved from the projection at start. */
|
|
106
|
+
repoOwner: v.string(),
|
|
107
|
+
/** Name of the monorepo, resolved from the projection at start. */
|
|
108
|
+
repoName: v.string(),
|
|
109
|
+
/** The branch the run pushes its work to; null until the apply phase dispatches. */
|
|
110
|
+
branch: v.nullable(v.string()),
|
|
111
|
+
});
|
|
60
112
|
/**
|
|
61
113
|
* How a bootstrap run faulted, so the board can classify the failure (and decide
|
|
62
114
|
* whether a retry is likely to help):
|
|
@@ -120,6 +172,23 @@ export const bootstrapJobSchema = v.object({
|
|
|
120
172
|
error: v.nullable(v.string()),
|
|
121
173
|
/** Structured failure diagnostics when `status` is `failed`; null otherwise. */
|
|
122
174
|
failure: v.nullable(bootstrapFailureSchema),
|
|
175
|
+
/**
|
|
176
|
+
* The monorepo this run is bootstrapping a service INTO, or null for a run that creates a
|
|
177
|
+
* repository of its own. Its presence is what puts the run on the two-phase, human-reviewed
|
|
178
|
+
* path; every other field below is null on a new-repo run.
|
|
179
|
+
*/
|
|
180
|
+
monorepo: v.nullable(monorepoBootstrapRefSchema),
|
|
181
|
+
/** Which half of the monorepo flow the run is in; null on a new-repo run. */
|
|
182
|
+
phase: v.nullable(bootstrapPhaseSchema),
|
|
183
|
+
/** The suggestion the human is reviewing (or the stated reason there is none). */
|
|
184
|
+
adoptionPlan: v.nullable(adoptionPlanSchema),
|
|
185
|
+
/** What the human settled; null until the review is submitted. */
|
|
186
|
+
adoptionReview: v.nullable(resolvedAdoptionSchema),
|
|
187
|
+
/**
|
|
188
|
+
* The pull request the apply phase opened against the monorepo; null until it does.
|
|
189
|
+
* A monorepo bootstrap's deliverable IS a PR: nothing is merged for the reviewer.
|
|
190
|
+
*/
|
|
191
|
+
prUrl: v.nullable(v.string()),
|
|
123
192
|
createdAt: v.number(),
|
|
124
193
|
updatedAt: v.number(),
|
|
125
194
|
});
|
|
@@ -134,8 +203,18 @@ export const bootstrapJobSchema = v.object({
|
|
|
134
203
|
export const bootstrapRepoSchema = v.pipe(v.object({
|
|
135
204
|
/** Reference architecture to clone from; omit to bootstrap from a freeform prompt. */
|
|
136
205
|
referenceArchitectureId: v.optional(v.nullable(v.pipe(v.string(), v.minLength(1)))),
|
|
137
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Name of the thing being created: the new REPOSITORY on a plain run, and the new SERVICE
|
|
208
|
+
* (the board frame's title, and the default leaf of its directory) on a monorepo run.
|
|
209
|
+
*/
|
|
138
210
|
repoName: slugField,
|
|
211
|
+
/**
|
|
212
|
+
* Bootstrap into an existing monorepo at this subdirectory instead of creating a new
|
|
213
|
+
* repository. Present ⇒ the run is two-phase: it surveys the monorepo and the reference
|
|
214
|
+
* template, parks on `awaiting_review` with an adoption plan, and only writes the service
|
|
215
|
+
* once a human has settled it.
|
|
216
|
+
*/
|
|
217
|
+
monorepo: v.optional(monorepoBootstrapTargetSchema),
|
|
139
218
|
/**
|
|
140
219
|
* The repository role for the bootstrapped frame (backend service / frontend / library /
|
|
141
220
|
* document repository). Omitted → `service`, so existing callers are unchanged.
|
package/dist/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,8EAA8E;AAC9E,iFAAiF;AACjF,iFAAiF;AACjF,iFAAiF;AACjF,0EAA0E;AAC1E,0EAA0E;AAC1E,gFAAgF;AAChF,EAAE;AACF,mCAAmC;AACnC,+EAA+E;AAC/E,iFAAiF;AACjF,8EAA8E;AAE9E,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;AAChF;;;;GAIG;AACH,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CACtB,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,IAAI,EAAE,EACR,CAAC,CAAC,KAAK,CAAC,mBAAmB,EAAE,oDAAoD,CAAC,EAClF,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACd,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CACjB,CAAA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tC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,iBAAiB,EAAE,EAAE,CAAC;CAChD,CAAC,EACF,CAAC,CAAC,KAAK,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EACzF,8EAA8E,CAC/E,CACF,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
/**
|
|
3
|
-
* One
|
|
3
|
+
* One place a provider states traffic for its environment's URL host goes: an ADDRESS the platform
|
|
4
|
+
* dials as written, or a NAME it resolves when it dials.
|
|
4
5
|
*
|
|
5
6
|
* The motivating shape is an org running per-PR preview environments whose per-environment DNS
|
|
6
7
|
* record lives in an internal view while the load balancers fronting it are ordinary names and
|
|
@@ -8,16 +9,74 @@ import * as v from 'valibot';
|
|
|
8
9
|
* it. The only missing thing is a name-to-address mapping, which is exactly what a hosts-file
|
|
9
10
|
* entry (or a Kubernetes `hostAliases` entry) is.
|
|
10
11
|
*
|
|
12
|
+
* **Exactly one of {@link EnvironmentRouteCandidate.address} and
|
|
13
|
+
* {@link EnvironmentRouteCandidate.host} is set, and which one is the PROVIDER'S statement**, never
|
|
14
|
+
* something the platform reads off the spelling. Guessing would rest the security rule on a parse:
|
|
15
|
+
* `isBridgeableAddress` refuses a non-canonical literal precisely so `2130706433` cannot become
|
|
16
|
+
* loopback, and a resolver handed that same string answers loopback happily. A candidate stating
|
|
17
|
+
* neither (or both, which is two claims with no way to tell which was meant) therefore names no
|
|
18
|
+
* target at all and is RECORDED as one, on the same rule as an address no bridge may name.
|
|
19
|
+
*
|
|
11
20
|
* `label` is for the human reading a diagnostic ("internal ALB", "public ALB"), never for
|
|
12
21
|
* matching: the platform picks by PROBING, never by name.
|
|
13
22
|
*/
|
|
14
|
-
export declare const
|
|
15
|
-
/** An IP literal. Never a name:
|
|
16
|
-
readonly address: v.StringSchema<undefined>;
|
|
17
|
-
/**
|
|
23
|
+
export declare const environmentRouteCandidateSchema: v.ObjectSchema<{
|
|
24
|
+
/** An IP literal, dialled as written. Never a name: see {@link EnvironmentRouteCandidate.host}. */
|
|
25
|
+
readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* A NAME the platform RESOLVES at proof time, expanding it in place into the addresses it
|
|
28
|
+
* answers with.
|
|
29
|
+
*
|
|
30
|
+
* For the provider whose stable identity IS a name, which is the ordinary shape of a managed
|
|
31
|
+
* load balancer: an ALB's addresses change as it scales or gains a zone, and its DNS name is
|
|
32
|
+
* what the vendor documents a client should use. A provider stating the resolved literals
|
|
33
|
+
* instead re-pins a snapshot of that set on every poll, and owes bounded resolution, stable
|
|
34
|
+
* ordering and partial-failure handling of its own.
|
|
35
|
+
*
|
|
36
|
+
* Deliberately NOT the URL's own host, which is the lookup that already failed. This is a
|
|
37
|
+
* DIFFERENT name in a different zone, and its whole point is resolving when that one does not.
|
|
38
|
+
* Nothing downstream ever sees it: every address it resolves to is graded by
|
|
39
|
+
* `isBridgeableAddress` exactly as a stated address is, and the proof publishes the ADDRESS that
|
|
40
|
+
* carried with the name it came from beside it, so a bridge is still built from a literal the
|
|
41
|
+
* platform itself proved.
|
|
42
|
+
*/
|
|
43
|
+
readonly host: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
44
|
+
/** What this candidate IS, for the diagnostic. Never load-bearing. */
|
|
18
45
|
readonly label: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
19
46
|
}, undefined>;
|
|
20
|
-
export type
|
|
47
|
+
export type EnvironmentRouteCandidate = v.InferOutput<typeof environmentRouteCandidateSchema>;
|
|
48
|
+
/**
|
|
49
|
+
* What one candidate actually names, or that it names nothing usable.
|
|
50
|
+
*
|
|
51
|
+
* A discriminated result rather than two optional reads at every site, because the three cases
|
|
52
|
+
* want three different reactions and the third is the one a nullable read renders as absent. Read
|
|
53
|
+
* through this rather than off the fields, so "which kind is this" is answered once.
|
|
54
|
+
*/
|
|
55
|
+
export type StatedRouteTarget = {
|
|
56
|
+
kind: 'address';
|
|
57
|
+
address: string;
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'host';
|
|
60
|
+
host: string;
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'unusable';
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Read a stated candidate as the one thing it names.
|
|
66
|
+
*
|
|
67
|
+
* A host is lower-cased because DNS is case-insensitive and this value is both a map key and a
|
|
68
|
+
* comparison target: two spellings of one balancer name must not resolve twice, nor invalidate a
|
|
69
|
+
* proof by failing to match themselves.
|
|
70
|
+
*/
|
|
71
|
+
export declare function statedRouteTarget(candidate: EnvironmentRouteCandidate): StatedRouteTarget;
|
|
72
|
+
/**
|
|
73
|
+
* One candidate as a reader sees it: its value, its label, and a NAME marked as one.
|
|
74
|
+
*
|
|
75
|
+
* ONE renderer, because three surfaces print this list (the environment investigation's route
|
|
76
|
+
* section, its timeline entry and the diagnostics bundle) and a name printed into a sentence about
|
|
77
|
+
* "the addresses the provider stated" reads as an address somebody typed wrong.
|
|
78
|
+
*/
|
|
79
|
+
export declare function describeRouteCandidate(candidate: EnvironmentRouteCandidate): string;
|
|
21
80
|
/**
|
|
22
81
|
* Why a `ready` environment could not be reached, at the layer the platform can observe.
|
|
23
82
|
*
|
|
@@ -29,20 +88,33 @@ export type EnvironmentAddress = v.InferOutput<typeof environmentAddressSchema>;
|
|
|
29
88
|
*
|
|
30
89
|
* - `no_candidate` the environment carries no URL, or one with no host to probe. There
|
|
31
90
|
* was nothing to try, which is not the same as trying and failing.
|
|
32
|
-
* - `name_unresolved` the URL's host
|
|
91
|
+
* - `name_unresolved` a name resolved nowhere: the URL's own host, with no stated candidate
|
|
92
|
+
* carrying either, or one stated NAME whose own lookup answered nothing.
|
|
33
93
|
* - `no_route` something resolved and the connect never completed (timeout,
|
|
34
94
|
* host/network unreachable). The expensive failure: a lookup that
|
|
35
95
|
* worked followed by a connect that hangs.
|
|
36
96
|
* - `connection_refused` the route carries and nothing is listening on the port.
|
|
37
|
-
* - `address_refused` the provider stated
|
|
38
|
-
* link-local/vendor
|
|
39
|
-
*
|
|
40
|
-
*
|
|
97
|
+
* - `address_refused` the provider stated a target the platform will not dial: a loopback,
|
|
98
|
+
* link-local/vendor-metadata or non-canonical address (whether stated or
|
|
99
|
+
* resolved from a stated name), or a candidate naming no single target at
|
|
100
|
+
* all. Recorded as an attempt rather than dropped, because a refused input
|
|
101
|
+
* is an omission the operator has to be able to see.
|
|
102
|
+
* - `resolver_unavailable` the provider stated a NAME and nothing in this deployment can turn one
|
|
103
|
+
* into an address. An admission about the PLATFORM, never a verdict about
|
|
104
|
+
* the environment, so it leaves the route unruled-out exactly as
|
|
105
|
+
* `probe_failed` does.
|
|
106
|
+
* - `not_attempted` the platform stopped short of the list its provider stated: it looks up
|
|
107
|
+
* a bounded number of names and dials a bounded number of addresses, so a
|
|
108
|
+
* longer list is a PREFIX. Recorded ONCE, naming how many were passed
|
|
109
|
+
* over, because a reader who assumes a prefix concludes the tail was
|
|
110
|
+
* never stated. Another admission about the PLATFORM: a candidate nothing
|
|
111
|
+
* looked at cannot be part of a verdict that nothing reaches the
|
|
112
|
+
* environment.
|
|
41
113
|
* - `probe_failed` the probe itself errored in a way it could not classify. Kept apart
|
|
42
114
|
* from the three above so "we could not tell" never renders as a
|
|
43
115
|
* verdict about the environment.
|
|
44
116
|
*/
|
|
45
|
-
export declare const environmentUnreachableReasonSchema: v.PicklistSchema<["no_candidate", "name_unresolved", "no_route", "connection_refused", "address_refused", "probe_failed"], undefined>;
|
|
117
|
+
export declare const environmentUnreachableReasonSchema: v.PicklistSchema<["no_candidate", "name_unresolved", "no_route", "connection_refused", "address_refused", "resolver_unavailable", "not_attempted", "probe_failed"], undefined>;
|
|
46
118
|
export type EnvironmentUnreachableReason = v.InferOutput<typeof environmentUnreachableReasonSchema>;
|
|
47
119
|
/** One target the proof tried, in the order it was tried, and what came back. */
|
|
48
120
|
export declare const environmentRouteAttemptSchema: v.ObjectSchema<{
|
|
@@ -93,6 +165,21 @@ export declare const environmentRouteProofSchema: v.ObjectSchema<{
|
|
|
93
165
|
* then points further from the cause than no bridge at all did.
|
|
94
166
|
*/
|
|
95
167
|
readonly via: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
168
|
+
/**
|
|
169
|
+
* The stated NAME {@link via} was resolved from, when the candidate that carried was a host
|
|
170
|
+
* rather than an address. Absent when `via` is itself a stated address, when the URL's own name
|
|
171
|
+
* carried, and when nothing carried.
|
|
172
|
+
*
|
|
173
|
+
* Recorded because the fold decides a `reached` proof's survival on whether the target it names
|
|
174
|
+
* is still on offer, and for a resolved name that target is the NAME. The address is a snapshot
|
|
175
|
+
* of a set that rotates (a balancer scaling or gaining a zone changes it, and tells the platform
|
|
176
|
+
* nothing about whether the proved route still carries), so matching `via` against the candidate
|
|
177
|
+
* list would drop a good proof on every such event and pay a fresh probe sequence for it.
|
|
178
|
+
*
|
|
179
|
+
* Optional so a proof written before this existed still parses, where its absence reads as the
|
|
180
|
+
* address case, which is what it was.
|
|
181
|
+
*/
|
|
182
|
+
readonly viaHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
96
183
|
/**
|
|
97
184
|
* The {@link EnvironmentUnreachableReason} when `state` is `not_reached` or `inconclusive`,
|
|
98
185
|
* else null. An open string on the wire so a stored proof written by an older build never fails
|
|
@@ -130,11 +217,32 @@ export type EnvironmentRouteProof = v.InferOutput<typeof environmentRouteProofSc
|
|
|
130
217
|
* offered as well as which were reached, and a re-probe on a later poll re-reads the same claim.
|
|
131
218
|
*/
|
|
132
219
|
export declare const environmentReachabilitySchema: v.ObjectSchema<{
|
|
133
|
-
/**
|
|
220
|
+
/**
|
|
221
|
+
* The addresses and names the provider states carry traffic for the URL's host, in ITS
|
|
222
|
+
* preference order.
|
|
223
|
+
*/
|
|
134
224
|
readonly candidates: v.ArraySchema<v.ObjectSchema<{
|
|
135
|
-
/** An IP literal. Never a name:
|
|
136
|
-
readonly address: v.StringSchema<undefined>;
|
|
137
|
-
/**
|
|
225
|
+
/** An IP literal, dialled as written. Never a name: see {@link EnvironmentRouteCandidate.host}. */
|
|
226
|
+
readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
227
|
+
/**
|
|
228
|
+
* A NAME the platform RESOLVES at proof time, expanding it in place into the addresses it
|
|
229
|
+
* answers with.
|
|
230
|
+
*
|
|
231
|
+
* For the provider whose stable identity IS a name, which is the ordinary shape of a managed
|
|
232
|
+
* load balancer: an ALB's addresses change as it scales or gains a zone, and its DNS name is
|
|
233
|
+
* what the vendor documents a client should use. A provider stating the resolved literals
|
|
234
|
+
* instead re-pins a snapshot of that set on every poll, and owes bounded resolution, stable
|
|
235
|
+
* ordering and partial-failure handling of its own.
|
|
236
|
+
*
|
|
237
|
+
* Deliberately NOT the URL's own host, which is the lookup that already failed. This is a
|
|
238
|
+
* DIFFERENT name in a different zone, and its whole point is resolving when that one does not.
|
|
239
|
+
* Nothing downstream ever sees it: every address it resolves to is graded by
|
|
240
|
+
* `isBridgeableAddress` exactly as a stated address is, and the proof publishes the ADDRESS that
|
|
241
|
+
* carried with the name it came from beside it, so a bridge is still built from a literal the
|
|
242
|
+
* platform itself proved.
|
|
243
|
+
*/
|
|
244
|
+
readonly host: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
245
|
+
/** What this candidate IS, for the diagnostic. Never load-bearing. */
|
|
138
246
|
readonly label: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
139
247
|
}, undefined>, undefined>;
|
|
140
248
|
/** What proving found, or null when nothing has probed this environment yet. */
|
|
@@ -150,6 +258,21 @@ export declare const environmentReachabilitySchema: v.ObjectSchema<{
|
|
|
150
258
|
* then points further from the cause than no bridge at all did.
|
|
151
259
|
*/
|
|
152
260
|
readonly via: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
261
|
+
/**
|
|
262
|
+
* The stated NAME {@link via} was resolved from, when the candidate that carried was a host
|
|
263
|
+
* rather than an address. Absent when `via` is itself a stated address, when the URL's own name
|
|
264
|
+
* carried, and when nothing carried.
|
|
265
|
+
*
|
|
266
|
+
* Recorded because the fold decides a `reached` proof's survival on whether the target it names
|
|
267
|
+
* is still on offer, and for a resolved name that target is the NAME. The address is a snapshot
|
|
268
|
+
* of a set that rotates (a balancer scaling or gaining a zone changes it, and tells the platform
|
|
269
|
+
* nothing about whether the proved route still carries), so matching `via` against the candidate
|
|
270
|
+
* list would drop a good proof on every such event and pay a fresh probe sequence for it.
|
|
271
|
+
*
|
|
272
|
+
* Optional so a proof written before this existed still parses, where its absence reads as the
|
|
273
|
+
* address case, which is what it was.
|
|
274
|
+
*/
|
|
275
|
+
readonly viaHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
153
276
|
/**
|
|
154
277
|
* The {@link EnvironmentUnreachableReason} when `state` is `not_reached` or `inconclusive`,
|
|
155
278
|
* else null. An open string on the wire so a stored proof written by an older build never fails
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-reachability.d.ts","sourceRoot":"","sources":["../src/environment-reachability.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B
|
|
1
|
+
{"version":3,"file":"environment-reachability.d.ts","sourceRoot":"","sources":["../src/environment-reachability.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,+BAA+B;IAC1C,mGAAmG;;IAEnG;;;;;;;;;;;;;;;;OAgBG;;IAEH,sEAAsE;;aAEtE,CAAA;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAC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