@cat-factory/contracts 0.214.0 → 0.216.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.
@@ -10,12 +10,31 @@ import * as v from 'valibot';
10
10
  */
11
11
  export declare const binaryGeneratorCredentialSchema: v.ObjectSchema<{
12
12
  /**
13
- * The credential's key. It is both what the secret resolver is asked for and the ENVIRONMENT
14
- * VARIABLE the agent reads it from, so it must be a valid POSIX variable name — a generator
15
- * declaring `x-rd-token` would resolve fine and then be dropped by the harness's env
13
+ * The credential's LOOKUP key: what the secret resolver is asked for, and what a workspace
14
+ * stores its own value under. Also the ENVIRONMENT VARIABLE the agent reads it from unless
15
+ * {@link envName} says otherwise, so it must be a valid POSIX variable name either way: a
16
+ * generator declaring `x-rd-token` would resolve fine and then be dropped by the harness's env
16
17
  * validation, which is a silent "the integration just 401s" at run time.
18
+ *
19
+ * It may NOT name a variable the platform's own configuration owns
20
+ * ({@link isReservedPlatformEnvKey}). The resolver reads the key off the deployment's
21
+ * environment and the value is injected into an agent process, so an integration declaring
22
+ * `ENCRYPTION_KEY` would hand a prompt-injectable agent the deployment's master sealing key.
23
+ * Refused here so a deployment learns at boot, and again at dispatch, since a mothership-mode
24
+ * node boot-validates none of the definitions it resolves.
17
25
  */
18
- readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name">]>;
26
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
27
+ /**
28
+ * The environment variable the value is injected as, when that differs from {@link key}. This
29
+ * is the name the agent is told to read, and it is what a vendor SDK that auto-reads its own
30
+ * documented variable needs.
31
+ *
32
+ * Held to the toolchain rule rather than the reserved-platform one, because it reads nothing:
33
+ * the floor above is about what may be READ off the deployment's environment, and an injection
34
+ * name only decides what a variable is called inside this job's agent process. That is what lets
35
+ * an integration keep a vendor's documented name even when a platform prefix family covers it.
36
+ */
37
+ readonly envName: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>, undefined>;
19
38
  /**
20
39
  * How the integration expects the credential to be presented (`X-RD-Token: <value>`,
21
40
  * `Authorization: Bearer <value>`). Folded into the brief verbatim: the agent writes the
@@ -75,12 +94,31 @@ export declare const binaryGeneratorDefinitionSchema: v.ObjectSchema<{
75
94
  readonly guidance: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 20000, undefined>]>, undefined>;
76
95
  readonly credential: v.OptionalSchema<v.ObjectSchema<{
77
96
  /**
78
- * The credential's key. It is both what the secret resolver is asked for and the ENVIRONMENT
79
- * VARIABLE the agent reads it from, so it must be a valid POSIX variable name — a generator
80
- * declaring `x-rd-token` would resolve fine and then be dropped by the harness's env
97
+ * The credential's LOOKUP key: what the secret resolver is asked for, and what a workspace
98
+ * stores its own value under. Also the ENVIRONMENT VARIABLE the agent reads it from unless
99
+ * {@link envName} says otherwise, so it must be a valid POSIX variable name either way: a
100
+ * generator declaring `x-rd-token` would resolve fine and then be dropped by the harness's env
81
101
  * validation, which is a silent "the integration just 401s" at run time.
102
+ *
103
+ * It may NOT name a variable the platform's own configuration owns
104
+ * ({@link isReservedPlatformEnvKey}). The resolver reads the key off the deployment's
105
+ * environment and the value is injected into an agent process, so an integration declaring
106
+ * `ENCRYPTION_KEY` would hand a prompt-injectable agent the deployment's master sealing key.
107
+ * Refused here so a deployment learns at boot, and again at dispatch, since a mothership-mode
108
+ * node boot-validates none of the definitions it resolves.
109
+ */
110
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
111
+ /**
112
+ * The environment variable the value is injected as, when that differs from {@link key}. This
113
+ * is the name the agent is told to read, and it is what a vendor SDK that auto-reads its own
114
+ * documented variable needs.
115
+ *
116
+ * Held to the toolchain rule rather than the reserved-platform one, because it reads nothing:
117
+ * the floor above is about what may be READ off the deployment's environment, and an injection
118
+ * name only decides what a variable is called inside this job's agent process. That is what lets
119
+ * an integration keep a vendor's documented name even when a platform prefix family covers it.
82
120
  */
83
- readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name">]>;
121
+ readonly envName: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>, undefined>;
84
122
  /**
85
123
  * How the integration expects the credential to be presented (`X-RD-Token: <value>`,
86
124
  * `Authorization: Bearer <value>`). Folded into the brief verbatim: the agent writes the
@@ -1 +1 @@
1
- {"version":3,"file":"binary-generators.d.ts","sourceRoot":"","sources":["../src/binary-generators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAgC5B;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B;IAC1C;;;;;OAKG;;IAQH;;;;OAIG;;IAEH;;;;;OAKG;;aAEH,CAAA;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F;;;;;;;GAOG;A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M,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F;;;;;;;;GAQG;AACH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B;;;;IAI1C,0FAA0F;;IAE1F,gGAAgG;;aAEhG,CAAA;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,EAAE,CAO7E"}
@@ -1,6 +1,7 @@
1
1
  import * as v from 'valibot';
2
2
  import { binaryModalitySchema, mediaTypeSchema } from './binary-modalities.js';
3
3
  import { uploadApiContractSchema } from './foundational-services.js';
4
+ import { isReservedPlatformEnvKey, isToolchainEnvName, reservedEnvKeyMessage, toolchainEnvNameMessage, } from './reserved-env-keys.js';
4
5
  // ---------------------------------------------------------------------------
5
6
  // Wire vocabulary for GENERATIVE BINARY INTEGRATIONS — the third-party (or in-house) APIs a
6
7
  // binary-generating agent kind calls to PRODUCE its deliverable: an image generator, a
@@ -32,12 +33,31 @@ const slug = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(64), v.reg
32
33
  */
33
34
  export const binaryGeneratorCredentialSchema = v.object({
34
35
  /**
35
- * The credential's key. It is both what the secret resolver is asked for and the ENVIRONMENT
36
- * VARIABLE the agent reads it from, so it must be a valid POSIX variable name — a generator
37
- * declaring `x-rd-token` would resolve fine and then be dropped by the harness's env
36
+ * The credential's LOOKUP key: what the secret resolver is asked for, and what a workspace
37
+ * stores its own value under. Also the ENVIRONMENT VARIABLE the agent reads it from unless
38
+ * {@link envName} says otherwise, so it must be a valid POSIX variable name either way: a
39
+ * generator declaring `x-rd-token` would resolve fine and then be dropped by the harness's env
38
40
  * validation, which is a silent "the integration just 401s" at run time.
41
+ *
42
+ * It may NOT name a variable the platform's own configuration owns
43
+ * ({@link isReservedPlatformEnvKey}). The resolver reads the key off the deployment's
44
+ * environment and the value is injected into an agent process, so an integration declaring
45
+ * `ENCRYPTION_KEY` would hand a prompt-injectable agent the deployment's master sealing key.
46
+ * Refused here so a deployment learns at boot, and again at dispatch, since a mothership-mode
47
+ * node boot-validates none of the definitions it resolves.
39
48
  */
40
- key: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128), v.regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'must be a valid environment variable name')),
49
+ key: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128), v.regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'must be a valid environment variable name'), v.check((key) => !isReservedPlatformEnvKey(key), (issue) => reservedEnvKeyMessage(String(issue.input)))),
50
+ /**
51
+ * The environment variable the value is injected as, when that differs from {@link key}. This
52
+ * is the name the agent is told to read, and it is what a vendor SDK that auto-reads its own
53
+ * documented variable needs.
54
+ *
55
+ * Held to the toolchain rule rather than the reserved-platform one, because it reads nothing:
56
+ * the floor above is about what may be READ off the deployment's environment, and an injection
57
+ * name only decides what a variable is called inside this job's agent process. That is what lets
58
+ * an integration keep a vendor's documented name even when a platform prefix family covers it.
59
+ */
60
+ envName: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128), v.regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'must be a valid environment variable name'), v.check((name) => !isToolchainEnvName(name), (issue) => toolchainEnvNameMessage(String(issue.input))))),
41
61
  /**
42
62
  * How the integration expects the credential to be presented (`X-RD-Token: <value>`,
43
63
  * `Authorization: Bearer <value>`). Folded into the brief verbatim: the agent writes the
@@ -1 +1 @@
1
- {"version":3,"file":"binary-generators.js","sourceRoot":"","sources":["../src/binary-generators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,8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,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,0FAA0F;IAC1F,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACzC,gGAAgG;IAChG,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;CACjD,CAAC,CAAA;AAGF,MAAM,UAAU,+BAA+B,CAAC,UAAmB;IACjE,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,+BAA+B,EAAE,UAAU,CAAC,CAAA;IACvE,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,CAAA;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACjC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACxE,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;IAC3D,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,159 @@
1
+ import * as v from 'valibot';
2
+ /**
3
+ * The key a stored credential answers for: the LOOKUP name the capability's definition declares,
4
+ * which is what a resolver is asked for.
5
+ *
6
+ * It is not necessarily the variable the agent reads the value from. A definition that needs a
7
+ * specific variable name in the process it configures declares `envName` beside its `key`, and
8
+ * the store never sees that name: it stores what the resolver is ASKED for, and the injection
9
+ * name is applied afterwards, at dispatch.
10
+ *
11
+ * Held to BOTH lists, which protect different things and neither implies the other:
12
+ *
13
+ * - {@link isReservedPlatformEnvKey}, the platform's own configuration. Storing a value under
14
+ * `ENCRYPTION_KEY` would not read the deployment's key (this store answers first), but the
15
+ * declaration it would satisfy is refused at boot, so accepting it here lets an operator fill
16
+ * in a credential that can never be asked for.
17
+ * - {@link isToolchainEnvName}, the harness's own process. This one is belt-and-braces at this
18
+ * boundary rather than the real guard (the real guard is on `envName` at declaration), because
19
+ * a stored key with no `envName` beside it IS the injected name.
20
+ */
21
+ export declare const capabilityCredentialKeySchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
22
+ /** One stored credential: the key it answers for, and the write-only value sealed at rest. */
23
+ export declare const capabilityCredentialEntrySchema: v.ObjectSchema<{
24
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
25
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>;
26
+ }, undefined>;
27
+ export type CapabilityCredentialEntry = v.InferOutput<typeof capabilityCredentialEntrySchema>;
28
+ /**
29
+ * The non-secret projection of a stored credential — what the API returns and the UI lists.
30
+ *
31
+ * A KEY and nothing else. There is deliberately no operator-authored description field, unlike a
32
+ * test secret's: what a capability credential is FOR is already stated by the definition that
33
+ * declares it (`usage`, `guidance`), and a second free-text answer beside it is a copy that can
34
+ * disagree with the definition and always wins visually. The read that pairs stored keys with
35
+ * their DECLARATIONS is {@link capabilityCredentialStatusSchema}.
36
+ */
37
+ export declare const capabilityCredentialRefSchema: v.ObjectSchema<{
38
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
39
+ /** When the value was last written, so the UI can show age without revealing the value. */
40
+ readonly updatedAt: v.NumberSchema<undefined>;
41
+ }, undefined>;
42
+ export type CapabilityCredentialRef = v.InferOutput<typeof capabilityCredentialRefSchema>;
43
+ /**
44
+ * A credential the deployment's registered capabilities actually DECLARE, joined to whether this
45
+ * workspace has stored one.
46
+ *
47
+ * This is the read that makes the store usable rather than a blank key-value form. The keys a
48
+ * workspace must fill in are not a workspace fact at all — they are a property of the
49
+ * deployment's CODE (its `AgentKindRegistry` tool servers, its `BinaryGeneratorRegistry`) — so
50
+ * without projecting them, an operator has to read the deployment's source to learn what to type,
51
+ * and a typo produces a stored credential that is never asked for.
52
+ *
53
+ * Admin-gated on purpose. The workspace SNAPSHOT's generative-integration projection deliberately
54
+ * omits credential key names ("a workspace viewer has no business learning which environment
55
+ * variables the deployment sets"), and that judgement does not change because the value now lives
56
+ * in a row: this rides the same `secrets.manage` surface as the write.
57
+ */
58
+ export declare const capabilityCredentialStatusSchema: v.ObjectSchema<{
59
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
60
+ /** Which capabilities want it — id + label, so the UI can say who a key is for. */
61
+ readonly declaredBy: v.ArraySchema<v.ObjectSchema<{
62
+ readonly subject: v.PicklistSchema<["tool-server", "binary-generator"], undefined>;
63
+ readonly id: v.StringSchema<undefined>;
64
+ readonly label: v.StringSchema<undefined>;
65
+ /** The definition's own note on how the value is presented, when it states one. */
66
+ readonly usage: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
67
+ }, undefined>, undefined>;
68
+ /** Whether at least one declaring capability treats it as required. */
69
+ readonly required: v.BooleanSchema<undefined>;
70
+ /** Whether THIS workspace has stored a value. */
71
+ readonly stored: v.BooleanSchema<undefined>;
72
+ /** When the stored value was last written. Absent when nothing is stored. */
73
+ readonly updatedAt: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
74
+ }, undefined>;
75
+ export type CapabilityCredentialStatus = v.InferOutput<typeof capabilityCredentialStatusSchema>;
76
+ /** Set/replace a workspace's capability credentials. Values write-only; keys unique. */
77
+ export declare const upsertCapabilityCredentialsSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
78
+ readonly entries: v.ArraySchema<v.ObjectSchema<{
79
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
80
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>;
81
+ }, undefined>, undefined>;
82
+ }, undefined>, v.CheckAction<{
83
+ entries: {
84
+ key: string;
85
+ value: string;
86
+ }[];
87
+ }, "capability credential keys must be unique within a workspace">, v.CheckAction<{
88
+ entries: {
89
+ key: string;
90
+ value: string;
91
+ }[];
92
+ }, "at most 100 capability credentials per workspace">]>;
93
+ export type UpsertCapabilityCredentialsInput = v.InferOutput<typeof upsertCapabilityCredentialsSchema>;
94
+ /**
95
+ * What the credential surface returns: what this deployment's capabilities DECLARE joined to what
96
+ * this workspace has STORED, plus any stored key nothing declares.
97
+ *
98
+ * The orphan half is not tidiness. A capability is deployment CODE, so a workspace's stored key
99
+ * stops being declared whenever the deployment retires an integration or renames a variable — and
100
+ * an orphaned credential is a live secret nobody will ever ask for, sitting sealed in a row. It is
101
+ * reported as its own list rather than dropped from the view, for the same reason an unknown
102
+ * generator id is named rather than filtered: the operator is the only one who can decide whether
103
+ * to delete it or whether the deployment regressed.
104
+ */
105
+ export declare const capabilityCredentialsViewSchema: v.ObjectSchema<{
106
+ readonly declared: v.ArraySchema<v.ObjectSchema<{
107
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
108
+ /** Which capabilities want it — id + label, so the UI can say who a key is for. */
109
+ readonly declaredBy: v.ArraySchema<v.ObjectSchema<{
110
+ readonly subject: v.PicklistSchema<["tool-server", "binary-generator"], undefined>;
111
+ readonly id: v.StringSchema<undefined>;
112
+ readonly label: v.StringSchema<undefined>;
113
+ /** The definition's own note on how the value is presented, when it states one. */
114
+ readonly usage: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
115
+ }, undefined>, undefined>;
116
+ /** Whether at least one declaring capability treats it as required. */
117
+ readonly required: v.BooleanSchema<undefined>;
118
+ /** Whether THIS workspace has stored a value. */
119
+ readonly stored: v.BooleanSchema<undefined>;
120
+ /** When the stored value was last written. Absent when nothing is stored. */
121
+ readonly updatedAt: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
122
+ }, undefined>, undefined>;
123
+ /** Stored keys no registered capability declares. */
124
+ readonly orphaned: v.ArraySchema<v.ObjectSchema<{
125
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
126
+ /** When the value was last written, so the UI can show age without revealing the value. */
127
+ readonly updatedAt: v.NumberSchema<undefined>;
128
+ }, undefined>, undefined>;
129
+ /**
130
+ * Whether the deployment ALSO has an environment-variable fallback behind this store. False
131
+ * when a facade wired a store-only resolver.
132
+ *
133
+ * Stated because it changes what an EMPTY row means: with the fallback, a key nothing is stored
134
+ * for may still resolve from the deployment's environment, so the UI must not report it as
135
+ * missing. "Absent" and "zero" again.
136
+ */
137
+ readonly environmentFallback: v.BooleanSchema<undefined>;
138
+ /**
139
+ * Whether the DECLARATION half of this view is known to be incomplete — the generative
140
+ * integrations are read through `BinaryGeneratorSource`, which THROWS rather than answering an
141
+ * empty set when it cannot reach the mothership, and this surface must not turn that outage
142
+ * into "no integration needs a credential".
143
+ *
144
+ * Its own flag rather than a failed request, because the stored half is still perfectly
145
+ * readable and an operator locked out of their own credential list during someone else's
146
+ * outage is a worse answer than a list with a caveat on it.
147
+ */
148
+ readonly declarationsIncomplete: v.BooleanSchema<undefined>;
149
+ }, undefined>;
150
+ export type CapabilityCredentialsView = v.InferOutput<typeof capabilityCredentialsViewSchema>;
151
+ /** Validate a decrypted blob at the read boundary, so a drifted row fails clearly and early. */
152
+ export declare const capabilityCredentialEntriesSchema: v.ArraySchema<v.ObjectSchema<{
153
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "must be a valid environment variable name (letters, digits and underscores, not starting with a digit)">, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>, v.CheckAction<string, (issue: v.CheckIssue<string>) => string>]>;
154
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>;
155
+ }, undefined>, undefined>;
156
+ export declare function parseCapabilityCredentialEntries(raw: unknown): CapabilityCredentialEntry[];
157
+ /** The non-secret summary persisted beside the sealed values, so a read decrypts nothing. */
158
+ export declare function capabilityCredentialsSummary(entries: CapabilityCredentialEntry[], updatedAt: number): CapabilityCredentialRef[];
159
+ //# sourceMappingURL=capability-credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-credentials.d.ts","sourceRoot":"","sources":["../src/capability-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAiC5B;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,2ZAiBzC,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,+BAA+B;;;aAG1C,CAAA;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B;;IAExC,2FAA2F;;aAE3F,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAEzF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gCAAgC;;IAE3C,mFAAmF;;;;;QAM/E,mFAAmF;;;IAIvF,uEAAuE;;IAEvE,iDAAiD;;IAEjD,6EAA6E;;aAE7E,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAE/F,wFAAwF;AACxF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;wDAO7C,CAAA;AACD,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,WAAW,CAC1D,OAAO,iCAAiC,CACzC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B;;;QA3C1C,mFAAmF;;;;;YAM/E,mFAAmF;;;QAIvF,uEAAuE;;QAEvE,iDAAiD;;QAEjD,6EAA6E;;;IA+B7E,qDAAqD;;;QAnErD,2FAA2F;;;IAqE3F;;;;;;;OAOG;;IAEH;;;;;;;;;OASG;;aAEH,CAAA;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F,gGAAgG;AAChG,eAAO,MAAM,iCAAiC;;;yBAA2C,CAAA;AACzF,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,OAAO,GAAG,yBAAyB,EAAE,CAE1F;AAED,6FAA6F;AAC7F,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,yBAAyB,EAAE,EACpC,SAAS,EAAE,MAAM,GAChB,uBAAuB,EAAE,CAE3B"}
@@ -0,0 +1,145 @@
1
+ import * as v from 'valibot';
2
+ import { isReservedPlatformEnvKey, isToolchainEnvName, reservedEnvKeyMessage, toolchainEnvNameMessage, } from './reserved-env-keys.js';
3
+ // ---------------------------------------------------------------------------
4
+ // PER-WORKSPACE capability credentials (SEALED) — the tenant-scoped home for the secrets a
5
+ // registered capability declares.
6
+ //
7
+ // A tool server (MCP) and a generative binary integration each declare the credential they need
8
+ // BY NAME, and the value is resolved per dispatch through the kernel `ToolSecretResolver`. The
9
+ // shipped default reads that name off the DEPLOYMENT'S OWN ENVIRONMENT, which is the right answer
10
+ // for a single-tenant install and the wrong one for every other shape: one process serves many
11
+ // workspaces, so one variable serves them all — every tenant's runs authenticate as whoever set
12
+ // the variable, a tenant cannot supply its own vendor account, rotating one tenant's key means a
13
+ // redeploy, and the value is visible to every operator with shell access to the host.
14
+ //
15
+ // Every other credential in the platform already went the other way: provider API keys, tracker /
16
+ // document / runner / observability connections, personal subscriptions, private package
17
+ // registries and the sensitive test secrets are all per-tenant rows, sealed at rest, edited in
18
+ // the UI. Capabilities are the subsystem that did not get it. This module is that store's wire
19
+ // vocabulary, and it is modelled on `test-secrets.ts` deliberately — same sealed-blob-plus-
20
+ // non-secret-summary shape, same write-only values, same "the view lists KEYS, never values".
21
+ //
22
+ // The env resolver is NOT removed. It becomes the FALLBACK: a workspace that has stored nothing
23
+ // keeps resolving exactly as before, so a local install and a single-tenant deployment need no
24
+ // migration and no UI visit. What changes is which one wins when both have a value — see
25
+ // `composeToolSecretResolvers` in `@cat-factory/server`.
26
+ // ---------------------------------------------------------------------------
27
+ /**
28
+ * The key a stored credential answers for: the LOOKUP name the capability's definition declares,
29
+ * which is what a resolver is asked for.
30
+ *
31
+ * It is not necessarily the variable the agent reads the value from. A definition that needs a
32
+ * specific variable name in the process it configures declares `envName` beside its `key`, and
33
+ * the store never sees that name: it stores what the resolver is ASKED for, and the injection
34
+ * name is applied afterwards, at dispatch.
35
+ *
36
+ * Held to BOTH lists, which protect different things and neither implies the other:
37
+ *
38
+ * - {@link isReservedPlatformEnvKey}, the platform's own configuration. Storing a value under
39
+ * `ENCRYPTION_KEY` would not read the deployment's key (this store answers first), but the
40
+ * declaration it would satisfy is refused at boot, so accepting it here lets an operator fill
41
+ * in a credential that can never be asked for.
42
+ * - {@link isToolchainEnvName}, the harness's own process. This one is belt-and-braces at this
43
+ * boundary rather than the real guard (the real guard is on `envName` at declaration), because
44
+ * a stored key with no `envName` beside it IS the injected name.
45
+ */
46
+ export const capabilityCredentialKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128), v.regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'must be a valid environment variable name (letters, digits and underscores, not starting with a digit)'), v.check((key) => !isReservedPlatformEnvKey(key), (issue) => reservedEnvKeyMessage(String(issue.input))), v.check((key) => !isToolchainEnvName(key), (issue) => toolchainEnvNameMessage(String(issue.input))));
47
+ /** One stored credential: the key it answers for, and the write-only value sealed at rest. */
48
+ export const capabilityCredentialEntrySchema = v.object({
49
+ key: capabilityCredentialKeySchema,
50
+ value: v.pipe(v.string(), v.minLength(1), v.maxLength(8192)),
51
+ });
52
+ /**
53
+ * The non-secret projection of a stored credential — what the API returns and the UI lists.
54
+ *
55
+ * A KEY and nothing else. There is deliberately no operator-authored description field, unlike a
56
+ * test secret's: what a capability credential is FOR is already stated by the definition that
57
+ * declares it (`usage`, `guidance`), and a second free-text answer beside it is a copy that can
58
+ * disagree with the definition and always wins visually. The read that pairs stored keys with
59
+ * their DECLARATIONS is {@link capabilityCredentialStatusSchema}.
60
+ */
61
+ export const capabilityCredentialRefSchema = v.object({
62
+ key: capabilityCredentialKeySchema,
63
+ /** When the value was last written, so the UI can show age without revealing the value. */
64
+ updatedAt: v.number(),
65
+ });
66
+ /**
67
+ * A credential the deployment's registered capabilities actually DECLARE, joined to whether this
68
+ * workspace has stored one.
69
+ *
70
+ * This is the read that makes the store usable rather than a blank key-value form. The keys a
71
+ * workspace must fill in are not a workspace fact at all — they are a property of the
72
+ * deployment's CODE (its `AgentKindRegistry` tool servers, its `BinaryGeneratorRegistry`) — so
73
+ * without projecting them, an operator has to read the deployment's source to learn what to type,
74
+ * and a typo produces a stored credential that is never asked for.
75
+ *
76
+ * Admin-gated on purpose. The workspace SNAPSHOT's generative-integration projection deliberately
77
+ * omits credential key names ("a workspace viewer has no business learning which environment
78
+ * variables the deployment sets"), and that judgement does not change because the value now lives
79
+ * in a row: this rides the same `secrets.manage` surface as the write.
80
+ */
81
+ export const capabilityCredentialStatusSchema = v.object({
82
+ key: capabilityCredentialKeySchema,
83
+ /** Which capabilities want it — id + label, so the UI can say who a key is for. */
84
+ declaredBy: v.array(v.object({
85
+ subject: v.picklist(['tool-server', 'binary-generator']),
86
+ id: v.string(),
87
+ label: v.string(),
88
+ /** The definition's own note on how the value is presented, when it states one. */
89
+ usage: v.optional(v.string()),
90
+ })),
91
+ /** Whether at least one declaring capability treats it as required. */
92
+ required: v.boolean(),
93
+ /** Whether THIS workspace has stored a value. */
94
+ stored: v.boolean(),
95
+ /** When the stored value was last written. Absent when nothing is stored. */
96
+ updatedAt: v.optional(v.number()),
97
+ });
98
+ /** Set/replace a workspace's capability credentials. Values write-only; keys unique. */
99
+ export const upsertCapabilityCredentialsSchema = v.pipe(v.object({ entries: v.array(capabilityCredentialEntrySchema) }), v.check((o) => new Set(o.entries.map((e) => e.key)).size === o.entries.length, 'capability credential keys must be unique within a workspace'), v.check((o) => o.entries.length <= 100, 'at most 100 capability credentials per workspace'));
100
+ /**
101
+ * What the credential surface returns: what this deployment's capabilities DECLARE joined to what
102
+ * this workspace has STORED, plus any stored key nothing declares.
103
+ *
104
+ * The orphan half is not tidiness. A capability is deployment CODE, so a workspace's stored key
105
+ * stops being declared whenever the deployment retires an integration or renames a variable — and
106
+ * an orphaned credential is a live secret nobody will ever ask for, sitting sealed in a row. It is
107
+ * reported as its own list rather than dropped from the view, for the same reason an unknown
108
+ * generator id is named rather than filtered: the operator is the only one who can decide whether
109
+ * to delete it or whether the deployment regressed.
110
+ */
111
+ export const capabilityCredentialsViewSchema = v.object({
112
+ declared: v.array(capabilityCredentialStatusSchema),
113
+ /** Stored keys no registered capability declares. */
114
+ orphaned: v.array(capabilityCredentialRefSchema),
115
+ /**
116
+ * Whether the deployment ALSO has an environment-variable fallback behind this store. False
117
+ * when a facade wired a store-only resolver.
118
+ *
119
+ * Stated because it changes what an EMPTY row means: with the fallback, a key nothing is stored
120
+ * for may still resolve from the deployment's environment, so the UI must not report it as
121
+ * missing. "Absent" and "zero" again.
122
+ */
123
+ environmentFallback: v.boolean(),
124
+ /**
125
+ * Whether the DECLARATION half of this view is known to be incomplete — the generative
126
+ * integrations are read through `BinaryGeneratorSource`, which THROWS rather than answering an
127
+ * empty set when it cannot reach the mothership, and this surface must not turn that outage
128
+ * into "no integration needs a credential".
129
+ *
130
+ * Its own flag rather than a failed request, because the stored half is still perfectly
131
+ * readable and an operator locked out of their own credential list during someone else's
132
+ * outage is a worse answer than a list with a caveat on it.
133
+ */
134
+ declarationsIncomplete: v.boolean(),
135
+ });
136
+ /** Validate a decrypted blob at the read boundary, so a drifted row fails clearly and early. */
137
+ export const capabilityCredentialEntriesSchema = v.array(capabilityCredentialEntrySchema);
138
+ export function parseCapabilityCredentialEntries(raw) {
139
+ return v.parse(capabilityCredentialEntriesSchema, raw);
140
+ }
141
+ /** The non-secret summary persisted beside the sealed values, so a read decrypts nothing. */
142
+ export function capabilityCredentialsSummary(entries, updatedAt) {
143
+ return entries.map((entry) => ({ key: entry.key, updatedAt }));
144
+ }
145
+ //# sourceMappingURL=capability-credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-credentials.js","sourceRoot":"","sources":["../src/capability-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAA;AAE/B,8EAA8E;AAC9E,2FAA2F;AAC3F,kCAAkC;AAClC,EAAE;AACF,gGAAgG;AAChG,+FAA+F;AAC/F,kGAAkG;AAClG,+FAA+F;AAC/F,gGAAgG;AAChG,iGAAiG;AACjG,sFAAsF;AACtF,EAAE;AACF,kGAAkG;AAClG,yFAAyF;AACzF,+FAA+F;AAC/F,+FAA+F;AAC/F,4FAA4F;AAC5F,8FAA8F;AAC9F,EAAE;AACF,gGAAgG;AAChG,+FAA+F;AAC/F,yFAAyF;AACzF,yDAAyD;AACzD,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CACjD,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,IAAI,EAAE,EACR,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACd,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAChB,CAAC,CAAC,KAAK,CACL,0BAA0B,EAC1B,wGAAwG,CACzG,EACD,CAAC,CAAC,KAAK,C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iC,GAAG,CAAC,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA;AACzF,MAAM,UAAU,gCAAgC,CAAC,GAAY;IAC3D,OAAO,CAAC,CAAC,KAAK,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAA;AACxD,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,4BAA4B,CAC1C,OAAoC,EACpC,SAAiB;IAEjB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChE,CAAC"}
@@ -910,14 +910,20 @@ export declare const modelCostSchema: v.ObjectSchema<{
910
910
  readonly currency: v.StringSchema<undefined>;
911
911
  }, undefined>;
