@sealant/api-contracts-next 0.40.0-next.814 → 0.40.0-next.816
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-api/connected-accounts.d.ts +27 -1
- package/dist/core-api/connected-accounts.js +16 -2
- package/dist/core-api/control-plane.d.ts +1009 -997
- package/dist/core-api/endpoint-url.d.ts +22 -0
- package/dist/core-api/endpoint-url.js +54 -0
- package/dist/core-api/profiles.d.ts +4 -0
- package/dist/core-api/system.d.ts +14 -0
- package/dist/core-api/system.js +7 -0
- package/dist/core-api/workspaces.d.ts +12 -1
- package/dist/core-api/workspaces.js +4 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base URL of a compatible endpoint an API-key login sends its requests to, such as a company
|
|
3
|
+
* gateway: Anthropic-compatible for a Claude login, OpenAI-compatible for a Codex login.
|
|
4
|
+
*/
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
/**
|
|
7
|
+
* An absolute `http:` or `https:` URL with a host, and no user name, password, query string or
|
|
8
|
+
* fragment. Decoding normalizes it: the host as the URL standard writes it, and the path without a
|
|
9
|
+
* trailing slash. `http:` is allowed, since an endpoint on a private network often has no TLS.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EndpointUrl: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">;
|
|
12
|
+
export type EndpointUrl = typeof EndpointUrl.Type;
|
|
13
|
+
/** The endpoint's host, with its port when that is not the scheme's default. */
|
|
14
|
+
export declare const endpointHostOf: (url: EndpointUrl) => string;
|
|
15
|
+
/** A pasted endpoint as an {@link EndpointUrl}, or the reason it is not one, for a person to read. */
|
|
16
|
+
export declare const parseEndpointUrl: (raw: string) => {
|
|
17
|
+
readonly valid: true;
|
|
18
|
+
readonly url: EndpointUrl;
|
|
19
|
+
} | {
|
|
20
|
+
readonly valid: false;
|
|
21
|
+
readonly reason: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base URL of a compatible endpoint an API-key login sends its requests to, such as a company
|
|
3
|
+
* gateway: Anthropic-compatible for a Claude login, OpenAI-compatible for a Codex login.
|
|
4
|
+
*/
|
|
5
|
+
import { Schema, SchemaGetter } from "effect";
|
|
6
|
+
const parsed = (value) => {
|
|
7
|
+
try {
|
|
8
|
+
return new URL(value);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** Why `value` is not an endpoint URL, or `undefined` when it is one. */
|
|
15
|
+
const endpointUrlProblem = (value) => {
|
|
16
|
+
const url = parsed(value);
|
|
17
|
+
if (url === undefined || (url.protocol !== "http:" && url.protocol !== "https:")) {
|
|
18
|
+
return "must be an absolute http: or https: URL";
|
|
19
|
+
}
|
|
20
|
+
if (url.hostname === "")
|
|
21
|
+
return "must name a host";
|
|
22
|
+
if (url.username !== "" || url.password !== "") {
|
|
23
|
+
return "must not carry a user name or password; the key is sent on its own";
|
|
24
|
+
}
|
|
25
|
+
if (url.search !== "" || value.includes("?"))
|
|
26
|
+
return "must not have a query string";
|
|
27
|
+
if (url.hash !== "" || value.includes("#"))
|
|
28
|
+
return "must not have a fragment";
|
|
29
|
+
return undefined;
|
|
30
|
+
};
|
|
31
|
+
/** Scheme, host (with a port that is not the scheme's default) and path, without a trailing slash. */
|
|
32
|
+
const canonicalEndpointUrl = (value) => {
|
|
33
|
+
const url = new URL(value);
|
|
34
|
+
return `${url.protocol}//${url.host}${url.pathname.replace(/\/+$/, "")}`;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* An absolute `http:` or `https:` URL with a host, and no user name, password, query string or
|
|
38
|
+
* fragment. Decoding normalizes it: the host as the URL standard writes it, and the path without a
|
|
39
|
+
* trailing slash. `http:` is allowed, since an endpoint on a private network often has no TLS.
|
|
40
|
+
*/
|
|
41
|
+
export const EndpointUrl = Schema.String.check(Schema.makeFilter(endpointUrlProblem)).pipe(Schema.decode({
|
|
42
|
+
decode: SchemaGetter.transform(canonicalEndpointUrl),
|
|
43
|
+
encode: SchemaGetter.passthrough(),
|
|
44
|
+
}), Schema.brand("EndpointUrl"));
|
|
45
|
+
/** The endpoint's host, with its port when that is not the scheme's default. */
|
|
46
|
+
export const endpointHostOf = (url) => new URL(url).host;
|
|
47
|
+
const decodeEndpointUrl = Schema.decodeSync(EndpointUrl);
|
|
48
|
+
/** A pasted endpoint as an {@link EndpointUrl}, or the reason it is not one, for a person to read. */
|
|
49
|
+
export const parseEndpointUrl = (raw) => {
|
|
50
|
+
const problem = endpointUrlProblem(raw);
|
|
51
|
+
return problem === undefined
|
|
52
|
+
? { valid: true, url: decodeEndpointUrl(raw) }
|
|
53
|
+
: { valid: false, reason: `The endpoint ${problem}.` };
|
|
54
|
+
};
|
|
@@ -61,6 +61,7 @@ export declare const profileCredentialBindingWithAccountSchema: Schema.Struct<{
|
|
|
61
61
|
}>, Schema.Struct<{
|
|
62
62
|
readonly kind: Schema.Literal<"api-key">;
|
|
63
63
|
readonly suffix: Schema.String;
|
|
64
|
+
readonly endpointHost: Schema.optional<Schema.String>;
|
|
64
65
|
}>]>>;
|
|
65
66
|
}>;
|
|
66
67
|
}>;
|
|
@@ -95,6 +96,7 @@ export declare const listProfileCredentialBindingsResponseSchema: Schema.Struct<
|
|
|
95
96
|
}>, Schema.Struct<{
|
|
96
97
|
readonly kind: Schema.Literal<"api-key">;
|
|
97
98
|
readonly suffix: Schema.String;
|
|
99
|
+
readonly endpointHost: Schema.optional<Schema.String>;
|
|
98
100
|
}>]>>;
|
|
99
101
|
}>;
|
|
100
102
|
}>>;
|
|
@@ -165,6 +167,7 @@ export declare const ProfilesGroup: HttpApiGroup.HttpApiGroup<"profiles", HttpAp
|
|
|
165
167
|
}>, Schema.Struct<{
|
|
166
168
|
readonly kind: Schema.Literal<"api-key">;
|
|
167
169
|
readonly suffix: Schema.String;
|
|
170
|
+
readonly endpointHost: Schema.optional<Schema.String>;
|
|
168
171
|
}>]>>;
|
|
169
172
|
}>;
|
|
170
173
|
}>>;
|
|
@@ -223,6 +226,7 @@ export declare const ProfilesGroup: HttpApiGroup.HttpApiGroup<"profiles", HttpAp
|
|
|
223
226
|
}>, Schema.Struct<{
|
|
224
227
|
readonly kind: Schema.Literal<"api-key">;
|
|
225
228
|
readonly suffix: Schema.String;
|
|
229
|
+
readonly endpointHost: Schema.optional<Schema.String>;
|
|
226
230
|
}>]>>;
|
|
227
231
|
}>;
|
|
228
232
|
}>>;
|
|
@@ -71,6 +71,13 @@ export declare const systemIndexResponseSchema: Schema.Struct<{
|
|
|
71
71
|
* Codex's own key file. A `$HOME` launch still refuses a Claude key.
|
|
72
72
|
*/
|
|
73
73
|
readonly connectedAccountApiKeys: Schema.optional<Schema.Boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* A Claude or Codex API key connects with an `endpoint`, the base URL of a compatible
|
|
76
|
+
* endpoint its requests go to: the summary's `login` carries its `endpointHost`, a placement
|
|
77
|
+
* receipt its `baseUrl`, and inference sends the exchange there. Without it, `endpoint` on
|
|
78
|
+
* a connect is dropped unread.
|
|
79
|
+
*/
|
|
80
|
+
readonly connectedAccountEndpoints: Schema.optional<Schema.Boolean>;
|
|
74
81
|
/**
|
|
75
82
|
* Inference takes `allowedLogin` and refuses a key when it says `subscription`, answers and
|
|
76
83
|
* errors carry the exchange's `receipt`, and a Claude API key runs inference. Without it,
|
|
@@ -175,6 +182,13 @@ export declare const SystemGroup: HttpApiGroup.HttpApiGroup<"system", HttpApiEnd
|
|
|
175
182
|
* Codex's own key file. A `$HOME` launch still refuses a Claude key.
|
|
176
183
|
*/
|
|
177
184
|
readonly connectedAccountApiKeys: Schema.optional<Schema.Boolean>;
|
|
185
|
+
/**
|
|
186
|
+
* A Claude or Codex API key connects with an `endpoint`, the base URL of a compatible
|
|
187
|
+
* endpoint its requests go to: the summary's `login` carries its `endpointHost`, a placement
|
|
188
|
+
* receipt its `baseUrl`, and inference sends the exchange there. Without it, `endpoint` on
|
|
189
|
+
* a connect is dropped unread.
|
|
190
|
+
*/
|
|
191
|
+
readonly connectedAccountEndpoints: Schema.optional<Schema.Boolean>;
|
|
178
192
|
/**
|
|
179
193
|
* Inference takes `allowedLogin` and refuses a key when it says `subscription`, answers and
|
|
180
194
|
* errors carry the exchange's `receipt`, and a Claude API key runs inference. Without it,
|
package/dist/core-api/system.js
CHANGED
|
@@ -72,6 +72,13 @@ export const systemIndexResponseSchema = Schema.Struct({
|
|
|
72
72
|
* Codex's own key file. A `$HOME` launch still refuses a Claude key.
|
|
73
73
|
*/
|
|
74
74
|
connectedAccountApiKeys: Schema.optional(Schema.Boolean),
|
|
75
|
+
/**
|
|
76
|
+
* A Claude or Codex API key connects with an `endpoint`, the base URL of a compatible
|
|
77
|
+
* endpoint its requests go to: the summary's `login` carries its `endpointHost`, a placement
|
|
78
|
+
* receipt its `baseUrl`, and inference sends the exchange there. Without it, `endpoint` on
|
|
79
|
+
* a connect is dropped unread.
|
|
80
|
+
*/
|
|
81
|
+
connectedAccountEndpoints: Schema.optional(Schema.Boolean),
|
|
75
82
|
/**
|
|
76
83
|
* Inference takes `allowedLogin` and refuses a key when it says `subscription`, answers and
|
|
77
84
|
* errors carry the exchange's `receipt`, and a Claude API key runs inference. Without it,
|
|
@@ -973,7 +973,8 @@ export declare const putWorkspaceCredentialsRequestSchema: Schema.Struct<{
|
|
|
973
973
|
export type PutWorkspaceCredentialsRequest = typeof putWorkspaceCredentialsRequestSchema.Type;
|
|
974
974
|
/**
|
|
975
975
|
* What a placed login spends. A key carries its last four characters; a Claude key also its file's
|
|
976
|
-
* absolute path, which Claude reads through an `apiKeyHelper` such as `cat <keyPath>`.
|
|
976
|
+
* absolute path, which Claude reads through an `apiKeyHelper` such as `cat <keyPath>`. A key with an
|
|
977
|
+
* endpoint carries its `baseUrl`, which nothing in the home holds: the harness's launch sets it.
|
|
977
978
|
*/
|
|
978
979
|
export declare const credentialPlacementLoginSchema: Schema.Union<readonly [Schema.Struct<{
|
|
979
980
|
readonly kind: Schema.Literal<"subscription">;
|
|
@@ -981,6 +982,7 @@ export declare const credentialPlacementLoginSchema: Schema.Union<readonly [Sche
|
|
|
981
982
|
readonly kind: Schema.Literal<"api-key">;
|
|
982
983
|
readonly suffix: Schema.String;
|
|
983
984
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
985
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
984
986
|
}>]>;
|
|
985
987
|
export type CredentialPlacementLogin = typeof credentialPlacementLoginSchema.Type;
|
|
986
988
|
/** One login written into one home: its id stays the same while a refresh moves its revision. */
|
|
@@ -994,6 +996,7 @@ export declare const credentialPlacementReceiptSchema: Schema.Struct<{
|
|
|
994
996
|
readonly kind: Schema.Literal<"api-key">;
|
|
995
997
|
readonly suffix: Schema.String;
|
|
996
998
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
999
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
997
1000
|
}>]>;
|
|
998
1001
|
readonly pinned: Schema.Boolean;
|
|
999
1002
|
}>;
|
|
@@ -1009,6 +1012,7 @@ export declare const workspaceCredentialPlacementReceiptSchema: Schema.Struct<{
|
|
|
1009
1012
|
readonly kind: Schema.Literal<"api-key">;
|
|
1010
1013
|
readonly suffix: Schema.String;
|
|
1011
1014
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
1015
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
1012
1016
|
}>]>;
|
|
1013
1017
|
readonly pinned: Schema.Boolean;
|
|
1014
1018
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -1037,6 +1041,7 @@ export declare const workspaceCredentialHomeSchema: Schema.Struct<{
|
|
|
1037
1041
|
readonly kind: Schema.Literal<"api-key">;
|
|
1038
1042
|
readonly suffix: Schema.String;
|
|
1039
1043
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
1044
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
1040
1045
|
}>]>;
|
|
1041
1046
|
readonly pinned: Schema.Boolean;
|
|
1042
1047
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -1110,6 +1115,7 @@ export declare const putWorkspaceCredentialsResponseSchema: Schema.Struct<{
|
|
|
1110
1115
|
readonly kind: Schema.Literal<"api-key">;
|
|
1111
1116
|
readonly suffix: Schema.String;
|
|
1112
1117
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
1118
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
1113
1119
|
}>]>;
|
|
1114
1120
|
readonly pinned: Schema.Boolean;
|
|
1115
1121
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -1189,6 +1195,7 @@ export declare const pruneWorkspaceCredentialsResponseSchema: Schema.Struct<{
|
|
|
1189
1195
|
readonly kind: Schema.Literal<"api-key">;
|
|
1190
1196
|
readonly suffix: Schema.String;
|
|
1191
1197
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
1198
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
1192
1199
|
}>]>;
|
|
1193
1200
|
readonly pinned: Schema.Boolean;
|
|
1194
1201
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -1268,6 +1275,7 @@ export declare const listWorkspaceCredentialsResponseSchema: Schema.Struct<{
|
|
|
1268
1275
|
readonly kind: Schema.Literal<"api-key">;
|
|
1269
1276
|
readonly suffix: Schema.String;
|
|
1270
1277
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
1278
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
1271
1279
|
}>]>;
|
|
1272
1280
|
readonly pinned: Schema.Boolean;
|
|
1273
1281
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -3647,6 +3655,7 @@ export declare const WorkspacesGroup: HttpApiGroup.HttpApiGroup<"workspaces", Ht
|
|
|
3647
3655
|
readonly kind: Schema.Literal<"api-key">;
|
|
3648
3656
|
readonly suffix: Schema.String;
|
|
3649
3657
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
3658
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
3650
3659
|
}>]>;
|
|
3651
3660
|
readonly pinned: Schema.Boolean;
|
|
3652
3661
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -3868,6 +3877,7 @@ export declare const WorkspacesGroup: HttpApiGroup.HttpApiGroup<"workspaces", Ht
|
|
|
3868
3877
|
readonly kind: Schema.Literal<"api-key">;
|
|
3869
3878
|
readonly suffix: Schema.String;
|
|
3870
3879
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
3880
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
3871
3881
|
}>]>;
|
|
3872
3882
|
readonly pinned: Schema.Boolean;
|
|
3873
3883
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -3975,6 +3985,7 @@ export declare const WorkspacesGroup: HttpApiGroup.HttpApiGroup<"workspaces", Ht
|
|
|
3975
3985
|
readonly kind: Schema.Literal<"api-key">;
|
|
3976
3986
|
readonly suffix: Schema.String;
|
|
3977
3987
|
readonly keyPath: Schema.optional<Schema.String>;
|
|
3988
|
+
readonly baseUrl: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "EndpointUrl">>;
|
|
3978
3989
|
}>]>;
|
|
3979
3990
|
readonly pinned: Schema.Boolean;
|
|
3980
3991
|
readonly provider: Schema.Literals<readonly ["claude", "codex", "github", "pi", "opencode"]>;
|
|
@@ -2,6 +2,7 @@ import { Schema } from "effect";
|
|
|
2
2
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
3
3
|
import { BudgetExceededError } from "./budgets.js";
|
|
4
4
|
import { connectedAccountProviderSchema } from "./connected-accounts.js";
|
|
5
|
+
import { EndpointUrl } from "./endpoint-url.js";
|
|
5
6
|
import { PersonId } from "./person-id.js";
|
|
6
7
|
import { runCommandSchema, runSchema } from "./runs.js";
|
|
7
8
|
import { workspaceProcessUserSchema } from "./sessions.js";
|
|
@@ -805,7 +806,8 @@ export const putWorkspaceCredentialsRequestSchema = Schema.Struct({
|
|
|
805
806
|
});
|
|
806
807
|
/**
|
|
807
808
|
* What a placed login spends. A key carries its last four characters; a Claude key also its file's
|
|
808
|
-
* absolute path, which Claude reads through an `apiKeyHelper` such as `cat <keyPath>`.
|
|
809
|
+
* absolute path, which Claude reads through an `apiKeyHelper` such as `cat <keyPath>`. A key with an
|
|
810
|
+
* endpoint carries its `baseUrl`, which nothing in the home holds: the harness's launch sets it.
|
|
809
811
|
*/
|
|
810
812
|
export const credentialPlacementLoginSchema = Schema.Union([
|
|
811
813
|
Schema.Struct({ kind: Schema.Literal("subscription") }),
|
|
@@ -813,6 +815,7 @@ export const credentialPlacementLoginSchema = Schema.Union([
|
|
|
813
815
|
kind: Schema.Literal("api-key"),
|
|
814
816
|
suffix: NonEmptyString,
|
|
815
817
|
keyPath: Schema.optional(NonEmptyString),
|
|
818
|
+
baseUrl: Schema.optional(EndpointUrl),
|
|
816
819
|
}),
|
|
817
820
|
]);
|
|
818
821
|
/** One login written into one home: its id stays the same while a refresh moves its revision. */
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealant/api-contracts-next",
|
|
3
|
-
"version": "0.40.0-next.
|
|
3
|
+
"version": "0.40.0-next.816",
|
|
4
4
|
"description": "Contract-first HTTP API definitions for Sealant services",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"effect": "^4.0.5"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "7e75b0104c9a5c82fd16e73e1862fb5676a38351",
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
}
|