@cat-factory/contracts 0.284.0 → 0.286.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/agent-presentation.d.ts +32 -2
- package/dist/agent-presentation.d.ts.map +1 -1
- package/dist/agent-presentation.js +15 -0
- package/dist/agent-presentation.js.map +1 -1
- package/dist/binary-candidates.d.ts +261 -0
- package/dist/binary-candidates.d.ts.map +1 -0
- package/dist/binary-candidates.js +202 -0
- package/dist/binary-candidates.js.map +1 -0
- package/dist/binary-capabilities.d.ts +393 -0
- package/dist/binary-capabilities.d.ts.map +1 -0
- package/dist/binary-capabilities.js +465 -0
- package/dist/binary-capabilities.js.map +1 -0
- package/dist/binary-generators.d.ts +27 -0
- package/dist/binary-generators.d.ts.map +1 -1
- package/dist/binary-generators.js +28 -0
- package/dist/binary-generators.js.map +1 -1
- package/dist/binary-modalities.d.ts +18 -0
- package/dist/binary-modalities.d.ts.map +1 -1
- package/dist/binary-modalities.js +28 -0
- package/dist/binary-modalities.js.map +1 -1
- package/dist/binary-outputs.d.ts +69 -0
- package/dist/binary-outputs.d.ts.map +1 -1
- package/dist/binary-outputs.js +46 -0
- package/dist/binary-outputs.js.map +1 -1
- package/dist/build-ladder.d.ts +37 -0
- package/dist/build-ladder.d.ts.map +1 -0
- package/dist/build-ladder.js +46 -0
- package/dist/build-ladder.js.map +1 -0
- package/dist/entities.d.ts +49 -0
- package/dist/entities.d.ts.map +1 -1
- package/dist/entities.js +26 -0
- package/dist/entities.js.map +1 -1
- package/dist/execution.d.ts +136 -6
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +30 -3
- package/dist/execution.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/platform-agent-kinds.d.ts +19 -0
- package/dist/platform-agent-kinds.d.ts.map +1 -0
- package/dist/platform-agent-kinds.js +30 -0
- package/dist/platform-agent-kinds.js.map +1 -0
- package/dist/requests.d.ts +27 -0
- package/dist/requests.d.ts.map +1 -1
- package/dist/requests.js +10 -0
- package/dist/requests.js.map +1 -1
- package/dist/result-views.d.ts +1 -1
- package/dist/result-views.d.ts.map +1 -1
- package/dist/result-views.js +1 -0
- package/dist/result-views.js.map +1 -1
- package/dist/routes/agent-runs.d.ts +84 -0
- package/dist/routes/agent-runs.d.ts.map +1 -1
- package/dist/routes/binaryCandidates.d.ts +139 -0
- package/dist/routes/binaryCandidates.d.ts.map +1 -0
- package/dist/routes/binaryCandidates.js +31 -0
- package/dist/routes/binaryCandidates.js.map +1 -0
- package/dist/routes/bug-hunt.d.ts +84 -0
- package/dist/routes/bug-hunt.d.ts.map +1 -1
- package/dist/routes/execution.d.ts +1523 -0
- package/dist/routes/execution.d.ts.map +1 -1
- package/dist/routes/execution.js +13 -1
- package/dist/routes/execution.js.map +1 -1
- package/dist/routes/human-review.d.ts +42 -0
- package/dist/routes/human-review.d.ts.map +1 -1
- package/dist/routes/human-test.d.ts +210 -0
- package/dist/routes/human-test.d.ts.map +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/pipelines.d.ts +70 -0
- package/dist/routes/pipelines.d.ts.map +1 -1
- package/dist/routes/visual-confirm.d.ts +126 -0
- package/dist/routes/visual-confirm.d.ts.map +1 -1
- package/dist/routes/workspaces.d.ts +108 -2
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/snapshot.d.ts +72 -9
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +18 -8
- package/dist/snapshot.js.map +1 -1
- package/dist/step-conditions.d.ts +98 -0
- package/dist/step-conditions.d.ts.map +1 -0
- package/dist/step-conditions.js +109 -0
- package/dist/step-conditions.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
/**
|
|
3
|
+
* A CAPABILITY a generative binary integration declares, as a closed vocabulary.
|
|
4
|
+
*
|
|
5
|
+
* Closed for the same reason {@link binaryModalitySchema} is: it decides things. A capability
|
|
6
|
+
* gates a per-step generation option (a control the builder shows, a paragraph the brief writes,
|
|
7
|
+
* a requirement admission refuses), so `referenceImage` and `reference-image` would be two
|
|
8
|
+
* capabilities that look identical to a reader and silently never match.
|
|
9
|
+
*
|
|
10
|
+
* **A member earns its place only when the PLATFORM exposes something because of it.** That is a
|
|
11
|
+
* higher bar than "the providers differ", and it is what keeps this from becoming the
|
|
12
|
+
* discriminator field the design record refuses (`style`, `resolutionRange`, `intendedUse`).
|
|
13
|
+
* Those were refused because they do not PARTITION a deliverable, so no predicate could be
|
|
14
|
+
* computed from them and a rule built on one would refuse correctly-configured steps by the taste
|
|
15
|
+
* of whoever wrote the picklist. A capability partitions exactly: an API either accepts an input
|
|
16
|
+
* image or it does not, either takes a mask or it does not, and the answer is a fact about the
|
|
17
|
+
* endpoint rather than an opinion about the art. So `covered` / `uncovered` is computable here,
|
|
18
|
+
* which is the same property that lets `modalities` and `mediaTypes` carry admission rules.
|
|
19
|
+
*
|
|
20
|
+
* It also decides nothing about WHICH of two integrations to call. That question stays exactly
|
|
21
|
+
* where the design record put it (the step's `generatorIds`, its format requirement, and its own
|
|
22
|
+
* prompt); this only says what may be ASKED of whichever one is called. A capability that told
|
|
23
|
+
* two producers of one modality apart without unlocking an option would be the refused
|
|
24
|
+
* discriminator wearing a new name.
|
|
25
|
+
*
|
|
26
|
+
* Anything that does not clear the bar stays prose in `description` / `guidance`, which is where
|
|
27
|
+
* "good at pixel art", "expensive above 2K" and "rate limited to 5/min" belong.
|
|
28
|
+
*/
|
|
29
|
+
export declare const binaryGeneratorCapabilitySchema: v.PicklistSchema<["reference-image", "multi-reference", "instruction-edit", "mask-edit", "negative-prompt", "seed", "aspect-ratio", "exact-size", "candidate-batch", "upscale", "transparent-background", "tileable"], undefined>;
|
|
30
|
+
export type BinaryGeneratorCapability = v.InferOutput<typeof binaryGeneratorCapabilitySchema>;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a value is still a member of the vocabulary, DERIVED from the picklist.
|
|
33
|
+
*
|
|
34
|
+
* Unlike {@link isBinaryModality} this vocabulary is not persisted on a step: capabilities are
|
|
35
|
+
* declared in a deployment's own code, so a build that retires a member also stops emitting it.
|
|
36
|
+
* The guard exists for the ONE seam where that is not true: a MOTHERSHIP-MODE node resolves its
|
|
37
|
+
* integrations from a process that may be a build AHEAD of it, so a capability this build has
|
|
38
|
+
* never heard of can arrive over `/internal/binary-generators` and reach a `Record` lookup or a
|
|
39
|
+
* `switch`. Narrow with this first and describe the negative case as the unknown value it is.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isBinaryGeneratorCapability(value: string): value is BinaryGeneratorCapability;
|
|
42
|
+
/**
|
|
43
|
+
* Where an artifact the step points a generator AT already lives: a reference image, the source
|
|
44
|
+
* of an edit, a mask.
|
|
45
|
+
*
|
|
46
|
+
* The platform deliberately does NOT fetch it. It is named to the agent in the brief, and the
|
|
47
|
+
* agent reads it exactly as it calls the generation API itself, which is the same division of
|
|
48
|
+
* labour the rest of this feature runs on: the platform states, the agent acts, and nothing here
|
|
49
|
+
* touches bytes. `service` names one of the step's own foundational services when the artifact
|
|
50
|
+
* lives in the org's estate rather than at a URL, so a private object store needs no public link.
|
|
51
|
+
*/
|
|
52
|
+
export declare const binaryAssetRefSchema: v.ObjectSchema<{
|
|
53
|
+
/** Where it lives, in `service`'s addressing when one is named, else an absolute URL. */
|
|
54
|
+
readonly location: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
55
|
+
/**
|
|
56
|
+
* The foundational service the location is addressed in. Absent ⇒ `location` is a URL the
|
|
57
|
+
* agent can fetch directly. Not validated against the step's own selection: a reference can
|
|
58
|
+
* legitimately live in a service the step does not otherwise use, and the brief names whatever
|
|
59
|
+
* is here so a wrong id is visible rather than silently dropped.
|
|
60
|
+
*/
|
|
61
|
+
readonly service: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
62
|
+
/** What this is, in the step author's words, folded into the brief verbatim. */
|
|
63
|
+
readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
|
|
64
|
+
}, undefined>;
|
|
65
|
+
export type BinaryAssetRef = v.InferOutput<typeof binaryAssetRefSchema>;
|
|
66
|
+
/**
|
|
67
|
+
* A reference image plus the ROLE it plays, because "here is an image" is not an instruction.
|
|
68
|
+
* The same file means "match this palette", "this is the character" or "start from this and
|
|
69
|
+
* change it" depending on the answer, and every one of the four reference-capable APIs takes a
|
|
70
|
+
* different parameter for each.
|
|
71
|
+
*/
|
|
72
|
+
export declare const binaryReferenceImageSchema: v.ObjectSchema<{
|
|
73
|
+
readonly location: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
74
|
+
readonly service: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
75
|
+
readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
|
|
76
|
+
readonly role: v.PicklistSchema<["style", "subject", "composition", "base"], undefined>;
|
|
77
|
+
}, undefined>;
|
|
78
|
+
export type BinaryReferenceImage = v.InferOutput<typeof binaryReferenceImageSchema>;
|
|
79
|
+
/**
|
|
80
|
+
* The step REVISES existing artifacts rather than making new ones.
|
|
81
|
+
*
|
|
82
|
+
* A named schema rather than an inline object inside the options bag below, for the reason the
|
|
83
|
+
* reference-image shape is spelled out: this nests two more object levels under an already-deep
|
|
84
|
+
* chain, and a named const is where `tsc` can stop re-instantiating it.
|
|
85
|
+
*/
|
|
86
|
+
export declare const binaryEditRequestSchema: v.ObjectSchema<{
|
|
87
|
+
/**
|
|
88
|
+
* `instruction` rewrites a whole artifact from a sentence; `mask` repaints only the region a
|
|
89
|
+
* mask names. Two capabilities, because almost no integration has both.
|
|
90
|
+
*/
|
|
91
|
+
readonly mode: v.PicklistSchema<["instruction", "mask"], undefined>;
|
|
92
|
+
/** What to change, folded into the brief verbatim. */
|
|
93
|
+
readonly instruction: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* The artifact to revise. Absent ⇒ the step's scope services say which existing asset each
|
|
96
|
+
* generation revises, which is the ordinary case for a step that re-renders an inventory.
|
|
97
|
+
*/
|
|
98
|
+
readonly source: v.OptionalSchema<v.ObjectSchema<{
|
|
99
|
+
/** Where it lives, in `service`'s addressing when one is named, else an absolute URL. */
|
|
100
|
+
readonly location: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
101
|
+
/**
|
|
102
|
+
* The foundational service the location is addressed in. Absent ⇒ `location` is a URL the
|
|
103
|
+
* agent can fetch directly. Not validated against the step's own selection: a reference can
|
|
104
|
+
* legitimately live in a service the step does not otherwise use, and the brief names whatever
|
|
105
|
+
* is here so a wrong id is visible rather than silently dropped.
|
|
106
|
+
*/
|
|
107
|
+
readonly service: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
108
|
+
/** What this is, in the step author's words, folded into the brief verbatim. */
|
|
109
|
+
readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
|
|
110
|
+
}, undefined>, undefined>;
|
|
111
|
+
/** The mask, for `mask` mode. Absent in `mask` mode is a gap the brief STATES. */
|
|
112
|
+
readonly mask: v.OptionalSchema<v.ObjectSchema<{
|
|
113
|
+
/** Where it lives, in `service`'s addressing when one is named, else an absolute URL. */
|
|
114
|
+
readonly location: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
115
|
+
/**
|
|
116
|
+
* The foundational service the location is addressed in. Absent ⇒ `location` is a URL the
|
|
117
|
+
* agent can fetch directly. Not validated against the step's own selection: a reference can
|
|
118
|
+
* legitimately live in a service the step does not otherwise use, and the brief names whatever
|
|
119
|
+
* is here so a wrong id is visible rather than silently dropped.
|
|
120
|
+
*/
|
|
121
|
+
readonly service: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
122
|
+
/** What this is, in the step author's words, folded into the brief verbatim. */
|
|
123
|
+
readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
|
|
124
|
+
}, undefined>, undefined>;
|
|
125
|
+
}, undefined>;
|
|
126
|
+
export type BinaryEditRequest = v.InferOutput<typeof binaryEditRequestSchema>;
|
|
127
|
+
/**
|
|
128
|
+
* The largest pixel extent either axis may carry: a SANITY ceiling on the field, never a claim
|
|
129
|
+
* about what any endpoint supports.
|
|
130
|
+
*
|
|
131
|
+
* Nothing here knows Flux's 4 MP cap or Retro Diffusion's per-style range, and by design nothing
|
|
132
|
+
* will: the platform checks that a step CAN be asked for dimensions (the `exact-size` capability)
|
|
133
|
+
* and states the number to the agent, which is the party holding the vendor's contract when it
|
|
134
|
+
* writes the call. Exported so the read-back that re-checks a reported dimension bounds it against
|
|
135
|
+
* the same number the write boundary does.
|
|
136
|
+
*/
|
|
137
|
+
export declare const MAX_BINARY_PIXEL_EXTENT = 16384;
|
|
138
|
+
/**
|
|
139
|
+
* Exact output DIMENSIONS in pixels, for the deliverables where the size IS the requirement.
|
|
140
|
+
*
|
|
141
|
+
* A named schema rather than an inline object, for the reason {@link binaryEditRequestSchema} is
|
|
142
|
+
* one: this nests another object level under an already-deep chain and a named const is where
|
|
143
|
+
* `tsc` stops re-instantiating it.
|
|
144
|
+
*
|
|
145
|
+
* Both members are required together: a width with no height describes no deliverable, and half a
|
|
146
|
+
* pair would let a size comparison downstream read one axis as matching.
|
|
147
|
+
*/
|
|
148
|
+
export declare const binaryOutputSizeSchema: v.ObjectSchema<{
|
|
149
|
+
readonly width: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 16384, undefined>]>;
|
|
150
|
+
readonly height: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 16384, undefined>]>;
|
|
151
|
+
}, undefined>;
|
|
152
|
+
export type BinaryOutputSize = v.InferOutput<typeof binaryOutputSizeSchema>;
|
|
153
|
+
/**
|
|
154
|
+
* The per-step GENERATION OPTIONS: the parameters a step wants every generation to carry, each
|
|
155
|
+
* gated by the capability that makes it answerable ({@link BINARY_OPTION_CAPABILITIES}).
|
|
156
|
+
*
|
|
157
|
+
* They are a statement about the WORK, exactly like `modalities` and `mediaTypes` beside them,
|
|
158
|
+
* and they are checked the same way: a step asking for something nothing it selected can do is
|
|
159
|
+
* refused at admission rather than discovering it at the end of a paid run. What they are NOT is
|
|
160
|
+
* a passthrough of any vendor's request body. Everything here is a fact about the deliverable
|
|
161
|
+
* that more than one of the registered APIs can express in its own parameters, and the agent
|
|
162
|
+
* translates it on the call it writes; a knob only one vendor has (`prompt_upsampling`,
|
|
163
|
+
* `safety_tolerance`, a sampler name) stays in that integration's `guidance`, where it can say
|
|
164
|
+
* what it means, rather than becoming a field every other integration ignores.
|
|
165
|
+
*/
|
|
166
|
+
/**
|
|
167
|
+
* The raw object schema. Exported ONLY so the drift guard in `binary-capabilities.test.ts` can
|
|
168
|
+
* infer its output type and compare it against the hand-written {@link BinaryGenerationOptions};
|
|
169
|
+
* every other consumer takes {@link binaryGenerationOptionsSchema}, whose whole purpose is to
|
|
170
|
+
* stop that inference from happening at each use site. See the interface's note for why.
|
|
171
|
+
*/
|
|
172
|
+
export declare const binaryGenerationOptionsObject: v.ObjectSchema<{
|
|
173
|
+
/**
|
|
174
|
+
* Images every generation is conditioned on. Needs `reference-image`; more than one also needs
|
|
175
|
+
* `multi-reference`, since an API that takes a single input image cannot compose two.
|
|
176
|
+
*/
|
|
177
|
+
readonly referenceImages: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
178
|
+
readonly location: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
179
|
+
readonly service: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
180
|
+
readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
|
|
181
|
+
readonly role: v.PicklistSchema<["style", "subject", "composition", "base"], undefined>;
|
|
182
|
+
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
183
|
+
location: string;
|
|
184
|
+
service?: string | undefined;
|
|
185
|
+
note?: string | undefined;
|
|
186
|
+
role: "base" | "composition" | "style" | "subject";
|
|
187
|
+
}[], 8, undefined>]>, undefined>;
|
|
188
|
+
/**
|
|
189
|
+
* The step REVISES existing artifacts rather than making new ones. Needs `instruction-edit` or
|
|
190
|
+
* `mask-edit` depending on `mode`.
|
|
191
|
+
*/
|
|
192
|
+
readonly edit: v.OptionalSchema<v.ObjectSchema<{
|
|
193
|
+
/**
|
|
194
|
+
* `instruction` rewrites a whole artifact from a sentence; `mask` repaints only the region a
|
|
195
|
+
* mask names. Two capabilities, because almost no integration has both.
|
|
196
|
+
*/
|
|
197
|
+
readonly mode: v.PicklistSchema<["instruction", "mask"], undefined>;
|
|
198
|
+
/** What to change, folded into the brief verbatim. */
|
|
199
|
+
readonly instruction: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
|
|
200
|
+
/**
|
|
201
|
+
* The artifact to revise. Absent ⇒ the step's scope services say which existing asset each
|
|
202
|
+
* generation revises, which is the ordinary case for a step that re-renders an inventory.
|
|
203
|
+
*/
|
|
204
|
+
readonly source: v.OptionalSchema<v.ObjectSchema<{
|
|
205
|
+
/** Where it lives, in `service`'s addressing when one is named, else an absolute URL. */
|
|
206
|
+
readonly location: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
207
|
+
/**
|
|
208
|
+
* The foundational service the location is addressed in. Absent ⇒ `location` is a URL the
|
|
209
|
+
* agent can fetch directly. Not validated against the step's own selection: a reference can
|
|
210
|
+
* legitimately live in a service the step does not otherwise use, and the brief names whatever
|
|
211
|
+
* is here so a wrong id is visible rather than silently dropped.
|
|
212
|
+
*/
|
|
213
|
+
readonly service: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
214
|
+
/** What this is, in the step author's words, folded into the brief verbatim. */
|
|
215
|
+
readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
|
|
216
|
+
}, undefined>, undefined>;
|
|
217
|
+
/** The mask, for `mask` mode. Absent in `mask` mode is a gap the brief STATES. */
|
|
218
|
+
readonly mask: v.OptionalSchema<v.ObjectSchema<{
|
|
219
|
+
/** Where it lives, in `service`'s addressing when one is named, else an absolute URL. */
|
|
220
|
+
readonly location: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
221
|
+
/**
|
|
222
|
+
* The foundational service the location is addressed in. Absent ⇒ `location` is a URL the
|
|
223
|
+
* agent can fetch directly. Not validated against the step's own selection: a reference can
|
|
224
|
+
* legitimately live in a service the step does not otherwise use, and the brief names whatever
|
|
225
|
+
* is here so a wrong id is visible rather than silently dropped.
|
|
226
|
+
*/
|
|
227
|
+
readonly service: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
228
|
+
/** What this is, in the step author's words, folded into the brief verbatim. */
|
|
229
|
+
readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
|
|
230
|
+
}, undefined>, undefined>;
|
|
231
|
+
}, undefined>, undefined>;
|
|
232
|
+
/** What to keep out. Needs `negative-prompt`. */
|
|
233
|
+
readonly negativePrompt: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
|
|
234
|
+
/**
|
|
235
|
+
* A fixed seed, so the run is reproducible. Needs `seed`.
|
|
236
|
+
*
|
|
237
|
+
* A step comparing candidates deliberately does NOT get its seed varied for it: a fixed seed
|
|
238
|
+
* across integrations is how two renders of one subject are told apart by the integration
|
|
239
|
+
* rather than by luck, and the brief says so.
|
|
240
|
+
*/
|
|
241
|
+
readonly seed: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
|
|
242
|
+
/** `16:9`, `1:1`, `3:2`. Needs `aspect-ratio`. */
|
|
243
|
+
readonly aspectRatio: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 16, undefined>, v.RegexAction<string, "must be an aspect ratio of the form W:H">]>, undefined>;
|
|
244
|
+
/**
|
|
245
|
+
* Exact pixel dimensions every artifact must be delivered at. Needs `exact-size`.
|
|
246
|
+
*
|
|
247
|
+
* Mutually exclusive with `aspectRatio` and `upscale`, refused structurally at pipeline save
|
|
248
|
+
* (`assertUnambiguousOutputSize`): each of those states the final dimensions in a second,
|
|
249
|
+
* possibly disagreeing way, and the party who would reconcile them is the agent writing the
|
|
250
|
+
* call — the one with the least basis for deciding, which is the same argument that keeps
|
|
251
|
+
* `mediaTypes` from meaning "any of these".
|
|
252
|
+
*/
|
|
253
|
+
readonly outputSize: v.OptionalSchema<v.ObjectSchema<{
|
|
254
|
+
readonly width: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 16384, undefined>]>;
|
|
255
|
+
readonly height: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 16384, undefined>]>;
|
|
256
|
+
}, undefined>, undefined>;
|
|
257
|
+
/** Render at this multiple of the integration's native size. Needs `upscale`. */
|
|
258
|
+
readonly upscale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 2, undefined>, v.MaxValueAction<number, 8, undefined>]>, undefined>;
|
|
259
|
+
/** Deliver an alpha channel rather than a background. Needs `transparent-background`. */
|
|
260
|
+
readonly transparentBackground: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
|
|
261
|
+
/** Deliver a seamlessly tiling image. Needs `tileable`. */
|
|
262
|
+
readonly tileable: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
|
|
263
|
+
}, undefined>;
|
|
264
|
+
/**
|
|
265
|
+
* The generation options as a TYPE, written out rather than inferred.
|
|
266
|
+
*
|
|
267
|
+
* The one hand-written shape in this module, and it is not a style choice. This bag sits at the
|
|
268
|
+
* bottom of the deepest schema chain the product has: `WorkspaceSnapshot` → pipeline → step
|
|
269
|
+
* options → binary output → here → a reference image → its pipes: and inferring it pushed `tsc`
|
|
270
|
+
* past its instantiation limit in `@cat-factory/workspaces`, several packages away, with an error
|
|
271
|
+
* pointing at a line that has nothing to do with any of this. Naming the type stops the recursion
|
|
272
|
+
* at this node: every consumer resolves `BinaryGenerationOptions` instead of re-deriving it.
|
|
273
|
+
*
|
|
274
|
+
* A hand-written type beside a schema is exactly the drift this codebase avoids elsewhere, so it
|
|
275
|
+
* is pinned: `binary-capabilities.test.ts` asserts the inferred output and this interface are
|
|
276
|
+
* mutually assignable, which fails the build if either side gains a field the other does not.
|
|
277
|
+
* That check lives in a TEST rather than here because performing the inference in this file is
|
|
278
|
+
* what the annotation exists to stop doing at every use site, and doing it once in one place is
|
|
279
|
+
* affordable.
|
|
280
|
+
*/
|
|
281
|
+
export interface BinaryGenerationOptions {
|
|
282
|
+
referenceImages?: BinaryReferenceImage[] | undefined;
|
|
283
|
+
edit?: BinaryEditRequest | undefined;
|
|
284
|
+
negativePrompt?: string | undefined;
|
|
285
|
+
seed?: number | undefined;
|
|
286
|
+
aspectRatio?: string | undefined;
|
|
287
|
+
outputSize?: BinaryOutputSize | undefined;
|
|
288
|
+
upscale?: number | undefined;
|
|
289
|
+
transparentBackground?: true | undefined;
|
|
290
|
+
tileable?: true | undefined;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* The generation options as a SCHEMA, typed against the interface above so consumers stop
|
|
294
|
+
* re-inferring it. `unknown` on the input side is what a parser accepts anyway, and nothing in
|
|
295
|
+
* this repo reads `InferInput` of a step's options.
|
|
296
|
+
*/
|
|
297
|
+
export declare const binaryGenerationOptionsSchema: v.GenericSchema<unknown, BinaryGenerationOptions>;
|
|
298
|
+
/**
|
|
299
|
+
* Which option needs which capability, as the ONE table both sides read.
|
|
300
|
+
*
|
|
301
|
+
* A `Record` over the option keys rather than a chain of `if`s at each reader, so an option added
|
|
302
|
+
* to the schema without a capability fails the typecheck here instead of shipping as a control
|
|
303
|
+
* nothing checks. `referenceImages` maps to a LIST because its requirement grows with its length,
|
|
304
|
+
* and `edit` maps to one of two by its mode, which is why the derivation below is a function and
|
|
305
|
+
* not a lookup.
|
|
306
|
+
*/
|
|
307
|
+
export declare const BINARY_OPTION_CAPABILITIES: Record<keyof BinaryGenerationOptions, readonly BinaryGeneratorCapability[]>;
|
|
308
|
+
/**
|
|
309
|
+
* The capabilities a step's generation options actually REQUIRE, in a stable order.
|
|
310
|
+
*
|
|
311
|
+
* Derived rather than declared, so a step never carries a requirement it does not exercise: a
|
|
312
|
+
* `referenceImages` list of one needs `reference-image` and NOT `multi-reference`, and an `edit`
|
|
313
|
+
* needs exactly the one capability its mode names. Deriving it is also what keeps the refusal
|
|
314
|
+
* honest in the other direction, since a requirement nobody stated cannot be silently dropped by
|
|
315
|
+
* an integration that does not declare it.
|
|
316
|
+
*
|
|
317
|
+
* Deliberately NOT extended with `candidate-batch` for a comparison step: an integration without
|
|
318
|
+
* it can still produce several candidates by repeating the call, so a refusal there would reject
|
|
319
|
+
* a selection that works. The brief states which of the two the agent should do.
|
|
320
|
+
*/
|
|
321
|
+
export declare function requiredBinaryCapabilities(options: BinaryGenerationOptions | undefined): BinaryGeneratorCapability[];
|
|
322
|
+
/**
|
|
323
|
+
* A generation option that states the DELIVERED DIMENSIONS a second time, beside an exact
|
|
324
|
+
* `outputSize`. The union is the option keys themselves, so a reader on either side of the wire
|
|
325
|
+
* names the field the composer has to delete.
|
|
326
|
+
*/
|
|
327
|
+
export type ConflictingOutputSizeOption = 'aspectRatio' | 'upscale';
|
|
328
|
+
/**
|
|
329
|
+
* The options that restate the delivered dimensions beside an exact {@link BinaryOutputSize}, in a
|
|
330
|
+
* stable order. Empty when the step asks for no exact size, which stays the ordinary case.
|
|
331
|
+
*
|
|
332
|
+
* `aspectRatio` states the shape the size already fixes, and `upscale` states a multiple of
|
|
333
|
+
* whatever the integration renders natively, so either one held beside a size leaves the
|
|
334
|
+
* deliverable's actual dimensions undetermined at exactly the point the step went to the trouble of
|
|
335
|
+
* determining them. The platform refuses that rather than resolving it by precedence: the party a
|
|
336
|
+
* precedence rule hands the leftover decision to is the AGENT writing the vendor call, which reads
|
|
337
|
+
* "96x96" and "16:9" in one brief and picks. Two contradicting statements of one fact is a
|
|
338
|
+
* mis-configured step and the fix (delete one) is unambiguous, which is what makes refusing it the
|
|
339
|
+
* cheap option.
|
|
340
|
+
*
|
|
341
|
+
* Shared rather than restated on each side, like {@link binaryFormatCoverage} one axis over: the
|
|
342
|
+
* backend REFUSES the save with it and the SPA has to state the same refusal in the builder, where
|
|
343
|
+
* it is fixable without a round trip. A rule with a home on only one side becomes a hand-kept copy
|
|
344
|
+
* on the other, and the two then disagree about which selection is legal.
|
|
345
|
+
*/
|
|
346
|
+
export declare function conflictingOutputSizeOptions(options: BinaryGenerationOptions | undefined): ConflictingOutputSizeOption[];
|
|
347
|
+
/** How a step's required capabilities stand against what its selected integrations declare. */
|
|
348
|
+
export interface BinaryCapabilityCoverage {
|
|
349
|
+
/** Required capabilities no selected integration declares, judged against integrations that
|
|
350
|
+
* DECLARED theirs. These refuse the run. */
|
|
351
|
+
uncovered: BinaryGeneratorCapability[];
|
|
352
|
+
/** Required capabilities nothing selected claims, where at least one selected integration
|
|
353
|
+
* declares NO capabilities at all, so the requirement might be met and nothing may say
|
|
354
|
+
* otherwise. */
|
|
355
|
+
unverifiable: BinaryGeneratorCapability[];
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Judge `required` against what `selected` declares it can do.
|
|
359
|
+
*
|
|
360
|
+
* The same THREE outcomes as {@link binaryFormatCoverage}, and deliberately the same rule, because
|
|
361
|
+
* the two axes are in the same position: a declaration that pins nothing down is an explicit
|
|
362
|
+
* documented state ("only the coarse facts are known") rather than a denial. That reading is what
|
|
363
|
+
* lets this ship without breaking a single integration registered before capabilities existed:
|
|
364
|
+
* they declare none, so every requirement against them is UNVERIFIABLE, the run is admitted, and
|
|
365
|
+
* the gap is stated to the agent in its brief and to the composer in the picker. Refusing there
|
|
366
|
+
* would retroactively invalidate every registration in existence; calling it covered would be a
|
|
367
|
+
* clean bill of health nobody issued on the surface that decides whether the run may start.
|
|
368
|
+
*
|
|
369
|
+
* Kept as its own function rather than a generic over the format one: they read different fields
|
|
370
|
+
* of different shapes, and a shared generic would be a parameterised `some`/`has` that saves four
|
|
371
|
+
* lines and hides which axis a caller is asking about.
|
|
372
|
+
*/
|
|
373
|
+
export declare function binaryCapabilityCoverage(required: readonly BinaryGeneratorCapability[], selected: readonly {
|
|
374
|
+
capabilities?: readonly BinaryGeneratorCapability[];
|
|
375
|
+
}[]): BinaryCapabilityCoverage;
|
|
376
|
+
/**
|
|
377
|
+
* The integrations that declare each required capability, so a surface can say WHICH of a
|
|
378
|
+
* step's selection will actually honour an option rather than only that something will.
|
|
379
|
+
*
|
|
380
|
+
* The question a person asks the moment a step holds two producers of one modality and one
|
|
381
|
+
* option: an aspect ratio honoured by one of them and ignored by the other is not a covered
|
|
382
|
+
* requirement in any useful sense, and coverage alone cannot say so. Ids come out in selection
|
|
383
|
+
* order and a capability with no declarer is absent, never an empty list, so "nobody" and "not
|
|
384
|
+
* asked" stay different answers.
|
|
385
|
+
*/
|
|
386
|
+
export declare function binaryCapabilityProviders(required: readonly BinaryGeneratorCapability[], selected: readonly {
|
|
387
|
+
id: string;
|
|
388
|
+
capabilities?: readonly BinaryGeneratorCapability[];
|
|
389
|
+
}[]): {
|
|
390
|
+
capability: BinaryGeneratorCapability;
|
|
391
|
+
generatorIds: string[];
|
|
392
|
+
}[];
|
|
393
|
+
//# sourceMappingURL=binary-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-capabilities.d.ts","sourceRoot":"","sources":["../src/binary-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAuB5B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,+BAA+B,mOA8F1C,CAAA;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAI7F;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,yBAAyB,CAE7F;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;IAC/B,yFAAyF;;IAEzF;;;;;OAKG;;IAIH,gFAAgF;;aAEhF,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B;;;;;aAuBrC,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;OAGG;;IAEH,sDAAsD;;IAEtD;;;OAGG;;QAlEH,yFAAyF;;QAEzF;;;;;WAKG;;QAIH,gFAAgF;;;IAyDhF,kFAAkF;;QApElF,yFAAyF;;QAEzF;;;;;WAKG;;QAIH,gFAAgF;;;aA2DhF,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CA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