@the-open-engine/zeroshot 6.35.2 → 6.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent-cli-provider/adapters/omp.js +1 -1
- package/lib/agent-cli-provider/adapters/omp.js.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.js +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.js.map +1 -1
- package/lib/hosted-target/adapter-types.d.cts +0 -8
- package/lib/hosted-target/adapter-types.d.mts +0 -8
- package/lib/hosted-target/adapter-types.d.ts +0 -8
- package/lib/hosted-target/index.d.cts +1 -1
- package/lib/hosted-target/index.d.mts +1 -1
- package/lib/hosted-target/index.d.ts +1 -1
- package/lib/hosted-target/retry-executor.d.cts +1 -1
- package/lib/hosted-target/retry-executor.d.mts +1 -1
- package/lib/hosted-target/retry-executor.d.ts +1 -1
- package/lib/hosted-target/target-adapter.d.cts +1 -1
- package/lib/hosted-target/target-adapter.d.mts +1 -1
- package/lib/hosted-target/target-adapter.d.ts +1 -1
- package/lib/hosted-target/zero-cloud-v1-adapter.cjs +0 -29
- package/lib/hosted-target/zero-cloud-v1-adapter.d.cts +0 -2
- package/lib/hosted-target/zero-cloud-v1-adapter.d.mts +0 -2
- package/lib/hosted-target/zero-cloud-v1-adapter.d.ts +0 -2
- package/lib/hosted-target/zero-cloud-v1-adapter.mjs +0 -29
- package/lib/target/discovery-sections.cjs +2 -21
- package/lib/target/discovery-sections.d.cts +0 -2
- package/lib/target/discovery-sections.d.mts +0 -2
- package/lib/target/discovery-sections.d.ts +0 -2
- package/lib/target/discovery-sections.js +2 -21
- package/lib/target/discovery-sections.mjs +3 -22
- package/lib/target/discovery-validation.cjs +4 -28
- package/lib/target/discovery-validation.d.cts +0 -10
- package/lib/target/discovery-validation.d.mts +0 -10
- package/lib/target/discovery-validation.d.ts +0 -10
- package/lib/target/discovery-validation.js +4 -28
- package/lib/target/discovery-validation.mjs +4 -27
- package/lib/target/discovery.cjs +0 -1
- package/lib/target/discovery.d.cts +0 -3
- package/lib/target/discovery.d.mts +0 -3
- package/lib/target/discovery.d.ts +0 -3
- package/lib/target/discovery.js +0 -1
- package/lib/target/discovery.mjs +1 -2
- package/lib/target/index.d.ts +1 -1
- package/lib/target/run-intent-discovery.cjs +3 -1
- package/lib/target/run-intent-discovery.js +3 -1
- package/lib/target/run-intent-discovery.mjs +4 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/agent-cli-provider/adapters/omp.ts +1 -1
- package/src/agent-cli-provider/single-agent-runtime.ts +1 -5
- package/src/hosted-target/adapter-types.ts +0 -14
- package/src/hosted-target/index.ts +0 -1
- package/src/hosted-target/retry-executor.ts +12 -14
- package/src/hosted-target/target-adapter.ts +1 -5
- package/src/hosted-target/zero-cloud-v1-adapter.ts +0 -37
- package/src/target/discovery-sections.ts +3 -28
- package/src/target/discovery-validation.ts +15 -61
- package/src/target/discovery.ts +1 -9
- package/src/target/index.ts +0 -1
- package/src/target/run-intent-discovery.ts +3 -2
- package/lib/hosted-target/runtime-install.cjs +0 -45
- package/lib/hosted-target/runtime-install.d.cts +0 -14
- package/lib/hosted-target/runtime-install.d.mts +0 -14
- package/lib/hosted-target/runtime-install.d.ts +0 -14
- package/lib/hosted-target/runtime-install.mjs +0 -42
- package/src/hosted-target/runtime-install.ts +0 -83
|
@@ -7,9 +7,7 @@ exports.exact = exact;
|
|
|
7
7
|
exports.integer = integer;
|
|
8
8
|
exports.exactStringSet = exactStringSet;
|
|
9
9
|
exports.sameOriginUrl = sameOriginUrl;
|
|
10
|
-
exports.parseCredentialInstall = parseCredentialInstall;
|
|
11
10
|
const discovery_errors_js_1 = require("./discovery-errors.cjs");
|
|
12
|
-
const route_template_js_1 = require("./route-template.cjs");
|
|
13
11
|
function record(value, field) {
|
|
14
12
|
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
15
13
|
throw new discovery_errors_js_1.TargetDiscoveryError(`${field} must be an object`);
|
|
@@ -44,19 +42,20 @@ function exactStringSet(value, field, expected) {
|
|
|
44
42
|
if (!Array.isArray(value) || value.some((item) => typeof item !== 'string')) {
|
|
45
43
|
throw new discovery_errors_js_1.TargetDiscoveryError(`${field} must be an array of strings`);
|
|
46
44
|
}
|
|
47
|
-
if (value.length !== expected.length ||
|
|
45
|
+
if (value.length !== expected.length ||
|
|
46
|
+
new Set(value).size !== value.length ||
|
|
48
47
|
expected.some((item) => !value.includes(item))) {
|
|
49
48
|
throw new discovery_errors_js_1.TargetDiscoveryError(`${field} does not match the supported contract`);
|
|
50
49
|
}
|
|
51
50
|
return Object.freeze([...value]);
|
|
52
51
|
}
|
|
53
52
|
function hasForbiddenUrlComponent(url, value, protocols) {
|
|
54
|
-
return !protocols.includes(url.protocol) ||
|
|
53
|
+
return (!protocols.includes(url.protocol) ||
|
|
55
54
|
url.username !== '' ||
|
|
56
55
|
url.password !== '' ||
|
|
57
56
|
url.search !== '' ||
|
|
58
57
|
url.hash !== '' ||
|
|
59
|
-
url.href !== value;
|
|
58
|
+
url.href !== value);
|
|
60
59
|
}
|
|
61
60
|
function sameOriginUrl(value, field, origin, protocols = ['https:', 'http:']) {
|
|
62
61
|
if (typeof value !== 'string' || /[\u0000-\u0020\u007f]|\s/u.test(value)) {
|
|
@@ -77,26 +76,3 @@ function sameOriginUrl(value, field, origin, protocols = ['https:', 'http:']) {
|
|
|
77
76
|
}
|
|
78
77
|
return url.href;
|
|
79
78
|
}
|
|
80
|
-
function parseCredentialInstall(value) {
|
|
81
|
-
if (value === undefined || value === null)
|
|
82
|
-
return null;
|
|
83
|
-
const extension = closedRecord(value, 'extensions.credential_install', [
|
|
84
|
-
'kind',
|
|
85
|
-
'install',
|
|
86
|
-
'max_body_bytes',
|
|
87
|
-
]);
|
|
88
|
-
exact(extension.kind, 'openengine.capsule-credential-install/v1', 'extensions.credential_install.kind');
|
|
89
|
-
const install = closedRecord(extension.install, 'extensions.credential_install.install', [
|
|
90
|
-
'route_template',
|
|
91
|
-
'method',
|
|
92
|
-
]);
|
|
93
|
-
exact(install.method, 'PUT', 'extensions.credential_install.install.method');
|
|
94
|
-
return Object.freeze({
|
|
95
|
-
kind: 'openengine.capsule-credential-install/v1',
|
|
96
|
-
install: Object.freeze({
|
|
97
|
-
routeTemplate: (0, route_template_js_1.routeTemplate)(install.route_template, 'extensions.credential_install.install.route_template', ['capsule_id']),
|
|
98
|
-
method: 'PUT',
|
|
99
|
-
}),
|
|
100
|
-
maxBodyBytes: integer(extension.max_body_bytes, 'extensions.credential_install.max_body_bytes', 1, 4 * 1024 * 1024),
|
|
101
|
-
});
|
|
102
|
-
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { type RouteTemplate } from './route-template.js';
|
|
2
|
-
export interface CredentialInstallDescriptor {
|
|
3
|
-
readonly kind: 'openengine.capsule-credential-install/v1';
|
|
4
|
-
readonly install: {
|
|
5
|
-
readonly routeTemplate: RouteTemplate;
|
|
6
|
-
readonly method: 'PUT';
|
|
7
|
-
};
|
|
8
|
-
readonly maxBodyBytes: number;
|
|
9
|
-
}
|
|
10
1
|
export declare function record(value: unknown, field: string): Record<string, unknown>;
|
|
11
2
|
export declare function closedRecord(value: unknown, field: string, fields: readonly string[]): Record<string, unknown>;
|
|
12
3
|
export declare function stringField(source: Record<string, unknown>, field: string, parent?: string): string;
|
|
@@ -14,4 +5,3 @@ export declare function exact(value: unknown, expected: unknown, field: string):
|
|
|
14
5
|
export declare function integer(value: unknown, field: string, min: number, max?: number): number;
|
|
15
6
|
export declare function exactStringSet(value: unknown, field: string, expected: readonly string[]): readonly string[];
|
|
16
7
|
export declare function sameOriginUrl(value: unknown, field: string, origin: string, protocols?: readonly string[]): string;
|
|
17
|
-
export declare function parseCredentialInstall(value: unknown): CredentialInstallDescriptor | null;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { type RouteTemplate } from './route-template.js';
|
|
2
|
-
export interface CredentialInstallDescriptor {
|
|
3
|
-
readonly kind: 'openengine.capsule-credential-install/v1';
|
|
4
|
-
readonly install: {
|
|
5
|
-
readonly routeTemplate: RouteTemplate;
|
|
6
|
-
readonly method: 'PUT';
|
|
7
|
-
};
|
|
8
|
-
readonly maxBodyBytes: number;
|
|
9
|
-
}
|
|
10
1
|
export declare function record(value: unknown, field: string): Record<string, unknown>;
|
|
11
2
|
export declare function closedRecord(value: unknown, field: string, fields: readonly string[]): Record<string, unknown>;
|
|
12
3
|
export declare function stringField(source: Record<string, unknown>, field: string, parent?: string): string;
|
|
@@ -14,4 +5,3 @@ export declare function exact(value: unknown, expected: unknown, field: string):
|
|
|
14
5
|
export declare function integer(value: unknown, field: string, min: number, max?: number): number;
|
|
15
6
|
export declare function exactStringSet(value: unknown, field: string, expected: readonly string[]): readonly string[];
|
|
16
7
|
export declare function sameOriginUrl(value: unknown, field: string, origin: string, protocols?: readonly string[]): string;
|
|
17
|
-
export declare function parseCredentialInstall(value: unknown): CredentialInstallDescriptor | null;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { type RouteTemplate } from './route-template.js';
|
|
2
|
-
export interface CredentialInstallDescriptor {
|
|
3
|
-
readonly kind: 'openengine.capsule-credential-install/v1';
|
|
4
|
-
readonly install: {
|
|
5
|
-
readonly routeTemplate: RouteTemplate;
|
|
6
|
-
readonly method: 'PUT';
|
|
7
|
-
};
|
|
8
|
-
readonly maxBodyBytes: number;
|
|
9
|
-
}
|
|
10
1
|
export declare function record(value: unknown, field: string): Record<string, unknown>;
|
|
11
2
|
export declare function closedRecord(value: unknown, field: string, fields: readonly string[]): Record<string, unknown>;
|
|
12
3
|
export declare function stringField(source: Record<string, unknown>, field: string, parent?: string): string;
|
|
@@ -14,4 +5,3 @@ export declare function exact(value: unknown, expected: unknown, field: string):
|
|
|
14
5
|
export declare function integer(value: unknown, field: string, min: number, max?: number): number;
|
|
15
6
|
export declare function exactStringSet(value: unknown, field: string, expected: readonly string[]): readonly string[];
|
|
16
7
|
export declare function sameOriginUrl(value: unknown, field: string, origin: string, protocols?: readonly string[]): string;
|
|
17
|
-
export declare function parseCredentialInstall(value: unknown): CredentialInstallDescriptor | null;
|
|
@@ -7,9 +7,7 @@ exports.exact = exact;
|
|
|
7
7
|
exports.integer = integer;
|
|
8
8
|
exports.exactStringSet = exactStringSet;
|
|
9
9
|
exports.sameOriginUrl = sameOriginUrl;
|
|
10
|
-
exports.parseCredentialInstall = parseCredentialInstall;
|
|
11
10
|
const discovery_errors_js_1 = require("./discovery-errors.js");
|
|
12
|
-
const route_template_js_1 = require("./route-template.js");
|
|
13
11
|
function record(value, field) {
|
|
14
12
|
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
15
13
|
throw new discovery_errors_js_1.TargetDiscoveryError(`${field} must be an object`);
|
|
@@ -44,19 +42,20 @@ function exactStringSet(value, field, expected) {
|
|
|
44
42
|
if (!Array.isArray(value) || value.some((item) => typeof item !== 'string')) {
|
|
45
43
|
throw new discovery_errors_js_1.TargetDiscoveryError(`${field} must be an array of strings`);
|
|
46
44
|
}
|
|
47
|
-
if (value.length !== expected.length ||
|
|
45
|
+
if (value.length !== expected.length ||
|
|
46
|
+
new Set(value).size !== value.length ||
|
|
48
47
|
expected.some((item) => !value.includes(item))) {
|
|
49
48
|
throw new discovery_errors_js_1.TargetDiscoveryError(`${field} does not match the supported contract`);
|
|
50
49
|
}
|
|
51
50
|
return Object.freeze([...value]);
|
|
52
51
|
}
|
|
53
52
|
function hasForbiddenUrlComponent(url, value, protocols) {
|
|
54
|
-
return !protocols.includes(url.protocol) ||
|
|
53
|
+
return (!protocols.includes(url.protocol) ||
|
|
55
54
|
url.username !== '' ||
|
|
56
55
|
url.password !== '' ||
|
|
57
56
|
url.search !== '' ||
|
|
58
57
|
url.hash !== '' ||
|
|
59
|
-
url.href !== value;
|
|
58
|
+
url.href !== value);
|
|
60
59
|
}
|
|
61
60
|
function sameOriginUrl(value, field, origin, protocols = ['https:', 'http:']) {
|
|
62
61
|
if (typeof value !== 'string' || /[\u0000-\u0020\u007f]|\s/u.test(value)) {
|
|
@@ -77,26 +76,3 @@ function sameOriginUrl(value, field, origin, protocols = ['https:', 'http:']) {
|
|
|
77
76
|
}
|
|
78
77
|
return url.href;
|
|
79
78
|
}
|
|
80
|
-
function parseCredentialInstall(value) {
|
|
81
|
-
if (value === undefined || value === null)
|
|
82
|
-
return null;
|
|
83
|
-
const extension = closedRecord(value, 'extensions.credential_install', [
|
|
84
|
-
'kind',
|
|
85
|
-
'install',
|
|
86
|
-
'max_body_bytes',
|
|
87
|
-
]);
|
|
88
|
-
exact(extension.kind, 'openengine.capsule-credential-install/v1', 'extensions.credential_install.kind');
|
|
89
|
-
const install = closedRecord(extension.install, 'extensions.credential_install.install', [
|
|
90
|
-
'route_template',
|
|
91
|
-
'method',
|
|
92
|
-
]);
|
|
93
|
-
exact(install.method, 'PUT', 'extensions.credential_install.install.method');
|
|
94
|
-
return Object.freeze({
|
|
95
|
-
kind: 'openengine.capsule-credential-install/v1',
|
|
96
|
-
install: Object.freeze({
|
|
97
|
-
routeTemplate: (0, route_template_js_1.routeTemplate)(install.route_template, 'extensions.credential_install.install.route_template', ['capsule_id']),
|
|
98
|
-
method: 'PUT',
|
|
99
|
-
}),
|
|
100
|
-
maxBodyBytes: integer(extension.max_body_bytes, 'extensions.credential_install.max_body_bytes', 1, 4 * 1024 * 1024),
|
|
101
|
-
});
|
|
102
|
-
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TargetDiscoveryError } from './discovery-errors.mjs';
|
|
2
|
-
import { routeTemplate } from './route-template.mjs';
|
|
3
2
|
export function record(value, field) {
|
|
4
3
|
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
5
4
|
throw new TargetDiscoveryError(`${field} must be an object`);
|
|
@@ -34,19 +33,20 @@ export function exactStringSet(value, field, expected) {
|
|
|
34
33
|
if (!Array.isArray(value) || value.some((item) => typeof item !== 'string')) {
|
|
35
34
|
throw new TargetDiscoveryError(`${field} must be an array of strings`);
|
|
36
35
|
}
|
|
37
|
-
if (value.length !== expected.length ||
|
|
36
|
+
if (value.length !== expected.length ||
|
|
37
|
+
new Set(value).size !== value.length ||
|
|
38
38
|
expected.some((item) => !value.includes(item))) {
|
|
39
39
|
throw new TargetDiscoveryError(`${field} does not match the supported contract`);
|
|
40
40
|
}
|
|
41
41
|
return Object.freeze([...value]);
|
|
42
42
|
}
|
|
43
43
|
function hasForbiddenUrlComponent(url, value, protocols) {
|
|
44
|
-
return !protocols.includes(url.protocol) ||
|
|
44
|
+
return (!protocols.includes(url.protocol) ||
|
|
45
45
|
url.username !== '' ||
|
|
46
46
|
url.password !== '' ||
|
|
47
47
|
url.search !== '' ||
|
|
48
48
|
url.hash !== '' ||
|
|
49
|
-
url.href !== value;
|
|
49
|
+
url.href !== value);
|
|
50
50
|
}
|
|
51
51
|
export function sameOriginUrl(value, field, origin, protocols = ['https:', 'http:']) {
|
|
52
52
|
if (typeof value !== 'string' || /[\u0000-\u0020\u007f]|\s/u.test(value)) {
|
|
@@ -67,26 +67,3 @@ export function sameOriginUrl(value, field, origin, protocols = ['https:', 'http
|
|
|
67
67
|
}
|
|
68
68
|
return url.href;
|
|
69
69
|
}
|
|
70
|
-
export function parseCredentialInstall(value) {
|
|
71
|
-
if (value === undefined || value === null)
|
|
72
|
-
return null;
|
|
73
|
-
const extension = closedRecord(value, 'extensions.credential_install', [
|
|
74
|
-
'kind',
|
|
75
|
-
'install',
|
|
76
|
-
'max_body_bytes',
|
|
77
|
-
]);
|
|
78
|
-
exact(extension.kind, 'openengine.capsule-credential-install/v1', 'extensions.credential_install.kind');
|
|
79
|
-
const install = closedRecord(extension.install, 'extensions.credential_install.install', [
|
|
80
|
-
'route_template',
|
|
81
|
-
'method',
|
|
82
|
-
]);
|
|
83
|
-
exact(install.method, 'PUT', 'extensions.credential_install.install.method');
|
|
84
|
-
return Object.freeze({
|
|
85
|
-
kind: 'openengine.capsule-credential-install/v1',
|
|
86
|
-
install: Object.freeze({
|
|
87
|
-
routeTemplate: routeTemplate(install.route_template, 'extensions.credential_install.install.route_template', ['capsule_id']),
|
|
88
|
-
method: 'PUT',
|
|
89
|
-
}),
|
|
90
|
-
maxBodyBytes: integer(extension.max_body_bytes, 'extensions.credential_install.max_body_bytes', 1, 4 * 1024 * 1024),
|
|
91
|
-
});
|
|
92
|
-
}
|
package/lib/target/discovery.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HttpTransport } from './device-flow.js';
|
|
2
2
|
import type { RouteTemplate } from './route-template.js';
|
|
3
|
-
import { type CredentialInstallDescriptor } from './discovery-validation.js';
|
|
4
3
|
import type { RunIntentDescriptor } from './run-intent-discovery.js';
|
|
5
|
-
export type { CredentialInstallDescriptor } from './discovery-validation.js';
|
|
6
4
|
export type { RunIntentDescriptor } from './run-intent-discovery.js';
|
|
7
5
|
export { TargetDiscoveryError } from './discovery-errors.js';
|
|
8
6
|
export { expandRoute, type RouteTemplate } from './route-template.js';
|
|
@@ -57,7 +55,6 @@ export interface TargetDiscoveryDescriptor {
|
|
|
57
55
|
};
|
|
58
56
|
};
|
|
59
57
|
readonly capabilityFlags: readonly string[];
|
|
60
|
-
readonly credentialInstall: CredentialInstallDescriptor | null;
|
|
61
58
|
readonly runIntent: RunIntentDescriptor | null;
|
|
62
59
|
readonly additional: Readonly<Record<string, unknown>>;
|
|
63
60
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HttpTransport } from './device-flow.js';
|
|
2
2
|
import type { RouteTemplate } from './route-template.js';
|
|
3
|
-
import { type CredentialInstallDescriptor } from './discovery-validation.js';
|
|
4
3
|
import type { RunIntentDescriptor } from './run-intent-discovery.js';
|
|
5
|
-
export type { CredentialInstallDescriptor } from './discovery-validation.js';
|
|
6
4
|
export type { RunIntentDescriptor } from './run-intent-discovery.js';
|
|
7
5
|
export { TargetDiscoveryError } from './discovery-errors.js';
|
|
8
6
|
export { expandRoute, type RouteTemplate } from './route-template.js';
|
|
@@ -57,7 +55,6 @@ export interface TargetDiscoveryDescriptor {
|
|
|
57
55
|
};
|
|
58
56
|
};
|
|
59
57
|
readonly capabilityFlags: readonly string[];
|
|
60
|
-
readonly credentialInstall: CredentialInstallDescriptor | null;
|
|
61
58
|
readonly runIntent: RunIntentDescriptor | null;
|
|
62
59
|
readonly additional: Readonly<Record<string, unknown>>;
|
|
63
60
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HttpTransport } from './device-flow.js';
|
|
2
2
|
import type { RouteTemplate } from './route-template.js';
|
|
3
|
-
import { type CredentialInstallDescriptor } from './discovery-validation.js';
|
|
4
3
|
import type { RunIntentDescriptor } from './run-intent-discovery.js';
|
|
5
|
-
export type { CredentialInstallDescriptor } from './discovery-validation.js';
|
|
6
4
|
export type { RunIntentDescriptor } from './run-intent-discovery.js';
|
|
7
5
|
export { TargetDiscoveryError } from './discovery-errors.js';
|
|
8
6
|
export { expandRoute, type RouteTemplate } from './route-template.js';
|
|
@@ -57,7 +55,6 @@ export interface TargetDiscoveryDescriptor {
|
|
|
57
55
|
};
|
|
58
56
|
};
|
|
59
57
|
readonly capabilityFlags: readonly string[];
|
|
60
|
-
readonly credentialInstall: CredentialInstallDescriptor | null;
|
|
61
58
|
readonly runIntent: RunIntentDescriptor | null;
|
|
62
59
|
readonly additional: Readonly<Record<string, unknown>>;
|
|
63
60
|
}
|
package/lib/target/discovery.js
CHANGED
package/lib/target/discovery.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readBoundedResponseJson } from './bounded-response.mjs';
|
|
2
2
|
import { TargetDiscoveryError } from './discovery-errors.mjs';
|
|
3
|
-
import { exact, exactStringSet, record
|
|
3
|
+
import { exact, exactStringSet, record } from './discovery-validation.mjs';
|
|
4
4
|
import { parseAdapter, parseCapsule, parseEndpoint, parseExtensions, parseOAuth, parseSession, parseSizes, parseTransport, validateOAuthMetadata, } from './discovery-sections.mjs';
|
|
5
5
|
export { TargetDiscoveryError } from './discovery-errors.mjs';
|
|
6
6
|
export { expandRoute } from './route-template.mjs';
|
|
@@ -60,7 +60,6 @@ function parseDiscoveryDocument(discovery, origin) {
|
|
|
60
60
|
capsule,
|
|
61
61
|
transport,
|
|
62
62
|
capabilityFlags,
|
|
63
|
-
credentialInstall: extensions.credentialInstall,
|
|
64
63
|
runIntent: extensions.runIntent,
|
|
65
64
|
additional,
|
|
66
65
|
});
|
package/lib/target/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { acquireTargetLock } from './credential-lock.js';
|
|
|
3
3
|
export { requestDeviceCode, pollForToken, parseTokenResponse, DeviceFlowDeniedError, DeviceFlowExpiredError, UnboundSessionError, type DeviceCodeResponse, type DeviceExchangeContext, type TokenResponse, type HttpTransport, type Clock, } from './device-flow.js';
|
|
4
4
|
export { addTarget, removeTarget, getTarget, listTargets, updateTargetOrganization, validateTargetName, normalizeAndValidateUrl, TargetNameInvalidError, TargetNameExistsError, TargetNotFoundError, TargetUrlInvalidError, type TargetRecord, type SettingsPort, } from './target-registry.js';
|
|
5
5
|
export { TargetSessionManager, LoginRequiredError, type BrowserOpener, type TargetSessionDeps, type TargetSessionManagerInit, } from './target-session.js';
|
|
6
|
-
export { discoverTarget, discoverTargetSessionEndpoints, expandRoute, TargetDiscoveryError, type
|
|
6
|
+
export { discoverTarget, discoverTargetSessionEndpoints, expandRoute, TargetDiscoveryError, type RunIntentDescriptor, type RouteTemplate, type TargetDiscoveryDescriptor, type TargetSessionEndpoints, } from './discovery.js';
|
|
@@ -6,12 +6,14 @@ const discovery_validation_js_1 = require("./discovery-validation.cjs");
|
|
|
6
6
|
function parseRunIntent(value, origin) {
|
|
7
7
|
if (value === undefined || value === null)
|
|
8
8
|
return null;
|
|
9
|
+
const advertised = (0, discovery_validation_js_1.record)(value, 'extensions.run_intent');
|
|
10
|
+
if (advertised.kind !== 'zeroshot.run-intent/v2')
|
|
11
|
+
return null;
|
|
9
12
|
const extension = (0, discovery_validation_js_1.closedRecord)(value, 'extensions.run_intent', [
|
|
10
13
|
'kind',
|
|
11
14
|
'base_url',
|
|
12
15
|
'route_templates',
|
|
13
16
|
]);
|
|
14
|
-
(0, discovery_validation_js_1.exact)(extension.kind, 'zeroshot.run-intent/v2', 'extensions.run_intent.kind');
|
|
15
17
|
const routes = (0, discovery_validation_js_1.closedRecord)(extension.route_templates, 'extensions.run_intent.route_templates', [
|
|
16
18
|
'submit',
|
|
17
19
|
'status',
|
|
@@ -6,12 +6,14 @@ const discovery_validation_js_1 = require("./discovery-validation.js");
|
|
|
6
6
|
function parseRunIntent(value, origin) {
|
|
7
7
|
if (value === undefined || value === null)
|
|
8
8
|
return null;
|
|
9
|
+
const advertised = (0, discovery_validation_js_1.record)(value, 'extensions.run_intent');
|
|
10
|
+
if (advertised.kind !== 'zeroshot.run-intent/v2')
|
|
11
|
+
return null;
|
|
9
12
|
const extension = (0, discovery_validation_js_1.closedRecord)(value, 'extensions.run_intent', [
|
|
10
13
|
'kind',
|
|
11
14
|
'base_url',
|
|
12
15
|
'route_templates',
|
|
13
16
|
]);
|
|
14
|
-
(0, discovery_validation_js_1.exact)(extension.kind, 'zeroshot.run-intent/v2', 'extensions.run_intent.kind');
|
|
15
17
|
const routes = (0, discovery_validation_js_1.closedRecord)(extension.route_templates, 'extensions.run_intent.route_templates', [
|
|
16
18
|
'submit',
|
|
17
19
|
'status',
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { routeTemplate } from './route-template.mjs';
|
|
2
|
-
import { closedRecord,
|
|
2
|
+
import { closedRecord, record, sameOriginUrl } from './discovery-validation.mjs';
|
|
3
3
|
export function parseRunIntent(value, origin) {
|
|
4
4
|
if (value === undefined || value === null)
|
|
5
5
|
return null;
|
|
6
|
+
const advertised = record(value, 'extensions.run_intent');
|
|
7
|
+
if (advertised.kind !== 'zeroshot.run-intent/v2')
|
|
8
|
+
return null;
|
|
6
9
|
const extension = closedRecord(value, 'extensions.run_intent', [
|
|
7
10
|
'kind',
|
|
8
11
|
'base_url',
|
|
9
12
|
'route_templates',
|
|
10
13
|
]);
|
|
11
|
-
exact(extension.kind, 'zeroshot.run-intent/v2', 'extensions.run_intent.kind');
|
|
12
14
|
const routes = closedRecord(extension.route_templates, 'extensions.run_intent.route_templates', [
|
|
13
15
|
'submit',
|
|
14
16
|
'status',
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-open-engine/zeroshot",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.36.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@the-open-engine/zeroshot",
|
|
9
|
-
"version": "6.
|
|
9
|
+
"version": "6.36.0",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED
|
@@ -81,7 +81,7 @@ function detectCliFeatures(helpText?: string | null, versionText?: string | null
|
|
|
81
81
|
return {
|
|
82
82
|
provider: 'omp',
|
|
83
83
|
versionMatches: VERSION_TOKEN_PATTERN.test(version),
|
|
84
|
-
supportsRpcMode: /(
|
|
84
|
+
supportsRpcMode: /(?<![A-Za-z0-9_-])rpc(?![A-Za-z0-9_-])/.test(help),
|
|
85
85
|
supportsConfig: /--config\b/.test(help),
|
|
86
86
|
supportsModel: /--model\b/.test(help),
|
|
87
87
|
supportsThinking: /--thinking\b/.test(help),
|
|
@@ -921,11 +921,7 @@ function probeGatewayProvider(
|
|
|
921
921
|
try {
|
|
922
922
|
const settings = runtimeSettings ?? loadRuntimeSettings();
|
|
923
923
|
const providerSettings = runtimeProviderSettings(settings, 'gateway', process.cwd());
|
|
924
|
-
|
|
925
|
-
providerSettings.gateway,
|
|
926
|
-
'settings.providerSettings.gateway',
|
|
927
|
-
process.cwd()
|
|
928
|
-
);
|
|
924
|
+
resolveRuntimeGatewayOptions('gateway', {}, providerSettings, providerSettings.gateway ?? {});
|
|
929
925
|
return {
|
|
930
926
|
available: true,
|
|
931
927
|
helpText: 'Bundled gateway runner',
|
|
@@ -12,13 +12,6 @@ import type {
|
|
|
12
12
|
TargetAccessTokenProvider,
|
|
13
13
|
} from './types.js';
|
|
14
14
|
|
|
15
|
-
export type CredentialInstallCapability =
|
|
16
|
-
| { readonly supported: false }
|
|
17
|
-
| {
|
|
18
|
-
readonly supported: true;
|
|
19
|
-
readonly descriptor: NonNullable<TargetDiscoveryDescriptor['credentialInstall']>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
15
|
export interface TargetAdapter {
|
|
23
16
|
allocate(req: AllocateRequest, signal?: AbortSignal): Promise<Capsule>;
|
|
24
17
|
list(req?: ListRequest, signal?: AbortSignal): Promise<CapsuleListPage>;
|
|
@@ -26,13 +19,6 @@ export interface TargetAdapter {
|
|
|
26
19
|
terminate(capsuleId: string, signal?: AbortSignal): Promise<Capsule>;
|
|
27
20
|
limits(signal?: AbortSignal): Promise<CapsuleLimits>;
|
|
28
21
|
access(capsuleId: string, signal?: AbortSignal): Promise<CapsuleAccess>;
|
|
29
|
-
installRuntime(
|
|
30
|
-
capsuleId: string,
|
|
31
|
-
runtime: unknown,
|
|
32
|
-
accessToken: string,
|
|
33
|
-
signal?: AbortSignal
|
|
34
|
-
): Promise<void>;
|
|
35
|
-
readonly credentialInstall: CredentialInstallCapability;
|
|
36
22
|
}
|
|
37
23
|
|
|
38
24
|
export interface CreateTargetAdapterOptions {
|
|
@@ -2,14 +2,7 @@ import { MAX_RETRY_ELAPSED_MS } from './bounds.js';
|
|
|
2
2
|
import { TargetAdapterError } from './errors.js';
|
|
3
3
|
import type { Clock, RetryPolicy } from './types.js';
|
|
4
4
|
|
|
5
|
-
export type TargetOperation =
|
|
6
|
-
| 'allocate'
|
|
7
|
-
| 'list'
|
|
8
|
-
| 'inspect'
|
|
9
|
-
| 'terminate'
|
|
10
|
-
| 'limits'
|
|
11
|
-
| 'access'
|
|
12
|
-
| 'installRuntime';
|
|
5
|
+
export type TargetOperation = 'allocate' | 'list' | 'inspect' | 'terminate' | 'limits' | 'access';
|
|
13
6
|
|
|
14
7
|
function throwIfAborted(signal?: AbortSignal): void {
|
|
15
8
|
if (signal?.aborted) {
|
|
@@ -22,10 +15,16 @@ async function wait(delayMs: number, signal?: AbortSignal): Promise<void> {
|
|
|
22
15
|
if (delayMs <= 0) return;
|
|
23
16
|
await new Promise<void>((resolve, reject) => {
|
|
24
17
|
const timer = setTimeout(resolve, delayMs);
|
|
25
|
-
signal?.addEventListener(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
signal?.addEventListener(
|
|
19
|
+
'abort',
|
|
20
|
+
() => {
|
|
21
|
+
clearTimeout(timer);
|
|
22
|
+
reject(
|
|
23
|
+
signal.reason ?? new globalThis.DOMException('The operation was aborted', 'AbortError')
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
{ once: true }
|
|
27
|
+
);
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -41,12 +40,11 @@ function validRetryDelay(retry: boolean, delayMs: number, remaining: number): bo
|
|
|
41
40
|
return retry && Number.isFinite(delayMs) && delayMs >= 0 && delayMs < remaining;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
|
|
45
43
|
export async function withTargetRetry<T>(
|
|
46
44
|
operation: TargetOperation,
|
|
47
45
|
effect: () => Promise<T>,
|
|
48
46
|
signal: AbortSignal | undefined,
|
|
49
|
-
context: RetryContext
|
|
47
|
+
context: RetryContext
|
|
50
48
|
): Promise<T> {
|
|
51
49
|
const retrySafe = operation !== 'access';
|
|
52
50
|
const started = context.clock.now();
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { ZeroCloudV1TargetAdapter } from './zero-cloud-v1-adapter.js';
|
|
2
2
|
import type { CreateTargetAdapterOptions, TargetAdapter } from './adapter-types.js';
|
|
3
|
-
export type {
|
|
4
|
-
CreateTargetAdapterOptions,
|
|
5
|
-
CredentialInstallCapability,
|
|
6
|
-
TargetAdapter,
|
|
7
|
-
} from './adapter-types.js';
|
|
3
|
+
export type { CreateTargetAdapterOptions, TargetAdapter } from './adapter-types.js';
|
|
8
4
|
|
|
9
5
|
export function createTargetAdapter(options: CreateTargetAdapterOptions): TargetAdapter {
|
|
10
6
|
if (options.descriptor.adapter.majorVersion !== 1) {
|
|
@@ -22,7 +22,6 @@ import type { TargetDiscoveryDescriptor } from '../target/discovery.js';
|
|
|
22
22
|
import { readBoundedResponseJson } from '../target/bounded-response.js';
|
|
23
23
|
import { validateAccessUrl } from './access-url.js';
|
|
24
24
|
import { withTargetRetry } from './retry-executor.js';
|
|
25
|
-
import { installRuntime as installOpaqueRuntime } from './runtime-install.js';
|
|
26
25
|
import { assertCapsuleResponseStatus } from './response-status.js';
|
|
27
26
|
import {
|
|
28
27
|
createAdapterRequester,
|
|
@@ -61,13 +60,6 @@ export class ZeroCloudV1TargetAdapter implements TargetAdapter {
|
|
|
61
60
|
this.#retryPolicy = options.retryPolicy ?? new DefaultRetryPolicy();
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
get credentialInstall(): TargetAdapter['credentialInstall'] {
|
|
65
|
-
const descriptor = this.#descriptor.credentialInstall;
|
|
66
|
-
return descriptor === null
|
|
67
|
-
? Object.freeze({ supported: false as const })
|
|
68
|
-
: Object.freeze({ supported: true as const, descriptor });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
63
|
allocate(request: AllocateRequest, signal?: AbortSignal): Promise<Capsule> {
|
|
72
64
|
try {
|
|
73
65
|
if (!IDEMPOTENCY_KEY_PATTERN.test(request.idempotencyKey))
|
|
@@ -184,35 +176,6 @@ export class ZeroCloudV1TargetAdapter implements TargetAdapter {
|
|
|
184
176
|
return result;
|
|
185
177
|
}
|
|
186
178
|
|
|
187
|
-
async installRuntime(
|
|
188
|
-
capsuleId: string,
|
|
189
|
-
runtime: unknown,
|
|
190
|
-
accessToken: string,
|
|
191
|
-
signal?: AbortSignal
|
|
192
|
-
): Promise<void> {
|
|
193
|
-
const descriptor = this.#descriptor.credentialInstall;
|
|
194
|
-
if (descriptor === null) {
|
|
195
|
-
throw new TargetProtocolError('Target does not advertise runtime installation');
|
|
196
|
-
}
|
|
197
|
-
await installOpaqueRuntime({
|
|
198
|
-
capsuleId,
|
|
199
|
-
runtime,
|
|
200
|
-
accessToken,
|
|
201
|
-
descriptor,
|
|
202
|
-
...(signal === undefined ? {} : { signal }),
|
|
203
|
-
clock: this.#clock,
|
|
204
|
-
retryPolicy: this.#retryPolicy,
|
|
205
|
-
request: (method, path, requestSignal, body, token) =>
|
|
206
|
-
this.#request({
|
|
207
|
-
method,
|
|
208
|
-
path,
|
|
209
|
-
signal: requestSignal,
|
|
210
|
-
request: { body },
|
|
211
|
-
accessToken: token,
|
|
212
|
-
}),
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
|
|
216
179
|
#execute<T>(...args: ExecuteArguments<T>): Promise<T> {
|
|
217
180
|
return Promise.resolve().then(() => this.#executeExpanded(args));
|
|
218
181
|
}
|
|
@@ -4,10 +4,9 @@ import {
|
|
|
4
4
|
exact,
|
|
5
5
|
exactStringSet,
|
|
6
6
|
integer,
|
|
7
|
-
|
|
7
|
+
record,
|
|
8
8
|
sameOriginUrl,
|
|
9
9
|
stringField,
|
|
10
|
-
type CredentialInstallDescriptor,
|
|
11
10
|
} from './discovery-validation.js';
|
|
12
11
|
import { parseRunIntent, type RunIntentDescriptor } from './run-intent-discovery.js';
|
|
13
12
|
import { routeTemplate } from './route-template.js';
|
|
@@ -65,37 +64,13 @@ export function parseExtensions(
|
|
|
65
64
|
discovery: Record<string, unknown>,
|
|
66
65
|
origin: string
|
|
67
66
|
): {
|
|
68
|
-
readonly credentialInstall: CredentialInstallDescriptor | null;
|
|
69
67
|
readonly runIntent: RunIntentDescriptor | null;
|
|
70
68
|
} {
|
|
71
69
|
if (discovery.extensions === undefined || discovery.extensions === null) {
|
|
72
|
-
return Object.freeze({
|
|
70
|
+
return Object.freeze({ runIntent: null });
|
|
73
71
|
}
|
|
74
|
-
const extensions =
|
|
75
|
-
'connections',
|
|
76
|
-
'credential_install',
|
|
77
|
-
'run_intent',
|
|
78
|
-
]);
|
|
79
|
-
if (extensions.connections === undefined) {
|
|
80
|
-
throw new TargetDiscoveryError('extensions.connections is required');
|
|
81
|
-
}
|
|
82
|
-
const connections = closedRecord(extensions.connections, 'extensions.connections', [
|
|
83
|
-
'kind',
|
|
84
|
-
'base_url',
|
|
85
|
-
'route_templates',
|
|
86
|
-
]);
|
|
87
|
-
exact(connections.kind, 'zerocloud.connections/v1', 'extensions.connections.kind');
|
|
88
|
-
sameOriginUrl(connections.base_url, 'extensions.connections.base_url', origin);
|
|
89
|
-
const routes = closedRecord(
|
|
90
|
-
connections.route_templates,
|
|
91
|
-
'extensions.connections.route_templates',
|
|
92
|
-
['list', 'create', 'update']
|
|
93
|
-
);
|
|
94
|
-
routeTemplate(routes.list, 'extensions.connections.route_templates.list', []);
|
|
95
|
-
routeTemplate(routes.create, 'extensions.connections.route_templates.create', []);
|
|
96
|
-
routeTemplate(routes.update, 'extensions.connections.route_templates.update', ['connection_id']);
|
|
72
|
+
const extensions = record(discovery.extensions, 'extensions');
|
|
97
73
|
return Object.freeze({
|
|
98
|
-
credentialInstall: parseCredentialInstall(extensions.credential_install),
|
|
99
74
|
runIntent: parseRunIntent(extensions.run_intent, origin),
|
|
100
75
|
});
|
|
101
76
|
}
|