@agent-api/cli 0.3.6 → 0.4.0

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
@@ -4,7 +4,7 @@ import { stat } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
5
  import { render } from "ink";
6
6
  import React from "react";
7
- import { activeProfile, configureAgentAppRuntime, conversationSummary, deleteConversation, deleteProfile, getConversation, listConversations, listProfiles, loadConfig, loadConversationConfiguration, loginWithAPIKey, loginWithBrowser, normalizeChatOptions, openWorkdir, profileSummary, redactSecret, resolveRuntimeProfile, runAgent, runtime, useProfile, } from "@agent-api/app-engine";
7
+ import { activeProfile, configureAgentAppRuntime, conversationSummary, deleteConversation, deleteProfile, getConversation, listConversations, listProfiles, loadConfig, loadConversationConfiguration, loginWithAPIKey, loginWithBrowser, normalizeChatOptions, openWorkdir, profileSummary, redactSecret, resolveRuntimeProfile, runAgent, runtime, useProfile, } from "@agent-api/app-engine/core";
8
8
  import { ChatApp } from "./tui/chat.js";
9
9
  import { cliAuthor, cliName, cliVersion, legacyCliName } from "./runtime.js";
10
10
  configureAgentAppRuntime({
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.3.6";
3
+ export declare const cliVersion = "0.4.0";
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.3.6";
3
+ export const cliVersion = "0.4.0";
4
4
  export const legacyCliName = "agent-api-cli";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { type AgentRunOptions } from "@agent-api/app-engine";
2
+ import { type AgentRunOptions } from "@agent-api/app-engine/core";
3
3
  export declare function ChatApp({ options }: {
4
4
  options: AgentRunOptions;
5
5
  }): React.JSX.Element;
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { useApp, useInput, useStdout } from "ink";
4
- import { buildWorkbenchRenderModel, createAgentEngine, createWorkbenchAuthController, createWorkbenchAuthGateController, defaultBaseURL, } from "@agent-api/app-engine";
4
+ import { createAgentEngine, defaultBaseURL, } from "@agent-api/app-engine/core";
5
+ import { createWorkbenchAuthController, createWorkbenchAuthGateController, } from "@agent-api/app-engine/workbench";
6
+ import { buildWorkbenchRenderModel } from "@agent-api/app-engine/terminal";
5
7
  import { InkAuthGate, InkWorkbenchScreen } from "./components.js";
6
8
  export function ChatApp({ options }) {
7
9
  return _jsx(AuthenticatedChatApp, { options: options });
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { type AuthGateState, type WorkbenchRenderModel } from "@agent-api/app-engine";
2
+ import { type WorkbenchRenderModel } from "@agent-api/app-engine/terminal";
3
+ import { type AuthGateState } from "@agent-api/app-engine/workbench";
3
4
  export declare function InkWorkbenchScreen({ renderModel, spinnerFrame, }: {
4
5
  renderModel: WorkbenchRenderModel;
5
6
  spinnerFrame: number;
@@ -1,8 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
- import { activityColor, authMethods, busySpinner, } from "@agent-api/app-engine";
3
+ import { activityColor, busySpinner, } from "@agent-api/app-engine/terminal";
4
+ import { authMethods, } from "@agent-api/app-engine/workbench";
4
5
  export function InkWorkbenchScreen({ renderModel, spinnerFrame, }) {
5
- 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, children: [_jsxs(Box, { flexDirection: "column", width: "72%", paddingRight: 1, children: [renderModel.transcript.visibleLines.map((line) => (_jsx(Text, { bold: line.bold, color: line.color, inverse: line.inverse, wrap: "truncate", children: line.text || " " }, line.id))), renderModel.transcript.visibleLines.length === 0 && _jsx(Text, { color: "gray", children: "No transcript lines." })] }), _jsxs(Box, { flexDirection: "column", width: "28%", 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)))] })] }), _jsxs(Box, { borderStyle: "single", borderColor: renderModel.input.busy ? "yellow" : "green", paddingX: 1, children: [renderModel.input.fullAccess && (_jsx(Text, { color: "red", bold: true, inverse: true, children: "FULL ACCESS" })), renderModel.input.fullAccess && _jsx(Text, { children: " " }), _jsxs(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] })) : (_jsxs(Text, { wrap: "truncate", children: [renderModel.input.beforeCursor, _jsx(Cursor, { text: renderModel.input.cursorText, visible: true }), renderModel.input.afterCursor] }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", wrap: "truncate", children: renderModel.footerText }) })] }));
6
+ 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, children: [_jsxs(Box, { flexDirection: "column", width: "72%", paddingRight: 1, 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." })] }), _jsxs(Box, { flexDirection: "column", width: "28%", 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)))] })] }), _jsxs(Box, { borderStyle: "single", borderColor: renderModel.input.busy ? "yellow" : "green", paddingX: 1, children: [renderModel.input.fullAccess && (_jsx(Text, { color: "red", bold: true, inverse: true, children: "FULL ACCESS" })), renderModel.input.fullAccess && _jsx(Text, { children: " " }), _jsxs(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] })) : (_jsxs(Text, { wrap: "truncate", children: [renderModel.input.beforeCursor, _jsx(Cursor, { text: renderModel.input.cursorText, visible: true }), renderModel.input.afterCursor] }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", wrap: "truncate", children: renderModel.footerText }) })] }));
7
+ }
8
+ function TranscriptText({ line }) {
9
+ if (!line.spans || line.spans.length === 0) {
10
+ return (_jsx(Text, { bold: line.bold, color: line.color, inverse: line.inverse, wrap: "truncate", children: line.text || " " }));
11
+ }
12
+ return (_jsx(Text, { bold: line.bold, color: line.color, inverse: line.inverse, wrap: "truncate", children: line.spans.map((span, index) => (_jsx(Text, { bold: span.bold, color: span.color, inverse: span.inverse, children: span.text }, index))) }));
6
13
  }
