@robota-sdk/agent-transport 3.0.0-beta.65 → 3.0.0-beta.67
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 +97 -0
- package/dist/node/chunk-Bmb41Sf3.cjs +1 -0
- package/dist/node/headless/index.cjs +1 -1
- package/dist/node/headless/index.d.ts +2 -2
- package/dist/node/headless/index.js +1 -1
- package/dist/node/headless-B8yWkXW_.js +15 -0
- package/dist/node/headless-B8yWkXW_.js.map +1 -0
- package/dist/node/headless-Dp3kQVmo.cjs +14 -0
- package/dist/node/http/index.cjs +1 -1
- package/dist/node/http/index.d.ts +1 -1
- package/dist/node/http/index.js +1 -1
- package/dist/node/{http-DwO1AHG-.js → http-Br10Ps8m.js} +1 -1
- package/dist/node/http-Br10Ps8m.js.map +1 -0
- package/dist/node/http-Da6Kw4oy.cjs +1 -0
- package/dist/node/{index-B_rcr14p.d.ts → index-C5KNEBO9.d.ts} +2 -2
- package/dist/node/{index-B_rcr14p.d.ts.map → index-C5KNEBO9.d.ts.map} +1 -1
- package/dist/node/{index-Y0zHb1Bz.d.ts → index-C7DvsmEg.d.ts} +2 -2
- package/dist/node/{index-Y0zHb1Bz.d.ts.map → index-C7DvsmEg.d.ts.map} +1 -1
- package/dist/node/index-C9LWCL4l.d.ts.map +1 -1
- package/dist/node/{index-k3TUjA-T.d.ts → index-CP7kaYMg.d.ts} +17 -2
- package/dist/node/index-CP7kaYMg.d.ts.map +1 -0
- package/dist/node/index-CQsMNXAh.d.ts +67 -0
- package/dist/node/index-CQsMNXAh.d.ts.map +1 -0
- package/dist/node/{index-nBlMTFkZ.d.ts → index-DOA2KIYt.d.ts} +2 -2
- package/dist/node/{index-nBlMTFkZ.d.ts.map → index-DOA2KIYt.d.ts.map} +1 -1
- package/dist/node/{index-D34WUfFH.d.ts → index-Gby9H4q2.d.ts} +17 -2
- package/dist/node/index-Gby9H4q2.d.ts.map +1 -0
- package/dist/node/{index-CvXLpjJO.d.ts → index-X2Zg8FEY.d.ts} +2 -2
- package/dist/node/{index-CEs25wVk.d.ts.map → index-X2Zg8FEY.d.ts.map} +1 -1
- package/dist/node/index-rGmGTQ9o.d.ts +67 -0
- package/dist/node/index-rGmGTQ9o.d.ts.map +1 -0
- package/dist/node/{index-CEs25wVk.d.ts → index-yvGShbDx.d.ts} +2 -2
- package/dist/node/{index-CvXLpjJO.d.ts.map → index-yvGShbDx.d.ts.map} +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.ts +28 -6
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -0
- package/dist/node/mcp/index.cjs +1 -1
- package/dist/node/mcp/index.d.ts +1 -1
- package/dist/node/mcp/index.js +1 -1
- package/dist/node/{mcp-BXBwF6Wu.js → mcp-BAujHOMr.js} +1 -1
- package/dist/node/mcp-BAujHOMr.js.map +1 -0
- package/dist/node/mcp-Bl8jUfev.cjs +1 -0
- package/dist/node/tui/index.cjs +1 -1
- package/dist/node/tui/index.d.ts +2 -2
- package/dist/node/tui/index.js +1 -1
- package/dist/node/tui-B8G3yHrL.cjs +24 -0
- package/dist/node/tui-DUIfVw3G.js +25 -0
- package/dist/node/tui-DUIfVw3G.js.map +1 -0
- package/dist/node/ws/index.cjs +1 -1
- package/dist/node/ws/index.d.ts +1 -1
- package/dist/node/ws/index.js +1 -1
- package/dist/node/{ws-B-oRccFl.js → ws-BWel8nzl.js} +1 -1
- package/dist/node/ws-BWel8nzl.js.map +1 -0
- package/dist/node/ws-tCjj2gPu.cjs +1 -0
- package/package.json +19 -18
- package/src/headless/cli-input.ts +50 -0
- package/src/headless/headless-runner.ts +2 -1
- package/src/headless/headless-stream-json.ts +1 -0
- package/src/headless/headless-transport.ts +3 -2
- package/src/headless/index.ts +2 -0
- package/src/headless/print-terminal.ts +57 -0
- package/src/http/http-transport.ts +3 -3
- package/src/http/routes.ts +2 -1
- package/src/index.ts +2 -1
- package/src/mcp/mcp-server.ts +1 -0
- package/src/mcp/mcp-transport.ts +3 -2
- package/src/transport-registry.ts +100 -0
- package/src/tui/App.tsx +52 -34
- package/src/tui/BackgroundTaskPanel.tsx +4 -2
- package/src/tui/CjkTextInput.tsx +3 -2
- package/src/tui/ConfirmPrompt.tsx +2 -1
- package/src/tui/ExecutionWorkspaceDetailPane.tsx +7 -5
- package/src/tui/ExecutionWorkspaceSwitcher.tsx +8 -6
- package/src/tui/InputArea.tsx +20 -19
- package/src/tui/InteractivePrompt.tsx +5 -3
- package/src/tui/ListPicker.tsx +2 -1
- package/src/tui/MenuSelect.tsx +2 -1
- package/src/tui/MessageList.tsx +8 -6
- package/src/tui/PermissionPrompt.tsx +5 -3
- package/src/tui/PluginTUI.tsx +5 -3
- package/src/tui/SessionPicker.tsx +4 -2
- package/src/tui/SessionStatusBar.tsx +7 -3
- package/src/tui/SlashAutocomplete.tsx +4 -3
- package/src/tui/StatusBar.tsx +5 -3
- package/src/tui/StreamingIndicator.tsx +4 -2
- package/src/tui/TextPrompt.tsx +2 -1
- package/src/tui/ToolCommandOutput.tsx +4 -2
- package/src/tui/ToolDiffBlock.tsx +4 -2
- package/src/tui/TransportTUI.tsx +3 -2
- package/src/tui/UpdateNotice.tsx +1 -1
- package/src/tui/UsageSummaryEntry.tsx +3 -2
- package/src/tui/WaveText.tsx +1 -1
- package/src/tui/__tests__/fixtures/provider-setup-prompt-driver.tsx +7 -4
- package/src/tui/background-task-row-format.ts +2 -1
- package/src/tui/command-interaction-registry.ts +66 -0
- package/src/tui/command-interaction.ts +9 -35
- package/src/tui/create-default-tui-cli-adapter.ts +42 -0
- package/src/tui/flows/input-area-flow.ts +3 -2
- package/src/tui/hooks/command-effect-handler.ts +4 -3
- package/src/tui/hooks/side-effects-types.ts +1 -1
- package/src/tui/hooks/use-interactive-session-init.ts +4 -2
- package/src/tui/hooks/useAutocomplete.ts +1 -0
- package/src/tui/hooks/useInteractiveSession.ts +22 -19
- package/src/tui/hooks/usePermissionQueue.ts +2 -1
- package/src/tui/hooks/usePluginCallbacks.ts +1 -0
- package/src/tui/hooks/usePluginScreenData.ts +2 -1
- package/src/tui/hooks/useSideEffects.ts +8 -6
- package/src/tui/hooks/useSlashRouting.ts +4 -3
- package/src/tui/hooks/useStatusLineSettings.ts +4 -2
- package/src/tui/index.ts +3 -1
- package/src/tui/interactions/CommandConfirm.tsx +2 -1
- package/src/tui/interactions/CommandPicker.tsx +2 -1
- package/src/tui/render-markdown.ts +2 -1
- package/src/tui/render.tsx +12 -28
- package/src/tui/tui-cli-adapter-context.tsx +1 -0
- package/src/tui/tui-cli-adapter.ts +1 -1
- package/src/tui/tui-transport.ts +5 -4
- package/src/tui/utils/edit-diff.ts +1 -0
- package/src/tui/utils/tool-call-extractor.ts +1 -0
- package/src/ws/ws-background-messages.ts +1 -1
- package/src/ws/ws-handler.ts +6 -5
- package/src/ws/ws-transport-configurable.ts +6 -3
- package/src/ws/ws-transport.ts +3 -2
- package/dist/node/headless-CWEpJXFK.js +0 -7
- package/dist/node/headless-CWEpJXFK.js.map +0 -1
- package/dist/node/headless-DJ5pnxM6.cjs +0 -6
- package/dist/node/http-CuQE6V6t.cjs +0 -1
- package/dist/node/http-DwO1AHG-.js.map +0 -1
- package/dist/node/index-CSgNoyPK.d.ts +0 -85
- package/dist/node/index-CSgNoyPK.d.ts.map +0 -1
- package/dist/node/index-D34WUfFH.d.ts.map +0 -1
- package/dist/node/index-_dNm-2J3.d.ts +0 -85
- package/dist/node/index-_dNm-2J3.d.ts.map +0 -1
- package/dist/node/index-k3TUjA-T.d.ts.map +0 -1
- package/dist/node/mcp-BXBwF6Wu.js.map +0 -1
- package/dist/node/mcp-BiJsIywJ.cjs +0 -1
- package/dist/node/tui-BIpIcT7-.cjs +0 -24
- package/dist/node/tui-DBLn1T15.js +0 -25
- package/dist/node/tui-DBLn1T15.js.map +0 -1
- package/dist/node/ws-B-oRccFl.js.map +0 -1
- package/dist/node/ws-XRTSFZOK.cjs +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Box, Text } from 'ink';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
4
|
import { formatBackgroundTaskRow } from './background-task-row-format.js';
|
|
5
5
|
|
|
6
|
+
import type { IExecutionWorkspaceEntry } from '@robota-sdk/agent-framework';
|
|
7
|
+
|
|
6
8
|
interface IProps {
|
|
7
9
|
entries: IExecutionWorkspaceEntry[];
|
|
8
10
|
}
|
package/src/tui/CjkTextInput.tsx
CHANGED
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
* Drop-in replacement: same props as ink-text-input.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import React, { useRef, useState } from 'react';
|
|
15
|
-
import { Text, useInput, usePaste } from 'ink';
|
|
16
14
|
import chalk from 'chalk';
|
|
15
|
+
import { Text, useInput, usePaste } from 'ink';
|
|
16
|
+
import React, { useRef, useState } from 'react';
|
|
17
|
+
|
|
17
18
|
import {
|
|
18
19
|
applyCjkTextInput,
|
|
19
20
|
applyCjkTextPaste,
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Used by model change, permission prompts, and other yes/no confirmations.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import React, { useState, useRef, useCallback } from 'react';
|
|
7
6
|
import { Box, Text, useInput } from 'ink';
|
|
7
|
+
import React, { useState, useRef, useCallback } from 'react';
|
|
8
|
+
|
|
8
9
|
import {
|
|
9
10
|
applyConfirmPromptInput,
|
|
10
11
|
getConfirmPromptInputAction,
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Box, Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
formatExecutionDetailRecord,
|
|
6
|
+
formatExecutionWorkspaceEntryRow,
|
|
7
|
+
} from './execution-workspace-view-model.js';
|
|
8
|
+
|
|
3
9
|
import type {
|
|
4
10
|
IExecutionDetailPage,
|
|
5
11
|
IExecutionWorkspaceEntry,
|
|
6
12
|
TExecutionDetailRecordKind,
|
|
7
13
|
} from '@robota-sdk/agent-framework';
|
|
8
|
-
import {
|
|
9
|
-
formatExecutionDetailRecord,
|
|
10
|
-
formatExecutionWorkspaceEntryRow,
|
|
11
|
-
} from './execution-workspace-view-model.js';
|
|
12
14
|
|
|
13
15
|
const MAX_VISIBLE_DETAIL_RECORDS = 12;
|
|
14
16
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
1
|
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '@robota-sdk/agent-framework';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { formatExecutionWorkspaceEntryRow } from './execution-workspace-view-model.js';
|
|
7
5
|
import {
|
|
8
6
|
applySelectionInput,
|
|
9
7
|
createSelectionFlowState,
|
|
@@ -12,7 +10,11 @@ import {
|
|
|
12
10
|
type ISelectionFlowState,
|
|
13
11
|
type TSelectionInputAction,
|
|
14
12
|
} from './flows/selection-flow.js';
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
import type {
|
|
15
|
+
IExecutionWorkspaceEntry,
|
|
16
|
+
IExecutionWorkspaceSnapshot,
|
|
17
|
+
} from '@robota-sdk/agent-framework';
|
|
16
18
|
|
|
17
19
|
const MAX_VISIBLE_WORKSPACE_ENTRIES = 8;
|
|
18
20
|
|
package/src/tui/InputArea.tsx
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { Box, Text, useInput, useWindowSize } from 'ink';
|
|
1
2
|
import React, { useState, useCallback, useRef, useMemo } from 'react';
|
|
2
3
|
|
|
3
4
|
const PENDING_PROMPT_DISPLAY_MAX = 50;
|
|
4
5
|
const PENDING_PROMPT_TAIL_KEEP = 47;
|
|
5
|
-
|
|
6
|
-
import type { IHistoryEntry } from '@robota-sdk/agent-core';
|
|
7
|
-
import type { CommandRegistry, ICommand } from '@robota-sdk/agent-framework';
|
|
6
|
+
|
|
8
7
|
import CjkTextInput from './CjkTextInput.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
import { resolveCommandInteraction } from './command-interaction-registry.js';
|
|
9
|
+
import {
|
|
10
|
+
isPickerInteraction,
|
|
11
|
+
isConfirmInteraction,
|
|
12
|
+
type ITuiCommandInteraction,
|
|
13
|
+
type ITuiPickerItem,
|
|
14
|
+
} from './command-interaction.js';
|
|
15
15
|
import {
|
|
16
16
|
appendPromptHistory,
|
|
17
17
|
createPasteLabelChange,
|
|
@@ -26,12 +26,15 @@ import {
|
|
|
26
26
|
resolveTabCompletion,
|
|
27
27
|
shouldSubmitInput,
|
|
28
28
|
} from './flows/input-area-flow.js';
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
import { useAutocomplete } from './hooks/useAutocomplete.js';
|
|
30
|
+
import CommandConfirm from './interactions/CommandConfirm.js';
|
|
31
|
+
import CommandPicker from './interactions/CommandPicker.js';
|
|
32
|
+
import SlashAutocomplete from './SlashAutocomplete.js';
|
|
33
|
+
import { expandPasteLabels } from './utils/paste-labels.js';
|
|
34
|
+
import WaveText from './WaveText.js';
|
|
35
|
+
|
|
36
|
+
import type { IHistoryEntry } from '@robota-sdk/agent-core';
|
|
37
|
+
import type { CommandRegistry, ICommand } from '@robota-sdk/agent-framework';
|
|
35
38
|
|
|
36
39
|
interface IActiveInteraction {
|
|
37
40
|
commandName: string;
|
|
@@ -47,7 +50,6 @@ interface IProps {
|
|
|
47
50
|
registry?: CommandRegistry;
|
|
48
51
|
sessionName?: string;
|
|
49
52
|
history?: readonly IHistoryEntry[];
|
|
50
|
-
resolveInteraction?: (commandName: string) => ITuiCommandInteraction | undefined;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
/**
|
|
@@ -79,7 +81,6 @@ export default function InputArea({
|
|
|
79
81
|
registry,
|
|
80
82
|
sessionName,
|
|
81
83
|
history,
|
|
82
|
-
resolveInteraction,
|
|
83
84
|
}: IProps): React.ReactElement {
|
|
84
85
|
const [value, setValue] = useState('');
|
|
85
86
|
const [cursorHint, setCursorHint] = useState<number | null>(null);
|
|
@@ -155,7 +156,7 @@ export default function InputArea({
|
|
|
155
156
|
/** Enter: insert and execute command immediately */
|
|
156
157
|
const enterSelectCommand = useCallback(
|
|
157
158
|
(cmd: ICommand): void => {
|
|
158
|
-
const interaction =
|
|
159
|
+
const interaction = resolveCommandInteraction(cmd.name);
|
|
159
160
|
const result = resolveEnterCommandSelection(value, cmd, interaction);
|
|
160
161
|
if (result.type === 'insert') {
|
|
161
162
|
setValue(result.value);
|
|
@@ -174,7 +175,7 @@ export default function InputArea({
|
|
|
174
175
|
submitPrompt(result.value);
|
|
175
176
|
}
|
|
176
177
|
},
|
|
177
|
-
[value, submitPrompt, setSelectedIndex,
|
|
178
|
+
[value, submitPrompt, setSelectedIndex, setShowPopup],
|
|
178
179
|
);
|
|
179
180
|
|
|
180
181
|
const handleSubmit = useCallback(
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Box, Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import ListPicker from './ListPicker.js';
|
|
5
|
+
import TextPrompt from './TextPrompt.js';
|
|
6
|
+
|
|
3
7
|
import type {
|
|
4
8
|
TCommandInteractionPrompt as TInteractivePrompt,
|
|
5
9
|
ICommandChoicePromptOption as IChoicePromptOption,
|
|
6
10
|
} from '@robota-sdk/agent-framework';
|
|
7
|
-
import ListPicker from './ListPicker.js';
|
|
8
|
-
import TextPrompt from './TextPrompt.js';
|
|
9
11
|
|
|
10
12
|
interface IInteractivePromptProps {
|
|
11
13
|
prompt: TInteractivePrompt;
|
package/src/tui/ListPicker.tsx
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Shows a limited number of items at a time; scrolls as the cursor moves.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, { useState, useRef, useCallback } from 'react';
|
|
8
7
|
import { Box, Text, useInput } from 'ink';
|
|
8
|
+
import React, { useState, useRef, useCallback } from 'react';
|
|
9
|
+
|
|
9
10
|
import {
|
|
10
11
|
applySelectionInput,
|
|
11
12
|
createSelectionFlowState,
|
package/src/tui/MenuSelect.tsx
CHANGED
package/src/tui/MessageList.tsx
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import type { IHistoryEntry, TUniversalMessage, TUniversalValue } from '@robota-sdk/agent-core';
|
|
4
1
|
import { isToolMessage, isAssistantMessage } from '@robota-sdk/agent-core';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { formatCommandOutputSummary } from './command-output-summary.js';
|
|
5
6
|
import { renderMarkdown } from './render-markdown.js';
|
|
6
|
-
import
|
|
7
|
+
import ToolCommandOutput from './ToolCommandOutput.js';
|
|
7
8
|
import ToolDiffBlock from './ToolDiffBlock.js';
|
|
8
9
|
import UsageSummaryEntry from './UsageSummaryEntry.js';
|
|
9
|
-
|
|
10
|
-
import
|
|
10
|
+
|
|
11
|
+
import type { IToolCallSummary } from './utils/tool-call-extractor.js';
|
|
12
|
+
import type { IHistoryEntry, TUniversalMessage, TUniversalValue } from '@robota-sdk/agent-core';
|
|
11
13
|
|
|
12
14
|
interface IProps {
|
|
13
15
|
history: IHistoryEntry[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
5
4
|
import {
|
|
6
5
|
applyPermissionPromptInput,
|
|
7
6
|
getPermissionPromptInputAction,
|
|
@@ -10,6 +9,9 @@ import {
|
|
|
10
9
|
} from './flows/permission-prompt-flow.js';
|
|
11
10
|
import { createSelectionFlowState, type ISelectionFlowState } from './flows/selection-flow.js';
|
|
12
11
|
|
|
12
|
+
import type { IPermissionRequest } from './types.js';
|
|
13
|
+
import type { TToolArgs } from '@robota-sdk/agent-core';
|
|
14
|
+
|
|
13
15
|
interface IProps {
|
|
14
16
|
request: IPermissionRequest;
|
|
15
17
|
}
|
package/src/tui/PluginTUI.tsx
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useState, useCallback } from 'react';
|
|
7
|
-
|
|
8
|
-
import TextPrompt from './TextPrompt.js';
|
|
7
|
+
|
|
9
8
|
import ConfirmPrompt from './ConfirmPrompt.js';
|
|
9
|
+
import { usePluginScreenData } from './hooks/usePluginScreenData.js';
|
|
10
|
+
import MenuSelect from './MenuSelect.js';
|
|
10
11
|
import {
|
|
11
12
|
handleMainSelect,
|
|
12
13
|
handleMarketplaceListSelect,
|
|
@@ -16,9 +17,10 @@ import {
|
|
|
16
17
|
handleInstalledListSelect,
|
|
17
18
|
handleInstalledActionSelect,
|
|
18
19
|
} from './plugin-tui-handlers.js';
|
|
20
|
+
import TextPrompt from './TextPrompt.js';
|
|
21
|
+
|
|
19
22
|
import type { IMenuSelectItem } from './MenuSelect.js';
|
|
20
23
|
import type { ICommandPluginAdapter } from '@robota-sdk/agent-framework';
|
|
21
|
-
import { usePluginScreenData } from './hooks/usePluginScreenData.js';
|
|
22
24
|
|
|
23
25
|
type TScreenId =
|
|
24
26
|
| 'main'
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* Shows a list of sessions for the current cwd.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import React from 'react';
|
|
7
6
|
import { Box, Text } from 'ink';
|
|
8
|
-
import
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
9
|
import ListPicker from './ListPicker.js';
|
|
10
10
|
|
|
11
|
+
import type { IResumableSessionSummary } from '@robota-sdk/agent-framework';
|
|
12
|
+
|
|
11
13
|
const SESSION_ID_DISPLAY_LENGTH = 8;
|
|
12
14
|
const SESSION_PREVIEW_DISPLAY_LENGTH = 60;
|
|
13
15
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import StatusBar from './StatusBar.js';
|
|
4
|
+
import { useTuiCliAdapter } from './tui-cli-adapter-context.js';
|
|
5
|
+
|
|
2
6
|
import type { TPermissionMode } from '@robota-sdk/agent-core';
|
|
3
7
|
import type { IStatusLineCommandSettings } from '@robota-sdk/agent-framework';
|
|
4
|
-
import { useTuiCliAdapter } from './tui-cli-adapter-context.js';
|
|
5
|
-
import StatusBar from './StatusBar.js';
|
|
6
8
|
|
|
7
9
|
interface IProps {
|
|
8
10
|
cwd: string;
|
|
@@ -18,6 +20,7 @@ interface IProps {
|
|
|
18
20
|
sessionName?: string;
|
|
19
21
|
settings: IStatusLineCommandSettings;
|
|
20
22
|
activeAgentLabel?: string;
|
|
23
|
+
gitRefreshToken?: number;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export default function SessionStatusBar({
|
|
@@ -34,9 +37,10 @@ export default function SessionStatusBar({
|
|
|
34
37
|
sessionName,
|
|
35
38
|
settings,
|
|
36
39
|
activeAgentLabel,
|
|
40
|
+
gitRefreshToken,
|
|
37
41
|
}: IProps): React.ReactElement | null {
|
|
38
42
|
const cliAdapter = useTuiCliAdapter();
|
|
39
|
-
const gitBranch = useMemo(() => cliAdapter.getGitBranch(cwd), [cliAdapter, cwd]);
|
|
43
|
+
const gitBranch = useMemo(() => cliAdapter.getGitBranch(cwd), [cliAdapter, cwd, gitRefreshToken]);
|
|
40
44
|
const providerDisplayName = useMemo(
|
|
41
45
|
() =>
|
|
42
46
|
providerType !== undefined ? cliAdapter.getProviderDisplayName(providerType) : undefined,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
1
|
import { Box, Text, useStdout } from 'ink';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
|
|
3
4
|
import type { ICommand } from '@robota-sdk/agent-framework';
|
|
4
5
|
|
|
5
6
|
interface IProps {
|
|
@@ -21,11 +22,11 @@ const NAME_COL_MAX = 20;
|
|
|
21
22
|
|
|
22
23
|
function useRowWidth(): number {
|
|
23
24
|
const { stdout } = useStdout();
|
|
24
|
-
const measure = () => Math.max(MIN_ROW_WIDTH, (stdout.columns ?? 80) - OUTER_CHROME);
|
|
25
|
+
const measure = (): number => Math.max(MIN_ROW_WIDTH, (stdout.columns ?? 80) - OUTER_CHROME);
|
|
25
26
|
const [width, setWidth] = useState(measure);
|
|
26
27
|
|
|
27
28
|
useEffect(() => {
|
|
28
|
-
const onResize = () => setWidth(measure());
|
|
29
|
+
const onResize = (): void => setWidth(measure());
|
|
29
30
|
stdout.on('resize', onResize);
|
|
30
31
|
return () => {
|
|
31
32
|
stdout.off('resize', onResize);
|
package/src/tui/StatusBar.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import type { TPermissionMode } from '@robota-sdk/agent-core';
|
|
4
1
|
import { formatTokenCount } from '@robota-sdk/agent-core';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
5
|
import { formatStatusActivity } from './status-activity.js';
|
|
6
6
|
|
|
7
|
+
import type { TPermissionMode } from '@robota-sdk/agent-core';
|
|
8
|
+
|
|
7
9
|
/** Threshold boundaries for context percentage color coding */
|
|
8
10
|
const CONTEXT_YELLOW_THRESHOLD = 70;
|
|
9
11
|
const CONTEXT_RED_THRESHOLD = 90;
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* Displayed during session.run() execution.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import React from 'react';
|
|
7
6
|
import { Box, Text } from 'ink';
|
|
8
|
-
import
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
9
|
import { renderMarkdown } from './render-markdown.js';
|
|
10
10
|
import ToolDiffBlock from './ToolDiffBlock.js';
|
|
11
11
|
|
|
12
|
+
import type { IToolState } from '@robota-sdk/agent-framework';
|
|
13
|
+
|
|
12
14
|
function getToolStyle(t: IToolState): {
|
|
13
15
|
color: string;
|
|
14
16
|
icon: string;
|
package/src/tui/TextPrompt.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Box, Text } from 'ink';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
4
|
import { formatCommandOutputSummary } from './command-output-summary.js';
|
|
5
5
|
|
|
6
|
+
import type { ICommandOutputInput } from './command-output-summary.js';
|
|
7
|
+
|
|
6
8
|
interface IProps {
|
|
7
9
|
tool: ICommandOutputInput;
|
|
8
10
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Box, Text } from 'ink';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
4
|
import { renderMarkdown } from './render-markdown.js';
|
|
5
|
+
import { buildToolDiffSummary } from './utils/tool-diff-summary.js';
|
|
6
|
+
|
|
5
7
|
import type { IDiffLine } from './utils/edit-diff.js';
|
|
6
8
|
|
|
7
9
|
interface IProps {
|
package/src/tui/TransportTUI.tsx
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Arrow keys navigate the list, space toggles enabled/disabled, enter/esc closes.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, { useState, useCallback } from 'react';
|
|
8
7
|
import { Box, Text, useInput } from 'ink';
|
|
8
|
+
import React, { useState, useCallback } from 'react';
|
|
9
|
+
|
|
10
|
+
import type { IInteractiveSession } from '@robota-sdk/agent-framework';
|
|
9
11
|
import type {
|
|
10
12
|
ITransportEntry,
|
|
11
13
|
ITransportRegistryView,
|
|
12
14
|
} from '@robota-sdk/agent-interface-transport';
|
|
13
|
-
import type { IInteractiveSession } from '@robota-sdk/agent-framework';
|
|
14
15
|
|
|
15
16
|
const TRANSPORT_NAME_WIDTH = 18;
|
|
16
17
|
|
package/src/tui/UpdateNotice.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { formatTokenCount } from '@robota-sdk/agent-core';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
3
5
|
import type { IHistoryEntry } from '@robota-sdk/agent-core';
|
|
4
|
-
import { formatTokenCount } from '@robota-sdk/agent-core';
|
|
5
6
|
import type { IUsageSnapshot } from '@robota-sdk/agent-framework';
|
|
6
7
|
|
|
7
8
|
const TOKEN_COMPACT_THRESHOLD = 1000;
|
package/src/tui/WaveText.tsx
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Colors stay in a narrow range (dim grays) to avoid harsh contrast.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, { useState, useEffect } from 'react';
|
|
8
7
|
import { Text } from 'ink';
|
|
8
|
+
import React, { useState, useEffect } from 'react';
|
|
9
9
|
|
|
10
10
|
// Subtle gray tones — minimal contrast, soft wave
|
|
11
11
|
const WAVE_COLORS = ['#666666', '#888888', '#aaaaaa', '#888888'] as const;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { writeFileSync } from 'node:fs';
|
|
3
|
-
|
|
4
|
-
import InteractivePrompt from '../../InteractivePrompt.js';
|
|
5
|
-
import type { TCommandInteractionPrompt as TInteractivePrompt } from '@robota-sdk/agent-framework';
|
|
2
|
+
|
|
6
3
|
import {
|
|
7
4
|
createProviderSetupFlow,
|
|
8
5
|
formatProviderSetupHelpLinks,
|
|
@@ -12,7 +9,13 @@ import {
|
|
|
12
9
|
type IProviderSetupFlowState,
|
|
13
10
|
type TProviderSetupType,
|
|
14
11
|
} from '@robota-sdk/agent-command';
|
|
12
|
+
import { render, useApp } from 'ink';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
|
|
15
|
+
import InteractivePrompt from '../../InteractivePrompt.js';
|
|
16
|
+
|
|
15
17
|
import type { IAIProvider, IProviderDefinition } from '@robota-sdk/agent-core';
|
|
18
|
+
import type { TCommandInteractionPrompt as TInteractivePrompt } from '@robota-sdk/agent-framework';
|
|
16
19
|
|
|
17
20
|
const openaiDefaults = {
|
|
18
21
|
apiKey: '$ENV:OPENAI_API_KEY',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { IExecutionWorkspaceEntry } from '@robota-sdk/agent-framework';
|
|
2
1
|
import { formatExecutionWorkspaceEntryRow } from './execution-workspace-view-model.js';
|
|
3
2
|
|
|
3
|
+
import type { IExecutionWorkspaceEntry } from '@robota-sdk/agent-framework';
|
|
4
|
+
|
|
4
5
|
export interface IBackgroundTaskRow {
|
|
5
6
|
connector: '├' | '└';
|
|
6
7
|
marker: '□' | '■';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ITuiPickerItem, TAnyTuiCommandInteraction } from './command-interaction.js';
|
|
2
|
+
|
|
3
|
+
function getModeItems(): ITuiPickerItem[] {
|
|
4
|
+
return [
|
|
5
|
+
{ label: 'plan', value: 'plan', description: 'Plan only, no execution' },
|
|
6
|
+
{ label: 'default', value: 'default', description: 'Ask before risky actions' },
|
|
7
|
+
{ label: 'acceptEdits', value: 'acceptEdits', description: 'Auto-approve file edits' },
|
|
8
|
+
{
|
|
9
|
+
label: 'bypassPermissions',
|
|
10
|
+
value: 'bypassPermissions',
|
|
11
|
+
description: 'Skip all permission checks',
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getLanguageItems(): ITuiPickerItem[] {
|
|
17
|
+
return [
|
|
18
|
+
{ label: 'ko Korean', value: 'ko', description: '한국어' },
|
|
19
|
+
{ label: 'en English', value: 'en', description: 'English' },
|
|
20
|
+
{ label: 'ja Japanese', value: 'ja', description: '日本語' },
|
|
21
|
+
{ label: 'zh Chinese', value: 'zh', description: '中文' },
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getProviderSubcommandItems(): ITuiPickerItem[] {
|
|
26
|
+
return [
|
|
27
|
+
{ label: 'current', value: 'current', description: 'Show current provider' },
|
|
28
|
+
{ label: 'list', value: 'list', description: 'List available providers' },
|
|
29
|
+
{ label: 'use', value: 'use', description: 'Switch to a provider' },
|
|
30
|
+
{ label: 'add', value: 'add', description: 'Add a new provider' },
|
|
31
|
+
{ label: 'test', value: 'test', description: 'Test provider connection' },
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const BUILT_IN_INTERACTIONS: Record<string, TAnyTuiCommandInteraction | undefined> = {
|
|
36
|
+
agent: undefined,
|
|
37
|
+
background: undefined,
|
|
38
|
+
clear: { onMissingArgs: 'confirm', message: 'Clear conversation history?' },
|
|
39
|
+
compact: undefined,
|
|
40
|
+
context: undefined,
|
|
41
|
+
cost: undefined,
|
|
42
|
+
exit: { onMissingArgs: 'confirm', message: 'Exit the session?' },
|
|
43
|
+
help: undefined,
|
|
44
|
+
language: { onMissingArgs: 'picker', getItems: getLanguageItems },
|
|
45
|
+
memory: undefined,
|
|
46
|
+
mode: { onMissingArgs: 'picker', getItems: getModeItems },
|
|
47
|
+
model: undefined,
|
|
48
|
+
permissions: undefined,
|
|
49
|
+
plugin: undefined,
|
|
50
|
+
provider: { onMissingArgs: 'picker', getItems: getProviderSubcommandItems },
|
|
51
|
+
rename: undefined,
|
|
52
|
+
reset: undefined,
|
|
53
|
+
resume: undefined,
|
|
54
|
+
rewind: undefined,
|
|
55
|
+
settings: undefined,
|
|
56
|
+
skills: undefined,
|
|
57
|
+
statusline: undefined,
|
|
58
|
+
'user-local': undefined,
|
|
59
|
+
'validate-session': undefined,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export function resolveCommandInteraction(
|
|
63
|
+
commandName: string,
|
|
64
|
+
): TAnyTuiCommandInteraction | undefined {
|
|
65
|
+
return BUILT_IN_INTERACTIONS[commandName];
|
|
66
|
+
}
|
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
onMissingArgs?: TOnMissingArgsAction;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ITuiPickerInteraction extends ITuiCommandInteraction {
|
|
14
|
-
onMissingArgs: 'picker';
|
|
15
|
-
getItems(): ITuiPickerItem[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ITuiConfirmInteraction extends ITuiCommandInteraction {
|
|
19
|
-
onMissingArgs: 'confirm';
|
|
20
|
-
message: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type TAnyTuiCommandInteraction = ITuiPickerInteraction | ITuiConfirmInteraction;
|
|
24
|
-
|
|
25
|
-
export function isPickerInteraction(
|
|
26
|
-
interaction: ITuiCommandInteraction,
|
|
27
|
-
): interaction is ITuiPickerInteraction {
|
|
28
|
-
return interaction.onMissingArgs === 'picker';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function isConfirmInteraction(
|
|
32
|
-
interaction: ITuiCommandInteraction,
|
|
33
|
-
): interaction is ITuiConfirmInteraction {
|
|
34
|
-
return interaction.onMissingArgs === 'confirm';
|
|
35
|
-
}
|
|
1
|
+
export type {
|
|
2
|
+
TOnMissingArgsAction,
|
|
3
|
+
ITuiPickerItem,
|
|
4
|
+
ITuiCommandInteraction,
|
|
5
|
+
ITuiPickerInteraction,
|
|
6
|
+
ITuiConfirmInteraction,
|
|
7
|
+
TAnyTuiCommandInteraction,
|
|
8
|
+
} from '@robota-sdk/agent-interface-tui';
|
|
9
|
+
export { isPickerInteraction, isConfirmInteraction } from '@robota-sdk/agent-interface-tui';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { findProviderDefinition } from '@robota-sdk/agent-core';
|
|
2
|
+
import {
|
|
3
|
+
applyActiveModelChange,
|
|
4
|
+
applyStatusLineSettings,
|
|
5
|
+
deleteSettings,
|
|
6
|
+
getUserSettingsPath,
|
|
7
|
+
readSettings,
|
|
8
|
+
resolveGitBranch,
|
|
9
|
+
writeSettings,
|
|
10
|
+
} from '@robota-sdk/agent-framework';
|
|
11
|
+
|
|
12
|
+
import type { ITuiCliAdapter } from './tui-cli-adapter.js';
|
|
13
|
+
import type { IProviderDefinition } from '@robota-sdk/agent-core';
|
|
14
|
+
import type { CommandRegistry } from '@robota-sdk/agent-framework';
|
|
15
|
+
|
|
16
|
+
export interface IDefaultTuiCliAdapterOptions {
|
|
17
|
+
providerDefinitions: readonly IProviderDefinition[];
|
|
18
|
+
reloadPluginCommandSource: (registry: CommandRegistry) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createDefaultTuiCliAdapter({
|
|
22
|
+
providerDefinitions,
|
|
23
|
+
reloadPluginCommandSource,
|
|
24
|
+
}: IDefaultTuiCliAdapterOptions): ITuiCliAdapter {
|
|
25
|
+
return {
|
|
26
|
+
getUserSettingsPath: () => getUserSettingsPath(),
|
|
27
|
+
readSettings: (path) => readSettings(path),
|
|
28
|
+
writeSettings: (path, settings) => writeSettings(path, settings),
|
|
29
|
+
deleteSettings: (path) => deleteSettings(path),
|
|
30
|
+
applyStatusLineSettings: (path, patch) => applyStatusLineSettings(path, patch),
|
|
31
|
+
reloadPluginCommandSource: (registry) => {
|
|
32
|
+
reloadPluginCommandSource(registry);
|
|
33
|
+
},
|
|
34
|
+
applyActiveModelChange: (cwd, modelId, options) => {
|
|
35
|
+
applyActiveModelChange(cwd, modelId, options);
|
|
36
|
+
return { applied: true };
|
|
37
|
+
},
|
|
38
|
+
getGitBranch: (cwd) => resolveGitBranch(cwd),
|
|
39
|
+
getProviderDisplayName: (type) =>
|
|
40
|
+
findProviderDefinition(providerDefinitions, type)?.displayName ?? type,
|
|
41
|
+
};
|
|
42
|
+
}
|