@cat-factory/contracts 0.6.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/LICENSE +21 -0
- package/dist/accounts.d.ts +103 -0
- package/dist/accounts.d.ts.map +1 -0
- package/dist/accounts.js +102 -0
- package/dist/accounts.js.map +1 -0
- package/dist/agent-config.d.ts +77 -0
- package/dist/agent-config.d.ts.map +1 -0
- package/dist/agent-config.js +78 -0
- package/dist/agent-config.js.map +1 -0
- package/dist/api-keys.d.ts +44 -0
- package/dist/api-keys.d.ts.map +1 -0
- package/dist/api-keys.js +49 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/auth.d.ts +24 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +15 -0
- package/dist/auth.js.map +1 -0
- package/dist/board-scan.d.ts +89 -0
- package/dist/board-scan.d.ts.map +1 -0
- package/dist/board-scan.js +122 -0
- package/dist/board-scan.js.map +1 -0
- package/dist/bootstrap.d.ts +168 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +148 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/clarity.d.ts +75 -0
- package/dist/clarity.d.ts.map +1 -0
- package/dist/clarity.js +66 -0
- package/dist/clarity.js.map +1 -0
- package/dist/companion.d.ts +32 -0
- package/dist/companion.d.ts.map +1 -0
- package/dist/companion.js +43 -0
- package/dist/companion.js.map +1 -0
- package/dist/consensus.d.ts +195 -0
- package/dist/consensus.d.ts.map +1 -0
- package/dist/consensus.js +164 -0
- package/dist/consensus.js.map +1 -0
- package/dist/documents.d.ts +197 -0
- package/dist/documents.d.ts.map +1 -0
- package/dist/documents.js +161 -0
- package/dist/documents.js.map +1 -0
- package/dist/entities.d.ts +1691 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +853 -0
- package/dist/entities.js.map +1 -0
- package/dist/environments.d.ts +426 -0
- package/dist/environments.d.ts.map +1 -0
- package/dist/environments.js +190 -0
- package/dist/environments.js.map +1 -0
- package/dist/events.d.ts +98 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/fragment-library.d.ts +123 -0
- package/dist/fragment-library.d.ts.map +1 -0
- package/dist/fragment-library.js +88 -0
- package/dist/fragment-library.js.map +1 -0
- package/dist/github.d.ts +215 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +204 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/iteration-cap.d.ts +17 -0
- package/dist/iteration-cap.d.ts.map +1 -0
- package/dist/iteration-cap.js +25 -0
- package/dist/iteration-cap.js.map +1 -0
- package/dist/localModels.d.ts +54 -0
- package/dist/localModels.d.ts.map +1 -0
- package/dist/localModels.js +79 -0
- package/dist/localModels.js.map +1 -0
- package/dist/merge.d.ts +106 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +129 -0
- package/dist/merge.js.map +1 -0
- package/dist/model-defaults.d.ts +23 -0
- package/dist/model-defaults.d.ts.map +1 -0
- package/dist/model-defaults.js +34 -0
- package/dist/model-defaults.js.map +1 -0
- package/dist/notifications.d.ts +136 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +125 -0
- package/dist/notifications.js.map +1 -0
- package/dist/observability.d.ts +271 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +152 -0
- package/dist/observability.js.map +1 -0
- package/dist/personal-subscriptions.d.ts +66 -0
- package/dist/personal-subscriptions.d.ts.map +1 -0
- package/dist/personal-subscriptions.js +70 -0
- package/dist/personal-subscriptions.js.map +1 -0
- package/dist/primitives.d.ts +57 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +66 -0
- package/dist/primitives.js.map +1 -0
- package/dist/provisioning.d.ts +46 -0
- package/dist/provisioning.d.ts.map +1 -0
- package/dist/provisioning.js +107 -0
- package/dist/provisioning.js.map +1 -0
- package/dist/recurring.d.ts +117 -0
- package/dist/recurring.d.ts.map +1 -0
- package/dist/recurring.js +99 -0
- package/dist/recurring.js.map +1 -0
- package/dist/release.d.ts +60 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +75 -0
- package/dist/release.js.map +1 -0
- package/dist/requests.d.ts +451 -0
- package/dist/requests.d.ts.map +1 -0
- package/dist/requests.js +231 -0
- package/dist/requests.js.map +1 -0
- package/dist/requirements.d.ts +127 -0
- package/dist/requirements.d.ts.map +1 -0
- package/dist/requirements.js +137 -0
- package/dist/requirements.js.map +1 -0
- package/dist/runners.d.ts +387 -0
- package/dist/runners.d.ts.map +1 -0
- package/dist/runners.js +117 -0
- package/dist/runners.js.map +1 -0
- package/dist/sandbox.d.ts +300 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +243 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/service-fragment-defaults.d.ts +16 -0
- package/dist/service-fragment-defaults.d.ts.map +1 -0
- package/dist/service-fragment-defaults.js +23 -0
- package/dist/service-fragment-defaults.js.map +1 -0
- package/dist/services.d.ts +81 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +77 -0
- package/dist/services.js.map +1 -0
- package/dist/slack.d.ts +104 -0
- package/dist/slack.d.ts.map +1 -0
- package/dist/slack.js +98 -0
- package/dist/slack.js.map +1 -0
- package/dist/snapshot.d.ts +522 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +104 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/spec.d.ts +174 -0
- package/dist/spec.d.ts.map +1 -0
- package/dist/spec.js +173 -0
- package/dist/spec.js.map +1 -0
- package/dist/tasks.d.ts +150 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +146 -0
- package/dist/tasks.js.map +1 -0
- package/dist/testing.d.ts +67 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +64 -0
- package/dist/testing.js.map +1 -0
- package/dist/tracker.d.ts +18 -0
- package/dist/tracker.d.ts.map +1 -0
- package/dist/tracker.js +24 -0
- package/dist/tracker.js.map +1 -0
- package/dist/vendor-credentials.d.ts +37 -0
- package/dist/vendor-credentials.d.ts.map +1 -0
- package/dist/vendor-credentials.js +40 -0
- package/dist/vendor-credentials.js.map +1 -0
- package/dist/workspace-settings.d.ts +36 -0
- package/dist/workspace-settings.d.ts.map +1 -0
- package/dist/workspace-settings.js +41 -0
- package/dist/workspace-settings.js.map +1 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Igor Savin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const accountTypeSchema: v.PicklistSchema<["personal", "org"], undefined>;
|
|
3
|
+
export type AccountType = v.InferOutput<typeof accountTypeSchema>;
|
|
4
|
+
export declare const accountRoleSchema: v.PicklistSchema<["admin", "developer", "product"], undefined>;
|
|
5
|
+
export type AccountRole = v.InferOutput<typeof accountRoleSchema>;
|
|
6
|
+
/** A member's combinable role set (at least one role). */
|
|
7
|
+
export declare const accountRolesSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["admin", "developer", "product"], undefined>, undefined>, v.MinLengthAction<("admin" | "developer" | "product")[], 1, undefined>]>;
|
|
8
|
+
export type AccountRoles = v.InferOutput<typeof accountRolesSchema>;
|
|
9
|
+
/** An account as exposed to clients, annotated with the caller's role in it. */
|
|
10
|
+
export declare const accountSchema: v.ObjectSchema<{
|
|
11
|
+
readonly id: v.StringSchema<undefined>;
|
|
12
|
+
readonly type: v.PicklistSchema<["personal", "org"], undefined>;
|
|
13
|
+
readonly name: v.StringSchema<undefined>;
|
|
14
|
+
/** The GitHub org/user login this account maps to, when known. */
|
|
15
|
+
readonly githubAccountLogin: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
16
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
17
|
+
/** The signed-in caller's roles in this account (`null` in the auth-disabled path). */
|
|
18
|
+
readonly roles: v.NullableSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["admin", "developer", "product"], undefined>, undefined>, v.MinLengthAction<("admin" | "developer" | "product")[], 1, undefined>]>, undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* The cloud provider new services in this account default to (a service may
|
|
21
|
+
* override it). Absent means the built-in {@link DEFAULT_CLOUD_PROVIDER}
|
|
22
|
+
* (`cloudflare`).
|
|
23
|
+
*/
|
|
24
|
+
readonly defaultCloudProvider: v.OptionalSchema<v.PicklistSchema<["cloudflare", "docker", "aws", "gcp", "azure", "custom"], undefined>, undefined>;
|
|
25
|
+
}, undefined>;
|
|
26
|
+
export type Account = v.InferOutput<typeof accountSchema>;
|
|
27
|
+
/** A member of an account. */
|
|
28
|
+
export declare const accountMemberSchema: v.ObjectSchema<{
|
|
29
|
+
readonly accountId: v.StringSchema<undefined>;
|
|
30
|
+
readonly userId: v.StringSchema<undefined>;
|
|
31
|
+
readonly roles: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["admin", "developer", "product"], undefined>, undefined>, v.MinLengthAction<("admin" | "developer" | "product")[], 1, undefined>]>;
|
|
32
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
33
|
+
/** Display details of the member (resolved from the users table), when available. */
|
|
34
|
+
readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
35
|
+
readonly email: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
36
|
+
readonly avatarUrl: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
37
|
+
}, undefined>;
|
|
38
|
+
export type AccountMember = v.InferOutput<typeof accountMemberSchema>;
|
|
39
|
+
/** Create a shared org account (the caller becomes its first owner). */
|
|
40
|
+
export declare const createAccountSchema: v.ObjectSchema<{
|
|
41
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>;
|
|
42
|
+
/** Optional GitHub org login this account maps to. */
|
|
43
|
+
readonly githubAccountLogin: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 120, undefined>]>, undefined>;
|
|
44
|
+
}, undefined>;
|
|
45
|
+
export type CreateAccountInput = v.InferOutput<typeof createAccountSchema>;
|
|
46
|
+
/** Update an account's settings (today: its default cloud provider for new services). */
|
|
47
|
+
export declare const updateAccountSchema: v.ObjectSchema<{
|
|
48
|
+
readonly defaultCloudProvider: v.OptionalSchema<v.PicklistSchema<["cloudflare", "docker", "aws", "gcp", "azure", "custom"], undefined>, undefined>;
|
|
49
|
+
}, undefined>;
|
|
50
|
+
export type UpdateAccountInput = v.InferOutput<typeof updateAccountSchema>;
|
|
51
|
+
/** Add a member to an account by their internal user id. */
|
|
52
|
+
export declare const addMemberSchema: v.ObjectSchema<{
|
|
53
|
+
readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
54
|
+
readonly roles: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["admin", "developer", "product"], undefined>, undefined>, v.MinLengthAction<("admin" | "developer" | "product")[], 1, undefined>]>, undefined>;
|
|
55
|
+
}, undefined>;
|
|
56
|
+
export type AddMemberInput = v.InferOutput<typeof addMemberSchema>;
|
|
57
|
+
/** Set a member's role set (admin-only). */
|
|
58
|
+
export declare const setMemberRolesSchema: v.ObjectSchema<{
|
|
59
|
+
readonly roles: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["admin", "developer", "product"], undefined>, undefined>, v.MinLengthAction<("admin" | "developer" | "product")[], 1, undefined>]>;
|
|
60
|
+
}, undefined>;
|
|
61
|
+
export type SetMemberRolesInput = v.InferOutput<typeof setMemberRolesSchema>;
|
|
62
|
+
export declare const invitationStatusSchema: v.PicklistSchema<["pending", "accepted", "revoked"], undefined>;
|
|
63
|
+
export type InvitationStatus = v.InferOutput<typeof invitationStatusSchema>;
|
|
64
|
+
/** An account invitation as exposed to clients (never carries the raw token). */
|
|
65
|
+
export declare const accountInvitationSchema: v.ObjectSchema<{
|
|
66
|
+
readonly id: v.StringSchema<undefined>;
|
|
67
|
+
readonly accountId: v.StringSchema<undefined>;
|
|
68
|
+
readonly email: v.StringSchema<undefined>;
|
|
69
|
+
readonly roles: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["admin", "developer", "product"], undefined>, undefined>, v.MinLengthAction<("admin" | "developer" | "product")[], 1, undefined>]>;
|
|
70
|
+
readonly status: v.PicklistSchema<["pending", "accepted", "revoked"], undefined>;
|
|
71
|
+
readonly invitedBy: v.StringSchema<undefined>;
|
|
72
|
+
readonly expiresAt: v.NumberSchema<undefined>;
|
|
73
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
74
|
+
}, undefined>;
|
|
75
|
+
export type AccountInvitation = v.InferOutput<typeof accountInvitationSchema>;
|
|
76
|
+
/** Invite a teammate by email into an org account. */
|
|
77
|
+
export declare const createInvitationSchema: v.ObjectSchema<{
|
|
78
|
+
readonly email: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>;
|
|
79
|
+
readonly roles: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["admin", "developer", "product"], undefined>, undefined>, v.MinLengthAction<("admin" | "developer" | "product")[], 1, undefined>]>, undefined>;
|
|
80
|
+
}, undefined>;
|
|
81
|
+
export type CreateInvitationInput = v.InferOutput<typeof createInvitationSchema>;
|
|
82
|
+
export declare const emailProviderKindSchema: v.PicklistSchema<["sendgrid", "resend"], undefined>;
|
|
83
|
+
export type EmailProviderKind = v.InferOutput<typeof emailProviderKindSchema>;
|
|
84
|
+
/** Safe email-connection metadata exposed to clients (never the API key). */
|
|
85
|
+
export declare const emailConnectionSchema: v.ObjectSchema<{
|
|
86
|
+
readonly provider: v.PicklistSchema<["sendgrid", "resend"], undefined>;
|
|
87
|
+
readonly fromAddress: v.StringSchema<undefined>;
|
|
88
|
+
readonly connectedAt: v.NumberSchema<undefined>;
|
|
89
|
+
}, undefined>;
|
|
90
|
+
export type EmailConnection = v.InferOutput<typeof emailConnectionSchema>;
|
|
91
|
+
/** Connect (or replace) an account's email sender. */
|
|
92
|
+
export declare const connectEmailSchema: v.ObjectSchema<{
|
|
93
|
+
readonly provider: v.PicklistSchema<["sendgrid", "resend"], undefined>;
|
|
94
|
+
readonly apiKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 500, undefined>]>;
|
|
95
|
+
readonly fromAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>;
|
|
96
|
+
}, undefined>;
|
|
97
|
+
export type ConnectEmailInput = v.InferOutput<typeof connectEmailSchema>;
|
|
98
|
+
/** Send a test email through a connected account sender. */
|
|
99
|
+
export declare const testEmailSchema: v.ObjectSchema<{
|
|
100
|
+
readonly to: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>;
|
|
101
|
+
}, undefined>;
|
|
102
|
+
export type TestEmailInput = v.InferOutput<typeof testEmailSchema>;
|
|
103
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAU5B,eAAO,MAAM,iBAAiB,kDAAkC,CAAA;AAChE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAOjE,eAAO,MAAM,iBAAiB,gEAAgD,CAAA;AAC9E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEjE,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,+LAAqD,CAAA;AACpF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,gFAAgF;AAChF,eAAO,MAAM,aAAa;;;;IAIxB,kEAAkE;;;IAGlE,uFAAuF;;IAE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,CAAA;AAIhF,eAAO,MAAM,uBAAuB,qDAAqC,CAAA;AACzE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;aAIhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,sDAAsD;AACtD,eAAO,MAAM,kBAAkB;;;;aAI7B,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAExE,4DAA4D;AAC5D,eAAO,MAAM,eAAe;;aAE1B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA"}
|
package/dist/accounts.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { cloudProviderSchema } from './provisioning.js';
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Account tenancy wire contracts. An account is the tenant that owns workspaces:
|
|
5
|
+
// either a single user's `personal` account or an `org` shared by many engineers.
|
|
6
|
+
// Memberships map GitHub users to accounts with a role. A GitHub App installation
|
|
7
|
+
// is bound to an account, so every workspace in it can link the account's repos.
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
export const accountTypeSchema = v.picklist(['personal', 'org']);
|
|
10
|
+
// Combinable account roles. `admin` may modify anything about the org account
|
|
11
|
+
// (settings, members, invitations, account-scoped credentials); `developer` is the
|
|
12
|
+
// default and grants no special powers; `product` people can be set as a task's
|
|
13
|
+
// responsible person and are notified when requirement review flags findings. A member
|
|
14
|
+
// holds a SET of these (e.g. an admin who is also a product owner).
|
|
15
|
+
export const accountRoleSchema = v.picklist(['admin', 'developer', 'product']);
|
|
16
|
+
/** A member's combinable role set (at least one role). */
|
|
17
|
+
export const accountRolesSchema = v.pipe(v.array(accountRoleSchema), v.minLength(1));
|
|
18
|
+
/** An account as exposed to clients, annotated with the caller's role in it. */
|
|
19
|
+
export const accountSchema = v.object({
|
|
20
|
+
id: v.string(),
|
|
21
|
+
type: accountTypeSchema,
|
|
22
|
+
name: v.string(),
|
|
23
|
+
/** The GitHub org/user login this account maps to, when known. */
|
|
24
|
+
githubAccountLogin: v.nullable(v.string()),
|
|
25
|
+
createdAt: v.number(),
|
|
26
|
+
/** The signed-in caller's roles in this account (`null` in the auth-disabled path). */
|
|
27
|
+
roles: v.nullable(accountRolesSchema),
|
|
28
|
+
/**
|
|
29
|
+
* The cloud provider new services in this account default to (a service may
|
|
30
|
+
* override it). Absent means the built-in {@link DEFAULT_CLOUD_PROVIDER}
|
|
31
|
+
* (`cloudflare`).
|
|
32
|
+
*/
|
|
33
|
+
defaultCloudProvider: v.optional(cloudProviderSchema),
|
|
34
|
+
});
|
|
35
|
+
/** A member of an account. */
|
|
36
|
+
export const accountMemberSchema = v.object({
|
|
37
|
+
accountId: v.string(),
|
|
38
|
+
userId: v.string(),
|
|
39
|
+
roles: accountRolesSchema,
|
|
40
|
+
createdAt: v.number(),
|
|
41
|
+
/** Display details of the member (resolved from the users table), when available. */
|
|
42
|
+
name: v.optional(v.nullable(v.string())),
|
|
43
|
+
email: v.optional(v.nullable(v.string())),
|
|
44
|
+
avatarUrl: v.optional(v.nullable(v.string())),
|
|
45
|
+
});
|
|
46
|
+
// ---- Request bodies -------------------------------------------------------
|
|
47
|
+
/** Create a shared org account (the caller becomes its first owner). */
|
|
48
|
+
export const createAccountSchema = v.object({
|
|
49
|
+
name: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(120)),
|
|
50
|
+
/** Optional GitHub org login this account maps to. */
|
|
51
|
+
githubAccountLogin: v.optional(v.pipe(v.string(), v.trim(), v.maxLength(120))),
|
|
52
|
+
});
|
|
53
|
+
/** Update an account's settings (today: its default cloud provider for new services). */
|
|
54
|
+
export const updateAccountSchema = v.object({
|
|
55
|
+
defaultCloudProvider: v.optional(cloudProviderSchema),
|
|
56
|
+
});
|
|
57
|
+
/** Add a member to an account by their internal user id. */
|
|
58
|
+
export const addMemberSchema = v.object({
|
|
59
|
+
userId: v.pipe(v.string(), v.minLength(1)),
|
|
60
|
+
roles: v.optional(accountRolesSchema),
|
|
61
|
+
});
|
|
62
|
+
/** Set a member's role set (admin-only). */
|
|
63
|
+
export const setMemberRolesSchema = v.object({
|
|
64
|
+
roles: accountRolesSchema,
|
|
65
|
+
});
|
|
66
|
+
// ---- Invitations ----------------------------------------------------------
|
|
67
|
+
export const invitationStatusSchema = v.picklist(['pending', 'accepted', 'revoked']);
|
|
68
|
+
/** An account invitation as exposed to clients (never carries the raw token). */
|
|
69
|
+
export const accountInvitationSchema = v.object({
|
|
70
|
+
id: v.string(),
|
|
71
|
+
accountId: v.string(),
|
|
72
|
+
email: v.string(),
|
|
73
|
+
roles: accountRolesSchema,
|
|
74
|
+
status: invitationStatusSchema,
|
|
75
|
+
invitedBy: v.string(),
|
|
76
|
+
expiresAt: v.number(),
|
|
77
|
+
createdAt: v.number(),
|
|
78
|
+
});
|
|
79
|
+
/** Invite a teammate by email into an org account. */
|
|
80
|
+
export const createInvitationSchema = v.object({
|
|
81
|
+
email: v.pipe(v.string(), v.trim(), v.email(), v.maxLength(320)),
|
|
82
|
+
roles: v.optional(accountRolesSchema),
|
|
83
|
+
});
|
|
84
|
+
// ---- Email sender connection (per-account, UI-onboarded) ------------------
|
|
85
|
+
export const emailProviderKindSchema = v.picklist(['sendgrid', 'resend']);
|
|
86
|
+
/** Safe email-connection metadata exposed to clients (never the API key). */
|
|
87
|
+
export const emailConnectionSchema = v.object({
|
|
88
|
+
provider: emailProviderKindSchema,
|
|
89
|
+
fromAddress: v.string(),
|
|
90
|
+
connectedAt: v.number(),
|
|
91
|
+
});
|
|
92
|
+
/** Connect (or replace) an account's email sender. */
|
|
93
|
+
export const connectEmailSchema = v.object({
|
|
94
|
+
provider: emailProviderKindSchema,
|
|
95
|
+
apiKey: v.pipe(v.string(), v.minLength(1), v.maxLength(500)),
|
|
96
|
+
fromAddress: v.pipe(v.string(), v.trim(), v.email(), v.maxLength(320)),
|
|
97
|
+
});
|
|
98
|
+
/** Send a test email through a connected account sender. */
|
|
99
|
+
export const testEmailSchema = v.object({
|
|
100
|
+
to: v.pipe(v.string(), v.trim(), v.email(), v.maxLength(320)),
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAEvD,8EAA8E;AAC9E,iFAAiF;AACjF,kFAAkF;AAClF,kFAAkF;AAClF,iFAAiF;AACjF,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAA;AAGhE,8EAA8E;AAC9E,mFAAmF;AACnF,gFAAgF;AAChF,uFAAuF;AACvF,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAA;AAG9E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AAGpF,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,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CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;CAC9D,CAAC,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
/** One selectable choice for a `select`-typed config descriptor. */
|
|
3
|
+
export declare const agentConfigOptionSchema: v.ObjectSchema<{
|
|
4
|
+
/** The value persisted on the block when this option is chosen. */
|
|
5
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
6
|
+
/** Human label shown in the picker. */
|
|
7
|
+
readonly label: v.StringSchema<undefined>;
|
|
8
|
+
}, undefined>;
|
|
9
|
+
export type AgentConfigOption = v.InferOutput<typeof agentConfigOptionSchema>;
|
|
10
|
+
/**
|
|
11
|
+
* A single configuration parameter an agent kind contributes. `id` is a stable,
|
|
12
|
+
* globally-unique key (conventionally namespaced by the kind, e.g.
|
|
13
|
+
* `tester.environment`) used both as the descriptor key and as the key under
|
|
14
|
+
* which the chosen value is stored in {@link agentConfigValuesSchema}. `type` is a
|
|
15
|
+
* picklist for forward-compatibility — only `select` exists today, but a future
|
|
16
|
+
* `text`/`number`/`boolean` descriptor slots in here without a shape change.
|
|
17
|
+
*/
|
|
18
|
+
export declare const agentConfigDescriptorSchema: v.ObjectSchema<{
|
|
19
|
+
/** Stable, globally-unique id, e.g. `tester.environment`. Also the value-map key. */
|
|
20
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
21
|
+
/** The agent kind that contributes (and owns the freeze of) this config. */
|
|
22
|
+
readonly agentKind: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
23
|
+
/** Human label shown next to the field. */
|
|
24
|
+
readonly label: v.StringSchema<undefined>;
|
|
25
|
+
/** One-line explanation shown under the field. */
|
|
26
|
+
readonly description: v.StringSchema<undefined>;
|
|
27
|
+
/** The control type. Only `select` today; designed to grow. */
|
|
28
|
+
readonly type: v.PicklistSchema<["select"], undefined>;
|
|
29
|
+
/** The choices for a `select` descriptor. */
|
|
30
|
+
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
31
|
+
/** The value persisted on the block when this option is chosen. */
|
|
32
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
33
|
+
/** Human label shown in the picker. */
|
|
34
|
+
readonly label: v.StringSchema<undefined>;
|
|
35
|
+
}, undefined>, undefined>;
|
|
36
|
+
/** The value used when the task has made no explicit choice. */
|
|
37
|
+
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
38
|
+
}, undefined>;
|
|
39
|
+
export type AgentConfigDescriptor = v.InferOutput<typeof agentConfigDescriptorSchema>;
|
|
40
|
+
/** The full catalog of config descriptors, attached to the workspace snapshot. */
|
|
41
|
+
export declare const agentConfigCatalogSchema: v.ArraySchema<v.ObjectSchema<{
|
|
42
|
+
/** Stable, globally-unique id, e.g. `tester.environment`. Also the value-map key. */
|
|
43
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
44
|
+
/** The agent kind that contributes (and owns the freeze of) this config. */
|
|
45
|
+
readonly agentKind: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
46
|
+
/** Human label shown next to the field. */
|
|
47
|
+
readonly label: v.StringSchema<undefined>;
|
|
48
|
+
/** One-line explanation shown under the field. */
|
|
49
|
+
readonly description: v.StringSchema<undefined>;
|
|
50
|
+
/** The control type. Only `select` today; designed to grow. */
|
|
51
|
+
readonly type: v.PicklistSchema<["select"], undefined>;
|
|
52
|
+
/** The choices for a `select` descriptor. */
|
|
53
|
+
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
54
|
+
/** The value persisted on the block when this option is chosen. */
|
|
55
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
56
|
+
/** Human label shown in the picker. */
|
|
57
|
+
readonly label: v.StringSchema<undefined>;
|
|
58
|
+
}, undefined>, undefined>;
|
|
59
|
+
/** The value used when the task has made no explicit choice. */
|
|
60
|
+
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
61
|
+
}, undefined>, undefined>;
|
|
62
|
+
export type AgentConfigCatalog = v.InferOutput<typeof agentConfigCatalogSchema>;
|
|
63
|
+
/**
|
|
64
|
+
* The selected configuration values on a block: a plain map from descriptor id to
|
|
65
|
+
* the chosen value. Sparse — only ids the user has explicitly set are present;
|
|
66
|
+
* everything else resolves to the descriptor's `default` at read time.
|
|
67
|
+
*/
|
|
68
|
+
export declare const agentConfigValuesSchema: v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>;
|
|
69
|
+
export type AgentConfigValues = v.InferOutput<typeof agentConfigValuesSchema>;
|
|
70
|
+
/** Parse-or-throw a block's stored agent-config values. */
|
|
71
|
+
export declare function parseAgentConfigValues(value: unknown): AgentConfigValues;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve a single descriptor's effective value for a block: the explicit choice
|
|
74
|
+
* if present and valid, else the descriptor's default.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveAgentConfigValue(descriptor: AgentConfigDescriptor, values: AgentConfigValues | undefined): string;
|
|
77
|
+
//# sourceMappingURL=agent-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { agentKindSchema } from './primitives.js';
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Agent configuration-contribution contracts.
|
|
5
|
+
//
|
|
6
|
+
// Agents (built-in or custom) may *contribute* task-level configuration
|
|
7
|
+
// parameters they care about — e.g. the `tester` agent contributes whether it
|
|
8
|
+
// runs the suite against an ephemeral environment or stands the dependencies up
|
|
9
|
+
// locally. When a pipeline is selected for a task, the union of the contributions
|
|
10
|
+
// of that pipeline's agent kinds is surfaced as editable fields on task creation
|
|
11
|
+
// and in the inspector. Each value is editable until the contributing agent's
|
|
12
|
+
// pipeline step starts, at which point it freezes.
|
|
13
|
+
//
|
|
14
|
+
// The descriptor catalog is STATIC metadata derived from the registered agent
|
|
15
|
+
// kinds (see `@cat-factory/agents` `configContributionsFor`), attached to the
|
|
16
|
+
// workspace snapshot. The selected VALUES live on the block (`Block.agentConfig`),
|
|
17
|
+
// a plain id→value map. This mirrors how the model/fragment/merge-preset catalogs
|
|
18
|
+
// are served read-only while the per-block selection is persisted on the block.
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/** One selectable choice for a `select`-typed config descriptor. */
|
|
21
|
+
export const agentConfigOptionSchema = v.object({
|
|
22
|
+
/** The value persisted on the block when this option is chosen. */
|
|
23
|
+
value: v.pipe(v.string(), v.minLength(1)),
|
|
24
|
+
/** Human label shown in the picker. */
|
|
25
|
+
label: v.string(),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* A single configuration parameter an agent kind contributes. `id` is a stable,
|
|
29
|
+
* globally-unique key (conventionally namespaced by the kind, e.g.
|
|
30
|
+
* `tester.environment`) used both as the descriptor key and as the key under
|
|
31
|
+
* which the chosen value is stored in {@link agentConfigValuesSchema}. `type` is a
|
|
32
|
+
* picklist for forward-compatibility — only `select` exists today, but a future
|
|
33
|
+
* `text`/`number`/`boolean` descriptor slots in here without a shape change.
|
|
34
|
+
*/
|
|
35
|
+
export const agentConfigDescriptorSchema = v.object({
|
|
36
|
+
/** Stable, globally-unique id, e.g. `tester.environment`. Also the value-map key. */
|
|
37
|
+
id: v.pipe(v.string(), v.minLength(1)),
|
|
38
|
+
/** The agent kind that contributes (and owns the freeze of) this config. */
|
|
39
|
+
agentKind: agentKindSchema,
|
|
40
|
+
/** Human label shown next to the field. */
|
|
41
|
+
label: v.string(),
|
|
42
|
+
/** One-line explanation shown under the field. */
|
|
43
|
+
description: v.string(),
|
|
44
|
+
/** The control type. Only `select` today; designed to grow. */
|
|
45
|
+
type: v.picklist(['select']),
|
|
46
|
+
/** The choices for a `select` descriptor. */
|
|
47
|
+
options: v.array(agentConfigOptionSchema),
|
|
48
|
+
/** The value used when the task has made no explicit choice. */
|
|
49
|
+
default: v.pipe(v.string(), v.minLength(1)),
|
|
50
|
+
});
|
|
51
|
+
/** The full catalog of config descriptors, attached to the workspace snapshot. */
|
|
52
|
+
export const agentConfigCatalogSchema = v.array(agentConfigDescriptorSchema);
|
|
53
|
+
/**
|
|
54
|
+
* The selected configuration values on a block: a plain map from descriptor id to
|
|
55
|
+
* the chosen value. Sparse — only ids the user has explicitly set are present;
|
|
56
|
+
* everything else resolves to the descriptor's `default` at read time.
|
|
57
|
+
*/
|
|
58
|
+
// Keys are descriptor ids (e.g. `tester.environment`) and values are short option
|
|
59
|
+
// values; both are length-capped so a stray client can't persist an unbounded map.
|
|
60
|
+
// Values are NOT validated against the descriptor catalog here (the contracts layer
|
|
61
|
+
// can't see the runtime-registered descriptors) — `resolveAgentConfigValue` falls
|
|
62
|
+
// back to the descriptor default for any unknown/invalid value at read time.
|
|
63
|
+
export const agentConfigValuesSchema = v.record(v.pipe(v.string(), v.minLength(1), v.maxLength(120)), v.pipe(v.string(), v.maxLength(400)));
|
|
64
|
+
/** Parse-or-throw a block's stored agent-config values. */
|
|
65
|
+
export function parseAgentConfigValues(value) {
|
|
66
|
+
return v.parse(agentConfigValuesSchema, value);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolve a single descriptor's effective value for a block: the explicit choice
|
|
70
|
+
* if present and valid, else the descriptor's default.
|
|
71
|
+
*/
|
|
72
|
+
export function resolveAgentConfigValue(descriptor, values) {
|
|
73
|
+
const chosen = values?.[descriptor.id];
|
|
74
|
+
if (chosen && descriptor.options.some((o) => o.value === chosen))
|
|
75
|
+
return chosen;
|
|
76
|
+
return descriptor.default;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=agent-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-config.js","sourceRoot":"","sources":["../src/agent-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,8EAA8E;AAC9E,8CAA8C;AAC9C,EAAE;AACF,wEAAwE;AACxE,8EAA8E;AAC9E,gFAAgF;AAChF,kFAAkF;AAClF,iFAAiF;AACjF,8EAA8E;AAC9E,mDAAmD;AACnD,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,mFAAmF;AACnF,kFAAkF;AAClF,gFAAgF;AAChF,8EAA8E;AAE9E,oEAAoE;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,mEAAmE;IACnE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACzC,uCAAuC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAA;AAGF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,qFAAqF;IACrF,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAA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CAAA;IACtC,IAAI,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC;QAAE,OAAO,MAAM,CAAA;IAC/E,OAAO,UAAU,CAAC,OAAO,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
/** The scope a stored API key belongs to. */
|
|
3
|
+
export declare const apiKeyScopeSchema: v.PicklistSchema<["account", "workspace", "user"], undefined>;
|
|
4
|
+
export type ApiKeyScope = v.InferOutput<typeof apiKeyScopeSchema>;
|
|
5
|
+
/** The direct providers that own a poolable API key. */
|
|
6
|
+
export declare const apiKeyProviderSchema: v.PicklistSchema<["openai", "anthropic", "qwen", "deepseek", "moonshot", "openrouter", "litellm"], undefined>;
|
|
7
|
+
export type ApiKeyProvider = v.InferOutput<typeof apiKeyProviderSchema>;
|
|
8
|
+
/** One pool key as exposed to clients — metadata + usage, never the secret. */
|
|
9
|
+
export declare const apiKeySchema: v.ObjectSchema<{
|
|
10
|
+
readonly id: v.StringSchema<undefined>;
|
|
11
|
+
readonly scope: v.PicklistSchema<["account", "workspace", "user"], undefined>;
|
|
12
|
+
readonly scopeId: v.StringSchema<undefined>;
|
|
13
|
+
readonly provider: v.PicklistSchema<["openai", "anthropic", "qwen", "deepseek", "moonshot", "openrouter", "litellm"], undefined>;
|
|
14
|
+
readonly label: v.StringSchema<undefined>;
|
|
15
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
16
|
+
readonly lastUsedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
17
|
+
/** Rolling-window usage so the UI can show load and rotation fairness. */
|
|
18
|
+
readonly inputTokens: v.NumberSchema<undefined>;
|
|
19
|
+
readonly outputTokens: v.NumberSchema<undefined>;
|
|
20
|
+
readonly requestCount: v.NumberSchema<undefined>;
|
|
21
|
+
}, undefined>;
|
|
22
|
+
export type ApiKey = v.InferOutput<typeof apiKeySchema>;
|
|
23
|
+
export declare const apiKeyListSchema: v.ArraySchema<v.ObjectSchema<{
|
|
24
|
+
readonly id: v.StringSchema<undefined>;
|
|
25
|
+
readonly scope: v.PicklistSchema<["account", "workspace", "user"], undefined>;
|
|
26
|
+
readonly scopeId: v.StringSchema<undefined>;
|
|
27
|
+
readonly provider: v.PicklistSchema<["openai", "anthropic", "qwen", "deepseek", "moonshot", "openrouter", "litellm"], undefined>;
|
|
28
|
+
readonly label: v.StringSchema<undefined>;
|
|
29
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
30
|
+
readonly lastUsedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
31
|
+
/** Rolling-window usage so the UI can show load and rotation fairness. */
|
|
32
|
+
readonly inputTokens: v.NumberSchema<undefined>;
|
|
33
|
+
readonly outputTokens: v.NumberSchema<undefined>;
|
|
34
|
+
readonly requestCount: v.NumberSchema<undefined>;
|
|
35
|
+
}, undefined>, undefined>;
|
|
36
|
+
export type ApiKeyList = v.InferOutput<typeof apiKeyListSchema>;
|
|
37
|
+
/** Add a key to a pool. `key` is write-only (the raw secret). */
|
|
38
|
+
export declare const addApiKeySchema: v.ObjectSchema<{
|
|
39
|
+
readonly provider: v.PicklistSchema<["openai", "anthropic", "qwen", "deepseek", "moonshot", "openrouter", "litellm"], undefined>;
|
|
40
|
+
readonly label: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>;
|
|
41
|
+
readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
42
|
+
}, undefined>;
|
|
43
|
+
export type AddApiKeyInput = v.InferOutput<typeof addApiKeySchema>;
|
|
44
|
+
//# sourceMappingURL=api-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAc5B,6CAA6C;AAC7C,eAAO,MAAM,iBAAiB,+DAA+C,CAAA;AAC7E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEjE,wDAAwD;AACxD,eAAO,MAAM,oBAAoB,+GAW/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE,+EAA+E;AAC/E,eAAO,MAAM,YAAY;;;;;;;;IAQvB,0EAA0E;;;;aAI1E,CAAA;AACF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,YAAY,CAAC,CAAA;AAEvD,eAAO,MAAM,gBAAgB;;;;;;;;IAP3B,0EAA0E;;;;yBAOvB,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D,iEAAiE;AACjE,eAAO,MAAM,eAAe;;;;aAI1B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA"}
|
package/dist/api-keys.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Direct-provider API-key wire contracts.
|
|
4
|
+
//
|
|
5
|
+
// Vendor API keys (OpenAI/Anthropic/Qwen/DeepSeek/Moonshot) are onboarded via the
|
|
6
|
+
// UI and stored encrypted in the DB, replacing the old deployment-env onboarding.
|
|
7
|
+
// A key lives at one of three SCOPES — account, workspace, or user. Within a
|
|
8
|
+
// workspace the candidate pool is the union of the workspace's keys, its owning
|
|
9
|
+
// account's keys, and the run initiator's own user keys; keys are leased with
|
|
10
|
+
// usage-aware rotation. The raw key is write-only — encrypted at rest and never
|
|
11
|
+
// returned; only metadata + rolling-window usage is exposed back to clients.
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
/** The scope a stored API key belongs to. */
|
|
14
|
+
export const apiKeyScopeSchema = v.picklist(['account', 'workspace', 'user']);
|
|
15
|
+
/** The direct providers that own a poolable API key. */
|
|
16
|
+
export const apiKeyProviderSchema = v.picklist([
|
|
17
|
+
'openai',
|
|
18
|
+
'anthropic',
|
|
19
|
+
'qwen',
|
|
20
|
+
'deepseek',
|
|
21
|
+
'moonshot',
|
|
22
|
+
// OpenAI-compatible aggregator/gateway providers: OpenRouter (a single hosted gateway
|
|
23
|
+
// to 300+ models) and LiteLLM (an operator-hosted gateway; its base URL comes from the
|
|
24
|
+
// deployment's LITELLM_BASE_URL). Both resolve via the shared OpenAI-compatible path.
|
|
25
|
+
'openrouter',
|
|
26
|
+
'litellm',
|
|
27
|
+
]);
|
|
28
|
+
/** One pool key as exposed to clients — metadata + usage, never the secret. */
|
|
29
|
+
export const apiKeySchema = v.object({
|
|
30
|
+
id: v.string(),
|
|
31
|
+
scope: apiKeyScopeSchema,
|
|
32
|
+
scopeId: v.string(),
|
|
33
|
+
provider: apiKeyProviderSchema,
|
|
34
|
+
label: v.string(),
|
|
35
|
+
createdAt: v.number(),
|
|
36
|
+
lastUsedAt: v.nullable(v.number()),
|
|
37
|
+
/** Rolling-window usage so the UI can show load and rotation fairness. */
|
|
38
|
+
inputTokens: v.number(),
|
|
39
|
+
outputTokens: v.number(),
|
|
40
|
+
requestCount: v.number(),
|
|
41
|
+
});
|
|
42
|
+
export const apiKeyListSchema = v.array(apiKeySchema);
|
|
43
|
+
/** Add a key to a pool. `key` is write-only (the raw secret). */
|
|
44
|
+
export const addApiKeySchema = v.object({
|
|
45
|
+
provider: apiKeyProviderSchema,
|
|
46
|
+
label: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(120)),
|
|
47
|
+
key: v.pipe(v.string(), v.trim(), v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E;CACzB,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;AAGrD,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,oBAAoB;IAC9B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACrE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAClD,CAAC,CAAA"}
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const signupSchema: v.ObjectSchema<{
|
|
3
|
+
readonly email: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>;
|
|
4
|
+
readonly password: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 8, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
|
|
5
|
+
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 120, undefined>]>, undefined>;
|
|
6
|
+
/** Optional invitation token to redeem on signup (grants org membership). */
|
|
7
|
+
readonly invite: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
8
|
+
}, undefined>;
|
|
9
|
+
export type SignupInput = v.InferOutput<typeof signupSchema>;
|
|
10
|
+
export declare const passwordLoginSchema: v.ObjectSchema<{
|
|
11
|
+
readonly email: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>;
|
|
12
|
+
readonly password: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
export type PasswordLoginInput = v.InferOutput<typeof passwordLoginSchema>;
|
|
15
|
+
/** What `GET /auth/config` reports so the SPA renders the right login controls. */
|
|
16
|
+
export interface AuthProvidersConfig {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
providers: {
|
|
19
|
+
github: boolean;
|
|
20
|
+
password: boolean;
|
|
21
|
+
google: boolean;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAK5B,eAAO,MAAM,YAAY;;;;IAIvB,6EAA6E;;aAE7E,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,YAAY,CAAC,CAAA;AAE5D,eAAO,MAAM,mBAAmB;;;aAG9B,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE1E,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAA;CACnE"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
// Wire contracts for the email/password + invite auth flows. OAuth flows are pure
|
|
3
|
+
// browser redirects, so they need no request body schema.
|
|
4
|
+
export const signupSchema = v.object({
|
|
5
|
+
email: v.pipe(v.string(), v.trim(), v.email(), v.maxLength(320)),
|
|
6
|
+
password: v.pipe(v.string(), v.minLength(8), v.maxLength(200)),
|
|
7
|
+
name: v.optional(v.pipe(v.string(), v.trim(), v.maxLength(120))),
|
|
8
|
+
/** Optional invitation token to redeem on signup (grants org membership). */
|
|
9
|
+
invite: v.optional(v.pipe(v.string(), v.minLength(1))),
|
|
10
|
+
});
|
|
11
|
+
export const passwordLoginSchema = v.object({
|
|
12
|
+
email: v.pipe(v.string(), v.trim(), v.email(), v.maxLength(320)),
|
|
13
|
+
password: v.pipe(v.string(), v.minLength(1), v.maxLength(200)),
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,kFAAkF;AAClF,0DAA0D;AAE1D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAChE,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9D,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CA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