7
14
  export function InkAuthGate({ cursorVisible, state }) {
8
15
  return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { borderStyle: "round", borderColor: "cyan", paddingX: 1, flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Agent API Workbench" }), _jsx(Text, { color: "gray", children: "Authentication required before starting the conversation UI." })] }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: state.error ? "red" : "gray", children: state.error || state.message }), state.status === "checking" && _jsx(Text, { color: "yellow", children: "Checking..." }), state.status === "select" && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [authMethods.map((method, index) => (_jsxs(Text, { color: index === state.selectedMethod ? "green" : "gray", children: [index === state.selectedMethod ? "›" : " ", " ", method.label, " - ", method.description] }, method.method))), _jsx(Text, { color: "gray", children: "Use \u2191/\u2193 and Enter." })] })), state.status === "api_profile" && _jsx(AuthPrompt, { cursorVisible: cursorVisible, label: "Profile", value: state.profile }), state.status === "api_base_url" && _jsx(AuthPrompt, { cursorVisible: cursorVisible, label: "Base URL", value: state.baseURL }), state.status === "api_key" && _jsx(AuthPrompt, { cursorVisible: cursorVisible, label: "API key", value: state.apiKey ? "•".repeat(Math.min(state.apiKey.length, 32)) : "" }), state.status === "browser_profile" && _jsx(AuthPrompt, { cursorVisible: cursorVisible, label: "Profile", value: state.profile }), state.status === "browser_base_url" && _jsx(AuthPrompt, { cursorVisible: cursorVisible, label: "Base URL", value: state.baseURL }), state.status === "browser_waiting" && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [state.browserURL && _jsxs(Text, { children: ["URL: ", state.browserURL] }), state.browserCode && _jsxs(Text, { children: ["Code: ", state.browserCode] }), _jsx(Text, { color: "yellow", children: "Waiting for browser approval..." })] }))] })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-api/cli",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
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.0.7",
38
+ "@agent-api/app-engine": "^0.1.0",
39
39
  "commander": "^14.0.3",
40
40
  "ink": "^6.8.0",
41
41
  "react": "^19.2.7"