@agent-api/cli 0.4.10 → 0.4.12

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/index.js CHANGED
@@ -32,6 +32,7 @@ program.action(async (workdir) => {
32
32
  const options = normalizeChatOptions([], launchWorkdir ? { workdir: launchWorkdir } : {});
33
33
  const app = render(React.createElement(ChatApp, { options }));
34
34
  await app.waitUntilExit();
35
+ clearTerminalAfterTUI();
35
36
  });
36
37
  program
37
38
  .command("auth")
@@ -86,6 +87,11 @@ program.parseAsync(process.argv).catch((error) => {
86
87
  console.error(error instanceof Error ? error.message : String(error));
87
88
  process.exitCode = 1;
88
89
  });
90
+ function clearTerminalAfterTUI() {
91
+ if (!process.stdout.isTTY)
92
+ return;
93
+ process.stdout.write("\x1b[2J\x1b[3J\x1b[H");
94
+ }
89
95
  function authLoginCommand() {
90
96
  return new Command("login")
91
97
  .description("Sign in with browser auth or save an API key profile")
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const cliName = "agent-tui";
2
2
  export declare const cliAuthor = "AgentsWay";
3
- export declare const cliVersion = "0.4.10";
3
+ export declare const cliVersion = "0.4.12";
4
4
  export declare const legacyCliName = "agent-api-cli";
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export const cliName = "agent-tui";
2
2
  export const cliAuthor = "AgentsWay";
3
- export const cliVersion = "0.4.10";
3
+ export const cliVersion = "0.4.12";
4
4
  export const legacyCliName = "agent-api-cli";
@@ -110,6 +110,7 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
110
110
  const terminalSize = useTerminalSize(stdout);
111
111
  const [draft, setDraft] = useState("");
112
112
  const [cursor, setCursor] = useState(0);
113
+ const [selectionAnchor, setSelectionAnchor] = useState(null);
113
114
  const [spinnerFrame, setSpinnerFrame] = useState(0);
114
115
  const [transcriptOffset, setTranscriptOffset] = useState(0);
115
116
  const agentEngineRef = useRef(null);
@@ -137,6 +138,7 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
137
138
  draft,
138
139
  cursor,
139
140
  profileName,
141
+ selectionAnchor,
140
142
  spinnerFrame,
141
143
  state,
142
144
  transcriptOffset,
@@ -145,7 +147,7 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
145
147
  columns: terminalSize.columns,
146
148
  },
147
149
  workdirFallback: options.workdir || process.cwd(),
148
- }), [cursor, draft, options.workdir, profileName, spinnerFrame, state, terminalSize.columns, terminalSize.rows, transcriptOffset]);
150
+ }), [cursor, draft, options.workdir, profileName, selectionAnchor, spinnerFrame, state, terminalSize.columns, terminalSize.rows, transcriptOffset]);
149
151
  useEffect(() => {
150
152
  setTranscriptOffset((offset) => Math.min(offset, renderModel.transcript.maxOffset));
151
153
  }, [renderModel.transcript.maxOffset]);
@@ -195,12 +197,16 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
195
197
  busy: state.busy,
196
198
  cursor,
197
199
  draft,
200
+ selectionAnchor,
201
+ viewportColumns: renderModel.input.viewportColumns,
198
202
  viewportHeight: renderModel.viewportHeight,
199
203
  });
200
204
  if (result.draft !== draft)
201
205
  setDraft(result.draft);
202
206
  if (result.cursor !== cursor)
203
207
  setCursor(result.cursor);
