@eve-horizon/cli 0.2.46 → 0.2.48
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/dist/index.js +455 -91
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -6291,7 +6291,7 @@ var require_parse = __commonJS({
|
|
|
6291
6291
|
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js"(exports2, module2) {
|
|
6292
6292
|
"use strict";
|
|
6293
6293
|
var SemVer = require_semver();
|
|
6294
|
-
var
|
|
6294
|
+
var parse4 = (version2, options, throwErrors = false) => {
|
|
6295
6295
|
if (version2 instanceof SemVer) {
|
|
6296
6296
|
return version2;
|
|
6297
6297
|
}
|
|
@@ -6304,7 +6304,7 @@ var require_parse = __commonJS({
|
|
|
6304
6304
|
throw er;
|
|
6305
6305
|
}
|
|
6306
6306
|
};
|
|
6307
|
-
module2.exports =
|
|
6307
|
+
module2.exports = parse4;
|
|
6308
6308
|
}
|
|
6309
6309
|
});
|
|
6310
6310
|
|
|
@@ -6312,9 +6312,9 @@ var require_parse = __commonJS({
|
|
|
6312
6312
|
var require_valid = __commonJS({
|
|
6313
6313
|
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js"(exports2, module2) {
|
|
6314
6314
|
"use strict";
|
|
6315
|
-
var
|
|
6315
|
+
var parse4 = require_parse();
|
|
6316
6316
|
var valid = (version2, options) => {
|
|
6317
|
-
const v =
|
|
6317
|
+
const v = parse4(version2, options);
|
|
6318
6318
|
return v ? v.version : null;
|
|
6319
6319
|
};
|
|
6320
6320
|
module2.exports = valid;
|
|
@@ -6325,9 +6325,9 @@ var require_valid = __commonJS({
|
|
|
6325
6325
|
var require_clean = __commonJS({
|
|
6326
6326
|
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js"(exports2, module2) {
|
|
6327
6327
|
"use strict";
|
|
6328
|
-
var
|
|
6328
|
+
var parse4 = require_parse();
|
|
6329
6329
|
var clean = (version2, options) => {
|
|
6330
|
-
const s =
|
|
6330
|
+
const s = parse4(version2.trim().replace(/^[=v]+/, ""), options);
|
|
6331
6331
|
return s ? s.version : null;
|
|
6332
6332
|
};
|
|
6333
6333
|
module2.exports = clean;
|
|
@@ -6362,10 +6362,10 @@ var require_inc = __commonJS({
|
|
|
6362
6362
|
var require_diff = __commonJS({
|
|
6363
6363
|
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js"(exports2, module2) {
|
|
6364
6364
|
"use strict";
|
|
6365
|
-
var
|
|
6365
|
+
var parse4 = require_parse();
|
|
6366
6366
|
var diff = (version1, version2) => {
|
|
6367
|
-
const v12 =
|
|
6368
|
-
const v2 =
|
|
6367
|
+
const v12 = parse4(version1, null, true);
|
|
6368
|
+
const v2 = parse4(version2, null, true);
|
|
6369
6369
|
const comparison = v12.compare(v2);
|
|
6370
6370
|
if (comparison === 0) {
|
|
6371
6371
|
return null;
|
|
@@ -6436,9 +6436,9 @@ var require_patch = __commonJS({
|
|
|
6436
6436
|
var require_prerelease = __commonJS({
|
|
6437
6437
|
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js"(exports2, module2) {
|
|
6438
6438
|
"use strict";
|
|
6439
|
-
var
|
|
6439
|
+
var parse4 = require_parse();
|
|
6440
6440
|
var prerelease = (version2, options) => {
|
|
6441
|
-
const parsed =
|
|
6441
|
+
const parsed = parse4(version2, options);
|
|
6442
6442
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
6443
6443
|
};
|
|
6444
6444
|
module2.exports = prerelease;
|
|
@@ -6624,7 +6624,7 @@ var require_coerce = __commonJS({
|
|
|
6624
6624
|
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js"(exports2, module2) {
|
|
6625
6625
|
"use strict";
|
|
6626
6626
|
var SemVer = require_semver();
|
|
6627
|
-
var
|
|
6627
|
+
var parse4 = require_parse();
|
|
6628
6628
|
var { safeRe: re2, t } = require_re();
|
|
6629
6629
|
var coerce2 = (version2, options) => {
|
|
6630
6630
|
if (version2 instanceof SemVer) {
|
|
@@ -6659,7 +6659,7 @@ var require_coerce = __commonJS({
|
|
|
6659
6659
|
const patch = match[4] || "0";
|
|
6660
6660
|
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
6661
6661
|
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
6662
|
-
return
|
|
6662
|
+
return parse4(`${major2}.${minor}.${patch}${prerelease}${build}`, options);
|
|
6663
6663
|
};
|
|
6664
6664
|
module2.exports = coerce2;
|
|
6665
6665
|
}
|
|
@@ -7676,7 +7676,7 @@ var require_semver2 = __commonJS({
|
|
|
7676
7676
|
var constants = require_constants2();
|
|
7677
7677
|
var SemVer = require_semver();
|
|
7678
7678
|
var identifiers = require_identifiers();
|
|
7679
|
-
var
|
|
7679
|
+
var parse4 = require_parse();
|
|
7680
7680
|
var valid = require_valid();
|
|
7681
7681
|
var clean = require_clean();
|
|
7682
7682
|
var inc = require_inc();
|
|
@@ -7714,7 +7714,7 @@ var require_semver2 = __commonJS({
|
|
|
7714
7714
|
var simplifyRange = require_simplify();
|
|
7715
7715
|
var subset = require_subset();
|
|
7716
7716
|
module2.exports = {
|
|
7717
|
-
parse:
|
|
7717
|
+
parse: parse4,
|
|
7718
7718
|
valid,
|
|
7719
7719
|
clean,
|
|
7720
7720
|
inc,
|
|
@@ -7996,7 +7996,7 @@ var require_ms = __commonJS({
|
|
|
7996
7996
|
options = options || {};
|
|
7997
7997
|
var type = typeof val;
|
|
7998
7998
|
if (type === "string" && val.length > 0) {
|
|
7999
|
-
return
|
|
7999
|
+
return parse4(val);
|
|
8000
8000
|
} else if (type === "number" && isFinite(val)) {
|
|
8001
8001
|
return options.long ? fmtLong(val) : fmtShort(val);
|
|
8002
8002
|
}
|
|
@@ -8004,7 +8004,7 @@ var require_ms = __commonJS({
|
|
|
8004
8004
|
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
8005
8005
|
);
|
|
8006
8006
|
};
|
|
8007
|
-
function
|
|
8007
|
+
function parse4(str) {
|
|
8008
8008
|
str = String(str);
|
|
8009
8009
|
if (str.length > 100) {
|
|
8010
8010
|
return;
|
|
@@ -8887,7 +8887,7 @@ var require_path_parse = __commonJS({
|
|
|
8887
8887
|
var require_node_modules_paths = __commonJS({
|
|
8888
8888
|
"../../node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/node-modules-paths.js"(exports2, module2) {
|
|
8889
8889
|
var path8 = require("path");
|
|
8890
|
-
var
|
|
8890
|
+
var parse4 = path8.parse || require_path_parse();
|
|
8891
8891
|
var driveLetterRegex = /^([A-Za-z]:)/;
|
|
8892
8892
|
var uncPathRegex = /^\\\\/;
|
|
8893
8893
|
var getNodeModulesDirs = function getNodeModulesDirs2(absoluteStart, modules) {
|
|
@@ -8898,10 +8898,10 @@ var require_node_modules_paths = __commonJS({
|
|
|
8898
8898
|
prefix = "\\\\";
|
|
8899
8899
|
}
|
|
8900
8900
|
var paths = [absoluteStart];
|
|
8901
|
-
var parsed =
|
|
8901
|
+
var parsed = parse4(absoluteStart);
|
|
8902
8902
|
while (parsed.dir !== paths[paths.length - 1]) {
|
|
8903
8903
|
paths.push(parsed.dir);
|
|
8904
|
-
parsed =
|
|
8904
|
+
parsed = parse4(parsed.dir);
|
|
8905
8905
|
}
|
|
8906
8906
|
return paths.reduce(function(dirs, aPath) {
|
|
8907
8907
|
return dirs.concat(modules.map(function(moduleDir) {
|
|
@@ -9811,8 +9811,8 @@ var require_sync = __commonJS({
|
|
|
9811
9811
|
}
|
|
9812
9812
|
return x;
|
|
9813
9813
|
};
|
|
9814
|
-
var defaultReadPackageSync = function defaultReadPackageSync2(
|
|
9815
|
-
var body =
|
|
9814
|
+
var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync26, pkgfile) {
|
|
9815
|
+
var body = readFileSync26(pkgfile);
|
|
9816
9816
|
try {
|
|
9817
9817
|
var pkg = JSON.parse(body);
|
|
9818
9818
|
return pkg;
|
|
@@ -9832,7 +9832,7 @@ var require_sync = __commonJS({
|
|
|
9832
9832
|
}
|
|
9833
9833
|
var opts = normalizeOptions(x, options);
|
|
9834
9834
|
var isFile = opts.isFile || defaultIsFile;
|
|
9835
|
-
var
|
|
9835
|
+
var readFileSync26 = opts.readFileSync || fs6.readFileSync;
|
|
9836
9836
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
9837
9837
|
var realpathSync = opts.realpathSync || defaultRealpathSync;
|
|
9838
9838
|
var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
|
@@ -9889,7 +9889,7 @@ var require_sync = __commonJS({
|
|
|
9889
9889
|
if (!isFile(pkgfile)) {
|
|
9890
9890
|
return loadpkg(path8.dirname(dir));
|
|
9891
9891
|
}
|
|
9892
|
-
var pkg = readPackageSync(
|
|
9892
|
+
var pkg = readPackageSync(readFileSync26, pkgfile);
|
|
9893
9893
|
if (pkg && opts.packageFilter) {
|
|
9894
9894
|
pkg = opts.packageFilter(
|
|
9895
9895
|
pkg,
|
|
@@ -9903,7 +9903,7 @@ var require_sync = __commonJS({
|
|
|
9903
9903
|
var pkgfile = path8.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
|
9904
9904
|
if (isFile(pkgfile)) {
|
|
9905
9905
|
try {
|
|
9906
|
-
var pkg = readPackageSync(
|
|
9906
|
+
var pkg = readPackageSync(readFileSync26, pkgfile);
|
|
9907
9907
|
} catch (e) {
|
|
9908
9908
|
}
|
|
9909
9909
|
if (pkg && opts.packageFilter) {
|
|
@@ -10494,7 +10494,7 @@ var require_register = __commonJS({
|
|
|
10494
10494
|
var require_import_in_the_middle = __commonJS({
|
|
10495
10495
|
"../../node_modules/.pnpm/import-in-the-middle@1.15.0/node_modules/import-in-the-middle/index.js"(exports2, module2) {
|
|
10496
10496
|
var path8 = require("path");
|
|
10497
|
-
var
|
|
10497
|
+
var parse4 = require_module_details_from_path();
|
|
10498
10498
|
var { fileURLToPath } = require("url");
|
|
10499
10499
|
var { MessageChannel } = require("worker_threads");
|
|
10500
10500
|
var {
|
|
@@ -10578,7 +10578,7 @@ var require_import_in_the_middle = __commonJS({
|
|
|
10578
10578
|
} catch (e) {
|
|
10579
10579
|
}
|
|
10580
10580
|
}
|
|
10581
|
-
const details =
|
|
10581
|
+
const details = parse4(name);
|
|
10582
10582
|
if (details) {
|
|
10583
10583
|
name = details.name;
|
|
10584
10584
|
baseDir = details.basedir;
|
|
@@ -23186,7 +23186,7 @@ var require_instrumentation14 = __commonJS({
|
|
|
23186
23186
|
}
|
|
23187
23187
|
_patchParse() {
|
|
23188
23188
|
const instrumentation = this;
|
|
23189
|
-
return function
|
|
23189
|
+
return function parse4(original) {
|
|
23190
23190
|
return function patchParse(source, options) {
|
|
23191
23191
|
return instrumentation._parse(this, original, source, options);
|
|
23192
23192
|
};
|
|
@@ -28340,7 +28340,7 @@ var require_forwarded_parse = __commonJS({
|
|
|
28340
28340
|
position
|
|
28341
28341
|
);
|
|
28342
28342
|
}
|
|
28343
|
-
function
|
|
28343
|
+
function parse4(header) {
|
|
28344
28344
|
var mustUnescape = false;
|
|
28345
28345
|
var isEscaping = false;
|
|
28346
28346
|
var inQuotes = false;
|
|
@@ -28427,7 +28427,7 @@ var require_forwarded_parse = __commonJS({
|
|
|
28427
28427
|
output.push(forwarded);
|
|
28428
28428
|
return output;
|
|
28429
28429
|
}
|
|
28430
|
-
module2.exports =
|
|
28430
|
+
module2.exports = parse4;
|
|
28431
28431
|
}
|
|
28432
28432
|
});
|
|
28433
28433
|
|
|
@@ -52105,9 +52105,9 @@ async function handleProject(subcommand, positionals, flags, context2) {
|
|
|
52105
52105
|
const validateSecretsFlag = flags["validate-secrets"] ?? flags.validate_secrets;
|
|
52106
52106
|
const validateSecrets = toBoolean(validateSecretsFlag) ?? false;
|
|
52107
52107
|
const strict = toBoolean(flags.strict) ?? false;
|
|
52108
|
-
let
|
|
52108
|
+
let yaml2;
|
|
52109
52109
|
try {
|
|
52110
|
-
|
|
52110
|
+
yaml2 = (0, import_node_fs3.readFileSync)(manifestPath, "utf-8");
|
|
52111
52111
|
} catch (error) {
|
|
52112
52112
|
throw new Error(`Failed to read manifest at ${manifestPath}: ${error.message}`);
|
|
52113
52113
|
}
|
|
@@ -52121,13 +52121,13 @@ async function handleProject(subcommand, positionals, flags, context2) {
|
|
|
52121
52121
|
}
|
|
52122
52122
|
const projectIdRaw = typeof flags.project === "string" ? flags.project : context2.projectId;
|
|
52123
52123
|
if (!projectIdRaw) {
|
|
52124
|
-
const projectMatch =
|
|
52124
|
+
const projectMatch = yaml2.match(/^project:\s*(\S+)/m);
|
|
52125
52125
|
if (projectMatch) {
|
|
52126
52126
|
const projectIdFromManifest = projectMatch[1];
|
|
52127
52127
|
const response2 = await requestJson(context2, `/projects/${projectIdFromManifest}/manifest`, {
|
|
52128
52128
|
method: "POST",
|
|
52129
52129
|
body: {
|
|
52130
|
-
yaml,
|
|
52130
|
+
yaml: yaml2,
|
|
52131
52131
|
git_sha: gitSha,
|
|
52132
52132
|
branch,
|
|
52133
52133
|
validate_secrets: validateSecrets || strict,
|
|
@@ -52161,7 +52161,7 @@ async function handleProject(subcommand, positionals, flags, context2) {
|
|
|
52161
52161
|
const response = await requestJson(context2, `/projects/${projectIdRaw}/manifest`, {
|
|
52162
52162
|
method: "POST",
|
|
52163
52163
|
body: {
|
|
52164
|
-
yaml,
|
|
52164
|
+
yaml: yaml2,
|
|
52165
52165
|
git_sha: gitSha,
|
|
52166
52166
|
branch,
|
|
52167
52167
|
validate_secrets: validateSecrets || strict,
|
|
@@ -56840,7 +56840,27 @@ function createAuthChecks() {
|
|
|
56840
56840
|
}
|
|
56841
56841
|
return missing("missing OPENAI_API_KEY or Codex OAuth", instructionsOpenAi());
|
|
56842
56842
|
},
|
|
56843
|
-
codex: (env) => checks.code(env)
|
|
56843
|
+
codex: (env) => checks.code(env),
|
|
56844
|
+
pi: (env) => {
|
|
56845
|
+
const hasAnyKey = [
|
|
56846
|
+
"ANTHROPIC_API_KEY",
|
|
56847
|
+
"OPENAI_API_KEY",
|
|
56848
|
+
"GEMINI_API_KEY",
|
|
56849
|
+
"GOOGLE_API_KEY",
|
|
56850
|
+
"Z_AI_API_KEY",
|
|
56851
|
+
"ZAI_API_KEY",
|
|
56852
|
+
"MISTRAL_API_KEY",
|
|
56853
|
+
"XAI_API_KEY",
|
|
56854
|
+
"GROQ_API_KEY",
|
|
56855
|
+
"OPENROUTER_API_KEY",
|
|
56856
|
+
"PI_MODELS_JSON_B64"
|
|
56857
|
+
].some((k) => !!env[k]);
|
|
56858
|
+
return {
|
|
56859
|
+
available: hasAnyKey,
|
|
56860
|
+
reason: hasAnyKey ? "using provider credentials" : "missing pi provider credentials",
|
|
56861
|
+
instructions: hasAnyKey ? [] : ["Set ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, Z_AI_API_KEY, or ZAI_API_KEY."]
|
|
56862
|
+
};
|
|
56863
|
+
}
|
|
56844
56864
|
};
|
|
56845
56865
|
return checks;
|
|
56846
56866
|
}
|
|
@@ -56965,6 +56985,21 @@ var HARNESS_CAPABILITIES = {
|
|
|
56965
56985
|
mode: "effort",
|
|
56966
56986
|
notes: "Mapped directly to Code/Codex reasoning effort flag."
|
|
56967
56987
|
}
|
|
56988
|
+
},
|
|
56989
|
+
pi: {
|
|
56990
|
+
supports_model: true,
|
|
56991
|
+
model_notes: "Use provider/model format (e.g., anthropic/claude-sonnet-4).",
|
|
56992
|
+
model_examples: [
|
|
56993
|
+
"anthropic/claude-sonnet-4",
|
|
56994
|
+
"openai/gpt-4o",
|
|
56995
|
+
"google/gemini-2.5-pro"
|
|
56996
|
+
],
|
|
56997
|
+
reasoning: {
|
|
56998
|
+
supported: true,
|
|
56999
|
+
levels: ["low", "medium", "high", "x-high"],
|
|
57000
|
+
mode: "level",
|
|
57001
|
+
notes: "pi maps x-high to xhigh internally."
|
|
57002
|
+
}
|
|
56968
57003
|
}
|
|
56969
57004
|
};
|
|
56970
57005
|
|
|
@@ -56981,6 +57016,12 @@ var CODE_REASONING_MAP = {
|
|
|
56981
57016
|
high: "high",
|
|
56982
57017
|
"x-high": "xhigh"
|
|
56983
57018
|
};
|
|
57019
|
+
var PI_REASONING_MAP = {
|
|
57020
|
+
low: "low",
|
|
57021
|
+
medium: "medium",
|
|
57022
|
+
high: "high",
|
|
57023
|
+
"x-high": "xhigh"
|
|
57024
|
+
};
|
|
56984
57025
|
function mapReasoningEffort(harness, effort) {
|
|
56985
57026
|
if (!effort)
|
|
56986
57027
|
return void 0;
|
|
@@ -56995,6 +57036,9 @@ function mapReasoningEffort(harness, effort) {
|
|
|
56995
57036
|
if (harness === "gemini") {
|
|
56996
57037
|
return effort;
|
|
56997
57038
|
}
|
|
57039
|
+
if (harness === "pi") {
|
|
57040
|
+
return PI_REASONING_MAP[effort] ?? effort;
|
|
57041
|
+
}
|
|
56998
57042
|
return void 0;
|
|
56999
57043
|
}
|
|
57000
57044
|
|
|
@@ -57150,6 +57194,41 @@ var codexAdapter = {
|
|
|
57150
57194
|
}
|
|
57151
57195
|
};
|
|
57152
57196
|
|
|
57197
|
+
// ../shared/dist/harnesses/adapters/pi.js
|
|
57198
|
+
var piAdapter = {
|
|
57199
|
+
name: "pi",
|
|
57200
|
+
buildOptions: async (ctx) => {
|
|
57201
|
+
const env = {};
|
|
57202
|
+
const providerKeys = [
|
|
57203
|
+
"ANTHROPIC_API_KEY",
|
|
57204
|
+
"OPENAI_API_KEY",
|
|
57205
|
+
"Z_AI_API_KEY",
|
|
57206
|
+
"ZAI_API_KEY",
|
|
57207
|
+
"GEMINI_API_KEY",
|
|
57208
|
+
"GOOGLE_API_KEY",
|
|
57209
|
+
"MISTRAL_API_KEY",
|
|
57210
|
+
"XAI_API_KEY",
|
|
57211
|
+
"GROQ_API_KEY",
|
|
57212
|
+
"OPENROUTER_API_KEY"
|
|
57213
|
+
];
|
|
57214
|
+
for (const key of providerKeys) {
|
|
57215
|
+
if (ctx.env[key])
|
|
57216
|
+
env[key] = ctx.env[key];
|
|
57217
|
+
}
|
|
57218
|
+
if (ctx.env.PI_MODELS_JSON_B64) {
|
|
57219
|
+
env.PI_MODELS_JSON_B64 = ctx.env.PI_MODELS_JSON_B64;
|
|
57220
|
+
}
|
|
57221
|
+
return {
|
|
57222
|
+
harness: ctx.harness,
|
|
57223
|
+
permission: ctx.permission,
|
|
57224
|
+
variant: ctx.invocation.harness_options?.variant ?? ctx.invocation.variant,
|
|
57225
|
+
model: ctx.invocation.harness_options?.model,
|
|
57226
|
+
reasoning: mapReasoningEffort(ctx.harness, ctx.invocation.harness_options?.reasoning_effort),
|
|
57227
|
+
env
|
|
57228
|
+
};
|
|
57229
|
+
}
|
|
57230
|
+
};
|
|
57231
|
+
|
|
57153
57232
|
// ../shared/dist/harnesses/adapters/index.js
|
|
57154
57233
|
var adapters = [
|
|
57155
57234
|
claudeAdapter,
|
|
@@ -57157,7 +57236,8 @@ var adapters = [
|
|
|
57157
57236
|
zaiAdapter,
|
|
57158
57237
|
geminiAdapter,
|
|
57159
57238
|
codeAdapter,
|
|
57160
|
-
codexAdapter
|
|
57239
|
+
codexAdapter,
|
|
57240
|
+
piAdapter
|
|
57161
57241
|
];
|
|
57162
57242
|
var registry = /* @__PURE__ */ new Map();
|
|
57163
57243
|
for (const adapter of adapters) {
|
|
@@ -60664,6 +60744,7 @@ function mergeXEve(packFragments, projectXEve) {
|
|
|
60664
60744
|
// ../shared/dist/lib/resource-uris.js
|
|
60665
60745
|
var ORG_DOCS_PREFIX = "org_docs:/";
|
|
60666
60746
|
var JOB_ATTACHMENTS_PREFIX = "job_attachments:/";
|
|
60747
|
+
var INGEST_PREFIX = "ingest:/";
|
|
60667
60748
|
function normalizeOrgDocPath(path8) {
|
|
60668
60749
|
if (!path8)
|
|
60669
60750
|
return "/";
|
|
@@ -60699,6 +60780,19 @@ function parseResourceUri(uri) {
|
|
|
60699
60780
|
return null;
|
|
60700
60781
|
return { scheme: "job_attachments", jobId, name };
|
|
60701
60782
|
}
|
|
60783
|
+
if (uri.startsWith(INGEST_PREFIX)) {
|
|
60784
|
+
const raw = uri.slice(INGEST_PREFIX.length);
|
|
60785
|
+
if (!raw)
|
|
60786
|
+
return null;
|
|
60787
|
+
const parts = raw.split("/").filter(Boolean);
|
|
60788
|
+
if (parts.length < 2)
|
|
60789
|
+
return null;
|
|
60790
|
+
const [ingestId, ...fileNameParts] = parts;
|
|
60791
|
+
const fileName = decodeURIComponent(fileNameParts.join("/"));
|
|
60792
|
+
if (!ingestId || !fileName)
|
|
60793
|
+
return null;
|
|
60794
|
+
return { scheme: "ingest", ingestId, fileName };
|
|
60795
|
+
}
|
|
60702
60796
|
return null;
|
|
60703
60797
|
}
|
|
60704
60798
|
|
|
@@ -60856,6 +60950,9 @@ function normalizeModelName(provider, model) {
|
|
|
60856
60950
|
if (m.startsWith("managed/")) {
|
|
60857
60951
|
m = m.slice("managed/".length);
|
|
60858
60952
|
}
|
|
60953
|
+
if (m.includes("/") && !m.startsWith("managed/")) {
|
|
60954
|
+
m = m.split("/").slice(1).join("/");
|
|
60955
|
+
}
|
|
60859
60956
|
const providerDef = getProvider(provider);
|
|
60860
60957
|
if (providerDef) {
|
|
60861
60958
|
for (const pattern of providerDef.normalization.strip_patterns) {
|
|
@@ -73405,6 +73502,7 @@ function padRight6(str, width) {
|
|
|
73405
73502
|
var fs4 = __toESM(require("node:fs"));
|
|
73406
73503
|
var path6 = __toESM(require("node:path"));
|
|
73407
73504
|
var import_node_child_process7 = require("node:child_process");
|
|
73505
|
+
var yaml = __toESM(require("yaml"));
|
|
73408
73506
|
var UNIVERSAL_SKILLS_DIR = path6.join(".agents", "skills");
|
|
73409
73507
|
var PRIVATE_SKILLS_DIRNAME = "private-skills";
|
|
73410
73508
|
async function handleSkills(subcommand, positionals, flags) {
|
|
@@ -73433,6 +73531,12 @@ async function handleInstall(positionals, flags) {
|
|
|
73433
73531
|
console.log("Skills install complete");
|
|
73434
73532
|
return;
|
|
73435
73533
|
}
|
|
73534
|
+
const packsInstalled = installPackSkills(skillsBin, projectRoot);
|
|
73535
|
+
if (packsInstalled) {
|
|
73536
|
+
ensureSkillsSymlink(projectRoot);
|
|
73537
|
+
console.log("Skills install complete (from packs)");
|
|
73538
|
+
return;
|
|
73539
|
+
}
|
|
73436
73540
|
const manifest = parseSkillsManifest(manifestPath);
|
|
73437
73541
|
if (manifest.length === 0) {
|
|
73438
73542
|
console.log("No skills.txt found or empty; nothing to install");
|
|
@@ -73457,7 +73561,7 @@ function installSkill(skillsBin, skill, projectRoot) {
|
|
|
73457
73561
|
const localDir = resolveLocalDirIfExists(skill, projectRoot);
|
|
73458
73562
|
const excludePrivate = localDir !== null && !sourcePathExplicitlyTargetsPrivate(skill.source);
|
|
73459
73563
|
try {
|
|
73460
|
-
const agents = ["claude-code", "codex", "gemini-cli"];
|
|
73564
|
+
const agents = ["claude-code", "codex", "gemini-cli", "pi"];
|
|
73461
73565
|
if (localDir) {
|
|
73462
73566
|
const skillDirs = findSkillDirs(localDir, { fullDepth: true, excludePrivate });
|
|
73463
73567
|
if (skillDirs.length === 0) {
|
|
@@ -73492,6 +73596,77 @@ function installSkill(skillsBin, skill, projectRoot) {
|
|
|
73492
73596
|
console.error(` Failed to install ${skill.name}`);
|
|
73493
73597
|
}
|
|
73494
73598
|
}
|
|
73599
|
+
var DEFAULT_AGENTS = ["claude-code", "codex", "gemini-cli", "pi"];
|
|
73600
|
+
function installPackSkills(skillsBin, projectRoot) {
|
|
73601
|
+
const manifestPath = path6.join(projectRoot, ".eve", "manifest.yaml");
|
|
73602
|
+
if (!fs4.existsSync(manifestPath)) return false;
|
|
73603
|
+
let manifest;
|
|
73604
|
+
try {
|
|
73605
|
+
manifest = yaml.parse(fs4.readFileSync(manifestPath, "utf-8")) ?? {};
|
|
73606
|
+
} catch {
|
|
73607
|
+
return false;
|
|
73608
|
+
}
|
|
73609
|
+
const xEve = manifest["x-eve"] ?? manifest["x_eve"];
|
|
73610
|
+
const packs = xEve?.packs ?? [];
|
|
73611
|
+
if (packs.length === 0) return false;
|
|
73612
|
+
const installAgents = xEve?.install_agents ?? DEFAULT_AGENTS;
|
|
73613
|
+
const lockfilePath = path6.join(projectRoot, ".eve", "packs.lock.yaml");
|
|
73614
|
+
if (!fs4.existsSync(lockfilePath)) {
|
|
73615
|
+
console.error('Warning: packs defined in manifest but no .eve/packs.lock.yaml found. Run "eve agents sync" first.');
|
|
73616
|
+
return false;
|
|
73617
|
+
}
|
|
73618
|
+
let lockfile;
|
|
73619
|
+
try {
|
|
73620
|
+
lockfile = yaml.parse(fs4.readFileSync(lockfilePath, "utf-8"));
|
|
73621
|
+
} catch (err) {
|
|
73622
|
+
console.error("Warning: failed to parse .eve/packs.lock.yaml:", err);
|
|
73623
|
+
return false;
|
|
73624
|
+
}
|
|
73625
|
+
for (const pack of packs) {
|
|
73626
|
+
if (!pack.ref) continue;
|
|
73627
|
+
const locked = lockfile.packs.find((p) => p.source === pack.source);
|
|
73628
|
+
if (!locked) {
|
|
73629
|
+
throw new Error(`Pack "${pack.source}" in manifest but not in lockfile. Run "eve agents sync".`);
|
|
73630
|
+
}
|
|
73631
|
+
if (locked.ref !== pack.ref) {
|
|
73632
|
+
throw new Error(
|
|
73633
|
+
`Pack ref mismatch for "${pack.source}": manifest has ${pack.ref?.substring(0, 8)}, lock has ${locked.ref.substring(0, 8)}. Run "eve agents sync".`
|
|
73634
|
+
);
|
|
73635
|
+
}
|
|
73636
|
+
}
|
|
73637
|
+
console.log(`Installing skills from ${packs.length} pack(s) for ${installAgents.length} agent(s)...`);
|
|
73638
|
+
for (const pack of packs) {
|
|
73639
|
+
const agents = pack.install_agents ?? installAgents;
|
|
73640
|
+
console.log(` Pack: ${pack.source}`);
|
|
73641
|
+
const localDir = resolveLocalDirIfExists({ source: pack.source, type: "local", raw: pack.source, name: path6.basename(pack.source) }, projectRoot);
|
|
73642
|
+
const wantsExcludePrivate = localDir !== null && !sourcePathExplicitlyTargetsPrivate(pack.source);
|
|
73643
|
+
for (const agent of agents) {
|
|
73644
|
+
try {
|
|
73645
|
+
if (wantsExcludePrivate && localDir) {
|
|
73646
|
+
const skillDirs = findSkillDirs(localDir, { fullDepth: true, excludePrivate: true });
|
|
73647
|
+
for (const dir of skillDirs) {
|
|
73648
|
+
const rel = path6.relative(projectRoot, dir);
|
|
73649
|
+
const installSource = rel.startsWith(".") ? rel : `./${rel}`;
|
|
73650
|
+
(0, import_node_child_process7.execSync)(`${skillsBin} add ${JSON.stringify(installSource)} -a ${agent} -s '*' -y --full-depth`, {
|
|
73651
|
+
cwd: projectRoot,
|
|
73652
|
+
stdio: "inherit",
|
|
73653
|
+
timeout: 12e4
|
|
73654
|
+
});
|
|
73655
|
+
}
|
|
73656
|
+
} else {
|
|
73657
|
+
(0, import_node_child_process7.execSync)(`${skillsBin} add ${JSON.stringify(pack.source)} -a ${agent} -s '*' -y --full-depth`, {
|
|
73658
|
+
cwd: projectRoot,
|
|
73659
|
+
stdio: "inherit",
|
|
73660
|
+
timeout: 12e4
|
|
73661
|
+
});
|
|
73662
|
+
}
|
|
73663
|
+
} catch (err) {
|
|
73664
|
+
console.error(` Failed to install pack ${pack.source} for ${agent}:`, err);
|
|
73665
|
+
}
|
|
73666
|
+
}
|
|
73667
|
+
}
|
|
73668
|
+
return true;
|
|
73669
|
+
}
|
|
73495
73670
|
function persistToManifest(manifestPath, source) {
|
|
73496
73671
|
if (!fs4.existsSync(manifestPath)) {
|
|
73497
73672
|
fs4.writeFileSync(manifestPath, `${source}
|
|
@@ -75078,8 +75253,8 @@ async function handleRelease2(subcommand, positionals, flags, context2) {
|
|
|
75078
75253
|
const dir = typeof flags.dir === "string" ? flags.dir : process.cwd();
|
|
75079
75254
|
const manifestPath = (0, import_node_path12.join)(dir, ".eve", "manifest.yaml");
|
|
75080
75255
|
try {
|
|
75081
|
-
const
|
|
75082
|
-
const projectMatch =
|
|
75256
|
+
const yaml2 = (0, import_node_fs12.readFileSync)(manifestPath, "utf-8");
|
|
75257
|
+
const projectMatch = yaml2.match(/^project:\s*(\S+)/m);
|
|
75083
75258
|
if (projectMatch) {
|
|
75084
75259
|
projectId = projectMatch[1];
|
|
75085
75260
|
}
|
|
@@ -77325,10 +77500,10 @@ function formatBindingScope(scope) {
|
|
|
77325
77500
|
}
|
|
77326
77501
|
return JSON.stringify(normalized);
|
|
77327
77502
|
}
|
|
77328
|
-
function semanticValidate(
|
|
77503
|
+
function semanticValidate(yaml2) {
|
|
77329
77504
|
const errors = [];
|
|
77330
|
-
const roles =
|
|
77331
|
-
const groups =
|
|
77505
|
+
const roles = yaml2.access.roles ?? {};
|
|
77506
|
+
const groups = yaml2.access.groups ?? {};
|
|
77332
77507
|
const roleNames = new Set(Object.keys(roles));
|
|
77333
77508
|
const groupSlugs = new Set(Object.keys(groups));
|
|
77334
77509
|
for (const [name, role] of Object.entries(roles)) {
|
|
@@ -77358,7 +77533,7 @@ function semanticValidate(yaml) {
|
|
|
77358
77533
|
}
|
|
77359
77534
|
}
|
|
77360
77535
|
const seenBindingKeys = /* @__PURE__ */ new Set();
|
|
77361
|
-
const bindings =
|
|
77536
|
+
const bindings = yaml2.access.bindings ?? [];
|
|
77362
77537
|
for (let i = 0; i < bindings.length; i++) {
|
|
77363
77538
|
const binding = bindings[i];
|
|
77364
77539
|
for (const roleName of binding.roles) {
|
|
@@ -77441,17 +77616,17 @@ function semanticValidate(yaml) {
|
|
|
77441
77616
|
}
|
|
77442
77617
|
async function handleValidate(flags, json) {
|
|
77443
77618
|
const filePath = resolveFilePath(flags);
|
|
77444
|
-
const
|
|
77445
|
-
const errors = semanticValidate(
|
|
77619
|
+
const yaml2 = loadAccessYaml(filePath);
|
|
77620
|
+
const errors = semanticValidate(yaml2);
|
|
77446
77621
|
if (json) {
|
|
77447
77622
|
outputJson({
|
|
77448
77623
|
valid: errors.length === 0,
|
|
77449
77624
|
file: filePath,
|
|
77450
77625
|
errors,
|
|
77451
|
-
groups: Object.keys(
|
|
77452
|
-
roles: Object.keys(
|
|
77453
|
-
members: Object.values(
|
|
77454
|
-
bindings: (
|
|
77626
|
+
groups: Object.keys(yaml2.access.groups ?? {}).length,
|
|
77627
|
+
roles: Object.keys(yaml2.access.roles ?? {}).length,
|
|
77628
|
+
members: Object.values(yaml2.access.groups ?? {}).reduce((acc, group) => acc + (group.members?.length ?? 0), 0),
|
|
77629
|
+
bindings: (yaml2.access.bindings ?? []).length
|
|
77455
77630
|
}, json);
|
|
77456
77631
|
return;
|
|
77457
77632
|
}
|
|
@@ -77463,10 +77638,10 @@ async function handleValidate(flags, json) {
|
|
|
77463
77638
|
}
|
|
77464
77639
|
process.exit(1);
|
|
77465
77640
|
}
|
|
77466
|
-
const groupCount = Object.keys(
|
|
77467
|
-
const roleCount = Object.keys(
|
|
77468
|
-
const memberCount = Object.values(
|
|
77469
|
-
const bindingCount = (
|
|
77641
|
+
const groupCount = Object.keys(yaml2.access.groups ?? {}).length;
|
|
77642
|
+
const roleCount = Object.keys(yaml2.access.roles ?? {}).length;
|
|
77643
|
+
const memberCount = Object.values(yaml2.access.groups ?? {}).reduce((acc, group) => acc + (group.members?.length ?? 0), 0);
|
|
77644
|
+
const bindingCount = (yaml2.access.bindings ?? []).length;
|
|
77470
77645
|
console.log(`Valid (${groupCount} groups, ${memberCount} members, ${roleCount} roles, ${bindingCount} bindings)`);
|
|
77471
77646
|
}
|
|
77472
77647
|
function resolveGroupPrincipalId(groupRef, groupsById, groupsBySlug) {
|
|
@@ -77475,7 +77650,7 @@ function resolveGroupPrincipalId(groupRef, groupsById, groupsBySlug) {
|
|
|
77475
77650
|
}
|
|
77476
77651
|
return groupsBySlug.get(groupRef)?.id ?? null;
|
|
77477
77652
|
}
|
|
77478
|
-
async function computePlan(
|
|
77653
|
+
async function computePlan(yaml2, orgId, context2) {
|
|
77479
77654
|
const [apiGroupsResponse, apiRolesResponse, apiBindingsResponse] = await Promise.all([
|
|
77480
77655
|
requestJson(context2, `/orgs/${orgId}/access/groups`),
|
|
77481
77656
|
requestJson(context2, `/orgs/${orgId}/access/roles`),
|
|
@@ -77510,7 +77685,7 @@ async function computePlan(yaml, orgId, context2) {
|
|
|
77510
77685
|
unchanged_bindings: 0
|
|
77511
77686
|
};
|
|
77512
77687
|
const declaredGroupSlugs = /* @__PURE__ */ new Set();
|
|
77513
|
-
for (const [slug, declaredGroup] of Object.entries(
|
|
77688
|
+
for (const [slug, declaredGroup] of Object.entries(yaml2.access.groups ?? {})) {
|
|
77514
77689
|
declaredGroupSlugs.add(slug);
|
|
77515
77690
|
const existing = groupsBySlug.get(slug);
|
|
77516
77691
|
const desiredMembers = declaredGroup.members ?? [];
|
|
@@ -77582,7 +77757,7 @@ async function computePlan(yaml, orgId, context2) {
|
|
|
77582
77757
|
}
|
|
77583
77758
|
}
|
|
77584
77759
|
const declaredRoleNames = /* @__PURE__ */ new Set();
|
|
77585
|
-
for (const [name, declaredRole] of Object.entries(
|
|
77760
|
+
for (const [name, declaredRole] of Object.entries(yaml2.access.roles ?? {})) {
|
|
77586
77761
|
declaredRoleNames.add(name);
|
|
77587
77762
|
const existing = rolesByName.get(name);
|
|
77588
77763
|
if (!existing) {
|
|
@@ -77635,7 +77810,7 @@ async function computePlan(yaml, orgId, context2) {
|
|
|
77635
77810
|
const groupsMarkedForPrune = new Set(
|
|
77636
77811
|
plan.groups.filter((group) => group.action === "prune").map((group) => group.id)
|
|
77637
77812
|
);
|
|
77638
|
-
for (const declaredBinding of
|
|
77813
|
+
for (const declaredBinding of yaml2.access.bindings ?? []) {
|
|
77639
77814
|
const normalizedDeclaredScope = normalizeBindingScope(declaredBinding.scope);
|
|
77640
77815
|
const principalType = declaredBinding.subject.type;
|
|
77641
77816
|
let principalIdHint = declaredBinding.subject.id;
|
|
@@ -77925,14 +78100,14 @@ async function handlePlan(flags, context2, json) {
|
|
|
77925
78100
|
throw new Error("--org is required (or set a default org in your profile)");
|
|
77926
78101
|
}
|
|
77927
78102
|
const filePath = resolveFilePath(flags);
|
|
77928
|
-
const
|
|
77929
|
-
const errors = semanticValidate(
|
|
78103
|
+
const yaml2 = loadAccessYaml(filePath);
|
|
78104
|
+
const errors = semanticValidate(yaml2);
|
|
77930
78105
|
if (errors.length > 0) {
|
|
77931
78106
|
const lines = errors.map((e) => ` ${e.path}: ${e.message}`);
|
|
77932
78107
|
throw new Error(`Validation failed:
|
|
77933
78108
|
${lines.join("\n")}`);
|
|
77934
78109
|
}
|
|
77935
|
-
const plan = await computePlan(
|
|
78110
|
+
const plan = await computePlan(yaml2, orgId, context2);
|
|
77936
78111
|
if (json) {
|
|
77937
78112
|
outputJson(planToJson(plan, orgId), json);
|
|
77938
78113
|
return;
|
|
@@ -77965,8 +78140,8 @@ async function handleSync(flags, context2, json) {
|
|
|
77965
78140
|
throw new Error("--org is required (or set a default org in your profile)");
|
|
77966
78141
|
}
|
|
77967
78142
|
const filePath = resolveFilePath(flags);
|
|
77968
|
-
const
|
|
77969
|
-
const errors = semanticValidate(
|
|
78143
|
+
const yaml2 = loadAccessYaml(filePath);
|
|
78144
|
+
const errors = semanticValidate(yaml2);
|
|
77970
78145
|
if (errors.length > 0) {
|
|
77971
78146
|
const lines = errors.map((e) => ` ${e.path}: ${e.message}`);
|
|
77972
78147
|
throw new Error(`Validation failed:
|
|
@@ -77974,7 +78149,7 @@ ${lines.join("\n")}`);
|
|
|
77974
78149
|
}
|
|
77975
78150
|
const prune = getBooleanFlag(flags, ["prune"]) ?? false;
|
|
77976
78151
|
const yes = getBooleanFlag(flags, ["yes", "y"]) ?? false;
|
|
77977
|
-
const plan = await computePlan(
|
|
78152
|
+
const plan = await computePlan(yaml2, orgId, context2);
|
|
77978
78153
|
if (!hasChanges(plan, prune)) {
|
|
77979
78154
|
if (json) {
|
|
77980
78155
|
outputJson({ applied: false, reason: "no_changes", org_id: orgId }, json);
|
|
@@ -78031,7 +78206,7 @@ ${lines.join("\n")}`);
|
|
|
78031
78206
|
}
|
|
78032
78207
|
for (const ra of plan.roles) {
|
|
78033
78208
|
if (ra.action === "update") {
|
|
78034
|
-
const declaredRole = (
|
|
78209
|
+
const declaredRole = (yaml2.access.roles ?? {})[ra.name];
|
|
78035
78210
|
if (!declaredRole) continue;
|
|
78036
78211
|
const body = {};
|
|
78037
78212
|
body.permissions = declaredRole.permissions;
|
|
@@ -79773,9 +79948,195 @@ async function handleOllama(subcommand, positionals, flags, context2) {
|
|
|
79773
79948
|
}
|
|
79774
79949
|
}
|
|
79775
79950
|
|
|
79951
|
+
// src/commands/ingest.ts
|
|
79952
|
+
var import_node_fs19 = require("node:fs");
|
|
79953
|
+
var import_node_path19 = require("node:path");
|
|
79954
|
+
async function handleIngest(subcommand, positionals, flags, context2) {
|
|
79955
|
+
const json = Boolean(flags.json);
|
|
79956
|
+
const projectId = getStringFlag(flags, ["project", "project-id", "project_id"]) ?? context2.projectId;
|
|
79957
|
+
if (!projectId) {
|
|
79958
|
+
throw new Error("Missing project id. Provide --project or set a profile default.");
|
|
79959
|
+
}
|
|
79960
|
+
const isFileSubcommand = subcommand && !["create", "list", "show"].includes(subcommand);
|
|
79961
|
+
const effectiveSubcommand = isFileSubcommand ? "create" : subcommand;
|
|
79962
|
+
const effectivePositionals = isFileSubcommand ? [subcommand, ...positionals] : positionals;
|
|
79963
|
+
switch (effectiveSubcommand) {
|
|
79964
|
+
case "create":
|
|
79965
|
+
case void 0: {
|
|
79966
|
+
const filePath = effectivePositionals[0];
|
|
79967
|
+
if (!filePath) {
|
|
79968
|
+
throw new Error(
|
|
79969
|
+
"Usage: eve ingest <file> [--title <title>] [--description <desc>] [--instructions <text>] [--tags <a,b>]\n eve ingest create <file> [same flags]\n eve ingest list [--status <status>]\n eve ingest show <ingest_id>"
|
|
79970
|
+
);
|
|
79971
|
+
}
|
|
79972
|
+
const resolvedPath = (0, import_node_path19.resolve)(filePath);
|
|
79973
|
+
const stat = (0, import_node_fs19.statSync)(resolvedPath);
|
|
79974
|
+
const fileName = (0, import_node_path19.basename)(resolvedPath);
|
|
79975
|
+
const sizeBytes = stat.size;
|
|
79976
|
+
const mimeType = getStringFlag(flags, ["mime-type", "mime_type"]) ?? inferMimeType(fileName);
|
|
79977
|
+
const title = getStringFlag(flags, ["title"]);
|
|
79978
|
+
const description = getStringFlag(flags, ["description", "desc"]);
|
|
79979
|
+
const instructions = getStringFlag(flags, ["instructions"]);
|
|
79980
|
+
const tagsRaw = getStringFlag(flags, ["tags"]);
|
|
79981
|
+
const tags = tagsRaw ? tagsRaw.split(",").map((t) => t.trim()).filter(Boolean) : void 0;
|
|
79982
|
+
const sourceChannel = getStringFlag(flags, ["source-channel", "source_channel"]) ?? "cli";
|
|
79983
|
+
const createResp = await requestJson(
|
|
79984
|
+
context2,
|
|
79985
|
+
`/projects/${projectId}/ingest`,
|
|
79986
|
+
{
|
|
79987
|
+
method: "POST",
|
|
79988
|
+
body: {
|
|
79989
|
+
file_name: fileName,
|
|
79990
|
+
mime_type: mimeType,
|
|
79991
|
+
size_bytes: sizeBytes,
|
|
79992
|
+
...title ? { title } : {},
|
|
79993
|
+
...description ? { description } : {},
|
|
79994
|
+
...instructions ? { instructions } : {},
|
|
79995
|
+
...tags ? { tags } : {},
|
|
79996
|
+
source_channel: sourceChannel
|
|
79997
|
+
}
|
|
79998
|
+
}
|
|
79999
|
+
);
|
|
80000
|
+
const fileContent = (0, import_node_fs19.readFileSync)(resolvedPath);
|
|
80001
|
+
const uploadResp = await fetch(createResp.upload_url, {
|
|
80002
|
+
method: "PUT",
|
|
80003
|
+
headers: { "Content-Type": mimeType },
|
|
80004
|
+
body: fileContent
|
|
80005
|
+
});
|
|
80006
|
+
if (!uploadResp.ok) {
|
|
80007
|
+
throw new Error(`Upload failed: HTTP ${uploadResp.status}`);
|
|
80008
|
+
}
|
|
80009
|
+
const confirmResp = await requestJson(
|
|
80010
|
+
context2,
|
|
80011
|
+
`/projects/${projectId}/ingest/${createResp.ingest_id}/confirm`,
|
|
80012
|
+
{ method: "POST" }
|
|
80013
|
+
);
|
|
80014
|
+
if (json) {
|
|
80015
|
+
outputJson({
|
|
80016
|
+
ingest_id: createResp.ingest_id,
|
|
80017
|
+
status: confirmResp.status,
|
|
80018
|
+
event_id: confirmResp.event_id,
|
|
80019
|
+
job_id: confirmResp.job_id,
|
|
80020
|
+
file_name: fileName,
|
|
80021
|
+
size_bytes: sizeBytes,
|
|
80022
|
+
storage_key: createResp.storage_key
|
|
80023
|
+
}, json);
|
|
80024
|
+
} else {
|
|
80025
|
+
console.log(`Ingested: ${fileName} (${sizeBytes} bytes)`);
|
|
80026
|
+
console.log(` ingest_id: ${createResp.ingest_id}`);
|
|
80027
|
+
console.log(` status: ${confirmResp.status}`);
|
|
80028
|
+
if (confirmResp.event_id) console.log(` event_id: ${confirmResp.event_id}`);
|
|
80029
|
+
if (confirmResp.job_id) console.log(` job_id: ${confirmResp.job_id}`);
|
|
80030
|
+
}
|
|
80031
|
+
return;
|
|
80032
|
+
}
|
|
80033
|
+
case "list": {
|
|
80034
|
+
const status = getStringFlag(flags, ["status"]);
|
|
80035
|
+
const limit = getStringFlag(flags, ["limit"]);
|
|
80036
|
+
const offset = getStringFlag(flags, ["offset"]);
|
|
80037
|
+
const params = new URLSearchParams();
|
|
80038
|
+
if (status) params.set("status", status);
|
|
80039
|
+
if (limit) params.set("limit", limit);
|
|
80040
|
+
if (offset) params.set("offset", offset);
|
|
80041
|
+
const suffix = params.toString() ? `?${params.toString()}` : "";
|
|
80042
|
+
const result = await requestJson(
|
|
80043
|
+
context2,
|
|
80044
|
+
`/projects/${projectId}/ingest${suffix}`
|
|
80045
|
+
);
|
|
80046
|
+
if (json) {
|
|
80047
|
+
outputJson(result, json);
|
|
80048
|
+
} else {
|
|
80049
|
+
const items = result.items;
|
|
80050
|
+
if (items.length === 0) {
|
|
80051
|
+
console.log("No ingest records found.");
|
|
80052
|
+
return;
|
|
80053
|
+
}
|
|
80054
|
+
console.log(`Ingest records (${items.length} of ${result.total}):
|
|
80055
|
+
`);
|
|
80056
|
+
for (const item of items) {
|
|
80057
|
+
const statusStr = item.status === "done" ? "done" : item.status === "failed" ? "FAILED" : item.status === "processing" ? "processing..." : String(item.status);
|
|
80058
|
+
console.log(` ${item.id} ${item.file_name} [${statusStr}]`);
|
|
80059
|
+
}
|
|
80060
|
+
}
|
|
80061
|
+
return;
|
|
80062
|
+
}
|
|
80063
|
+
case "show": {
|
|
80064
|
+
const ingestId = positionals[0];
|
|
80065
|
+
if (!ingestId) {
|
|
80066
|
+
throw new Error("Usage: eve ingest show <ingest_id> [--json]");
|
|
80067
|
+
}
|
|
80068
|
+
const result = await requestJson(
|
|
80069
|
+
context2,
|
|
80070
|
+
`/projects/${projectId}/ingest/${ingestId}`
|
|
80071
|
+
);
|
|
80072
|
+
if (json) {
|
|
80073
|
+
outputJson(result, json);
|
|
80074
|
+
} else {
|
|
80075
|
+
console.log(`Ingest: ${result.id}`);
|
|
80076
|
+
console.log(` file: ${result.file_name} (${result.size_bytes} bytes)`);
|
|
80077
|
+
console.log(` status: ${result.status}`);
|
|
80078
|
+
console.log(` mime: ${result.mime_type}`);
|
|
80079
|
+
if (result.title) console.log(` title: ${result.title}`);
|
|
80080
|
+
if (result.description) console.log(` description: ${result.description}`);
|
|
80081
|
+
if (result.instructions) console.log(` instructions: ${result.instructions}`);
|
|
80082
|
+
if (result.event_id) console.log(` event_id: ${result.event_id}`);
|
|
80083
|
+
if (result.job_id) console.log(` job_id: ${result.job_id}`);
|
|
80084
|
+
if (result.error_message) console.log(` error: ${result.error_message}`);
|
|
80085
|
+
console.log(` created: ${result.created_at}`);
|
|
80086
|
+
if (result.completed_at) console.log(` completed: ${result.completed_at}`);
|
|
80087
|
+
}
|
|
80088
|
+
return;
|
|
80089
|
+
}
|
|
80090
|
+
default:
|
|
80091
|
+
throw new Error(
|
|
80092
|
+
"Usage: eve ingest <file> [--title <title>] [--description <desc>] [--instructions <text>] [--tags <a,b>]\n eve ingest list [--status <status>]\n eve ingest show <ingest_id>"
|
|
80093
|
+
);
|
|
80094
|
+
}
|
|
80095
|
+
}
|
|
80096
|
+
function inferMimeType(fileName) {
|
|
80097
|
+
const ext = fileName.split(".").pop()?.toLowerCase();
|
|
80098
|
+
switch (ext) {
|
|
80099
|
+
case "md":
|
|
80100
|
+
return "text/markdown";
|
|
80101
|
+
case "txt":
|
|
80102
|
+
return "text/plain";
|
|
80103
|
+
case "pdf":
|
|
80104
|
+
return "application/pdf";
|
|
80105
|
+
case "json":
|
|
80106
|
+
return "application/json";
|
|
80107
|
+
case "yaml":
|
|
80108
|
+
case "yml":
|
|
80109
|
+
return "application/yaml";
|
|
80110
|
+
case "html":
|
|
80111
|
+
case "htm":
|
|
80112
|
+
return "text/html";
|
|
80113
|
+
case "csv":
|
|
80114
|
+
return "text/csv";
|
|
80115
|
+
case "xml":
|
|
80116
|
+
return "application/xml";
|
|
80117
|
+
case "doc":
|
|
80118
|
+
return "application/msword";
|
|
80119
|
+
case "docx":
|
|
80120
|
+
return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
80121
|
+
case "png":
|
|
80122
|
+
return "image/png";
|
|
80123
|
+
case "jpg":
|
|
80124
|
+
case "jpeg":
|
|
80125
|
+
return "image/jpeg";
|
|
80126
|
+
case "mp3":
|
|
80127
|
+
return "audio/mpeg";
|
|
80128
|
+
case "wav":
|
|
80129
|
+
return "audio/wav";
|
|
80130
|
+
case "mp4":
|
|
80131
|
+
return "video/mp4";
|
|
80132
|
+
default:
|
|
80133
|
+
return "application/octet-stream";
|
|
80134
|
+
}
|
|
80135
|
+
}
|
|
80136
|
+
|
|
79776
80137
|
// src/commands/fs.ts
|
|
79777
80138
|
var import_promises = require("node:fs/promises");
|
|
79778
|
-
var
|
|
80139
|
+
var import_node_fs20 = require("node:fs");
|
|
79779
80140
|
var import_node_os5 = require("node:os");
|
|
79780
80141
|
function getOrgOrThrow(flags, context2) {
|
|
79781
80142
|
const orgId = getStringFlag(flags, ["org", "org-id", "org_id"]) ?? context2.orgId;
|
|
@@ -80019,7 +80380,7 @@ async function handleSync2(action, positionals, flags, context2) {
|
|
|
80019
80380
|
for (const link of links.data) {
|
|
80020
80381
|
let writable = false;
|
|
80021
80382
|
try {
|
|
80022
|
-
await (0, import_promises.access)(link.local_path,
|
|
80383
|
+
await (0, import_promises.access)(link.local_path, import_node_fs20.constants.R_OK | import_node_fs20.constants.W_OK);
|
|
80023
80384
|
writable = true;
|
|
80024
80385
|
} catch {
|
|
80025
80386
|
writable = false;
|
|
@@ -80109,22 +80470,22 @@ async function handleFs(subcommand, positionals, flags, context2) {
|
|
|
80109
80470
|
}
|
|
80110
80471
|
|
|
80111
80472
|
// src/commands/local.ts
|
|
80112
|
-
var
|
|
80473
|
+
var import_node_fs21 = require("node:fs");
|
|
80113
80474
|
var import_node_crypto = require("node:crypto");
|
|
80114
80475
|
var import_node_child_process10 = require("node:child_process");
|
|
80115
80476
|
var import_node_os6 = require("node:os");
|
|
80116
|
-
var
|
|
80477
|
+
var import_node_path20 = require("node:path");
|
|
80117
80478
|
var import_promises2 = require("node:readline/promises");
|
|
80118
80479
|
var DEFAULT_CLUSTER_NAME = "eve-local";
|
|
80119
80480
|
var DEFAULT_KUBE_CONTEXT = "k3d-eve-local";
|
|
80120
|
-
var MANAGED_BIN_DIR = (0,
|
|
80481
|
+
var MANAGED_BIN_DIR = (0, import_node_path20.join)((0, import_node_os6.homedir)(), ".eve", "bin");
|
|
80121
80482
|
var LOCAL_API_URL = "http://api.eve.lvh.me";
|
|
80122
80483
|
var WATCH_INTERVAL_MS = 5e3;
|
|
80123
80484
|
var K3D_VERSION = "v5.7.5";
|
|
80124
80485
|
var KUBECTL_STABLE_URL = "https://dl.k8s.io/release/stable.txt";
|
|
80125
|
-
var LOCAL_STACK_ROOT = (0,
|
|
80126
|
-
var LOCAL_STACK_OVERLAY = (0,
|
|
80127
|
-
var LOCAL_STACK_BASE = (0,
|
|
80486
|
+
var LOCAL_STACK_ROOT = (0, import_node_path20.resolve)(__dirname, "..", "assets", "local-k8s");
|
|
80487
|
+
var LOCAL_STACK_OVERLAY = (0, import_node_path20.join)(LOCAL_STACK_ROOT, "overlays", "local");
|
|
80488
|
+
var LOCAL_STACK_BASE = (0, import_node_path20.join)(LOCAL_STACK_ROOT, "base");
|
|
80128
80489
|
var DEFAULT_PLATFORM_NAMESPACE = "eve-horizon";
|
|
80129
80490
|
var CONFIGURED_REGISTRY = process.env.ECR_REGISTRY?.trim();
|
|
80130
80491
|
var CONFIGURED_NAMESPACE = process.env.ECR_NAMESPACE?.trim() || DEFAULT_PLATFORM_NAMESPACE;
|
|
@@ -80527,7 +80888,7 @@ async function ensureManagedTool(tool, runtimeOptions) {
|
|
|
80527
80888
|
if (findExecutable(tool)) {
|
|
80528
80889
|
return;
|
|
80529
80890
|
}
|
|
80530
|
-
(0,
|
|
80891
|
+
(0, import_node_fs21.mkdirSync)(MANAGED_BIN_DIR, { recursive: true });
|
|
80531
80892
|
if (tool === "k3d") {
|
|
80532
80893
|
printProgress(runtimeOptions, `Installing k3d ${K3D_VERSION} into ${MANAGED_BIN_DIR}...`);
|
|
80533
80894
|
await installK3dBinary();
|
|
@@ -80543,7 +80904,7 @@ async function installK3dBinary() {
|
|
|
80543
80904
|
const platform2 = normalizePlatform(process.platform);
|
|
80544
80905
|
const arch = normalizeArch(process.arch);
|
|
80545
80906
|
const url = `https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-${platform2}-${arch}`;
|
|
80546
|
-
await downloadBinary(url, (0,
|
|
80907
|
+
await downloadBinary(url, (0, import_node_path20.join)(MANAGED_BIN_DIR, "k3d"));
|
|
80547
80908
|
}
|
|
80548
80909
|
async function installKubectlBinary() {
|
|
80549
80910
|
const platform2 = normalizePlatform(process.platform);
|
|
@@ -80563,7 +80924,7 @@ async function installKubectlBinary() {
|
|
|
80563
80924
|
if (expectedChecksum !== actualChecksum) {
|
|
80564
80925
|
throw new Error(`kubectl checksum verification failed (expected ${expectedChecksum}, got ${actualChecksum}).`);
|
|
80565
80926
|
}
|
|
80566
|
-
writeExecutable((0,
|
|
80927
|
+
writeExecutable((0, import_node_path20.join)(MANAGED_BIN_DIR, "kubectl"), binary);
|
|
80567
80928
|
}
|
|
80568
80929
|
function normalizePlatform(platform2) {
|
|
80569
80930
|
if (platform2 === "darwin" || platform2 === "linux") {
|
|
@@ -80618,9 +80979,9 @@ async function fetchText(url, headers) {
|
|
|
80618
80979
|
}
|
|
80619
80980
|
function writeExecutable(destination, bytes) {
|
|
80620
80981
|
const tempPath = `${destination}.tmp-${Date.now()}-${process.pid}`;
|
|
80621
|
-
(0,
|
|
80622
|
-
(0,
|
|
80623
|
-
(0,
|
|
80982
|
+
(0, import_node_fs21.writeFileSync)(tempPath, bytes);
|
|
80983
|
+
(0, import_node_fs21.chmodSync)(tempPath, 493);
|
|
80984
|
+
(0, import_node_fs21.renameSync)(tempPath, destination);
|
|
80624
80985
|
}
|
|
80625
80986
|
async function ensureClusterReady(runtimeOptions) {
|
|
80626
80987
|
const k3d = requireToolPath("k3d", "Run 'eve local up' again to auto-install managed tools.");
|
|
@@ -80809,13 +81170,13 @@ ${pull.stdout}`.toLowerCase();
|
|
|
80809
81170
|
}
|
|
80810
81171
|
}
|
|
80811
81172
|
function importImageViaTar(docker, k3d, imageTag, component, stdio) {
|
|
80812
|
-
const tarPath = (0,
|
|
81173
|
+
const tarPath = (0, import_node_path20.join)((0, import_node_os6.tmpdir)(), `eve-local-${component}-${Date.now()}-${process.pid}.tar`);
|
|
80813
81174
|
try {
|
|
80814
81175
|
run(docker, ["image", "save", "--platform", "linux/amd64", imageTag, "-o", tarPath], { stdio });
|
|
80815
81176
|
run(k3d, ["image", "import", "--mode", "direct", tarPath, "-c", DEFAULT_CLUSTER_NAME], { stdio });
|
|
80816
81177
|
} finally {
|
|
80817
|
-
if ((0,
|
|
80818
|
-
(0,
|
|
81178
|
+
if ((0, import_node_fs21.existsSync)(tarPath)) {
|
|
81179
|
+
(0, import_node_fs21.unlinkSync)(tarPath);
|
|
80819
81180
|
}
|
|
80820
81181
|
}
|
|
80821
81182
|
}
|
|
@@ -80918,7 +81279,7 @@ function writeManagerMarker(kubectl, runtimeOptions) {
|
|
|
80918
81279
|
}
|
|
80919
81280
|
function runDbMigration(timeoutSeconds, runtimeOptions) {
|
|
80920
81281
|
const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
|
|
80921
|
-
const migrateJobPath = (0,
|
|
81282
|
+
const migrateJobPath = (0, import_node_path20.join)(LOCAL_STACK_BASE, "db-migrate-job.yaml");
|
|
80922
81283
|
printProgress(runtimeOptions, "Running database migrations...");
|
|
80923
81284
|
run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "delete", "job/eve-db-migrate", "--ignore-not-found"], {
|
|
80924
81285
|
stdio: "pipe",
|
|
@@ -81019,7 +81380,7 @@ function readSecretValue(kubectl, key) {
|
|
|
81019
81380
|
}
|
|
81020
81381
|
function runAuthBootstrap(timeoutSeconds, runtimeOptions) {
|
|
81021
81382
|
const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
|
|
81022
|
-
const bootstrapJobPath = (0,
|
|
81383
|
+
const bootstrapJobPath = (0, import_node_path20.join)(LOCAL_STACK_BASE, "auth-bootstrap-job.yaml");
|
|
81023
81384
|
printProgress(runtimeOptions, "Bootstrapping auth database role...");
|
|
81024
81385
|
run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "delete", "job/auth-db-bootstrap", "--ignore-not-found"], {
|
|
81025
81386
|
stdio: "pipe",
|
|
@@ -81119,12 +81480,12 @@ function assertLocalAssetsPresent() {
|
|
|
81119
81480
|
const files = [
|
|
81120
81481
|
LOCAL_STACK_OVERLAY,
|
|
81121
81482
|
LOCAL_STACK_BASE,
|
|
81122
|
-
(0,
|
|
81123
|
-
(0,
|
|
81124
|
-
(0,
|
|
81483
|
+
(0, import_node_path20.join)(LOCAL_STACK_OVERLAY, "kustomization.yaml"),
|
|
81484
|
+
(0, import_node_path20.join)(LOCAL_STACK_BASE, "db-migrate-job.yaml"),
|
|
81485
|
+
(0, import_node_path20.join)(LOCAL_STACK_BASE, "auth-bootstrap-job.yaml")
|
|
81125
81486
|
];
|
|
81126
81487
|
for (const file of files) {
|
|
81127
|
-
if (!(0,
|
|
81488
|
+
if (!(0, import_node_fs21.existsSync)(file)) {
|
|
81128
81489
|
throw new Error(
|
|
81129
81490
|
`Missing local stack assets at ${file}. Reinstall the CLI or ensure package assets were published.`
|
|
81130
81491
|
);
|
|
@@ -81212,7 +81573,7 @@ function parseTimeoutSeconds(flags, defaultValue) {
|
|
|
81212
81573
|
}
|
|
81213
81574
|
function run(command, args, options = {}) {
|
|
81214
81575
|
const env = { ...process.env };
|
|
81215
|
-
if ((0,
|
|
81576
|
+
if ((0, import_node_fs21.existsSync)(MANAGED_BIN_DIR)) {
|
|
81216
81577
|
env.PATH = `${MANAGED_BIN_DIR}:${env.PATH ?? ""}`;
|
|
81217
81578
|
}
|
|
81218
81579
|
const result = (0, import_node_child_process10.spawnSync)(command, args, {
|
|
@@ -81232,8 +81593,8 @@ function run(command, args, options = {}) {
|
|
|
81232
81593
|
return { status, stdout, stderr };
|
|
81233
81594
|
}
|
|
81234
81595
|
function findExecutable(name) {
|
|
81235
|
-
const managed = (0,
|
|
81236
|
-
if ((0,
|
|
81596
|
+
const managed = (0, import_node_path20.join)(MANAGED_BIN_DIR, name);
|
|
81597
|
+
if ((0, import_node_fs21.existsSync)(managed)) {
|
|
81237
81598
|
return managed;
|
|
81238
81599
|
}
|
|
81239
81600
|
const found = (0, import_node_child_process10.spawnSync)("which", [name], {
|
|
@@ -81722,6 +82083,9 @@ async function main2() {
|
|
|
81722
82083
|
case "ollama":
|
|
81723
82084
|
await handleOllama(subcommand, rest, flags, context2);
|
|
81724
82085
|
return;
|
|
82086
|
+
case "ingest":
|
|
82087
|
+
await handleIngest(subcommand, rest, flags, context2);
|
|
82088
|
+
return;
|
|
81725
82089
|
case "fs":
|
|
81726
82090
|
await handleFs(subcommand, rest, flags, context2);
|
|
81727
82091
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eve-horizon/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.48",
|
|
4
4
|
"description": "Eve Horizon CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"assets",
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node22 --outfile=dist/index.js --format=cjs --external:yaml"
|
|
23
|
-
},
|
|
24
21
|
"publishConfig": {
|
|
25
22
|
"access": "public"
|
|
26
23
|
},
|
|
@@ -31,11 +28,14 @@
|
|
|
31
28
|
"yaml": "^2.5.1"
|
|
32
29
|
},
|
|
33
30
|
"devDependencies": {
|
|
34
|
-
"@eve/migrate": "workspace:*",
|
|
35
|
-
"@eve/shared": "workspace:*",
|
|
36
31
|
"@types/node": "^22.0.0",
|
|
37
32
|
"esbuild": "^0.27.3",
|
|
38
33
|
"postgres": "^3.4.0",
|
|
39
|
-
"typescript": "^5.7.0"
|
|
34
|
+
"typescript": "^5.7.0",
|
|
35
|
+
"@eve/shared": "0.0.1",
|
|
36
|
+
"@eve/migrate": "0.0.1"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node22 --outfile=dist/index.js --format=cjs --external:yaml"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|