@cat-factory/contracts 0.17.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ import * as v from 'valibot';
2
+ /** The per-user secret kinds. Each maps to a registered handler (fields + test). */
3
+ export declare const USER_SECRET_KINDS: readonly ['github_pat'];
4
+ export declare const userSecretKindSchema: v.PicklistSchema<readonly ["github_pat"], undefined>;
5
+ export type UserSecretKind = v.InferOutput<typeof userSecretKindSchema>;
6
+ /** Read-only status of one stored per-user secret — never the secret value. */
7
+ export declare const userSecretStatusSchema: v.ObjectSchema<{
8
+ readonly kind: v.PicklistSchema<readonly ["github_pat"], undefined>;
9
+ readonly label: v.StringSchema<undefined>;
10
+ /** Whether a (write-only) secret is stored for this kind. */
11
+ readonly hasSecret: v.BooleanSchema<undefined>;
12
+ /** Non-secret metadata the kind keeps (e.g. `{ apiBase }`). */
13
+ readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
14
+ readonly connectedAt: v.NumberSchema<undefined>;
15
+ }, undefined>;
16
+ export type UserSecretStatus = v.InferOutput<typeof userSecretStatusSchema>;
17
+ /** Store (or replace) the signed-in user's secret for a kind. */
18
+ export declare const storeUserSecretSchema: v.ObjectSchema<{
19
+ readonly label: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 120, undefined>]>, undefined>;
20
+ /** The raw secret (write-only); stored encrypted at rest. */
21
+ readonly secret: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 4000, undefined>]>;
22
+ /** Optional non-secret metadata the kind understands (e.g. `apiBase`). */
23
+ readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, undefined>;
24
+ }, undefined>;
25
+ export type StoreUserSecretInput = v.InferOutput<typeof storeUserSecretSchema>;
26
+ /** Probe a (not-yet-saved) secret + metadata for reachability/validity. */
27
+ export declare const testUserSecretSchema: v.ObjectSchema<{
28
+ readonly secret: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 4000, undefined>]>;
29
+ readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, undefined>;
30
+ }, undefined>;
31
+ export type TestUserSecretInput = v.InferOutput<typeof testUserSecretSchema>;
32
+ /** A kind's self-description for the generic connect form. */
33
+ export declare const userSecretDescriptorSchema: v.ObjectSchema<{
34
+ readonly kind: v.PicklistSchema<readonly ["github_pat"], undefined>;
35
+ readonly label: v.StringSchema<undefined>;
36
+ readonly configFields: v.ArraySchema<v.ObjectSchema<{
37
+ readonly key: v.StringSchema<undefined>;
38
+ readonly label: v.StringSchema<undefined>;
39
+ readonly help: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
40
+ readonly placeholder: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
41
+ readonly secret: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
42
+ readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
43
+ readonly type: v.OptionalSchema<v.PicklistSchema<["text", "password", "select"], undefined>, undefined>;
44
+ readonly options: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
45
+ readonly value: v.StringSchema<undefined>;
46
+ readonly label: v.StringSchema<undefined>;
47
+ }, undefined>, undefined>, undefined>;
48
+ }, undefined>, undefined>;
49
+ readonly supportsTest: v.BooleanSchema<undefined>;
50
+ }, undefined>;
51
+ export type UserSecretDescriptor = v.InferOutput<typeof userSecretDescriptorSchema>;
52
+ //# sourceMappingURL=user-secret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-secret.d.ts","sourceRoot":"","sources":["../src/user-secret.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAgB5B,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,YAAI,YAAY,CAAU,CAAA;AACxD,eAAO,MAAM,oBAAoB,sDAAgC,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB;;;IAGjC,6DAA6D;;IAE7D,+DAA+D;;;aAG/D,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAM3E,iEAAiE;AACjE,eAAO,MAAM,qBAAqB;;IAEhC,6DAA6D;;IAE7D,0EAA0E;;aAE1E,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE9E,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB;;;aAG/B,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAE5E,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;aAKrC,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
@@ -0,0 +1,51 @@
1
+ import * as v from 'valibot';
2
+ import { providerConfigFieldSchema } from './provider-config.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Per-user secret wire contracts. A generic, `kind`-discriminated store for
5
+ // token-style per-user credentials — a GitHub personal access token today, and
6
+ // future repository/provider tokens (GitLab PAT, …) as new kinds with NO schema
7
+ // change. Each kind declares the config fields it needs (rendered generically,
8
+ // like the provider descriptors) and may expose a connection test.
9
+ //
10
+ // Distinct from `personal_subscriptions` (double-encrypted under a personal
11
+ // password, with per-run activation) and `local_model_endpoints` (base URL +
12
+ // enabled-model selection) — those carry real specializations and stay separate.
13
+ // This store is only for `{ secret, optional non-secret metadata }`.
14
+ // ---------------------------------------------------------------------------
15
+ /** The per-user secret kinds. Each maps to a registered handler (fields + test). */
16
+ export const USER_SECRET_KINDS = ['github_pat'];
17
+ export const userSecretKindSchema = v.picklist(USER_SECRET_KINDS);
18
+ /** Read-only status of one stored per-user secret — never the secret value. */
19
+ export const userSecretStatusSchema = v.object({
20
+ kind: userSecretKindSchema,
21
+ label: v.string(),
22
+ /** Whether a (write-only) secret is stored for this kind. */
23
+ hasSecret: v.boolean(),
24
+ /** Non-secret metadata the kind keeps (e.g. `{ apiBase }`). */
25
+ metadata: v.optional(v.record(v.string(), v.string())),
26
+ connectedAt: v.number(),
27
+ });
28
+ const labelSchema = v.pipe(v.string(), v.trim(), v.maxLength(120));
29
+ const secretSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(4000));
30
+ const metadataSchema = v.record(v.string(), v.pipe(v.string(), v.trim(), v.maxLength(2000)));
31
+ /** Store (or replace) the signed-in user's secret for a kind. */
32
+ export const storeUserSecretSchema = v.object({
33
+ label: v.optional(labelSchema),
34
+ /** The raw secret (write-only); stored encrypted at rest. */
35
+ secret: secretSchema,
36
+ /** Optional non-secret metadata the kind understands (e.g. `apiBase`). */
37
+ metadata: v.optional(metadataSchema),
38
+ });
39
+ /** Probe a (not-yet-saved) secret + metadata for reachability/validity. */
40
+ export const testUserSecretSchema = v.object({
41
+ secret: secretSchema,
42
+ metadata: v.optional(metadataSchema),
43
+ });
44
+ /** A kind's self-description for the generic connect form. */
45
+ export const userSecretDescriptorSchema = v.object({
46
+ kind: userSecretKindSchema,
47
+ label: v.string(),
48
+ configFields: v.array(providerConfigFieldSchema),
49
+ supportsTest: v.boolean(),
50
+ });
51
+ //# source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AC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AACpF,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAE5F,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;IAC9B,6DAA6D;IAC7D,MAAM,EAAE,YAAY;IACpB,0EAA0E;IAC1E,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC;CACrC,CAAC,CAAA;AAGF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC;CACrC,CAAC,CAAA;AAGF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC;IAChD,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;CAC1B,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/contracts",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "description": "Valibot wire contract shared between the Agent Architecture Board frontend and backend.",
5
5
  "repository": {
6
6
  "type": "git",