@robota-sdk/agent-transport 3.0.0-beta.74 → 3.0.0-beta.76

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.
Files changed (197) hide show
  1. package/README.md +10 -10
  2. package/dist/node/headless/index.cjs +1 -1
  3. package/dist/node/headless/index.d.ts +1 -1
  4. package/dist/node/headless/index.js +1 -1
  5. package/dist/node/headless-OnpVk4-k.cjs +15 -0
  6. package/dist/node/{headless-D02zUEGh.js → headless-mRYilLfC.js} +2 -2
  7. package/dist/node/{headless-D02zUEGh.js.map → headless-mRYilLfC.js.map} +1 -1
  8. package/dist/node/{index-DE3-dHqw.d.ts → index-CYl7ksS6.d.ts} +12 -2
  9. package/dist/node/{index-DE3-dHqw.d.ts.map → index-CYl7ksS6.d.ts.map} +1 -1
  10. package/dist/node/{index-WKTgvhlg.d.ts → index-E8Gx4-lc.d.ts} +12 -2
  11. package/dist/node/{index-WKTgvhlg.d.ts.map → index-E8Gx4-lc.d.ts.map} +1 -1
  12. package/dist/node/index.cjs +1 -1
  13. package/dist/node/index.d.ts +2 -7
  14. package/dist/node/index.d.ts.map +1 -1
  15. package/dist/node/index.js +1 -1
  16. package/dist/node/index.js.map +1 -1
  17. package/package.json +7 -75
  18. package/src/headless/HeadlessInteractionChannel.ts +21 -1
  19. package/src/index.ts +1 -5
  20. package/src/transport-registry.ts +0 -9
  21. package/dist/node/headless-BeHAOlIM.cjs +0 -15
  22. package/dist/node/http/index.cjs +0 -1
  23. package/dist/node/http/index.d.ts +0 -2
  24. package/dist/node/http/index.js +0 -1
  25. package/dist/node/http-2Jiuflc1.js +0 -2
  26. package/dist/node/http-2Jiuflc1.js.map +0 -1
  27. package/dist/node/http-CBAvefLw.cjs +0 -1
  28. package/dist/node/index-BQLN_Lc9.d.ts +0 -78
  29. package/dist/node/index-BQLN_Lc9.d.ts.map +0 -1
  30. package/dist/node/index-BnAGE-u9.d.ts +0 -33
  31. package/dist/node/index-BnAGE-u9.d.ts.map +0 -1
  32. package/dist/node/index-BrQ4gGw0.d.ts +0 -213
  33. package/dist/node/index-BrQ4gGw0.d.ts.map +0 -1
  34. package/dist/node/index-CoeBF21y.d.ts +0 -213
  35. package/dist/node/index-CoeBF21y.d.ts.map +0 -1
  36. package/dist/node/index-DHt-2VQ-.d.ts +0 -46
  37. package/dist/node/index-DHt-2VQ-.d.ts.map +0 -1
  38. package/dist/node/index-DMwKN5Le.d.ts +0 -33
  39. package/dist/node/index-DMwKN5Le.d.ts.map +0 -1
  40. package/dist/node/index-IvYaYY6v.d.ts +0 -78
  41. package/dist/node/index-IvYaYY6v.d.ts.map +0 -1
  42. package/dist/node/index-c0M42fsA.d.ts +0 -46
  43. package/dist/node/index-c0M42fsA.d.ts.map +0 -1
  44. package/dist/node/mcp/index.cjs +0 -1
  45. package/dist/node/mcp/index.d.ts +0 -2
  46. package/dist/node/mcp/index.js +0 -1
  47. package/dist/node/mcp-BOglBJNy.cjs +0 -1
  48. package/dist/node/mcp-D3BBVK7C.js +0 -2
  49. package/dist/node/mcp-D3BBVK7C.js.map +0 -1
  50. package/dist/node/rolldown-runtime-CMqjfN_6.cjs +0 -1
  51. package/dist/node/tui/index.cjs +0 -1
  52. package/dist/node/tui/index.d.ts +0 -2
  53. package/dist/node/tui/index.js +0 -1
  54. package/dist/node/tui-Btb1q88j.js +0 -25
  55. package/dist/node/tui-Btb1q88j.js.map +0 -1
  56. package/dist/node/tui-SbUT7Zlt.cjs +0 -24
  57. package/dist/node/ws/index.cjs +0 -1
  58. package/dist/node/ws/index.d.ts +0 -2
  59. package/dist/node/ws/index.js +0 -1
  60. package/dist/node/ws-Dc2RUwVs.js +0 -2
  61. package/dist/node/ws-Dc2RUwVs.js.map +0 -1
  62. package/dist/node/ws-QNMQn5kg.cjs +0 -1
  63. package/src/http/__tests__/http-transport.test.ts +0 -55
  64. package/src/http/__tests__/routes.test.ts +0 -168
  65. package/src/http/http-transport.ts +0 -41
  66. package/src/http/index.ts +0 -4
  67. package/src/http/routes.ts +0 -152
  68. package/src/mcp/__tests__/mcp-server.test.ts +0 -66
  69. package/src/mcp/__tests__/mcp-transport.test.ts +0 -46
  70. package/src/mcp/index.ts +0 -4
  71. package/src/mcp/mcp-server.ts +0 -163
  72. package/src/mcp/mcp-transport.ts +0 -48
  73. package/src/tui/App.tsx +0 -488
  74. package/src/tui/BackgroundTaskPanel.tsx +0 -36
  75. package/src/tui/CjkTextInput.tsx +0 -199
  76. package/src/tui/ConfirmPrompt.tsx +0 -70
  77. package/src/tui/ContextWarningBanner.tsx +0 -34
  78. package/src/tui/ExecutionWorkspaceDetailPane.tsx +0 -64
  79. package/src/tui/ExecutionWorkspaceSwitcher.tsx +0 -187
  80. package/src/tui/InputArea.tsx +0 -310
  81. package/src/tui/InteractivePrompt.tsx +0 -59
  82. package/src/tui/ListPicker.tsx +0 -95
  83. package/src/tui/MenuSelect.tsx +0 -104
  84. package/src/tui/MessageList.tsx +0 -284
  85. package/src/tui/PermissionPrompt.tsx +0 -86
  86. package/src/tui/PluginTUI.tsx +0 -258
  87. package/src/tui/SessionPicker.tsx +0 -68
  88. package/src/tui/SessionStatusBar.tsx +0 -70
  89. package/src/tui/SlashAutocomplete.tsx +0 -110
  90. package/src/tui/StatusBar.tsx +0 -209
  91. package/src/tui/StreamingIndicator.tsx +0 -93
  92. package/src/tui/TextPrompt.tsx +0 -81
  93. package/src/tui/ToolCommandOutput.tsx +0 -39
  94. package/src/tui/ToolDiffBlock.tsx +0 -32
  95. package/src/tui/TransportTUI.tsx +0 -117
  96. package/src/tui/TuiInteractionChannel.ts +0 -483
  97. package/src/tui/UpdateNotice.tsx +0 -14
  98. package/src/tui/UsageSummaryEntry.tsx +0 -39
  99. package/src/tui/WaveText.tsx +0 -44
  100. package/src/tui/__tests__/InteractivePrompt.test.tsx +0 -82
  101. package/src/tui/__tests__/ListPicker.test.tsx +0 -159
  102. package/src/tui/__tests__/MenuSelect.test.tsx +0 -103
  103. package/src/tui/__tests__/PluginTUI.test.tsx +0 -167
  104. package/src/tui/__tests__/SlashAutocomplete.test.tsx +0 -140
  105. package/src/tui/__tests__/TextPrompt.test.tsx +0 -98
  106. package/src/tui/__tests__/TuiInteractionChannel.display-contract.test.ts +0 -239
  107. package/src/tui/__tests__/TuiInteractionChannel.lifecycle.test.ts +0 -297
  108. package/src/tui/__tests__/TuiInteractionChannel.requestAction.test.ts +0 -124
  109. package/src/tui/__tests__/UpdateNotice.test.tsx +0 -15
  110. package/src/tui/__tests__/abort-after-permission.test.tsx +0 -169
  111. package/src/tui/__tests__/abort-streaming-e2e.test.tsx +0 -183
  112. package/src/tui/__tests__/background-task-panel.test.tsx +0 -53
  113. package/src/tui/__tests__/background-task-row-format.test.ts +0 -59
  114. package/src/tui/__tests__/channel-factory-integration.test.ts +0 -138
  115. package/src/tui/__tests__/cjk-text-input-flow.test.ts +0 -109
  116. package/src/tui/__tests__/cjk-text-input.test.ts +0 -191
  117. package/src/tui/__tests__/command-effect-handler.test.ts +0 -127
  118. package/src/tui/__tests__/command-output-summary.test.ts +0 -95
  119. package/src/tui/__tests__/compact-event-bridge.test.ts +0 -20
  120. package/src/tui/__tests__/confirm-permission-flow.test.ts +0 -130
  121. package/src/tui/__tests__/confirm-prompt.test.tsx +0 -87
  122. package/src/tui/__tests__/execution-workspace-switcher.test.tsx +0 -110
  123. package/src/tui/__tests__/execution-workspace-view-model.test.ts +0 -93
  124. package/src/tui/__tests__/fixtures/provider-setup-prompt-driver.tsx +0 -125
  125. package/src/tui/__tests__/input-area-flow.test.ts +0 -164
  126. package/src/tui/__tests__/message-list-rendering.test.tsx +0 -353
  127. package/src/tui/__tests__/prompt-queue.test.tsx +0 -255
  128. package/src/tui/__tests__/provider-setup-pty-e2e.test.ts +0 -233
  129. package/src/tui/__tests__/pty/pty-driver.ts +0 -135
  130. package/src/tui/__tests__/pty/tui-pty.ptytest.ts +0 -61
  131. package/src/tui/__tests__/render-channel-options.test.ts +0 -32
  132. package/src/tui/__tests__/render-markdown.test.ts +0 -72
  133. package/src/tui/__tests__/selection-flow.test.ts +0 -61
  134. package/src/tui/__tests__/session-init-poller.test.ts +0 -102
  135. package/src/tui/__tests__/session-naming.test.ts +0 -64
  136. package/src/tui/__tests__/session-switch-channel.test.tsx +0 -307
  137. package/src/tui/__tests__/slash-routing-effects.test.ts +0 -228
  138. package/src/tui/__tests__/status-activity.test.ts +0 -71
  139. package/src/tui/__tests__/status-bar.test.tsx +0 -158
  140. package/src/tui/__tests__/streaming-indicator.test.tsx +0 -137
  141. package/src/tui/__tests__/text-prompt-flow.test.ts +0 -77
  142. package/src/tui/__tests__/tui-channel-init-failure.test.ts +0 -57
  143. package/src/tui/__tests__/tui-state-manager.test.ts +0 -401
  144. package/src/tui/background-task-row-format.ts +0 -53
  145. package/src/tui/command-interaction.ts +0 -9
  146. package/src/tui/command-output-summary.ts +0 -122
  147. package/src/tui/create-default-tui-cli-adapter.ts +0 -41
  148. package/src/tui/execution-workspace-view-model.ts +0 -123
  149. package/src/tui/flows/cjk-text-input-flow.ts +0 -285
  150. package/src/tui/flows/confirm-prompt-flow.ts +0 -45
  151. package/src/tui/flows/input-area-flow.ts +0 -189
  152. package/src/tui/flows/permission-prompt-flow.ts +0 -85
  153. package/src/tui/flows/selection-flow.ts +0 -126
  154. package/src/tui/flows/session-init-poller.ts +0 -77
  155. package/src/tui/flows/text-prompt-flow.ts +0 -98
  156. package/src/tui/hooks/command-effect-handler.ts +0 -97
  157. package/src/tui/hooks/command-effect-queue.ts +0 -39
  158. package/src/tui/hooks/side-effects-types.ts +0 -35
  159. package/src/tui/hooks/useAutocomplete.ts +0 -87
  160. package/src/tui/hooks/usePluginCallbacks.ts +0 -31
  161. package/src/tui/hooks/usePluginScreenData.ts +0 -85
  162. package/src/tui/hooks/useSideEffects.ts +0 -175
  163. package/src/tui/hooks/useSlashRouting.ts +0 -118
  164. package/src/tui/hooks/useStatusLineSettings.ts +0 -37
  165. package/src/tui/hooks/useTuiChannel.ts +0 -95
  166. package/src/tui/index.ts +0 -14
  167. package/src/tui/interactions/CommandConfirm.tsx +0 -36
  168. package/src/tui/interactions/CommandPicker.tsx +0 -77
  169. package/src/tui/interactions/__tests__/CommandConfirm.test.tsx +0 -124
  170. package/src/tui/interactions/__tests__/CommandPicker.test.tsx +0 -138
  171. package/src/tui/plugin-tui-handlers.ts +0 -163
  172. package/src/tui/render-markdown.ts +0 -130
  173. package/src/tui/render.tsx +0 -117
  174. package/src/tui/session-naming.ts +0 -33
  175. package/src/tui/status-activity.ts +0 -63
  176. package/src/tui/tui-cli-adapter-context.tsx +0 -13
  177. package/src/tui/tui-cli-adapter.ts +0 -25
  178. package/src/tui/tui-state-manager.ts +0 -226
  179. package/src/tui/tui-transport.ts +0 -35
  180. package/src/tui/types.ts +0 -15
  181. package/src/tui/utils/__tests__/edit-diff.test.ts +0 -426
  182. package/src/tui/utils/__tests__/paste-detection.test.ts +0 -116
  183. package/src/tui/utils/__tests__/paste-labels.test.ts +0 -46
  184. package/src/tui/utils/__tests__/tool-call-extractor.test.ts +0 -227
  185. package/src/tui/utils/__tests__/tool-diff-summary.test.ts +0 -104
  186. package/src/tui/utils/edit-diff.ts +0 -153
  187. package/src/tui/utils/paste-labels.ts +0 -9
  188. package/src/tui/utils/tool-call-extractor.ts +0 -92
  189. package/src/tui/utils/tool-diff-summary.ts +0 -75
  190. package/src/ws/__tests__/ws-handler.test.ts +0 -409
  191. package/src/ws/__tests__/ws-transport.test.ts +0 -53
  192. package/src/ws/index.ts +0 -13
  193. package/src/ws/ws-background-messages.ts +0 -170
  194. package/src/ws/ws-handler.ts +0 -280
  195. package/src/ws/ws-protocol.ts +0 -78
  196. package/src/ws/ws-transport-configurable.ts +0 -128
  197. package/src/ws/ws-transport.ts +0 -42