912
912
  export type ModelCost = v.InferOutput<typeof modelCostSchema>;
913
+ /**
914
+ * The routes a catalog model can resolve to. Listed in the DEFAULT order they are
915
+ * preferred (see kernel's `DEFAULT_PROVIDER_PREFERENCE`, which is pinned against this
916
+ * picklist): a model's own provider API when its key is configured, then AWS Bedrock
917
+ * when the account's allow-list carries the model, then the OpenRouter gateway, then
918
+ * the always-available Workers AI fallback, and finally a Claude Code / Codex harness
919
+ * run on a stored subscription token.
920
+ */
921
+ export declare const modelFlavorSchema: v.PicklistSchema<["direct", "bedrock", "openrouter", "cloudflare", "subscription"], undefined>;
922
+ export type ModelFlavor = v.InferOutput<typeof modelFlavorSchema>;
913
923
  /**
914
924
  * A selectable LLM model, resolved to the flavour actually in use for this
915
- * deployment (`GET /models`). `flavor` is `direct` when the model's own provider
916
- * API key is configured, `openrouter` when it routes through the OpenRouter
917
- * gateway, `cloudflare` for the Workers AI fallback, or `subscription` for a
918
- * Claude Code / Codex model run via a stored subscription token. `provider`/`model`
919
- * are the effective {@link ModelRef} parts the agent will run with; the picker
920
- * stores only `id`.
925
+ * deployment (`GET /models`). `provider`/`model` are the effective {@link ModelRef}
926
+ * parts the agent will run with; the picker stores only `id`.
921
927
  */
