@qvac/harness 0.3.0 → 0.3.1
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/CHANGELOG.md +213 -0
- package/dist/harness.bundle +13 -11
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion.js +17 -5
- package/dist-lib/lib/helpers/tool-call-markup.js +15 -7
- package/dist-lib/lib/no-redirect-fetch-impl.d.ts +3 -2
- package/dist-lib/lib/no-redirect-fetch-impl.js +4 -1
- package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +2 -0
- package/dist-lib/lib/tools/exec/adapters/python/distributions.d.ts +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/distributions.js +4 -0
- package/dist-lib/lib/tools/exec/adapters/python/guarded-fetch.d.ts +67 -0
- package/dist-lib/lib/tools/exec/adapters/python/guarded-fetch.js +196 -0
- package/dist-lib/lib/tools/exec/adapters/python/loader.js +2 -1
- package/dist-lib/lib/tools/exec/adapters/python/module-distributions.d.ts +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/module-distributions.js +52 -0
- package/dist-lib/lib/tools/exec/adapters/python/net-shim.d.ts +2 -0
- package/dist-lib/lib/tools/exec/adapters/python/net-shim.js +148 -0
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.js +13 -1
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.d.ts +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.js +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +9 -3
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +130 -20
- package/dist-lib/lib/tools/exec/adapters/python/run-session.d.ts +3 -0
- package/dist-lib/lib/tools/exec/adapters/python/run-session.js +25 -8
- package/dist-lib/lib/tools/exec/adapters/python/wheels.d.ts +6 -0
- package/dist-lib/lib/tools/exec/adapters/python/wheels.js +17 -3
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +7 -1
- package/dist-lib/lib/tools/exec/shell-guidance.d.ts +10 -0
- package/dist-lib/lib/tools/exec/shell-guidance.js +123 -0
- package/dist-lib/lib/tools/exec/video-tools.d.ts +5 -0
- package/dist-lib/lib/tools/exec/video-tools.js +40 -0
- package/dist-lib/lib/tools/exec.d.ts +2 -1
- package/dist-lib/lib/tools/exec.js +59 -32
- package/dist-lib/lib/tools/http-request/truncate-response.d.ts +1 -0
- package/dist-lib/lib/tools/http-request/truncate-response.js +1 -1
- package/dist-lib/lib/tools/http-request.js +4 -1
- package/dist-lib/lib/tools/operations/builders.d.ts +1 -1
- package/dist-lib/lib/tools/operations/builders.js +9 -0
- package/dist-lib/lib/tools/operations/compile.js +41 -18
- package/dist-lib/lib/tools/operations/decoders.d.ts +6 -0
- package/dist-lib/lib/tools/operations/decoders.js +82 -0
- package/dist-lib/lib/tools/operations/manifest.d.ts +16 -2
- package/dist-lib/lib/tools/operations/manifest.js +6 -1
- package/dist-lib/lib/tools/skill.d.ts +3 -0
- package/dist-lib/lib/tools/skill.js +38 -5
- package/dist-lib/lib/tools/skills/manifest-parse.js +43 -1
- package/dist-lib/lib/tools/skills/manifest.d.ts +13 -0
- package/dist-lib/schema/harness.js +20 -1
- package/dist-lib/spec/hrpc/messages.js +93 -5
- package/dist-lib/spec/hyperschema/index.js +93 -5
- package/dist-lib/spec/hyperschema/schema.json +66 -1
- package/dist-lib/spec/hyperschema/types.d.ts +18 -1
- package/package.json +30 -2
- package/wheels/manifest.json +15 -0
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { ToolParameters } from '../../capabilities/completion.ts';
|
|
3
|
+
declare const ResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
+
pick: z.ZodArray<z.ZodString>;
|
|
5
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6
|
+
decode: z.ZodEnum<{
|
|
7
|
+
"gmail-message": "gmail-message";
|
|
8
|
+
}>;
|
|
9
|
+
}, z.core.$strict>]>;
|
|
3
10
|
declare const OperationSchema: z.ZodObject<{
|
|
4
11
|
tool: z.ZodString;
|
|
5
12
|
description: z.ZodString;
|
|
@@ -16,6 +23,7 @@ declare const OperationSchema: z.ZodObject<{
|
|
|
16
23
|
"drive-create-folder": "drive-create-folder";
|
|
17
24
|
"drive-trash": "drive-trash";
|
|
18
25
|
"gmail-draft": "gmail-draft";
|
|
26
|
+
"gmail-get": "gmail-get";
|
|
19
27
|
"gmail-send": "gmail-send";
|
|
20
28
|
"notion-create-page": "notion-create-page";
|
|
21
29
|
"notion-insert-content": "notion-insert-content";
|
|
@@ -43,6 +51,7 @@ declare const OperationSchema: z.ZodObject<{
|
|
|
43
51
|
"drive-create-folder": "drive-create-folder";
|
|
44
52
|
"drive-trash": "drive-trash";
|
|
45
53
|
"gmail-draft": "gmail-draft";
|
|
54
|
+
"gmail-get": "gmail-get";
|
|
46
55
|
"gmail-send": "gmail-send";
|
|
47
56
|
"notion-create-page": "notion-create-page";
|
|
48
57
|
"notion-insert-content": "notion-insert-content";
|
|
@@ -51,10 +60,15 @@ declare const OperationSchema: z.ZodObject<{
|
|
|
51
60
|
"sheets-write-values": "sheets-write-values";
|
|
52
61
|
}>;
|
|
53
62
|
}, z.core.$strip>]>;
|
|
54
|
-
response: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
response: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
55
64
|
pick: z.ZodArray<z.ZodString>;
|
|
56
|
-
}, z.core.$
|
|
65
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
66
|
+
decode: z.ZodEnum<{
|
|
67
|
+
"gmail-message": "gmail-message";
|
|
68
|
+
}>;
|
|
69
|
+
}, z.core.$strict>]>>;
|
|
57
70
|
}, z.core.$strip>;
|
|
58
71
|
export type OperationSpec = z.infer<typeof OperationSchema>;
|
|
72
|
+
export type OperationResponse = z.infer<typeof ResponseSchema>;
|
|
59
73
|
export declare function parseOperationsManifest(json: string): OperationSpec[] | null;
|
|
60
74
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BUILDER_NAMES } from './builders.js';
|
|
3
|
+
import { DECODER_NAMES } from './decoders.js';
|
|
3
4
|
const ParameterType = z.enum(['string', 'number', 'boolean', 'object', 'integer', 'array', 'null']);
|
|
4
5
|
const ParameterSchema = z.lazy(() => z.object({
|
|
5
6
|
type: z.union([ParameterType, z.array(ParameterType).min(1)]),
|
|
@@ -29,12 +30,16 @@ const McpRequestSchema = z.object({
|
|
|
29
30
|
builder: z.enum(BUILDER_NAMES)
|
|
30
31
|
});
|
|
31
32
|
const RequestSchema = z.union([McpRequestSchema, HttpRequestSchema]);
|
|
33
|
+
const ResponseSchema = z.union([
|
|
34
|
+
z.strictObject({ pick: z.array(z.string().min(1)).min(1) }),
|
|
35
|
+
z.strictObject({ decode: z.enum(DECODER_NAMES) })
|
|
36
|
+
]);
|
|
32
37
|
const OperationSchema = z.object({
|
|
33
38
|
tool: z.string().min(1),
|
|
34
39
|
description: z.string().min(1),
|
|
35
40
|
parameters: ParametersSchema,
|
|
36
41
|
request: RequestSchema,
|
|
37
|
-
response:
|
|
42
|
+
response: ResponseSchema.optional()
|
|
38
43
|
});
|
|
39
44
|
const ManifestSchema = z.object({ operations: z.array(OperationSchema) });
|
|
40
45
|
export function parseOperationsManifest(json) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ToolDefinition } from '../capabilities/completion.ts';
|
|
2
2
|
import { type CredentialStoreFn } from './skills/auth-resolver.ts';
|
|
3
3
|
export type ReadSkillFn = (name: string, file: string) => Promise<string> | string;
|
|
4
|
+
export declare function mainFileRequested(name: string, file: unknown): boolean;
|
|
5
|
+
export declare function skillFileArg(args: Record<string, unknown> | null | undefined): unknown;
|
|
6
|
+
export declare function skillFileStem(file: string): string;
|
|
4
7
|
export interface SkillToolOptions {
|
|
5
8
|
skillsDir?: string;
|
|
6
9
|
overlayDir?: string | null;
|
|
@@ -10,6 +10,25 @@ import { parseToolGrant } from './skills/tool-grants.js';
|
|
|
10
10
|
import { shellEscapeArg } from './exec/shell-argv.js';
|
|
11
11
|
import { isObsidianVaultPath, OBSIDIAN_SKILL_NAME, OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY } from './skills/obsidian-readiness.js';
|
|
12
12
|
const MAIN_FILE = 'SKILL.md';
|
|
13
|
+
const NO_FILE = /^(?:none|null|undefined|main)$/i;
|
|
14
|
+
export function mainFileRequested(name, file) {
|
|
15
|
+
if (file === undefined || file === null)
|
|
16
|
+
return true;
|
|
17
|
+
const asked = unquoteArg(file).toLowerCase();
|
|
18
|
+
return (asked === '' ||
|
|
19
|
+
NO_FILE.test(asked) ||
|
|
20
|
+
asked === name.toLowerCase() ||
|
|
21
|
+
asked === MAIN_FILE.toLowerCase());
|
|
22
|
+
}
|
|
23
|
+
export function skillFileArg(args) {
|
|
24
|
+
return args?.file ?? args?.path ?? args?.filename;
|
|
25
|
+
}
|
|
26
|
+
export function skillFileStem(file) {
|
|
27
|
+
return file
|
|
28
|
+
.toLowerCase()
|
|
29
|
+
.replace(/^references\//, '')
|
|
30
|
+
.replace(/\.md$/, '');
|
|
31
|
+
}
|
|
13
32
|
function resolveSkillDir(root, name) {
|
|
14
33
|
if (!root)
|
|
15
34
|
return null;
|
|
@@ -47,6 +66,10 @@ async function listSkillFiles(drives, name) {
|
|
|
47
66
|
}
|
|
48
67
|
return [...files].sort();
|
|
49
68
|
}
|
|
69
|
+
function nearestFile(wanted, available) {
|
|
70
|
+
const matches = available.filter((file) => skillFileStem(file) === skillFileStem(wanted));
|
|
71
|
+
return matches.length === 1 ? matches[0] : null;
|
|
72
|
+
}
|
|
50
73
|
async function vaultModeNote(name, credentialStore, ctx) {
|
|
51
74
|
if (name !== OBSIDIAN_SKILL_NAME || !credentialStore)
|
|
52
75
|
return null;
|
|
@@ -107,13 +130,13 @@ export function createSkillTool({ skillsDir, overlayDir = resolveSkillsOverlayDi
|
|
|
107
130
|
autoApprove: true,
|
|
108
131
|
async execute(args, ctx) {
|
|
109
132
|
const name = unquoteArg(args.name ?? args.skill_name ?? args.skill);
|
|
110
|
-
const fileArg = args
|
|
111
|
-
const file =
|
|
133
|
+
const fileArg = skillFileArg(args);
|
|
134
|
+
const file = mainFileRequested(name, fileArg) ? MAIN_FILE : unquoteArg(fileArg);
|
|
112
135
|
if (file.startsWith('/') || file.includes('\\') || file.split('/').includes('..')) {
|
|
113
136
|
return { error: `file not found in skill ${name}: ${file}` };
|
|
114
137
|
}
|
|
115
|
-
|
|
116
|
-
const { raw, root } = await resolveSkill(name,
|
|
138
|
+
const load = async (target) => {
|
|
139
|
+
const { raw, root } = await resolveSkill(name, target);
|
|
117
140
|
const { body, meta } = parseSkillFrontMatter(raw);
|
|
118
141
|
const dir = resolveSkillDir(root, name);
|
|
119
142
|
const content = dir ? body.replaceAll('{{SKILL_DIR}}', shellEscapeArg(dir)) : body;
|
|
@@ -123,14 +146,24 @@ export function createSkillTool({ skillsDir, overlayDir = resolveSkillsOverlayDi
|
|
|
123
146
|
].filter(Boolean);
|
|
124
147
|
return {
|
|
125
148
|
name,
|
|
126
|
-
file:
|
|
149
|
+
file: target === MAIN_FILE ? undefined : target,
|
|
127
150
|
content: notes.length ? [content.trim(), ...notes].join('\n\n') : content
|
|
128
151
|
};
|
|
152
|
+
};
|
|
153
|
+
try {
|
|
154
|
+
return await load(file);
|
|
129
155
|
}
|
|
130
156
|
catch {
|
|
131
157
|
if (file === MAIN_FILE)
|
|
132
158
|
return { error: `skill not found: ${name}` };
|
|
133
159
|
const available = await listSkillFiles([overlayDrive, baseDrive], name);
|
|
160
|
+
const near = nearestFile(file, available);
|
|
161
|
+
if (near !== null) {
|
|
162
|
+
try {
|
|
163
|
+
return await load(near);
|
|
164
|
+
}
|
|
165
|
+
catch { }
|
|
166
|
+
}
|
|
134
167
|
const rest = available.length
|
|
135
168
|
? ` — files this skill has: ${available.join(', ')}`
|
|
136
169
|
: '. This skill has no other files; you already have its full instructions — act now.';
|
|
@@ -223,6 +223,46 @@ function readAuthParams(v) {
|
|
|
223
223
|
const out = Object.fromEntries(Object.entries(record).filter(([key]) => !OAUTH_RESERVED_PARAMS.has(key)));
|
|
224
224
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
225
225
|
}
|
|
226
|
+
const OAUTH_ERROR_CODE = /^[a-z0-9_]+$/;
|
|
227
|
+
function siteOf(url) {
|
|
228
|
+
return new URL(url).hostname.split('.').slice(-2).join('.');
|
|
229
|
+
}
|
|
230
|
+
function readVerifyRule(v) {
|
|
231
|
+
if (!isObj(v) || typeof v.error !== 'string' || !OAUTH_ERROR_CODE.test(v.error))
|
|
232
|
+
return undefined;
|
|
233
|
+
const status = Array.isArray(v.status)
|
|
234
|
+
? v.status.filter((s) => Number.isInteger(s) && s >= 100 && s < 600)
|
|
235
|
+
: [];
|
|
236
|
+
const field = typeof v.field === 'string' && v.field.length > 0 ? v.field : undefined;
|
|
237
|
+
if (status.length === 0 && !field)
|
|
238
|
+
return undefined;
|
|
239
|
+
return {
|
|
240
|
+
error: v.error,
|
|
241
|
+
...(status.length > 0 ? { status } : {}),
|
|
242
|
+
...(field ? { field } : {}),
|
|
243
|
+
...(field && typeof v.notEqual === 'string' ? { notEqual: v.notEqual } : {})
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function readVerify(v, tokenUrl) {
|
|
247
|
+
if (!isObj(v))
|
|
248
|
+
return undefined;
|
|
249
|
+
const url = httpsUrl(v.url);
|
|
250
|
+
if (!url || siteOf(url) !== siteOf(tokenUrl))
|
|
251
|
+
return undefined;
|
|
252
|
+
if (v.method !== undefined && v.method !== null && v.method !== 'GET' && v.method !== 'POST') {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
const reject = Array.isArray(v.reject) ? v.reject.flatMap((r) => readVerifyRule(r) ?? []) : [];
|
|
256
|
+
if (reject.length === 0)
|
|
257
|
+
return undefined;
|
|
258
|
+
const body = typeof v.body === 'string' ? v.body : isObj(v.body) ? JSON.stringify(v.body) : undefined;
|
|
259
|
+
return {
|
|
260
|
+
url,
|
|
261
|
+
...(v.method === 'GET' || v.method === 'POST' ? { method: v.method } : {}),
|
|
262
|
+
...(body !== undefined ? { body } : {}),
|
|
263
|
+
reject
|
|
264
|
+
};
|
|
265
|
+
}
|
|
226
266
|
function readOAuth(v) {
|
|
227
267
|
if (!isObj(v))
|
|
228
268
|
return undefined;
|
|
@@ -240,6 +280,7 @@ function readOAuth(v) {
|
|
|
240
280
|
return undefined;
|
|
241
281
|
const extraAuthParams = readAuthParams(v.extraAuthParams);
|
|
242
282
|
const registrationEndpoint = httpsUrl(v.registrationEndpoint);
|
|
283
|
+
const verify = readVerify(v.verify, tokenUrl);
|
|
243
284
|
return {
|
|
244
285
|
stateKey: v.stateKey,
|
|
245
286
|
authUrl,
|
|
@@ -249,7 +290,8 @@ function readOAuth(v) {
|
|
|
249
290
|
...(extraAuthParams ? { extraAuthParams } : {}),
|
|
250
291
|
...(registrationEndpoint ? { registrationEndpoint } : {}),
|
|
251
292
|
...(isPort(v.port) ? { port: v.port } : {}),
|
|
252
|
-
...(typeof v.sharedIosSession === 'boolean' ? { sharedIosSession: v.sharedIosSession } : {})
|
|
293
|
+
...(typeof v.sharedIosSession === 'boolean' ? { sharedIosSession: v.sharedIosSession } : {}),
|
|
294
|
+
...(verify ? { verify } : {})
|
|
253
295
|
};
|
|
254
296
|
}
|
|
255
297
|
export function toWireSetup(setup) {
|
|
@@ -39,6 +39,19 @@ export interface SkillOAuthConfig {
|
|
|
39
39
|
readonly registrationEndpoint?: string;
|
|
40
40
|
readonly port?: number;
|
|
41
41
|
readonly sharedIosSession?: boolean;
|
|
42
|
+
readonly verify?: SkillOAuthVerify;
|
|
43
|
+
}
|
|
44
|
+
export interface SkillOAuthVerify {
|
|
45
|
+
readonly url: string;
|
|
46
|
+
readonly method?: 'GET' | 'POST';
|
|
47
|
+
readonly body?: string;
|
|
48
|
+
readonly reject: readonly SkillOAuthVerifyRule[];
|
|
49
|
+
}
|
|
50
|
+
export interface SkillOAuthVerifyRule {
|
|
51
|
+
readonly error: string;
|
|
52
|
+
readonly status?: readonly number[];
|
|
53
|
+
readonly field?: string;
|
|
54
|
+
readonly notEqual?: string;
|
|
42
55
|
}
|
|
43
56
|
export interface SkillSetupRoute {
|
|
44
57
|
readonly kind: 'oauth' | 'token' | 'install' | 'picker' | 'instructions';
|
|
@@ -645,6 +645,24 @@ export function registerHarnessTypes(ns) {
|
|
|
645
645
|
{ name: 'value', type: 'string', required: true }
|
|
646
646
|
]
|
|
647
647
|
});
|
|
648
|
+
ns.register({
|
|
649
|
+
name: 'skill-oauth-verify-rule',
|
|
650
|
+
fields: [
|
|
651
|
+
{ name: 'error', type: 'string', required: true },
|
|
652
|
+
{ name: 'status', type: 'uint', array: true },
|
|
653
|
+
{ name: 'field', type: 'string' },
|
|
654
|
+
{ name: 'notEqual', type: 'string' }
|
|
655
|
+
]
|
|
656
|
+
});
|
|
657
|
+
ns.register({
|
|
658
|
+
name: 'skill-oauth-verify',
|
|
659
|
+
fields: [
|
|
660
|
+
{ name: 'url', type: 'string', required: true },
|
|
661
|
+
{ name: 'method', type: 'string' },
|
|
662
|
+
{ name: 'body', type: 'string' },
|
|
663
|
+
{ name: 'reject', type: '@harness/skill-oauth-verify-rule', array: true }
|
|
664
|
+
]
|
|
665
|
+
});
|
|
648
666
|
ns.register({
|
|
649
667
|
name: 'skill-oauth-config',
|
|
650
668
|
fields: [
|
|
@@ -656,7 +674,8 @@ export function registerHarnessTypes(ns) {
|
|
|
656
674
|
{ name: 'extraAuthParams', type: '@harness/skill-oauth-param', array: true },
|
|
657
675
|
{ name: 'registrationEndpoint', type: 'string' },
|
|
658
676
|
{ name: 'port', type: 'uint' },
|
|
659
|
-
{ name: 'sharedIosSession', type: 'bool' }
|
|
677
|
+
{ name: 'sharedIosSession', type: 'bool' },
|
|
678
|
+
{ name: 'verify', type: '@harness/skill-oauth-verify' }
|
|
660
679
|
]
|
|
661
680
|
});
|
|
662
681
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 13
|
|
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 = 13
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line no-unused-vars
|
|
12
12
|
let version = VERSION
|
|
@@ -3045,12 +3045,13 @@ const encoding82 = {
|
|
|
3045
3045
|
c.string.preencode(state, m.authUrl)
|
|
3046
3046
|
c.string.preencode(state, m.tokenUrl)
|
|
3047
3047
|
c.string.preencode(state, m.tokenAuth)
|
|
3048
|
-
state.end++ // max flag is
|
|
3048
|
+
state.end++ // max flag is 32 so always one byte
|
|
3049
3049
|
|
|
3050
3050
|
if (version >= 11 && m.scopes) encoding82_4.preencode(state, m.scopes)
|
|
3051
3051
|
if (version >= 11 && m.extraAuthParams) encoding82_5.preencode(state, m.extraAuthParams)
|
|
3052
3052
|
if (version >= 11 && m.registrationEndpoint) c.string.preencode(state, m.registrationEndpoint)
|
|
3053
3053
|
if (version >= 11 && m.port) c.uint.preencode(state, m.port)
|
|
3054
|
+
if (version >= 13 && m.verify) encoding82_9.preencode(state, m.verify)
|
|
3054
3055
|
},
|
|
3055
3056
|
encode(state, m) {
|
|
3056
3057
|
const flags =
|
|
@@ -3058,7 +3059,8 @@ const encoding82 = {
|
|
|
3058
3059
|
((version >= 11 && m.extraAuthParams) ? 2 : 0) |
|
|
3059
3060
|
((version >= 11 && m.registrationEndpoint) ? 4 : 0) |
|
|
3060
3061
|
((version >= 11 && m.port) ? 8 : 0) |
|
|
3061
|
-
((version >= 11 && m.sharedIosSession) ? 16 : 0)
|
|
3062
|
+
((version >= 11 && m.sharedIosSession) ? 16 : 0) |
|
|
3063
|
+
((version >= 13 && m.verify) ? 32 : 0)
|
|
3062
3064
|
|
|
3063
3065
|
c.string.encode(state, m.stateKey)
|
|
3064
3066
|
c.string.encode(state, m.authUrl)
|
|
@@ -3070,6 +3072,7 @@ const encoding82 = {
|
|
|
3070
3072
|
if (version >= 11 && m.extraAuthParams) encoding82_5.encode(state, m.extraAuthParams)
|
|
3071
3073
|
if (version >= 11 && m.registrationEndpoint) c.string.encode(state, m.registrationEndpoint)
|
|
3072
3074
|
if (version >= 11 && m.port) c.uint.encode(state, m.port)
|
|
3075
|
+
if (version >= 13 && m.verify) encoding82_9.encode(state, m.verify)
|
|
3073
3076
|
},
|
|
3074
3077
|
decode(state) {
|
|
3075
3078
|
const r0 = c.string.decode(state)
|
|
@@ -3087,7 +3090,86 @@ const encoding82 = {
|
|
|
3087
3090
|
extraAuthParams: (version >= 11 && (flags & 2) !== 0) ? encoding82_5.decode(state) : null,
|
|
3088
3091
|
registrationEndpoint: (version >= 11 && (flags & 4) !== 0) ? c.string.decode(state) : null,
|
|
3089
3092
|
port: (version >= 11 && (flags & 8) !== 0) ? c.uint.decode(state) : 0,
|
|
3090
|
-
sharedIosSession: (version >= 11 && (flags & 16) !== 0)
|
|
3093
|
+
sharedIosSession: (version >= 11 && (flags & 16) !== 0),
|
|
3094
|
+
verify: (version >= 13 && (flags & 32) !== 0) ? encoding82_9.decode(state) : null
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
// @harness/skill-oauth-verify-rule.status
|
|
3100
|
+
const encoding83_1 = c.array(c.uint)
|
|
3101
|
+
|
|
3102
|
+
// @harness/skill-oauth-verify-rule
|
|
3103
|
+
const encoding83 = {
|
|
3104
|
+
preencode(state, m) {
|
|
3105
|
+
c.string.preencode(state, m.error)
|
|
3106
|
+
state.end++ // max flag is 4 so always one byte
|
|
3107
|
+
|
|
3108
|
+
if (version >= 13 && m.status) encoding83_1.preencode(state, m.status)
|
|
3109
|
+
if (version >= 13 && m.field) c.string.preencode(state, m.field)
|
|
3110
|
+
if (version >= 13 && m.notEqual) c.string.preencode(state, m.notEqual)
|
|
3111
|
+
},
|
|
3112
|
+
encode(state, m) {
|
|
3113
|
+
const flags =
|
|
3114
|
+
((version >= 13 && m.status) ? 1 : 0) |
|
|
3115
|
+
((version >= 13 && m.field) ? 2 : 0) |
|
|
3116
|
+
((version >= 13 && m.notEqual) ? 4 : 0)
|
|
3117
|
+
|
|
3118
|
+
c.string.encode(state, m.error)
|
|
3119
|
+
c.uint.encode(state, flags)
|
|
3120
|
+
|
|
3121
|
+
if (version >= 13 && m.status) encoding83_1.encode(state, m.status)
|
|
3122
|
+
if (version >= 13 && m.field) c.string.encode(state, m.field)
|
|
3123
|
+
if (version >= 13 && m.notEqual) c.string.encode(state, m.notEqual)
|
|
3124
|
+
},
|
|
3125
|
+
decode(state) {
|
|
3126
|
+
const r0 = c.string.decode(state)
|
|
3127
|
+
const flags = c.uint.decode(state)
|
|
3128
|
+
|
|
3129
|
+
return {
|
|
3130
|
+
error: r0,
|
|
3131
|
+
status: (version >= 13 && (flags & 1) !== 0) ? encoding83_1.decode(state) : null,
|
|
3132
|
+
field: (version >= 13 && (flags & 2) !== 0) ? c.string.decode(state) : null,
|
|
3133
|
+
notEqual: (version >= 13 && (flags & 4) !== 0) ? c.string.decode(state) : null
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
// @harness/skill-oauth-verify.reject
|
|
3139
|
+
const encoding84_3 = c.array(c.frame(encoding83))
|
|
3140
|
+
|
|
3141
|
+
// @harness/skill-oauth-verify
|
|
3142
|
+
const encoding84 = {
|
|
3143
|
+
preencode(state, m) {
|
|
3144
|
+
c.string.preencode(state, m.url)
|
|
3145
|
+
state.end++ // max flag is 4 so always one byte
|
|
3146
|
+
|
|
3147
|
+
if (version >= 13 && m.method) c.string.preencode(state, m.method)
|
|
3148
|
+
if (version >= 13 && m.body) c.string.preencode(state, m.body)
|
|
3149
|
+
if (version >= 13 && m.reject) encoding84_3.preencode(state, m.reject)
|
|
3150
|
+
},
|
|
3151
|
+
encode(state, m) {
|
|
3152
|
+
const flags =
|
|
3153
|
+
((version >= 13 && m.method) ? 1 : 0) |
|
|
3154
|
+
((version >= 13 && m.body) ? 2 : 0) |
|
|
3155
|
+
((version >= 13 && m.reject) ? 4 : 0)
|
|
3156
|
+
|
|
3157
|
+
c.string.encode(state, m.url)
|
|
3158
|
+
c.uint.encode(state, flags)
|
|
3159
|
+
|
|
3160
|
+
if (version >= 13 && m.method) c.string.encode(state, m.method)
|
|
3161
|
+
if (version >= 13 && m.body) c.string.encode(state, m.body)
|
|
3162
|
+
if (version >= 13 && m.reject) encoding84_3.encode(state, m.reject)
|
|
3163
|
+
},
|
|
3164
|
+
decode(state) {
|
|
3165
|
+
const r0 = c.string.decode(state)
|
|
3166
|
+
const flags = c.uint.decode(state)
|
|
3167
|
+
|
|
3168
|
+
return {
|
|
3169
|
+
url: r0,
|
|
3170
|
+
method: (version >= 13 && (flags & 1) !== 0) ? c.string.decode(state) : null,
|
|
3171
|
+
body: (version >= 13 && (flags & 2) !== 0) ? c.string.decode(state) : null,
|
|
3172
|
+
reject: (version >= 13 && (flags & 4) !== 0) ? encoding84_3.decode(state) : null
|
|
3091
3173
|
}
|
|
3092
3174
|
}
|
|
3093
3175
|
}
|
|
@@ -3100,6 +3182,8 @@ const encoding28_14 = c.frame(encoding51)
|
|
|
3100
3182
|
const encoding42_2 = c.frame(encoding57)
|
|
3101
3183
|
// @harness/skill-setup-route-v2.oauth, deferred due to recusive use
|
|
3102
3184
|
const encoding50_10 = c.frame(encoding82)
|
|
3185
|
+
// @harness/skill-oauth-config.verify, deferred due to recusive use
|
|
3186
|
+
const encoding82_9 = c.frame(encoding84)
|
|
3103
3187
|
|
|
3104
3188
|
function setVersion(v) {
|
|
3105
3189
|
version = v
|
|
@@ -3318,6 +3402,10 @@ function getEncoding(name) {
|
|
|
3318
3402
|
return encoding81
|
|
3319
3403
|
case '@harness/skill-oauth-config':
|
|
3320
3404
|
return encoding82
|
|
3405
|
+
case '@harness/skill-oauth-verify-rule':
|
|
3406
|
+
return encoding83
|
|
3407
|
+
case '@harness/skill-oauth-verify':
|
|
3408
|
+
return encoding84
|
|
3321
3409
|
default:
|
|
3322
3410
|
throw new Error('Encoder not found ' + name)
|
|
3323
3411
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 13
|
|
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 = 13
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line no-unused-vars
|
|
12
12
|
let version = VERSION
|
|
@@ -3045,12 +3045,13 @@ const encoding82 = {
|
|
|
3045
3045
|
c.string.preencode(state, m.authUrl)
|
|
3046
3046
|
c.string.preencode(state, m.tokenUrl)
|
|
3047
3047
|
c.string.preencode(state, m.tokenAuth)
|
|
3048
|
-
state.end++ // max flag is
|
|
3048
|
+
state.end++ // max flag is 32 so always one byte
|
|
3049
3049
|
|
|
3050
3050
|
if (version >= 11 && m.scopes) encoding82_4.preencode(state, m.scopes)
|
|
3051
3051
|
if (version >= 11 && m.extraAuthParams) encoding82_5.preencode(state, m.extraAuthParams)
|
|
3052
3052
|
if (version >= 11 && m.registrationEndpoint) c.string.preencode(state, m.registrationEndpoint)
|
|
3053
3053
|
if (version >= 11 && m.port) c.uint.preencode(state, m.port)
|
|
3054
|
+
if (version >= 13 && m.verify) encoding82_9.preencode(state, m.verify)
|
|
3054
3055
|
},
|
|
3055
3056
|
encode(state, m) {
|
|
3056
3057
|
const flags =
|
|
@@ -3058,7 +3059,8 @@ const encoding82 = {
|
|
|
3058
3059
|
((version >= 11 && m.extraAuthParams) ? 2 : 0) |
|
|
3059
3060
|
((version >= 11 && m.registrationEndpoint) ? 4 : 0) |
|
|
3060
3061
|
((version >= 11 && m.port) ? 8 : 0) |
|
|
3061
|
-
((version >= 11 && m.sharedIosSession) ? 16 : 0)
|
|
3062
|
+
((version >= 11 && m.sharedIosSession) ? 16 : 0) |
|
|
3063
|
+
((version >= 13 && m.verify) ? 32 : 0)
|
|
3062
3064
|
|
|
3063
3065
|
c.string.encode(state, m.stateKey)
|
|
3064
3066
|
c.string.encode(state, m.authUrl)
|
|
@@ -3070,6 +3072,7 @@ const encoding82 = {
|
|
|
3070
3072
|
if (version >= 11 && m.extraAuthParams) encoding82_5.encode(state, m.extraAuthParams)
|
|
3071
3073
|
if (version >= 11 && m.registrationEndpoint) c.string.encode(state, m.registrationEndpoint)
|
|
3072
3074
|
if (version >= 11 && m.port) c.uint.encode(state, m.port)
|
|
3075
|
+
if (version >= 13 && m.verify) encoding82_9.encode(state, m.verify)
|
|
3073
3076
|
},
|
|
3074
3077
|
decode(state) {
|
|
3075
3078
|
const r0 = c.string.decode(state)
|
|
@@ -3087,7 +3090,86 @@ const encoding82 = {
|
|
|
3087
3090
|
extraAuthParams: (version >= 11 && (flags & 2) !== 0) ? encoding82_5.decode(state) : null,
|
|
3088
3091
|
registrationEndpoint: (version >= 11 && (flags & 4) !== 0) ? c.string.decode(state) : null,
|
|
3089
3092
|
port: (version >= 11 && (flags & 8) !== 0) ? c.uint.decode(state) : 0,
|
|
3090
|
-
sharedIosSession: (version >= 11 && (flags & 16) !== 0)
|
|
3093
|
+
sharedIosSession: (version >= 11 && (flags & 16) !== 0),
|
|
3094
|
+
verify: (version >= 13 && (flags & 32) !== 0) ? encoding82_9.decode(state) : null
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
// @harness/skill-oauth-verify-rule.status
|
|
3100
|
+
const encoding83_1 = c.array(c.uint)
|
|
3101
|
+
|
|
3102
|
+
// @harness/skill-oauth-verify-rule
|
|
3103
|
+
const encoding83 = {
|
|
3104
|
+
preencode(state, m) {
|
|
3105
|
+
c.string.preencode(state, m.error)
|
|
3106
|
+
state.end++ // max flag is 4 so always one byte
|
|
3107
|
+
|
|
3108
|
+
if (version >= 13 && m.status) encoding83_1.preencode(state, m.status)
|
|
3109
|
+
if (version >= 13 && m.field) c.string.preencode(state, m.field)
|
|
3110
|
+
if (version >= 13 && m.notEqual) c.string.preencode(state, m.notEqual)
|
|
3111
|
+
},
|
|
3112
|
+
encode(state, m) {
|
|
3113
|
+
const flags =
|
|
3114
|
+
((version >= 13 && m.status) ? 1 : 0) |
|
|
3115
|
+
((version >= 13 && m.field) ? 2 : 0) |
|
|
3116
|
+
((version >= 13 && m.notEqual) ? 4 : 0)
|
|
3117
|
+
|
|
3118
|
+
c.string.encode(state, m.error)
|
|
3119
|
+
c.uint.encode(state, flags)
|
|
3120
|
+
|
|
3121
|
+
if (version >= 13 && m.status) encoding83_1.encode(state, m.status)
|
|
3122
|
+
if (version >= 13 && m.field) c.string.encode(state, m.field)
|
|
3123
|
+
if (version >= 13 && m.notEqual) c.string.encode(state, m.notEqual)
|
|
3124
|
+
},
|
|
3125
|
+
decode(state) {
|
|
3126
|
+
const r0 = c.string.decode(state)
|
|
3127
|
+
const flags = c.uint.decode(state)
|
|
3128
|
+
|
|
3129
|
+
return {
|
|
3130
|
+
error: r0,
|
|
3131
|
+
status: (version >= 13 && (flags & 1) !== 0) ? encoding83_1.decode(state) : null,
|
|
3132
|
+
field: (version >= 13 && (flags & 2) !== 0) ? c.string.decode(state) : null,
|
|
3133
|
+
notEqual: (version >= 13 && (flags & 4) !== 0) ? c.string.decode(state) : null
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
// @harness/skill-oauth-verify.reject
|
|
3139
|
+
const encoding84_3 = c.array(c.frame(encoding83))
|
|
3140
|
+
|
|
3141
|
+
// @harness/skill-oauth-verify
|
|
3142
|
+
const encoding84 = {
|
|
3143
|
+
preencode(state, m) {
|
|
3144
|
+
c.string.preencode(state, m.url)
|
|
3145
|
+
state.end++ // max flag is 4 so always one byte
|
|
3146
|
+
|
|
3147
|
+
if (version >= 13 && m.method) c.string.preencode(state, m.method)
|
|
3148
|
+
if (version >= 13 && m.body) c.string.preencode(state, m.body)
|
|
3149
|
+
if (version >= 13 && m.reject) encoding84_3.preencode(state, m.reject)
|
|
3150
|
+
},
|
|
3151
|
+
encode(state, m) {
|
|
3152
|
+
const flags =
|
|
3153
|
+
((version >= 13 && m.method) ? 1 : 0) |
|
|
3154
|
+
((version >= 13 && m.body) ? 2 : 0) |
|
|
3155
|
+
((version >= 13 && m.reject) ? 4 : 0)
|
|
3156
|
+
|
|
3157
|
+
c.string.encode(state, m.url)
|
|
3158
|
+
c.uint.encode(state, flags)
|
|
3159
|
+
|
|
3160
|
+
if (version >= 13 && m.method) c.string.encode(state, m.method)
|
|
3161
|
+
if (version >= 13 && m.body) c.string.encode(state, m.body)
|
|
3162
|
+
if (version >= 13 && m.reject) encoding84_3.encode(state, m.reject)
|
|
3163
|
+
},
|
|
3164
|
+
decode(state) {
|
|
3165
|
+
const r0 = c.string.decode(state)
|
|
3166
|
+
const flags = c.uint.decode(state)
|
|
3167
|
+
|
|
3168
|
+
return {
|
|
3169
|
+
url: r0,
|
|
3170
|
+
method: (version >= 13 && (flags & 1) !== 0) ? c.string.decode(state) : null,
|
|
3171
|
+
body: (version >= 13 && (flags & 2) !== 0) ? c.string.decode(state) : null,
|
|
3172
|
+
reject: (version >= 13 && (flags & 4) !== 0) ? encoding84_3.decode(state) : null
|
|
3091
3173
|
}
|
|
3092
3174
|
}
|
|
3093
3175
|
}
|
|
@@ -3100,6 +3182,8 @@ const encoding28_14 = c.frame(encoding51)
|
|
|
3100
3182
|
const encoding42_2 = c.frame(encoding57)
|
|
3101
3183
|
// @harness/skill-setup-route-v2.oauth, deferred due to recusive use
|
|
3102
3184
|
const encoding50_10 = c.frame(encoding82)
|
|
3185
|
+
// @harness/skill-oauth-config.verify, deferred due to recusive use
|
|
3186
|
+
const encoding82_9 = c.frame(encoding84)
|
|
3103
3187
|
|
|
3104
3188
|
function setVersion(v) {
|
|
3105
3189
|
version = v
|
|
@@ -3318,6 +3402,10 @@ function getEncoding(name) {
|
|
|
3318
3402
|
return encoding81
|
|
3319
3403
|
case '@harness/skill-oauth-config':
|
|
3320
3404
|
return encoding82
|
|
3405
|
+
case '@harness/skill-oauth-verify-rule':
|
|
3406
|
+
return encoding83
|
|
3407
|
+
case '@harness/skill-oauth-verify':
|
|
3408
|
+
return encoding84
|
|
3321
3409
|
default:
|
|
3322
3410
|
throw new Error('Encoder not found ' + name)
|
|
3323
3411
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version":
|
|
2
|
+
"version": 13,
|
|
3
3
|
"schema": [
|
|
4
4
|
{
|
|
5
5
|
"name": "empty",
|
|
@@ -2486,6 +2486,71 @@
|
|
|
2486
2486
|
"name": "sharedIosSession",
|
|
2487
2487
|
"type": "bool",
|
|
2488
2488
|
"version": 11
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"name": "verify",
|
|
2492
|
+
"type": "@harness/skill-oauth-verify",
|
|
2493
|
+
"version": 13
|
|
2494
|
+
}
|
|
2495
|
+
]
|
|
2496
|
+
},
|
|
2497
|
+
{
|
|
2498
|
+
"name": "skill-oauth-verify-rule",
|
|
2499
|
+
"namespace": "harness",
|
|
2500
|
+
"compact": false,
|
|
2501
|
+
"flagsPosition": 1,
|
|
2502
|
+
"fields": [
|
|
2503
|
+
{
|
|
2504
|
+
"name": "error",
|
|
2505
|
+
"required": true,
|
|
2506
|
+
"type": "string",
|
|
2507
|
+
"version": 13
|
|
2508
|
+
},
|
|
2509
|
+
{
|
|
2510
|
+
"name": "status",
|
|
2511
|
+
"array": true,
|
|
2512
|
+
"type": "uint",
|
|
2513
|
+
"version": 13
|
|
2514
|
+
},
|
|
2515
|
+
{
|
|
2516
|
+
"name": "field",
|
|
2517
|
+
"type": "string",
|
|
2518
|
+
"version": 13
|
|
2519
|
+
},
|
|
2520
|
+
{
|
|
2521
|
+
"name": "notEqual",
|
|
2522
|
+
"type": "string",
|
|
2523
|
+
"version": 13
|
|
2524
|
+
}
|
|
2525
|
+
]
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
"name": "skill-oauth-verify",
|
|
2529
|
+
"namespace": "harness",
|
|
2530
|
+
"compact": false,
|
|
2531
|
+
"flagsPosition": 1,
|
|
2532
|
+
"fields": [
|
|
2533
|
+
{
|
|
2534
|
+
"name": "url",
|
|
2535
|
+
"required": true,
|
|
2536
|
+
"type": "string",
|
|
2537
|
+
"version": 13
|
|
2538
|
+
},
|
|
2539
|
+
{
|
|
2540
|
+
"name": "method",
|
|
2541
|
+
"type": "string",
|
|
2542
|
+
"version": 13
|
|
2543
|
+
},
|
|
2544
|
+
{
|
|
2545
|
+
"name": "body",
|
|
2546
|
+
"type": "string",
|
|
2547
|
+
"version": 13
|
|
2548
|
+
},
|
|
2549
|
+
{
|
|
2550
|
+
"name": "reject",
|
|
2551
|
+
"array": true,
|
|
2552
|
+
"type": "@harness/skill-oauth-verify-rule",
|
|
2553
|
+
"version": 13
|
|
2489
2554
|
}
|
|
2490
2555
|
]
|
|
2491
2556
|
}
|