208
+ if (result.selectionAnchor !== selectionAnchor)
209
+ setSelectionAnchor(result.selectionAnchor);
204
210
  for (const effect of result.effects) {
205
211
  switch (effect.type) {
206
212
  case "exit":
@@ -4,7 +4,7 @@ import { activityColor, busySpinner, } from "@agent-api/app-engine/terminal";
4
4
  import { authMethods, } from "@agent-api/app-engine/workbench";
5
5
  export function InkWorkbenchScreen({ renderModel, spinnerFrame, }) {
6
6
  const activity = (_jsxs(Box, { flexDirection: "column", width: renderModel.layout === "wide" ? "28%" : "100%", height: renderModel.activityHeight, borderStyle: "single", borderColor: "gray", paddingX: 1, children: [_jsx(Text, { bold: true, wrap: "truncate", children: "Activity" }), renderModel.visibleActivities.map((activity) => (_jsxs(Text, { color: activityColor(activity.level), wrap: "truncate", children: [new Date(activity.timestamp).toLocaleTimeString(), " ", activity.text] }, activity.id)))] }));
7
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { contextEnabled: renderModel.header.contextEnabled, conversation: renderModel.header.conversation, conversationId: renderModel.header.conversationId, conversationPreviousResponseId: renderModel.header.conversationPreviousResponseId, conversationStatus: renderModel.header.conversationStatus, model: renderModel.header.model, accessMode: renderModel.header.accessMode, pendingLocalLabel: renderModel.header.pendingLocalLabel, preset: renderModel.header.preset, profile: renderModel.header.profile, renderMode: renderModel.header.renderMode, workdir: renderModel.header.workdir }), _jsxs(Box, { marginTop: 1, height: renderModel.viewportHeight, flexDirection: renderModel.layout === "wide" ? "row" : "column", children: [_jsxs(Box, { flexDirection: "column", width: renderModel.layout === "wide" ? "72%" : "100%", paddingRight: renderModel.layout === "wide" ? 1 : 0, children: [renderModel.transcript.visibleLines.map((line) => (_jsx(TranscriptText, { line: line }, line.id))), renderModel.transcript.visibleLines.length === 0 && _jsx(Text, { color: "gray", children: "No transcript lines." })] }), activity] }), _jsxs(Box, { borderStyle: "single", borderColor: renderModel.input.busy ? "yellow" : "green", paddingX: 1, flexDirection: "column", children: [_jsxs(Box, { children: [renderModel.input.fullAccess && (_jsx(Text, { color: "red", bold: true, inverse: true, children: "FULL ACCESS" })), renderModel.input.fullAccess && _jsx(Text, { children: " " }), _jsx(Text, { color: renderModel.input.busy ? "yellow" : "green", children: renderModel.input.label })] }), renderModel.input.busy ? (_jsxs(Text, { wrap: "truncate", children: [_jsx(Text, { color: "yellow", children: busySpinner(spinnerFrame) }), " ", renderModel.input.waitingText] })) : (_jsx(Box, { flexDirection: "column", children: renderModel.input.lines.map((line, index) => (_jsxs(Text, { children: [line.beforeCursor || (line.hasCursor ? "" : " "), line.hasCursor && _jsx(Cursor, { text: line.cursorText, visible: true }), line.afterCursor] }, index))) }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", wrap: "truncate", children: renderModel.footerText }) })] }));
7
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { contextEnabled: renderModel.header.contextEnabled, conversation: renderModel.header.conversation, conversationId: renderModel.header.conversationId, conversationPreviousResponseId: renderModel.header.conversationPreviousResponseId, conversationStatus: renderModel.header.conversationStatus, model: renderModel.header.model, accessMode: renderModel.header.accessMode, pendingLocalLabel: renderModel.header.pendingLocalLabel, preset: renderModel.header.preset, profile: renderModel.header.profile, renderMode: renderModel.header.renderMode, workdir: renderModel.header.workdir }), _jsxs(Box, { height: renderModel.viewportHeight, flexDirection: renderModel.layout === "wide" ? "row" : "column", children: [_jsxs(Box, { flexDirection: "column", width: renderModel.layout === "wide" ? "72%" : "100%", paddingRight: renderModel.layout === "wide" ? 1 : 0, children: [renderModel.transcript.visibleLines.map((line) => (_jsx(TranscriptText, { line: line }, line.id))), renderModel.transcript.visibleLines.length === 0 && _jsx(Text, { color: "gray", children: "No transcript lines." })] }), activity] }), _jsxs(Box, { borderStyle: "single", borderColor: renderModel.input.busy ? "yellow" : "green", paddingX: 1, flexDirection: "column", children: [_jsxs(Box, { children: [renderModel.input.fullAccess && (_jsx(Text, { color: "red", bold: true, inverse: true, children: "FULL ACCESS" })), renderModel.input.fullAccess && _jsx(Text, { children: " " }), _jsx(Text, { color: renderModel.input.busy ? "yellow" : "green", children: renderModel.input.label })] }), renderModel.input.busy ? (_jsxs(Text, { wrap: "truncate", children: [_jsx(Text, { color: "yellow", children: busySpinner(spinnerFrame) }), " ", renderModel.input.waitingText] })) : (_jsx(Box, { flexDirection: "column", children: renderModel.input.lines.map((line, index) => (_jsx(Text, { wrap: "truncate", children: line.spans.map((span, spanIndex) => (_jsx(Text, { inverse: span.inverse, children: span.text }, spanIndex))) }, index))) }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", wrap: "truncate", children: renderModel.footerText }) })] }));
8
8
  }
9
9
  function TranscriptText({ line }) {
10
10
  if (!line.spans || line.spans.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-api/cli",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "description": "First-class command line interface for Agent API",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/scalebox-dev/agent-tui#readme",
@@ -35,7 +35,7 @@
35
35
  "test": "npm run sync-version && npm run build && npm run smoke -w @agent-api/app-engine && node --test test/*.test.mjs"
36
36
  },
37
37
  "dependencies": {
38
- "@agent-api/app-engine": "^0.1.10",
38
+ "@agent-api/app-engine": "^0.1.12",
39
39
  "commander": "^14.0.3",
40
40
  "ink": "^6.8.0",
41
41
  "react": "^19.2.7"