@dexto/tui 1.6.15 → 1.6.17
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/InkCLIRefactored.d.ts +3 -3
- package/dist/InkCLIRefactored.d.ts.map +1 -1
- package/dist/agent-backend.cjs +118 -0
- package/dist/agent-backend.d.ts +82 -0
- package/dist/agent-backend.d.ts.map +1 -0
- package/dist/agent-backend.js +86 -0
- package/dist/agent-backend.test.cjs +28 -0
- package/dist/agent-backend.test.d.ts +2 -0
- package/dist/agent-backend.test.d.ts.map +1 -0
- package/dist/agent-backend.test.js +29 -0
- package/dist/components/Footer.cjs +5 -0
- package/dist/components/Footer.d.ts +3 -2
- package/dist/components/Footer.d.ts.map +1 -1
- package/dist/components/Footer.js +5 -0
- package/dist/components/ResourceAutocomplete.cjs +8 -0
- package/dist/components/ResourceAutocomplete.d.ts +2 -2
- package/dist/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/components/ResourceAutocomplete.js +8 -0
- package/dist/components/SlashCommandAutocomplete.cjs +4 -4
- package/dist/components/SlashCommandAutocomplete.d.ts +2 -2
- package/dist/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/components/SlashCommandAutocomplete.js +5 -5
- package/dist/components/StatusBar.d.ts +2 -2
- package/dist/components/StatusBar.d.ts.map +1 -1
- package/dist/components/modes/AlternateBufferCLI.d.ts +2 -2
- package/dist/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/components/modes/StaticCLI.d.ts +2 -2
- package/dist/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/components/overlays/ContextStatsOverlay.d.ts +2 -2
- package/dist/components/overlays/ContextStatsOverlay.d.ts.map +1 -1
- package/dist/components/overlays/ExportWizard.d.ts +2 -2
- package/dist/components/overlays/ExportWizard.d.ts.map +1 -1
- package/dist/components/overlays/LogLevelSelector.d.ts +2 -2
- package/dist/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpRemoveSelector.d.ts +2 -2
- package/dist/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/components/overlays/McpServerList.d.ts +3 -2
- package/dist/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/components/overlays/ModelSelectorRefactored.d.ts +3 -2
- package/dist/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/components/overlays/PromptDeleteSelector.d.ts +3 -2
- package/dist/components/overlays/PromptDeleteSelector.d.ts.map +1 -1
- package/dist/components/overlays/PromptList.d.ts +3 -2
- package/dist/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/components/overlays/ReasoningOverlay.d.ts +2 -2
- package/dist/components/overlays/ReasoningOverlay.d.ts.map +1 -1
- package/dist/components/overlays/SearchOverlay.d.ts +2 -2
- package/dist/components/overlays/SearchOverlay.d.ts.map +1 -1
- package/dist/components/overlays/SessionSelectorRefactored.d.ts +2 -2
- package/dist/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/components/overlays/ToolBrowser.d.ts +2 -2
- package/dist/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/containers/InputContainer.cjs +8 -4
- package/dist/containers/InputContainer.d.ts +3 -2
- package/dist/containers/InputContainer.d.ts.map +1 -1
- package/dist/containers/InputContainer.js +12 -4
- package/dist/containers/OverlayContainer.cjs +1 -1
- package/dist/containers/OverlayContainer.d.ts +2 -2
- package/dist/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/containers/OverlayContainer.js +1 -1
- package/dist/hooks/useAgentEvents.d.ts +3 -2
- package/dist/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/hooks/useCLIState.d.ts +4 -3
- package/dist/hooks/useCLIState.d.ts.map +1 -1
- package/dist/hooks/useCLIState.js +1 -4
- package/dist/hooks/useInputOrchestrator.d.ts +3 -2
- package/dist/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/hooks/useKeyboardShortcuts.d.ts +2 -2
- package/dist/hooks/useKeyboardShortcuts.d.ts.map +1 -1
- package/dist/hooks/useTokenCounter.d.ts +2 -2
- package/dist/hooks/useTokenCounter.d.ts.map +1 -1
- package/dist/host/index.d.ts +7 -3
- package/dist/host/index.d.ts.map +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +243 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/interactive-commands/command-parser.d.ts +2 -2
- package/dist/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/interactive-commands/commands.cjs +27 -16
- package/dist/interactive-commands/commands.d.ts +3 -2
- package/dist/interactive-commands/commands.d.ts.map +1 -1
- package/dist/interactive-commands/commands.js +29 -15
- package/dist/interactive-commands/commands.test.cjs +28 -0
- package/dist/interactive-commands/commands.test.d.ts +2 -0
- package/dist/interactive-commands/commands.test.d.ts.map +1 -0
- package/dist/interactive-commands/commands.test.js +27 -0
- package/dist/interactive-commands/documentation-commands.d.ts.map +1 -1
- package/dist/interactive-commands/general-commands.cjs +3 -3
- package/dist/interactive-commands/general-commands.d.ts +2 -1
- package/dist/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/interactive-commands/general-commands.js +3 -3
- package/dist/interactive-commands/prompt-commands.d.ts +2 -2
- package/dist/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/interactive-commands/session/session-commands.d.ts.map +1 -1
- package/dist/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/interactive-commands/tool-commands.d.ts.map +1 -1
- package/dist/services/CommandService.d.ts +2 -2
- package/dist/services/CommandService.d.ts.map +1 -1
- package/dist/utils/commandOverlays.cjs +5 -1
- package/dist/utils/commandOverlays.d.ts +2 -1
- package/dist/utils/commandOverlays.d.ts.map +1 -1
- package/dist/utils/commandOverlays.js +5 -1
- package/dist/utils/messageFormatting.cjs +12 -0
- package/dist/utils/messageFormatting.d.ts +3 -2
- package/dist/utils/messageFormatting.d.ts.map +1 -1
- package/dist/utils/messageFormatting.js +12 -0
- package/package.json +4 -4
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { isDextoAuthEnabled } from "@dexto/agent-management";
|
|
2
|
+
import {
|
|
3
|
+
isCommandDefinitionSupported,
|
|
4
|
+
isCommandSupported,
|
|
5
|
+
supportsPrompts
|
|
6
|
+
} from "../agent-backend.js";
|
|
2
7
|
import { generalCommands, createHelpCommand } from "./general-commands.js";
|
|
3
8
|
import { searchCommand, resumeCommand, renameCommand, forkCommand } from "./session/index.js";
|
|
4
9
|
import { exportCommand } from "./export/index.js";
|
|
@@ -45,7 +50,7 @@ const baseCommands = [
|
|
|
45
50
|
// Auth commands (feature-flagged)
|
|
46
51
|
...isDextoAuthEnabled() ? [loginCommand, logoutCommand] : []
|
|
47
52
|
];
|
|
48
|
-
CLI_COMMANDS.push(createHelpCommand(() =>
|
|
53
|
+
CLI_COMMANDS.push(createHelpCommand((agent) => getAvailableCommands(agent)));
|
|
49
54
|
CLI_COMMANDS.push(...baseCommands);
|
|
50
55
|
async function executeCommand(command, args, agent, sessionId, configFilePath) {
|
|
51
56
|
const ctx = { sessionId: sessionId ?? null, configFilePath: configFilePath ?? null };
|
|
@@ -53,6 +58,9 @@ async function executeCommand(command, args, agent, sessionId, configFilePath) {
|
|
|
53
58
|
(c) => c.name === command || c.aliases && c.aliases.includes(command)
|
|
54
59
|
);
|
|
55
60
|
if (cmd) {
|
|
61
|
+
if (!isCommandSupported(agent, command, cmd)) {
|
|
62
|
+
return `\u26A0\uFE0F Command /${command} is not available for this chat target.`;
|
|
63
|
+
}
|
|
56
64
|
try {
|
|
57
65
|
const result = await cmd.handler(args, agent, ctx);
|
|
58
66
|
return result;
|
|
@@ -66,20 +74,22 @@ ${error instanceof Error ? error.message : String(error)}`;
|
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
try {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
if (supportsPrompts(agent)) {
|
|
78
|
+
const { getDynamicPromptCommands } = await import("./prompt-commands.js");
|
|
79
|
+
const dynamicCommands = await getDynamicPromptCommands(agent);
|
|
80
|
+
const promptCmd = dynamicCommands.find((c) => c.name === command);
|
|
81
|
+
if (promptCmd) {
|
|
82
|
+
try {
|
|
83
|
+
const result = await promptCmd.handler(args, agent, ctx);
|
|
84
|
+
return result;
|
|
85
|
+
} catch (error) {
|
|
86
|
+
const errorMsg2 = `\u274C Error executing prompt /${command}:
|
|
78
87
|
${error instanceof Error ? error.message : String(error)}`;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
agent.logger.error(
|
|
89
|
+
`Error executing prompt /${command}: ${error instanceof Error ? error.message : String(error)}`
|
|
90
|
+
);
|
|
91
|
+
return errorMsg2;
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
} catch (error) {
|
|
@@ -94,8 +104,12 @@ Type / to see available commands, /prompts to add new ones`;
|
|
|
94
104
|
function getAllCommands() {
|
|
95
105
|
return CLI_COMMANDS;
|
|
96
106
|
}
|
|
107
|
+
function getAvailableCommands(agent) {
|
|
108
|
+
return CLI_COMMANDS.filter((command) => isCommandDefinitionSupported(agent, command));
|
|
109
|
+
}
|
|
97
110
|
export {
|
|
98
111
|
CLI_COMMANDS,
|
|
99
112
|
executeCommand,
|
|
100
|
-
getAllCommands
|
|
113
|
+
getAllCommands,
|
|
114
|
+
getAvailableCommands
|
|
101
115
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_vitest = require("vitest");
|
|
3
|
+
var import_commands = require("./commands.js");
|
|
4
|
+
function createAgent(capabilities) {
|
|
5
|
+
return {
|
|
6
|
+
capabilities,
|
|
7
|
+
logger: {
|
|
8
|
+
debug: import_vitest.vi.fn(),
|
|
9
|
+
info: import_vitest.vi.fn(),
|
|
10
|
+
warn: import_vitest.vi.fn(),
|
|
11
|
+
error: import_vitest.vi.fn(),
|
|
12
|
+
getLevel: import_vitest.vi.fn(),
|
|
13
|
+
getLogFilePath: import_vitest.vi.fn()
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
(0, import_vitest.describe)("executeCommand", () => {
|
|
18
|
+
(0, import_vitest.it)("returns unknown-command guidance when prompts are unsupported and the command is not real", async () => {
|
|
19
|
+
const agent = createAgent({ prompts: false });
|
|
20
|
+
const result = await (0, import_commands.executeCommand)("typoed-command", [], agent);
|
|
21
|
+
(0, import_vitest.expect)(result).toContain("Unknown command");
|
|
22
|
+
});
|
|
23
|
+
(0, import_vitest.it)("still blocks static prompt commands when the prompts capability is disabled", async () => {
|
|
24
|
+
const agent = createAgent({ prompts: false });
|
|
25
|
+
const result = await (0, import_commands.executeCommand)("prompts", [], agent);
|
|
26
|
+
(0, import_vitest.expect)(result).toBe("\u26A0\uFE0F Command /prompts is not available for this chat target.");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.test.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/commands.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { executeCommand } from "./commands.js";
|
|
3
|
+
function createAgent(capabilities) {
|
|
4
|
+
return {
|
|
5
|
+
capabilities,
|
|
6
|
+
logger: {
|
|
7
|
+
debug: vi.fn(),
|
|
8
|
+
info: vi.fn(),
|
|
9
|
+
warn: vi.fn(),
|
|
10
|
+
error: vi.fn(),
|
|
11
|
+
getLevel: vi.fn(),
|
|
12
|
+
getLogFilePath: vi.fn()
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
describe("executeCommand", () => {
|
|
17
|
+
it("returns unknown-command guidance when prompts are unsupported and the command is not real", async () => {
|
|
18
|
+
const agent = createAgent({ prompts: false });
|
|
19
|
+
const result = await executeCommand("typoed-command", [], agent);
|
|
20
|
+
expect(result).toContain("Unknown command");
|
|
21
|
+
});
|
|
22
|
+
it("still blocks static prompt commands when the prompts capability is disabled", async () => {
|
|
23
|
+
const agent = createAgent({ prompts: false });
|
|
24
|
+
const result = await executeCommand("prompts", [], agent);
|
|
25
|
+
expect(result).toBe("\u26A0\uFE0F Command /prompts is not available for this chat target.");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentation-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/documentation-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"documentation-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/documentation-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,qBAAqB,CAAC;AAI7E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,EAkCpD,CAAC"}
|
|
@@ -97,15 +97,15 @@ async function executeShellCommand(command, cwd, timeoutMs = 3e4) {
|
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
function createHelpCommand(
|
|
100
|
+
function createHelpCommand(getAvailableCommandsForAgent) {
|
|
101
101
|
return {
|
|
102
102
|
name: "help",
|
|
103
103
|
description: "Show help information",
|
|
104
104
|
usage: "/help",
|
|
105
105
|
category: "General",
|
|
106
106
|
aliases: ["h", "?"],
|
|
107
|
-
handler: async (_args,
|
|
108
|
-
const allCommands =
|
|
107
|
+
handler: async (_args, agent, _ctx) => {
|
|
108
|
+
const allCommands = getAvailableCommandsForAgent(agent);
|
|
109
109
|
const styledData = {
|
|
110
110
|
commands: allCommands.map((cmd) => ({
|
|
111
111
|
name: cmd.name,
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* - /clear, /reset - Clear conversation history
|
|
11
11
|
*/
|
|
12
12
|
import type { CommandDefinition } from './command-parser.js';
|
|
13
|
+
import type { TuiAgentBackend } from '../agent-backend.js';
|
|
13
14
|
/**
|
|
14
15
|
* Creates the help command with access to all commands for display
|
|
15
16
|
*/
|
|
16
|
-
export declare function createHelpCommand(
|
|
17
|
+
export declare function createHelpCommand(getAvailableCommandsForAgent: (agent: TuiAgentBackend) => CommandDefinition[]): CommandDefinition;
|
|
17
18
|
/**
|
|
18
19
|
* General commands that are available across all contexts
|
|
19
20
|
* Note: The help command is created separately to avoid circular dependencies
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/general-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAwC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"general-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/general-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAwC,MAAM,qBAAqB,CAAC;AAOnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAoG3D;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,4BAA4B,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,iBAAiB,EAAE,GAC9E,iBAAiB,CAgCnB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,iBAAiB,EAwe9C,CAAC"}
|
|
@@ -63,15 +63,15 @@ async function executeShellCommand(command, cwd, timeoutMs = 3e4) {
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function createHelpCommand(
|
|
66
|
+
function createHelpCommand(getAvailableCommandsForAgent) {
|
|
67
67
|
return {
|
|
68
68
|
name: "help",
|
|
69
69
|
description: "Show help information",
|
|
70
70
|
usage: "/help",
|
|
71
71
|
category: "General",
|
|
72
72
|
aliases: ["h", "?"],
|
|
73
|
-
handler: async (_args,
|
|
74
|
-
const allCommands =
|
|
73
|
+
handler: async (_args, agent, _ctx) => {
|
|
74
|
+
const allCommands = getAvailableCommandsForAgent(agent);
|
|
75
75
|
const styledData = {
|
|
76
76
|
commands: allCommands.map((cmd) => ({
|
|
77
77
|
name: cmd.name,
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* - /prompts - List all available prompts (MCP + internal)
|
|
10
10
|
* - /<prompt-name> [args] - Direct prompt execution (auto-generated for each prompt)
|
|
11
11
|
*/
|
|
12
|
-
import type { DextoAgent } from '@dexto/core';
|
|
13
12
|
import type { CommandDefinition } from './command-parser.js';
|
|
13
|
+
import type { TuiAgentBackend } from '../agent-backend.js';
|
|
14
14
|
/**
|
|
15
15
|
* Prompt management commands
|
|
16
16
|
*/
|
|
@@ -21,5 +21,5 @@ export declare const promptCommands: CommandDefinition[];
|
|
|
21
21
|
* Filters out prompts with `userInvocable: false` as these are not intended
|
|
22
22
|
* for direct user invocation via slash commands.
|
|
23
23
|
*/
|
|
24
|
-
export declare function getDynamicPromptCommands(agent:
|
|
24
|
+
export declare function getDynamicPromptCommands(agent: TuiAgentBackend): Promise<CommandDefinition[]>;
|
|
25
25
|
//# sourceMappingURL=prompt-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/prompt-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"prompt-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/prompt-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAwC,MAAM,qBAAqB,CAAC;AAGnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,iBAAiB,EAiI7C,CAAC;AA+JF;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC1C,KAAK,EAAE,eAAe,GACvB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAiB9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-commands.d.ts","sourceRoot":"","sources":["../../../src/interactive-commands/session/session-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"session-commands.d.ts","sourceRoot":"","sources":["../../../src/interactive-commands/session/session-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,sBAAsB,CAAC;AAG9E;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,iBAqB3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,iBAc3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,iBAa3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,iBA8BzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-commands.d.ts","sourceRoot":"","sources":["../../../src/interactive-commands/system/system-commands.ts"],"names":[],"mappings":"AAeA,OAAO,EAEH,KAAK,iBAAiB,EAGzB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"system-commands.d.ts","sourceRoot":"","sources":["../../../src/interactive-commands/system/system-commands.ts"],"names":[],"mappings":"AAeA,OAAO,EAEH,KAAK,iBAAiB,EAGzB,MAAM,sBAAsB,CAAC;AAgB9B;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,iBAAiB,EA8N7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/tool-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"tool-commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/tool-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,qBAAqB,CAAC;AAG7E;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAiB,EAe3C,CAAC"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Command execution service
|
|
3
3
|
* Handles command parsing and execution
|
|
4
4
|
*/
|
|
5
|
-
import type { DextoAgent } from '@dexto/core';
|
|
6
5
|
import type { CommandResult } from '../interactive-commands/command-parser.js';
|
|
7
6
|
import type { StyledMessageType, StyledData } from '../state/types.js';
|
|
7
|
+
import type { TuiAgentBackend } from '../agent-backend.js';
|
|
8
8
|
/**
|
|
9
9
|
* Styled output for command execution
|
|
10
10
|
*/
|
|
@@ -53,6 +53,6 @@ export declare class CommandService {
|
|
|
53
53
|
/**
|
|
54
54
|
* Executes a command and returns the result
|
|
55
55
|
*/
|
|
56
|
-
executeCommand(command: string, args: string[], agent:
|
|
56
|
+
executeCommand(command: string, args: string[], agent: TuiAgentBackend, sessionId?: string, configFilePath?: string | null): Promise<CommandExecutionResult>;
|
|
57
57
|
}
|
|
58
58
|
//# sourceMappingURL=CommandService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandService.d.ts","sourceRoot":"","sources":["../../src/services/CommandService.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"CommandService.d.ts","sourceRoot":"","sources":["../../src/services/CommandService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,YAAY,CAQtE;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAEvE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,iBAAiB,CAShF;AAED;;GAEG;AACH,qBAAa,cAAc;IACvB;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAIxC;;OAEG;IACG,cAAc,CAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,eAAe,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC/B,OAAO,CAAC,sBAAsB,CAAC;CAqBrC"}
|
|
@@ -22,6 +22,7 @@ __export(commandOverlays_exports, {
|
|
|
22
22
|
isInteractiveCommand: () => isInteractiveCommand
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(commandOverlays_exports);
|
|
25
|
+
var import_agent_backend = require("../agent-backend.js");
|
|
25
26
|
const ALWAYS_OVERLAY = {
|
|
26
27
|
search: "search",
|
|
27
28
|
find: "search",
|
|
@@ -50,7 +51,10 @@ const NO_ARGS_OVERLAY = {
|
|
|
50
51
|
log: "log-level-selector",
|
|
51
52
|
prompts: "prompt-list"
|
|
52
53
|
};
|
|
53
|
-
function getCommandOverlay(command, args) {
|
|
54
|
+
function getCommandOverlay(command, args, agent) {
|
|
55
|
+
if (!(0, import_agent_backend.isCommandSupported)(agent, command)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
54
58
|
const alwaysOverlay = ALWAYS_OVERLAY[command];
|
|
55
59
|
if (alwaysOverlay) return alwaysOverlay;
|
|
56
60
|
if (args.length === 0) {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* When adding a new interactive command, add it here - no other files need changes.
|
|
6
6
|
*/
|
|
7
7
|
import type { OverlayType } from '../state/types.js';
|
|
8
|
+
import { type TuiAgentBackend } from '../agent-backend.js';
|
|
8
9
|
/**
|
|
9
10
|
* Get the overlay for a command submission (with parsed args).
|
|
10
11
|
* Used by InputContainer.handleSubmit
|
|
@@ -13,7 +14,7 @@ import type { OverlayType } from '../state/types.js';
|
|
|
13
14
|
* @param args - Arguments passed to the command
|
|
14
15
|
* @returns Overlay type to show, or null to execute command handler
|
|
15
16
|
*/
|
|
16
|
-
export declare function getCommandOverlay(command: string, args: string[]): OverlayType | null;
|
|
17
|
+
export declare function getCommandOverlay(command: string, args: string[], agent: TuiAgentBackend): OverlayType | null;
|
|
17
18
|
/**
|
|
18
19
|
* Check if a command has any overlay behavior.
|
|
19
20
|
* Useful for determining if a command should be handled specially.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandOverlays.d.ts","sourceRoot":"","sources":["../../src/utils/commandOverlays.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"commandOverlays.d.ts","sourceRoot":"","sources":["../../src/utils/commandOverlays.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAqC/E;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,eAAe,GACvB,WAAW,GAAG,IAAI,CAgBpB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE7D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isCommandSupported } from "../agent-backend.js";
|
|
1
2
|
const ALWAYS_OVERLAY = {
|
|
2
3
|
search: "search",
|
|
3
4
|
find: "search",
|
|
@@ -26,7 +27,10 @@ const NO_ARGS_OVERLAY = {
|
|
|
26
27
|
log: "log-level-selector",
|
|
27
28
|
prompts: "prompt-list"
|
|
28
29
|
};
|
|
29
|
-
function getCommandOverlay(command, args) {
|
|
30
|
+
function getCommandOverlay(command, args, agent) {
|
|
31
|
+
if (!isCommandSupported(agent, command)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
30
34
|
const alwaysOverlay = ALWAYS_OVERLAY[command];
|
|
31
35
|
if (alwaysOverlay) return alwaysOverlay;
|
|
32
36
|
if (args.length === 0) {
|
|
@@ -54,6 +54,7 @@ module.exports = __toCommonJS(messageFormatting_exports);
|
|
|
54
54
|
var import_path = __toESM(require("path"), 1);
|
|
55
55
|
var import_os = __toESM(require("os"), 1);
|
|
56
56
|
var import_core = require("@dexto/core");
|
|
57
|
+
var import_agent_backend = require("../agent-backend.js");
|
|
57
58
|
var import_idGenerator = require("./idGenerator.js");
|
|
58
59
|
const HIDDEN_TOOL_NAMES = /* @__PURE__ */ new Set(["wait_for"]);
|
|
59
60
|
function normalizeToolName(toolName) {
|
|
@@ -406,6 +407,17 @@ function convertHistoryToUIMessages(history, sessionId) {
|
|
|
406
407
|
return uiMessages;
|
|
407
408
|
}
|
|
408
409
|
async function getStartupInfo(agent, sessionId) {
|
|
410
|
+
if (!(0, import_agent_backend.supportsStartupInfo)(agent)) {
|
|
411
|
+
return {
|
|
412
|
+
connectedServers: {
|
|
413
|
+
count: 0,
|
|
414
|
+
names: []
|
|
415
|
+
},
|
|
416
|
+
failedConnections: [],
|
|
417
|
+
toolCount: 0,
|
|
418
|
+
logFile: null
|
|
419
|
+
};
|
|
420
|
+
}
|
|
409
421
|
const connectedServers = agent.mcpManager.getClients();
|
|
410
422
|
const failedConnections = agent.mcpManager.getFailedConnections();
|
|
411
423
|
const tools = await agent.getAllTools();
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Message formatting utilities
|
|
3
3
|
* Helpers for creating and formatting messages
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { InternalMessage, ToolPresentationSnapshotV1 } from '@dexto/core';
|
|
6
6
|
import type { Message, ExternalTriggerStyledData } from '../state/types.js';
|
|
7
|
+
import { type TuiAgentBackend } from '../agent-backend.js';
|
|
7
8
|
export declare function normalizeToolName(toolName: string): string;
|
|
8
9
|
export declare function shouldHideTool(toolName: string | undefined): boolean;
|
|
9
10
|
/**
|
|
@@ -119,7 +120,7 @@ export declare function convertHistoryToUIMessages(history: InternalMessage[], s
|
|
|
119
120
|
/**
|
|
120
121
|
* Collects startup information for display in header
|
|
121
122
|
*/
|
|
122
|
-
export declare function getStartupInfo(agent:
|
|
123
|
+
export declare function getStartupInfo(agent: TuiAgentBackend, sessionId: string | null): Promise<{
|
|
123
124
|
connectedServers: {
|
|
124
125
|
count: number;
|
|
125
126
|
names: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageFormatting.d.ts","sourceRoot":"","sources":["../../src/utils/messageFormatting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACR,
|
|
1
|
+
{"version":3,"file":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AoIX;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;;;;;;;;GA+BpF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import os from "os";
|
|
3
3
|
import { isTextPart, isAssistantMessage, isToolMessage } from "@dexto/core";
|
|
4
|
+
import { supportsStartupInfo } from "../agent-backend.js";
|
|
4
5
|
const HIDDEN_TOOL_NAMES = /* @__PURE__ */ new Set(["wait_for"]);
|
|
5
6
|
function normalizeToolName(toolName) {
|
|
6
7
|
if (toolName.startsWith("mcp--")) {
|
|
@@ -353,6 +354,17 @@ function convertHistoryToUIMessages(history, sessionId) {
|
|
|
353
354
|
return uiMessages;
|
|
354
355
|
}
|
|
355
356
|
async function getStartupInfo(agent, sessionId) {
|
|
357
|
+
if (!supportsStartupInfo(agent)) {
|
|
358
|
+
return {
|
|
359
|
+
connectedServers: {
|
|
360
|
+
count: 0,
|
|
361
|
+
names: []
|
|
362
|
+
},
|
|
363
|
+
failedConnections: [],
|
|
364
|
+
toolCount: 0,
|
|
365
|
+
logFile: null
|
|
366
|
+
};
|
|
367
|
+
}
|
|
356
368
|
const connectedServers = agent.mcpManager.getClients();
|
|
357
369
|
const failedConnections = agent.mcpManager.getFailedConnections();
|
|
358
370
|
const tools = await agent.getAllTools();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/tui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.17",
|
|
4
4
|
"description": "Interactive terminal UI for Dexto CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"string-width": "^8.1.0",
|
|
29
29
|
"strip-ansi": "^7.1.2",
|
|
30
30
|
"wrap-ansi": "^9.0.2",
|
|
31
|
-
"@dexto/agent-management": "1.6.
|
|
32
|
-
"@dexto/core": "1.6.
|
|
33
|
-
"@dexto/registry": "1.6.
|
|
31
|
+
"@dexto/agent-management": "1.6.17",
|
|
32
|
+
"@dexto/core": "1.6.17",
|
|
33
|
+
"@dexto/registry": "1.6.17"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/react": "^19.0.0",
|