@kenkaiiii/ggcoder 4.3.216 → 4.3.218
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/command-routing.d.ts +28 -0
- package/dist/cli/command-routing.d.ts.map +1 -0
- package/dist/cli/command-routing.js +51 -0
- package/dist/cli/command-routing.js.map +1 -0
- package/dist/cli/command-routing.test.d.ts +2 -0
- package/dist/cli/command-routing.test.d.ts.map +1 -0
- package/dist/cli/command-routing.test.js +59 -0
- package/dist/cli/command-routing.test.js.map +1 -0
- package/dist/cli.d.ts +3 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +63 -108
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-compaction.test.d.ts +2 -0
- package/dist/core/agent-session-compaction.test.d.ts.map +1 -0
- package/dist/core/agent-session-compaction.test.js +121 -0
- package/dist/core/agent-session-compaction.test.js.map +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -7
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/goal-controller.d.ts.map +1 -1
- package/dist/core/goal-controller.js +46 -1
- package/dist/core/goal-controller.js.map +1 -1
- package/dist/core/goal-controller.test.js +39 -0
- package/dist/core/goal-controller.test.js.map +1 -1
- package/dist/core/goal-store.d.ts +18 -0
- package/dist/core/goal-store.d.ts.map +1 -1
- package/dist/core/goal-store.js +48 -0
- package/dist/core/goal-store.js.map +1 -1
- package/dist/core/goal-store.test.js +10 -0
- package/dist/core/goal-store.test.js.map +1 -1
- package/dist/core/goal-worker.d.ts +9 -1
- package/dist/core/goal-worker.d.ts.map +1 -1
- package/dist/core/goal-worker.js +66 -19
- package/dist/core/goal-worker.js.map +1 -1
- package/dist/core/goal-worker.test.js +120 -1
- package/dist/core/goal-worker.test.js.map +1 -1
- package/dist/core/goal-worktree.d.ts +33 -0
- package/dist/core/goal-worktree.d.ts.map +1 -0
- package/dist/core/goal-worktree.js +67 -0
- package/dist/core/goal-worktree.js.map +1 -0
- package/dist/core/goal-worktree.test.d.ts +2 -0
- package/dist/core/goal-worktree.test.d.ts.map +1 -0
- package/dist/core/goal-worktree.test.js +101 -0
- package/dist/core/goal-worktree.test.js.map +1 -0
- package/dist/core/repomap-budget.d.ts +7 -0
- package/dist/core/repomap-budget.d.ts.map +1 -0
- package/dist/core/repomap-budget.js +10 -0
- package/dist/core/repomap-budget.js.map +1 -0
- package/dist/core/repomap-budget.test.d.ts +2 -0
- package/dist/core/repomap-budget.test.d.ts.map +1 -0
- package/dist/core/repomap-budget.test.js +26 -0
- package/dist/core/repomap-budget.test.js.map +1 -0
- package/dist/system-prompt.d.ts.map +1 -1
- package/dist/system-prompt.js +4 -0
- package/dist/system-prompt.js.map +1 -1
- package/dist/system-prompt.test.js +18 -0
- package/dist/system-prompt.test.js.map +1 -1
- package/dist/tools/goals.d.ts +9 -0
- package/dist/tools/goals.d.ts.map +1 -1
- package/dist/tools/goals.js +79 -27
- package/dist/tools/goals.js.map +1 -1
- package/dist/tools/goals.test.js +91 -22
- package/dist/tools/goals.test.js.map +1 -1
- package/dist/ui/App.d.ts +11 -385
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +109 -559
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/app-items.d.ts +207 -0
- package/dist/ui/app-items.d.ts.map +1 -0
- package/dist/ui/app-items.js +2 -0
- package/dist/ui/app-items.js.map +1 -0
- package/dist/ui/app-state-persistence.test.js +4 -1
- package/dist/ui/app-state-persistence.test.js.map +1 -1
- package/dist/ui/chat-layout-pinning.test.js +11 -1
- package/dist/ui/chat-layout-pinning.test.js.map +1 -1
- package/dist/ui/components/AnimationContext.d.ts.map +1 -1
- package/dist/ui/components/AnimationContext.js +3 -5
- package/dist/ui/components/AnimationContext.js.map +1 -1
- package/dist/ui/components/AssistantMessage.test.js +12 -12
- package/dist/ui/components/AssistantMessage.test.js.map +1 -1
- package/dist/ui/components/CompactionNotice.js +2 -2
- package/dist/ui/components/CompactionNotice.js.map +1 -1
- package/dist/ui/components/Footer.d.ts +1 -0
- package/dist/ui/components/Footer.d.ts.map +1 -1
- package/dist/ui/components/Footer.js +5 -2
- package/dist/ui/components/Footer.js.map +1 -1
- package/dist/ui/components/ServerToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ServerToolExecution.js +5 -23
- package/dist/ui/components/ServerToolExecution.js.map +1 -1
- package/dist/ui/components/SubAgentPanel.d.ts.map +1 -1
- package/dist/ui/components/SubAgentPanel.js +3 -2
- package/dist/ui/components/SubAgentPanel.js.map +1 -1
- package/dist/ui/components/ToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolExecution.js +12 -30
- package/dist/ui/components/ToolExecution.js.map +1 -1
- package/dist/ui/components/ToolGroupExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolGroupExecution.js +5 -24
- package/dist/ui/components/ToolGroupExecution.js.map +1 -1
- package/dist/ui/components/ToolUseLoader.d.ts +3 -1
- package/dist/ui/components/ToolUseLoader.d.ts.map +1 -1
- package/dist/ui/components/ToolUseLoader.js +2 -2
- package/dist/ui/components/ToolUseLoader.js.map +1 -1
- package/dist/ui/footer-status-layout.test.js +9 -1
- package/dist/ui/footer-status-layout.test.js.map +1 -1
- package/dist/ui/goal-events.d.ts +4 -0
- package/dist/ui/goal-events.d.ts.map +1 -1
- package/dist/ui/goal-events.js +19 -1
- package/dist/ui/goal-events.js.map +1 -1
- package/dist/ui/goal-events.test.js +15 -1
- package/dist/ui/goal-events.test.js.map +1 -1
- package/dist/ui/goal-lifecycle-orchestration.test.js +20 -1
- package/dist/ui/goal-lifecycle-orchestration.test.js.map +1 -1
- package/dist/ui/goal-progress.d.ts +31 -0
- package/dist/ui/goal-progress.d.ts.map +1 -0
- package/dist/ui/goal-progress.js +152 -0
- package/dist/ui/goal-progress.js.map +1 -0
- package/dist/ui/item-helpers.d.ts +24 -0
- package/dist/ui/item-helpers.d.ts.map +1 -0
- package/dist/ui/item-helpers.js +96 -0
- package/dist/ui/item-helpers.js.map +1 -0
- package/dist/ui/layout-decisions.d.ts +113 -0
- package/dist/ui/layout-decisions.d.ts.map +1 -0
- package/dist/ui/layout-decisions.js +173 -0
- package/dist/ui/layout-decisions.js.map +1 -0
- package/dist/ui/prompt-routing.d.ts +29 -0
- package/dist/ui/prompt-routing.d.ts.map +1 -0
- package/dist/ui/prompt-routing.js +105 -0
- package/dist/ui/prompt-routing.js.map +1 -0
- package/dist/ui/queued-message.test.js +19 -1
- package/dist/ui/queued-message.test.js.map +1 -1
- package/dist/ui/render.d.ts +1 -0
- package/dist/ui/render.d.ts.map +1 -1
- package/dist/ui/render.js +1 -0
- package/dist/ui/render.js.map +1 -1
- package/dist/ui/scroll-stabilization.test.js +1 -1
- package/dist/ui/scroll-stabilization.test.js.map +1 -1
- package/dist/ui/slash-command-images.test.js +1 -1
- package/dist/ui/slash-command-images.test.js.map +1 -1
- package/dist/ui/terminal-history-format.d.ts +41 -0
- package/dist/ui/terminal-history-format.d.ts.map +1 -0
- package/dist/ui/terminal-history-format.js +131 -0
- package/dist/ui/terminal-history-format.js.map +1 -0
- package/dist/ui/terminal-history-spacing.d.ts +3 -0
- package/dist/ui/terminal-history-spacing.d.ts.map +1 -0
- package/dist/ui/terminal-history-spacing.js +28 -0
- package/dist/ui/terminal-history-spacing.js.map +1 -0
- package/dist/ui/terminal-history-status-renderers.d.ts +16 -0
- package/dist/ui/terminal-history-status-renderers.d.ts.map +1 -0
- package/dist/ui/terminal-history-status-renderers.js +83 -0
- package/dist/ui/terminal-history-status-renderers.js.map +1 -0
- package/dist/ui/terminal-history.d.ts.map +1 -1
- package/dist/ui/terminal-history.js +30 -246
- package/dist/ui/terminal-history.js.map +1 -1
- package/dist/ui/terminal-history.test.js +21 -7
- package/dist/ui/terminal-history.test.js.map +1 -1
- package/dist/ui/thinking-level-cycle.test.d.ts +2 -0
- package/dist/ui/thinking-level-cycle.test.d.ts.map +1 -0
- package/dist/ui/thinking-level-cycle.test.js +25 -0
- package/dist/ui/thinking-level-cycle.test.js.map +1 -0
- package/dist/ui/thinking-level.d.ts +5 -0
- package/dist/ui/thinking-level.d.ts.map +1 -0
- package/dist/ui/thinking-level.js +30 -0
- package/dist/ui/thinking-level.js.map +1 -0
- package/dist/ui/tool-group-summary.d.ts.map +1 -1
- package/dist/ui/tool-group-summary.js +117 -8
- package/dist/ui/tool-group-summary.js.map +1 -1
- package/dist/ui/tool-group-summary.test.d.ts +2 -0
- package/dist/ui/tool-group-summary.test.d.ts.map +1 -0
- package/dist/ui/tool-group-summary.test.js +79 -0
- package/dist/ui/tool-group-summary.test.js.map +1 -0
- package/dist/ui/tui-history-parity.test.js +34 -13
- package/dist/ui/tui-history-parity.test.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type CliSubcommandName = "pixel" | "login" | "logout" | "sessions" | "telegram" | "serve" | "doctor" | "agent-home-login" | "agent-home";
|
|
2
|
+
export type CliCommandRouteResult = {
|
|
3
|
+
kind: "handled";
|
|
4
|
+
subcommand: CliSubcommandName;
|
|
5
|
+
} | {
|
|
6
|
+
kind: "continue";
|
|
7
|
+
} | {
|
|
8
|
+
kind: "main";
|
|
9
|
+
subcommand: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
type SubcommandHandler = () => void;
|
|
12
|
+
export interface CliCommandRoutingOptions {
|
|
13
|
+
argv: string[];
|
|
14
|
+
printHelp: () => void;
|
|
15
|
+
exit: (code: number) => never;
|
|
16
|
+
handlers: Record<CliSubcommandName, SubcommandHandler>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Routes the early CLI command layer before parseArgs handles normal flags.
|
|
20
|
+
*
|
|
21
|
+
* This intentionally preserves the legacy startup contract:
|
|
22
|
+
* - any -h/--help anywhere prints top-level help and exits before subcommands;
|
|
23
|
+
* - selected subcommands remove their command token before their mode parser runs;
|
|
24
|
+
* - `continue` is not a standalone handler, it only toggles the later TUI resume path.
|
|
25
|
+
*/
|
|
26
|
+
export declare function routeCliCommandInput(options: CliCommandRoutingOptions): CliCommandRouteResult;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=command-routing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-routing.d.ts","sourceRoot":"","sources":["../../src/cli/command-routing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,YAAY,CAAC;AAEjB,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,iBAAiB,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAErD,KAAK,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAEpC,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;CACxD;AA6BD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,wBAAwB,GAAG,qBAAqB,CAwB7F"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const SUBCOMMANDS_THAT_KEEP_ARGV = new Set([
|
|
2
|
+
"pixel",
|
|
3
|
+
"login",
|
|
4
|
+
"logout",
|
|
5
|
+
"telegram",
|
|
6
|
+
"doctor",
|
|
7
|
+
"agent-home-login",
|
|
8
|
+
]);
|
|
9
|
+
function isCliSubcommandName(value) {
|
|
10
|
+
return (value === "pixel" ||
|
|
11
|
+
value === "login" ||
|
|
12
|
+
value === "logout" ||
|
|
13
|
+
value === "sessions" ||
|
|
14
|
+
value === "telegram" ||
|
|
15
|
+
value === "serve" ||
|
|
16
|
+
value === "doctor" ||
|
|
17
|
+
value === "agent-home-login" ||
|
|
18
|
+
value === "agent-home");
|
|
19
|
+
}
|
|
20
|
+
function stripSubcommandArg(argv) {
|
|
21
|
+
argv.splice(2, 1);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Routes the early CLI command layer before parseArgs handles normal flags.
|
|
25
|
+
*
|
|
26
|
+
* This intentionally preserves the legacy startup contract:
|
|
27
|
+
* - any -h/--help anywhere prints top-level help and exits before subcommands;
|
|
28
|
+
* - selected subcommands remove their command token before their mode parser runs;
|
|
29
|
+
* - `continue` is not a standalone handler, it only toggles the later TUI resume path.
|
|
30
|
+
*/
|
|
31
|
+
export function routeCliCommandInput(options) {
|
|
32
|
+
const { argv, printHelp, exit, handlers } = options;
|
|
33
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
34
|
+
printHelp();
|
|
35
|
+
exit(0);
|
|
36
|
+
}
|
|
37
|
+
const subcommand = argv[2];
|
|
38
|
+
if (isCliSubcommandName(subcommand)) {
|
|
39
|
+
if (!SUBCOMMANDS_THAT_KEEP_ARGV.has(subcommand)) {
|
|
40
|
+
stripSubcommandArg(argv);
|
|
41
|
+
}
|
|
42
|
+
handlers[subcommand]();
|
|
43
|
+
return { kind: "handled", subcommand };
|
|
44
|
+
}
|
|
45
|
+
if (subcommand === "continue") {
|
|
46
|
+
stripSubcommandArg(argv);
|
|
47
|
+
return { kind: "continue" };
|
|
48
|
+
}
|
|
49
|
+
return { kind: "main", subcommand };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=command-routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-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IACzC,CAAC;IAED,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;QAC9B,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-routing.test.d.ts","sourceRoot":"","sources":["../../src/cli/command-routing.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { routeCliCommandInput } from "./command-routing.js";
|
|
3
|
+
function handlers(calls) {
|
|
4
|
+
return {
|
|
5
|
+
pixel: () => calls.push("pixel"),
|
|
6
|
+
login: () => calls.push("login"),
|
|
7
|
+
logout: () => calls.push("logout"),
|
|
8
|
+
sessions: () => calls.push("sessions"),
|
|
9
|
+
telegram: () => calls.push("telegram"),
|
|
10
|
+
serve: () => calls.push("serve"),
|
|
11
|
+
doctor: () => calls.push("doctor"),
|
|
12
|
+
"agent-home-login": () => calls.push("agent-home-login"),
|
|
13
|
+
"agent-home": () => calls.push("agent-home"),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
describe("routeCliCommandInput", () => {
|
|
17
|
+
it("prints top-level help before dispatching subcommands", () => {
|
|
18
|
+
const argv = ["node", "ggcoder", "login", "--help"];
|
|
19
|
+
const printHelp = vi.fn();
|
|
20
|
+
const exit = vi.fn((code) => {
|
|
21
|
+
throw new Error(`exit:${code}`);
|
|
22
|
+
});
|
|
23
|
+
expect(() => routeCliCommandInput({ argv, printHelp, exit, handlers: handlers([]) })).toThrow("exit:0");
|
|
24
|
+
expect(printHelp).toHaveBeenCalledOnce();
|
|
25
|
+
});
|
|
26
|
+
it("dispatches subcommands and strips command tokens only for modes that parse their own flags", () => {
|
|
27
|
+
const calls = [];
|
|
28
|
+
const sessionsArgv = ["node", "ggcoder", "sessions", "--foo"];
|
|
29
|
+
const loginArgv = ["node", "ggcoder", "login", "--foo"];
|
|
30
|
+
expect(routeCliCommandInput({
|
|
31
|
+
argv: sessionsArgv,
|
|
32
|
+
printHelp: vi.fn(),
|
|
33
|
+
exit: vi.fn(),
|
|
34
|
+
handlers: handlers(calls),
|
|
35
|
+
})).toEqual({ kind: "handled", subcommand: "sessions" });
|
|
36
|
+
expect(sessionsArgv).toEqual(["node", "ggcoder", "--foo"]);
|
|
37
|
+
expect(routeCliCommandInput({
|
|
38
|
+
argv: loginArgv,
|
|
39
|
+
printHelp: vi.fn(),
|
|
40
|
+
exit: vi.fn(),
|
|
41
|
+
handlers: handlers(calls),
|
|
42
|
+
})).toEqual({ kind: "handled", subcommand: "login" });
|
|
43
|
+
expect(loginArgv).toEqual(["node", "ggcoder", "login", "--foo"]);
|
|
44
|
+
expect(calls).toEqual(["sessions", "login"]);
|
|
45
|
+
});
|
|
46
|
+
it("converts continue into a later TUI resume route without handling it as a subcommand", () => {
|
|
47
|
+
const argv = ["node", "ggcoder", "continue", "--model", "x"];
|
|
48
|
+
const calls = [];
|
|
49
|
+
expect(routeCliCommandInput({
|
|
50
|
+
argv,
|
|
51
|
+
printHelp: vi.fn(),
|
|
52
|
+
exit: vi.fn(),
|
|
53
|
+
handlers: handlers(calls),
|
|
54
|
+
})).toEqual({ kind: "continue" });
|
|
55
|
+
expect(argv).toEqual(["node", "ggcoder", "--model", "x"]);
|
|
56
|
+
expect(calls).toEqual([]);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=command-routing.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-routing.test.js","sourceRoot":"","sources":["../../src/cli/command-routing.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,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QACjE,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qFAAqF,EAAE,GAAG,EAAE;QAC7F,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAC7D,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,MAAM,CACJ,oBAAoB,CAAC;YACnB,IAAI;YACJ,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE;YAClB,IAAI,EAAE,EAAE,CAAC,EAAE,EAAW;YACtB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;SAC1B,CAAC,CACH,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=8192 --expose-gc
|
|
2
|
-
import type { CompletedItem } from "./ui/
|
|
3
|
-
import type { Message } from "@kenkaiiii/gg-ai";
|
|
2
|
+
import type { CompletedItem } from "./ui/app-items.js";
|
|
3
|
+
import type { Message, ThinkingLevel } from "@kenkaiiii/gg-ai";
|
|
4
|
+
export declare function parseThinkingLevel(value: string | undefined): ThinkingLevel | undefined;
|
|
4
5
|
export declare function messagesToHistoryItems(msgs: Message[]): CompletedItem[];
|
|
5
6
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA6DA,OAAO,KAAK,EAAE,aAAa,EAAqB,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA6DA,OAAO,KAAK,EAAE,aAAa,EAAqB,MAAM,mBAAmB,CAAC;AAI1E,OAAO,KAAK,EAAE,OAAO,EAAY,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA0CzE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAIvF;AAitDD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAgJvE"}
|
package/dist/cli.js
CHANGED
|
@@ -78,8 +78,17 @@ import { loginGemini } from "./core/oauth/gemini.js";
|
|
|
78
78
|
import chalk from "chalk";
|
|
79
79
|
import { checkAndAutoUpdate } from "./core/auto-update.js";
|
|
80
80
|
import { parseGoalSyntheticEvent } from "./ui/goal-events.js";
|
|
81
|
+
import { routeCliCommandInput } from "./cli/command-routing.js";
|
|
81
82
|
const _require = createRequire(import.meta.url);
|
|
82
83
|
const CLI_VERSION = _require("../package.json").version;
|
|
84
|
+
const THINKING_LEVELS = new Set(["low", "medium", "high", "xhigh"]);
|
|
85
|
+
export function parseThinkingLevel(value) {
|
|
86
|
+
if (value === undefined)
|
|
87
|
+
return undefined;
|
|
88
|
+
if (THINKING_LEVELS.has(value))
|
|
89
|
+
return value;
|
|
90
|
+
throw new Error(`Invalid --thinking value "${value}". Expected low, medium, high, or xhigh.`);
|
|
91
|
+
}
|
|
83
92
|
// ── Logo + gradient (mirrors Banner.tsx) ────────────────────────────
|
|
84
93
|
const LOGO_LINES = [
|
|
85
94
|
" \u2584\u2580\u2580\u2580 \u2584\u2580\u2580\u2580",
|
|
@@ -168,6 +177,7 @@ function printHelp() {
|
|
|
168
177
|
["--model <name>", "Model to use (e.g. claude-sonnet-4-6, gpt-5.5)"],
|
|
169
178
|
["--max-turns <n>", "Maximum agent turns per prompt"],
|
|
170
179
|
["--system-prompt <text>", "Override the system prompt"],
|
|
180
|
+
["--thinking <level>", "Enable thinking level (low, medium, high, xhigh)"],
|
|
171
181
|
["--json", "JSON output mode (for sub-agents)"],
|
|
172
182
|
["--rpc", "JSON-RPC mode (for IDE integrations)"],
|
|
173
183
|
];
|
|
@@ -205,108 +215,48 @@ function printHelp() {
|
|
|
205
215
|
}
|
|
206
216
|
console.log();
|
|
207
217
|
}
|
|
218
|
+
function createCliSubcommandHandlers() {
|
|
219
|
+
const runWithStandardErrorHandling = (operation, logStack = false) => {
|
|
220
|
+
operation().catch((err) => {
|
|
221
|
+
log("ERROR", "fatal", err instanceof Error ? (logStack ? (err.stack ?? err.message) : err.message) : String(err));
|
|
222
|
+
closeLogger();
|
|
223
|
+
process.stderr.write(formatUserError(err) + "\n");
|
|
224
|
+
process.exit(1);
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
return {
|
|
228
|
+
pixel: () => runWithStandardErrorHandling(runPixel, true),
|
|
229
|
+
login: () => runWithStandardErrorHandling(runLogin),
|
|
230
|
+
logout: () => runWithStandardErrorHandling(runLogout),
|
|
231
|
+
sessions: () => runWithStandardErrorHandling(runSessions),
|
|
232
|
+
telegram: () => runWithStandardErrorHandling(runTelegramSetup),
|
|
233
|
+
serve: () => runWithStandardErrorHandling(runServe),
|
|
234
|
+
doctor: () => {
|
|
235
|
+
runDoctor().catch((err) => {
|
|
236
|
+
process.stderr.write(formatUserError(err) + "\n");
|
|
237
|
+
process.exit(1);
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
"agent-home-login": () => runWithStandardErrorHandling(runAgentHomeLogin),
|
|
241
|
+
"agent-home": () => runWithStandardErrorHandling(runAgentHome),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
208
244
|
function main() {
|
|
209
245
|
// Silent auto-update check (throttled, non-blocking on failure)
|
|
210
246
|
const updateMessage = checkAndAutoUpdate(CLI_VERSION);
|
|
211
247
|
if (updateMessage) {
|
|
212
248
|
console.error(chalk.bold.hex("#4ade80")(`✨ ${updateMessage}`));
|
|
213
249
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const subcommand = process.argv[2];
|
|
222
|
-
if (subcommand === "pixel") {
|
|
223
|
-
runPixel().catch((err) => {
|
|
224
|
-
// Log the full stack — `pixel install` failures are usually bugs in our
|
|
225
|
-
// own AST/wiring code, and the stack is the only useful diagnostic.
|
|
226
|
-
log("ERROR", "fatal", err instanceof Error ? (err.stack ?? err.message) : String(err));
|
|
227
|
-
closeLogger();
|
|
228
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
229
|
-
process.exit(1);
|
|
230
|
-
});
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (subcommand === "login") {
|
|
234
|
-
runLogin().catch((err) => {
|
|
235
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
236
|
-
closeLogger();
|
|
237
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
238
|
-
process.exit(1);
|
|
239
|
-
});
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (subcommand === "logout") {
|
|
243
|
-
runLogout().catch((err) => {
|
|
244
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
245
|
-
closeLogger();
|
|
246
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
247
|
-
process.exit(1);
|
|
248
|
-
});
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (subcommand === "sessions") {
|
|
252
|
-
process.argv.splice(2, 1);
|
|
253
|
-
runSessions().catch((err) => {
|
|
254
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
255
|
-
closeLogger();
|
|
256
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
257
|
-
process.exit(1);
|
|
258
|
-
});
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
if (subcommand === "telegram") {
|
|
262
|
-
runTelegramSetup().catch((err) => {
|
|
263
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
264
|
-
closeLogger();
|
|
265
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
266
|
-
process.exit(1);
|
|
267
|
-
});
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (subcommand === "serve") {
|
|
271
|
-
process.argv.splice(2, 1);
|
|
272
|
-
runServe().catch((err) => {
|
|
273
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
274
|
-
closeLogger();
|
|
275
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
276
|
-
process.exit(1);
|
|
277
|
-
});
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
if (subcommand === "doctor") {
|
|
281
|
-
runDoctor().catch((err) => {
|
|
282
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
283
|
-
process.exit(1);
|
|
284
|
-
});
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
if (subcommand === "agent-home-login") {
|
|
288
|
-
runAgentHomeLogin().catch((err) => {
|
|
289
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
290
|
-
closeLogger();
|
|
291
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
292
|
-
process.exit(1);
|
|
293
|
-
});
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
if (subcommand === "agent-home") {
|
|
297
|
-
process.argv.splice(2, 1);
|
|
298
|
-
runAgentHome().catch((err) => {
|
|
299
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
300
|
-
closeLogger();
|
|
301
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
302
|
-
process.exit(1);
|
|
303
|
-
});
|
|
250
|
+
const commandRoute = routeCliCommandInput({
|
|
251
|
+
argv: process.argv,
|
|
252
|
+
printHelp,
|
|
253
|
+
exit: process.exit,
|
|
254
|
+
handlers: createCliSubcommandHandlers(),
|
|
255
|
+
});
|
|
256
|
+
if (commandRoute.kind === "handled") {
|
|
304
257
|
return;
|
|
305
258
|
}
|
|
306
|
-
|
|
307
|
-
// Remove "continue" so parseArgs handles remaining flags
|
|
308
|
-
process.argv.splice(2, 1);
|
|
309
|
-
}
|
|
259
|
+
const subcommand = commandRoute.kind === "continue" ? "continue" : commandRoute.subcommand;
|
|
310
260
|
const { values, positionals } = parseArgs({
|
|
311
261
|
options: {
|
|
312
262
|
help: { type: "boolean", short: "h" },
|
|
@@ -318,6 +268,7 @@ function main() {
|
|
|
318
268
|
"max-turns": { type: "string" },
|
|
319
269
|
"system-prompt": { type: "string" },
|
|
320
270
|
"prompt-cache-key": { type: "string" },
|
|
271
|
+
thinking: { type: "string" },
|
|
321
272
|
},
|
|
322
273
|
allowPositionals: true,
|
|
323
274
|
strict: true,
|
|
@@ -338,6 +289,7 @@ function main() {
|
|
|
338
289
|
const maxTurns = values["max-turns"] ? parseInt(values["max-turns"], 10) : undefined;
|
|
339
290
|
const systemPrompt = values["system-prompt"];
|
|
340
291
|
const promptCacheKey = values["prompt-cache-key"];
|
|
292
|
+
const thinkingLevel = parseThinkingLevel(values.thinking);
|
|
341
293
|
const cwd = process.cwd();
|
|
342
294
|
runJsonMode({
|
|
343
295
|
message,
|
|
@@ -347,6 +299,7 @@ function main() {
|
|
|
347
299
|
systemPrompt,
|
|
348
300
|
maxTurns,
|
|
349
301
|
promptCacheKey,
|
|
302
|
+
thinkingLevel,
|
|
350
303
|
}).catch((err) => {
|
|
351
304
|
process.stderr.write(formatUserError(err) + "\n");
|
|
352
305
|
process.exit(1);
|
|
@@ -393,7 +346,7 @@ function main() {
|
|
|
393
346
|
}
|
|
394
347
|
const model = saved.model ?? getHardcodedDefault(provider);
|
|
395
348
|
const thinkingLevel = saved.thinkingEnabled
|
|
396
|
-
? getMaxThinkingLevel(model)
|
|
349
|
+
? (saved.thinkingLevel ?? getMaxThinkingLevel(model))
|
|
397
350
|
: undefined;
|
|
398
351
|
// Interactive mode (Ink TUI)
|
|
399
352
|
const cwd = process.cwd();
|
|
@@ -558,16 +511,17 @@ async function runInkTUI(opts) {
|
|
|
558
511
|
});
|
|
559
512
|
return rebuilt;
|
|
560
513
|
};
|
|
561
|
-
//
|
|
514
|
+
// MCP startup can involve `npx` installing/booting servers. Do it after the
|
|
515
|
+
// TUI paints so a slow network or npm cache never looks like "nothing happens".
|
|
562
516
|
const mcpManager = new MCPClientManager();
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
517
|
+
let initialMcpConnectPromise;
|
|
518
|
+
const connectInitialMcpTools = async () => {
|
|
519
|
+
initialMcpConnectPromise ??= (async () => {
|
|
520
|
+
const providerApiKey = provider === "glm" ? credentialsByProvider["glm"]?.accessToken : undefined;
|
|
521
|
+
return mcpManager.connectAll(getMCPServers(provider, providerApiKey));
|
|
522
|
+
})();
|
|
523
|
+
return initialMcpConnectPromise;
|
|
524
|
+
};
|
|
571
525
|
const systemPrompt = await buildSystemPrompt(cwd, skills, false, undefined, tools.map((tool) => tool.name), undefined, goalModeRef.current);
|
|
572
526
|
// Kill all background processes on exit (synchronous — catches all exit paths)
|
|
573
527
|
process.on("exit", () => {
|
|
@@ -684,6 +638,7 @@ async function runInkTUI(opts) {
|
|
|
684
638
|
rebuildToolsForCwd,
|
|
685
639
|
repoMapChangedFilesRef,
|
|
686
640
|
repoMapReadFilesRef,
|
|
641
|
+
connectInitialMcpTools,
|
|
687
642
|
});
|
|
688
643
|
closeLogger();
|
|
689
644
|
}
|
|
@@ -1055,7 +1010,7 @@ async function runSessions() {
|
|
|
1055
1010
|
}
|
|
1056
1011
|
const model = saved2.model ?? getDefault(provider);
|
|
1057
1012
|
const thinkingLevel = saved2.thinkingEnabled
|
|
1058
|
-
? getMaxThinkingLevel(model)
|
|
1013
|
+
? (saved2.thinkingLevel ?? getMaxThinkingLevel(model))
|
|
1059
1014
|
: undefined;
|
|
1060
1015
|
closeLogger();
|
|
1061
1016
|
await runInkTUI({
|
|
@@ -1240,7 +1195,7 @@ async function runServe() {
|
|
|
1240
1195
|
const preferredProvider = serveValues.provider ?? saved3.provider ?? "anthropic";
|
|
1241
1196
|
const { provider, model } = await resolveActiveProvider(authStorage, preferredProvider, serveValues.model ?? saved3.model);
|
|
1242
1197
|
const thinkingLevel = saved3.thinkingEnabled
|
|
1243
|
-
? getMaxThinkingLevel(model)
|
|
1198
|
+
? (saved3.thinkingLevel ?? getMaxThinkingLevel(model))
|
|
1244
1199
|
: undefined;
|
|
1245
1200
|
initLogger(paths.logFile, {
|
|
1246
1201
|
version: CLI_VERSION,
|
|
@@ -1372,7 +1327,7 @@ async function runAgentHome() {
|
|
|
1372
1327
|
const preferredProvider = ahValues.provider ?? saved4.provider ?? "anthropic";
|
|
1373
1328
|
const { provider, model } = await resolveActiveProvider(authStorage, preferredProvider, ahValues.model ?? saved4.model);
|
|
1374
1329
|
const thinkingLevel = saved4.thinkingEnabled
|
|
1375
|
-
? getMaxThinkingLevel(model)
|
|
1330
|
+
? (saved4.thinkingLevel ?? getMaxThinkingLevel(model))
|
|
1376
1331
|
: undefined;
|
|
1377
1332
|
initLogger(paths.logFile, {
|
|
1378
1333
|
version: CLI_VERSION,
|
|
@@ -1454,7 +1409,7 @@ async function runPixel() {
|
|
|
1454
1409
|
provider,
|
|
1455
1410
|
model,
|
|
1456
1411
|
cwd: process.cwd(),
|
|
1457
|
-
thinkingLevel: saved.thinkingEnabled ? "medium" : undefined,
|
|
1412
|
+
thinkingLevel: saved.thinkingEnabled ? (saved.thinkingLevel ?? "medium") : undefined,
|
|
1458
1413
|
theme: saved.theme,
|
|
1459
1414
|
initialOverlay: "pixel",
|
|
1460
1415
|
});
|