orizu 0.5.21 → 0.5.23
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 +46 -15
- package/dist/cleanup.d.ts +6 -0
- package/dist/cleanup.d.ts.map +1 -0
- package/dist/cleanup.js +27 -0
- package/dist/gepa-engine-dispatch.d.ts.map +1 -1
- package/dist/gepa-engine-dispatch.js +20 -1
- package/dist/gepa-python-paths.d.ts.map +1 -1
- package/dist/gepa-python-paths.js +25 -6
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +37 -15
- package/dist/hosted-commands.d.ts +13 -0
- package/dist/hosted-commands.d.ts.map +1 -0
- package/dist/hosted-commands.js +10 -0
- package/dist/hosted-gepa-cli.d.ts +11 -0
- package/dist/hosted-gepa-cli.d.ts.map +1 -0
- package/dist/hosted-gepa-cli.js +110 -0
- package/dist/hosted-gepa-numeric-values.d.ts +3 -0
- package/dist/hosted-gepa-numeric-values.d.ts.map +1 -0
- package/dist/hosted-gepa-numeric-values.js +49 -0
- package/dist/hosted-provider-settings.d.ts +3 -0
- package/dist/hosted-provider-settings.d.ts.map +1 -0
- package/dist/hosted-provider-settings.js +69 -0
- package/dist/hosted-session-cli.d.ts.map +1 -1
- package/dist/hosted-session-cli.js +6 -1
- package/dist/http.d.ts +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +72 -74
- package/dist/instruction-set-loader.d.ts.map +1 -1
- package/dist/instruction-set-loader.js +57 -5
- package/dist/instruction-sets-cli.d.ts +5 -2
- package/dist/instruction-sets-cli.d.ts.map +1 -1
- package/dist/instruction-sets-cli.js +134 -24
- package/dist/optimizations-promote-cli.d.ts +3 -0
- package/dist/optimizations-promote-cli.d.ts.map +1 -1
- package/dist/optimizations-promote-cli.js +75 -7
- package/dist/runner-dir-verify.d.ts.map +1 -1
- package/dist/runner-dir-verify.js +4 -7
- package/dist/skilled-proposer-bake-report.d.ts +2 -0
- package/dist/skilled-proposer-bake-report.d.ts.map +1 -0
- package/dist/skilled-proposer-bake-report.js +1 -0
- package/dist/skilled-proposer-config.d.ts +2 -0
- package/dist/skilled-proposer-config.d.ts.map +1 -0
- package/dist/skilled-proposer-config.js +212 -0
- package/dist/skilled-proposer-launch.d.ts +26 -0
- package/dist/skilled-proposer-launch.d.ts.map +1 -1
- package/dist/skilled-proposer-launch.js +103 -6
- package/package.json +1 -1
- package/scripts/vendor-gepa-python.mjs +81 -12
- package/src/cleanup.ts +37 -0
- package/src/gepa-engine-dispatch.ts +21 -1
- package/src/gepa-python-paths.ts +24 -6
- package/src/help.ts +37 -15
- package/src/hosted-commands.ts +4 -0
- package/src/hosted-gepa-cli.ts +107 -0
- package/src/hosted-gepa-numeric-values.ts +60 -0
- package/src/hosted-provider-settings.ts +69 -0
- package/src/hosted-session-cli.ts +4 -1
- package/src/http.ts +8 -0
- package/src/index.ts +112 -89
- package/src/instruction-set-loader.ts +55 -5
- package/src/instruction-sets-cli.ts +173 -19
- package/src/optimizations-promote-cli.ts +85 -7
- package/src/runner-dir-verify.ts +11 -6
- package/src/skilled-proposer-bake-report.ts +1 -0
- package/src/skilled-proposer-config.ts +191 -0
- package/src/skilled-proposer-launch.ts +96 -7
- package/src/skilled-proposer-venv-manager.mjs +44 -27
- package/vendor/orizu-gepa/src/orizu_gepa_connector/engine.py +36 -3
- package/vendor/orizu-gepa/src/orizu_gepa_connector/instruction_set_loader.py +31 -3
- package/vendor/orizu-gepa/src/orizu_gepa_connector/runtime.py +7 -2
- package/vendor/orizu-gepa/src/orizu_gepa_connector/skilled_proposer_bridge.py +354 -5
- package/vendor/orizu-gepa-python/src/orizu_gepa/cli.py +1 -0
- package/vendor/orizu-gepa-python/src/orizu_gepa/client.py +15 -0
- package/vendor/skills/orizu-cli/SKILL.md +94 -168
- package/vendor/skills/orizu-cli/references/assess-and-plan.md +107 -0
- package/vendor/skills/orizu-cli/references/building-judges.md +442 -180
- package/vendor/skills/orizu-cli/references/cli-reference.md +69 -39
- package/vendor/skills/orizu-cli/references/dataset-design.md +100 -0
- package/vendor/skills/orizu-cli/references/eval-strategy.md +64 -0
- package/vendor/skills/orizu-cli/references/instructions-after-prompts.md +115 -0
- package/vendor/skills/orizu-cli/references/migrate-existing-gepa-setup.md +150 -82
- package/vendor/skills/orizu-cli/references/optimization-reports.md +196 -104
- package/vendor/skills/orizu-cli/references/optimization-with-gepa.md +57 -37
- package/vendor/skills/orizu-cli/references/primer.md +43 -18
- package/vendor/skills/orizu-cli/references/prompt-control-plane.md +199 -131
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function isRecord(value) {
|
|
2
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
function hasOnlyKeys(value, keys) {
|
|
5
|
+
return Object.keys(value).every(key => keys.includes(key));
|
|
6
|
+
}
|
|
7
|
+
function isChoice(value, choices) {
|
|
8
|
+
return typeof value === 'string' && choices.includes(value);
|
|
9
|
+
}
|
|
10
|
+
function isProviderObject(value, keys, choices) {
|
|
11
|
+
return isRecord(value) && hasOnlyKeys(value, keys)
|
|
12
|
+
&& Object.entries(value).every(([key, nested]) => isChoice(nested, choices[key] ?? []));
|
|
13
|
+
}
|
|
14
|
+
function isCredentialKey(key) {
|
|
15
|
+
const tokens = key.replaceAll(/([a-z0-9])([A-Z])/g, '$1 $2').toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
16
|
+
return tokens.some(token => ['auth', 'authorization', 'token', 'secret', 'password', 'passwd', 'credential', 'credentials', 'key'].includes(token))
|
|
17
|
+
|| /(?:authorization|authheader|bearer|token|secret|password|passwd|credential|credentials|apikey|accesskey(?:id)?|privatekey|clientkey|secretkey|connection(?:string|url)|dsn)$/.test(tokens.join(''));
|
|
18
|
+
}
|
|
19
|
+
function containsCredential(value, root = true) {
|
|
20
|
+
if (Array.isArray(value))
|
|
21
|
+
return root || value.some(nested => containsCredential(nested, false));
|
|
22
|
+
if (!isRecord(value))
|
|
23
|
+
return root ? value !== undefined
|
|
24
|
+
: typeof value === 'string' && (/(?:authorization|bearer|x-api-key|x-auth-token)\s*[: ]/i.test(value)
|
|
25
|
+
|| /^[a-z]+:\/\/[^/@]*:[^/@]*@/i.test(value));
|
|
26
|
+
return Object.entries(value).some(([key, nested]) => isCredentialKey(key) || containsCredential(nested, false));
|
|
27
|
+
}
|
|
28
|
+
function unsupportedHostedSetting(value, model) {
|
|
29
|
+
if (value === undefined)
|
|
30
|
+
return null;
|
|
31
|
+
if (!isRecord(value))
|
|
32
|
+
return '<root>';
|
|
33
|
+
const providerKeys = model.startsWith('openai/') ? ['reasoning']
|
|
34
|
+
: model.startsWith('anthropic/') ? ['thinking', 'output_config'] : [];
|
|
35
|
+
const unknown = Object.keys(value).find(key => !['top_p', ...providerKeys].includes(key));
|
|
36
|
+
if (unknown)
|
|
37
|
+
return unknown;
|
|
38
|
+
if (value.top_p !== undefined && (typeof value.top_p !== 'number'
|
|
39
|
+
|| !Number.isFinite(value.top_p) || value.top_p < 0 || value.top_p > 1))
|
|
40
|
+
return 'top_p';
|
|
41
|
+
if (value.thinking !== undefined && (!isRecord(value.thinking) || value.thinking.type === undefined))
|
|
42
|
+
return 'thinking.type';
|
|
43
|
+
for (const [key, nested, keys, choices] of [
|
|
44
|
+
['thinking', value.thinking, ['type'], { type: ['adaptive'] }],
|
|
45
|
+
['output_config', value.output_config, ['effort'], { effort: ['low', 'medium', 'high', 'max'] }],
|
|
46
|
+
['reasoning', value.reasoning, ['effort', 'summary'], { effort: ['minimal', 'low', 'medium', 'high', 'xhigh'], summary: ['auto', 'concise', 'detailed'] }],
|
|
47
|
+
])
|
|
48
|
+
if (nested !== undefined && !isProviderObject(nested, keys, choices)) {
|
|
49
|
+
if (!isRecord(nested))
|
|
50
|
+
return key;
|
|
51
|
+
return `${key}.${Object.keys(nested).find(child => !keys.includes(child)
|
|
52
|
+
|| !isChoice(nested[child], choices[child] ?? [])) ?? key}`;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
export function hostedSettingsContainCredentials(value) { return containsCredential(value); }
|
|
57
|
+
export function hostedProviderSettingsError(value, model = 'anthropic/', temperature) {
|
|
58
|
+
if (hostedSettingsContainCredentials(value)) {
|
|
59
|
+
return 'Hosted reflection provider settings must not contain credential-bearing fields.';
|
|
60
|
+
}
|
|
61
|
+
const unsupported = unsupportedHostedSetting(value, model);
|
|
62
|
+
if (unsupported)
|
|
63
|
+
return `Unsupported hosted setting "${unsupported}".`;
|
|
64
|
+
if (model.startsWith('anthropic/') && temperature !== undefined && temperature !== null
|
|
65
|
+
&& isRecord(value) && value.thinking !== undefined) {
|
|
66
|
+
return 'reflection_temperature cannot be combined with Anthropic thinking';
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-session-cli.d.ts","sourceRoot":"","sources":["../src/hosted-session-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAA;AAK9B,OAAO,EAAE,oBAAoB,EAAqB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"hosted-session-cli.d.ts","sourceRoot":"","sources":["../src/hosted-session-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EAC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AA;CAC9H;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,EAAE,eAAe,EACnB,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAoLjB"}
|
|
@@ -44,6 +44,7 @@ import { buildEgressPolicy, DEFAULT_EGRESS_CANARY_HOST } from './egress-policy.j
|
|
|
44
44
|
import { DEFAULT_HOSTED_MODEL, hostedLoopCommand } from './hosted-loop.js';
|
|
45
45
|
import { hostedBootCommand } from './hosted-boot.js';
|
|
46
46
|
import { mergeJobCommand } from './merge-job.js';
|
|
47
|
+
import { skilledProposerBakeCommand } from './skilled-proposer-launch.js';
|
|
47
48
|
import { authedFetch } from './http.js';
|
|
48
49
|
import { resolveBaseUrl } from './http.js';
|
|
49
50
|
import { findUnknownOption } from './option-validation.js';
|
|
@@ -1185,7 +1186,11 @@ export async function hostedCommand(args, io, deps = {}) {
|
|
|
1185
1186
|
if (positional[1] === 'merge-job') {
|
|
1186
1187
|
return mergeJobCommand(io);
|
|
1187
1188
|
}
|
|
1188
|
-
|
|
1189
|
+
if (positional[1] === 'bake-skilled-proposer-venv')
|
|
1190
|
+
return skilledProposerBakeCommand(io);
|
|
1191
|
+
if (positional[1] === 'verify-skilled-proposer-bake')
|
|
1192
|
+
return skilledProposerBakeCommand(io, true);
|
|
1193
|
+
io.printErr?.('Usage: orizu internal <hosted-loop --context <path> | hosted-boot | merge-job | bake-skilled-proposer-venv | verify-skilled-proposer-bake>');
|
|
1189
1194
|
return 1;
|
|
1190
1195
|
}
|
|
1191
1196
|
const unknownOption = findUnknownOption(args, HOSTED_START_OPTIONS, HOSTED_START_VALUE_OPTIONS);
|
package/dist/http.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export declare function resolveBaseUrl(flags?: GlobalFlags): string;
|
|
|
4
4
|
export declare function resolveLoginBaseUrl(flags?: GlobalFlags): string;
|
|
5
5
|
export declare function getBaseUrl(): string;
|
|
6
6
|
export declare function assertSecureTokenTransport(baseUrl: string): void;
|
|
7
|
+
export declare function credentialRequestRedirectPolicy(): Pick<RequestInit, 'redirect'>;
|
|
7
8
|
export declare function authedFetch(path: string, init?: RequestInit): Promise<Response>;
|
|
8
9
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,WAAW,EAAoB,MAAM,mBAAmB,CAAA;AAKjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,QAEhD;AAED,wBAAgB,cAAc,CAAC,KAAK,GAAE,WAA0B,GAAG,MAAM,CAiBxE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,WAA0B,GAAG,MAAM,CAY7E;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAWD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,QAmBzD;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,WAAW,EAAoB,MAAM,mBAAmB,CAAA;AAKjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,QAEhD;AAED,wBAAgB,cAAc,CAAC,KAAK,GAAE,WAA0B,GAAG,MAAM,CAiBxE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,WAA0B,GAAG,MAAM,CAY7E;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAWD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,QAmBzD;AAeD,wBAAgB,+BAA+B,IAAI,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAE/E;AAkCD,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,qBAqDrE"}
|
package/dist/http.js
CHANGED
|
@@ -65,6 +65,9 @@ function isExpired(expiresAt) {
|
|
|
65
65
|
const nowUnix = Math.floor(Date.now() / 1000);
|
|
66
66
|
return expiresAt <= nowUnix + 30;
|
|
67
67
|
}
|
|
68
|
+
export function credentialRequestRedirectPolicy() {
|
|
69
|
+
return process.env.ORIZU_CLI_AUTH_REDIRECT === 'error' ? { redirect: 'error' } : {};
|
|
70
|
+
}
|
|
68
71
|
async function refreshCredentials(baseUrl, credentials) {
|
|
69
72
|
if (!isSessionCredentials(credentials)) {
|
|
70
73
|
throw new Error('API key credentials do not refresh. Run `orizu login` again if access fails.');
|
|
@@ -74,6 +77,7 @@ async function refreshCredentials(baseUrl, credentials) {
|
|
|
74
77
|
method: 'POST',
|
|
75
78
|
headers: { 'Content-Type': 'application/json' },
|
|
76
79
|
body: JSON.stringify({ refreshToken: credentials.refreshToken }),
|
|
80
|
+
...credentialRequestRedirectPolicy(),
|
|
77
81
|
});
|
|
78
82
|
if (!response.ok) {
|
|
79
83
|
throw new Error('Session expired. Run `orizu login` again.');
|
|
@@ -107,6 +111,7 @@ export async function authedFetch(path, init = {}) {
|
|
|
107
111
|
...(init.headers || {}),
|
|
108
112
|
Authorization: `Bearer ${envBearer}`,
|
|
109
113
|
},
|
|
114
|
+
...credentialRequestRedirectPolicy(),
|
|
110
115
|
});
|
|
111
116
|
}
|
|
112
117
|
const credentials = getServerCredentials(baseUrl);
|
|
@@ -123,6 +128,7 @@ export async function authedFetch(path, init = {}) {
|
|
|
123
128
|
...(init.headers || {}),
|
|
124
129
|
Authorization: `Bearer ${getAuthorizationToken(activeCredentials)}`,
|
|
125
130
|
},
|
|
131
|
+
...credentialRequestRedirectPolicy(),
|
|
126
132
|
});
|
|
127
133
|
if (response.status === 401 && isSessionCredentials(activeCredentials)) {
|
|
128
134
|
activeCredentials = await refreshCredentials(baseUrl, activeCredentials);
|
|
@@ -132,6 +138,7 @@ export async function authedFetch(path, init = {}) {
|
|
|
132
138
|
...(init.headers || {}),
|
|
133
139
|
Authorization: `Bearer ${getAuthorizationToken(activeCredentials)}`,
|
|
134
140
|
},
|
|
141
|
+
...credentialRequestRedirectPolicy(),
|
|
135
142
|
});
|
|
136
143
|
}
|
|
137
144
|
return response;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAmGgF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAoChJ,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAgU5E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAUD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAyBD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAcD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,GAAG,CAqB5E;AA6BD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBtD;AAkkKD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA0B1G;AAED,eAAO,MAAM,iBAAiB,SAAU,CAAA;AACxC,eAAO,MAAM,uBAAuB,QAAkB,CAAA;AACtD,eAAO,MAAM,oBAAoB,aAgB/B,CAAA;AAEF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAaxH;AAWD,wBAAsB,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,CAoC3H;AA0LD,wBAAsB,IAAI,CAAC,OAAO,WAAwB,iBAygBzD"}
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { parseGlobalFlags } from './global-flags.js';
|
|
|
21
21
|
import { getCapabilities, renderHelpForArgs, renderRootHelp } from './help.js';
|
|
22
22
|
import { runLocalAppPreview } from './preview-runtime.js';
|
|
23
23
|
import { readAssignmentManifestJsonlFile } from './task-assignment-manifest.js';
|
|
24
|
-
import { assertSecureTokenTransport, authedFetch, getBaseUrl, resolveLoginBaseUrl, setGlobalFlags } from './http.js';
|
|
24
|
+
import { assertSecureTokenTransport, authedFetch, credentialRequestRedirectPolicy, getBaseUrl, resolveLoginBaseUrl, setGlobalFlags, } from './http.js';
|
|
25
25
|
import { computeSkillContentHash, getSkillInstallPath, getSkillTargetStatus, getTargetForAgent, installSkillTarget, isSkillInstallAgent, isSkillInstallTarget, resolveSkillSource, SKILL_INSTALL_AGENTS, SKILL_INSTALL_TARGETS, targetNeedsOverwrite, } from './skill-installer.js';
|
|
26
26
|
import { renderBanner } from './banner.js';
|
|
27
27
|
import { formatTaskCreateError } from './task-create-error.js';
|
|
@@ -33,6 +33,7 @@ import { ARTIFACT_MAX_BYTES, runnerOptimizerCommand } from './artifact-pull.js';
|
|
|
33
33
|
import { killSwitchCommand } from './kill-switch-cli.js';
|
|
34
34
|
import { egressAllowlistCommand } from './egress-allowlist-cli.js';
|
|
35
35
|
import { acceptScoreRunCommand } from './scores-accept-cli.js';
|
|
36
|
+
import { cleanupAll, throwWithCleanup } from './cleanup.js';
|
|
36
37
|
import { listOptimizationRunsCommand } from './optimizations-list-cli.js';
|
|
37
38
|
import { promoteOptimizationCommand } from './optimizations-promote-cli.js';
|
|
38
39
|
import { scorersCommand } from './scorers-cli.js';
|
|
@@ -41,7 +42,7 @@ import { archiveArtifactCommand, listAssignmentsCommand, printAppSummaries, prin
|
|
|
41
42
|
import { teamConnectorsCommand } from './team-connectors-cli.js';
|
|
42
43
|
import { manifestsCommand } from './manifests-cli.js';
|
|
43
44
|
import { workbenchCommand } from './workbench-cli.js';
|
|
44
|
-
import {
|
|
45
|
+
import { dispatchHostedCommands } from './hosted-commands.js';
|
|
45
46
|
import { workspaceSyncCommand } from './workspace-sync.js';
|
|
46
47
|
import { runGitCredentialInvocation } from './git-credential.js';
|
|
47
48
|
import { instructionSetsCommand, syncToDisk } from './instruction-sets-cli.js';
|
|
@@ -52,7 +53,7 @@ import { readMarkdownReportInput } from './markdown-report-input.js';
|
|
|
52
53
|
import { promptPushErrorMessage, promptReportCommand } from './prompt-report-cli.js';
|
|
53
54
|
import { setPromptLabel } from './prompt-label-cli.js';
|
|
54
55
|
import { printPromptSummaryTable } from './prompt-summary-table.js';
|
|
55
|
-
import { assertSnapshotManifestConfined, verifyGepaRunnerDirsFromArgs, verifyRunnerDirRegistered } from './runner-dir-verify.js';
|
|
56
|
+
import { assertSnapshotManifestConfined, extractFlagValue, verifyGepaRunnerDirsFromArgs, verifyRunnerDirRegistered, } from './runner-dir-verify.js';
|
|
56
57
|
import { runScorersRegister } from './scorer-draft-push.js';
|
|
57
58
|
import { runZipArtifactPush } from './zip-draft-push.js';
|
|
58
59
|
import { runGithubLink, runInteractiveHostedSetup } from './github-setup.js';
|
|
@@ -65,7 +66,7 @@ import { dispatchGepaEngine } from './gepa-engine-dispatch.js';
|
|
|
65
66
|
import { resolveGepaInstructionSetProfileVersion } from './instruction-set-gepa-launch.js';
|
|
66
67
|
import { getGepaPythonCommand } from './gepa-python-command.js';
|
|
67
68
|
import { getGepaPythonPathEntries } from './gepa-python-paths.js';
|
|
68
|
-
import { prepareSkilledProposerLaunch } from './skilled-proposer-launch.js';
|
|
69
|
+
import { prepareSkilledProposerLaunch, spawnSkilledProposerChild } from './skilled-proposer-launch.js';
|
|
69
70
|
export { parseJsonResponse, sanitizeTerminalText } from './json-response.js';
|
|
70
71
|
function getErrorMessage(error) {
|
|
71
72
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -811,6 +812,7 @@ async function logout() {
|
|
|
811
812
|
body: 'refreshToken' in credentials
|
|
812
813
|
? JSON.stringify({ refreshToken: credentials.refreshToken })
|
|
813
814
|
: undefined,
|
|
815
|
+
...credentialRequestRedirectPolicy(),
|
|
814
816
|
});
|
|
815
817
|
if (!response.ok) {
|
|
816
818
|
remoteLogoutError = sanitizeTerminalText(await response.text()).slice(0, 180);
|
|
@@ -1205,39 +1207,6 @@ function refusePromptMutation(replacement) {
|
|
|
1205
1207
|
process.exitCode = 1;
|
|
1206
1208
|
throw new Error(`Use: orizu instructions ${replacement}`);
|
|
1207
1209
|
}
|
|
1208
|
-
async function bindPromptScorer(role) {
|
|
1209
|
-
const promptId = getPositionalArg(3);
|
|
1210
|
-
const project = getArg('--project') || await resolveProjectSlug(null);
|
|
1211
|
-
const scorerVersionId = getArg('--scorer-version');
|
|
1212
|
-
if (!promptId || !scorerVersionId) {
|
|
1213
|
-
throw new Error(`Usage: orizu prompts scorers ${role === 'headline' ? 'set-headline' : 'add'} <prompt-id> --scorer-version <id> [--dataset-version <id> --split-set <id> --split <name>] [--project <team/project>] [--json]`);
|
|
1214
|
-
}
|
|
1215
|
-
const response = await authedFetch(`/api/cli/prompts/scorers?project=${encodeURIComponent(project)}`, {
|
|
1216
|
-
method: 'POST',
|
|
1217
|
-
headers: { 'Content-Type': 'application/json' },
|
|
1218
|
-
body: JSON.stringify({
|
|
1219
|
-
promptId,
|
|
1220
|
-
scorerVersionId,
|
|
1221
|
-
role,
|
|
1222
|
-
datasetVersionId: getArg('--dataset-version') || undefined,
|
|
1223
|
-
splitSetId: getArg('--split-set') || undefined,
|
|
1224
|
-
splitName: getArg('--split') || undefined,
|
|
1225
|
-
}),
|
|
1226
|
-
});
|
|
1227
|
-
if (!response.ok) {
|
|
1228
|
-
throw new Error(`Failed to bind prompt scorer: ${await response.text()}`);
|
|
1229
|
-
}
|
|
1230
|
-
const data = await parseJsonResponse(response, 'Prompt scorer bind');
|
|
1231
|
-
if (hasJsonFlag()) {
|
|
1232
|
-
printJson(data);
|
|
1233
|
-
return;
|
|
1234
|
-
}
|
|
1235
|
-
printLine(`${role === 'headline' ? 'Set headline' : 'Added'} scorer ${sanitizeTerminalText(scorerVersionId)} for ${sanitizeTerminalText(promptId)}`);
|
|
1236
|
-
if (data.owner) {
|
|
1237
|
-
printLine(`Owner: ${sanitizeTerminalText(promptId)} -> ` +
|
|
1238
|
-
`${sanitizeTerminalText(data.owner.instructionSetSlug)} / ${sanitizeTerminalText(data.owner.componentKey)}`);
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
1210
|
function getPositionalArg(index) {
|
|
1242
1211
|
const value = cliArgs[index];
|
|
1243
1212
|
return value && !value.startsWith('--') ? value : null;
|
|
@@ -1784,6 +1753,30 @@ async function updateOptimizationRunLifecycle(action) {
|
|
|
1784
1753
|
}
|
|
1785
1754
|
// ALI-1073 list moved to optimizations-list-cli.ts (line ratchet, ALI-976);
|
|
1786
1755
|
// ALI-1175 labels its best scores as agent-reported evidence there.
|
|
1756
|
+
const GEPA_RUNNER_MATERIALIZATION_PAIRS = [
|
|
1757
|
+
{ versionFlag: '--runner-version-id', dirFlag: '--candidate-runner-dir' },
|
|
1758
|
+
{ versionFlag: '--scorer-runner-version-id', dirFlag: '--scorer-runner-dir' },
|
|
1759
|
+
];
|
|
1760
|
+
async function materializeMissingGepaRunnerDirs(args) {
|
|
1761
|
+
const rewritten = [...args];
|
|
1762
|
+
const cleanups = [];
|
|
1763
|
+
const cleanup = () => cleanupAll(cleanups, 'Failed to clean materialized runner directories');
|
|
1764
|
+
try {
|
|
1765
|
+
for (const pair of GEPA_RUNNER_MATERIALIZATION_PAIRS) {
|
|
1766
|
+
const runnerVersionId = extractFlagValue(rewritten, pair.versionFlag);
|
|
1767
|
+
const runnerDir = extractFlagValue(rewritten, pair.dirFlag);
|
|
1768
|
+
if (!runnerVersionId || runnerDir)
|
|
1769
|
+
continue;
|
|
1770
|
+
const materialized = await materializeRunnerVersion(runnerVersionId);
|
|
1771
|
+
cleanups.push(materialized.cleanup);
|
|
1772
|
+
rewritten.push(pair.dirFlag, materialized.runnerDir);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
catch (error) {
|
|
1776
|
+
throwWithCleanup(error, cleanups, 'Runner materialization failed and cleanup also failed');
|
|
1777
|
+
}
|
|
1778
|
+
return { args: rewritten, cleanup };
|
|
1779
|
+
}
|
|
1787
1780
|
async function runGepaOptimization() {
|
|
1788
1781
|
const project = getArg('--project') || await resolveProjectSlug(null);
|
|
1789
1782
|
const baseUrl = getBaseUrl();
|
|
@@ -1796,11 +1789,12 @@ async function runGepaOptimization() {
|
|
|
1796
1789
|
// itself (both argparse flag forms), fail-closed on half-populated pairs,
|
|
1797
1790
|
// and REWRITES the dir flags to verified snapshots (the exact hashed bytes)
|
|
1798
1791
|
// so a post-hash mutation of the original dirs cannot change what runs.
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1801
|
-
let result;
|
|
1792
|
+
const materialized = await materializeMissingGepaRunnerDirs(forwardedArgs);
|
|
1793
|
+
let verified;
|
|
1802
1794
|
let selectedEngine = 'official';
|
|
1803
1795
|
try {
|
|
1796
|
+
verified = await verifyGepaRunnerDirsFromArgs(materialized.args);
|
|
1797
|
+
forwardedArgs = verified.args;
|
|
1804
1798
|
// Uniform resolution (ALI-1090): honors ORIZU_TOKEN / ORIZU_TOKEN_FILE before
|
|
1805
1799
|
// credentials.json so hosted sandboxes can run optimizations. Read at spawn
|
|
1806
1800
|
// time — AFTER the verification awaits above, so a hosted token-file
|
|
@@ -1827,17 +1821,21 @@ async function runGepaOptimization() {
|
|
|
1827
1821
|
dispatch.environment.ORIZU_INSTRUCTION_SET_PROFILE_VERSION_ID = instructionSetProfileVersionId;
|
|
1828
1822
|
selectedEngine = dispatch.engine;
|
|
1829
1823
|
const launch = prepareSkilledProposerLaunch(python, dispatch.engine, dispatch.environment);
|
|
1830
|
-
result =
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1824
|
+
const result = await spawnSkilledProposerChild(launch.python, ['-m', dispatch.module, ...dispatch.args], dispatch.engine, launch.environment);
|
|
1825
|
+
if (result.error) {
|
|
1826
|
+
throw new Error(`${selectedEngine} GEPA engine failed: ${result.error.message}`, { cause: result.error });
|
|
1827
|
+
}
|
|
1828
|
+
if (result.status !== 0) {
|
|
1829
|
+
throw new Error(`${selectedEngine} GEPA engine failed with exit code ${result.status}`);
|
|
1830
|
+
}
|
|
1837
1831
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1832
|
+
catch (error) {
|
|
1833
|
+
throwWithCleanup(error, [
|
|
1834
|
+
...(verified ? [verified.cleanup] : []),
|
|
1835
|
+
materialized.cleanup,
|
|
1836
|
+
], 'GEPA launch failed and runner cleanup also failed');
|
|
1840
1837
|
}
|
|
1838
|
+
cleanupAll([verified.cleanup, materialized.cleanup], 'Failed to clean GEPA runner directories');
|
|
1841
1839
|
if (hasJsonFlag()) {
|
|
1842
1840
|
printJson({ status: 'completed', exitCode: 0 });
|
|
1843
1841
|
}
|
|
@@ -4500,24 +4498,27 @@ export async function materializeRunnerVersion(runnerVersionId) {
|
|
|
4500
4498
|
const tempDir = mkdtempSync(join(tmpdir(), 'orizu-runner-version-'));
|
|
4501
4499
|
const zipPath = join(tempDir, 'runner.zip');
|
|
4502
4500
|
const runnerDir = join(tempDir, 'runner');
|
|
4503
|
-
const
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4501
|
+
const cleanup = () => rmSync(tempDir, { recursive: true, force: true });
|
|
4502
|
+
try {
|
|
4503
|
+
const zipBytes = new Uint8Array(await response.arrayBuffer());
|
|
4504
|
+
if (zipBytes.byteLength > ARTIFACT_MAX_BYTES) {
|
|
4505
|
+
throw new Error(`Runner artifact exceeds ${ARTIFACT_MAX_BYTES} bytes`);
|
|
4506
|
+
}
|
|
4507
|
+
writeFileSync(zipPath, zipBytes);
|
|
4508
|
+
const result = spawnSync('unzip', ['-q', zipPath, '-d', runnerDir], {
|
|
4509
|
+
encoding: 'utf8',
|
|
4510
|
+
});
|
|
4511
|
+
if (result.error) {
|
|
4512
|
+
throw result.error;
|
|
4513
|
+
}
|
|
4514
|
+
if (result.status !== 0) {
|
|
4515
|
+
throw new Error(`unzip failed: ${sanitizeTerminalText(result.stderr || result.stdout || '')}`);
|
|
4516
|
+
}
|
|
4517
|
+
return { runnerDir, cleanup };
|
|
4515
4518
|
}
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
throw new Error(`unzip failed: ${sanitizeTerminalText(result.stderr || result.stdout || '')}`);
|
|
4519
|
+
catch (error) {
|
|
4520
|
+
throwWithCleanup(error, [cleanup], `Runner ${runnerVersionId} materialization failed and cleanup also failed`);
|
|
4519
4521
|
}
|
|
4520
|
-
return { runnerDir, cleanup: () => rmSync(tempDir, { recursive: true, force: true }) };
|
|
4521
4522
|
}
|
|
4522
4523
|
async function runnersExec() {
|
|
4523
4524
|
const prompt = getArg('--prompt');
|
|
@@ -4854,12 +4855,10 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
4854
4855
|
return;
|
|
4855
4856
|
}
|
|
4856
4857
|
if (command === 'prompts' && subcommand === 'scorers' && cliArgs[2] === 'set-headline') {
|
|
4857
|
-
|
|
4858
|
-
return;
|
|
4858
|
+
refusePromptMutation('scorers set-headline <set> --key <component-key> --scorer-version <id> --project <team/project>');
|
|
4859
4859
|
}
|
|
4860
4860
|
if (command === 'prompts' && subcommand === 'scorers' && cliArgs[2] === 'add') {
|
|
4861
|
-
|
|
4862
|
-
return;
|
|
4861
|
+
refusePromptMutation('scorers add <set> --key <component-key> --scorer-version <id> --project <team/project>');
|
|
4863
4862
|
}
|
|
4864
4863
|
if (command === 'judges' && subcommand === 'list') {
|
|
4865
4864
|
await listJudges();
|
|
@@ -4930,6 +4929,8 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
4930
4929
|
await acceptScoreRunCommand(cliArgs.slice(2), { json: hasJsonFlag(), print: printLine, resolveProjectSlug });
|
|
4931
4930
|
return;
|
|
4932
4931
|
}
|
|
4932
|
+
if (await dispatchHostedCommands(cliArgs, { environment: process.env, getArg, json: hasJsonFlag(), printJson, printLine, printErr: printError, resolveProjectSlug, setExitCode: code => { process.exitCode = code; } }))
|
|
4933
|
+
return;
|
|
4933
4934
|
if (command === 'optimizations' && subcommand === 'start') {
|
|
4934
4935
|
await startOptimizationRun();
|
|
4935
4936
|
return;
|
|
@@ -4958,7 +4959,8 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
4958
4959
|
}
|
|
4959
4960
|
if (command === 'optimizations' && subcommand === 'promote') {
|
|
4960
4961
|
await promoteOptimizationCommand(cliArgs.slice(2), {
|
|
4961
|
-
json: hasJsonFlag(), print: printLine,
|
|
4962
|
+
json: hasJsonFlag(), origin: parsed.flags, print: printLine, printErr: printError,
|
|
4963
|
+
resolveProjectSlug, fetcher: authedFetch,
|
|
4962
4964
|
});
|
|
4963
4965
|
return;
|
|
4964
4966
|
}
|
|
@@ -5106,10 +5108,6 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
5106
5108
|
await downloadAnnotations();
|
|
5107
5109
|
return;
|
|
5108
5110
|
}
|
|
5109
|
-
if (command === 'internal' || (command === 'session' && subcommand === 'start' && hasArg('--hosted'))) {
|
|
5110
|
-
process.exitCode = await hostedCommand(cliArgs, { json: hasJsonFlag(), print: printLine, printErr: printError });
|
|
5111
|
-
return;
|
|
5112
|
-
}
|
|
5113
5111
|
if (command === 'session' || command === 'run') {
|
|
5114
5112
|
process.exitCode = await workbenchCommand(cliArgs, { json: hasJsonFlag(), print: printLine });
|
|
5115
5113
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-set-loader.d.ts","sourceRoot":"","sources":["../src/instruction-set-loader.ts"],"names":[],"mappings":"AAGA,qBAAa,yBAA0B,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAClC;
|
|
1
|
+
{"version":3,"file":"instruction-set-loader.d.ts","sourceRoot":"","sources":["../src/instruction-set-loader.ts"],"names":[],"mappings":"AAGA,qBAAa,yBAA0B,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAClC;AA2DD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBvH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, realpathSync, readFileSync, statSync } from 'node:fs';
|
|
1
|
+
import { existsSync, realpathSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
2
2
|
import { resolve, sep } from 'node:path';
|
|
3
3
|
export class InstructionSetLoaderError extends Error {
|
|
4
4
|
code;
|
|
@@ -9,11 +9,63 @@ export class InstructionSetLoaderError extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
function inside(root, candidate) { return candidate === root || candidate.startsWith(`${root}${sep}`); }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
function manifestMatchesReference(candidate, reference) {
|
|
13
|
+
try {
|
|
14
|
+
const manifest = JSON.parse(readFileSync(resolve(candidate, 'manifest.json'), 'utf8'));
|
|
15
|
+
return manifest.name === reference || manifest.slug === reference;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function resolveSetRoot(directory, reference) {
|
|
22
|
+
let directoryRoot;
|
|
23
|
+
try {
|
|
24
|
+
directoryRoot = realpathSync(directory);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
15
27
|
throw new InstructionSetLoaderError('instruction_set_not_synced');
|
|
16
|
-
|
|
28
|
+
}
|
|
29
|
+
const direct = resolve(directoryRoot, reference);
|
|
30
|
+
try {
|
|
31
|
+
if (inside(directoryRoot, direct) && existsSync(direct) && statSync(direct).isDirectory()) {
|
|
32
|
+
const realDirect = realpathSync(direct);
|
|
33
|
+
if (inside(directoryRoot, realDirect)) {
|
|
34
|
+
try {
|
|
35
|
+
const manifest = JSON.parse(readFileSync(resolve(realDirect, 'manifest.json'), 'utf8'));
|
|
36
|
+
if (manifest.name === reference || manifest.slug === reference) {
|
|
37
|
+
return realDirect;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Preserve the exact-path loader's specific missing/invalid manifest error.
|
|
42
|
+
return realDirect;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// A stale or unreadable direct-path candidate must not shadow a valid set.
|
|
49
|
+
}
|
|
50
|
+
const matches = readdirSync(directoryRoot, { withFileTypes: true }).flatMap(entry => {
|
|
51
|
+
try {
|
|
52
|
+
if (entry.name.startsWith('.') || !entry.isDirectory())
|
|
53
|
+
return [];
|
|
54
|
+
const candidate = realpathSync(resolve(directoryRoot, entry.name));
|
|
55
|
+
return inside(directoryRoot, candidate) && manifestMatchesReference(candidate, reference)
|
|
56
|
+
? [candidate]
|
|
57
|
+
: [];
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
if (matches.length !== 1)
|
|
64
|
+
throw new InstructionSetLoaderError(matches.length > 1 ? 'instruction_set_reference_ambiguous' : 'instruction_set_not_synced');
|
|
65
|
+
return matches[0];
|
|
66
|
+
}
|
|
67
|
+
export function loadInstructionSet(directory, name, modelConfigIdentity) {
|
|
68
|
+
const setRoot = resolveSetRoot(directory, name);
|
|
17
69
|
const manifestPath = resolve(setRoot, 'manifest.json');
|
|
18
70
|
if (!existsSync(manifestPath))
|
|
19
71
|
throw new InstructionSetLoaderError('instruction_set_manifest_missing');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { renameSync, writeFileSync } from 'node:fs';
|
|
1
|
+
import { renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
2
|
export interface InstructionSetsCommandIo {
|
|
3
3
|
json: boolean;
|
|
4
4
|
print: (line: string) => void;
|
|
@@ -23,6 +23,8 @@ export interface SyncProfile {
|
|
|
23
23
|
production: SyncMaterial | null;
|
|
24
24
|
}
|
|
25
25
|
export interface SyncSet {
|
|
26
|
+
projectId?: string;
|
|
27
|
+
instructionSetId?: string;
|
|
26
28
|
name: string;
|
|
27
29
|
slug?: string;
|
|
28
30
|
description?: string | null;
|
|
@@ -34,7 +36,8 @@ export interface SyncSet {
|
|
|
34
36
|
export interface SyncFileOps {
|
|
35
37
|
writeFileSync: typeof writeFileSync;
|
|
36
38
|
renameSync?: typeof renameSync;
|
|
39
|
+
rmSync?: typeof rmSync;
|
|
37
40
|
}
|
|
38
|
-
export declare function syncToDisk(out: string, set: SyncSet, fileOps?: SyncFileOps):
|
|
41
|
+
export declare function syncToDisk(out: string, set: SyncSet, fileOps?: SyncFileOps): string;
|
|
39
42
|
export declare function instructionSetsCommand(args: string[], io: InstructionSetsCommandIo): Promise<number>;
|
|
40
43
|
//# sourceMappingURL=instruction-sets-cli.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-sets-cli.d.ts","sourceRoot":"","sources":["../src/instruction-sets-cli.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuC,UAAU,
|
|
1
|
+
{"version":3,"file":"instruction-sets-cli.d.ts","sourceRoot":"","sources":["../src/instru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