@qvac/core 0.3.1 → 0.3.3
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 +4 -4
- package/dist-lib/lib/assistant/history.d.ts +10 -1
- package/dist-lib/lib/assistant/history.js +36 -1
- package/dist-lib/lib/assistant/message.d.ts +2 -0
- package/dist-lib/lib/assistant/message.js +11 -0
- package/dist-lib/lib/assistant/skill-encode.js +27 -1
- package/dist-lib/lib/assistant.d.ts +5 -2
- package/dist-lib/lib/assistant.js +41 -8
- package/dist-lib/lib/core/chat-activity.js +2 -8
- package/dist-lib/lib/core/skill-secrets.js +3 -6
- package/dist-lib/lib/core.d.ts +1 -0
- package/dist-lib/lib/core.js +51 -9
- package/dist-lib/lib/credential-pusher.d.ts +2 -3
- package/dist-lib/lib/credential-pusher.js +67 -39
- package/dist-lib/lib/integrations/index.d.ts +1 -2
- package/dist-lib/lib/integrations/index.js +0 -1
- package/dist-lib/lib/integrations/setup-routes.js +0 -15
- package/dist-lib/lib/oauth/flow-core.js +1 -1
- package/dist-lib/lib/oauth/flow.d.ts +4 -2
- package/dist-lib/lib/oauth/flow.js +3 -4
- package/dist-lib/lib/oauth/host.d.ts +3 -1
- package/dist-lib/lib/oauth/host.js +3 -1
- package/dist-lib/lib/oauth/keys.d.ts +21 -20
- package/dist-lib/lib/oauth/keys.js +59 -85
- package/dist-lib/lib/oauth/loopback.d.ts +2 -2
- package/dist-lib/lib/oauth/loopback.js +32 -19
- package/dist-lib/lib/oauth/loopback.stub.d.ts +2 -2
- package/dist-lib/lib/oauth/loopback.stub.js +2 -2
- package/dist-lib/lib/oauth/providers.d.ts +3 -5
- package/dist-lib/lib/oauth/providers.js +20 -67
- package/dist-lib/lib/oauth/redirect-types.d.ts +1 -0
- package/dist-lib/lib/oauth/registry.d.ts +10 -0
- package/dist-lib/lib/oauth/registry.js +25 -0
- package/dist-lib/lib/oauth/resolve.js +1 -1
- package/dist-lib/lib/oauth/token-exchange-core.js +2 -1
- package/dist-lib/lib/oauth/types.d.ts +1 -1
- package/dist-lib/lib/oauth.client.d.ts +3 -1
- package/dist-lib/lib/oauth.client.js +3 -1
- package/dist-lib/lib/oauth.d.ts +4 -7
- package/dist-lib/lib/oauth.js +4 -7
- package/dist-lib/lib/skill-types.d.ts +12 -0
- package/dist-lib/schema/engine.js +21 -1
- package/dist-lib/spec/hrpc/messages.js +114 -5
- package/dist-lib/spec/hyperschema/index.js +114 -5
- package/dist-lib/spec/hyperschema/schema.json +84 -1
- package/dist-lib/spec/hyperschema/types.d.ts +18 -1
- package/package.json +4 -4
- package/tui/app.mjs +98 -155
- package/tui/lib/save-file.mjs +1 -1
- package/dist-lib/lib/integrations/oauth-providers.d.ts +0 -14
- package/dist-lib/lib/integrations/oauth-providers.js +0 -116
- package/dist-lib/lib/oauth/asana.d.ts +0 -35
- package/dist-lib/lib/oauth/asana.js +0 -71
- package/dist-lib/lib/oauth/google.d.ts +0 -37
- package/dist-lib/lib/oauth/google.js +0 -77
- package/dist-lib/lib/oauth/notion.d.ts +0 -34
- package/dist-lib/lib/oauth/notion.js +0 -82
- package/dist-lib/lib/oauth/spotify.d.ts +0 -32
- package/dist-lib/lib/oauth/spotify.js +0 -74
- package/dist-lib/lib/oauth/verify.d.ts +0 -8
- package/dist-lib/lib/oauth/verify.js +0 -58
|
@@ -1,70 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
tokenAuth: 'secret-in-body',
|
|
22
|
-
authUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
23
|
-
tokenUrl: 'https://oauth2.googleapis.com/token',
|
|
24
|
-
scopes: spec.scopes,
|
|
25
|
-
credentialKey: spec.credentialKey,
|
|
26
|
-
port: OAUTH_PROVIDER_PORTS[provider],
|
|
27
|
-
extraAuthParams: { access_type: 'offline', prompt: 'consent' }
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
if (provider === 'spotify') {
|
|
31
|
-
return {
|
|
32
|
-
clientId: credentials.clientId,
|
|
33
|
-
tokenAuth: 'pkce-only',
|
|
34
|
-
authUrl: 'https://accounts.spotify.com/authorize',
|
|
35
|
-
tokenUrl: 'https://accounts.spotify.com/api/token',
|
|
36
|
-
scopes: spec.scopes,
|
|
37
|
-
credentialKey: spec.credentialKey,
|
|
38
|
-
port: OAUTH_PROVIDER_PORTS[provider]
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
if (provider === 'asana') {
|
|
42
|
-
return {
|
|
43
|
-
clientId: credentials.clientId,
|
|
44
|
-
clientSecret: requireSecret(credentials.clientSecret, provider),
|
|
45
|
-
tokenAuth: 'secret-in-body',
|
|
46
|
-
authUrl: 'https://app.asana.com/-/oauth_authorize',
|
|
47
|
-
tokenUrl: 'https://app.asana.com/-/oauth_token',
|
|
48
|
-
scopes: spec.scopes,
|
|
49
|
-
credentialKey: spec.credentialKey,
|
|
50
|
-
port: OAUTH_PROVIDER_PORTS[provider],
|
|
51
|
-
extraAuthParams: { resource: ASANA_MCP_RESOURCE }
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
if (provider === 'notion') {
|
|
55
|
-
return {
|
|
56
|
-
clientId: credentials.clientId,
|
|
57
|
-
tokenAuth: 'pkce-only',
|
|
58
|
-
authUrl: 'https://mcp.notion.com/authorize',
|
|
59
|
-
tokenUrl: 'https://mcp.notion.com/token',
|
|
60
|
-
registrationEndpoint: 'https://mcp.notion.com/register',
|
|
61
|
-
dynamicRegistration: true,
|
|
62
|
-
scopes: spec.scopes,
|
|
63
|
-
credentialKey: spec.credentialKey,
|
|
64
|
-
port: OAUTH_PROVIDER_PORTS[provider]
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
throw new Error(`Unknown OAuth provider: ${String(provider)}`);
|
|
1
|
+
export function buildProviderConfig(spec, credentials) {
|
|
2
|
+
const base = {
|
|
3
|
+
clientId: credentials.clientId,
|
|
4
|
+
authUrl: spec.authUrl,
|
|
5
|
+
tokenUrl: spec.tokenUrl,
|
|
6
|
+
scopes: spec.scopes,
|
|
7
|
+
credentialKey: spec.credentialKey,
|
|
8
|
+
port: spec.port ?? 0,
|
|
9
|
+
...(spec.extraAuthParams ? { extraAuthParams: spec.extraAuthParams } : {}),
|
|
10
|
+
...(spec.registrationEndpoint
|
|
11
|
+
? { registrationEndpoint: spec.registrationEndpoint, dynamicRegistration: true }
|
|
12
|
+
: {})
|
|
13
|
+
};
|
|
14
|
+
if (spec.tokenAuth === 'pkce-only')
|
|
15
|
+
return { ...base, tokenAuth: 'pkce-only' };
|
|
16
|
+
return {
|
|
17
|
+
...base,
|
|
18
|
+
tokenAuth: spec.tokenAuth,
|
|
19
|
+
clientSecret: requireSecret(credentials.clientSecret, spec.provider)
|
|
20
|
+
};
|
|
68
21
|
}
|
|
69
22
|
function requireSecret(secret, provider) {
|
|
70
23
|
if (!secret)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type OAuthKeySpec, type OAuthRouteLike } from './keys.ts';
|
|
2
|
+
type SkillLike = {
|
|
3
|
+
readonly origin?: string;
|
|
4
|
+
readonly setup?: {
|
|
5
|
+
readonly routes?: ReadonlyArray<OAuthRouteLike> | null | undefined;
|
|
6
|
+
} | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function oauthSpecs(skills: ReadonlyArray<SkillLike>): ReadonlyArray<OAuthKeySpec>;
|
|
9
|
+
export declare function oauthSpecFor(skills: ReadonlyArray<SkillLike>, credentialKey: string): OAuthKeySpec | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { specFromRoute } from './keys.js';
|
|
2
|
+
export function oauthSpecs(skills) {
|
|
3
|
+
const byKey = new Map();
|
|
4
|
+
for (const skill of skills) {
|
|
5
|
+
if (skill.origin === 'overlay')
|
|
6
|
+
continue;
|
|
7
|
+
for (const route of skill.setup?.routes ?? []) {
|
|
8
|
+
const spec = specFromRoute(route);
|
|
9
|
+
if (spec && !byKey.has(spec.credentialKey))
|
|
10
|
+
byKey.set(spec.credentialKey, spec);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const claimed = new Set();
|
|
14
|
+
const specs = [];
|
|
15
|
+
for (const spec of byKey.values()) {
|
|
16
|
+
if (byKey.has(spec.stateKey) || claimed.has(spec.stateKey))
|
|
17
|
+
continue;
|
|
18
|
+
claimed.add(spec.stateKey);
|
|
19
|
+
specs.push(spec);
|
|
20
|
+
}
|
|
21
|
+
return specs;
|
|
22
|
+
}
|
|
23
|
+
export function oauthSpecFor(skills, credentialKey) {
|
|
24
|
+
return oauthSpecs(skills).find((spec) => spec.credentialKey === credentialKey) ?? null;
|
|
25
|
+
}
|
|
@@ -41,7 +41,7 @@ export async function resolveOAuthCredential(opts) {
|
|
|
41
41
|
key: scopedKey(agentId, stateKey),
|
|
42
42
|
value: JSON.stringify({
|
|
43
43
|
...stored,
|
|
44
|
-
refreshToken: refreshed.refreshToken,
|
|
44
|
+
refreshToken: refreshed.refreshToken ?? refreshToken,
|
|
45
45
|
expiresAt: refreshed.expiresAt
|
|
46
46
|
})
|
|
47
47
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AbortController } from 'bare-abort-controller';
|
|
1
2
|
import * as z from 'zod';
|
|
2
3
|
const TOKEN_REQUEST_TIMEOUT_MS = 30_000;
|
|
3
4
|
const TokenResponseSchema = z.object({
|
|
@@ -73,7 +74,7 @@ export async function refreshOAuthTokensWithFetch(config, refreshToken, fetchImp
|
|
|
73
74
|
Accept: 'application/json'
|
|
74
75
|
};
|
|
75
76
|
applyClientSecret(config, body, headers);
|
|
76
|
-
const controller = new
|
|
77
|
+
const controller = new AbortController();
|
|
77
78
|
const timeout = globalThis.setTimeout(() => controller.abort(new Error('OAuth token refresh timed out')), TOKEN_REQUEST_TIMEOUT_MS);
|
|
78
79
|
try {
|
|
79
80
|
const response = await fetchImpl(config.tokenUrl, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OAuthRedirectFactory } from './redirect-types.ts';
|
|
2
|
-
export type OAuthProvider =
|
|
2
|
+
export type OAuthProvider = string;
|
|
3
3
|
export type OAuthTokens = {
|
|
4
4
|
readonly accessToken: string;
|
|
5
5
|
readonly refreshToken?: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { createOAuthClient, isTokenExpired, type OAuthClient } from './oauth/client.ts';
|
|
2
|
-
export { buildProviderConfig
|
|
2
|
+
export { buildProviderConfig } from './oauth/providers.ts';
|
|
3
|
+
export { specFromRoute, type OAuthKeySpec, type OAuthRouteLike } from './oauth/keys.ts';
|
|
4
|
+
export { oauthSpecFor, oauthSpecs } from './oauth/registry.ts';
|
|
3
5
|
export type { OAuthCallbackResult, OAuthRedirect, OAuthRedirectFactory } from './oauth/redirect-types.ts';
|
|
4
6
|
export type { OAuthRuntimeFlowDeps } from './oauth/flow-core.ts';
|
|
5
7
|
export type { OAuthCredentials, OAuthFetch, OAuthFlowDeps, OAuthFlowResult, OAuthProvider, OAuthProviderConfig, OAuthRuntime, OAuthTokens } from './oauth/types.ts';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { createOAuthClient, isTokenExpired } from './oauth/client.js';
|
|
2
|
-
export { buildProviderConfig
|
|
2
|
+
export { buildProviderConfig } from './oauth/providers.js';
|
|
3
|
+
export { specFromRoute } from './oauth/keys.js';
|
|
4
|
+
export { oauthSpecFor, oauthSpecs } from './oauth/registry.js';
|
package/dist-lib/lib/oauth.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
export { createPkce, scopedKey, type ConfigEngine, type Fetch, type FetchResponse, type OAuthTokens } from './oauth/common.ts';
|
|
2
2
|
export { waitForOAuthCallback } from './oauth/browser-connect.ts';
|
|
3
|
-
export { buildGoogleAuthUrl, connectGoogle, exchangeGoogleCode, GOOGLE_OAUTH_PORT, refreshGoogleToken, resolveGoogleCredential, type GoogleTokens } from './oauth/google.ts';
|
|
4
|
-
export { buildNotionAuthUrl, connectNotion, exchangeNotionCode, NOTION_MCP_CREDENTIAL_KEY, NOTION_OAUTH_PORT, NOTION_OAUTH_STATE_KEY, refreshNotionToken, registerNotionClient, resolveNotionCredential, type NotionTokens } from './oauth/notion.ts';
|
|
5
|
-
export { buildAsanaAuthUrl, connectAsana, exchangeAsanaCode, ASANA_MCP_CREDENTIAL_KEY, ASANA_OAUTH_PORT, ASANA_OAUTH_STATE_KEY, refreshAsanaToken, resolveAsanaCredential, type AsanaTokens } from './oauth/asana.ts';
|
|
6
|
-
export { buildSpotifyAuthUrl, connectSpotify, exchangeSpotifyCode, refreshSpotifyToken, resolveSpotifyCredential, SPOTIFY_CREDENTIAL_KEY, SPOTIFY_OAUTH_PORT, SPOTIFY_OAUTH_STATE_KEY, type SpotifyTokens } from './oauth/spotify.ts';
|
|
7
3
|
export { cancelOAuthFlow, runOAuthFlow } from './oauth/flow.ts';
|
|
8
|
-
export {
|
|
4
|
+
export { OAUTH_CALLBACK_PATH, OAUTH_WAIT_FOR_CODE_TIMEOUT_MS, oauthRedirectUri, specFromRoute, type OAuthKeySpec, type OAuthRouteLike } from './oauth/keys.ts';
|
|
5
|
+
export { oauthSpecFor, oauthSpecs } from './oauth/registry.ts';
|
|
9
6
|
export { generatePkceChallenge, type PkceChallenge } from './oauth/pkce.ts';
|
|
10
|
-
export { buildProviderConfig
|
|
7
|
+
export { buildProviderConfig } from './oauth/providers.ts';
|
|
11
8
|
export type { OAuthCallbackResult, OAuthRedirect, OAuthRedirectFactory } from './oauth/redirect-types.ts';
|
|
12
9
|
export { registerOAuthClient, resolveDynamicClientId } from './oauth/register.ts';
|
|
10
|
+
export { resolveOAuthCredential } from './oauth/resolve.ts';
|
|
13
11
|
export { isTokenExpired, refreshOAuthTokens } from './oauth/token-exchange.ts';
|
|
14
|
-
export { verifyOAuthTokens, type VerifyResult } from './oauth/verify.ts';
|
|
15
12
|
export type { OAuthCredentials, OAuthFlowDeps, OAuthFlowResult, OAuthProvider, OAuthProviderConfig } from './oauth/types.ts';
|
package/dist-lib/lib/oauth.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export { createPkce, scopedKey } from './oauth/common.js';
|
|
2
2
|
export { waitForOAuthCallback } from './oauth/browser-connect.js';
|
|
3
|
-
export { buildGoogleAuthUrl, connectGoogle, exchangeGoogleCode, GOOGLE_OAUTH_PORT, refreshGoogleToken, resolveGoogleCredential } from './oauth/google.js';
|
|
4
|
-
export { buildNotionAuthUrl, connectNotion, exchangeNotionCode, NOTION_MCP_CREDENTIAL_KEY, NOTION_OAUTH_PORT, NOTION_OAUTH_STATE_KEY, refreshNotionToken, registerNotionClient, resolveNotionCredential } from './oauth/notion.js';
|
|
5
|
-
export { buildAsanaAuthUrl, connectAsana, exchangeAsanaCode, ASANA_MCP_CREDENTIAL_KEY, ASANA_OAUTH_PORT, ASANA_OAUTH_STATE_KEY, refreshAsanaToken, resolveAsanaCredential } from './oauth/asana.js';
|
|
6
|
-
export { buildSpotifyAuthUrl, connectSpotify, exchangeSpotifyCode, refreshSpotifyToken, resolveSpotifyCredential, SPOTIFY_CREDENTIAL_KEY, SPOTIFY_OAUTH_PORT, SPOTIFY_OAUTH_STATE_KEY } from './oauth/spotify.js';
|
|
7
3
|
export { cancelOAuthFlow, runOAuthFlow } from './oauth/flow.js';
|
|
8
|
-
export {
|
|
4
|
+
export { OAUTH_CALLBACK_PATH, OAUTH_WAIT_FOR_CODE_TIMEOUT_MS, oauthRedirectUri, specFromRoute } from './oauth/keys.js';
|
|
5
|
+
export { oauthSpecFor, oauthSpecs } from './oauth/registry.js';
|
|
9
6
|
export { generatePkceChallenge } from './oauth/pkce.js';
|
|
10
|
-
export { buildProviderConfig
|
|
7
|
+
export { buildProviderConfig } from './oauth/providers.js';
|
|
11
8
|
export { registerOAuthClient, resolveDynamicClientId } from './oauth/register.js';
|
|
9
|
+
export { resolveOAuthCredential } from './oauth/resolve.js';
|
|
12
10
|
export { isTokenExpired, refreshOAuthTokens } from './oauth/token-exchange.js';
|
|
13
|
-
export { verifyOAuthTokens } from './oauth/verify.js';
|
|
@@ -21,6 +21,17 @@ export type SkillSetupField = {
|
|
|
21
21
|
readonly secret?: boolean | undefined;
|
|
22
22
|
readonly required?: boolean | undefined;
|
|
23
23
|
};
|
|
24
|
+
export type SkillOAuthConfig = {
|
|
25
|
+
readonly stateKey: string;
|
|
26
|
+
readonly authUrl: string;
|
|
27
|
+
readonly tokenUrl: string;
|
|
28
|
+
readonly scopes: ReadonlyArray<string>;
|
|
29
|
+
readonly tokenAuth: 'pkce-only' | 'secret-in-body' | 'secret-in-basic';
|
|
30
|
+
readonly extraAuthParams?: Readonly<Record<string, string>> | undefined;
|
|
31
|
+
readonly registrationEndpoint?: string | undefined;
|
|
32
|
+
readonly port?: number | undefined;
|
|
33
|
+
readonly sharedIosSession?: boolean | undefined;
|
|
34
|
+
};
|
|
24
35
|
export type SkillSetupRoute = {
|
|
25
36
|
readonly kind: 'oauth' | 'token' | 'install' | 'picker' | 'instructions';
|
|
26
37
|
readonly label: string;
|
|
@@ -32,6 +43,7 @@ export type SkillSetupRoute = {
|
|
|
32
43
|
readonly configSteps?: ReadonlyArray<string> | undefined;
|
|
33
44
|
readonly fields?: ReadonlyArray<SkillSetupField> | undefined;
|
|
34
45
|
readonly satisfied?: boolean | undefined;
|
|
46
|
+
readonly oauth?: SkillOAuthConfig | undefined;
|
|
35
47
|
};
|
|
36
48
|
export type SkillSetup = {
|
|
37
49
|
readonly summary?: string | undefined;
|
|
@@ -1099,6 +1099,25 @@ export function registerEngineTypes(ns) {
|
|
|
1099
1099
|
{ name: 'required', type: 'bool' }
|
|
1100
1100
|
]
|
|
1101
1101
|
});
|
|
1102
|
+
ns.register({
|
|
1103
|
+
name: 'skill-setup-token-auth',
|
|
1104
|
+
enum: ['pkce-only', 'secret-in-body', 'secret-in-basic'],
|
|
1105
|
+
strings: true
|
|
1106
|
+
});
|
|
1107
|
+
ns.register({
|
|
1108
|
+
name: 'skill-setup-oauth',
|
|
1109
|
+
fields: [
|
|
1110
|
+
{ name: 'stateKey', type: 'string', required: true },
|
|
1111
|
+
{ name: 'authUrl', type: 'string', required: true },
|
|
1112
|
+
{ name: 'tokenUrl', type: 'string', required: true },
|
|
1113
|
+
{ name: 'tokenAuth', type: '@assistant/skill-setup-token-auth', required: true },
|
|
1114
|
+
{ name: 'scopes', type: 'string', array: true },
|
|
1115
|
+
{ name: 'extraAuthParams', type: 'json' },
|
|
1116
|
+
{ name: 'registrationEndpoint', type: 'string' },
|
|
1117
|
+
{ name: 'port', type: 'uint' },
|
|
1118
|
+
{ name: 'sharedIosSession', type: 'bool' }
|
|
1119
|
+
]
|
|
1120
|
+
});
|
|
1102
1121
|
ns.register({
|
|
1103
1122
|
name: 'skill-setup-route-kind',
|
|
1104
1123
|
enum: ['oauth', 'token', 'install', 'picker', 'instructions'],
|
|
@@ -1116,7 +1135,8 @@ export function registerEngineTypes(ns) {
|
|
|
1116
1135
|
{ name: 'steps', type: 'string', array: true },
|
|
1117
1136
|
{ name: 'configSteps', type: 'string', array: true },
|
|
1118
1137
|
{ name: 'fields', type: '@assistant/skill-setup-field', array: true },
|
|
1119
|
-
{ name: 'satisfied', type: 'bool' }
|
|
1138
|
+
{ name: 'satisfied', type: 'bool' },
|
|
1139
|
+
{ name: 'oauth', type: '@assistant/skill-setup-oauth' }
|
|
1120
1140
|
]
|
|
1121
1141
|
});
|
|
1122
1142
|
ns.register({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 9
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
4
|
/* eslint-disable quotes */
|
|
5
5
|
/* eslint-disable space-before-function-paren */
|
|
6
6
|
|
|
7
7
|
import { c } from 'hyperschema/runtime'
|
|
8
8
|
|
|
9
|
-
const VERSION =
|
|
9
|
+
const VERSION = 9
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line no-unused-vars
|
|
12
12
|
let version = VERSION
|
|
@@ -5241,7 +5241,8 @@ const encoding137 = {
|
|
|
5241
5241
|
(m.steps ? 16 : 0) |
|
|
5242
5242
|
(m.configSteps ? 32 : 0) |
|
|
5243
5243
|
(m.fields ? 64 : 0) |
|
|
5244
|
-
(m.satisfied ? 128 : 0)
|
|
5244
|
+
(m.satisfied ? 128 : 0) |
|
|
5245
|
+
((version >= 9 && m.oauth) ? 256 : 0)
|
|
5245
5246
|
|
|
5246
5247
|
encoding136.preencode(state, m.kind)
|
|
5247
5248
|
c.string.preencode(state, m.label)
|
|
@@ -5254,6 +5255,7 @@ const encoding137 = {
|
|
|
5254
5255
|
if (m.steps) encoding137_6.preencode(state, m.steps)
|
|
5255
5256
|
if (m.configSteps) encoding137_7.preencode(state, m.configSteps)
|
|
5256
5257
|
if (m.fields) encoding137_8.preencode(state, m.fields)
|
|
5258
|
+
if (version >= 9 && m.oauth) encoding137_10.preencode(state, m.oauth)
|
|
5257
5259
|
},
|
|
5258
5260
|
encode(state, m) {
|
|
5259
5261
|
const flags =
|
|
@@ -5264,7 +5266,8 @@ const encoding137 = {
|
|
|
5264
5266
|
(m.steps ? 16 : 0) |
|
|
5265
5267
|
(m.configSteps ? 32 : 0) |
|
|
5266
5268
|
(m.fields ? 64 : 0) |
|
|
5267
|
-
(m.satisfied ? 128 : 0)
|
|
5269
|
+
(m.satisfied ? 128 : 0) |
|
|
5270
|
+
((version >= 9 && m.oauth) ? 256 : 0)
|
|
5268
5271
|
|
|
5269
5272
|
encoding136.encode(state, m.kind)
|
|
5270
5273
|
c.string.encode(state, m.label)
|
|
@@ -5277,6 +5280,7 @@ const encoding137 = {
|
|
|
5277
5280
|
if (m.steps) encoding137_6.encode(state, m.steps)
|
|
5278
5281
|
if (m.configSteps) encoding137_7.encode(state, m.configSteps)
|
|
5279
5282
|
if (m.fields) encoding137_8.encode(state, m.fields)
|
|
5283
|
+
if (version >= 9 && m.oauth) encoding137_10.encode(state, m.oauth)
|
|
5280
5284
|
},
|
|
5281
5285
|
decode(state) {
|
|
5282
5286
|
const r0 = encoding136.decode(state)
|
|
@@ -5293,7 +5297,8 @@ const encoding137 = {
|
|
|
5293
5297
|
steps: (flags & 16) !== 0 ? encoding137_6.decode(state) : null,
|
|
5294
5298
|
configSteps: (flags & 32) !== 0 ? encoding137_7.decode(state) : null,
|
|
5295
5299
|
fields: (flags & 64) !== 0 ? encoding137_8.decode(state) : null,
|
|
5296
|
-
satisfied: (flags & 128) !== 0
|
|
5300
|
+
satisfied: (flags & 128) !== 0,
|
|
5301
|
+
oauth: (version >= 9 && (flags & 256) !== 0) ? encoding137_10.decode(state) : null
|
|
5297
5302
|
}
|
|
5298
5303
|
}
|
|
5299
5304
|
}
|
|
@@ -8690,12 +8695,110 @@ const encoding247 = {
|
|
|
8690
8695
|
}
|
|
8691
8696
|
}
|
|
8692
8697
|
|
|
8698
|
+
const encoding248_enum = {
|
|
8699
|
+
"pkce-only": 'pkce-only',
|
|
8700
|
+
"secret-in-body": 'secret-in-body',
|
|
8701
|
+
"secret-in-basic": 'secret-in-basic'
|
|
8702
|
+
}
|
|
8703
|
+
|
|
8704
|
+
// @assistant/skill-setup-token-auth enum
|
|
8705
|
+
const encoding248 = {
|
|
8706
|
+
preencode (state, m) {
|
|
8707
|
+
state.end++ // max enum is 3 so always one byte
|
|
8708
|
+
},
|
|
8709
|
+
encode (state, m) {
|
|
8710
|
+
switch (m) {
|
|
8711
|
+
case 'pkce-only':
|
|
8712
|
+
c.uint.encode(state, 1)
|
|
8713
|
+
break
|
|
8714
|
+
case 'secret-in-body':
|
|
8715
|
+
c.uint.encode(state, 2)
|
|
8716
|
+
break
|
|
8717
|
+
case 'secret-in-basic':
|
|
8718
|
+
c.uint.encode(state, 3)
|
|
8719
|
+
break
|
|
8720
|
+
default:
|
|
8721
|
+
throw new Error('Unknown enum')
|
|
8722
|
+
}
|
|
8723
|
+
},
|
|
8724
|
+
decode (state) {
|
|
8725
|
+
switch (c.uint.decode(state)) {
|
|
8726
|
+
case 1:
|
|
8727
|
+
return 'pkce-only'
|
|
8728
|
+
case 2:
|
|
8729
|
+
return 'secret-in-body'
|
|
8730
|
+
case 3:
|
|
8731
|
+
return 'secret-in-basic'
|
|
8732
|
+
default: return null
|
|
8733
|
+
}
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8736
|
+
|
|
8737
|
+
// @assistant/skill-setup-oauth.scopes
|
|
8738
|
+
const encoding249_4 = encoding12_6
|
|
8739
|
+
|
|
8740
|
+
// @assistant/skill-setup-oauth
|
|
8741
|
+
const encoding249 = {
|
|
8742
|
+
preencode(state, m) {
|
|
8743
|
+
c.string.preencode(state, m.stateKey)
|
|
8744
|
+
c.string.preencode(state, m.authUrl)
|
|
8745
|
+
c.string.preencode(state, m.tokenUrl)
|
|
8746
|
+
encoding248.preencode(state, m.tokenAuth)
|
|
8747
|
+
state.end++ // max flag is 16 so always one byte
|
|
8748
|
+
|
|
8749
|
+
if (version >= 9 && m.scopes) encoding249_4.preencode(state, m.scopes)
|
|
8750
|
+
if (version >= 9 && m.extraAuthParams) c.json.preencode(state, m.extraAuthParams)
|
|
8751
|
+
if (version >= 9 && m.registrationEndpoint) c.string.preencode(state, m.registrationEndpoint)
|
|
8752
|
+
if (version >= 9 && m.port) c.uint.preencode(state, m.port)
|
|
8753
|
+
},
|
|
8754
|
+
encode(state, m) {
|
|
8755
|
+
const flags =
|
|
8756
|
+
((version >= 9 && m.scopes) ? 1 : 0) |
|
|
8757
|
+
((version >= 9 && m.extraAuthParams) ? 2 : 0) |
|
|
8758
|
+
((version >= 9 && m.registrationEndpoint) ? 4 : 0) |
|
|
8759
|
+
((version >= 9 && m.port) ? 8 : 0) |
|
|
8760
|
+
((version >= 9 && m.sharedIosSession) ? 16 : 0)
|
|
8761
|
+
|
|
8762
|
+
c.string.encode(state, m.stateKey)
|
|
8763
|
+
c.string.encode(state, m.authUrl)
|
|
8764
|
+
c.string.encode(state, m.tokenUrl)
|
|
8765
|
+
encoding248.encode(state, m.tokenAuth)
|
|
8766
|
+
c.uint.encode(state, flags)
|
|
8767
|
+
|
|
8768
|
+
if (version >= 9 && m.scopes) encoding249_4.encode(state, m.scopes)
|
|
8769
|
+
if (version >= 9 && m.extraAuthParams) c.json.encode(state, m.extraAuthParams)
|
|
8770
|
+
if (version >= 9 && m.registrationEndpoint) c.string.encode(state, m.registrationEndpoint)
|
|
8771
|
+
if (version >= 9 && m.port) c.uint.encode(state, m.port)
|
|
8772
|
+
},
|
|
8773
|
+
decode(state) {
|
|
8774
|
+
const r0 = c.string.decode(state)
|
|
8775
|
+
const r1 = c.string.decode(state)
|
|
8776
|
+
const r2 = c.string.decode(state)
|
|
8777
|
+
const r3 = encoding248.decode(state)
|
|
8778
|
+
const flags = c.uint.decode(state)
|
|
8779
|
+
|
|
8780
|
+
return {
|
|
8781
|
+
stateKey: r0,
|
|
8782
|
+
authUrl: r1,
|
|
8783
|
+
tokenUrl: r2,
|
|
8784
|
+
tokenAuth: r3,
|
|
8785
|
+
scopes: (version >= 9 && (flags & 1) !== 0) ? encoding249_4.decode(state) : null,
|
|
8786
|
+
extraAuthParams: (version >= 9 && (flags & 2) !== 0) ? c.json.decode(state) : null,
|
|
8787
|
+
registrationEndpoint: (version >= 9 && (flags & 4) !== 0) ? c.string.decode(state) : null,
|
|
8788
|
+
port: (version >= 9 && (flags & 8) !== 0) ? c.uint.decode(state) : 0,
|
|
8789
|
+
sharedIosSession: (version >= 9 && (flags & 16) !== 0)
|
|
8790
|
+
}
|
|
8791
|
+
}
|
|
8792
|
+
}
|
|
8793
|
+
|
|
8693
8794
|
// @assistant/chat-list.groups, deferred due to recusive use
|
|
8694
8795
|
const encoding18_1 = c.array(c.frame(encoding186))
|
|
8695
8796
|
// @assistant/device.toolCatalog, deferred due to recusive use
|
|
8696
8797
|
const encoding23_15 = c.array(c.frame(encoding175))
|
|
8697
8798
|
// @assistant/save-device-capabilities-request.toolCatalog, deferred due to recusive use
|
|
8698
8799
|
const encoding25_5 = encoding23_15
|
|
8800
|
+
// @assistant/skill-setup-route.oauth, deferred due to recusive use
|
|
8801
|
+
const encoding137_10 = c.frame(encoding249)
|
|
8699
8802
|
// @assistant/chat-group-list.groups, deferred due to recusive use
|
|
8700
8803
|
const encoding187_0 = encoding18_1
|
|
8701
8804
|
|
|
@@ -8779,6 +8882,8 @@ function getEnum(name) {
|
|
|
8779
8882
|
return encoding203_enum
|
|
8780
8883
|
case '@assistant/notification-kind':
|
|
8781
8884
|
return encoding209_enum
|
|
8885
|
+
case '@assistant/skill-setup-token-auth':
|
|
8886
|
+
return encoding248_enum
|
|
8782
8887
|
default:
|
|
8783
8888
|
throw new Error('Enum not found ' + name)
|
|
8784
8889
|
}
|
|
@@ -9282,6 +9387,10 @@ function getEncoding(name) {
|
|
|
9282
9387
|
return encoding246
|
|
9283
9388
|
case '@assistant/inference-calls-handoff-ack':
|
|
9284
9389
|
return encoding247
|
|
9390
|
+
case '@assistant/skill-setup-token-auth':
|
|
9391
|
+
return encoding248
|
|
9392
|
+
case '@assistant/skill-setup-oauth':
|
|
9393
|
+
return encoding249
|
|
9285
9394
|
default:
|
|
9286
9395
|
throw new Error('Encoder not found ' + name)
|
|
9287
9396
|
}
|