@@ -1,63 +0,0 @@
1
- export type TStatusActivityKind = 'tools' | 'thinking' | 'background' | 'queued' | 'idle';
2
-
3
- export interface IStatusActivityInput {
4
- isThinking: boolean;
5
- activeToolCount: number;
6
- activeBackgroundTaskCount: number;
7
- hasPendingPrompt: boolean;
8
- }
9
-
10
- export interface IStatusActivity {
11
- kind: TStatusActivityKind;
12
- label: string;
13
- color: string;
14
- segments: string[];
15
- text: string;
16
- }
17
-
18
- const NO_ACTIVE_ITEMS = 0;
19
-
20
- export function formatStatusActivity(input: IStatusActivityInput): IStatusActivity {
21
- const base = getPrimaryActivity(input);
22
- const segments = input.hasPendingPrompt && base.kind !== 'queued' ? ['queued'] : [];
23
- const text = [base.label, ...segments].join(' · ');
24
- return { ...base, segments, text };
25
- }
26
-
27
- function getPrimaryActivity(
28
- input: IStatusActivityInput,
29
- ): Omit<IStatusActivity, 'segments' | 'text'> {
30
- if (input.activeToolCount > NO_ACTIVE_ITEMS) {
31
- return {
32
- kind: 'tools',
33
- label: `Tools (${input.activeToolCount})`,
34
- color: 'cyan',
35
- };
36
- }
37
- if (input.isThinking) {
38
- return {
39
- kind: 'thinking',
40
- label: 'Thinking',
41
- color: 'yellow',
42
- };
43
- }
44
- if (input.activeBackgroundTaskCount > NO_ACTIVE_ITEMS) {
45
- return {
46
- kind: 'background',
47
- label: `Background (${input.activeBackgroundTaskCount})`,
48
- color: 'cyan',
49
- };
50
- }
51
- if (input.hasPendingPrompt) {
52
- return {
53
- kind: 'queued',
54
- label: 'Queued',
55
- color: 'yellow',
56
- };
57
- }
58
- return {
59
- kind: 'idle',
60
- label: 'Idle',
61
- color: 'gray',
62
- };
63
- }
@@ -1,13 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- import type { ITuiCliAdapter } from './tui-cli-adapter.js';
4
-
5
- const TuiCliAdapterContext = createContext<ITuiCliAdapter | null>(null);
6
-
7
- export const TuiCliAdapterProvider = TuiCliAdapterContext.Provider;
8
-
9
- export function useTuiCliAdapter(): ITuiCliAdapter {
10
- const adapter = useContext(TuiCliAdapterContext);
11
- if (!adapter) throw new Error('TuiCliAdapterContext not provided');
12
- return adapter;
13
- }
@@ -1,25 +0,0 @@
1
- import type { TUniversalValue } from '@robota-sdk/agent-core';
2
- import type { CommandRegistry } from '@robota-sdk/agent-framework';
3
- import type {
4
- IStatusLineCommandSettings,
5
- TStatusLineCommandSettingsPatch,
6
- } from '@robota-sdk/agent-interface-transport';
7
-
8
- export interface ITuiCliAdapter {
9
- getUserSettingsPath(): string;
10
- readSettings(path: string): Record<string, TUniversalValue>;
11
- writeSettings(path: string, settings: Record<string, TUniversalValue>): void;
12
- deleteSettings(path: string): boolean;
13
- applyStatusLineSettings(
14
- path: string,
15
- patch: TStatusLineCommandSettingsPatch,
16
- ): IStatusLineCommandSettings;
17
- reloadPluginCommandSource(registry: CommandRegistry): void;
18
- applyActiveModelChange(
19
- cwd: string,
20
- modelId: string,
21
- options?: { providerOverride?: string },
22
- ): { applied: boolean };
23
- getGitBranch(cwd: string): string | undefined;
24
- getProviderDisplayName(type: string): string;
25
- }
@@ -1,226 +0,0 @@
1
- /**
2
- * TuiStateManager — pure TypeScript rendering state manager.
3
- *
4
- * Converts InteractiveSession events into rendering state.
5
- * No React dependency. Fully unit-testable.
6
- *
7
- * React hook (useTuiChannel) subscribes to onChange
8
- * and reads state for rendering.
9
- */
10
-
11
- import type { IContextWindowState, IHistoryEntry } from '@robota-sdk/agent-core';
12
- import type {
13
- IExecutionResult,
14
- IExecutionWorkspaceSnapshot,
15
- IToolState,
16
- } from '@robota-sdk/agent-interface-transport';
17
-
18
- /** Max messages kept in rendering state */
19
- const MAX_RENDERED_MESSAGES = 100;
20
-
21
- /** Debounce interval for streaming text notify (limits renderMarkdown frequency) */
22
- const STREAMING_DEBOUNCE_MS = 300;
23
- export interface IContextState {
24
- percentage: number;
25
- usedTokens: number;
26
- maxTokens: number;
27
- }
28
-
29
- /** Create a debounced notify — schedules at most one call per interval. */
30
- function createDebouncedNotify(
31
- notify: () => void,
32
- ms: number,
33
- ): { schedule: () => void; flush: () => void } {
34
- let timer: ReturnType<typeof setTimeout> | null = null;
35
- return {
36
- schedule() {
37
- if (!timer) {
38
- timer = setTimeout(() => {
39
- timer = null;
40
- notify();
41
- }, ms);
42
- }
43
- },
44
- flush() {
45
- if (timer) {
46
- clearTimeout(timer);
47
- timer = null;
48
- }
49
- },
50
- };
51
- }
52
-
53
- export class TuiStateManager {
54
- // ── Rendering state ───────────────────────────────────────────
55
- history: IHistoryEntry[] = [];
56
- streamingText = '';
57
- activeTools: IToolState[] = [];
58
- isThinking = false;
59
- isAborting = false;
60
- pendingPrompt: string | null = null;
61
- contextState: IContextState = { percentage: 0, usedTokens: 0, maxTokens: 0 };
62
- executionWorkspaceSnapshot: IExecutionWorkspaceSnapshot | null = null;
63
- selectedExecutionEntryId: string | undefined;
64
-
65
- /** Called after any state change. React hook sets this to trigger re-render. */
66
- onChange: (() => void) | null = null;
67
-
68
- // ── Internal ──────────────────────────────────────────────────
69
- private streamBuf = '';
70
- private debouncedStreamNotify = createDebouncedNotify(() => this.notify(), STREAMING_DEBOUNCE_MS);
71
-
72
- private notify(): void {
73
- this.onChange?.();
74
- }
75
-
76
- // ── Event handlers (InteractiveSession → state) ───────────────
77
-
78
- onTextDelta = (delta: string): void => {
79
- this.streamBuf += delta;
80
- this.streamingText = this.streamBuf;
81
- this.debouncedStreamNotify.schedule();
82
- };
83
-
84
- onToolStart = (state: IToolState): void => {
85
- this.activeTools = [...this.activeTools, state];
86
- this.notify();
87
- };
88
-
89
- onToolEnd = (state: IToolState): void => {
90
- // findLastIndex: when same tool runs concurrently, match the most recently started instance
91
- const idx = this.activeTools.findLastIndex((t) => t.toolName === state.toolName && t.isRunning);
92
- if (idx !== -1) {
93
- const updated = [...this.activeTools];
94
- updated[idx] = state;
95
- this.activeTools = updated;
96
- }
97
- this.notify();
98
- };
99
-
100
- onThinking = (thinking: boolean): void => {
101
- this.isThinking = thinking;
102
- if (thinking) {
103
- // Clear at START of new execution (preserves previous result until next)
104
- this.debouncedStreamNotify.flush();
105
- this.streamBuf = '';
106
- this.streamingText = '';
107
- this.activeTools = [];
108
- } else {
109
- this.isAborting = false;
110
- this.activeTools = [];
111
- }
112
- this.notify();
113
- };
114
-
115
- onComplete = (result: IExecutionResult): void => {
116
- // Tool summary is now in messages (pushed by InteractiveSession)
117
- // Clear streaming display
118
- this.debouncedStreamNotify.flush();
119
- this.streamBuf = '';
120
- this.streamingText = '';
121
- this.activeTools = [];
122
- this.contextState = {
123
- percentage: result.contextState.usedPercentage,
124
- usedTokens: result.contextState.usedTokens,
125
- maxTokens: result.contextState.maxTokens,
126
- };
127
- this.notify();
128
- };
129
-
130
- onInterrupted = (): void => {
131
- // Tool summary is now in messages
132
- this.debouncedStreamNotify.flush();
133
- this.streamBuf = '';
134
- this.streamingText = '';
135
- this.activeTools = [];
136
- this.notify();
137
- };
138
-
139
- onError = (): void => {
140
- // Tool summary is now in messages
141
- this.debouncedStreamNotify.flush();
142
- this.streamBuf = '';
143
- this.streamingText = '';
144
- this.activeTools = [];
145
- this.notify();
146
- };
147
-
148
- onContextUpdate = (state: IContextWindowState): void => {
149
- this.setContextState({
150
- percentage: state.usedPercentage,
151
- usedTokens: state.usedTokens,
152
- maxTokens: state.maxTokens,
153
- });
154
- };
155
-
156
- // ── State updates from external sources ───────────────────────
157
-
158
- /** Sync history from InteractiveSession */
159
- syncHistory(entries: IHistoryEntry[]): void {
160
- if (entries.length === 0) return;
161
- this.history =
162
- entries.length > MAX_RENDERED_MESSAGES ? entries.slice(-MAX_RENDERED_MESSAGES) : [...entries];
163
- this.notify();
164
- }
165
-
166
- /** Add a single history entry */
167
- addEntry(entry: IHistoryEntry): void {
168
- const updated = [...this.history, entry];
169
- this.history =
170
- updated.length > MAX_RENDERED_MESSAGES ? updated.slice(-MAX_RENDERED_MESSAGES) : updated;
171
- this.notify();
172
- }
173
-
174
- clearHistory(): void {
175
- this.history = [];
176
- this.debouncedStreamNotify.flush();
177
- this.streamBuf = '';
178
- this.streamingText = '';
179
- this.activeTools = [];
180
- this.notify();
181
- }
182
-
183
- /** Update pending prompt state */
184
- setPendingPrompt(prompt: string | null): void {
185
- this.pendingPrompt = prompt;
186
- this.notify();
187
- }
188
-
189
- /** Set aborting flag */
190
- setAborting(aborting: boolean): void {
191
- this.isAborting = aborting;
192
- this.notify();
193
- }
194
-
195
- /** Update context state */
196
- setContextState(state: IContextState): void {
197
- this.contextState = state;
198
- this.notify();
199
- }
200
-
201
- syncExecutionWorkspaceSnapshot(snapshot: IExecutionWorkspaceSnapshot): void {
202
- const currentSelection = this.selectedExecutionEntryId;
203
- const hasCurrentSelection =
204
- currentSelection !== undefined &&
205
- snapshot.entries.some((entry) => entry.id === currentSelection);
206
- const selectedExecutionEntryId = hasCurrentSelection
207
- ? currentSelection
208
- : (snapshot.selectedEntryId ?? snapshot.entries[0]?.id);
209
- this.executionWorkspaceSnapshot = {
210
- ...snapshot,
211
- ...(selectedExecutionEntryId ? { selectedEntryId: selectedExecutionEntryId } : {}),
212
- };
213
- this.selectedExecutionEntryId = selectedExecutionEntryId;
214
- this.notify();
215
- }
216
-
217
- selectExecutionWorkspaceEntry(entryId: string): void {
218
- if (!this.executionWorkspaceSnapshot?.entries.some((entry) => entry.id === entryId)) return;
219
- this.selectedExecutionEntryId = entryId;
220
- this.executionWorkspaceSnapshot = {
221
- ...this.executionWorkspaceSnapshot,
222
- selectedEntryId: entryId,
223
- };
224
- this.notify();
225
- }
226
- }
@@ -1,35 +0,0 @@
1
- import { renderApp, type IRenderOptions } from './render.js';
2
-
3
- import type { TUniversalValue } from '@robota-sdk/agent-core';
4
- import type {
5
- IConfigurableTransport,
6
- IInteractiveSession,
7
- } from '@robota-sdk/agent-interface-transport';
8
-
9
- export class TuiTransport implements IConfigurableTransport<IInteractiveSession> {
10
- readonly name = 'tui';
11
- readonly defaultEnabled = true;
12
- readonly optionsSchema = {};
13
-
14
- private readonly options: IRenderOptions;
15
-
16
- constructor(options: IRenderOptions) {
17
- this.options = options;
18
- }
19
-
20
- attach(_session: IInteractiveSession): void {
21
- // TuiTransport creates its own InteractiveSession internally via TuiInteractionChannel.
22
- }
23
-
24
- async start(): Promise<void> {
25
- await renderApp(this.options);
26
- }
27
-
28
- async stop(): Promise<void> {
29
- // Ink exits when the user triggers shutdown from within the TUI.
30
- }
31
-
32
- validateOptions(_options: Record<string, TUniversalValue>): boolean {
33
- return true;
34
- }
35
- }
package/src/tui/types.ts DELETED
@@ -1,15 +0,0 @@
1
- /** UI-layer permission types for the Ink TUI */
2
-
3
- import type { TToolArgs } from '@robota-sdk/agent-core';
4
-
5
- /**
6
- * Permission result: true (allow once), false (deny), 'allow-session' (remember for session),
7
- * or 'allow-project' (persist to .robota/settings.local.json).
8
- */
9
- export type TPermissionResult = boolean | 'allow-session' | 'allow-project';
10
-
11
- export interface IPermissionRequest {
12
- toolName: string;
13
- toolArgs: TToolArgs;
14
- resolve: (result: TPermissionResult) => void;
15
- }