@slopus/happy-agent-client 0.0.68 → 0.0.70
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/README.md +14 -19
- package/dist/HappyAgentClient.d.ts +8 -6
- package/dist/HappyAgentClient.d.ts.map +1 -1
- package/dist/HappyAgentClient.js +6 -6
- package/dist/HappyAgentClient.js.map +1 -1
- package/dist/HappyAgentOAuthError.d.ts +12 -0
- package/dist/HappyAgentOAuthError.d.ts.map +1 -0
- package/dist/HappyAgentOAuthError.js +16 -0
- package/dist/HappyAgentOAuthError.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/oauthSignIn.d.ts +46 -0
- package/dist/oauthSignIn.d.ts.map +1 -0
- package/dist/oauthSignIn.js +163 -0
- package/dist/oauthSignIn.js.map +1 -0
- package/dist/protocol/authentication.d.ts +63 -25
- package/dist/protocol/authentication.d.ts.map +1 -1
- package/dist/protocol/authentication.js +29 -15
- package/dist/protocol/authentication.js.map +1 -1
- package/dist/protocol/bootstrap.d.ts +8 -0
- package/dist/protocol/bootstrap.d.ts.map +1 -1
- package/dist/protocol/daemon.d.ts +41 -0
- package/dist/protocol/daemon.d.ts.map +1 -1
- package/dist/protocol/daemon.js +9 -0
- package/dist/protocol/daemon.js.map +1 -1
- package/package.json +1 -1
- package/dist/readAuthenticationCallback.d.ts +0 -9
- package/dist/readAuthenticationCallback.d.ts.map +0 -1
- package/dist/readAuthenticationCallback.js +0 -21
- package/dist/readAuthenticationCallback.js.map +0 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth authorization code sign-in with PKCE for native apps (RFC 8252).
|
|
3
|
+
*
|
|
4
|
+
* These functions talk only to the authorization server a method names. The
|
|
5
|
+
* daemon that advertised the method is not trusted with credentials: it never
|
|
6
|
+
* sees the code, the verifier, or a refresh token, and a refresh token is only
|
|
7
|
+
* ever sent to the refresh URL recorded when it was issued.
|
|
8
|
+
*/
|
|
9
|
+
import { Value } from "@sinclair/typebox/value";
|
|
10
|
+
import { HappyAgentOAuthError } from "./HappyAgentOAuthError.js";
|
|
11
|
+
import { oauthAuthenticationMethodSchema, oauthErrorResponseSchema, oauthTokenResponseSchema, } from "./protocol/authentication.js";
|
|
12
|
+
/** Start a sign-in: generate state and PKCE, and build the authorization URL. */
|
|
13
|
+
export async function beginOAuthSignIn(method, options) {
|
|
14
|
+
if (!Value.Check(oauthAuthenticationMethodSchema, method)) {
|
|
15
|
+
throw new HappyAgentOAuthError("invalid_response", "The sign-in method is not valid.");
|
|
16
|
+
}
|
|
17
|
+
const authorizationUrl = secureUrl(method.authorizationUrl);
|
|
18
|
+
secureUrl(method.tokenUrl);
|
|
19
|
+
if (method.refreshUrl !== undefined)
|
|
20
|
+
secureUrl(method.refreshUrl);
|
|
21
|
+
const redirect = new URL(options.redirectUri);
|
|
22
|
+
if (redirect.hash !== "") {
|
|
23
|
+
throw new HappyAgentOAuthError("insecure_url", "The redirect URI must not have a fragment.");
|
|
24
|
+
}
|
|
25
|
+
const state = randomBase64Url(16);
|
|
26
|
+
const codeVerifier = randomBase64Url(32);
|
|
27
|
+
const challenge = base64Url(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(codeVerifier))));
|
|
28
|
+
const parameters = {
|
|
29
|
+
response_type: "code",
|
|
30
|
+
client_id: method.clientId,
|
|
31
|
+
redirect_uri: options.redirectUri,
|
|
32
|
+
state,
|
|
33
|
+
code_challenge: challenge,
|
|
34
|
+
code_challenge_method: "S256",
|
|
35
|
+
...(method.scope === undefined ? {} : { scope: method.scope }),
|
|
36
|
+
};
|
|
37
|
+
for (const [name, value] of Object.entries(parameters)) {
|
|
38
|
+
authorizationUrl.searchParams.set(name, value);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
codeVerifier,
|
|
42
|
+
host: authorizationUrl.host,
|
|
43
|
+
method,
|
|
44
|
+
redirectUri: options.redirectUri,
|
|
45
|
+
state,
|
|
46
|
+
url: authorizationUrl.toString(),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Finish a sign-in from the redirect it produced, exchanging the code at the method's token URL. */
|
|
50
|
+
export async function completeOAuthSignIn(signIn, callbackUrl, options = {}) {
|
|
51
|
+
const parameters = new URL(callbackUrl.toString()).searchParams;
|
|
52
|
+
if (parameters.get("state") !== signIn.state) {
|
|
53
|
+
throw new HappyAgentOAuthError("state_mismatch", "The sign-in result does not match this sign-in attempt.");
|
|
54
|
+
}
|
|
55
|
+
const error = parameters.get("error");
|
|
56
|
+
if (error !== null) {
|
|
57
|
+
throw new HappyAgentOAuthError(error, parameters.get("error_description") ?? "The sign-in was not completed.");
|
|
58
|
+
}
|
|
59
|
+
const code = parameters.get("code");
|
|
60
|
+
if (code === null || code.length === 0) {
|
|
61
|
+
throw new HappyAgentOAuthError("invalid_response", "The sign-in result does not contain an authorization code.");
|
|
62
|
+
}
|
|
63
|
+
return await requestTokens(signIn.method.tokenUrl, {
|
|
64
|
+
grant_type: "authorization_code",
|
|
65
|
+
code,
|
|
66
|
+
redirect_uri: signIn.redirectUri,
|
|
67
|
+
client_id: signIn.method.clientId,
|
|
68
|
+
code_verifier: signIn.codeVerifier,
|
|
69
|
+
}, {
|
|
70
|
+
clientId: signIn.method.clientId,
|
|
71
|
+
refreshToken: null,
|
|
72
|
+
refreshUrl: signIn.method.refreshUrl ?? null,
|
|
73
|
+
}, options);
|
|
74
|
+
}
|
|
75
|
+
/** Exchange the credential's refresh token at the refresh URL recorded when it was issued. */
|
|
76
|
+
export async function refreshOAuthCredential(credential, options = {}) {
|
|
77
|
+
if (credential.refreshToken === null || credential.refreshUrl === null) {
|
|
78
|
+
throw new HappyAgentOAuthError("refresh_unavailable", "This sign-in cannot be refreshed. Sign in again.");
|
|
79
|
+
}
|
|
80
|
+
return await requestTokens(credential.refreshUrl, {
|
|
81
|
+
grant_type: "refresh_token",
|
|
82
|
+
refresh_token: credential.refreshToken,
|
|
83
|
+
client_id: credential.clientId,
|
|
84
|
+
}, {
|
|
85
|
+
clientId: credential.clientId,
|
|
86
|
+
refreshToken: credential.refreshToken,
|
|
87
|
+
refreshUrl: credential.refreshUrl,
|
|
88
|
+
}, options);
|
|
89
|
+
}
|
|
90
|
+
async function requestTokens(url, form, previous, options) {
|
|
91
|
+
const fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
92
|
+
let response;
|
|
93
|
+
try {
|
|
94
|
+
response = await fetch(secureUrl(url), {
|
|
95
|
+
method: "POST",
|
|
96
|
+
headers: {
|
|
97
|
+
accept: "application/json",
|
|
98
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
99
|
+
},
|
|
100
|
+
body: new URLSearchParams(form).toString(),
|
|
101
|
+
redirect: "error",
|
|
102
|
+
signal: options.signal ?? null,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (options.signal?.aborted === true)
|
|
107
|
+
throw error;
|
|
108
|
+
throw new HappyAgentOAuthError("network_error", "The sign-in server could not be reached.");
|
|
109
|
+
}
|
|
110
|
+
let body;
|
|
111
|
+
try {
|
|
112
|
+
body = await response.json();
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
body = undefined;
|
|
116
|
+
}
|
|
117
|
+
if (!response.ok) {
|
|
118
|
+
if (Value.Check(oauthErrorResponseSchema, body)) {
|
|
119
|
+
throw new HappyAgentOAuthError(body.error, body.error_description ?? "The sign-in server rejected the request.");
|
|
120
|
+
}
|
|
121
|
+
throw new HappyAgentOAuthError("invalid_response", `The sign-in server answered ${String(response.status)}.`);
|
|
122
|
+
}
|
|
123
|
+
if (!Value.Check(oauthTokenResponseSchema, body)) {
|
|
124
|
+
throw new HappyAgentOAuthError("invalid_response", "The sign-in server returned an invalid token response.");
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
accessToken: body.access_token,
|
|
128
|
+
clientId: previous.clientId,
|
|
129
|
+
expiresAt: body.expires_in === undefined ? null : Date.now() + body.expires_in * 1_000,
|
|
130
|
+
refreshToken: body.refresh_token ?? previous.refreshToken,
|
|
131
|
+
refreshUrl: previous.refreshUrl,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** Credentials only travel over https, or plain http to this machine. */
|
|
135
|
+
function secureUrl(value) {
|
|
136
|
+
let url;
|
|
137
|
+
try {
|
|
138
|
+
url = new URL(value);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
throw new HappyAgentOAuthError("insecure_url", "A sign-in URL is not valid.");
|
|
142
|
+
}
|
|
143
|
+
const loopback = url.hostname === "localhost" ||
|
|
144
|
+
url.hostname === "[::1]" ||
|
|
145
|
+
/^127(?:\.\d{1,3}){3}$/u.test(url.hostname);
|
|
146
|
+
if ((url.protocol !== "https:" && !(url.protocol === "http:" && loopback)) ||
|
|
147
|
+
url.username !== "" ||
|
|
148
|
+
url.password !== "" ||
|
|
149
|
+
url.hash !== "") {
|
|
150
|
+
throw new HappyAgentOAuthError("insecure_url", "Sign-in URLs must use https, or http only on this machine.");
|
|
151
|
+
}
|
|
152
|
+
return url;
|
|
153
|
+
}
|
|
154
|
+
function randomBase64Url(bytes) {
|
|
155
|
+
return base64Url(globalThis.crypto.getRandomValues(new Uint8Array(bytes)));
|
|
156
|
+
}
|
|
157
|
+
function base64Url(bytes) {
|
|
158
|
+
let binary = "";
|
|
159
|
+
for (const byte of bytes)
|
|
160
|
+
binary += String.fromCharCode(byte);
|
|
161
|
+
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/u, "");
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=oauthSignIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauthSignIn.js","sourceRoot":"","sources":["../sources/oauthSignIn.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EA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AC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IAClC,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,SAAS,CAAC,KAAiB;IAChC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
/** Authentication discovery: whether a request is signed in, and how a person signs in. */
|
|
2
2
|
import { type Static } from "@sinclair/typebox";
|
|
3
3
|
/**
|
|
4
|
-
* A sign-in completed
|
|
4
|
+
* A sign-in completed with the OAuth authorization code flow and PKCE.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
6
|
+
* The client talks to these endpoints directly. The daemon never receives the
|
|
7
|
+
* authorization code, the PKCE verifier, or a refresh token.
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
10
|
-
type: import("@sinclair/typebox").TLiteral<"
|
|
9
|
+
export declare const oauthAuthenticationMethodSchema: import("@sinclair/typebox").TObject<{
|
|
10
|
+
type: import("@sinclair/typebox").TLiteral<"oauth">;
|
|
11
11
|
/** Stable method identity, such as `"jwt"`. */
|
|
12
12
|
id: import("@sinclair/typebox").TString;
|
|
13
13
|
/** Human-readable method name for display. */
|
|
14
14
|
name: import("@sinclair/typebox").TString;
|
|
15
|
-
/** The
|
|
16
|
-
|
|
15
|
+
/** The authorization endpoint, opened in the system browser. */
|
|
16
|
+
authorizationUrl: import("@sinclair/typebox").TString;
|
|
17
|
+
/** Where the authorization code is exchanged for tokens. */
|
|
18
|
+
tokenUrl: import("@sinclair/typebox").TString;
|
|
19
|
+
/** Where a refresh token is exchanged; absent when refresh is unavailable. */
|
|
20
|
+
refreshUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
21
|
+
/** The public OAuth client identifier. */
|
|
22
|
+
clientId: import("@sinclair/typebox").TString;
|
|
23
|
+
/** The space-separated scope requested during authorization. */
|
|
24
|
+
scope: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
17
25
|
}>;
|
|
18
|
-
export type
|
|
26
|
+
export type OAuthAuthenticationMethod = Static<typeof oauthAuthenticationMethodSchema>;
|
|
19
27
|
/**
|
|
20
28
|
* One way to sign in, discriminated by `type`.
|
|
21
29
|
*
|
|
@@ -23,23 +31,23 @@ export type BrowserAuthenticationMethod = Static<typeof browserAuthenticationMet
|
|
|
23
31
|
* not recognize.
|
|
24
32
|
*/
|
|
25
33
|
export declare const authenticationMethodSchema: import("@sinclair/typebox").TObject<{
|
|
26
|
-
type: import("@sinclair/typebox").TLiteral<"
|
|
34
|
+
type: import("@sinclair/typebox").TLiteral<"oauth">;
|
|
27
35
|
/** Stable method identity, such as `"jwt"`. */
|
|
28
36
|
id: import("@sinclair/typebox").TString;
|
|
29
37
|
/** Human-readable method name for display. */
|
|
30
38
|
name: import("@sinclair/typebox").TString;
|
|
31
|
-
/** The
|
|
32
|
-
|
|
39
|
+
/** The authorization endpoint, opened in the system browser. */
|
|
40
|
+
authorizationUrl: import("@sinclair/typebox").TString;
|
|
41
|
+
/** Where the authorization code is exchanged for tokens. */
|
|
42
|
+
tokenUrl: import("@sinclair/typebox").TString;
|
|
43
|
+
/** Where a refresh token is exchanged; absent when refresh is unavailable. */
|
|
44
|
+
refreshUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
45
|
+
/** The public OAuth client identifier. */
|
|
46
|
+
clientId: import("@sinclair/typebox").TString;
|
|
47
|
+
/** The space-separated scope requested during authorization. */
|
|
48
|
+
scope: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
33
49
|
}>;
|
|
34
50
|
export type AuthenticationMethod = Static<typeof authenticationMethodSchema>;
|
|
35
|
-
/** Query for `GET /v0/authentication`. */
|
|
36
|
-
export declare const authenticationQuerySchema: import("@sinclair/typebox").TObject<{
|
|
37
|
-
/** Absolute URL without a fragment where the client receives the sign-in result. */
|
|
38
|
-
redirectUri: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
39
|
-
/** Client-generated value returned unchanged with the result; requires `redirectUri`. */
|
|
40
|
-
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
41
|
-
}>;
|
|
42
|
-
export type AuthenticationQuery = Static<typeof authenticationQuerySchema>;
|
|
43
51
|
/** `GET /v0/authentication` */
|
|
44
52
|
export declare const authenticationResponseSchema: import("@sinclair/typebox").TObject<{
|
|
45
53
|
/** `true` only when the request carried a valid bearer token. */
|
|
@@ -48,27 +56,57 @@ export declare const authenticationResponseSchema: import("@sinclair/typebox").T
|
|
|
48
56
|
userId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
49
57
|
/** Available sign-in methods in display order. */
|
|
50
58
|
methods: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
51
|
-
type: import("@sinclair/typebox").TLiteral<"
|
|
59
|
+
type: import("@sinclair/typebox").TLiteral<"oauth">;
|
|
52
60
|
/** Stable method identity, such as `"jwt"`. */
|
|
53
61
|
id: import("@sinclair/typebox").TString;
|
|
54
62
|
/** Human-readable method name for display. */
|
|
55
63
|
name: import("@sinclair/typebox").TString;
|
|
56
|
-
/** The
|
|
57
|
-
|
|
64
|
+
/** The authorization endpoint, opened in the system browser. */
|
|
65
|
+
authorizationUrl: import("@sinclair/typebox").TString;
|
|
66
|
+
/** Where the authorization code is exchanged for tokens. */
|
|
67
|
+
tokenUrl: import("@sinclair/typebox").TString;
|
|
68
|
+
/** Where a refresh token is exchanged; absent when refresh is unavailable. */
|
|
69
|
+
refreshUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
70
|
+
/** The public OAuth client identifier. */
|
|
71
|
+
clientId: import("@sinclair/typebox").TString;
|
|
72
|
+
/** The space-separated scope requested during authorization. */
|
|
73
|
+
scope: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
58
74
|
}>>;
|
|
59
75
|
}>;
|
|
60
76
|
export type AuthenticationResponse = Static<typeof authenticationResponseSchema>;
|
|
61
77
|
/** The additive `authentication` field of a `401` body. */
|
|
62
78
|
export declare const authenticationChallengeSchema: import("@sinclair/typebox").TObject<{
|
|
63
79
|
methods: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
64
|
-
type: import("@sinclair/typebox").TLiteral<"
|
|
80
|
+
type: import("@sinclair/typebox").TLiteral<"oauth">;
|
|
65
81
|
/** Stable method identity, such as `"jwt"`. */
|
|
66
82
|
id: import("@sinclair/typebox").TString;
|
|
67
83
|
/** Human-readable method name for display. */
|
|
68
84
|
name: import("@sinclair/typebox").TString;
|
|
69
|
-
/** The
|
|
70
|
-
|
|
85
|
+
/** The authorization endpoint, opened in the system browser. */
|
|
86
|
+
authorizationUrl: import("@sinclair/typebox").TString;
|
|
87
|
+
/** Where the authorization code is exchanged for tokens. */
|
|
88
|
+
tokenUrl: import("@sinclair/typebox").TString;
|
|
89
|
+
/** Where a refresh token is exchanged; absent when refresh is unavailable. */
|
|
90
|
+
refreshUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
91
|
+
/** The public OAuth client identifier. */
|
|
92
|
+
clientId: import("@sinclair/typebox").TString;
|
|
93
|
+
/** The space-separated scope requested during authorization. */
|
|
94
|
+
scope: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
71
95
|
}>>;
|
|
72
96
|
}>;
|
|
73
97
|
export type AuthenticationChallenge = Static<typeof authenticationChallengeSchema>;
|
|
98
|
+
/** A successful OAuth token endpoint response (RFC 6749 section 5.1). */
|
|
99
|
+
export declare const oauthTokenResponseSchema: import("@sinclair/typebox").TObject<{
|
|
100
|
+
access_token: import("@sinclair/typebox").TString;
|
|
101
|
+
token_type: import("@sinclair/typebox").TString;
|
|
102
|
+
expires_in: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
103
|
+
refresh_token: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
104
|
+
}>;
|
|
105
|
+
export type OAuthTokenResponse = Static<typeof oauthTokenResponseSchema>;
|
|
106
|
+
/** An OAuth error response (RFC 6749 section 5.2) or authorization error redirect. */
|
|
107
|
+
export declare const oauthErrorResponseSchema: import("@sinclair/typebox").TObject<{
|
|
108
|
+
error: import("@sinclair/typebox").TString;
|
|
109
|
+
error_description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
110
|
+
}>;
|
|
111
|
+
export type OAuthErrorResponse = Static<typeof oauthErrorResponseSchema>;
|
|
74
112
|
//# sourceMappingURL=authentication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../sources/protocol/authentication.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAE3F,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../sources/protocol/authentication.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAE3F,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAMtD;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B;;IAExC,+CAA+C;;IAE/C,8CAA8C;;IAE9C,gEAAgE;;IAEhE,4DAA4D;;IAE5D,8EAA8E;;IAE9E,0CAA0C;;IAE1C,gEAAgE;;EAElE,C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ebox";
|
|
3
3
|
import { Nullable } from "./common.js";
|
|
4
|
+
const urlSchema = Type.String({ minLength: 1, maxLength: 2048 });
|
|
4
5
|
/**
|
|
5
|
-
* A sign-in completed
|
|
6
|
+
* A sign-in completed with the OAuth authorization code flow and PKCE.
|
|
6
7
|
*
|
|
7
|
-
* The
|
|
8
|
-
*
|
|
8
|
+
* The client talks to these endpoints directly. The daemon never receives the
|
|
9
|
+
* authorization code, the PKCE verifier, or a refresh token.
|
|
9
10
|
*/
|
|
10
|
-
export const
|
|
11
|
-
type: Type.Literal("
|
|
11
|
+
export const oauthAuthenticationMethodSchema = Type.Object({
|
|
12
|
+
type: Type.Literal("oauth"),
|
|
12
13
|
/** Stable method identity, such as `"jwt"`. */
|
|
13
14
|
id: Type.String({ minLength: 1 }),
|
|
14
15
|
/** Human-readable method name for display. */
|
|
15
16
|
name: Type.String({ minLength: 1, maxLength: 64 }),
|
|
16
|
-
/** The
|
|
17
|
-
|
|
17
|
+
/** The authorization endpoint, opened in the system browser. */
|
|
18
|
+
authorizationUrl: urlSchema,
|
|
19
|
+
/** Where the authorization code is exchanged for tokens. */
|
|
20
|
+
tokenUrl: urlSchema,
|
|
21
|
+
/** Where a refresh token is exchanged; absent when refresh is unavailable. */
|
|
22
|
+
refreshUrl: Type.Optional(urlSchema),
|
|
23
|
+
/** The public OAuth client identifier. */
|
|
24
|
+
clientId: Type.String({ minLength: 1, maxLength: 256 }),
|
|
25
|
+
/** The space-separated scope requested during authorization. */
|
|
26
|
+
scope: Type.Optional(Type.String({ minLength: 1, maxLength: 1024 })),
|
|
18
27
|
});
|
|
19
28
|
/**
|
|
20
29
|
* One way to sign in, discriminated by `type`.
|
|
@@ -22,14 +31,7 @@ export const browserAuthenticationMethodSchema = Type.Object({
|
|
|
22
31
|
* The set grows with the product; clients ignore methods whose `type` they do
|
|
23
32
|
* not recognize.
|
|
24
33
|
*/
|
|
25
|
-
export const authenticationMethodSchema = Type.Union([
|
|
26
|
-
/** Query for `GET /v0/authentication`. */
|
|
27
|
-
export const authenticationQuerySchema = Type.Object({
|
|
28
|
-
/** Absolute URL without a fragment where the client receives the sign-in result. */
|
|
29
|
-
redirectUri: Type.Optional(Type.String({ minLength: 1, maxLength: 2048 })),
|
|
30
|
-
/** Client-generated value returned unchanged with the result; requires `redirectUri`. */
|
|
31
|
-
state: Type.Optional(Type.String({ minLength: 1, maxLength: 512 })),
|
|
32
|
-
});
|
|
34
|
+
export const authenticationMethodSchema = Type.Union([oauthAuthenticationMethodSchema]);
|
|
33
35
|
/** `GET /v0/authentication` */
|
|
34
36
|
export const authenticationResponseSchema = Type.Object({
|
|
35
37
|
/** `true` only when the request carried a valid bearer token. */
|
|
@@ -43,4 +45,16 @@ export const authenticationResponseSchema = Type.Object({
|
|
|
43
45
|
export const authenticationChallengeSchema = Type.Object({
|
|
44
46
|
methods: Type.Array(authenticationMethodSchema),
|
|
45
47
|
});
|
|
48
|
+
/** A successful OAuth token endpoint response (RFC 6749 section 5.1). */
|
|
49
|
+
export const oauthTokenResponseSchema = Type.Object({
|
|
50
|
+
access_token: Type.String({ minLength: 1, maxLength: 16_384 }),
|
|
51
|
+
token_type: Type.String({ pattern: "^[Bb][Ee][Aa][Rr][Ee][Rr]$" }),
|
|
52
|
+
expires_in: Type.Optional(Type.Number({ minimum: 0 })),
|
|
53
|
+
refresh_token: Type.Optional(Type.String({ minLength: 1, maxLength: 16_384 })),
|
|
54
|
+
});
|
|
55
|
+
/** An OAuth error response (RFC 6749 section 5.2) or authorization error redirect. */
|
|
56
|
+
export const oauthErrorResponseSchema = Type.Object({
|
|
57
|
+
error: Type.String({ minLength: 1, maxLength: 256 }),
|
|
58
|
+
error_description: Type.Optional(Type.String({ maxLength: 2048 })),
|
|
59
|
+
});
|
|
46
60
|
//# sourceMappingURL=authentication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../sources/protocol/authentication.ts"],"names":[],"mappings":"AAAA,2FAA2F;A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AE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;IACpD,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;CACrE,CAAC,CAAC"}
|
|
@@ -116,6 +116,10 @@ export declare const desktopBootstrapResponseSchema: import("@sinclair/typebox")
|
|
|
116
116
|
defaultEffort: import("@sinclair/typebox").TString;
|
|
117
117
|
efforts: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
118
118
|
name: import("@sinclair/typebox").TString;
|
|
119
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
120
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
121
|
+
label: import("@sinclair/typebox").TString;
|
|
122
|
+
}>>>;
|
|
119
123
|
serviceTiers: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
120
124
|
}>>;
|
|
121
125
|
network: import("@sinclair/typebox").TObject<{
|
|
@@ -154,6 +158,10 @@ export declare const desktopBootstrapResponseSchema: import("@sinclair/typebox")
|
|
|
154
158
|
enabled: import("@sinclair/typebox").TBoolean;
|
|
155
159
|
id: import("@sinclair/typebox").TString;
|
|
156
160
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
161
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
162
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
163
|
+
label: import("@sinclair/typebox").TString;
|
|
164
|
+
}>>>;
|
|
157
165
|
serviceTiers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
158
166
|
}>>;
|
|
159
167
|
type: import("@sinclair/typebox").TString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../sources/protocol/bootstrap.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/F,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,aAAa,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD;;;;;;GAMG;AACH,MAAM,WAAW,sBACb,SAAQ,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB;IAChF,gFAAgF;IAChF,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChC,mFAAmF;IACnF,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B;IACvC,6EAA6E
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../sources/protocol/bootstrap.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/F,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,aAAa,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,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("@sinclair/typebox").TObject<{
|
|
|
178
178
|
}>>;
|
|
179
179
|
}>;
|
|
180
180
|
export type PresenceConfig = Static<typeof presenceConfigSchema>;
|
|
181
|
+
/** One daemon-owned speed choice. A null ID clears the service tier. */
|
|
182
|
+
export declare const serviceTierOptionSchema: import("@sinclair/typebox").TObject<{
|
|
183
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
184
|
+
label: import("@sinclair/typebox").TString;
|
|
185
|
+
}>;
|
|
186
|
+
export type ServiceTierOption = Static<typeof serviceTierOptionSchema>;
|
|
181
187
|
/** Everything a client needs to present a model, defined once. */
|
|
182
188
|
export declare const modelDefinitionSchema: import("@sinclair/typebox").TObject<{
|
|
183
189
|
/**
|
|
@@ -191,6 +197,11 @@ export declare const modelDefinitionSchema: import("@sinclair/typebox").TObject<
|
|
|
191
197
|
defaultEffort: import("@sinclair/typebox").TString;
|
|
192
198
|
efforts: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
193
199
|
name: import("@sinclair/typebox").TString;
|
|
200
|
+
/** Complete ordered speed menu, including the default choice; absent from older daemons. */
|
|
201
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
202
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
203
|
+
label: import("@sinclair/typebox").TString;
|
|
204
|
+
}>>>;
|
|
194
205
|
/** Empty when the model has no service tiers. */
|
|
195
206
|
serviceTiers: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
196
207
|
}>;
|
|
@@ -207,6 +218,11 @@ export declare const providerModelReferenceSchema: import("@sinclair/typebox").T
|
|
|
207
218
|
enabled: import("@sinclair/typebox").TBoolean;
|
|
208
219
|
id: import("@sinclair/typebox").TString;
|
|
209
220
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
221
|
+
/** Replaces the shared speed menu with this account/model's eligible choices. */
|
|
222
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
223
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
224
|
+
label: import("@sinclair/typebox").TString;
|
|
225
|
+
}>>>;
|
|
210
226
|
serviceTiers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
211
227
|
}>;
|
|
212
228
|
export type ProviderModelReference = Static<typeof providerModelReferenceSchema>;
|
|
@@ -219,6 +235,11 @@ export declare const providerConfigSchema: import("@sinclair/typebox").TObject<{
|
|
|
219
235
|
enabled: import("@sinclair/typebox").TBoolean;
|
|
220
236
|
id: import("@sinclair/typebox").TString;
|
|
221
237
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
238
|
+
/** Replaces the shared speed menu with this account/model's eligible choices. */
|
|
239
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
240
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
241
|
+
label: import("@sinclair/typebox").TString;
|
|
242
|
+
}>>>;
|
|
222
243
|
serviceTiers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
223
244
|
}>>;
|
|
224
245
|
/** The canonical provider key: `"claude"`, `"codex"`, `"grok"`, … */
|
|
@@ -294,6 +315,11 @@ export declare const daemonConfigSchema: import("@sinclair/typebox").TObject<{
|
|
|
294
315
|
defaultEffort: import("@sinclair/typebox").TString;
|
|
295
316
|
efforts: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
296
317
|
name: import("@sinclair/typebox").TString;
|
|
318
|
+
/** Complete ordered speed menu, including the default choice; absent from older daemons. */
|
|
319
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
320
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
321
|
+
label: import("@sinclair/typebox").TString;
|
|
322
|
+
}>>>;
|
|
297
323
|
/** Empty when the model has no service tiers. */
|
|
298
324
|
serviceTiers: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
299
325
|
}>>;
|
|
@@ -336,6 +362,11 @@ export declare const daemonConfigSchema: import("@sinclair/typebox").TObject<{
|
|
|
336
362
|
enabled: import("@sinclair/typebox").TBoolean;
|
|
337
363
|
id: import("@sinclair/typebox").TString;
|
|
338
364
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
365
|
+
/** Replaces the shared speed menu with this account/model's eligible choices. */
|
|
366
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
367
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
368
|
+
label: import("@sinclair/typebox").TString;
|
|
369
|
+
}>>>;
|
|
339
370
|
serviceTiers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
340
371
|
}>>;
|
|
341
372
|
/** The canonical provider key: `"claude"`, `"codex"`, `"grok"`, … */
|
|
@@ -407,6 +438,11 @@ export declare const configResponseSchema: import("@sinclair/typebox").TObject<{
|
|
|
407
438
|
defaultEffort: import("@sinclair/typebox").TString;
|
|
408
439
|
efforts: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
409
440
|
name: import("@sinclair/typebox").TString;
|
|
441
|
+
/** Complete ordered speed menu, including the default choice; absent from older daemons. */
|
|
442
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
443
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
444
|
+
label: import("@sinclair/typebox").TString;
|
|
445
|
+
}>>>;
|
|
410
446
|
/** Empty when the model has no service tiers. */
|
|
411
447
|
serviceTiers: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
412
448
|
}>>;
|
|
@@ -449,6 +485,11 @@ export declare const configResponseSchema: import("@sinclair/typebox").TObject<{
|
|
|
449
485
|
enabled: import("@sinclair/typebox").TBoolean;
|
|
450
486
|
id: import("@sinclair/typebox").TString;
|
|
451
487
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
488
|
+
/** Replaces the shared speed menu with this account/model's eligible choices. */
|
|
489
|
+
serviceTierOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
490
|
+
id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
491
|
+
label: import("@sinclair/typebox").TString;
|
|
492
|
+
}>>>;
|
|
452
493
|
serviceTiers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
453
494
|
}>>;
|
|
454
495
|
/** The canonical provider key: `"claude"`, `"codex"`, `"grok"`, … */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../sources/protocol/daemon.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAUtD;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,wEAAwE;AACxE,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,wEAAwE;AACxE,eAAO,MAAM,sBAAsB;;EAAuC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EAM3D,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEnE,qCAAqC;AACrC,eAAO,MAAM,iCAAiC;;EAA6C,CAAC;AAC5F,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,OAAO,iCAAiC,CAAC,CAAC"}
|
package/dist/protocol/daemon.js
CHANGED
|
@@ -132,6 +132,11 @@ export const presenceConfigSchema = Type.Object({
|
|
|
132
132
|
fallback: Type.String(),
|
|
133
133
|
states: Type.Record(Type.String(), presenceStateSchema),
|
|
134
134
|
});
|
|
135
|
+
/** One daemon-owned speed choice. A null ID clears the service tier. */
|
|
136
|
+
export const serviceTierOptionSchema = Type.Object({
|
|
137
|
+
id: Nullable(serviceTierSchema),
|
|
138
|
+
label: Type.String(),
|
|
139
|
+
});
|
|
135
140
|
/** Everything a client needs to present a model, defined once. */
|
|
136
141
|
export const modelDefinitionSchema = Type.Object({
|
|
137
142
|
/**
|
|
@@ -145,6 +150,8 @@ export const modelDefinitionSchema = Type.Object({
|
|
|
145
150
|
defaultEffort: effortSchema,
|
|
146
151
|
efforts: Type.Array(effortSchema),
|
|
147
152
|
name: Type.String(),
|
|
153
|
+
/** Complete ordered speed menu, including the default choice; absent from older daemons. */
|
|
154
|
+
serviceTierOptions: Type.Optional(Type.Array(serviceTierOptionSchema)),
|
|
148
155
|
/** Empty when the model has no service tiers. */
|
|
149
156
|
serviceTiers: Type.Array(serviceTierSchema),
|
|
150
157
|
});
|
|
@@ -160,6 +167,8 @@ export const providerModelReferenceSchema = Type.Object({
|
|
|
160
167
|
enabled: Type.Boolean(),
|
|
161
168
|
id: Type.String(),
|
|
162
169
|
name: Type.Optional(Type.String()),
|
|
170
|
+
/** Replaces the shared speed menu with this account/model's eligible choices. */
|
|
171
|
+
serviceTierOptions: Type.Optional(Type.Array(serviceTierOptionSchema)),
|
|
163
172
|
serviceTiers: Type.Optional(Type.Array(serviceTierSchema)),
|
|
164
173
|
});
|
|
165
174
|
/** One configured inference provider and the models it serves. */
|