922
928
  export declare const modelOptionSchema: v.ObjectSchema<{
923
929
  /** Stable id persisted on a block (`Block.modelId`). */
@@ -927,11 +933,12 @@ export declare const modelOptionSchema: v.ObjectSchema<{
927
933
  /** One-line description shown in the picker. */
928
934
  readonly description: v.StringSchema<undefined>;
929
935
  /** Which flavour is active for this deployment. */
930
- readonly flavor: v.PicklistSchema<["cloudflare", "direct", "openrouter", "subscription"], undefined>;
936
+ readonly flavor: v.PicklistSchema<["direct", "bedrock", "openrouter", "cloudflare", "subscription"], undefined>;
931
937
  /**
932
938
  * Whether this model is actually selectable given what the workspace has
933
939
  * configured: a direct key for its provider, a subscription token for its vendor,
934
- * or the opt-in Cloudflare lib enabled. The picker disables an unavailable model.
940
+ * the model in the deployment's Bedrock allow-list, or the opt-in Cloudflare lib
941
+ * enabled. The picker disables an unavailable model.
935
942
  */
936
943
  readonly available: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
937
944
  /**
@@ -1011,11 +1018,12 @@ export declare const modelCatalogSchema: v.ArraySchema<v.ObjectSchema<{
1011
1018
  /** One-line description shown in the picker. */
1012
1019
  readonly description: v.StringSchema<undefined>;
1013
1020
  /** Which flavour is active for this deployment. */
1014
- readonly flavor: v.PicklistSchema<["cloudflare", "direct", "openrouter", "subscription"], undefined>;
1021
+ readonly flavor: v.PicklistSchema<["direct", "bedrock", "openrouter", "cloudflare", "subscription"], undefined>;
1015
1022
  /**
1016
1023
  * Whether this model is actually selectable given what the workspace has
1017
1024
  * configured: a direct key for its provider, a subscription token for its vendor,
1018
- * or the opt-in Cloudflare lib enabled. The picker disables an unavailable model.
1025
+ * the model in the deployment's Bedrock allow-list, or the opt-in Cloudflare lib
1026
+ * enabled. The picker disables an unavailable model.
1019
1027
  */
1020
1028
  readonly available: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1021
1029
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"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WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAA;AAExE,eAAO,MAAM,eAAe;;;IAG1B,wDAAwD;;;IAGxD,8EAA8E;;IAE9E;;;;OAIG;;aAEH,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;IAC5B,2EAA2E;;IAE3E,kDAAkD;;IAElD,uDAAuD;;IAEvD,4DAA4D;;IAE5D,uDAAuD;;IAEvD,iEAAiE;;IAEjE,uFAAuF;;aAEvF,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B,gFAAgF;;IAEhF,6EAA6E;;IAE7E,+EAA+E;;aAE/E,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;IAClC,oGAAoG;;IAEpG,yGAAyG;;;;;;IAMzG,oFAAoF;;IAEpF,8CAA8C;;aAE9C,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;IAC5B,2EAA2E;;IAE3E,wDAAwD;;;QAvBxD,oGAAoG;;QAEpG,yGAAyG;;;;;;QAMzG,oFAAoF;;QAEpF,8CAA8C;;;aAgB9C,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
package/dist/entities.js CHANGED
@@ -538,14 +538,25 @@ export const modelCostSchema = v.object({
538
538
  /** ISO 4217 currency the prices are expressed in (e.g. `EUR`). */
539
539
  currency: v.string(),
540
540
  });
541
+ /**
542
+ * The routes a catalog model can resolve to. Listed in the DEFAULT order they are
543
+ * preferred (see kernel's `DEFAULT_PROVIDER_PREFERENCE`, which is pinned against this
544
+ * picklist): a model's own provider API when its key is configured, then AWS Bedrock
545
+ * when the account's allow-list carries the model, then the OpenRouter gateway, then
546
+ * the always-available Workers AI fallback, and finally a Claude Code / Codex harness
547
+ * run on a stored subscription token.
548
+ */
549
+ export const modelFlavorSchema = v.picklist([
550
+ 'direct',
551
+ 'bedrock',
552
+ 'openrouter',
553
+ 'cloudflare',
554
+ 'subscription',
555
+ ]);
541
556
  /**
542
557
  * A selectable LLM model, resolved to the flavour actually in use for this
543
- * deployment (`GET /models`). `flavor` is `direct` when the model's own provider
544
- * API key is configured, `openrouter` when it routes through the OpenRouter
545
- * gateway, `cloudflare` for the Workers AI fallback, or `subscription` for a
546
- * Claude Code / Codex model run via a stored subscription token. `provider`/`model`
547
- * are the effective {@link ModelRef} parts the agent will run with; the picker
548
- * stores only `id`.
558
+ * deployment (`GET /models`). `provider`/`model` are the effective {@link ModelRef}
559
+ * parts the agent will run with; the picker stores only `id`.
549
560
  */
550
561
  export const modelOptionSchema = v.object({
551
562
  /** Stable id persisted on a block (`Block.modelId`). */
@@ -555,11 +566,12 @@ export const modelOptionSchema = v.object({
555
566
  /** One-line description shown in the picker. */
556
567
  description: v.string(),
557
568
  /** Which flavour is active for this deployment. */
558
- flavor: v.picklist(['cloudflare', 'direct', 'openrouter', 'subscription']),
569
+ flavor: modelFlavorSchema,
559
570
  /**
560
571
  * Whether this model is actually selectable given what the workspace has
561
572
  * configured: a direct key for its provider, a subscription token for its vendor,
562
- * or the opt-in Cloudflare lib enabled. The picker disables an unavailable model.
573
+ * the model in the deployment's Bedrock allow-list, or the opt-in Cloudflare lib
574
+ * enabled. The picker disables an unavailable model.
563
575
  */
564
576
  available: v.optional(v.boolean()),
565
577
  /**