@agent-api/cli 0.1.0 → 0.1.1
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/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/tui/ink/app.js +5 -2
- package/dist/tui/ink/components.js +2 -2
- package/dist/workbench/command-controller.js +10 -3
- package/dist/workbench/lifecycle-controller.d.ts +1 -0
- package/dist/workbench/lifecycle-controller.js +1 -1
- package/dist/workbench/render-model.js +1 -1
- package/package.json +1 -1
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const cliName = "agent-api-cli";
|
|
2
2
|
export declare const cliAuthor = "AgentsWay";
|
|
3
|
-
export declare const cliVersion = "0.1.
|
|
3
|
+
export declare const cliVersion = "0.1.1";
|
|
4
4
|
export declare const runtime: import("@agent-api/sdk/local").LocalRuntime;
|
|
5
5
|
export declare function ensureRuntime(): Promise<import("@agent-api/sdk/local").LocalRuntime>;
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLocalRuntime } from "@agent-api/sdk/local";
|
|
2
2
|
export const cliName = "agent-api-cli";
|
|
3
3
|
export const cliAuthor = "AgentsWay";
|
|
4
|
-
export const cliVersion = "0.1.
|
|
4
|
+
export const cliVersion = "0.1.1";
|
|
5
5
|
export const runtime = createLocalRuntime({
|
|
6
6
|
appName: cliName,
|
|
7
7
|
appAuthor: cliAuthor,
|
package/dist/tui/ink/app.js
CHANGED
|
@@ -178,6 +178,8 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
|
|
|
178
178
|
};
|
|
179
179
|
}, [dispatch, lifecycleController, options.modelExplicit, options.preset, options.presetExplicit, settingsController]);
|
|
180
180
|
useEffect(() => {
|
|
181
|
+
if (!state.contextEnabled || state.workdir)
|
|
182
|
+
return;
|
|
181
183
|
let mounted = true;
|
|
182
184
|
dispatch({ type: "activity.add", text: "Loading workdir" });
|
|
183
185
|
localController.load(options.workdir || process.cwd())
|
|
@@ -201,7 +203,7 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
|
|
|
201
203
|
return () => {
|
|
202
204
|
mounted = false;
|
|
203
205
|
};
|
|
204
|
-
}, [dispatch, localController, options.workdir]);
|
|
206
|
+
}, [dispatch, localController, options.workdir, state.contextEnabled, state.workdir]);
|
|
205
207
|
useEffect(() => {
|
|
206
208
|
let mounted = true;
|
|
207
209
|
const refreshIntervalMs = 60_000;
|
|
@@ -256,11 +258,12 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
|
|
|
256
258
|
const initialPrompt = lifecycleController.initialPrompt({
|
|
257
259
|
busy: state.busy,
|
|
258
260
|
promptParts: options.promptParts,
|
|
261
|
+
requiresWorkdir: state.contextEnabled,
|
|
259
262
|
workdir: state.workdir,
|
|
260
263
|
});
|
|
261
264
|
if (initialPrompt)
|
|
262
265
|
void turnController.startPrompt(initialPrompt);
|
|
263
|
-
}, [lifecycleController, options.promptParts, state.busy, state.workdir, turnController]);
|
|
266
|
+
}, [lifecycleController, options.promptParts, state.busy, state.contextEnabled, state.workdir, turnController]);
|
|
264
267
|
useEffect(() => {
|
|
265
268
|
if (!state.busy) {
|
|
266
269
|
setSpinnerFrame(0);
|
|
@@ -4,7 +4,7 @@ import { authMethods } from "../../workbench/auth-gate-controller.js";
|
|
|
4
4
|
import { busySpinner } from "../../workbench/render-model.js";
|
|
5
5
|
import { activityColor, } from "../workbench.js";
|
|
6
6
|
export function InkWorkbenchScreen({ renderModel, spinnerFrame, }) {
|
|
7
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { contextEnabled: renderModel.header.contextEnabled, conversation: renderModel.header.conversation, 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, 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, children: "Activity" }), renderModel.visibleActivities.map((activity) => (_jsxs(Text, { color: activityColor(activity.level), 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, { children: [_jsx(Text, { color: "yellow", children: busySpinner(spinnerFrame) }), " ", renderModel.input.waitingText] })) : (_jsxs(Text, { children: [renderModel.input.draft, _jsx(Cursor, { visible: true })] }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", children: renderModel.footerText }) })] }));
|
|
7
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { contextEnabled: renderModel.header.contextEnabled, conversation: renderModel.header.conversation, 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.draft, _jsx(Cursor, { visible: true })] }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", wrap: "truncate", children: renderModel.footerText }) })] }));
|
|
8
8
|
}
|
|
9
9
|
export function InkAuthGate({ state }) {
|
|
10
10
|
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, { label: "Profile", value: state.profile }), state.status === "api_base_url" && _jsx(AuthPrompt, { label: "Base URL", value: state.baseURL }), state.status === "api_key" && _jsx(AuthPrompt, { label: "API key", value: state.apiKey ? "•".repeat(Math.min(state.apiKey.length, 32)) : "" }), state.status === "browser_profile" && _jsx(AuthPrompt, { label: "Profile", value: state.profile }), state.status === "browser_base_url" && _jsx(AuthPrompt, { 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..." })] }))] })] }));
|
|
@@ -13,7 +13,7 @@ function AuthPrompt({ label, value }) {
|
|
|
13
13
|
return (_jsxs(Box, { borderStyle: "single", borderColor: "green", paddingX: 1, marginTop: 1, children: [_jsxs(Text, { color: "green", children: [label, ": "] }), _jsx(Text, { children: value })] }));
|
|
14
14
|
}
|
|
15
15
|
function Header({ contextEnabled, conversation, accessMode, model, pendingLocalLabel, preset, profile, renderMode, workdir, }) {
|
|
16
|
-
return (_jsxs(Box, { borderStyle: "round", borderColor: "cyan", paddingX: 1, flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Agent API Workbench" }), _jsxs(Text, { color: "gray", children: ["profile=", profile, " conversation=", conversation, " preset=", preset, " model=", model] }), _jsxs(Text, { color: "gray", children: ["workdir=", workdir, " access=", accessMode, " local_tools=", contextEnabled ? "on" : "off", " render=", renderMode, " pending=", pendingLocalLabel] })] }));
|
|
16
|
+
return (_jsxs(Box, { borderStyle: "round", borderColor: "cyan", paddingX: 1, flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Agent API Workbench" }), _jsxs(Text, { color: "gray", wrap: "truncate", children: ["profile=", profile, " conversation=", conversation, " preset=", preset, " model=", model] }), _jsxs(Text, { color: "gray", wrap: "truncate", children: ["workdir=", workdir, " access=", accessMode, " local_tools=", contextEnabled ? "on" : "off", " render=", renderMode, " pending=", pendingLocalLabel] })] }));
|
|
17
17
|
}
|
|
18
18
|
function Cursor({ visible }) {
|
|
19
19
|
return visible ? _jsx(Text, { inverse: true, children: " " }) : _jsx(Text, { children: " " });
|
|
@@ -207,7 +207,7 @@ export function createWorkbenchCommandController(options) {
|
|
|
207
207
|
}
|
|
208
208
|
async function showSummary() {
|
|
209
209
|
if (!options.localController.isLoaded()) {
|
|
210
|
-
dispatch({ type: "message.add", role: "system", text:
|
|
210
|
+
dispatch({ type: "message.add", role: "system", text: unavailableWorkdirText() });
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
213
|
dispatch({ type: "activity.add", text: "Summarizing workdir" });
|
|
@@ -265,7 +265,7 @@ export function createWorkbenchCommandController(options) {
|
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
267
|
if (!options.localController.isLoaded()) {
|
|
268
|
-
dispatch({ type: "message.add", role: "system", text:
|
|
268
|
+
dispatch({ type: "message.add", role: "system", text: unavailableWorkdirText() });
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
dispatch({ type: "activity.add", text: `Searching workdir: ${query}` });
|
|
@@ -301,7 +301,7 @@ export function createWorkbenchCommandController(options) {
|
|
|
301
301
|
async function applyPendingEdit(allowFutureLocalActions) {
|
|
302
302
|
const state = options.engine.snapshot();
|
|
303
303
|
if (!options.localController.isLoaded()) {
|
|
304
|
-
dispatch({ type: "message.add", role: "system", text:
|
|
304
|
+
dispatch({ type: "message.add", role: "system", text: unavailableWorkdirText() });
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
307
|
if (state.pendingLocalTool) {
|
|
@@ -357,6 +357,13 @@ export function createWorkbenchCommandController(options) {
|
|
|
357
357
|
}
|
|
358
358
|
dispatch({ type: "message.add", role: "system", text: "No pending local action." });
|
|
359
359
|
}
|
|
360
|
+
function unavailableWorkdirText() {
|
|
361
|
+
const state = options.engine.snapshot();
|
|
362
|
+
if (!state.contextEnabled || state.accessMode === "off") {
|
|
363
|
+
return "Local workdir tools are off. Use /workdir on, /access approval, or /access full to load and expose the current workdir.";
|
|
364
|
+
}
|
|
365
|
+
return "Workdir is still loading.";
|
|
366
|
+
}
|
|
360
367
|
}
|
|
361
368
|
export function normalizeOptionalSetting(value, clearValues) {
|
|
362
369
|
const trimmed = value.trim();
|
|
@@ -50,7 +50,7 @@ export function createWorkbenchLifecycleController(options) {
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
initialPrompt(input) {
|
|
53
|
-
if (initialPromptSubmitted || input.busy || !input.workdir)
|
|
53
|
+
if (initialPromptSubmitted || input.busy || (input.requiresWorkdir && !input.workdir))
|
|
54
54
|
return undefined;
|
|
55
55
|
const prompt = input.promptParts.join(" ").trim();
|
|
56
56
|
if (!prompt)
|
|
@@ -2,7 +2,7 @@ import { buildTranscriptViewModel, elapsedDots, spinnerGlyph, } from "./view-mod
|
|
|
2
2
|
export function buildWorkbenchRenderModel(input) {
|
|
3
3
|
const terminalRows = Math.max(18, input.viewport.rows || 32);
|
|
4
4
|
const terminalColumns = Math.max(80, input.viewport.columns || 100);
|
|
5
|
-
const viewportHeight = Math.max(6, terminalRows -
|
|
5
|
+
const viewportHeight = Math.max(6, terminalRows - 11);
|
|
6
6
|
const activityHeight = viewportHeight;
|
|
7
7
|
const transcriptWidth = Math.max(36, Math.floor(terminalColumns * 0.72) - 4);
|
|
8
8
|
const transcript = buildTranscriptViewModel({
|