@defai.digital/automatosx 11.2.5 → 11.2.7
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 +1 -1
- package/dist/index.js +546 -465
- package/dist/mcp/index.js +243 -173
- package/examples/providers/README.md +58 -169
- package/package.json +1 -1
- package/CHANGELOG.md +0 -41
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -427
- package/FAQ.md +0 -895
- package/TROUBLESHOOTING.md +0 -972
- package/templates/providers/README.md +0 -117
- /package/examples/{claude → providers/claude}/CLAUDE_INTEGRATION.md +0 -0
- /package/examples/{claude → providers/claude}/mcp/automatosx.json +0 -0
- /package/examples/{codex → providers/codex}/CODEX_INTEGRATION.md +0 -0
- /package/examples/{codex → providers/codex}/README.md +0 -0
- /package/examples/{codex → providers/codex}/usage-examples.ts +0 -0
- /package/examples/{gemini → providers/gemini}/GEMINI_INTEGRATION.md +0 -0
- /package/examples/{gemini → providers/gemini}/README.md +0 -0
- /package/examples/{integrations → providers}/openai-codex-example.ts +0 -0
- /package/{templates → examples}/specs/enterprise.yaml.mustache +0 -0
- /package/{templates → examples}/specs/government.yaml.mustache +0 -0
- /package/{templates → examples}/specs/minimal.yaml.mustache +0 -0
- /package/examples/{templates → workflows}/analyst.yaml +0 -0
- /package/examples/{templates → workflows}/assistant.yaml +0 -0
- /package/examples/{templates → workflows}/basic-agent.yaml +0 -0
- /package/examples/{templates → workflows}/code-reviewer.yaml +0 -0
- /package/examples/{templates → workflows}/debugger.yaml +0 -0
- /package/examples/{templates → workflows}/designer.yaml +0 -0
- /package/examples/{templates → workflows}/developer.yaml +0 -0
- /package/examples/{templates → workflows}/fullstack-developer.yaml +0 -0
- /package/examples/{templates → workflows}/qa-specialist.yaml +0 -0
package/dist/index.js
CHANGED
|
@@ -57,12 +57,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
57
57
|
return to;
|
|
58
58
|
};
|
|
59
59
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
60
|
-
var getFilename, getDirname, __dirname$1;
|
|
61
60
|
var init_esm_shims = __esm({
|
|
62
61
|
"node_modules/tsup/assets/esm_shims.js"() {
|
|
63
|
-
getFilename = () => fileURLToPath(import.meta.url);
|
|
64
|
-
getDirname = () => path4__default.dirname(getFilename());
|
|
65
|
-
__dirname$1 = /* @__PURE__ */ getDirname();
|
|
66
62
|
}
|
|
67
63
|
});
|
|
68
64
|
function sanitizeObject(obj, maxDepth = 5, currentDepth = 0) {
|
|
@@ -99,7 +95,7 @@ function setLogLevel(level) {
|
|
|
99
95
|
}
|
|
100
96
|
var LOG_LEVELS, COLORS, SENSITIVE_KEYS, SimpleLogger, logger;
|
|
101
97
|
var init_logger = __esm({
|
|
102
|
-
"src/
|
|
98
|
+
"src/shared/logging/logger.ts"() {
|
|
103
99
|
init_esm_shims();
|
|
104
100
|
LOG_LEVELS = {
|
|
105
101
|
trace: 0,
|
|
@@ -271,7 +267,7 @@ ${JSON.stringify(entry.context, null, 2)}`;
|
|
|
271
267
|
}
|
|
272
268
|
});
|
|
273
269
|
|
|
274
|
-
// src/
|
|
270
|
+
// src/shared/process/process-manager.ts
|
|
275
271
|
var process_manager_exports = {};
|
|
276
272
|
__export(process_manager_exports, {
|
|
277
273
|
installExitHandlers: () => installExitHandlers,
|
|
@@ -321,7 +317,7 @@ function installExitHandlers() {
|
|
|
321
317
|
}
|
|
322
318
|
var ProcessManager, processManager, exitHandlersInstalled, exitInProgress;
|
|
323
319
|
var init_process_manager = __esm({
|
|
324
|
-
"src/
|
|
320
|
+
"src/shared/process/process-manager.ts"() {
|
|
325
321
|
init_esm_shims();
|
|
326
322
|
init_logger();
|
|
327
323
|
ProcessManager = class {
|
|
@@ -393,7 +389,7 @@ var init_process_manager = __esm({
|
|
|
393
389
|
if (child.killed || child.exitCode !== null) {
|
|
394
390
|
continue;
|
|
395
391
|
}
|
|
396
|
-
killPromises.push(new Promise((
|
|
392
|
+
killPromises.push(new Promise((resolve13) => {
|
|
397
393
|
let mainTimeoutId = null;
|
|
398
394
|
let fallbackTimeoutId = null;
|
|
399
395
|
let resolved = false;
|
|
@@ -408,7 +404,7 @@ var init_process_manager = __esm({
|
|
|
408
404
|
}
|
|
409
405
|
if (!resolved) {
|
|
410
406
|
resolved = true;
|
|
411
|
-
|
|
407
|
+
resolve13();
|
|
412
408
|
}
|
|
413
409
|
};
|
|
414
410
|
child.once("exit", () => {
|
|
@@ -433,8 +429,8 @@ var init_process_manager = __esm({
|
|
|
433
429
|
try {
|
|
434
430
|
await Promise.race([
|
|
435
431
|
Promise.all(killPromises),
|
|
436
|
-
new Promise((
|
|
437
|
-
finalTimeoutId = setTimeout(
|
|
432
|
+
new Promise((resolve13) => {
|
|
433
|
+
finalTimeoutId = setTimeout(resolve13, timeout);
|
|
438
434
|
})
|
|
439
435
|
]);
|
|
440
436
|
} finally {
|
|
@@ -485,8 +481,8 @@ var init_process_manager = __esm({
|
|
|
485
481
|
}
|
|
486
482
|
});
|
|
487
483
|
var DEFAULT_OPTIONS, DatabaseFactory;
|
|
488
|
-
var
|
|
489
|
-
"src/
|
|
484
|
+
var init_factory = __esm({
|
|
485
|
+
"src/core/database/factory.ts"() {
|
|
490
486
|
init_esm_shims();
|
|
491
487
|
init_logger();
|
|
492
488
|
DEFAULT_OPTIONS = {
|
|
@@ -682,12 +678,12 @@ function extname(filePath) {
|
|
|
682
678
|
return path4__default.extname(filePath);
|
|
683
679
|
}
|
|
684
680
|
var init_path_utils = __esm({
|
|
685
|
-
"src/
|
|
681
|
+
"src/shared/validation/path-utils.ts"() {
|
|
686
682
|
init_esm_shims();
|
|
687
683
|
}
|
|
688
684
|
});
|
|
689
685
|
|
|
690
|
-
// src/
|
|
686
|
+
// src/shared/errors/errors.ts
|
|
691
687
|
function toBaseError(error) {
|
|
692
688
|
if (error instanceof BaseError) {
|
|
693
689
|
return error;
|
|
@@ -708,7 +704,7 @@ function toBaseError(error) {
|
|
|
708
704
|
}
|
|
709
705
|
var BaseError, ConfigError, ProviderError;
|
|
710
706
|
var init_errors = __esm({
|
|
711
|
-
"src/
|
|
707
|
+
"src/shared/errors/errors.ts"() {
|
|
712
708
|
init_esm_shims();
|
|
713
709
|
BaseError = class extends Error {
|
|
714
710
|
code;
|
|
@@ -1012,7 +1008,7 @@ var init_path = __esm({
|
|
|
1012
1008
|
}
|
|
1013
1009
|
});
|
|
1014
1010
|
|
|
1015
|
-
// src/
|
|
1011
|
+
// src/shared/validation/path-resolver.ts
|
|
1016
1012
|
var path_resolver_exports = {};
|
|
1017
1013
|
__export(path_resolver_exports, {
|
|
1018
1014
|
PathResolver: () => PathResolver,
|
|
@@ -1062,7 +1058,7 @@ async function detectProjectRoot(startDir = process.cwd()) {
|
|
|
1062
1058
|
}
|
|
1063
1059
|
var PathResolver;
|
|
1064
1060
|
var init_path_resolver = __esm({
|
|
1065
|
-
"src/
|
|
1061
|
+
"src/shared/validation/path-resolver.ts"() {
|
|
1066
1062
|
init_esm_shims();
|
|
1067
1063
|
init_path_utils();
|
|
1068
1064
|
init_path();
|
|
@@ -1228,7 +1224,7 @@ var init_workspace_indexer = __esm({
|
|
|
1228
1224
|
"src/core/workspace-indexer.ts"() {
|
|
1229
1225
|
init_esm_shims();
|
|
1230
1226
|
init_logger();
|
|
1231
|
-
|
|
1227
|
+
init_factory();
|
|
1232
1228
|
DEFAULT_IGNORE_PATTERNS = [
|
|
1233
1229
|
"node_modules/**",
|
|
1234
1230
|
".git/**",
|
|
@@ -1749,10 +1745,10 @@ var init_workspace_indexer = __esm({
|
|
|
1749
1745
|
}
|
|
1750
1746
|
});
|
|
1751
1747
|
|
|
1752
|
-
// src/
|
|
1748
|
+
// src/shared/logging/verbosity-manager.ts
|
|
1753
1749
|
var VerbosityManager;
|
|
1754
1750
|
var init_verbosity_manager = __esm({
|
|
1755
|
-
"src/
|
|
1751
|
+
"src/shared/logging/verbosity-manager.ts"() {
|
|
1756
1752
|
init_esm_shims();
|
|
1757
1753
|
VerbosityManager = class _VerbosityManager {
|
|
1758
1754
|
static instance = null;
|
|
@@ -2072,7 +2068,7 @@ var init_provider_schemas = __esm({
|
|
|
2072
2068
|
});
|
|
2073
2069
|
var StreamingProgressParser;
|
|
2074
2070
|
var init_streaming_progress_parser = __esm({
|
|
2075
|
-
"src/
|
|
2071
|
+
"src/shared/process/streaming-progress-parser.ts"() {
|
|
2076
2072
|
init_esm_shims();
|
|
2077
2073
|
StreamingProgressParser = class {
|
|
2078
2074
|
spinner = null;
|
|
@@ -2582,7 +2578,8 @@ var init_base_provider = __esm({
|
|
|
2582
2578
|
try {
|
|
2583
2579
|
const cliCommand2 = this.getCLICommand();
|
|
2584
2580
|
const cliArgs = await this.getCLIArgs();
|
|
2585
|
-
const
|
|
2581
|
+
const escapedArgs = cliArgs.map((arg) => this.escapeShellArg(arg));
|
|
2582
|
+
const argsString = escapedArgs.length > 0 ? escapedArgs.join(" ") + " " : "";
|
|
2586
2583
|
const escapedPrompt = this.escapeShellArg(prompt);
|
|
2587
2584
|
const fullCommand = `${cliCommand2} ${argsString}${escapedPrompt}`;
|
|
2588
2585
|
const commandLength = fullCommand.length;
|
|
@@ -2625,7 +2622,7 @@ var init_base_provider = __esm({
|
|
|
2625
2622
|
* @returns Promise resolving to stdout and stderr
|
|
2626
2623
|
*/
|
|
2627
2624
|
async executeWithSpawn(command, cliCommand2) {
|
|
2628
|
-
return new Promise((
|
|
2625
|
+
return new Promise((resolve13, reject) => {
|
|
2629
2626
|
const child = spawn(command, [], {
|
|
2630
2627
|
shell: true,
|
|
2631
2628
|
// Auto-detects: cmd.exe on Windows, /bin/sh on Unix
|
|
@@ -2724,11 +2721,16 @@ var init_base_provider = __esm({
|
|
|
2724
2721
|
if (stderr) {
|
|
2725
2722
|
logger.debug(`${cliCommand2} CLI stderr output`, { stderr: stderr.trim() });
|
|
2726
2723
|
}
|
|
2727
|
-
if (code === 0 || code === null) {
|
|
2724
|
+
if ((code === 0 || code === null) && !signal) {
|
|
2728
2725
|
if (progressParser) {
|
|
2729
2726
|
progressParser.succeed(`${cliCommand2} completed successfully`);
|
|
2730
2727
|
}
|
|
2731
|
-
|
|
2728
|
+
resolve13({ stdout, stderr });
|
|
2729
|
+
} else if (signal) {
|
|
2730
|
+
if (progressParser) {
|
|
2731
|
+
progressParser.fail(`${cliCommand2} killed by signal ${signal}`);
|
|
2732
|
+
}
|
|
2733
|
+
reject(new Error(`${cliCommand2} CLI killed by signal ${signal}. stderr: ${stderr || "none"}`));
|
|
2732
2734
|
} else {
|
|
2733
2735
|
if (progressParser) {
|
|
2734
2736
|
progressParser.fail(`${cliCommand2} failed with code ${code}`);
|
|
@@ -2778,7 +2780,7 @@ var init_base_provider = __esm({
|
|
|
2778
2780
|
* @returns Promise resolving to stdout and stderr
|
|
2779
2781
|
*/
|
|
2780
2782
|
async executeWithStdin(cliCommand2, cliArgs, prompt) {
|
|
2781
|
-
return new Promise((
|
|
2783
|
+
return new Promise((resolve13, reject) => {
|
|
2782
2784
|
const commandArgs = cliArgs ? cliArgs.split(" ").filter(Boolean) : [];
|
|
2783
2785
|
logger.debug(`Executing ${cliCommand2} CLI with stdin`, {
|
|
2784
2786
|
command: cliCommand2,
|
|
@@ -2891,7 +2893,7 @@ var init_base_provider = __esm({
|
|
|
2891
2893
|
if (progressParser) {
|
|
2892
2894
|
progressParser.succeed(`${cliCommand2} completed successfully`);
|
|
2893
2895
|
}
|
|
2894
|
-
|
|
2896
|
+
resolve13({ stdout, stderr });
|
|
2895
2897
|
} else {
|
|
2896
2898
|
if (progressParser) {
|
|
2897
2899
|
progressParser.fail(`${cliCommand2} failed with code ${code}`);
|
|
@@ -3014,6 +3016,10 @@ ${fullPrompt}
|
|
|
3014
3016
|
errors: responseValidation.error.issues,
|
|
3015
3017
|
response
|
|
3016
3018
|
});
|
|
3019
|
+
throw new ProviderError(
|
|
3020
|
+
`Provider returned invalid response structure: ${responseValidation.error.issues.map((i) => i.message).join(", ")}`,
|
|
3021
|
+
"E1305" /* PROVIDER_EXEC_ERROR */
|
|
3022
|
+
);
|
|
3017
3023
|
}
|
|
3018
3024
|
return response;
|
|
3019
3025
|
} catch (error) {
|
|
@@ -3643,7 +3649,7 @@ var init_cli_wrapper = __esm({
|
|
|
3643
3649
|
* Spawn codex process
|
|
3644
3650
|
*/
|
|
3645
3651
|
async spawnProcess(args, prompt, timeout) {
|
|
3646
|
-
return new Promise((
|
|
3652
|
+
return new Promise((resolve13, reject) => {
|
|
3647
3653
|
let stdout = "";
|
|
3648
3654
|
let stderr = "";
|
|
3649
3655
|
let hasTimedOut = false;
|
|
@@ -3700,7 +3706,7 @@ var init_cli_wrapper = __esm({
|
|
|
3700
3706
|
return;
|
|
3701
3707
|
}
|
|
3702
3708
|
if (code === 0) {
|
|
3703
|
-
|
|
3709
|
+
resolve13({ stdout, stderr, exitCode: code });
|
|
3704
3710
|
} else {
|
|
3705
3711
|
reject(
|
|
3706
3712
|
new CodexError(
|
|
@@ -3733,7 +3739,7 @@ var init_cli_wrapper = __esm({
|
|
|
3733
3739
|
* Spawn codex process with streaming support
|
|
3734
3740
|
*/
|
|
3735
3741
|
async spawnProcessWithStreaming(args, prompt, timeout, renderer) {
|
|
3736
|
-
return new Promise((
|
|
3742
|
+
return new Promise((resolve13, reject) => {
|
|
3737
3743
|
let stdout = "";
|
|
3738
3744
|
let stderr = "";
|
|
3739
3745
|
let hasTimedOut = false;
|
|
@@ -3803,7 +3809,7 @@ var init_cli_wrapper = __esm({
|
|
|
3803
3809
|
if (renderer) {
|
|
3804
3810
|
renderer.succeed("Execution complete");
|
|
3805
3811
|
}
|
|
3806
|
-
|
|
3812
|
+
resolve13({ stdout, stderr, exitCode: code });
|
|
3807
3813
|
} else {
|
|
3808
3814
|
if (renderer) {
|
|
3809
3815
|
renderer.fail(`Process exited with code ${code}`);
|
|
@@ -4291,16 +4297,16 @@ var init_command_builder = __esm({
|
|
|
4291
4297
|
const args = [];
|
|
4292
4298
|
args.push("-p", this.escape(prompt));
|
|
4293
4299
|
if (options.provider) {
|
|
4294
|
-
args.push("--provider", options.provider);
|
|
4300
|
+
args.push("--provider", this.escape(options.provider));
|
|
4295
4301
|
}
|
|
4296
4302
|
if (options.model) {
|
|
4297
|
-
args.push("--model", options.model);
|
|
4303
|
+
args.push("--model", this.escape(options.model));
|
|
4298
4304
|
}
|
|
4299
4305
|
if (options.apiKey) {
|
|
4300
|
-
args.push("--api-key", options.apiKey);
|
|
4306
|
+
args.push("--api-key", this.escape(options.apiKey));
|
|
4301
4307
|
}
|
|
4302
4308
|
if (options.baseUrl) {
|
|
4303
|
-
args.push("--base-url", options.baseUrl);
|
|
4309
|
+
args.push("--base-url", this.escape(options.baseUrl));
|
|
4304
4310
|
}
|
|
4305
4311
|
if (options.directory) {
|
|
4306
4312
|
args.push("--directory", this.escape(options.directory));
|
|
@@ -4318,7 +4324,7 @@ var init_command_builder = __esm({
|
|
|
4318
4324
|
args.push("--selection", this.escape(options.selection));
|
|
4319
4325
|
}
|
|
4320
4326
|
if (options.lineRange) {
|
|
4321
|
-
args.push("--line-range", options.lineRange);
|
|
4327
|
+
args.push("--line-range", this.escape(options.lineRange));
|
|
4322
4328
|
}
|
|
4323
4329
|
if (options.gitDiff) {
|
|
4324
4330
|
args.push("--git-diff");
|
|
@@ -7617,7 +7623,7 @@ var init_ax_cli_provider = __esm({
|
|
|
7617
7623
|
init_esm_shims();
|
|
7618
7624
|
init_logger();
|
|
7619
7625
|
|
|
7620
|
-
// src/
|
|
7626
|
+
// src/shared/profiling/performance.ts
|
|
7621
7627
|
init_esm_shims();
|
|
7622
7628
|
var PerformanceTracker = class {
|
|
7623
7629
|
marks = /* @__PURE__ */ new Map();
|
|
@@ -7712,14 +7718,14 @@ var globalTracker = new PerformanceTracker(
|
|
|
7712
7718
|
process.env.AX_PROFILE === "true"
|
|
7713
7719
|
);
|
|
7714
7720
|
|
|
7715
|
-
// src/
|
|
7721
|
+
// src/shared/helpers/version.ts
|
|
7716
7722
|
init_esm_shims();
|
|
7717
7723
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
7718
7724
|
function getVersion() {
|
|
7719
7725
|
try {
|
|
7720
7726
|
const possiblePaths = [
|
|
7721
|
-
join(__dirname2, "
|
|
7722
|
-
// From src/
|
|
7727
|
+
join(__dirname2, "../../../package.json"),
|
|
7728
|
+
// From src/shared/helpers
|
|
7723
7729
|
join(__dirname2, "../package.json")
|
|
7724
7730
|
// From dist
|
|
7725
7731
|
];
|
|
@@ -7746,10 +7752,10 @@ init_process_manager();
|
|
|
7746
7752
|
// src/cli/commands/cache.ts
|
|
7747
7753
|
init_esm_shims();
|
|
7748
7754
|
|
|
7749
|
-
// src/core/response-cache.ts
|
|
7755
|
+
// src/core/cache/response-cache.ts
|
|
7750
7756
|
init_esm_shims();
|
|
7751
7757
|
init_logger();
|
|
7752
|
-
|
|
7758
|
+
init_factory();
|
|
7753
7759
|
var LRUCache = class {
|
|
7754
7760
|
cache;
|
|
7755
7761
|
maxSize;
|
|
@@ -8128,7 +8134,7 @@ var ResponseCache = class {
|
|
|
8128
8134
|
}
|
|
8129
8135
|
};
|
|
8130
8136
|
|
|
8131
|
-
// src/core/config.ts
|
|
8137
|
+
// src/core/config/loader.ts
|
|
8132
8138
|
init_esm_shims();
|
|
8133
8139
|
init_path_utils();
|
|
8134
8140
|
|
|
@@ -8504,11 +8510,11 @@ var DEFAULT_CONFIG = {
|
|
|
8504
8510
|
}
|
|
8505
8511
|
};
|
|
8506
8512
|
|
|
8507
|
-
// src/core/config.ts
|
|
8513
|
+
// src/core/config/loader.ts
|
|
8508
8514
|
init_errors();
|
|
8509
8515
|
init_logger();
|
|
8510
8516
|
|
|
8511
|
-
// src/
|
|
8517
|
+
// src/shared/helpers/deep-merge.ts
|
|
8512
8518
|
init_esm_shims();
|
|
8513
8519
|
function deepMerge(defaults, user) {
|
|
8514
8520
|
if (user === null || user === void 0) {
|
|
@@ -8648,7 +8654,7 @@ function isNonNegativeInteger(value) {
|
|
|
8648
8654
|
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
8649
8655
|
}
|
|
8650
8656
|
|
|
8651
|
-
// src/core/cache.ts
|
|
8657
|
+
// src/core/cache/cache.ts
|
|
8652
8658
|
init_esm_shims();
|
|
8653
8659
|
init_logger();
|
|
8654
8660
|
var TTLCache = class {
|
|
@@ -8933,7 +8939,7 @@ var TTLCache = class {
|
|
|
8933
8939
|
}
|
|
8934
8940
|
};
|
|
8935
8941
|
|
|
8936
|
-
// src/
|
|
8942
|
+
// src/shared/helpers/resource-calculator.ts
|
|
8937
8943
|
init_esm_shims();
|
|
8938
8944
|
function getSystemResources() {
|
|
8939
8945
|
const totalMemory = os2.totalmem();
|
|
@@ -8975,13 +8981,13 @@ function calculateMaxConcurrentAgents(staticLimit) {
|
|
|
8975
8981
|
};
|
|
8976
8982
|
}
|
|
8977
8983
|
|
|
8978
|
-
// src/config
|
|
8984
|
+
// src/core/config/generated.ts
|
|
8979
8985
|
init_esm_shims();
|
|
8980
8986
|
var PRECOMPILED_CONFIG = {
|
|
8981
8987
|
"providers": {
|
|
8982
8988
|
"claude-code": {
|
|
8983
8989
|
"enabled": true,
|
|
8984
|
-
"priority":
|
|
8990
|
+
"priority": 1,
|
|
8985
8991
|
"timeout": 27e5,
|
|
8986
8992
|
"command": "claude",
|
|
8987
8993
|
"healthCheck": {
|
|
@@ -9041,7 +9047,7 @@ var PRECOMPILED_CONFIG = {
|
|
|
9041
9047
|
},
|
|
9042
9048
|
"openai": {
|
|
9043
9049
|
"enabled": true,
|
|
9044
|
-
"priority":
|
|
9050
|
+
"priority": 3,
|
|
9045
9051
|
"timeout": 27e5,
|
|
9046
9052
|
"command": "codex",
|
|
9047
9053
|
"healthCheck": {
|
|
@@ -9279,10 +9285,10 @@ var PRECOMPILED_CONFIG = {
|
|
|
9279
9285
|
"enableFreeTierPrioritization": true,
|
|
9280
9286
|
"enableWorkloadAwareRouting": true
|
|
9281
9287
|
},
|
|
9282
|
-
"version": "11.2.
|
|
9288
|
+
"version": "11.2.7"
|
|
9283
9289
|
};
|
|
9284
9290
|
|
|
9285
|
-
// src/core/config
|
|
9291
|
+
// src/core/config/schemas.ts
|
|
9286
9292
|
init_esm_shims();
|
|
9287
9293
|
z.enum([
|
|
9288
9294
|
"claude",
|
|
@@ -9583,7 +9589,7 @@ function safeValidateConfig(config) {
|
|
|
9583
9589
|
}
|
|
9584
9590
|
automatosXConfigSchema.partial().passthrough();
|
|
9585
9591
|
|
|
9586
|
-
// src/core/config.ts
|
|
9592
|
+
// src/core/config/loader.ts
|
|
9587
9593
|
var configCache = new TTLCache({
|
|
9588
9594
|
ttl: 6e4,
|
|
9589
9595
|
// 60 seconds
|
|
@@ -9617,7 +9623,7 @@ async function loadConfigUncached(projectDir) {
|
|
|
9617
9623
|
logger.warn("\u26A0\uFE0F DEPRECATED: automatosx.config.{yaml,json} is deprecated.");
|
|
9618
9624
|
logger.warn(" Please rename to ax.config.{yaml,json} for future compatibility.");
|
|
9619
9625
|
logger.warn(" Migration: mv automatosx.config.json ax.config.json");
|
|
9620
|
-
logger.warn(" Support will be removed in
|
|
9626
|
+
logger.warn(" Support will be removed in a future version.");
|
|
9621
9627
|
}
|
|
9622
9628
|
return await loadConfigFile(configPath);
|
|
9623
9629
|
}
|
|
@@ -10159,7 +10165,7 @@ async function saveConfigFile(path7, config) {
|
|
|
10159
10165
|
}
|
|
10160
10166
|
}
|
|
10161
10167
|
|
|
10162
|
-
// src/
|
|
10168
|
+
// src/shared/logging/message-formatter.ts
|
|
10163
10169
|
init_esm_shims();
|
|
10164
10170
|
function formatSuccess(message, options = {}) {
|
|
10165
10171
|
const { colors = true, icon = true } = options;
|
|
@@ -10431,7 +10437,7 @@ var cacheCommand = {
|
|
|
10431
10437
|
init_esm_shims();
|
|
10432
10438
|
init_logger();
|
|
10433
10439
|
|
|
10434
|
-
// src/
|
|
10440
|
+
// src/shared/errors/error-formatter.ts
|
|
10435
10441
|
init_esm_shims();
|
|
10436
10442
|
init_errors();
|
|
10437
10443
|
function formatError(error, options = {}) {
|
|
@@ -10485,7 +10491,7 @@ function printError(error, options = {}) {
|
|
|
10485
10491
|
console.error(formatted);
|
|
10486
10492
|
}
|
|
10487
10493
|
|
|
10488
|
-
// src/
|
|
10494
|
+
// src/core/config/validator.ts
|
|
10489
10495
|
init_esm_shims();
|
|
10490
10496
|
function validateConfig2(config) {
|
|
10491
10497
|
const errors = [];
|
|
@@ -10902,7 +10908,7 @@ var configCommand = {
|
|
|
10902
10908
|
} else if (process.env.AUTOMATOSX_CONFIG_PATH) {
|
|
10903
10909
|
configPath = process.env.AUTOMATOSX_CONFIG_PATH;
|
|
10904
10910
|
} else {
|
|
10905
|
-
const projectConfig = resolve(process.cwd(), "
|
|
10911
|
+
const projectConfig = resolve(process.cwd(), "ax.config.json");
|
|
10906
10912
|
const hiddenConfig = resolve(process.cwd(), ".automatosx", "config.json");
|
|
10907
10913
|
const fs7 = await import('fs');
|
|
10908
10914
|
if (fs7.existsSync(projectConfig)) {
|
|
@@ -10990,7 +10996,7 @@ async function validateConfigFile(config, verbose) {
|
|
|
10990
10996
|
async function resetConfig(path7, verbose) {
|
|
10991
10997
|
const { createRequire } = await import('module');
|
|
10992
10998
|
const require2 = createRequire(import.meta.url);
|
|
10993
|
-
let version = "
|
|
10999
|
+
let version = "11.2.6";
|
|
10994
11000
|
try {
|
|
10995
11001
|
const packageJson = require2("../../../package.json");
|
|
10996
11002
|
version = packageJson.version;
|
|
@@ -11137,7 +11143,7 @@ function setNestedValue(obj, path7, value) {
|
|
|
11137
11143
|
init_esm_shims();
|
|
11138
11144
|
init_logger();
|
|
11139
11145
|
|
|
11140
|
-
// src/
|
|
11146
|
+
// src/shared/helpers/prompt-helper.ts
|
|
11141
11147
|
init_esm_shims();
|
|
11142
11148
|
var PromptHelper = class {
|
|
11143
11149
|
rl = null;
|
|
@@ -11165,9 +11171,9 @@ var PromptHelper = class {
|
|
|
11165
11171
|
*/
|
|
11166
11172
|
async question(query) {
|
|
11167
11173
|
const rl = this.ensureInterface();
|
|
11168
|
-
return new Promise((
|
|
11174
|
+
return new Promise((resolve13) => {
|
|
11169
11175
|
rl.question(query, (answer) => {
|
|
11170
|
-
|
|
11176
|
+
resolve13(answer.trim());
|
|
11171
11177
|
});
|
|
11172
11178
|
});
|
|
11173
11179
|
}
|
|
@@ -11257,6 +11263,29 @@ Your choice${defaultSuffix}: `,
|
|
|
11257
11263
|
}
|
|
11258
11264
|
};
|
|
11259
11265
|
|
|
11266
|
+
// src/shared/helpers/package-root.ts
|
|
11267
|
+
init_esm_shims();
|
|
11268
|
+
var cachedPackageRoot = null;
|
|
11269
|
+
function getPackageRoot(startDir) {
|
|
11270
|
+
if (cachedPackageRoot && true) {
|
|
11271
|
+
return cachedPackageRoot;
|
|
11272
|
+
}
|
|
11273
|
+
const __filename3 = fileURLToPath(import.meta.url);
|
|
11274
|
+
const __dirname4 = dirname(__filename3);
|
|
11275
|
+
let current = __dirname4;
|
|
11276
|
+
const root = "/";
|
|
11277
|
+
while (current !== root) {
|
|
11278
|
+
if (existsSync(join(current, "package.json"))) {
|
|
11279
|
+
{
|
|
11280
|
+
cachedPackageRoot = current;
|
|
11281
|
+
}
|
|
11282
|
+
return current;
|
|
11283
|
+
}
|
|
11284
|
+
current = dirname(current);
|
|
11285
|
+
}
|
|
11286
|
+
return __dirname4;
|
|
11287
|
+
}
|
|
11288
|
+
|
|
11260
11289
|
// src/integrations/claude-code/setup-helper.ts
|
|
11261
11290
|
init_esm_shims();
|
|
11262
11291
|
init_logger();
|
|
@@ -11822,7 +11851,7 @@ var AgentNotFoundError = class extends Error {
|
|
|
11822
11851
|
// src/agents/profile-loader.ts
|
|
11823
11852
|
init_logger();
|
|
11824
11853
|
|
|
11825
|
-
// src/
|
|
11854
|
+
// src/shared/profiling/performance-markers.ts
|
|
11826
11855
|
init_esm_shims();
|
|
11827
11856
|
init_logger();
|
|
11828
11857
|
var PERFORMANCE_THRESHOLDS = {
|
|
@@ -12124,16 +12153,6 @@ function safeValidateAgentProfile(profile) {
|
|
|
12124
12153
|
agentProfileSchema.partial();
|
|
12125
12154
|
|
|
12126
12155
|
// src/agents/profile-loader.ts
|
|
12127
|
-
var __filename2 = fileURLToPath(import.meta.url);
|
|
12128
|
-
var __dirname3 = dirname(__filename2);
|
|
12129
|
-
function getPackageRoot() {
|
|
12130
|
-
const currentDir = __dirname3;
|
|
12131
|
-
if (currentDir.includes("/dist")) {
|
|
12132
|
-
return join(currentDir, "..");
|
|
12133
|
-
} else {
|
|
12134
|
-
return join(currentDir, "../..");
|
|
12135
|
-
}
|
|
12136
|
-
}
|
|
12137
12156
|
var ProfileLoader = class {
|
|
12138
12157
|
profilesDir;
|
|
12139
12158
|
fallbackProfilesDir;
|
|
@@ -13181,19 +13200,6 @@ var ProviderDetector = class _ProviderDetector {
|
|
|
13181
13200
|
};
|
|
13182
13201
|
|
|
13183
13202
|
// src/cli/commands/setup.ts
|
|
13184
|
-
var __filename3 = fileURLToPath(import.meta.url);
|
|
13185
|
-
var __dirname4 = dirname(__filename3);
|
|
13186
|
-
function getPackageRoot2() {
|
|
13187
|
-
let current = __dirname4;
|
|
13188
|
-
const root = "/";
|
|
13189
|
-
while (current !== root) {
|
|
13190
|
-
if (existsSync(join(current, "package.json"))) {
|
|
13191
|
-
return current;
|
|
13192
|
-
}
|
|
13193
|
-
current = dirname(current);
|
|
13194
|
-
}
|
|
13195
|
-
throw new Error("Could not find package root (no package.json found)");
|
|
13196
|
-
}
|
|
13197
13203
|
var setupCommand = {
|
|
13198
13204
|
command: "setup [path]",
|
|
13199
13205
|
describe: "Set up AutomatosX in current or specified directory",
|
|
@@ -13223,8 +13229,8 @@ var setupCommand = {
|
|
|
13223
13229
|
const projectDir = resolve(argv.path || ".");
|
|
13224
13230
|
const automatosxDir = join(projectDir, ".automatosx");
|
|
13225
13231
|
const configPath = join(projectDir, "ax.config.json");
|
|
13226
|
-
const packageRoot =
|
|
13227
|
-
let version = "
|
|
13232
|
+
const packageRoot = getPackageRoot();
|
|
13233
|
+
let version = "11.2.6";
|
|
13228
13234
|
try {
|
|
13229
13235
|
const packageJson = JSON.parse(
|
|
13230
13236
|
await import('fs/promises').then((fs7) => fs7.readFile(join(packageRoot, "package.json"), "utf-8"))
|
|
@@ -13589,7 +13595,7 @@ async function validateEnvironment(packageRoot) {
|
|
|
13589
13595
|
const requiredDirs = [
|
|
13590
13596
|
"examples/agents",
|
|
13591
13597
|
"examples/abilities",
|
|
13592
|
-
"examples/
|
|
13598
|
+
"examples/workflows",
|
|
13593
13599
|
"examples/teams"
|
|
13594
13600
|
];
|
|
13595
13601
|
const errors = [];
|
|
@@ -13667,7 +13673,7 @@ async function copyExampleAbilities(baseDir, packageRoot) {
|
|
|
13667
13673
|
}
|
|
13668
13674
|
async function copyExampleTemplates(baseDir, packageRoot) {
|
|
13669
13675
|
return copyExampleFiles(baseDir, packageRoot, {
|
|
13670
|
-
exampleDir: "
|
|
13676
|
+
exampleDir: "workflows",
|
|
13671
13677
|
targetDir: "templates",
|
|
13672
13678
|
extension: ".yaml",
|
|
13673
13679
|
resourceName: "template"
|
|
@@ -13849,7 +13855,7 @@ async function createDefaultConfig(configPath, force, version) {
|
|
|
13849
13855
|
await writeFile(configPath, content, "utf-8");
|
|
13850
13856
|
}
|
|
13851
13857
|
async function setupClaudeIntegration(projectDir, packageRoot) {
|
|
13852
|
-
const examplesBaseDir = join(packageRoot, "examples/claude");
|
|
13858
|
+
const examplesBaseDir = join(packageRoot, "examples/providers/claude");
|
|
13853
13859
|
const claudeDir = join(projectDir, ".claude");
|
|
13854
13860
|
const mcpDir = join(claudeDir, "mcp");
|
|
13855
13861
|
await mkdir(mcpDir, { recursive: true });
|
|
@@ -13898,7 +13904,7 @@ async function initializeGitRepository(projectDir) {
|
|
|
13898
13904
|
return true;
|
|
13899
13905
|
}
|
|
13900
13906
|
const { spawn: spawn9 } = await import('child_process');
|
|
13901
|
-
await new Promise((
|
|
13907
|
+
await new Promise((resolve13, reject) => {
|
|
13902
13908
|
const child = spawn9("git", ["init"], {
|
|
13903
13909
|
cwd: projectDir,
|
|
13904
13910
|
stdio: "pipe",
|
|
@@ -13914,7 +13920,7 @@ async function initializeGitRepository(projectDir) {
|
|
|
13914
13920
|
reject(new Error(`git init failed with code ${code}: ${stderr}`));
|
|
13915
13921
|
} else {
|
|
13916
13922
|
logger.info("Git repository set up successfully");
|
|
13917
|
-
|
|
13923
|
+
resolve13();
|
|
13918
13924
|
}
|
|
13919
13925
|
});
|
|
13920
13926
|
child.on("error", (error) => {
|
|
@@ -16060,7 +16066,7 @@ var configureCommand = {
|
|
|
16060
16066
|
}
|
|
16061
16067
|
console.log(chalk5.bold.cyan("\n\u2728 AutomatosX Setup Wizard\n"));
|
|
16062
16068
|
console.log(chalk5.dim("This wizard will help you configure the OpenAI integration mode.\n"));
|
|
16063
|
-
const configPath = resolve(process.cwd(), "
|
|
16069
|
+
const configPath = resolve(process.cwd(), "ax.config.json");
|
|
16064
16070
|
const config = await loadConfig(configPath);
|
|
16065
16071
|
if (!config.providers.openai) {
|
|
16066
16072
|
console.log(chalk5.red("\n\u274C OpenAI provider not found in configuration\n"));
|
|
@@ -16350,7 +16356,7 @@ var MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
|
16350
16356
|
// src/mcp/server.ts
|
|
16351
16357
|
init_logger();
|
|
16352
16358
|
|
|
16353
|
-
// src/core/router.ts
|
|
16359
|
+
// src/core/router/router.ts
|
|
16354
16360
|
init_esm_shims();
|
|
16355
16361
|
init_logger();
|
|
16356
16362
|
init_errors();
|
|
@@ -16707,7 +16713,7 @@ async function getProviderLimitManager(stateDirectory) {
|
|
|
16707
16713
|
return ProviderLimitManager.getInstance(stateDirectory);
|
|
16708
16714
|
}
|
|
16709
16715
|
|
|
16710
|
-
// src/core/routing-strategy.ts
|
|
16716
|
+
// src/core/router/routing-strategy.ts
|
|
16711
16717
|
init_esm_shims();
|
|
16712
16718
|
|
|
16713
16719
|
// src/types/routing.ts
|
|
@@ -16784,7 +16790,7 @@ var ROUTING_STRATEGIES = {
|
|
|
16784
16790
|
init_esm_shims();
|
|
16785
16791
|
init_logger();
|
|
16786
16792
|
|
|
16787
|
-
// src/
|
|
16793
|
+
// src/shared/helpers/statistics.ts
|
|
16788
16794
|
init_esm_shims();
|
|
16789
16795
|
function getPercentileIndex(length, percentile) {
|
|
16790
16796
|
if (length === 0) {
|
|
@@ -17230,7 +17236,7 @@ function getProviderMetricsTracker() {
|
|
|
17230
17236
|
return globalMetricsTracker;
|
|
17231
17237
|
}
|
|
17232
17238
|
|
|
17233
|
-
// src/core/routing-strategy.ts
|
|
17239
|
+
// src/core/router/routing-strategy.ts
|
|
17234
17240
|
init_logger();
|
|
17235
17241
|
var RoutingStrategyManager = class extends EventEmitter {
|
|
17236
17242
|
strategy;
|
|
@@ -17513,7 +17519,7 @@ function getRoutingStrategyManager(config) {
|
|
|
17513
17519
|
return globalRoutingStrategy;
|
|
17514
17520
|
}
|
|
17515
17521
|
|
|
17516
|
-
// src/core/circuit-breaker.ts
|
|
17522
|
+
// src/core/router/circuit-breaker.ts
|
|
17517
17523
|
init_esm_shims();
|
|
17518
17524
|
init_logger();
|
|
17519
17525
|
var DEFAULT_CONFIG2 = {
|
|
@@ -17676,7 +17682,7 @@ var CircuitBreaker = class {
|
|
|
17676
17682
|
}
|
|
17677
17683
|
};
|
|
17678
17684
|
|
|
17679
|
-
// src/core/router
|
|
17685
|
+
// src/core/router/trace-logger.ts
|
|
17680
17686
|
init_esm_shims();
|
|
17681
17687
|
init_logger();
|
|
17682
17688
|
var RouterTraceLogger = class {
|
|
@@ -18049,7 +18055,7 @@ async function getProviderSession(workspacePath) {
|
|
|
18049
18055
|
return providerSessionInstances.get(path7);
|
|
18050
18056
|
}
|
|
18051
18057
|
|
|
18052
|
-
// src/core/router.ts
|
|
18058
|
+
// src/core/router/router.ts
|
|
18053
18059
|
var Router = class {
|
|
18054
18060
|
providers;
|
|
18055
18061
|
fallbackEnabled;
|
|
@@ -18229,23 +18235,29 @@ var Router = class {
|
|
|
18229
18235
|
const isCircuitOpen = this.circuitBreaker.isOpen(provider.name);
|
|
18230
18236
|
healthMultipliers.set(provider.name, isCircuitOpen ? 0.5 : 1);
|
|
18231
18237
|
}
|
|
18232
|
-
|
|
18233
|
-
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18238
|
+
try {
|
|
18239
|
+
const scores = await getProviderMetricsTracker().getAllScores(
|
|
18240
|
+
providerNames,
|
|
18241
|
+
strategyManager.getWeights(),
|
|
18242
|
+
healthMultipliers
|
|
18243
|
+
);
|
|
18244
|
+
if (scores.length > 0) {
|
|
18245
|
+
const scoreMap = new Map(scores.map((s) => [s.provider, s.totalScore]));
|
|
18246
|
+
const originalOrder = providersToTry.map((p) => p.name);
|
|
18247
|
+
providersToTry = [...providersToTry].sort((a, b) => {
|
|
18248
|
+
const scoreA = scoreMap.get(a.name) ?? 0;
|
|
18249
|
+
const scoreB = scoreMap.get(b.name) ?? 0;
|
|
18250
|
+
return scoreB - scoreA;
|
|
18251
|
+
});
|
|
18252
|
+
logger.debug("Provider order after multi-factor routing", {
|
|
18253
|
+
original: originalOrder,
|
|
18254
|
+
reordered: providersToTry.map((p) => p.name),
|
|
18255
|
+
scores: Object.fromEntries(scoreMap)
|
|
18256
|
+
});
|
|
18257
|
+
}
|
|
18258
|
+
} catch (scoringError) {
|
|
18259
|
+
logger.warn("Multi-factor scoring failed, using priority order", {
|
|
18260
|
+
error: scoringError.message
|
|
18249
18261
|
});
|
|
18250
18262
|
}
|
|
18251
18263
|
}
|
|
@@ -18853,10 +18865,10 @@ Run 'ax doctor' to diagnose provider setup.` : "";
|
|
|
18853
18865
|
}
|
|
18854
18866
|
};
|
|
18855
18867
|
|
|
18856
|
-
// src/core/lazy-
|
|
18868
|
+
// src/core/memory/lazy-manager.ts
|
|
18857
18869
|
init_esm_shims();
|
|
18858
18870
|
|
|
18859
|
-
// src/core/memory
|
|
18871
|
+
// src/core/memory/manager.ts
|
|
18860
18872
|
init_esm_shims();
|
|
18861
18873
|
|
|
18862
18874
|
// src/types/memory.ts
|
|
@@ -18870,12 +18882,12 @@ var MemoryError = class extends Error {
|
|
|
18870
18882
|
}
|
|
18871
18883
|
};
|
|
18872
18884
|
|
|
18873
|
-
// src/core/memory
|
|
18885
|
+
// src/core/memory/manager.ts
|
|
18874
18886
|
init_logger();
|
|
18875
18887
|
init_path_utils();
|
|
18876
|
-
|
|
18888
|
+
init_factory();
|
|
18877
18889
|
|
|
18878
|
-
// src/core/memory
|
|
18890
|
+
// src/core/memory/schemas.ts
|
|
18879
18891
|
init_esm_shims();
|
|
18880
18892
|
var MemoryMetadataSchema = z.object({
|
|
18881
18893
|
type: z.string().min(1).max(100),
|
|
@@ -19151,7 +19163,7 @@ var MemoryCleanupStrategies = class {
|
|
|
19151
19163
|
}
|
|
19152
19164
|
};
|
|
19153
19165
|
|
|
19154
|
-
// src/core/memory
|
|
19166
|
+
// src/core/memory/manager.ts
|
|
19155
19167
|
var MemoryManager = class _MemoryManager {
|
|
19156
19168
|
// v5.6.18: Performance optimization - Static regex for FTS5 query sanitization
|
|
19157
19169
|
// Moving these to class-level constants reduces 90% sanitization time
|
|
@@ -20124,8 +20136,11 @@ var MemoryManager = class _MemoryManager {
|
|
|
20124
20136
|
}
|
|
20125
20137
|
const tempPath = `${this.config.dbPath}.restore.tmp`;
|
|
20126
20138
|
const srcDb = new Database2(srcPath, { readonly: true });
|
|
20127
|
-
|
|
20128
|
-
|
|
20139
|
+
try {
|
|
20140
|
+
await srcDb.backup(tempPath);
|
|
20141
|
+
} finally {
|
|
20142
|
+
srcDb.close();
|
|
20143
|
+
}
|
|
20129
20144
|
try {
|
|
20130
20145
|
const tempDb = new Database2(tempPath, { readonly: true });
|
|
20131
20146
|
tempDb.prepare("SELECT COUNT(*) FROM memory_entries").get();
|
|
@@ -20408,7 +20423,7 @@ var MemoryManager = class _MemoryManager {
|
|
|
20408
20423
|
}
|
|
20409
20424
|
};
|
|
20410
20425
|
|
|
20411
|
-
// src/core/lazy-
|
|
20426
|
+
// src/core/memory/lazy-manager.ts
|
|
20412
20427
|
init_logger();
|
|
20413
20428
|
var LazyMemoryManager = class {
|
|
20414
20429
|
manager;
|
|
@@ -20614,7 +20629,7 @@ var LazyMemoryManager = class {
|
|
|
20614
20629
|
}
|
|
20615
20630
|
};
|
|
20616
20631
|
|
|
20617
|
-
// src/core/session
|
|
20632
|
+
// src/core/session/manager.ts
|
|
20618
20633
|
init_esm_shims();
|
|
20619
20634
|
|
|
20620
20635
|
// src/types/orchestration.ts
|
|
@@ -20637,11 +20652,11 @@ var SessionError = class extends Error {
|
|
|
20637
20652
|
}
|
|
20638
20653
|
};
|
|
20639
20654
|
|
|
20640
|
-
// src/core/session
|
|
20655
|
+
// src/core/session/manager.ts
|
|
20641
20656
|
init_logger();
|
|
20642
20657
|
init_path_utils();
|
|
20643
20658
|
|
|
20644
|
-
// src/core/session
|
|
20659
|
+
// src/core/session/schemas.ts
|
|
20645
20660
|
init_esm_shims();
|
|
20646
20661
|
var SessionTaskInfoSchema = z.object({
|
|
20647
20662
|
id: z.string().min(1).max(200),
|
|
@@ -20684,7 +20699,7 @@ z.object({
|
|
|
20684
20699
|
offset: z.number().int().nonnegative().optional()
|
|
20685
20700
|
}).strict();
|
|
20686
20701
|
|
|
20687
|
-
// src/core/session
|
|
20702
|
+
// src/core/session/manager.ts
|
|
20688
20703
|
var SessionManager = class _SessionManager {
|
|
20689
20704
|
/** Active sessions (in-memory, keyed by session ID) */
|
|
20690
20705
|
activeSessions = /* @__PURE__ */ new Map();
|
|
@@ -22713,23 +22728,13 @@ var ContextManager = class {
|
|
|
22713
22728
|
// src/agents/abilities-manager.ts
|
|
22714
22729
|
init_esm_shims();
|
|
22715
22730
|
init_logger();
|
|
22716
|
-
var __filename4 = fileURLToPath(import.meta.url);
|
|
22717
|
-
var __dirname5 = dirname(__filename4);
|
|
22718
|
-
function getPackageRoot3() {
|
|
22719
|
-
const currentDir = __dirname5;
|
|
22720
|
-
if (currentDir.includes("/dist")) {
|
|
22721
|
-
return join(currentDir, "..");
|
|
22722
|
-
} else {
|
|
22723
|
-
return join(currentDir, "../..");
|
|
22724
|
-
}
|
|
22725
|
-
}
|
|
22726
22731
|
var AbilitiesManager = class {
|
|
22727
22732
|
abilitiesDir;
|
|
22728
22733
|
fallbackAbilitiesDir;
|
|
22729
22734
|
cache;
|
|
22730
22735
|
constructor(abilitiesDir, fallbackAbilitiesDir) {
|
|
22731
22736
|
this.abilitiesDir = abilitiesDir;
|
|
22732
|
-
this.fallbackAbilitiesDir = fallbackAbilitiesDir || join(
|
|
22737
|
+
this.fallbackAbilitiesDir = fallbackAbilitiesDir || join(getPackageRoot(), "examples/abilities");
|
|
22733
22738
|
this.cache = new TTLCache({
|
|
22734
22739
|
maxEntries: 50,
|
|
22735
22740
|
ttl: 6e5,
|
|
@@ -22845,9 +22850,10 @@ ${content}`);
|
|
|
22845
22850
|
// src/mcp/server.ts
|
|
22846
22851
|
init_path_resolver();
|
|
22847
22852
|
|
|
22848
|
-
// src/core/
|
|
22853
|
+
// src/core/session/context-store.ts
|
|
22849
22854
|
init_esm_shims();
|
|
22850
22855
|
init_logger();
|
|
22856
|
+
var VALID_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
22851
22857
|
var ConversationContextStore = class {
|
|
22852
22858
|
storePath;
|
|
22853
22859
|
maxEntries;
|
|
@@ -22857,6 +22863,33 @@ var ConversationContextStore = class {
|
|
|
22857
22863
|
this.maxEntries = options.maxEntries ?? 100;
|
|
22858
22864
|
this.ttlMs = options.ttlMs ?? 24 * 60 * 60 * 1e3;
|
|
22859
22865
|
}
|
|
22866
|
+
/**
|
|
22867
|
+
* Validate and sanitize context ID to prevent path traversal attacks
|
|
22868
|
+
*
|
|
22869
|
+
* SECURITY: This is critical to prevent path traversal vulnerabilities.
|
|
22870
|
+
* A malicious ID like "../../.ssh/id_rsa" could read/write/delete files
|
|
22871
|
+
* outside the context store directory.
|
|
22872
|
+
*
|
|
22873
|
+
* @param id - Context ID to validate
|
|
22874
|
+
* @returns Sanitized file path within storePath
|
|
22875
|
+
* @throws Error if ID is invalid or path escapes storePath
|
|
22876
|
+
*/
|
|
22877
|
+
validateAndResolvePath(id) {
|
|
22878
|
+
if (!VALID_ID_PATTERN.test(id)) {
|
|
22879
|
+
throw new Error(
|
|
22880
|
+
`Invalid context ID: "${id}". IDs must be 1-64 characters, alphanumeric with underscores/hyphens only.`
|
|
22881
|
+
);
|
|
22882
|
+
}
|
|
22883
|
+
const filePath = join(this.storePath, `${id}.json`);
|
|
22884
|
+
const resolvedPath = resolve(filePath);
|
|
22885
|
+
const resolvedStorePath = resolve(this.storePath);
|
|
22886
|
+
const relativePath = relative(resolvedStorePath, resolvedPath);
|
|
22887
|
+
if (relativePath.startsWith("..") || relativePath.includes("/..") || relativePath.includes("\\..")) {
|
|
22888
|
+
logger.error("[ContextStore] Path traversal attempt blocked", { id, resolvedPath });
|
|
22889
|
+
throw new Error(`Security violation: context ID "${id}" would escape store directory`);
|
|
22890
|
+
}
|
|
22891
|
+
return resolvedPath;
|
|
22892
|
+
}
|
|
22860
22893
|
/**
|
|
22861
22894
|
* Initialize store (create directory if needed)
|
|
22862
22895
|
*/
|
|
@@ -22874,7 +22907,7 @@ var ConversationContextStore = class {
|
|
|
22874
22907
|
*/
|
|
22875
22908
|
async save(context) {
|
|
22876
22909
|
await this.initialize();
|
|
22877
|
-
const filePath =
|
|
22910
|
+
const filePath = this.validateAndResolvePath(context.id);
|
|
22878
22911
|
const data = JSON.stringify(context, null, 2);
|
|
22879
22912
|
try {
|
|
22880
22913
|
await writeFile(filePath, data, "utf-8");
|
|
@@ -22893,7 +22926,7 @@ var ConversationContextStore = class {
|
|
|
22893
22926
|
* Get conversation context by ID
|
|
22894
22927
|
*/
|
|
22895
22928
|
async get(id) {
|
|
22896
|
-
const filePath =
|
|
22929
|
+
const filePath = this.validateAndResolvePath(id);
|
|
22897
22930
|
try {
|
|
22898
22931
|
const data = await readFile(filePath, "utf-8");
|
|
22899
22932
|
const context = JSON.parse(data);
|
|
@@ -22947,7 +22980,7 @@ var ConversationContextStore = class {
|
|
|
22947
22980
|
* Delete context entry
|
|
22948
22981
|
*/
|
|
22949
22982
|
async delete(id) {
|
|
22950
|
-
const filePath =
|
|
22983
|
+
const filePath = this.validateAndResolvePath(id);
|
|
22951
22984
|
try {
|
|
22952
22985
|
await unlink(filePath);
|
|
22953
22986
|
logger.info("[ContextStore] Context deleted", { id });
|
|
@@ -23640,7 +23673,7 @@ var TimeoutManager = class {
|
|
|
23640
23673
|
}
|
|
23641
23674
|
};
|
|
23642
23675
|
|
|
23643
|
-
// src/
|
|
23676
|
+
// src/shared/validation/timeout-validator.ts
|
|
23644
23677
|
init_esm_shims();
|
|
23645
23678
|
init_errors();
|
|
23646
23679
|
var MIN_WARNING_THRESHOLD2 = 0.5;
|
|
@@ -25331,7 +25364,7 @@ ${context.task}`;
|
|
|
25331
25364
|
* @param signal - Optional AbortSignal to cancel the sleep
|
|
25332
25365
|
*/
|
|
25333
25366
|
sleep(ms, signal) {
|
|
25334
|
-
return new Promise((
|
|
25367
|
+
return new Promise((resolve13, reject) => {
|
|
25335
25368
|
if (signal?.aborted) {
|
|
25336
25369
|
reject(new Error("Sleep cancelled"));
|
|
25337
25370
|
return;
|
|
@@ -25341,7 +25374,7 @@ ${context.task}`;
|
|
|
25341
25374
|
if (abortHandler && signal) {
|
|
25342
25375
|
signal.removeEventListener("abort", abortHandler);
|
|
25343
25376
|
}
|
|
25344
|
-
|
|
25377
|
+
resolve13();
|
|
25345
25378
|
}, ms);
|
|
25346
25379
|
if (signal) {
|
|
25347
25380
|
abortHandler = () => {
|
|
@@ -26759,10 +26792,10 @@ var McpClient = class extends EventEmitter {
|
|
|
26759
26792
|
return;
|
|
26760
26793
|
}
|
|
26761
26794
|
if (this.state.status === "connecting") {
|
|
26762
|
-
return new Promise((
|
|
26795
|
+
return new Promise((resolve13, reject) => {
|
|
26763
26796
|
const onConnected = () => {
|
|
26764
26797
|
this.off("error", onError);
|
|
26765
|
-
|
|
26798
|
+
resolve13();
|
|
26766
26799
|
};
|
|
26767
26800
|
const onError = (err) => {
|
|
26768
26801
|
this.off("connected", onConnected);
|
|
@@ -26929,14 +26962,14 @@ var McpClient = class extends EventEmitter {
|
|
|
26929
26962
|
method,
|
|
26930
26963
|
params
|
|
26931
26964
|
};
|
|
26932
|
-
return new Promise((
|
|
26965
|
+
return new Promise((resolve13, reject) => {
|
|
26933
26966
|
const timeoutMs = timeout ?? this.config.timeout;
|
|
26934
26967
|
const timeoutHandle = setTimeout(() => {
|
|
26935
26968
|
this.pendingRequests.delete(id);
|
|
26936
26969
|
reject(new Error(`Request timed out after ${timeoutMs}ms: ${method}`));
|
|
26937
26970
|
}, timeoutMs);
|
|
26938
26971
|
this.pendingRequests.set(id, {
|
|
26939
|
-
resolve:
|
|
26972
|
+
resolve: resolve13,
|
|
26940
26973
|
reject,
|
|
26941
26974
|
timeout: timeoutHandle
|
|
26942
26975
|
});
|
|
@@ -27394,15 +27427,15 @@ var McpClientPool = class extends EventEmitter {
|
|
|
27394
27427
|
}
|
|
27395
27428
|
}
|
|
27396
27429
|
async waitForConnection(provider, pool) {
|
|
27397
|
-
return new Promise((
|
|
27430
|
+
return new Promise((resolve13, reject) => {
|
|
27398
27431
|
const timeout = setTimeout(() => {
|
|
27399
|
-
const index = pool.waitQueue.findIndex((w) => w.resolve ===
|
|
27432
|
+
const index = pool.waitQueue.findIndex((w) => w.resolve === resolve13);
|
|
27400
27433
|
if (index !== -1) {
|
|
27401
27434
|
pool.waitQueue.splice(index, 1);
|
|
27402
27435
|
}
|
|
27403
27436
|
reject(new ConnectionTimeoutError(provider, this.config.acquireTimeoutMs));
|
|
27404
27437
|
}, this.config.acquireTimeoutMs);
|
|
27405
|
-
pool.waitQueue.push({ resolve:
|
|
27438
|
+
pool.waitQueue.push({ resolve: resolve13, reject, timeout });
|
|
27406
27439
|
logger.debug("[MCP Pool] Waiting for connection", {
|
|
27407
27440
|
provider,
|
|
27408
27441
|
queuePosition: pool.waitQueue.length
|
|
@@ -28879,6 +28912,8 @@ var McpServer = class _McpServer {
|
|
|
28879
28912
|
initializationPromise = null;
|
|
28880
28913
|
initializationMutex = new Mutex();
|
|
28881
28914
|
// BUG FIX (v9.0.1): Prevent concurrent initialization
|
|
28915
|
+
stdinMutex = new Mutex();
|
|
28916
|
+
// BUG FIX: Prevent race conditions in stdin message processing
|
|
28882
28917
|
version;
|
|
28883
28918
|
ajv;
|
|
28884
28919
|
compiledValidators = /* @__PURE__ */ new Map();
|
|
@@ -29254,7 +29289,15 @@ var McpServer = class _McpServer {
|
|
|
29254
29289
|
* v10.5.0: Capture clientInfo for Smart Routing
|
|
29255
29290
|
*/
|
|
29256
29291
|
async handleInitialize(request, id) {
|
|
29257
|
-
const clientInfo = request.params
|
|
29292
|
+
const clientInfo = request.params?.clientInfo;
|
|
29293
|
+
if (!clientInfo || typeof clientInfo.name !== "string" || typeof clientInfo.version !== "string") {
|
|
29294
|
+
logger.warn("[MCP Server] Invalid initialize request: missing or invalid clientInfo", {
|
|
29295
|
+
hasParams: !!request.params,
|
|
29296
|
+
hasClientInfo: !!clientInfo,
|
|
29297
|
+
clientInfo
|
|
29298
|
+
});
|
|
29299
|
+
return this.createErrorResponse(id, -32600 /* InvalidRequest */, "Invalid initialize request: clientInfo with name and version is required");
|
|
29300
|
+
}
|
|
29258
29301
|
logger.info("[MCP Server] Initialize request received (fast handshake mode)", { clientInfo });
|
|
29259
29302
|
this.session = {
|
|
29260
29303
|
clientInfo: {
|
|
@@ -29380,67 +29423,77 @@ ${json}`;
|
|
|
29380
29423
|
logger.info("[MCP Server] Starting stdio JSON-RPC server...");
|
|
29381
29424
|
let buffer = "";
|
|
29382
29425
|
let contentLength = null;
|
|
29383
|
-
process.stdin.on("data",
|
|
29384
|
-
|
|
29385
|
-
|
|
29386
|
-
|
|
29387
|
-
|
|
29388
|
-
|
|
29389
|
-
|
|
29390
|
-
|
|
29391
|
-
|
|
29392
|
-
|
|
29393
|
-
|
|
29394
|
-
|
|
29395
|
-
|
|
29396
|
-
iterations
|
|
29397
|
-
|
|
29398
|
-
|
|
29399
|
-
|
|
29400
|
-
|
|
29401
|
-
|
|
29402
|
-
|
|
29403
|
-
const
|
|
29404
|
-
|
|
29405
|
-
|
|
29406
|
-
|
|
29407
|
-
|
|
29408
|
-
|
|
29409
|
-
|
|
29410
|
-
|
|
29426
|
+
process.stdin.on("data", (chunk) => {
|
|
29427
|
+
void this.stdinMutex.runExclusive(async () => {
|
|
29428
|
+
buffer += chunk.toString("utf-8");
|
|
29429
|
+
if (buffer.length > STDIO_MAX_BUFFER_SIZE) {
|
|
29430
|
+
logger.error("[MCP Server] Buffer size exceeded maximum", {
|
|
29431
|
+
bufferSize: buffer.length,
|
|
29432
|
+
maxSize: STDIO_MAX_BUFFER_SIZE
|
|
29433
|
+
});
|
|
29434
|
+
buffer = "";
|
|
29435
|
+
contentLength = null;
|
|
29436
|
+
return;
|
|
29437
|
+
}
|
|
29438
|
+
let iterations = 0;
|
|
29439
|
+
while (iterations < STDIO_MAX_ITERATIONS) {
|
|
29440
|
+
iterations++;
|
|
29441
|
+
if (contentLength === null) {
|
|
29442
|
+
const delimiter2 = buffer.includes("\r\n\r\n") ? "\r\n\r\n" : buffer.includes("\n\n") ? "\n\n" : null;
|
|
29443
|
+
if (!delimiter2) break;
|
|
29444
|
+
const headerEndIndex = buffer.indexOf(delimiter2);
|
|
29445
|
+
const headerBlock = buffer.slice(0, headerEndIndex);
|
|
29446
|
+
for (const line of headerBlock.split(delimiter2 === "\r\n\r\n" ? "\r\n" : "\n")) {
|
|
29447
|
+
const [key, value] = line.split(":", 2).map((s) => s.trim());
|
|
29448
|
+
if (key && key.toLowerCase() === "content-length" && value) {
|
|
29449
|
+
contentLength = parseInt(value, 10);
|
|
29450
|
+
if (isNaN(contentLength) || contentLength <= 0 || contentLength > STDIO_MAX_MESSAGE_SIZE) {
|
|
29451
|
+
logger.error("[MCP Server] Invalid Content-Length", { contentLength });
|
|
29452
|
+
this.writeResponse({
|
|
29453
|
+
jsonrpc: "2.0",
|
|
29454
|
+
id: null,
|
|
29455
|
+
error: {
|
|
29456
|
+
code: -32600 /* InvalidRequest */,
|
|
29457
|
+
message: `Invalid Content-Length: ${contentLength}`
|
|
29458
|
+
}
|
|
29459
|
+
});
|
|
29460
|
+
buffer = buffer.slice(headerEndIndex + delimiter2.length);
|
|
29461
|
+
contentLength = null;
|
|
29462
|
+
continue;
|
|
29463
|
+
}
|
|
29411
29464
|
}
|
|
29412
29465
|
}
|
|
29413
|
-
|
|
29414
|
-
|
|
29415
|
-
|
|
29466
|
+
if (contentLength === null) {
|
|
29467
|
+
logger.error("[MCP Server] No Content-Length header found");
|
|
29468
|
+
buffer = buffer.slice(headerEndIndex + delimiter2.length);
|
|
29469
|
+
continue;
|
|
29470
|
+
}
|
|
29416
29471
|
buffer = buffer.slice(headerEndIndex + delimiter2.length);
|
|
29417
|
-
continue;
|
|
29418
29472
|
}
|
|
29419
|
-
|
|
29420
|
-
|
|
29421
|
-
|
|
29422
|
-
|
|
29423
|
-
|
|
29424
|
-
|
|
29425
|
-
|
|
29426
|
-
|
|
29427
|
-
|
|
29428
|
-
|
|
29429
|
-
|
|
29430
|
-
|
|
29431
|
-
|
|
29473
|
+
if (Buffer.byteLength(buffer, "utf-8") < contentLength) break;
|
|
29474
|
+
const messageBuffer = Buffer.from(buffer, "utf-8");
|
|
29475
|
+
const jsonMessage = messageBuffer.slice(0, contentLength).toString("utf-8");
|
|
29476
|
+
buffer = messageBuffer.slice(contentLength).toString("utf-8");
|
|
29477
|
+
contentLength = null;
|
|
29478
|
+
try {
|
|
29479
|
+
const request = JSON.parse(jsonMessage);
|
|
29480
|
+
logger.debug("[MCP Server] Request received", { method: request.method, id: request.id });
|
|
29481
|
+
const response = await this.handleRequest(request);
|
|
29482
|
+
if (request.id !== void 0 && request.id !== null) {
|
|
29483
|
+
this.writeResponse(response);
|
|
29484
|
+
}
|
|
29485
|
+
} catch (error) {
|
|
29486
|
+
logger.error("[MCP Server] Failed to parse or handle request", { jsonMessage, error });
|
|
29487
|
+
this.writeResponse({ jsonrpc: "2.0", id: null, error: { code: -32700 /* ParseError */, message: "Parse error: Invalid JSON" } });
|
|
29432
29488
|
}
|
|
29433
|
-
} catch (error) {
|
|
29434
|
-
logger.error("[MCP Server] Failed to parse or handle request", { jsonMessage, error });
|
|
29435
|
-
this.writeResponse({ jsonrpc: "2.0", id: null, error: { code: -32700 /* ParseError */, message: "Parse error: Invalid JSON" } });
|
|
29436
29489
|
}
|
|
29437
|
-
|
|
29438
|
-
|
|
29439
|
-
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
}
|
|
29443
|
-
}
|
|
29490
|
+
if (iterations >= STDIO_MAX_ITERATIONS) {
|
|
29491
|
+
logger.warn("[MCP Server] Maximum iterations reached in message processing", {
|
|
29492
|
+
iterations,
|
|
29493
|
+
bufferSize: buffer.length
|
|
29494
|
+
});
|
|
29495
|
+
}
|
|
29496
|
+
});
|
|
29444
29497
|
});
|
|
29445
29498
|
const shutdown = (reason) => {
|
|
29446
29499
|
logger.info(`[MCP Server] ${reason}`);
|
|
@@ -30331,7 +30384,7 @@ var UnifiedMCPManager = class {
|
|
|
30331
30384
|
};
|
|
30332
30385
|
this.setupProcessHandlers(config.name, childProcess, serverProcess);
|
|
30333
30386
|
this.servers.set(config.name, serverProcess);
|
|
30334
|
-
await new Promise((
|
|
30387
|
+
await new Promise((resolve13) => setTimeout(resolve13, 100));
|
|
30335
30388
|
if (childProcess.killed || childProcess.exitCode !== null) {
|
|
30336
30389
|
throw new Error(
|
|
30337
30390
|
`Server process exited immediately with code ${childProcess.exitCode}`
|
|
@@ -30354,6 +30407,14 @@ var UnifiedMCPManager = class {
|
|
|
30354
30407
|
name: config.name,
|
|
30355
30408
|
error: error.message
|
|
30356
30409
|
});
|
|
30410
|
+
const serverProcess = this.servers.get(config.name);
|
|
30411
|
+
if (serverProcess?.process && !serverProcess.process.killed) {
|
|
30412
|
+
try {
|
|
30413
|
+
serverProcess.process.kill("SIGTERM");
|
|
30414
|
+
} catch {
|
|
30415
|
+
}
|
|
30416
|
+
}
|
|
30417
|
+
this.servers.delete(config.name);
|
|
30357
30418
|
throw error;
|
|
30358
30419
|
}
|
|
30359
30420
|
}
|
|
@@ -30434,7 +30495,7 @@ var UnifiedMCPManager = class {
|
|
|
30434
30495
|
async restartServer(serverName) {
|
|
30435
30496
|
logger.info("UnifiedMCPManager: Restarting server", { name: serverName });
|
|
30436
30497
|
await this.stopServer(serverName);
|
|
30437
|
-
await new Promise((
|
|
30498
|
+
await new Promise((resolve13) => setTimeout(resolve13, 1e3));
|
|
30438
30499
|
const serverConfig = this.config.servers.find((s) => s.name === serverName);
|
|
30439
30500
|
if (!serverConfig) {
|
|
30440
30501
|
throw new Error(`Server configuration not found: ${serverName}`);
|
|
@@ -30681,31 +30742,34 @@ var UnifiedMCPManager = class {
|
|
|
30681
30742
|
this.pendingRestarts.set(serverName, restartTimer);
|
|
30682
30743
|
}
|
|
30683
30744
|
});
|
|
30684
|
-
|
|
30685
|
-
|
|
30686
|
-
|
|
30745
|
+
const shouldLog = this.config.logging?.logServerOutput;
|
|
30746
|
+
if (process2.stdout) {
|
|
30747
|
+
process2.stdout.on("data", (data) => {
|
|
30748
|
+
if (shouldLog) {
|
|
30687
30749
|
logger.debug(`MCP[${serverName}] stdout:`, {
|
|
30688
30750
|
data: data.toString().trim()
|
|
30689
30751
|
});
|
|
30690
|
-
}
|
|
30691
|
-
}
|
|
30692
|
-
|
|
30693
|
-
|
|
30752
|
+
}
|
|
30753
|
+
});
|
|
30754
|
+
}
|
|
30755
|
+
if (process2.stderr) {
|
|
30756
|
+
process2.stderr.on("data", (data) => {
|
|
30757
|
+
if (shouldLog) {
|
|
30694
30758
|
logger.debug(`MCP[${serverName}] stderr:`, {
|
|
30695
30759
|
data: data.toString().trim()
|
|
30696
30760
|
});
|
|
30697
|
-
}
|
|
30698
|
-
}
|
|
30761
|
+
}
|
|
30762
|
+
});
|
|
30699
30763
|
}
|
|
30700
30764
|
}
|
|
30701
30765
|
/**
|
|
30702
30766
|
* Wait for process to exit
|
|
30703
30767
|
*/
|
|
30704
30768
|
async waitForExit(process2, timeoutMs) {
|
|
30705
|
-
return new Promise((
|
|
30769
|
+
return new Promise((resolve13, reject) => {
|
|
30706
30770
|
const exitListener = () => {
|
|
30707
30771
|
clearTimeout(timeout);
|
|
30708
|
-
|
|
30772
|
+
resolve13();
|
|
30709
30773
|
};
|
|
30710
30774
|
const timeout = setTimeout(() => {
|
|
30711
30775
|
process2.removeListener("exit", exitListener);
|
|
@@ -30977,15 +31041,6 @@ var KNOWN_MCP_SERVERS = {
|
|
|
30977
31041
|
description: "Persistent memory storage",
|
|
30978
31042
|
tags: ["memory", "storage", "persistence"]
|
|
30979
31043
|
},
|
|
30980
|
-
brave: {
|
|
30981
|
-
command: "npx",
|
|
30982
|
-
args: ["-y", "@modelcontextprotocol/server-brave-search"],
|
|
30983
|
-
description: "Brave Search API integration",
|
|
30984
|
-
tags: ["search", "web", "brave"],
|
|
30985
|
-
env: {
|
|
30986
|
-
// BRAVE_API_KEY should be provided by user
|
|
30987
|
-
}
|
|
30988
|
-
},
|
|
30989
31044
|
puppeteer: {
|
|
30990
31045
|
command: "npx",
|
|
30991
31046
|
args: ["-y", "@modelcontextprotocol/server-puppeteer"],
|
|
@@ -31030,14 +31085,14 @@ var statusCommand2 = {
|
|
|
31030
31085
|
return yargs2.option("provider", {
|
|
31031
31086
|
alias: "p",
|
|
31032
31087
|
type: "string",
|
|
31033
|
-
description: "Filter by provider (claude, gemini, codex
|
|
31034
|
-
choices: ["claude", "gemini", "codex"
|
|
31088
|
+
description: "Filter by provider (claude, gemini, codex)",
|
|
31089
|
+
choices: ["claude", "gemini", "codex"]
|
|
31035
31090
|
}).option("json", {
|
|
31036
31091
|
alias: "j",
|
|
31037
31092
|
type: "boolean",
|
|
31038
31093
|
description: "Output as JSON",
|
|
31039
31094
|
default: false
|
|
31040
|
-
}).example("$0 mcp status", "Show all MCP servers").example("$0 mcp status --provider
|
|
31095
|
+
}).example("$0 mcp status", "Show all MCP servers").example("$0 mcp status --provider gemini", "Show Gemini MCP servers only").example("$0 mcp status --json", "Output as JSON");
|
|
31041
31096
|
},
|
|
31042
31097
|
handler: async (argv) => {
|
|
31043
31098
|
try {
|
|
@@ -31059,7 +31114,7 @@ var statusCommand2 = {
|
|
|
31059
31114
|
if (allStatuses.length === 0) {
|
|
31060
31115
|
console.log(chalk5.yellow("No MCP servers running"));
|
|
31061
31116
|
console.log(chalk5.gray("\nTo enable MCP servers, configure them in your provider YAML files."));
|
|
31062
|
-
console.log(chalk5.gray("See: examples/providers/
|
|
31117
|
+
console.log(chalk5.gray("See: examples/providers/ for MCP configuration templates\n"));
|
|
31063
31118
|
return;
|
|
31064
31119
|
}
|
|
31065
31120
|
const table = new Table({
|
|
@@ -31107,7 +31162,7 @@ var healthCommand = {
|
|
|
31107
31162
|
alias: "p",
|
|
31108
31163
|
type: "string",
|
|
31109
31164
|
description: "Filter by provider",
|
|
31110
|
-
choices: ["claude", "gemini", "codex"
|
|
31165
|
+
choices: ["claude", "gemini", "codex"]
|
|
31111
31166
|
}).option("json", {
|
|
31112
31167
|
alias: "j",
|
|
31113
31168
|
type: "boolean",
|
|
@@ -31186,13 +31241,13 @@ var toolsCommand = {
|
|
|
31186
31241
|
alias: "p",
|
|
31187
31242
|
type: "string",
|
|
31188
31243
|
description: "Filter by provider",
|
|
31189
|
-
choices: ["claude", "gemini", "codex"
|
|
31244
|
+
choices: ["claude", "gemini", "codex"]
|
|
31190
31245
|
}).option("json", {
|
|
31191
31246
|
alias: "j",
|
|
31192
31247
|
type: "boolean",
|
|
31193
31248
|
description: "Output as JSON",
|
|
31194
31249
|
default: false
|
|
31195
|
-
}).example("$0 mcp tools", "List all available tools").example("$0 mcp tools --provider
|
|
31250
|
+
}).example("$0 mcp tools", "List all available tools").example("$0 mcp tools --provider gemini", "List Gemini tools only");
|
|
31196
31251
|
},
|
|
31197
31252
|
handler: async (argv) => {
|
|
31198
31253
|
try {
|
|
@@ -31328,7 +31383,7 @@ function checkIfInstalled(packageName) {
|
|
|
31328
31383
|
// src/cli/commands/memory.ts
|
|
31329
31384
|
init_esm_shims();
|
|
31330
31385
|
|
|
31331
|
-
// src/
|
|
31386
|
+
// src/shared/logging/progress.ts
|
|
31332
31387
|
init_esm_shims();
|
|
31333
31388
|
var ProgressIndicator = class {
|
|
31334
31389
|
spinner = null;
|
|
@@ -31760,8 +31815,8 @@ var deleteCommand = {
|
|
|
31760
31815
|
input: process.stdin,
|
|
31761
31816
|
output: process.stdout
|
|
31762
31817
|
});
|
|
31763
|
-
const answer = await new Promise((
|
|
31764
|
-
rl.question(chalk5.yellow("\nAre you sure you want to delete this entry? (y/N): "),
|
|
31818
|
+
const answer = await new Promise((resolve13) => {
|
|
31819
|
+
rl.question(chalk5.yellow("\nAre you sure you want to delete this entry? (y/N): "), resolve13);
|
|
31765
31820
|
});
|
|
31766
31821
|
rl.close();
|
|
31767
31822
|
if (answer.toLowerCase() !== "y" && answer.toLowerCase() !== "yes") {
|
|
@@ -32227,7 +32282,7 @@ var AgentSelector = class {
|
|
|
32227
32282
|
// src/core/stage-execution-controller.ts
|
|
32228
32283
|
init_esm_shims();
|
|
32229
32284
|
|
|
32230
|
-
// src/core/checkpoint
|
|
32285
|
+
// src/core/session/checkpoint.ts
|
|
32231
32286
|
init_esm_shims();
|
|
32232
32287
|
var CURRENT_SCHEMA_VERSION = "1.0.0";
|
|
32233
32288
|
var CheckpointValidationError = class extends Error {
|
|
@@ -32721,7 +32776,7 @@ ${this.config.locale === "zh" ? "\u8ACB\u9078\u64C7" : "Select"}${defaultDisplay
|
|
|
32721
32776
|
async promptWithTimeout(prompt, parser, defaultValue) {
|
|
32722
32777
|
const rl = this.getReadline();
|
|
32723
32778
|
const template = this.getTemplate();
|
|
32724
|
-
return new Promise((
|
|
32779
|
+
return new Promise((resolve13) => {
|
|
32725
32780
|
let resolved = false;
|
|
32726
32781
|
let timeoutHandle;
|
|
32727
32782
|
let warningHandle;
|
|
@@ -32735,7 +32790,7 @@ ${this.config.locale === "zh" ? "\u8ACB\u9078\u64C7" : "Select"}${defaultDisplay
|
|
|
32735
32790
|
${template.timedOut}`);
|
|
32736
32791
|
rl.close();
|
|
32737
32792
|
this.rl = null;
|
|
32738
|
-
|
|
32793
|
+
resolve13({
|
|
32739
32794
|
value: defaultValue,
|
|
32740
32795
|
timedOut: true
|
|
32741
32796
|
});
|
|
@@ -32759,7 +32814,7 @@ ${template.timeoutWarning(30)}`);
|
|
|
32759
32814
|
clearTimeout(warningHandle);
|
|
32760
32815
|
}
|
|
32761
32816
|
const value = parser(answer);
|
|
32762
|
-
|
|
32817
|
+
resolve13({
|
|
32763
32818
|
value,
|
|
32764
32819
|
timedOut: false
|
|
32765
32820
|
});
|
|
@@ -33841,9 +33896,9 @@ ${action.modifications}`;
|
|
|
33841
33896
|
)
|
|
33842
33897
|
);
|
|
33843
33898
|
console.log(chalk5.gray(` Waiting ${delay}ms before retry...`));
|
|
33844
|
-
await new Promise((
|
|
33899
|
+
await new Promise((resolve13) => setTimeout(resolve13, delay));
|
|
33845
33900
|
} else {
|
|
33846
|
-
await new Promise((
|
|
33901
|
+
await new Promise((resolve13) => setTimeout(resolve13, delay));
|
|
33847
33902
|
}
|
|
33848
33903
|
}
|
|
33849
33904
|
const executionOptions = {
|
|
@@ -34277,7 +34332,7 @@ init_gemini_provider();
|
|
|
34277
34332
|
init_openai_provider_factory();
|
|
34278
34333
|
init_logger();
|
|
34279
34334
|
|
|
34280
|
-
// src/
|
|
34335
|
+
// src/shared/helpers/agent-status-writer.ts
|
|
34281
34336
|
init_esm_shims();
|
|
34282
34337
|
init_logger();
|
|
34283
34338
|
async function writeAgentStatus(status, projectDir = process.cwd()) {
|
|
@@ -36064,7 +36119,7 @@ var IterateStatusRenderer = class {
|
|
|
36064
36119
|
// src/cli/commands/run.ts
|
|
36065
36120
|
init_verbosity_manager();
|
|
36066
36121
|
|
|
36067
|
-
// src/
|
|
36122
|
+
// src/shared/logging/output-formatter.ts
|
|
36068
36123
|
init_esm_shims();
|
|
36069
36124
|
function formatOutput(result, format, verbose = false) {
|
|
36070
36125
|
switch (format) {
|
|
@@ -36810,12 +36865,12 @@ Result: ${result.stages.map((s) => s.output).join("\n\n")}`;
|
|
|
36810
36865
|
let iterateHooks;
|
|
36811
36866
|
if (argv.iterate || argv.autoContinue) {
|
|
36812
36867
|
if (argv.iterateMaxCost !== void 0) {
|
|
36813
|
-
console.log(chalk5.yellow("\n\u26A0\uFE0F Warning: --iterate-max-cost is deprecated and will be removed in
|
|
36868
|
+
console.log(chalk5.yellow("\n\u26A0\uFE0F Warning: --iterate-max-cost is deprecated and will be removed in a future version"));
|
|
36814
36869
|
console.log(chalk5.yellow(" Reason: Provider pricing changes frequently, making cost estimates unreliable\n"));
|
|
36815
36870
|
console.log(chalk5.cyan(" Please use --iterate-max-tokens instead:"));
|
|
36816
36871
|
console.log(chalk5.cyan(` ax run ${resolvedAgentName} "${actualTask}" --iterate --iterate-max-tokens 1000000
|
|
36817
36872
|
`));
|
|
36818
|
-
console.log(chalk5.gray(" Learn more: https://
|
|
36873
|
+
console.log(chalk5.gray(" Learn more: https://github.com/defai-digital/automatosx/blob/main/docs/migration/cost-to-tokens.md\n"));
|
|
36819
36874
|
}
|
|
36820
36875
|
const maxTokens = argv.iterateMaxTokens || 1e6;
|
|
36821
36876
|
const maxTokensPerIteration = argv.iterateMaxTokensPerIteration || 1e5;
|
|
@@ -36980,7 +37035,7 @@ Result: ${result.stages.map((s) => s.output).join("\n\n")}`;
|
|
|
36980
37035
|
if (argv.save) {
|
|
36981
37036
|
try {
|
|
36982
37037
|
const savePath = argv.save;
|
|
36983
|
-
const saveDir =
|
|
37038
|
+
const saveDir = dirname(savePath);
|
|
36984
37039
|
await mkdir(saveDir, { recursive: true });
|
|
36985
37040
|
const outputData = formatForSave(result, argv.format || "text", {
|
|
36986
37041
|
agent: resolvedAgentName,
|
|
@@ -37028,7 +37083,7 @@ Response: ${result.response.content}`;
|
|
|
37028
37083
|
if (router) {
|
|
37029
37084
|
router.destroy();
|
|
37030
37085
|
}
|
|
37031
|
-
await new Promise((
|
|
37086
|
+
await new Promise((resolve13) => setImmediate(resolve13));
|
|
37032
37087
|
if (!verbosity.isQuiet()) {
|
|
37033
37088
|
const executionTime = ((Date.now() - executionStartTime) / 1e3).toFixed(1);
|
|
37034
37089
|
if (verbosity.isNormal()) {
|
|
@@ -37095,7 +37150,7 @@ Response: ${result.response.content}`;
|
|
|
37095
37150
|
logger.debug("Context cleanup error", { error: errMsg });
|
|
37096
37151
|
});
|
|
37097
37152
|
}
|
|
37098
|
-
await new Promise((
|
|
37153
|
+
await new Promise((resolve13) => setImmediate(resolve13));
|
|
37099
37154
|
try {
|
|
37100
37155
|
const { processManager: processManager2 } = await Promise.resolve().then(() => (init_process_manager(), process_manager_exports));
|
|
37101
37156
|
await processManager2.shutdown(3e3);
|
|
@@ -37927,7 +37982,7 @@ var updateCommand = {
|
|
|
37927
37982
|
describe: "Skip confirmation prompt",
|
|
37928
37983
|
type: "boolean",
|
|
37929
37984
|
default: false
|
|
37930
|
-
}).example("
|
|
37985
|
+
}).example("$0 update", "Check and install latest version").example("$0 update --check", "Only check for updates").example("$0 update --yes", "Update without confirmation");
|
|
37931
37986
|
},
|
|
37932
37987
|
handler: async (argv) => {
|
|
37933
37988
|
console.log(chalk5.blue.bold("\n\u{1F504} AutomatosX Update Checker\n"));
|
|
@@ -37994,11 +38049,11 @@ async function getCurrentVersion() {
|
|
|
37994
38049
|
return result.dependencies["@defai.digital/automatosx"]?.version || "unknown";
|
|
37995
38050
|
} catch (error) {
|
|
37996
38051
|
const { readFile: readFile24 } = await import('fs/promises');
|
|
37997
|
-
const { dirname:
|
|
37998
|
-
const { fileURLToPath:
|
|
37999
|
-
const
|
|
38000
|
-
const
|
|
38001
|
-
const pkgPath =
|
|
38052
|
+
const { dirname: dirname14, join: join49 } = await import('path');
|
|
38053
|
+
const { fileURLToPath: fileURLToPath5 } = await import('url');
|
|
38054
|
+
const __filename3 = fileURLToPath5(import.meta.url);
|
|
38055
|
+
const __dirname4 = dirname14(__filename3);
|
|
38056
|
+
const pkgPath = join49(__dirname4, "../../../package.json");
|
|
38002
38057
|
const content = await readFile24(pkgPath, "utf-8");
|
|
38003
38058
|
const pkg = JSON.parse(content);
|
|
38004
38059
|
return pkg.version;
|
|
@@ -38152,16 +38207,22 @@ var cleanupCommand = {
|
|
|
38152
38207
|
},
|
|
38153
38208
|
handler: async (argv) => {
|
|
38154
38209
|
try {
|
|
38210
|
+
const olderThan = argv.olderThan ?? 7;
|
|
38211
|
+
if (isNaN(olderThan) || olderThan < 0) {
|
|
38212
|
+
console.error(chalk5.red.bold("\n\u2717 Invalid --older-than value\n"));
|
|
38213
|
+
console.error(chalk5.red("Value must be a non-negative number (days)"));
|
|
38214
|
+
process.exit(1);
|
|
38215
|
+
}
|
|
38155
38216
|
const { detectProjectRoot: detectProjectRoot2 } = await Promise.resolve().then(() => (init_path_resolver(), path_resolver_exports));
|
|
38156
38217
|
const projectDir = await detectProjectRoot2(process.cwd());
|
|
38157
38218
|
const workspaceManager = new WorkspaceManager(projectDir);
|
|
38158
38219
|
if (!argv.confirm) {
|
|
38159
38220
|
console.log(chalk5.yellow(`
|
|
38160
|
-
\u26A0 This will remove temporary files older than ${
|
|
38221
|
+
\u26A0 This will remove temporary files older than ${olderThan} days`));
|
|
38161
38222
|
console.log(chalk5.gray("Run with --confirm to proceed\n"));
|
|
38162
38223
|
process.exit(0);
|
|
38163
38224
|
}
|
|
38164
|
-
const removed = await workspaceManager.cleanupTmp(
|
|
38225
|
+
const removed = await workspaceManager.cleanupTmp(olderThan);
|
|
38165
38226
|
console.log(chalk5.green.bold(`
|
|
38166
38227
|
\u2713 Cleanup complete
|
|
38167
38228
|
`));
|
|
@@ -38190,7 +38251,11 @@ init_esm_shims();
|
|
|
38190
38251
|
|
|
38191
38252
|
// src/cli/commands/agent/templates.ts
|
|
38192
38253
|
init_esm_shims();
|
|
38193
|
-
|
|
38254
|
+
|
|
38255
|
+
// src/cli/commands/agent/helpers.ts
|
|
38256
|
+
init_esm_shims();
|
|
38257
|
+
init_logger();
|
|
38258
|
+
var BUILTIN_TEMPLATE_METADATA = {
|
|
38194
38259
|
"basic-agent": {
|
|
38195
38260
|
name: "basic-agent",
|
|
38196
38261
|
team: "core",
|
|
@@ -38217,6 +38282,161 @@ var TEMPLATE_DESCRIPTIONS = {
|
|
|
38217
38282
|
description: "QA specialist (test planning, automation, quality)"
|
|
38218
38283
|
}
|
|
38219
38284
|
};
|
|
38285
|
+
async function listAvailableTemplates(baseDir) {
|
|
38286
|
+
const templates = [];
|
|
38287
|
+
const projectDir = process.cwd();
|
|
38288
|
+
const projectTemplatesDir = join(projectDir, ".automatosx", "templates");
|
|
38289
|
+
if (existsSync(projectTemplatesDir)) {
|
|
38290
|
+
try {
|
|
38291
|
+
const files = await readdir(projectTemplatesDir);
|
|
38292
|
+
for (const file of files) {
|
|
38293
|
+
if (extname$1(file) === ".yaml" || extname$1(file) === ".yml") {
|
|
38294
|
+
const name = file.replace(/\.(yaml|yml)$/, "");
|
|
38295
|
+
templates.push({
|
|
38296
|
+
name,
|
|
38297
|
+
path: join(projectTemplatesDir, file),
|
|
38298
|
+
description: "Custom template"
|
|
38299
|
+
});
|
|
38300
|
+
}
|
|
38301
|
+
}
|
|
38302
|
+
} catch (error) {
|
|
38303
|
+
logger.debug("Failed to read project templates", { error });
|
|
38304
|
+
}
|
|
38305
|
+
}
|
|
38306
|
+
const packageRoot = getPackageRoot();
|
|
38307
|
+
const builtinTemplatesDir = join(packageRoot, "examples/workflows");
|
|
38308
|
+
if (existsSync(builtinTemplatesDir)) {
|
|
38309
|
+
try {
|
|
38310
|
+
const files = await readdir(builtinTemplatesDir);
|
|
38311
|
+
for (const file of files) {
|
|
38312
|
+
if (extname$1(file) === ".yaml" || extname$1(file) === ".yml") {
|
|
38313
|
+
const name = file.replace(/\.(yaml|yml)$/, "");
|
|
38314
|
+
if (templates.find((t) => t.name === name)) {
|
|
38315
|
+
continue;
|
|
38316
|
+
}
|
|
38317
|
+
const metadata = BUILTIN_TEMPLATE_METADATA[name];
|
|
38318
|
+
templates.push({
|
|
38319
|
+
name,
|
|
38320
|
+
path: join(builtinTemplatesDir, file),
|
|
38321
|
+
description: metadata?.description || "Built-in template",
|
|
38322
|
+
team: metadata?.team
|
|
38323
|
+
});
|
|
38324
|
+
}
|
|
38325
|
+
}
|
|
38326
|
+
} catch (error) {
|
|
38327
|
+
logger.debug("Failed to read built-in templates", { error });
|
|
38328
|
+
}
|
|
38329
|
+
}
|
|
38330
|
+
return templates.sort((a, b) => a.name.localeCompare(b.name));
|
|
38331
|
+
}
|
|
38332
|
+
async function listAvailableTeams(baseDir) {
|
|
38333
|
+
const projectDir = process.cwd();
|
|
38334
|
+
const teamsDir = join(projectDir, ".automatosx", "teams");
|
|
38335
|
+
const teamManager = new TeamManager(teamsDir);
|
|
38336
|
+
try {
|
|
38337
|
+
const teamNames = await teamManager.listTeams();
|
|
38338
|
+
const teams = [];
|
|
38339
|
+
for (const name of teamNames) {
|
|
38340
|
+
try {
|
|
38341
|
+
const teamConfig = await teamManager.loadTeam(name);
|
|
38342
|
+
teams.push({
|
|
38343
|
+
name: teamConfig.name,
|
|
38344
|
+
displayName: teamConfig.displayName || teamConfig.name,
|
|
38345
|
+
description: teamConfig.description
|
|
38346
|
+
});
|
|
38347
|
+
} catch (error) {
|
|
38348
|
+
teams.push({
|
|
38349
|
+
name,
|
|
38350
|
+
displayName: name,
|
|
38351
|
+
description: void 0
|
|
38352
|
+
});
|
|
38353
|
+
}
|
|
38354
|
+
}
|
|
38355
|
+
return teams.sort((a, b) => a.name.localeCompare(b.name));
|
|
38356
|
+
} catch (error) {
|
|
38357
|
+
logger.warn("Failed to list teams, using defaults", { error });
|
|
38358
|
+
return [
|
|
38359
|
+
{ name: "core", displayName: "Core Team", description: "Quality assurance, core functions" },
|
|
38360
|
+
{ name: "engineering", displayName: "Engineering Team", description: "Software development" },
|
|
38361
|
+
{ name: "business", displayName: "Business Team", description: "Business analysis, product" },
|
|
38362
|
+
{ name: "design", displayName: "Design Team", description: "UI/UX design" }
|
|
38363
|
+
];
|
|
38364
|
+
}
|
|
38365
|
+
}
|
|
38366
|
+
function isValidAgentName(name) {
|
|
38367
|
+
if (!name || typeof name !== "string") {
|
|
38368
|
+
return { valid: false, error: "Agent name is required" };
|
|
38369
|
+
}
|
|
38370
|
+
if (name.length < 2) {
|
|
38371
|
+
return { valid: false, error: "Agent name must be at least 2 characters" };
|
|
38372
|
+
}
|
|
38373
|
+
if (name.length > 50) {
|
|
38374
|
+
return { valid: false, error: "Agent name must be at most 50 characters" };
|
|
38375
|
+
}
|
|
38376
|
+
if (!/^[a-z]/.test(name)) {
|
|
38377
|
+
return { valid: false, error: "Agent name must start with a lowercase letter" };
|
|
38378
|
+
}
|
|
38379
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
38380
|
+
return {
|
|
38381
|
+
valid: false,
|
|
38382
|
+
error: "Agent name must contain only lowercase letters, numbers, and hyphens"
|
|
38383
|
+
};
|
|
38384
|
+
}
|
|
38385
|
+
if (/--/.test(name)) {
|
|
38386
|
+
return { valid: false, error: "Agent name cannot contain consecutive hyphens" };
|
|
38387
|
+
}
|
|
38388
|
+
if (name.endsWith("-")) {
|
|
38389
|
+
return { valid: false, error: "Agent name cannot end with a hyphen" };
|
|
38390
|
+
}
|
|
38391
|
+
return { valid: true };
|
|
38392
|
+
}
|
|
38393
|
+
async function checkDisplayNameConflict(displayName, excludeAgentName, baseDir) {
|
|
38394
|
+
if (!displayName) {
|
|
38395
|
+
return void 0;
|
|
38396
|
+
}
|
|
38397
|
+
const projectDir = process.cwd();
|
|
38398
|
+
const agentsDir = join(projectDir, ".automatosx", "agents");
|
|
38399
|
+
const profileLoader = new ProfileLoader(agentsDir);
|
|
38400
|
+
try {
|
|
38401
|
+
const allProfiles = await profileLoader.listProfiles();
|
|
38402
|
+
for (const profileName of allProfiles) {
|
|
38403
|
+
if (excludeAgentName && profileName === excludeAgentName) ;
|
|
38404
|
+
try {
|
|
38405
|
+
const profile = await profileLoader.loadProfile(profileName);
|
|
38406
|
+
if (profile.displayName?.toLowerCase() === displayName.toLowerCase()) {
|
|
38407
|
+
return profileName;
|
|
38408
|
+
}
|
|
38409
|
+
} catch (error) {
|
|
38410
|
+
logger.debug("Failed to load profile for displayName check", {
|
|
38411
|
+
profile: profileName,
|
|
38412
|
+
error
|
|
38413
|
+
});
|
|
38414
|
+
}
|
|
38415
|
+
}
|
|
38416
|
+
return void 0;
|
|
38417
|
+
} catch (error) {
|
|
38418
|
+
logger.warn("Failed to check displayName conflicts", { error });
|
|
38419
|
+
return void 0;
|
|
38420
|
+
}
|
|
38421
|
+
}
|
|
38422
|
+
function suggestValidAgentName(input) {
|
|
38423
|
+
let suggestion = input.toLowerCase();
|
|
38424
|
+
suggestion = suggestion.replace(/[^a-z0-9-]/g, "-");
|
|
38425
|
+
suggestion = suggestion.replace(/-+/g, "-");
|
|
38426
|
+
suggestion = suggestion.replace(/^-+|-+$/g, "");
|
|
38427
|
+
if (suggestion.length < 2) {
|
|
38428
|
+
return "agent";
|
|
38429
|
+
}
|
|
38430
|
+
if (!/^[a-z]/.test(suggestion)) {
|
|
38431
|
+
suggestion = "agent-" + suggestion;
|
|
38432
|
+
}
|
|
38433
|
+
if (suggestion.length > 50) {
|
|
38434
|
+
suggestion = suggestion.substring(0, 50).replace(/-+$/, "");
|
|
38435
|
+
}
|
|
38436
|
+
return suggestion;
|
|
38437
|
+
}
|
|
38438
|
+
|
|
38439
|
+
// src/cli/commands/agent/templates.ts
|
|
38220
38440
|
var templatesCommand = {
|
|
38221
38441
|
command: "templates",
|
|
38222
38442
|
describe: "List available agent templates",
|
|
@@ -38225,7 +38445,8 @@ var templatesCommand = {
|
|
|
38225
38445
|
console.log(chalk5.blue.bold("\n\u{1F4CB} Available Agent Templates\n"));
|
|
38226
38446
|
const projectTemplatesDir = join(process.cwd(), ".automatosx", "templates");
|
|
38227
38447
|
const hasProjectTemplates = existsSync(projectTemplatesDir);
|
|
38228
|
-
const
|
|
38448
|
+
const packageRoot = getPackageRoot();
|
|
38449
|
+
const defaultTemplatesDir = join(packageRoot, "examples/workflows");
|
|
38229
38450
|
const hasDefaultTemplates = existsSync(defaultTemplatesDir);
|
|
38230
38451
|
if (!hasProjectTemplates && !hasDefaultTemplates) {
|
|
38231
38452
|
console.log(chalk5.yellow("\u26A0 No templates found."));
|
|
@@ -38249,7 +38470,7 @@ var templatesCommand = {
|
|
|
38249
38470
|
design: []
|
|
38250
38471
|
};
|
|
38251
38472
|
templates.forEach((template) => {
|
|
38252
|
-
const info =
|
|
38473
|
+
const info = BUILTIN_TEMPLATE_METADATA[template] || {
|
|
38253
38474
|
name: template,
|
|
38254
38475
|
team: "core",
|
|
38255
38476
|
description: "Custom template"
|
|
@@ -38415,169 +38636,6 @@ var TemplateEngine = class _TemplateEngine {
|
|
|
38415
38636
|
}
|
|
38416
38637
|
};
|
|
38417
38638
|
|
|
38418
|
-
// src/cli/commands/agent/helpers.ts
|
|
38419
|
-
init_esm_shims();
|
|
38420
|
-
init_logger();
|
|
38421
|
-
var __filename5 = fileURLToPath(import.meta.url);
|
|
38422
|
-
var __dirname6 = dirname(__filename5);
|
|
38423
|
-
async function listAvailableTemplates(baseDir) {
|
|
38424
|
-
const templates = [];
|
|
38425
|
-
const projectDir = process.cwd();
|
|
38426
|
-
const projectTemplatesDir = join(projectDir, ".automatosx", "templates");
|
|
38427
|
-
if (existsSync(projectTemplatesDir)) {
|
|
38428
|
-
try {
|
|
38429
|
-
const files = await readdir(projectTemplatesDir);
|
|
38430
|
-
for (const file of files) {
|
|
38431
|
-
if (extname$1(file) === ".yaml" || extname$1(file) === ".yml") {
|
|
38432
|
-
const name = file.replace(/\.(yaml|yml)$/, "");
|
|
38433
|
-
templates.push({
|
|
38434
|
-
name,
|
|
38435
|
-
path: join(projectTemplatesDir, file),
|
|
38436
|
-
description: "Custom template"
|
|
38437
|
-
});
|
|
38438
|
-
}
|
|
38439
|
-
}
|
|
38440
|
-
} catch (error) {
|
|
38441
|
-
logger.debug("Failed to read project templates", { error });
|
|
38442
|
-
}
|
|
38443
|
-
}
|
|
38444
|
-
const builtinTemplatesDir = join(__dirname6, "../../../../examples/templates");
|
|
38445
|
-
if (existsSync(builtinTemplatesDir)) {
|
|
38446
|
-
try {
|
|
38447
|
-
const files = await readdir(builtinTemplatesDir);
|
|
38448
|
-
for (const file of files) {
|
|
38449
|
-
if (extname$1(file) === ".yaml" || extname$1(file) === ".yml") {
|
|
38450
|
-
const name = file.replace(/\.(yaml|yml)$/, "");
|
|
38451
|
-
if (templates.find((t) => t.name === name)) {
|
|
38452
|
-
continue;
|
|
38453
|
-
}
|
|
38454
|
-
const descriptions = {
|
|
38455
|
-
"basic-agent": "Basic agent (core team)",
|
|
38456
|
-
"developer": "Software developer (engineering)",
|
|
38457
|
-
"analyst": "Business analyst (business)",
|
|
38458
|
-
"designer": "UI/UX designer (design)",
|
|
38459
|
-
"qa-specialist": "QA specialist (core)"
|
|
38460
|
-
};
|
|
38461
|
-
templates.push({
|
|
38462
|
-
name,
|
|
38463
|
-
path: join(builtinTemplatesDir, file),
|
|
38464
|
-
description: descriptions[name] || "Built-in template"
|
|
38465
|
-
});
|
|
38466
|
-
}
|
|
38467
|
-
}
|
|
38468
|
-
} catch (error) {
|
|
38469
|
-
logger.debug("Failed to read built-in templates", { error });
|
|
38470
|
-
}
|
|
38471
|
-
}
|
|
38472
|
-
return templates.sort((a, b) => a.name.localeCompare(b.name));
|
|
38473
|
-
}
|
|
38474
|
-
async function listAvailableTeams(baseDir) {
|
|
38475
|
-
const projectDir = process.cwd();
|
|
38476
|
-
const teamsDir = join(projectDir, ".automatosx", "teams");
|
|
38477
|
-
const teamManager = new TeamManager(teamsDir);
|
|
38478
|
-
try {
|
|
38479
|
-
const teamNames = await teamManager.listTeams();
|
|
38480
|
-
const teams = [];
|
|
38481
|
-
for (const name of teamNames) {
|
|
38482
|
-
try {
|
|
38483
|
-
const teamConfig = await teamManager.loadTeam(name);
|
|
38484
|
-
teams.push({
|
|
38485
|
-
name: teamConfig.name,
|
|
38486
|
-
displayName: teamConfig.displayName || teamConfig.name,
|
|
38487
|
-
description: teamConfig.description
|
|
38488
|
-
});
|
|
38489
|
-
} catch (error) {
|
|
38490
|
-
teams.push({
|
|
38491
|
-
name,
|
|
38492
|
-
displayName: name,
|
|
38493
|
-
description: void 0
|
|
38494
|
-
});
|
|
38495
|
-
}
|
|
38496
|
-
}
|
|
38497
|
-
return teams.sort((a, b) => a.name.localeCompare(b.name));
|
|
38498
|
-
} catch (error) {
|
|
38499
|
-
logger.warn("Failed to list teams, using defaults", { error });
|
|
38500
|
-
return [
|
|
38501
|
-
{ name: "core", displayName: "Core Team", description: "Quality assurance, core functions" },
|
|
38502
|
-
{ name: "engineering", displayName: "Engineering Team", description: "Software development" },
|
|
38503
|
-
{ name: "business", displayName: "Business Team", description: "Business analysis, product" },
|
|
38504
|
-
{ name: "design", displayName: "Design Team", description: "UI/UX design" }
|
|
38505
|
-
];
|
|
38506
|
-
}
|
|
38507
|
-
}
|
|
38508
|
-
function isValidAgentName(name) {
|
|
38509
|
-
if (!name || typeof name !== "string") {
|
|
38510
|
-
return { valid: false, error: "Agent name is required" };
|
|
38511
|
-
}
|
|
38512
|
-
if (name.length < 2) {
|
|
38513
|
-
return { valid: false, error: "Agent name must be at least 2 characters" };
|
|
38514
|
-
}
|
|
38515
|
-
if (name.length > 50) {
|
|
38516
|
-
return { valid: false, error: "Agent name must be at most 50 characters" };
|
|
38517
|
-
}
|
|
38518
|
-
if (!/^[a-z]/.test(name)) {
|
|
38519
|
-
return { valid: false, error: "Agent name must start with a lowercase letter" };
|
|
38520
|
-
}
|
|
38521
|
-
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
38522
|
-
return {
|
|
38523
|
-
valid: false,
|
|
38524
|
-
error: "Agent name must contain only lowercase letters, numbers, and hyphens"
|
|
38525
|
-
};
|
|
38526
|
-
}
|
|
38527
|
-
if (/--/.test(name)) {
|
|
38528
|
-
return { valid: false, error: "Agent name cannot contain consecutive hyphens" };
|
|
38529
|
-
}
|
|
38530
|
-
if (name.endsWith("-")) {
|
|
38531
|
-
return { valid: false, error: "Agent name cannot end with a hyphen" };
|
|
38532
|
-
}
|
|
38533
|
-
return { valid: true };
|
|
38534
|
-
}
|
|
38535
|
-
async function checkDisplayNameConflict(displayName, excludeAgentName, baseDir) {
|
|
38536
|
-
if (!displayName) {
|
|
38537
|
-
return void 0;
|
|
38538
|
-
}
|
|
38539
|
-
const projectDir = process.cwd();
|
|
38540
|
-
const agentsDir = join(projectDir, ".automatosx", "agents");
|
|
38541
|
-
const profileLoader = new ProfileLoader(agentsDir);
|
|
38542
|
-
try {
|
|
38543
|
-
const allProfiles = await profileLoader.listProfiles();
|
|
38544
|
-
for (const profileName of allProfiles) {
|
|
38545
|
-
if (excludeAgentName && profileName === excludeAgentName) ;
|
|
38546
|
-
try {
|
|
38547
|
-
const profile = await profileLoader.loadProfile(profileName);
|
|
38548
|
-
if (profile.displayName?.toLowerCase() === displayName.toLowerCase()) {
|
|
38549
|
-
return profileName;
|
|
38550
|
-
}
|
|
38551
|
-
} catch (error) {
|
|
38552
|
-
logger.debug("Failed to load profile for displayName check", {
|
|
38553
|
-
profile: profileName,
|
|
38554
|
-
error
|
|
38555
|
-
});
|
|
38556
|
-
}
|
|
38557
|
-
}
|
|
38558
|
-
return void 0;
|
|
38559
|
-
} catch (error) {
|
|
38560
|
-
logger.warn("Failed to check displayName conflicts", { error });
|
|
38561
|
-
return void 0;
|
|
38562
|
-
}
|
|
38563
|
-
}
|
|
38564
|
-
function suggestValidAgentName(input) {
|
|
38565
|
-
let suggestion = input.toLowerCase();
|
|
38566
|
-
suggestion = suggestion.replace(/[^a-z0-9-]/g, "-");
|
|
38567
|
-
suggestion = suggestion.replace(/-+/g, "-");
|
|
38568
|
-
suggestion = suggestion.replace(/^-+|-+$/g, "");
|
|
38569
|
-
if (suggestion.length < 2) {
|
|
38570
|
-
return "agent";
|
|
38571
|
-
}
|
|
38572
|
-
if (!/^[a-z]/.test(suggestion)) {
|
|
38573
|
-
suggestion = "agent-" + suggestion;
|
|
38574
|
-
}
|
|
38575
|
-
if (suggestion.length > 50) {
|
|
38576
|
-
suggestion = suggestion.substring(0, 50).replace(/-+$/, "");
|
|
38577
|
-
}
|
|
38578
|
-
return suggestion;
|
|
38579
|
-
}
|
|
38580
|
-
|
|
38581
38639
|
// src/cli/commands/agent/create.ts
|
|
38582
38640
|
var createCommand2 = {
|
|
38583
38641
|
command: "create <agent>",
|
|
@@ -38724,7 +38782,8 @@ async function findTemplate(name) {
|
|
|
38724
38782
|
if (existsSync(projectTemplate)) {
|
|
38725
38783
|
return projectTemplate;
|
|
38726
38784
|
}
|
|
38727
|
-
const
|
|
38785
|
+
const packageRoot = getPackageRoot();
|
|
38786
|
+
const defaultTemplate = join(packageRoot, "examples/workflows", `${name}.yaml`);
|
|
38728
38787
|
if (existsSync(defaultTemplate)) {
|
|
38729
38788
|
return defaultTemplate;
|
|
38730
38789
|
}
|
|
@@ -39436,7 +39495,7 @@ var resumeCommand = {
|
|
|
39436
39495
|
if (router) {
|
|
39437
39496
|
router.destroy();
|
|
39438
39497
|
}
|
|
39439
|
-
await new Promise((
|
|
39498
|
+
await new Promise((resolve13) => setImmediate(resolve13));
|
|
39440
39499
|
console.log(chalk5.green.bold("\u2705 Complete\n"));
|
|
39441
39500
|
process.exit(0);
|
|
39442
39501
|
} catch (error) {
|
|
@@ -39456,7 +39515,7 @@ var resumeCommand = {
|
|
|
39456
39515
|
if (router) {
|
|
39457
39516
|
router.destroy();
|
|
39458
39517
|
}
|
|
39459
|
-
await new Promise((
|
|
39518
|
+
await new Promise((resolve13) => setImmediate(resolve13));
|
|
39460
39519
|
} catch (cleanupError) {
|
|
39461
39520
|
const errMsg = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
|
|
39462
39521
|
logger.debug("Cleanup error ignored", { error: errMsg });
|
|
@@ -41747,7 +41806,7 @@ var doctorCommand = {
|
|
|
41747
41806
|
}
|
|
41748
41807
|
}
|
|
41749
41808
|
async function checkCLIVersion() {
|
|
41750
|
-
return new Promise((
|
|
41809
|
+
return new Promise((resolve13) => {
|
|
41751
41810
|
const child = spawn("gemini", ["--version"], {
|
|
41752
41811
|
stdio: ["ignore", "pipe", "pipe"]
|
|
41753
41812
|
});
|
|
@@ -41761,14 +41820,14 @@ var doctorCommand = {
|
|
|
41761
41820
|
});
|
|
41762
41821
|
child.on("close", (code) => {
|
|
41763
41822
|
if (code === 0 && stdout.trim()) {
|
|
41764
|
-
|
|
41823
|
+
resolve13({
|
|
41765
41824
|
name: "CLI Version",
|
|
41766
41825
|
status: "pass",
|
|
41767
41826
|
message: "Gemini CLI version detected",
|
|
41768
41827
|
details: stdout.trim()
|
|
41769
41828
|
});
|
|
41770
41829
|
} else {
|
|
41771
|
-
|
|
41830
|
+
resolve13({
|
|
41772
41831
|
name: "CLI Version",
|
|
41773
41832
|
status: "warn",
|
|
41774
41833
|
message: "Could not detect version",
|
|
@@ -41778,7 +41837,7 @@ var doctorCommand = {
|
|
|
41778
41837
|
});
|
|
41779
41838
|
setTimeout(() => {
|
|
41780
41839
|
child.kill();
|
|
41781
|
-
|
|
41840
|
+
resolve13({
|
|
41782
41841
|
name: "CLI Version",
|
|
41783
41842
|
status: "fail",
|
|
41784
41843
|
message: "Version check timed out"
|
|
@@ -41998,14 +42057,14 @@ init_esm_shims();
|
|
|
41998
42057
|
// src/core/spec/SpecSchemaValidator.ts
|
|
41999
42058
|
init_esm_shims();
|
|
42000
42059
|
init_logger();
|
|
42001
|
-
var
|
|
42002
|
-
var
|
|
42060
|
+
var __filename2 = fileURLToPath(import.meta.url);
|
|
42061
|
+
var __dirname3 = dirname(__filename2);
|
|
42003
42062
|
var SpecSchemaValidator = class {
|
|
42004
42063
|
ajv;
|
|
42005
42064
|
validateFn = null;
|
|
42006
42065
|
schemaPath;
|
|
42007
42066
|
constructor(schemaPath) {
|
|
42008
|
-
this.schemaPath = schemaPath || join(
|
|
42067
|
+
this.schemaPath = schemaPath || join(__dirname3, "../../../schema/spec-schema.json");
|
|
42009
42068
|
this.ajv = new Ajv({
|
|
42010
42069
|
allErrors: true,
|
|
42011
42070
|
// Collect all errors, not just first
|
|
@@ -43275,22 +43334,30 @@ var DagGenerator = class {
|
|
|
43275
43334
|
}
|
|
43276
43335
|
/**
|
|
43277
43336
|
* Calculate maximum depth of DAG (longest path)
|
|
43337
|
+
* BUG FIX: Added cycle detection with visiting set to prevent infinite recursion
|
|
43278
43338
|
*/
|
|
43279
43339
|
calculateMaxDepth(dag) {
|
|
43280
43340
|
const depths = /* @__PURE__ */ new Map();
|
|
43341
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
43281
43342
|
const calculateDepth = (nodeId) => {
|
|
43282
43343
|
if (depths.has(nodeId)) {
|
|
43283
43344
|
return depths.get(nodeId);
|
|
43284
43345
|
}
|
|
43346
|
+
if (visiting.has(nodeId)) {
|
|
43347
|
+
return 0;
|
|
43348
|
+
}
|
|
43349
|
+
visiting.add(nodeId);
|
|
43285
43350
|
const node = dag.nodes.find((n) => n.id === nodeId);
|
|
43286
43351
|
if (!node || !node.dependencies || node.dependencies.length === 0) {
|
|
43287
43352
|
depths.set(nodeId, 1);
|
|
43353
|
+
visiting.delete(nodeId);
|
|
43288
43354
|
return 1;
|
|
43289
43355
|
}
|
|
43290
43356
|
const depthValues = node.dependencies.map((dep) => calculateDepth(dep));
|
|
43291
43357
|
const maxDepDep = depthValues.length > 0 ? Math.max(...depthValues) : 0;
|
|
43292
43358
|
const depth = maxDepDep + 1;
|
|
43293
43359
|
depths.set(nodeId, depth);
|
|
43360
|
+
visiting.delete(nodeId);
|
|
43294
43361
|
return depth;
|
|
43295
43362
|
};
|
|
43296
43363
|
let maxDepth = 0;
|
|
@@ -44289,11 +44356,23 @@ var genCommand = {
|
|
|
44289
44356
|
process.exit(1);
|
|
44290
44357
|
}
|
|
44291
44358
|
specFile = resolve(process.cwd(), specFile);
|
|
44292
|
-
const
|
|
44293
|
-
const
|
|
44359
|
+
const dangerousUnixPaths = ["/etc", "/sys", "/proc", "/dev", "/root", "/boot"];
|
|
44360
|
+
const isDangerousUnixPath = dangerousUnixPaths.some(
|
|
44294
44361
|
(dangerous) => specFile.startsWith(dangerous + "/") || specFile === dangerous
|
|
44295
44362
|
);
|
|
44296
|
-
|
|
44363
|
+
const specFileLower = specFile.toLowerCase();
|
|
44364
|
+
const dangerousWindowsPaths = [
|
|
44365
|
+
"c:\\windows",
|
|
44366
|
+
"c:\\program files",
|
|
44367
|
+
"c:\\program files (x86)",
|
|
44368
|
+
"c:\\programdata",
|
|
44369
|
+
"c:\\users\\public",
|
|
44370
|
+
"c:\\system32"
|
|
44371
|
+
];
|
|
44372
|
+
const isDangerousWindowsPath = dangerousWindowsPaths.some(
|
|
44373
|
+
(dangerous) => specFileLower.startsWith(dangerous + "\\") || specFileLower === dangerous
|
|
44374
|
+
);
|
|
44375
|
+
if (isDangerousUnixPath || isDangerousWindowsPath) {
|
|
44297
44376
|
console.error(chalk5.red(`\u2717 Error: Access to system directory '${specFile}' is not allowed`));
|
|
44298
44377
|
console.error(chalk5.gray("Spec files should be in your project directory"));
|
|
44299
44378
|
process.exit(1);
|
|
@@ -45006,8 +45085,8 @@ async function handleReset() {
|
|
|
45006
45085
|
}
|
|
45007
45086
|
async function handleTrace(workspacePath, argv) {
|
|
45008
45087
|
const { existsSync: existsSync25, readFileSync: readFileSync8, watchFile } = await import('fs');
|
|
45009
|
-
const { join:
|
|
45010
|
-
const traceFile =
|
|
45088
|
+
const { join: join49 } = await import('path');
|
|
45089
|
+
const traceFile = join49(workspacePath, ".automatosx/logs/router.trace.jsonl");
|
|
45011
45090
|
if (!existsSync25(traceFile)) {
|
|
45012
45091
|
console.log(chalk5.yellow("\n\u26A0\uFE0F No trace log found\n"));
|
|
45013
45092
|
console.log(chalk5.gray(`Expected location: ${traceFile}
|
|
@@ -46085,15 +46164,17 @@ async function checkDiskSpace(workingDir, verbose) {
|
|
|
46085
46164
|
timeout: 1e4
|
|
46086
46165
|
});
|
|
46087
46166
|
const sizeKB = parseInt(duOutput.trim(), 10);
|
|
46088
|
-
|
|
46089
|
-
|
|
46090
|
-
|
|
46091
|
-
|
|
46092
|
-
|
|
46093
|
-
|
|
46094
|
-
|
|
46095
|
-
|
|
46096
|
-
|
|
46167
|
+
if (!isNaN(sizeKB)) {
|
|
46168
|
+
const sizeMB = (sizeKB / 1024).toFixed(2);
|
|
46169
|
+
results.push({
|
|
46170
|
+
name: ".automatosx Size",
|
|
46171
|
+
category: "Disk",
|
|
46172
|
+
passed: true,
|
|
46173
|
+
message: sizeKB > 1024 ? `${sizeMB} MB` : `${sizeKB} KB`,
|
|
46174
|
+
details: verbose ? `Includes: memory, sessions, logs, agents` : void 0
|
|
46175
|
+
});
|
|
46176
|
+
displayCheck(results[results.length - 1]);
|
|
46177
|
+
}
|
|
46097
46178
|
} catch {
|
|
46098
46179
|
}
|
|
46099
46180
|
}
|
|
@@ -46450,7 +46531,7 @@ async function findProcesses(processName, verbose) {
|
|
|
46450
46531
|
}
|
|
46451
46532
|
async function killProcess(pid, verbose) {
|
|
46452
46533
|
try {
|
|
46453
|
-
await new Promise((
|
|
46534
|
+
await new Promise((resolve13, reject) => {
|
|
46454
46535
|
const proc = spawn("kill", ["-TERM", String(pid)], {
|
|
46455
46536
|
stdio: "pipe",
|
|
46456
46537
|
shell: false
|
|
@@ -46458,23 +46539,23 @@ async function killProcess(pid, verbose) {
|
|
|
46458
46539
|
});
|
|
46459
46540
|
proc.on("close", (code) => {
|
|
46460
46541
|
if (code === 0) {
|
|
46461
|
-
|
|
46542
|
+
resolve13();
|
|
46462
46543
|
} else {
|
|
46463
46544
|
reject(new Error(`kill -TERM failed with code ${code}`));
|
|
46464
46545
|
}
|
|
46465
46546
|
});
|
|
46466
46547
|
proc.on("error", reject);
|
|
46467
46548
|
});
|
|
46468
|
-
await new Promise((
|
|
46549
|
+
await new Promise((resolve13) => setTimeout(resolve13, 1e3));
|
|
46469
46550
|
try {
|
|
46470
|
-
await new Promise((
|
|
46551
|
+
await new Promise((resolve13, reject) => {
|
|
46471
46552
|
const proc = spawn("ps", ["-p", String(pid)], {
|
|
46472
46553
|
stdio: "pipe",
|
|
46473
46554
|
shell: false
|
|
46474
46555
|
});
|
|
46475
46556
|
proc.on("close", (code) => {
|
|
46476
46557
|
if (code === 0) {
|
|
46477
|
-
|
|
46558
|
+
resolve13();
|
|
46478
46559
|
} else {
|
|
46479
46560
|
reject(new Error("Process not running"));
|
|
46480
46561
|
}
|
|
@@ -46484,14 +46565,14 @@ async function killProcess(pid, verbose) {
|
|
|
46484
46565
|
if (verbose) {
|
|
46485
46566
|
logger.debug(`Process ${pid} didn't respond to SIGTERM, using SIGKILL`);
|
|
46486
46567
|
}
|
|
46487
|
-
await new Promise((
|
|
46568
|
+
await new Promise((resolve13, reject) => {
|
|
46488
46569
|
const proc = spawn("kill", ["-KILL", String(pid)], {
|
|
46489
46570
|
stdio: "pipe",
|
|
46490
46571
|
shell: false
|
|
46491
46572
|
});
|
|
46492
46573
|
proc.on("close", (code) => {
|
|
46493
46574
|
if (code === 0) {
|
|
46494
|
-
|
|
46575
|
+
resolve13();
|
|
46495
46576
|
} else {
|
|
46496
46577
|
reject(new Error(`kill -KILL failed with code ${code}`));
|
|
46497
46578
|
}
|
|
@@ -46514,7 +46595,7 @@ init_esm_shims();
|
|
|
46514
46595
|
// src/core/telemetry/TelemetryCollector.ts
|
|
46515
46596
|
init_esm_shims();
|
|
46516
46597
|
init_logger();
|
|
46517
|
-
|
|
46598
|
+
init_factory();
|
|
46518
46599
|
var DEFAULT_OPTIONS3 = {
|
|
46519
46600
|
enabled: false,
|
|
46520
46601
|
// Opt-in by default (privacy-first)
|
|
@@ -48069,7 +48150,7 @@ async function handleKill(argv) {
|
|
|
48069
48150
|
`);
|
|
48070
48151
|
console.log(chalk5.yellow("This will immediately disable the feature for ALL users."));
|
|
48071
48152
|
console.log(chalk5.gray("Press Ctrl+C to cancel, or wait 5 seconds to confirm...\n"));
|
|
48072
|
-
await new Promise((
|
|
48153
|
+
await new Promise((resolve13) => setTimeout(resolve13, 5e3));
|
|
48073
48154
|
try {
|
|
48074
48155
|
await flagManager.killSwitch(flagName, reason);
|
|
48075
48156
|
console.log(chalk5.red("\u2713 Kill switch activated"));
|