@agiflowai/agent-cli 0.2.25 → 0.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +168 -149
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +28 -28
- package/dist/{index-DTMl_vl1.mjs → index-2jHcytGJ.mjs} +12691 -8895
- package/dist/index-2jHcytGJ.mjs.map +1 -0
- package/dist/{index-B9Al3DuK.mjs → index-3ffr2u5d.mjs} +19 -17
- package/dist/index-3ffr2u5d.mjs.map +1 -0
- package/dist/index-BxTdyWuL.mjs.map +1 -1
- package/dist/{index-DxcGwY5j.mjs → index-DTa10g5B.mjs} +4 -4
- package/dist/index-DTa10g5B.mjs.map +1 -0
- package/dist/index.js +29 -28
- package/package.json +3 -3
- package/dist/claudeNotification.js +0 -14327
- package/dist/claudePermissionRequest.js +0 -14376
- package/dist/claudePostToolUse.js +0 -14331
- package/dist/claudePreToolUse.js +0 -14251
- package/dist/claudeSessionEnd.js +0 -14190
- package/dist/claudeSessionStart.js +0 -14339
- package/dist/claudeStop.js +0 -14315
- package/dist/codex.md +0 -386
- package/dist/index-B9Al3DuK.mjs.map +0 -1
- package/dist/index-DTMl_vl1.mjs.map +0 -1
- package/dist/index-DxcGwY5j.mjs.map +0 -1
- package/dist/package.json +0 -45
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { bB as Y, bp as v, bq as V, bC as H } from "./index-2jHcytGJ.mjs";
|
|
3
3
|
import Q from "node:events";
|
|
4
4
|
import X from "node:child_process";
|
|
5
5
|
import Z from "node:path";
|
|
6
6
|
import ee from "node:fs";
|
|
7
7
|
import te from "node:process";
|
|
8
8
|
import ie from "dotenv";
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
if (W) return
|
|
9
|
+
var w = {}, k = {}, T = {}, W;
|
|
10
|
+
function P() {
|
|
11
|
+
if (W) return T;
|
|
12
12
|
W = 1;
|
|
13
13
|
class g extends Error {
|
|
14
14
|
/**
|
|
@@ -21,7 +21,7 @@ function D() {
|
|
|
21
21
|
super(u), Error.captureStackTrace(this, this.constructor), this.name = this.constructor.name, this.code = n, this.exitCode = o, this.nestedError = void 0;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class O extends g {
|
|
25
25
|
/**
|
|
26
26
|
* Constructs the InvalidArgumentError class
|
|
27
27
|
* @param {string} [message] explanation of why argument is invalid
|
|
@@ -30,14 +30,14 @@ function D() {
|
|
|
30
30
|
super(1, "commander.invalidArgument", o), Error.captureStackTrace(this, this.constructor), this.name = this.constructor.name;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return T.CommanderError = g, T.InvalidArgumentError = O, T;
|
|
34
34
|
}
|
|
35
35
|
var j;
|
|
36
|
-
function
|
|
37
|
-
if (j) return
|
|
36
|
+
function F() {
|
|
37
|
+
if (j) return k;
|
|
38
38
|
j = 1;
|
|
39
|
-
const { InvalidArgumentError: g } =
|
|
40
|
-
class
|
|
39
|
+
const { InvalidArgumentError: g } = P();
|
|
40
|
+
class O {
|
|
41
41
|
/**
|
|
42
42
|
* Initialize a new command argument with the given name and description.
|
|
43
43
|
* The default is that the argument is required, and you can explicitly
|
|
@@ -125,18 +125,18 @@ function N() {
|
|
|
125
125
|
return this.required = !1, this;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function f(o) {
|
|
129
129
|
const n = o.name() + (o.variadic === !0 ? "..." : "");
|
|
130
130
|
return o.required ? "<" + n + ">" : "[" + n + "]";
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return k.Argument = O, k.humanReadableArgName = f, k;
|
|
133
133
|
}
|
|
134
|
-
var
|
|
135
|
-
function
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
const { humanReadableArgName: g } =
|
|
139
|
-
class
|
|
134
|
+
var D = {}, I = {}, L;
|
|
135
|
+
function K() {
|
|
136
|
+
if (L) return I;
|
|
137
|
+
L = 1;
|
|
138
|
+
const { humanReadableArgName: g } = F();
|
|
139
|
+
class O {
|
|
140
140
|
constructor() {
|
|
141
141
|
this.helpWidth = void 0, this.sortSubcommands = !1, this.sortOptions = !1, this.showGlobalOptions = !1;
|
|
142
142
|
}
|
|
@@ -351,53 +351,53 @@ function J() {
|
|
|
351
351
|
* @returns {string}
|
|
352
352
|
*/
|
|
353
353
|
formatHelp(o, n) {
|
|
354
|
-
const u = n.padWidth(o, n), a = n.helpWidth || 80, h = 2,
|
|
355
|
-
function
|
|
354
|
+
const u = n.padWidth(o, n), a = n.helpWidth || 80, h = 2, _ = 2;
|
|
355
|
+
function C(t, i) {
|
|
356
356
|
if (i) {
|
|
357
|
-
const s = `${t.padEnd(u +
|
|
357
|
+
const s = `${t.padEnd(u + _)}${i}`;
|
|
358
358
|
return n.wrap(
|
|
359
359
|
s,
|
|
360
360
|
a - h,
|
|
361
|
-
u +
|
|
361
|
+
u + _
|
|
362
362
|
);
|
|
363
363
|
}
|
|
364
364
|
return t;
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function E(t) {
|
|
367
367
|
return t.join(`
|
|
368
368
|
`).replace(/^/gm, " ".repeat(h));
|
|
369
369
|
}
|
|
370
|
-
let
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
n.wrap(
|
|
370
|
+
let b = [`Usage: ${n.commandUsage(o)}`, ""];
|
|
371
|
+
const $ = n.commandDescription(o);
|
|
372
|
+
$.length > 0 && (b = b.concat([
|
|
373
|
+
n.wrap($, a, 0),
|
|
374
374
|
""
|
|
375
375
|
]));
|
|
376
|
-
const y = n.visibleArguments(o).map((t) =>
|
|
376
|
+
const y = n.visibleArguments(o).map((t) => C(
|
|
377
377
|
n.argumentTerm(t),
|
|
378
378
|
n.argumentDescription(t)
|
|
379
379
|
));
|
|
380
|
-
y.length > 0 && (
|
|
381
|
-
const
|
|
380
|
+
y.length > 0 && (b = b.concat(["Arguments:", E(y), ""]));
|
|
381
|
+
const x = n.visibleOptions(o).map((t) => C(
|
|
382
382
|
n.optionTerm(t),
|
|
383
383
|
n.optionDescription(t)
|
|
384
384
|
));
|
|
385
|
-
if (
|
|
386
|
-
const t = n.visibleGlobalOptions(o).map((i) =>
|
|
385
|
+
if (x.length > 0 && (b = b.concat(["Options:", E(x), ""])), this.showGlobalOptions) {
|
|
386
|
+
const t = n.visibleGlobalOptions(o).map((i) => C(
|
|
387
387
|
n.optionTerm(i),
|
|
388
388
|
n.optionDescription(i)
|
|
389
389
|
));
|
|
390
|
-
t.length > 0 && (
|
|
390
|
+
t.length > 0 && (b = b.concat([
|
|
391
391
|
"Global Options:",
|
|
392
|
-
|
|
392
|
+
E(t),
|
|
393
393
|
""
|
|
394
394
|
]));
|
|
395
395
|
}
|
|
396
|
-
const e = n.visibleCommands(o).map((t) =>
|
|
396
|
+
const e = n.visibleCommands(o).map((t) => C(
|
|
397
397
|
n.subcommandTerm(t),
|
|
398
398
|
n.subcommandDescription(t)
|
|
399
399
|
));
|
|
400
|
-
return e.length > 0 && (
|
|
400
|
+
return e.length > 0 && (b = b.concat(["Commands:", E(e), ""])), b.join(`
|
|
401
401
|
`);
|
|
402
402
|
}
|
|
403
403
|
/**
|
|
@@ -427,30 +427,30 @@ function J() {
|
|
|
427
427
|
*
|
|
428
428
|
*/
|
|
429
429
|
wrap(o, n, u, a = 40) {
|
|
430
|
-
const h = " \\f\\t\\v - \uFEFF",
|
|
431
|
-
if (o.match(
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
434
|
-
const
|
|
430
|
+
const h = " \\f\\t\\v - \uFEFF", _ = new RegExp(`[\\n][${h}]+`);
|
|
431
|
+
if (o.match(_)) return o;
|
|
432
|
+
const C = n - u;
|
|
433
|
+
if (C < a) return o;
|
|
434
|
+
const E = o.slice(0, u), b = o.slice(u).replace(`\r
|
|
435
435
|
`, `
|
|
436
|
-
`),
|
|
436
|
+
`), $ = " ".repeat(u), x = "\\s", e = new RegExp(
|
|
437
437
|
`
|
|
438
|
-
|.{1,${
|
|
438
|
+
|.{1,${C - 1}}([${x}]|$)|[^${x}]+?([${x}]|$)`,
|
|
439
439
|
"g"
|
|
440
|
-
), t =
|
|
441
|
-
return
|
|
442
|
-
` ? "" : (s > 0 ?
|
|
440
|
+
), t = b.match(e) || [];
|
|
441
|
+
return E + t.map((i, s) => i === `
|
|
442
|
+
` ? "" : (s > 0 ? $ : "") + i.trimEnd()).join(`
|
|
443
443
|
`);
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
return
|
|
446
|
+
return I.Help = O, I;
|
|
447
447
|
}
|
|
448
|
-
var
|
|
449
|
-
function
|
|
450
|
-
if (
|
|
451
|
-
|
|
452
|
-
const { InvalidArgumentError: g } =
|
|
453
|
-
class
|
|
448
|
+
var N = {}, R;
|
|
449
|
+
function J() {
|
|
450
|
+
if (R) return N;
|
|
451
|
+
R = 1;
|
|
452
|
+
const { InvalidArgumentError: g } = P();
|
|
453
|
+
class O {
|
|
454
454
|
/**
|
|
455
455
|
* Initialize a new `Option` with the given `flags` and `description`.
|
|
456
456
|
*
|
|
@@ -459,8 +459,8 @@ function K() {
|
|
|
459
459
|
*/
|
|
460
460
|
constructor(a, h) {
|
|
461
461
|
this.flags = a, this.description = h || "", this.required = a.includes("<"), this.optional = a.includes("["), this.variadic = /\w\.\.\.[>\]]$/.test(a), this.mandatory = !1;
|
|
462
|
-
const
|
|
463
|
-
this.short =
|
|
462
|
+
const _ = n(a);
|
|
463
|
+
this.short = _.shortFlag, this.long = _.longFlag, this.negate = !1, this.long && (this.negate = this.long.startsWith("--no-")), this.defaultValue = void 0, this.defaultValueDescription = void 0, this.presetArg = void 0, this.envVar = void 0, this.parseArg = void 0, this.hidden = !1, this.argChoices = void 0, this.conflictsWith = [], this.implied = void 0;
|
|
464
464
|
}
|
|
465
465
|
/**
|
|
466
466
|
* Set the default value, and optionally supply the description to be displayed in the help.
|
|
@@ -569,12 +569,12 @@ function K() {
|
|
|
569
569
|
* @return {Option}
|
|
570
570
|
*/
|
|
571
571
|
choices(a) {
|
|
572
|
-
return this.argChoices = a.slice(), this.parseArg = (h,
|
|
572
|
+
return this.argChoices = a.slice(), this.parseArg = (h, _) => {
|
|
573
573
|
if (!this.argChoices.includes(h))
|
|
574
574
|
throw new g(
|
|
575
575
|
`Allowed choices are ${this.argChoices.join(", ")}.`
|
|
576
576
|
);
|
|
577
|
-
return this.variadic ? this._concatValue(h,
|
|
577
|
+
return this.variadic ? this._concatValue(h, _) : h;
|
|
578
578
|
}, this;
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
@@ -616,15 +616,15 @@ function K() {
|
|
|
616
616
|
return !this.required && !this.optional && !this.negate;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
class
|
|
619
|
+
class f {
|
|
620
620
|
/**
|
|
621
621
|
* @param {Option[]} options
|
|
622
622
|
*/
|
|
623
623
|
constructor(a) {
|
|
624
624
|
this.positiveOptions = /* @__PURE__ */ new Map(), this.negativeOptions = /* @__PURE__ */ new Map(), this.dualOptions = /* @__PURE__ */ new Set(), a.forEach((h) => {
|
|
625
625
|
h.negate ? this.negativeOptions.set(h.attributeName(), h) : this.positiveOptions.set(h.attributeName(), h);
|
|
626
|
-
}), this.negativeOptions.forEach((h,
|
|
627
|
-
this.positiveOptions.has(
|
|
626
|
+
}), this.negativeOptions.forEach((h, _) => {
|
|
627
|
+
this.positiveOptions.has(_) && this.dualOptions.add(_);
|
|
628
628
|
});
|
|
629
629
|
}
|
|
630
630
|
/**
|
|
@@ -635,10 +635,10 @@ function K() {
|
|
|
635
635
|
* @returns {boolean}
|
|
636
636
|
*/
|
|
637
637
|
valueFromOption(a, h) {
|
|
638
|
-
const
|
|
639
|
-
if (!this.dualOptions.has(
|
|
640
|
-
const
|
|
641
|
-
return h.negate === (
|
|
638
|
+
const _ = h.attributeName();
|
|
639
|
+
if (!this.dualOptions.has(_)) return !0;
|
|
640
|
+
const C = this.negativeOptions.get(_).presetArg, E = C !== void 0 ? C : !1;
|
|
641
|
+
return h.negate === (E === a);
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
644
|
function o(u) {
|
|
@@ -646,17 +646,17 @@ function K() {
|
|
|
646
646
|
}
|
|
647
647
|
function n(u) {
|
|
648
648
|
let a, h;
|
|
649
|
-
const
|
|
650
|
-
return
|
|
649
|
+
const _ = u.split(/[ |,]+/);
|
|
650
|
+
return _.length > 1 && !/^[[<]/.test(_[1]) && (a = _.shift()), h = _.shift(), !a && /^-[^-]$/.test(h) && (a = h, h = void 0), { shortFlag: a, longFlag: h };
|
|
651
651
|
}
|
|
652
|
-
return
|
|
652
|
+
return N.Option = O, N.DualOptions = f, N;
|
|
653
653
|
}
|
|
654
|
-
var
|
|
654
|
+
var M = {}, U;
|
|
655
655
|
function ne() {
|
|
656
|
-
if (
|
|
657
|
-
|
|
656
|
+
if (U) return M;
|
|
657
|
+
U = 1;
|
|
658
658
|
const g = 3;
|
|
659
|
-
function
|
|
659
|
+
function O(o, n) {
|
|
660
660
|
if (Math.abs(o.length - n.length) > g)
|
|
661
661
|
return Math.max(o.length, n.length);
|
|
662
662
|
const u = [];
|
|
@@ -666,41 +666,41 @@ function ne() {
|
|
|
666
666
|
u[0][a] = a;
|
|
667
667
|
for (let a = 1; a <= n.length; a++)
|
|
668
668
|
for (let h = 1; h <= o.length; h++) {
|
|
669
|
-
let
|
|
670
|
-
o[h - 1] === n[a - 1] ?
|
|
669
|
+
let _ = 1;
|
|
670
|
+
o[h - 1] === n[a - 1] ? _ = 0 : _ = 1, u[h][a] = Math.min(
|
|
671
671
|
u[h - 1][a] + 1,
|
|
672
672
|
// deletion
|
|
673
673
|
u[h][a - 1] + 1,
|
|
674
674
|
// insertion
|
|
675
|
-
u[h - 1][a - 1] +
|
|
675
|
+
u[h - 1][a - 1] + _
|
|
676
676
|
// substitution
|
|
677
677
|
), h > 1 && a > 1 && o[h - 1] === n[a - 2] && o[h - 2] === n[a - 1] && (u[h][a] = Math.min(u[h][a], u[h - 2][a - 2] + 1));
|
|
678
678
|
}
|
|
679
679
|
return u[o.length][n.length];
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function f(o, n) {
|
|
682
682
|
if (!n || n.length === 0) return "";
|
|
683
683
|
n = Array.from(new Set(n));
|
|
684
684
|
const u = o.startsWith("--");
|
|
685
|
-
u && (o = o.slice(2), n = n.map((
|
|
685
|
+
u && (o = o.slice(2), n = n.map((C) => C.slice(2)));
|
|
686
686
|
let a = [], h = g;
|
|
687
|
-
const
|
|
688
|
-
return n.forEach((
|
|
689
|
-
if (
|
|
690
|
-
const
|
|
691
|
-
(
|
|
692
|
-
}), a.sort((
|
|
687
|
+
const _ = 0.4;
|
|
688
|
+
return n.forEach((C) => {
|
|
689
|
+
if (C.length <= 1) return;
|
|
690
|
+
const E = O(o, C), b = Math.max(o.length, C.length);
|
|
691
|
+
(b - E) / b > _ && (E < h ? (h = E, a = [C]) : E === h && a.push(C));
|
|
692
|
+
}), a.sort((C, E) => C.localeCompare(E)), u && (a = a.map((C) => `--${C}`)), a.length > 1 ? `
|
|
693
693
|
(Did you mean one of ${a.join(", ")}?)` : a.length === 1 ? `
|
|
694
694
|
(Did you mean ${a[0]}?)` : "";
|
|
695
695
|
}
|
|
696
|
-
return
|
|
696
|
+
return M.suggestSimilar = f, M;
|
|
697
697
|
}
|
|
698
|
-
var
|
|
698
|
+
var B;
|
|
699
699
|
function se() {
|
|
700
|
-
if (
|
|
701
|
-
|
|
702
|
-
const g = Q.EventEmitter,
|
|
703
|
-
class
|
|
700
|
+
if (B) return D;
|
|
701
|
+
B = 1;
|
|
702
|
+
const g = Q.EventEmitter, O = X, f = Z, o = ee, n = te, { Argument: u, humanReadableArgName: a } = F(), { CommanderError: h } = P(), { Help: _ } = K(), { Option: C, DualOptions: E } = J(), { suggestSimilar: b } = ne();
|
|
703
|
+
class $ extends g {
|
|
704
704
|
/**
|
|
705
705
|
* Initialize a new `Command`.
|
|
706
706
|
*
|
|
@@ -776,7 +776,7 @@ function se() {
|
|
|
776
776
|
* @return {Command} new command
|
|
777
777
|
*/
|
|
778
778
|
createCommand(e) {
|
|
779
|
-
return new
|
|
779
|
+
return new $(e);
|
|
780
780
|
}
|
|
781
781
|
/**
|
|
782
782
|
* You can customise the help with a subclass of Help by overriding createHelp,
|
|
@@ -785,7 +785,7 @@ function se() {
|
|
|
785
785
|
* @return {Help}
|
|
786
786
|
*/
|
|
787
787
|
createHelp() {
|
|
788
|
-
return Object.assign(new
|
|
788
|
+
return Object.assign(new _(), this.configureHelp());
|
|
789
789
|
}
|
|
790
790
|
/**
|
|
791
791
|
* You can customise the help by overriding Help properties using configureHelp(),
|
|
@@ -1027,7 +1027,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1027
1027
|
* @return {Option} new option
|
|
1028
1028
|
*/
|
|
1029
1029
|
createOption(e, t) {
|
|
1030
|
-
return new
|
|
1030
|
+
return new C(e, t);
|
|
1031
1031
|
}
|
|
1032
1032
|
/**
|
|
1033
1033
|
* Wrap parseArgs to catch 'commander.invalidArgument'.
|
|
@@ -1121,7 +1121,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1121
1121
|
* @private
|
|
1122
1122
|
*/
|
|
1123
1123
|
_optionEx(e, t, i, s, r) {
|
|
1124
|
-
if (typeof t == "object" && t instanceof
|
|
1124
|
+
if (typeof t == "object" && t instanceof C)
|
|
1125
1125
|
throw new Error(
|
|
1126
1126
|
"To add an Option object use addOption() instead of option() or requiredOption()"
|
|
1127
1127
|
);
|
|
@@ -1412,14 +1412,14 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1412
1412
|
t = t.slice();
|
|
1413
1413
|
let i = !1;
|
|
1414
1414
|
const s = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1415
|
-
function r(d,
|
|
1416
|
-
const
|
|
1417
|
-
if (o.existsSync(
|
|
1418
|
-
if (s.includes(
|
|
1415
|
+
function r(d, A) {
|
|
1416
|
+
const S = f.resolve(d, A);
|
|
1417
|
+
if (o.existsSync(S)) return S;
|
|
1418
|
+
if (s.includes(f.extname(A))) return;
|
|
1419
1419
|
const q = s.find(
|
|
1420
|
-
(
|
|
1420
|
+
(z) => o.existsSync(`${S}${z}`)
|
|
1421
1421
|
);
|
|
1422
|
-
if (q) return `${
|
|
1422
|
+
if (q) return `${S}${q}`;
|
|
1423
1423
|
}
|
|
1424
1424
|
this._checkForMissingMandatoryOptions(), this._checkForConflictingOptions();
|
|
1425
1425
|
let l = e._executableFile || `${this._name}-${e._name}`, m = this._executableDir || "";
|
|
@@ -1430,30 +1430,30 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1430
1430
|
} catch {
|
|
1431
1431
|
d = this._scriptPath;
|
|
1432
1432
|
}
|
|
1433
|
-
m =
|
|
1434
|
-
|
|
1433
|
+
m = f.resolve(
|
|
1434
|
+
f.dirname(d),
|
|
1435
1435
|
m
|
|
1436
1436
|
);
|
|
1437
1437
|
}
|
|
1438
1438
|
if (m) {
|
|
1439
1439
|
let d = r(m, l);
|
|
1440
1440
|
if (!d && !e._executableFile && this._scriptPath) {
|
|
1441
|
-
const
|
|
1441
|
+
const A = f.basename(
|
|
1442
1442
|
this._scriptPath,
|
|
1443
|
-
|
|
1443
|
+
f.extname(this._scriptPath)
|
|
1444
1444
|
);
|
|
1445
|
-
|
|
1445
|
+
A !== this._name && (d = r(
|
|
1446
1446
|
m,
|
|
1447
|
-
`${
|
|
1447
|
+
`${A}-${e._name}`
|
|
1448
1448
|
));
|
|
1449
1449
|
}
|
|
1450
1450
|
l = d || l;
|
|
1451
1451
|
}
|
|
1452
|
-
i = s.includes(
|
|
1452
|
+
i = s.includes(f.extname(l));
|
|
1453
1453
|
let c;
|
|
1454
|
-
n.platform !== "win32" ? i ? (t.unshift(l), t = y(n.execArgv).concat(t), c =
|
|
1455
|
-
n.on(
|
|
1456
|
-
c.killed === !1 && c.exitCode === null && c.kill(
|
|
1454
|
+
n.platform !== "win32" ? i ? (t.unshift(l), t = y(n.execArgv).concat(t), c = O.spawn(n.argv[0], t, { stdio: "inherit" })) : c = O.spawn(l, t, { stdio: "inherit" }) : (t.unshift(l), t = y(n.execArgv).concat(t), c = O.spawn(n.execPath, t, { stdio: "inherit" })), c.killed || ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"].forEach((A) => {
|
|
1455
|
+
n.on(A, () => {
|
|
1456
|
+
c.killed === !1 && c.exitCode === null && c.kill(A);
|
|
1457
1457
|
});
|
|
1458
1458
|
});
|
|
1459
1459
|
const p = this._exitCallback;
|
|
@@ -1467,22 +1467,22 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1467
1467
|
) : n.exit(d);
|
|
1468
1468
|
}), c.on("error", (d) => {
|
|
1469
1469
|
if (d.code === "ENOENT") {
|
|
1470
|
-
const
|
|
1470
|
+
const A = m ? `searched for local subcommand relative to directory '${m}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory", S = `'${l}' does not exist
|
|
1471
1471
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
1472
1472
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
1473
|
-
- ${
|
|
1474
|
-
throw new Error(
|
|
1473
|
+
- ${A}`;
|
|
1474
|
+
throw new Error(S);
|
|
1475
1475
|
} else if (d.code === "EACCES")
|
|
1476
1476
|
throw new Error(`'${l}' not executable`);
|
|
1477
1477
|
if (!p)
|
|
1478
1478
|
n.exit(1);
|
|
1479
1479
|
else {
|
|
1480
|
-
const
|
|
1480
|
+
const A = new h(
|
|
1481
1481
|
1,
|
|
1482
1482
|
"commander.executeSubCommandAsync",
|
|
1483
1483
|
"(error)"
|
|
1484
1484
|
);
|
|
1485
|
-
|
|
1485
|
+
A.nestedError = d, p(A);
|
|
1486
1486
|
}
|
|
1487
1487
|
}), this.runningCommand = c;
|
|
1488
1488
|
}
|
|
@@ -1853,7 +1853,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1853
1853
|
* @private
|
|
1854
1854
|
*/
|
|
1855
1855
|
_parseOptionsImplied() {
|
|
1856
|
-
const e = new
|
|
1856
|
+
const e = new E(this.options), t = (i) => this.getOptionValue(i) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(i));
|
|
1857
1857
|
this.options.filter(
|
|
1858
1858
|
(i) => i.implied !== void 0 && t(i.attributeName()) && e.valueFromOption(
|
|
1859
1859
|
this.getOptionValue(i.attributeName()),
|
|
@@ -1909,9 +1909,9 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1909
1909
|
_conflictingOption(e, t) {
|
|
1910
1910
|
const i = (l) => {
|
|
1911
1911
|
const m = l.attributeName(), c = this.getOptionValue(m), p = this.options.find(
|
|
1912
|
-
(
|
|
1912
|
+
(A) => A.negate && m === A.attributeName()
|
|
1913
1913
|
), d = this.options.find(
|
|
1914
|
-
(
|
|
1914
|
+
(A) => !A.negate && m === A.attributeName()
|
|
1915
1915
|
);
|
|
1916
1916
|
return p && (p.presetArg === void 0 && c === !1 || p.presetArg !== void 0 && c === p.presetArg) ? p : d || l;
|
|
1917
1917
|
}, s = (l) => {
|
|
@@ -1935,7 +1935,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1935
1935
|
const l = r.createHelp().visibleOptions(r).filter((m) => m.long).map((m) => m.long);
|
|
1936
1936
|
s = s.concat(l), r = r.parent;
|
|
1937
1937
|
} while (r && !r._enablePositionalOptions);
|
|
1938
|
-
t =
|
|
1938
|
+
t = b(e, s);
|
|
1939
1939
|
}
|
|
1940
1940
|
const i = `error: unknown option '${e}'${t}`;
|
|
1941
1941
|
this.error(i, { code: "commander.unknownOption" });
|
|
@@ -1963,7 +1963,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1963
1963
|
const s = [];
|
|
1964
1964
|
this.createHelp().visibleCommands(this).forEach((r) => {
|
|
1965
1965
|
s.push(r.name()), r.alias() && s.push(r.alias());
|
|
1966
|
-
}), t =
|
|
1966
|
+
}), t = b(e, s);
|
|
1967
1967
|
}
|
|
1968
1968
|
const i = `error: unknown command '${e}'${t}`;
|
|
1969
1969
|
this.error(i, { code: "commander.unknownCommand" });
|
|
@@ -2081,7 +2081,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
2081
2081
|
* @return {Command}
|
|
2082
2082
|
*/
|
|
2083
2083
|
nameFromFilename(e) {
|
|
2084
|
-
return this._name =
|
|
2084
|
+
return this._name = f.basename(e, f.extname(e)), this;
|
|
2085
2085
|
}
|
|
2086
2086
|
/**
|
|
2087
2087
|
* Get or set the directory for searching for executable subcommands of this command.
|
|
@@ -2215,36 +2215,36 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
2215
2215
|
t && e.find((s) => t.is(s)) && (this.outputHelp(), this._exit(0, "commander.helpDisplayed", "(outputHelp)"));
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
|
-
function y(
|
|
2219
|
-
return
|
|
2218
|
+
function y(x) {
|
|
2219
|
+
return x.map((e) => {
|
|
2220
2220
|
if (!e.startsWith("--inspect"))
|
|
2221
2221
|
return e;
|
|
2222
2222
|
let t, i = "127.0.0.1", s = "9229", r;
|
|
2223
2223
|
return (r = e.match(/^(--inspect(-brk)?)$/)) !== null ? t = r[1] : (r = e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null ? (t = r[1], /^\d+$/.test(r[3]) ? s = r[3] : i = r[3]) : (r = e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null && (t = r[1], i = r[3], s = r[4]), t && s !== "0" ? `${t}=${i}:${parseInt(s) + 1}` : e;
|
|
2224
2224
|
});
|
|
2225
2225
|
}
|
|
2226
|
-
return
|
|
2226
|
+
return D.Command = $, D;
|
|
2227
2227
|
}
|
|
2228
|
-
var
|
|
2228
|
+
var G;
|
|
2229
2229
|
function re() {
|
|
2230
|
-
if (
|
|
2231
|
-
|
|
2232
|
-
const { Argument: g } =
|
|
2233
|
-
return
|
|
2230
|
+
if (G) return w;
|
|
2231
|
+
G = 1;
|
|
2232
|
+
const { Argument: g } = F(), { Command: O } = se(), { CommanderError: f, InvalidArgumentError: o } = P(), { Help: n } = K(), { Option: u } = J();
|
|
2233
|
+
return w.program = new O(), w.createCommand = (a) => new O(a), w.createOption = (a, h) => new u(a, h), w.createArgument = (a, h) => new g(a, h), w.Command = O, w.Option = u, w.Argument = g, w.Help = n, w.CommanderError = f, w.InvalidArgumentError = o, w.InvalidOptionArgumentError = o, w;
|
|
2234
2234
|
}
|
|
2235
2235
|
var oe = re();
|
|
2236
|
-
const ae = /* @__PURE__ */
|
|
2237
|
-
program:
|
|
2236
|
+
const ae = /* @__PURE__ */ Y(oe), {
|
|
2237
|
+
program: Ae,
|
|
2238
2238
|
createCommand: be,
|
|
2239
|
-
createArgument:
|
|
2239
|
+
createArgument: Ee,
|
|
2240
2240
|
createOption: we,
|
|
2241
|
-
CommanderError:
|
|
2242
|
-
InvalidArgumentError:
|
|
2243
|
-
InvalidOptionArgumentError:
|
|
2241
|
+
CommanderError: ve,
|
|
2242
|
+
InvalidArgumentError: $e,
|
|
2243
|
+
InvalidOptionArgumentError: xe,
|
|
2244
2244
|
// deprecated old name
|
|
2245
2245
|
Command: ue,
|
|
2246
|
-
Argument:
|
|
2247
|
-
Option:
|
|
2246
|
+
Argument: ye,
|
|
2247
|
+
Option: Se,
|
|
2248
2248
|
Help: He
|
|
2249
2249
|
} = ae;
|
|
2250
2250
|
process.setMaxListeners(20);
|
|
@@ -2257,18 +2257,23 @@ try {
|
|
|
2257
2257
|
}
|
|
2258
2258
|
const le = () => {
|
|
2259
2259
|
let g = !1;
|
|
2260
|
-
const
|
|
2260
|
+
const O = () => {
|
|
2261
|
+
try {
|
|
2262
|
+
v.get(H.StdinManager).restoreNormalMode();
|
|
2263
|
+
} catch {
|
|
2264
|
+
}
|
|
2261
2265
|
try {
|
|
2262
|
-
|
|
2266
|
+
const o = v.get(V.OtelService);
|
|
2267
|
+
o.isInitialized() && o.flush();
|
|
2263
2268
|
} catch {
|
|
2264
2269
|
}
|
|
2265
|
-
},
|
|
2270
|
+
}, f = async () => {
|
|
2266
2271
|
if (!g) {
|
|
2267
|
-
g = !0,
|
|
2272
|
+
g = !0, O();
|
|
2268
2273
|
try {
|
|
2269
|
-
if (
|
|
2270
|
-
const o =
|
|
2271
|
-
|
|
2274
|
+
if (v.isBound(V.DaemonManager)) {
|
|
2275
|
+
const o = v.get(
|
|
2276
|
+
V.DaemonManager
|
|
2272
2277
|
);
|
|
2273
2278
|
if (o.isRunning()) {
|
|
2274
2279
|
await o.stop();
|
|
@@ -2280,23 +2285,37 @@ const le = () => {
|
|
|
2280
2285
|
process.exit(0);
|
|
2281
2286
|
}
|
|
2282
2287
|
};
|
|
2283
|
-
process.on("exit",
|
|
2284
|
-
console.error("[cli] Uncaught exception:", o),
|
|
2288
|
+
process.on("exit", O), process.on("SIGINT", () => f()), process.on("SIGTERM", () => f()), process.on("uncaughtException", (o) => {
|
|
2289
|
+
console.error("[cli] Uncaught exception:", o), O(), process.exit(1);
|
|
2285
2290
|
}), process.on("unhandledRejection", (o) => {
|
|
2286
|
-
console.error("[cli] Unhandled rejection:", o),
|
|
2291
|
+
console.error("[cli] Unhandled rejection:", o), O(), process.exit(1);
|
|
2287
2292
|
});
|
|
2288
2293
|
};
|
|
2289
2294
|
le();
|
|
2290
|
-
|
|
2295
|
+
const ce = () => {
|
|
2296
|
+
try {
|
|
2297
|
+
const g = v.get(V.ConfigManager), O = v.get(V.OtelService), f = g.getAppConfig();
|
|
2298
|
+
O.setup({
|
|
2299
|
+
OTEL_ENABLED: f.OTEL_ENABLED,
|
|
2300
|
+
OTEL_BACKEND_ENDPOINT: f.OTEL_BACKEND_ENDPOINT,
|
|
2301
|
+
OTEL_SAMPLE_RATE: f.OTEL_SAMPLE_RATE,
|
|
2302
|
+
AUTO_SERVICE_NAME: f.AUTO_SERVICE_NAME ?? "agent-cli",
|
|
2303
|
+
NODE_ENV: process.env.NODE_ENV
|
|
2304
|
+
});
|
|
2305
|
+
} catch {
|
|
2306
|
+
}
|
|
2307
|
+
};
|
|
2308
|
+
ce();
|
|
2309
|
+
async function me() {
|
|
2291
2310
|
const g = new ue();
|
|
2292
2311
|
g.name("agiflow").description("@agiflowai/agent-cli").option("-v, --verbose", "enable verbose logging").option("--debug", "enable debug mode");
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2312
|
+
const O = v.get(H.DaemonCommand), f = v.get(H.AgentCommand), o = v.get(H.LogoutCommand), n = v.get(H.CredentialsCommand);
|
|
2313
|
+
O.register(g), f.register(g), o.register(g), n.register(g);
|
|
2295
2314
|
try {
|
|
2296
2315
|
await g.parseAsync(process.argv);
|
|
2297
2316
|
} catch (u) {
|
|
2298
2317
|
console.error("[cli] error", u.message), g.opts().debug && u instanceof Error && console.error(u.stack), process.exit(1);
|
|
2299
2318
|
}
|
|
2300
2319
|
}
|
|
2301
|
-
|
|
2320
|
+
me();
|
|
2302
2321
|
//# sourceMappingURL=cli.js.map
|