@autopilot-agent/cli 0.3.0 → 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/README.md +8 -4
- package/dist/activity-animation.d.ts +1 -0
- package/dist/activity-animation.js +4 -2
- package/dist/browser-client.d.ts +14 -0
- package/dist/browser-client.js +156 -0
- package/dist/composition-root.d.ts +12 -2
- package/dist/composition-root.js +33 -15
- package/dist/context-report.d.ts +1 -1
- package/dist/context-report.js +1 -1
- package/dist/controller.d.ts +48 -1
- package/dist/controller.js +50 -24
- package/dist/design-tokens.d.ts +7 -2
- package/dist/design-tokens.js +11 -3
- package/dist/desktop-status.d.ts +35 -0
- package/dist/desktop-status.js +304 -0
- package/dist/file-mention-budget.d.ts +16 -0
- package/dist/file-mention-budget.js +82 -0
- package/dist/file-mention-context.d.ts +26 -1
- package/dist/file-mention-context.js +70 -22
- package/dist/main.d.ts +3 -0
- package/dist/main.js +76 -10
- package/dist/managed-attach.d.ts +3 -0
- package/dist/managed-attach.js +132 -0
- package/dist/managed-controller.d.ts +49 -0
- package/dist/managed-controller.js +171 -0
- package/dist/orchestration-templates.d.ts +27 -0
- package/dist/orchestration-templates.js +20 -0
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +14 -4
- package/dist/thread-host.d.ts +5 -0
- package/dist/thread-host.js +3 -0
- package/dist/tui/app.js +82 -18
- package/dist/tui/approval.js +1 -1
- package/dist/tui/brand/brand-header.d.ts +1 -3
- package/dist/tui/brand/brand-header.js +6 -8
- package/dist/tui/brand/logo.d.ts +3 -0
- package/dist/tui/brand/logo.js +89 -0
- package/dist/tui/brand/startup.d.ts +18 -0
- package/dist/tui/brand/startup.js +136 -0
- package/dist/tui/constants.d.ts +1 -1
- package/dist/tui/constants.js +1 -1
- package/dist/tui/context.js +1 -3
- package/dist/tui/desktop-resize.d.ts +9 -0
- package/dist/tui/desktop-resize.js +95 -0
- package/dist/tui/hooks/use-file-mention-index.js +9 -4
- package/dist/tui/hooks/use-prompt-input.d.ts +2 -1
- package/dist/tui/hooks/use-prompt-input.js +12 -7
- package/dist/tui/hooks/use-viewport.d.ts +2 -1
- package/dist/tui/hooks/use-viewport.js +15 -8
- package/dist/tui/input-area.d.ts +4 -1
- package/dist/tui/input-area.js +12 -7
- package/dist/tui/lifecycle.d.ts +1 -1
- package/dist/tui/lifecycle.js +82 -11
- package/dist/tui/pickers/permission.js +1 -1
- package/dist/tui/pickers/slash.d.ts +11 -2
- package/dist/tui/pickers/slash.js +21 -7
- package/dist/tui/prompt-input.d.ts +1 -0
- package/dist/tui/prompt-input.js +2 -2
- package/dist/tui/render-mode.d.ts +4 -0
- package/dist/tui/render-mode.js +12 -0
- package/dist/tui/run.js +17 -7
- package/dist/tui/session-manager.d.ts +1 -0
- package/dist/tui/session-manager.js +1 -0
- package/dist/tui/status-line.d.ts +1 -0
- package/dist/tui/status-line.js +29 -14
- package/dist/tui/store.d.ts +3 -1
- package/dist/tui/store.js +33 -9
- package/dist/tui/transcript.d.ts +1 -0
- package/dist/tui/transcript.js +24 -4
- package/dist/tui/types.d.ts +10 -1
- package/dist/tui/viewport/selection.d.ts +2 -2
- package/dist/tui/viewport/selection.js +13 -6
- package/dist/tui/viewport/sources.js +7 -1
- package/dist/types.d.ts +9 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @autopilot-agent/cli
|
|
2
2
|
|
|
3
|
-
Autopilot 的终端宿主包。普通用户安装主包 `autopilot-agent@0.
|
|
3
|
+
Autopilot 的终端宿主包。普通用户安装主包 `autopilot-agent@0.4.0`,无需分别安装各个 scoped 包:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install -g autopilot-agent@0.
|
|
6
|
+
npm install -g autopilot-agent@0.4.0
|
|
7
7
|
ap --help
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
完整安装、使用和限制见 [主包手册](https://github.com/C-Clay-W/autopilot/blob/main/packages/autopilot-agent/README.md),当前源码的 Anthropic、Chat Completions、Responses 配置与完整 argv / slash 语法见 [CLI 参考](../../agent/CLI-Reference.md#6-配置管理)。Chat Completions 与 Responses 各有独立配置示例,包含 User settings 路径、凭据引用、兼容预设和模型能力限制。开发参考随源码更新,可能先于已发布版本的行为。
|
|
11
11
|
|
|
12
12
|
## 结构与职责
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ ap --help
|
|
|
15
15
|
- composition-root.ts 注入共享 Core Runtime 与 Node Adapters,controller.ts 管理任务、审批与恢复。
|
|
16
16
|
- thread-commands.ts / thread-host.ts 承载同机会话协作:`ap thread ...` 薄命令复用 Core 协作协议,交互会话持有驱动 Runner;两者共用同一状态根与 Project。
|
|
17
17
|
- tui/ 使用 React / Ink;renderer.ts 与 event-projector.ts 支持纯文本和 JSONL。
|
|
18
|
-
- 内部依赖为 Core、Adapters、Presentation,0.
|
|
18
|
+
- 内部依赖为 Core、Adapters、Presentation,0.4.0 使用匹配的精确版本。
|
|
19
19
|
|
|
20
20
|
本包的 bin 提供 ap/autopilot,主入口包再转发至本包的 dist/main.js,不复制 Runtime。TTY 使用交互界面;显式 --output text/jsonl 用于脚本,JSONL 不输出 ANSI 或交互提示。
|
|
21
21
|
|
|
@@ -45,6 +45,10 @@ build 使用 TypeScript,输出 dist/*.js 与声明,不在 npm 包中发布
|
|
|
45
45
|
|
|
46
46
|
CLI 使用用户级 settings.json,默认工作区为当前目录,可显式指定 --workspace-root。CLI 不读取开发仓库 Web env,也不因配置中含 RAG 字段而自动启用私有知识库工具。重要项目保留版本控制,OS 沙箱、MCP 和平台限制见主包手册。
|
|
47
47
|
|
|
48
|
+
## 0.4.0 版本
|
|
49
|
+
|
|
50
|
+
可用 `/effort` 查看当前模型支持的推理强度,用 Ctrl+G 重看保留的通知。启动帮助见 `ap --help`。
|
|
51
|
+
|
|
48
52
|
## 0.3.0 版本
|
|
49
53
|
|
|
50
54
|
新增单窗口多会话、任务分派与进展汇报、主子会话双入口审批和图片输入。`Ctrl+T` 切换会话,`Ctrl+A` 处理真实待办请求;历史结构化问题可在原目标会话回答并继续。历史按需加载,输出使用终端原生滚动,并改进启动、缩放和流式完成时的布局。
|
|
@@ -46,6 +46,7 @@ export declare function resolveCliActivityView(input: {
|
|
|
46
46
|
}): CliActivityView | undefined;
|
|
47
47
|
/** 渲染稳定活动文案和可选的固定宽度离散帧。 */
|
|
48
48
|
export declare function TuiActivityLine(props: {
|
|
49
|
+
compacting?: boolean;
|
|
49
50
|
threadWait?: import("./types.js").CliProjection["threadWait"];
|
|
50
51
|
activity: CliActivityState;
|
|
51
52
|
status: CliTurnStatus;
|
|
@@ -117,7 +117,9 @@ export function resolveCliActivityView(input) {
|
|
|
117
117
|
/** 渲染稳定活动文案和可选的固定宽度离散帧。 */
|
|
118
118
|
export function TuiActivityLine(props) {
|
|
119
119
|
const [clockTime, setClockTime] = useState(props.clock.now());
|
|
120
|
-
const view =
|
|
120
|
+
const view = props.compacting
|
|
121
|
+
? { phase: "thinking", label: "Compacting context…", frame: getCliActivityFrame("thinking", clockTime) }
|
|
122
|
+
: resolveCliActivityView({ activity: props.activity, status: props.status, now: clockTime, waitingForApproval: props.waitingForApproval, threadWait: props.threadWait });
|
|
121
123
|
const shouldAnimate = props.animationActive && !props.screenReader && !props.reducedMotion && view !== undefined && view.phase !== "terminal";
|
|
122
124
|
const shouldTick = shouldAnimate || (props.runningSince !== undefined && props.status === "running");
|
|
123
125
|
useEffect(function subscribeActivityClock() {
|
|
@@ -138,5 +140,5 @@ export function TuiActivityLine(props) {
|
|
|
138
140
|
return null;
|
|
139
141
|
const frame = shouldAnimate ? view.frame : "·";
|
|
140
142
|
const isStalled = view.phase === "stalled";
|
|
141
|
-
return (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { bold: isStalled, color: props.useColor ? "ansi256(208)" : undefined, children: frame }) }), _jsx(Text, { bold: isStalled, dimColor: props.useColor && !isStalled, children: props.threadWait && props.status === "running" ? view.label : props.activeForm ?? view.label })] }));
|
|
143
|
+
return (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { bold: isStalled, color: props.useColor ? "ansi256(208)" : undefined, children: frame }) }), _jsx(Text, { bold: isStalled, dimColor: props.useColor && !isStalled, children: props.compacting || props.threadWait && props.status === "running" ? view.label : props.activeForm ?? view.label })] }));
|
|
142
144
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type BrowserCapability, type BrowserOperation } from "@autopilot-agent/core";
|
|
2
|
+
/** 仅保留源码定义的完整固定码,拒绝任意前缀正文、路径和伪造扩展码。 */
|
|
3
|
+
export declare function getBrowserErrorCode(value: unknown): string | undefined;
|
|
4
|
+
/** 单次HTTP请求不重试;取消或失联不能冒充动作未执行。 */
|
|
5
|
+
export declare function browserRequest(address: string, token: string, path: string, value: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
6
|
+
/** 原生连接持有无业务流量的进程监视通道,进程退出时宿主立即撤销回合。 */
|
|
7
|
+
export declare function createDesktopBrowserCapability(env?: NodeJS.ProcessEnv): BrowserCapability | undefined;
|
|
8
|
+
/** 固定命令组:动作名与单个JSON对象,许可只由原生工具适配器注入。 */
|
|
9
|
+
export declare function parseBrowserArgs(args: readonly string[]): {
|
|
10
|
+
operation: BrowserOperation;
|
|
11
|
+
permit?: string;
|
|
12
|
+
};
|
|
13
|
+
/** 第三方命令只能消费单次许可,不接受自报身份/回合或native凭据。 */
|
|
14
|
+
export declare function executeBrowserCommand(operation: BrowserOperation, permit: string | undefined, signal?: AbortSignal): Promise<unknown>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// AP CLI的固定浏览器入口直接连接受管宿主,不创建Provider或独立浏览器。
|
|
2
|
+
import { request as httpRequest } from "node:http";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { parseBrowserOperation } from "@autopilot-agent/core";
|
|
5
|
+
const browserErrorCodes = new Set([
|
|
6
|
+
"BROWSER_ACTION_INVALID", "BROWSER_AGENT_INVALID", "BROWSER_AUTH_REQUIRED", "BROWSER_BUSY",
|
|
7
|
+
"BROWSER_CALLER_DISCONNECTED", "BROWSER_CALL_INVALID", "BROWSER_CALL_REPLAY", "BROWSER_CALL_REQUIRED",
|
|
8
|
+
"BROWSER_CANCELLED", "BROWSER_CDP_DENIED", "BROWSER_CDP_OUTCOME_UNKNOWN", "BROWSER_DENIED",
|
|
9
|
+
"BROWSER_DESKTOP_REQUIRED", "BROWSER_DIALOG_UNAVAILABLE", "BROWSER_DOCUMENT_CHANGED", "BROWSER_DOCUMENT_PATH_INVALID",
|
|
10
|
+
"BROWSER_DOCUMENT_TIMEOUT", "BROWSER_DOCUMENT_TOO_LARGE", "BROWSER_DOCUMENT_UNAVAILABLE", "BROWSER_DOCUMENT_UNSUPPORTED",
|
|
11
|
+
"BROWSER_DOWNLOAD_UNAVAILABLE", "BROWSER_DRIVER_ACCESS_DENIED", "BROWSER_DRIVER_CLEANUP_FAILED", "BROWSER_DRIVER_FAILED",
|
|
12
|
+
"BROWSER_DRIVER_INTEGRITY_INVALID", "BROWSER_DRIVER_MISSING", "BROWSER_DRIVER_PLATFORM_UNAVAILABLE", "BROWSER_DRIVER_RESOURCE_INVALID",
|
|
13
|
+
"BROWSER_DRIVER_STOP_FAILED", "BROWSER_DRIVER_UNAVAILABLE", "BROWSER_DRIVER_VERSION_INVALID", "BROWSER_ENDPOINT_INVALID",
|
|
14
|
+
"BROWSER_FILE_URL_USE_DOCUMENT", "BROWSER_MAIN_SESSION_REQUIRED", "BROWSER_MANAGED_CLI_REQUIRED", "BROWSER_NATIVE_BINDING_FAILED",
|
|
15
|
+
"BROWSER_NATIVE_SHELL_UNSUPPORTED", "BROWSER_NATIVE_TOOL_BINDING_REQUIRED", "BROWSER_NATIVE_TURN_REQUIRED", "BROWSER_OUTCOME_UNKNOWN",
|
|
16
|
+
"BROWSER_PAGE_CHANGED", "BROWSER_PAGE_INITIALIZING", "BROWSER_PAGE_INIT_TIMEOUT", "BROWSER_PAGE_UNAVAILABLE",
|
|
17
|
+
"BROWSER_PERMIT_INVALID", "BROWSER_PREFERENCES_INVALID", "BROWSER_REQUEST_FAILED", "BROWSER_REQUEST_INVALID",
|
|
18
|
+
"BROWSER_RESPONSE_INVALID", "BROWSER_RESULT_TOO_LARGE", "BROWSER_ROUTE_INVALID", "BROWSER_SCREENSHOT_INVALID",
|
|
19
|
+
"BROWSER_SCREENSHOT_TIMEOUT", "BROWSER_SESSION_INVALID", "BROWSER_SKILL_CHANGED", "BROWSER_SKILL_CUSTOM_OR_UNAVAILABLE",
|
|
20
|
+
"BROWSER_TURN_ENDED", "BROWSER_TURN_INVALID", "BROWSER_TURN_UNAVAILABLE", "BROWSER_UNAVAILABLE",
|
|
21
|
+
"BROWSER_URL_INVALID", "BROWSER_USER_TURN_UNAVAILABLE", "BROWSER_WATCH_EXISTS", "BROWSER_WORKSPACE_ROOT_REQUIRED",
|
|
22
|
+
]);
|
|
23
|
+
/** 仅保留源码定义的完整固定码,拒绝任意前缀正文、路径和伪造扩展码。 */
|
|
24
|
+
export function getBrowserErrorCode(value) {
|
|
25
|
+
try {
|
|
26
|
+
const code = value instanceof Error ? value.message : value;
|
|
27
|
+
return typeof code === "string" && browserErrorCodes.has(code) ? code : undefined;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** 只接受Desktop随机loopback HTTP地址,不读取任意网络配置。 */
|
|
34
|
+
function endpoint(value) {
|
|
35
|
+
if (!value)
|
|
36
|
+
throw new Error("BROWSER_DESKTOP_REQUIRED");
|
|
37
|
+
let url;
|
|
38
|
+
try {
|
|
39
|
+
url = new URL(value);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error("BROWSER_ENDPOINT_INVALID");
|
|
43
|
+
}
|
|
44
|
+
if (url.protocol !== "http:" || url.hostname !== "127.0.0.1" || !url.port || url.username || url.password || url.pathname !== "/" || url.search || url.hash)
|
|
45
|
+
throw new Error("BROWSER_ENDPOINT_INVALID");
|
|
46
|
+
return url.origin;
|
|
47
|
+
}
|
|
48
|
+
/** 单次HTTP请求不重试;取消或失联不能冒充动作未执行。 */
|
|
49
|
+
export function browserRequest(address, token, path, value, signal) {
|
|
50
|
+
return new Promise(function send(resolve, reject) {
|
|
51
|
+
const request = httpRequest(endpoint(address) + path, { method: "POST", headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" }, signal }, function response(response) {
|
|
52
|
+
let output = "";
|
|
53
|
+
response.on("data", function data(chunk) { output += chunk.toString(); if (Buffer.byteLength(output) > 8 * 1024 * 1024)
|
|
54
|
+
request.destroy(new Error("BROWSER_RESULT_TOO_LARGE")); });
|
|
55
|
+
response.on("end", function end() {
|
|
56
|
+
let result;
|
|
57
|
+
try {
|
|
58
|
+
result = JSON.parse(output);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
reject(new Error("BROWSER_RESPONSE_INVALID"));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (!result || result.ok !== true) {
|
|
65
|
+
reject(new Error(getBrowserErrorCode(result?.error) || (result?.error === "有其他智能体正在操控,请等待后再试" ? "BROWSER_BUSY" : "BROWSER_REQUEST_FAILED")));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
resolve(result.result);
|
|
69
|
+
});
|
|
70
|
+
response.on("error", function failed() { reject(new Error(signal?.aborted ? "BROWSER_CANCELLED" : "BROWSER_OUTCOME_UNKNOWN")); });
|
|
71
|
+
});
|
|
72
|
+
request.on("error", function failed(error) { reject(new Error(signal?.aborted ? "BROWSER_CANCELLED" : getBrowserErrorCode(error) || "BROWSER_OUTCOME_UNKNOWN")); });
|
|
73
|
+
request.setTimeout(600_000, function expired() { request.destroy(new Error("BROWSER_OUTCOME_UNKNOWN")); });
|
|
74
|
+
request.end(JSON.stringify(value));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** 原生连接持有无业务流量的进程监视通道,进程退出时宿主立即撤销回合。 */
|
|
78
|
+
export function createDesktopBrowserCapability(env = process.env) {
|
|
79
|
+
if (!env.AUTOPILOT_BROWSER_ENDPOINT || !env.AUTOPILOT_BROWSER_NATIVE_TOKEN)
|
|
80
|
+
return undefined;
|
|
81
|
+
const address = endpoint(env.AUTOPILOT_BROWSER_ENDPOINT);
|
|
82
|
+
const initialToken = env.AUTOPILOT_BROWSER_NATIVE_TOKEN;
|
|
83
|
+
const runId = randomUUID();
|
|
84
|
+
let connection;
|
|
85
|
+
let watch;
|
|
86
|
+
const turns = new Set();
|
|
87
|
+
/** 本进程只登记一次,断开不自动重建已丢失的许可。 */
|
|
88
|
+
async function connect() {
|
|
89
|
+
const registered = await browserRequest(address, initialToken, "/connect-native", { runId });
|
|
90
|
+
await new Promise(function monitor(resolve, reject) {
|
|
91
|
+
watch = httpRequest(address + "/watch", { method: "POST", headers: { Authorization: `Bearer ${registered.token}`, "Content-Type": "application/json" } }, function ready(response) {
|
|
92
|
+
if (response.statusCode !== 200) {
|
|
93
|
+
response.resume();
|
|
94
|
+
reject(new Error("BROWSER_AUTH_REQUIRED"));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
response.resume();
|
|
98
|
+
response.socket?.unref();
|
|
99
|
+
resolve();
|
|
100
|
+
});
|
|
101
|
+
watch.on("error", function failed() { reject(new Error("BROWSER_UNAVAILABLE")); });
|
|
102
|
+
watch.end("{}");
|
|
103
|
+
});
|
|
104
|
+
return registered.token;
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
confirmsDocument: true,
|
|
108
|
+
managesApprovals: true,
|
|
109
|
+
/** Core可信绑定作为原生回合登记;命令行browser入口不能调用该路径。 */
|
|
110
|
+
async request(binding, callId, operation, signal, authorization) {
|
|
111
|
+
connection ??= connect();
|
|
112
|
+
const token = await connection;
|
|
113
|
+
const turnId = `${binding.sessionId}:${binding.turnId}`;
|
|
114
|
+
if (!turns.has(turnId)) {
|
|
115
|
+
await browserRequest(address, token, "/turn/begin", { turnId, sessionId: binding.sessionId }, signal);
|
|
116
|
+
turns.add(turnId);
|
|
117
|
+
}
|
|
118
|
+
return browserRequest(address, token, "/request", { turnId, callId, operation, authorization }, signal);
|
|
119
|
+
},
|
|
120
|
+
/** 真实终态等待宿主撤销;失联时关闭监视通道使宿主fail-closed。 */
|
|
121
|
+
async endTurn(binding) {
|
|
122
|
+
const turnId = `${binding.sessionId}:${binding.turnId}`;
|
|
123
|
+
if (!connection || !turns.has(turnId))
|
|
124
|
+
return;
|
|
125
|
+
try {
|
|
126
|
+
await browserRequest(address, await connection, "/turn/end", { turnId });
|
|
127
|
+
turns.delete(turnId);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
watch?.destroy();
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/** 固定命令组:动作名与单个JSON对象,许可只由原生工具适配器注入。 */
|
|
137
|
+
export function parseBrowserArgs(args) {
|
|
138
|
+
if (args.length !== 2 && args.length !== 4 || args.length === 4 && (args[2] !== "--permit" || !/^[a-f0-9]{64}$/.test(args[3])))
|
|
139
|
+
throw new Error("浏览器用法:ap browser <动作> '<JSON参数>'");
|
|
140
|
+
let input;
|
|
141
|
+
try {
|
|
142
|
+
input = JSON.parse(args[1]);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
throw new Error("BROWSER_ACTION_INVALID");
|
|
146
|
+
}
|
|
147
|
+
if (!input || typeof input !== "object" || Array.isArray(input) || "type" in input)
|
|
148
|
+
throw new Error("BROWSER_ACTION_INVALID");
|
|
149
|
+
return { operation: parseBrowserOperation({ type: args[0], ...input }), ...(args[3] ? { permit: args[3] } : {}) };
|
|
150
|
+
}
|
|
151
|
+
/** 第三方命令只能消费单次许可,不接受自报身份/回合或native凭据。 */
|
|
152
|
+
export async function executeBrowserCommand(operation, permit, signal) {
|
|
153
|
+
if (!permit || !process.env.AUTOPILOT_BROWSER_CALLER_TOKEN)
|
|
154
|
+
throw new Error("BROWSER_NATIVE_TOOL_BINDING_REQUIRED");
|
|
155
|
+
return browserRequest(endpoint(process.env.AUTOPILOT_BROWSER_ENDPOINT), process.env.AUTOPILOT_BROWSER_CALLER_TOKEN, "/call", { permit, operation }, signal);
|
|
156
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 负责选择 Core 默认 Runtime、共享 Node Adapter、canonical workspaceRoot、
|
|
5
5
|
* trust policy 和显式 stateRoot;不负责命令解析、事件投影或 Runtime 状态机。
|
|
6
6
|
*/
|
|
7
|
-
import { type AgentRuntime, type CapabilityLoader, type CreateRuntimeBootstrapServiceOptions, type RuntimeBootstrapService, type SafeBootstrapConfig, type SandboxCapabilityReport, type ThreadFacade, type WorkspaceTrustEntry, type WorkspaceTrustPolicy } from "@autopilot-agent/core";
|
|
7
|
+
import { type AgentRuntime, type AgentSkillsCapability, type CapabilityLoader, type CreateRuntimeBootstrapServiceOptions, type RuntimeBootstrapService, type RuntimePorts, type SafeBootstrapConfig, type SandboxCapabilityReport, type ThreadFacade, type WorkspaceTrustEntry, type WorkspaceTrustPolicy } from "@autopilot-agent/core";
|
|
8
8
|
import type { CliRuntimeStatusDefaults, CliSkillSummary } from "./types.js";
|
|
9
9
|
import { type WorkspaceRegistryEntry, type NodeCapabilityLoader, type NodeSettingsLoader } from "@autopilot-agent/adapters";
|
|
10
10
|
import { type CliThreadHost } from "./thread-host.js";
|
|
@@ -26,6 +26,11 @@ export interface CreateCliCompositionRootOptions {
|
|
|
26
26
|
trustPolicy?: WorkspaceTrustPolicy;
|
|
27
27
|
capabilityLoader?: CliCapabilityLoader;
|
|
28
28
|
defaultRunConfig?: CreateRuntimeBootstrapServiceOptions["defaultRunConfig"];
|
|
29
|
+
/** 可信宿主装饰同一份Ports,不额外创建Runtime或存储。 */
|
|
30
|
+
decoratePorts?: (ports: RuntimePorts) => RuntimePorts;
|
|
31
|
+
/** 可信宿主在普通 Skills 发现完成后注入内置目录。 */
|
|
32
|
+
decorateSkills?: (skills: AgentSkillsCapability | undefined) => AgentSkillsCapability | undefined;
|
|
33
|
+
enableUserQuestions?: boolean;
|
|
29
34
|
/** 已信任 settings Loader 的测试 seam;生产默认创建 Node Loader。 */
|
|
30
35
|
settingsLoader?: NodeSettingsLoader;
|
|
31
36
|
/** Doctor 连通性探测的测试 seam;生产默认使用全局 fetch。 */
|
|
@@ -80,7 +85,12 @@ export interface CliCompositionRoot {
|
|
|
80
85
|
/** 创建人类协作入口(薄命令);未绑定 Project 或缺少 Ports 时明确失败。 */
|
|
81
86
|
createHumanThreads(): ThreadFacade;
|
|
82
87
|
/** 创建常驻协作宿主(交互会话);未装配协作能力时明确失败。 */
|
|
83
|
-
createThreadHost(runtime: AgentRuntime, onError?: import("@autopilot-agent/adapters").NodeThreadRunnerOptions["onError"]
|
|
88
|
+
createThreadHost(runtime: AgentRuntime, onError?: import("@autopilot-agent/adapters").NodeThreadRunnerOptions["onError"], observeExecution?: (input: {
|
|
89
|
+
threadId: string;
|
|
90
|
+
turnId: string;
|
|
91
|
+
}) => void): CliThreadHost;
|
|
92
|
+
/** Desktop 观察复用当前受信 capability,不暴露路径或创建能力。 */
|
|
93
|
+
getDesktopStatusWorkspace?(): import("@autopilot-agent/adapters").DesktopWorkspaceStatus | undefined;
|
|
84
94
|
/** 只读取当前宿主Store事件,不调用恢复或执行入口。 */
|
|
85
95
|
readSessionEvents(sessionId: string): Promise<import("@autopilot-agent/core").AgentEventEnvelope[]>;
|
|
86
96
|
/** 只读一页历史及其持续跟进游标,不恢复或执行目标。 */
|
package/dist/composition-root.js
CHANGED
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* trust policy 和显式 stateRoot;不负责命令解析、事件投影或 Runtime 状态机。
|
|
6
6
|
*/
|
|
7
7
|
import { readCliSessionSummary } from "./session-summary.js";
|
|
8
|
+
import { createDesktopBrowserCapability } from "./browser-client.js";
|
|
8
9
|
import { WEB_SEARCH_DATA_FLOW_NOTICE } from "@autopilot-agent/presentation";
|
|
9
|
-
import { AgentRuntimeError, createDefaultModelSamplerFactory, createRuntimeBootstrapService, createSafeBootstrapConfig, createThreadFacade, WorkspaceTrustError, getMcpServerGrantConstraint, } from "@autopilot-agent/core";
|
|
10
|
+
import { AgentRuntimeError, resolveRouteModelCapability, createDefaultModelSamplerFactory, createRuntimeBootstrapService, createSafeBootstrapConfig, createThreadFacade, WorkspaceTrustError, getMcpServerGrantConstraint, } from "@autopilot-agent/core";
|
|
10
11
|
import { createNodeCredentialStore, createNodeCapabilityLoader, createNodeHostExecutionSandboxPort, createNodeSandboxPort, createNodeSettingsLoader, createNodeSettingsWriter, createNodeStateRootId, createNodeThreadHandoffWriter, ensureUserConfigDirectory, createNodeRuntimePorts, createNodeTrustPolicy, createNodeWorkspaceRegistry, createNodeWorkspaceAdapter, createNodeWorkspaceId, getNodeStateCorruptionDiagnostics, getNodeStatePaths, getNodeStateSchemaDiagnostic, initializeNodeStateRoot, LOCAL_HUMAN_PRINCIPAL_ID, resolveNodeSettingsPaths, resolveNodeStateRoot, assertNodeStateSchema, } from "@autopilot-agent/adapters";
|
|
11
12
|
import { createCliThreadHost } from "./thread-host.js";
|
|
12
13
|
import fs from "node:fs";
|
|
13
14
|
import path from "node:path";
|
|
14
15
|
/** CLI 专用模型行为补充:无结构化 answerer 时以普通正文完成最少必要澄清。 */
|
|
15
|
-
const CLI_TEXT_CLARIFICATION_INSTRUCTIONS = `当前宿主是 CLI,未提供 ask_user_question 或其他结构化用户回答能力。仅在完成任务确实缺少方向性信息、且不能从当前用户输入、会话历史或工作区安全获得时,才在普通助手正文中用最少必要的简短问题向用户澄清;提出问题后正常结束当前 Turn,等待用户下一条 prompt 作为同一 Session 的新 Turn 继续。不要臆造或调用 ask_user_question
|
|
16
|
+
const CLI_TEXT_CLARIFICATION_INSTRUCTIONS = `当前宿主是 CLI,未提供 ask_user_question 或其他结构化用户回答能力。仅在完成任务确实缺少方向性信息、且不能从当前用户输入、会话历史或工作区安全获得时,才在普通助手正文中用最少必要的简短问题向用户澄清;提出问题后正常结束当前 Turn,等待用户下一条 prompt 作为同一 Session 的新 Turn 继续。不要臆造或调用 ask_user_question,不要把澄清伪装成审批,也不要在等待澄清时猜测并执行写入或命令工具。`;
|
|
17
|
+
const CLI_TOOL_CONSTRAINTS = `用户下一条 prompt 与任何 Other/custom 文本都不授予 Trust、权限或审批;后续工具调用仍必须遵守既有 Policy 与 Approval 约束。Agent 自身的临时脚本、截图裁剪和中间文件必须写入项目根目录的 .autopilot/tmp,不得写入 node_modules 或随意污染业务目录;用户明确指定的目标路径除外。`;
|
|
16
18
|
/**
|
|
17
19
|
* 子会话可用的工具目录:协作工具用于回报,Work 常用工具用于真正执行任务。
|
|
18
20
|
* 这是 CLI 宿主策略(与 Web 首版保持同一最小集合),会随组记录冻结并向用户展示。
|
|
@@ -73,7 +75,7 @@ function omitCliRagCapabilityLoader(loader) {
|
|
|
73
75
|
return safeLoader;
|
|
74
76
|
}
|
|
75
77
|
/** 为任意 CLI Provider 工厂叠加宿主澄清指令,保留原采样和完成策略。 */
|
|
76
|
-
function withCliTextClarificationBehavior(factory) {
|
|
78
|
+
function withCliTextClarificationBehavior(factory, enableUserQuestions = false) {
|
|
77
79
|
return {
|
|
78
80
|
create(input) {
|
|
79
81
|
const sampler = factory.create(input);
|
|
@@ -82,7 +84,7 @@ function withCliTextClarificationBehavior(factory) {
|
|
|
82
84
|
...sampler,
|
|
83
85
|
behaviorProfile: {
|
|
84
86
|
id: `${profile?.id ?? "cli"}-text-clarification`,
|
|
85
|
-
instructions: [profile?.instructions, CLI_TEXT_CLARIFICATION_INSTRUCTIONS].filter(Boolean).join("\n\n"),
|
|
87
|
+
instructions: [profile?.instructions, enableUserQuestions ? CLI_TOOL_CONSTRAINTS : CLI_TEXT_CLARIFICATION_INSTRUCTIONS + " " + CLI_TOOL_CONSTRAINTS].filter(Boolean).join("\n\n"),
|
|
86
88
|
completionPolicy: profile?.completionPolicy,
|
|
87
89
|
},
|
|
88
90
|
};
|
|
@@ -215,17 +217,16 @@ export function createCliCompositionRoot(options = {}) {
|
|
|
215
217
|
const seen = new Set();
|
|
216
218
|
const firstPartyEfforts = ["none", "low", "medium", "high", "max"];
|
|
217
219
|
function getRouteRequestableEfforts(route, modelId) {
|
|
218
|
-
|
|
219
|
-
const profile = model?.protocolProfile ?? route.protocolProfile;
|
|
220
|
-
return route.apiProtocol === "openai-chat-completions"
|
|
221
|
-
&& (profile?.apiProtocol !== "openai-chat-completions" || !profile.supportsReasoningContent) ? ["none"] : firstPartyEfforts;
|
|
220
|
+
return resolveRouteModelCapability(route, modelId).supportedReasoningEfforts ?? [];
|
|
222
221
|
}
|
|
223
222
|
function addCapability(provider, modelId, requestableEfforts) {
|
|
224
223
|
const key = `${provider}/${modelId}`;
|
|
225
224
|
if (!modelId || seen.has(key))
|
|
226
225
|
return;
|
|
227
226
|
seen.add(key);
|
|
228
|
-
|
|
227
|
+
const route = resolvedSettings?.providerRoutes[provider];
|
|
228
|
+
const capability = route ? resolveRouteModelCapability(route, modelId) : undefined;
|
|
229
|
+
capabilities.push({ provider, modelId, requestableEfforts, defaultReasoningEffort: capability?.defaultReasoningEffort, reasoningCapabilityUnknown: route ? capability?.supportedReasoningEfforts === undefined : false, supportsToolCalls: capability?.supportsToolCalls });
|
|
229
230
|
}
|
|
230
231
|
// 开发态 CLI 可能仍链接上一轮 Core 产物;回退 availableModels 以保持 settings 热更新兼容。
|
|
231
232
|
const configuredModels = resolvedSettings.modelCandidates.length > 0
|
|
@@ -376,12 +377,21 @@ export function createCliCompositionRoot(options = {}) {
|
|
|
376
377
|
};
|
|
377
378
|
const baseCapabilityLoader = options.capabilityLoader ?? defaultCapabilityLoader;
|
|
378
379
|
const safeBaseCapabilityLoader = omitCliRagCapabilityLoader(baseCapabilityLoader);
|
|
380
|
+
const desktopBrowserEnv = {
|
|
381
|
+
AUTOPILOT_BROWSER_ENDPOINT: process.env.AUTOPILOT_BROWSER_ENDPOINT,
|
|
382
|
+
AUTOPILOT_BROWSER_NATIVE_TOKEN: process.env.AUTOPILOT_BROWSER_NATIVE_TOKEN,
|
|
383
|
+
};
|
|
384
|
+
// 原生浏览器凭据只留在组合根闭包,工作区工具的子进程不能继承。
|
|
385
|
+
delete process.env.AUTOPILOT_BROWSER_NATIVE_TOKEN;
|
|
386
|
+
let desktopBrowser;
|
|
379
387
|
let loadedSkills;
|
|
380
388
|
const capabilityLoader = {
|
|
381
389
|
...safeBaseCapabilityLoader,
|
|
390
|
+
/** Trust后只加载Desktop授予的原生连接;独立CLI无环境凭据时不注册工具。 */
|
|
391
|
+
loadBrowser: safeBaseCapabilityLoader.loadBrowser ?? function loadBrowser() { return desktopBrowser ??= createDesktopBrowserCapability(desktopBrowserEnv); },
|
|
382
392
|
...(safeBaseCapabilityLoader.loadProvider ? {
|
|
383
393
|
async loadProvider(workspaceRoot) {
|
|
384
|
-
return withCliTextClarificationBehavior(await safeBaseCapabilityLoader.loadProvider(workspaceRoot));
|
|
394
|
+
return withCliTextClarificationBehavior(await safeBaseCapabilityLoader.loadProvider(workspaceRoot), options.enableUserQuestions);
|
|
385
395
|
},
|
|
386
396
|
} : {}),
|
|
387
397
|
async loadSkills(workspaceRoot) {
|
|
@@ -389,8 +399,8 @@ export function createCliCompositionRoot(options = {}) {
|
|
|
389
399
|
const skills = safeBaseCapabilityLoader.loadSkills
|
|
390
400
|
? await safeBaseCapabilityLoader.loadSkills(workspaceRoot)
|
|
391
401
|
: undefined;
|
|
392
|
-
loadedSkills = skills;
|
|
393
|
-
return
|
|
402
|
+
loadedSkills = options.decorateSkills ? options.decorateSkills(skills) : skills;
|
|
403
|
+
return loadedSkills;
|
|
394
404
|
},
|
|
395
405
|
};
|
|
396
406
|
const bootstrapService = createRuntimeBootstrapService({
|
|
@@ -398,6 +408,7 @@ export function createCliCompositionRoot(options = {}) {
|
|
|
398
408
|
workspaceAdapter,
|
|
399
409
|
trustPolicy,
|
|
400
410
|
capabilityLoader,
|
|
411
|
+
enableUserQuestions: options.enableUserQuestions,
|
|
401
412
|
createPorts(workspaceRoot) {
|
|
402
413
|
initializeNodeStateRoot(stateRoot);
|
|
403
414
|
const ports = createNodeRuntimePorts({
|
|
@@ -411,8 +422,8 @@ export function createCliCompositionRoot(options = {}) {
|
|
|
411
422
|
sandboxTempRoot: path.join(workspaceRoot, ".autopilot", "tmp"),
|
|
412
423
|
});
|
|
413
424
|
// 协作 Facade/宿主必须与 Runtime 使用同一份 Ports,不能另建存储。
|
|
414
|
-
runtimePorts = ports;
|
|
415
|
-
return
|
|
425
|
+
runtimePorts = options.decoratePorts?.(ports) ?? ports;
|
|
426
|
+
return runtimePorts;
|
|
416
427
|
},
|
|
417
428
|
defaultRunConfig: {
|
|
418
429
|
...options.defaultRunConfig,
|
|
@@ -621,7 +632,13 @@ export function createCliCompositionRoot(options = {}) {
|
|
|
621
632
|
handoff: createNodeThreadHandoffWriter({ workspaceRoot: activeWorkspaceRoot }),
|
|
622
633
|
});
|
|
623
634
|
},
|
|
624
|
-
|
|
635
|
+
getDesktopStatusWorkspace: function getDesktopStatusWorkspace() {
|
|
636
|
+
const capability = currentThreadsCapability();
|
|
637
|
+
if (!capability || !activeWorkspaceRoot)
|
|
638
|
+
return undefined;
|
|
639
|
+
return { workspaceId: capability.workspaceId, stateRootId: capability.stateRootId, projectId: capability.projectId, displayName: path.basename(activeWorkspaceRoot).replace(/[\x00-\x1f\x7f/\\]/g, "").slice(0, 80) };
|
|
640
|
+
},
|
|
641
|
+
createThreadHost: function createThreadHost(runtime, onError, observeExecution) {
|
|
625
642
|
const capability = currentThreadsCapability();
|
|
626
643
|
if (!capability || !runtimePorts)
|
|
627
644
|
throw new AgentRuntimeError("THREADS_UNAVAILABLE", "THREADS_UNAVAILABLE");
|
|
@@ -631,6 +648,7 @@ export function createCliCompositionRoot(options = {}) {
|
|
|
631
648
|
runtime,
|
|
632
649
|
ports: runtimePorts,
|
|
633
650
|
...(onError ? { onError } : {}),
|
|
651
|
+
observeExecution,
|
|
634
652
|
});
|
|
635
653
|
},
|
|
636
654
|
bootstrap: async function bootstrap() {
|
package/dist/context-report.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { ContextUsageView, TurnUsageSummaryView } from "@autopilot-agent/core";
|
|
8
8
|
/**
|
|
9
9
|
* 生成 Context 报告文本行。
|
|
10
|
-
* grid=false(Plain/screen reader
|
|
10
|
+
* grid=false(Plain/screen reader)跳过装饰网格但保留完整文本;
|
|
11
11
|
* 列数不足以并排时整体改为上下堆叠。
|
|
12
12
|
*/
|
|
13
13
|
export declare function formatContextReportLines(usage: ContextUsageView | null, expanded: boolean, options: {
|
package/dist/context-report.js
CHANGED
|
@@ -132,7 +132,7 @@ function renderGridLines(usage, columns) {
|
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* 生成 Context 报告文本行。
|
|
135
|
-
* grid=false(Plain/screen reader
|
|
135
|
+
* grid=false(Plain/screen reader)跳过装饰网格但保留完整文本;
|
|
136
136
|
* 列数不足以并排时整体改为上下堆叠。
|
|
137
137
|
*/
|
|
138
138
|
export function formatContextReportLines(usage, expanded, options) {
|
package/dist/controller.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* Session/Turn 状态机,审批只从当前安全 projection 取得 approvalId,绝不
|
|
6
6
|
* 生成 callId、toolName、normalizedInputHash 或冻结工具输入。
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { FileMentionReference } from "./file-mention-budget.js";
|
|
9
|
+
import type { AgentEvent, AgentEventEnvelope, ApprovalDecision, ContextUsageView, SessionImageRef } from "@autopilot-agent/core";
|
|
9
10
|
import type { CliAction, CliCommand, CliEffortOption, CliExitCode, CliEventListener, CliJobView, CliQueuedInputStartedListener, CliModelOption, CliPermissionOption, CliProjection, CliRenderer, CliRuntimeStatusDefaults, CliSkillCatalogLister, CliSkillResolver, CliSkillSummary, CliStatusView, CliTurnStatus, CliRuntime } from "./types.js";
|
|
10
11
|
/** 为当前 Controller 注入的审批提交回调;四字段之外不允许宿主提供凭证。 */
|
|
11
12
|
export type CliApprovalSubmit = (input: {
|
|
@@ -20,6 +21,8 @@ export interface CliControllerResult {
|
|
|
20
21
|
exitCode: CliExitCode;
|
|
21
22
|
lines: string[];
|
|
22
23
|
message?: string;
|
|
24
|
+
/** 仅在交互 TUI 的滚动覆盖层显示,不进入通知。 */
|
|
25
|
+
infoReport?: string;
|
|
23
26
|
skillOptions?: CliSkillSummary[];
|
|
24
27
|
/** 交互 TTY 用于打开权限 picker;Plain 模式使用同一结果中的稳定 lines。 */
|
|
25
28
|
permissionOptions?: CliPermissionOption[];
|
|
@@ -41,8 +44,38 @@ export interface CliControllerResult {
|
|
|
41
44
|
inputId: string;
|
|
42
45
|
delivery: "steer" | "queue";
|
|
43
46
|
};
|
|
47
|
+
/** Host 已持久记录的追加原文;不是Core inbox回执,不伪造inputId。 */
|
|
48
|
+
hostRecordedPrompt?: string;
|
|
49
|
+
continuationRequested?: boolean;
|
|
50
|
+
preparedPrompt?: {
|
|
51
|
+
content: string;
|
|
52
|
+
delivery?: "steer" | "queue";
|
|
53
|
+
attachments: SessionImageRef[];
|
|
54
|
+
selectedSkills: Array<{
|
|
55
|
+
skillRef: string;
|
|
56
|
+
skillId: string;
|
|
57
|
+
contentHash: string;
|
|
58
|
+
pinned: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
activeSkills: Array<{
|
|
61
|
+
skillId: string;
|
|
62
|
+
contentHash: string;
|
|
63
|
+
}>;
|
|
64
|
+
fileMentions?: readonly FileMentionReference[];
|
|
65
|
+
};
|
|
44
66
|
projection: CliProjection;
|
|
45
67
|
}
|
|
68
|
+
/** 普通问题和宿主恢复问题共用编号/自定义答案解析,不将自然语言映射为隐式选择。 */
|
|
69
|
+
export declare function parseQuestionAnswer(content: string, item: {
|
|
70
|
+
id: string;
|
|
71
|
+
options: {
|
|
72
|
+
label: string;
|
|
73
|
+
}[];
|
|
74
|
+
}): {
|
|
75
|
+
id: string;
|
|
76
|
+
selected: string[];
|
|
77
|
+
custom?: string;
|
|
78
|
+
};
|
|
46
79
|
/** Controller 创建参数。 */
|
|
47
80
|
export interface CreateCliControllerOptions {
|
|
48
81
|
runtime?: CliRuntime;
|
|
@@ -55,6 +88,8 @@ export interface CreateCliControllerOptions {
|
|
|
55
88
|
workspaceRoot?: string;
|
|
56
89
|
/** 读取已热更新的安全 Runtime 默认值;仅用于 idle/Completed 状态栏,不参与 Turn 冻结。 */
|
|
57
90
|
getRuntimeStatusDefaults?: () => CliRuntimeStatusDefaults;
|
|
91
|
+
/** 受管宿主在原生附件与Skill解析后接管投递,不允许Controller另开执行。 */
|
|
92
|
+
handoffPrompt?: boolean;
|
|
58
93
|
onEvent?: CliEventListener;
|
|
59
94
|
/** 普通执行与现有 Runner 共享 owner 索引;不因前台选择转移 owner。 */
|
|
60
95
|
registerExecution?(input: {
|
|
@@ -71,6 +106,16 @@ export interface CreateCliControllerOptions {
|
|
|
71
106
|
}
|
|
72
107
|
/** CLI Controller 对外接口。 */
|
|
73
108
|
export interface CliController {
|
|
109
|
+
/** Desktop Worker 核验受管输入的文件路径,本地终端直接发送原文。 */
|
|
110
|
+
readonly resolveFileMentionsInHost?: true;
|
|
111
|
+
/** 受管执行者的审批反馈由宿主回执确认。 */
|
|
112
|
+
readonly hostApprovalFeedback?: true;
|
|
113
|
+
/** 当前受管审批暂停点的宿主回执。 */
|
|
114
|
+
getHostApprovalStatus?(): string | undefined;
|
|
115
|
+
/** 受管宿主可在公共目录上提供它实际执行的补全命令。 */
|
|
116
|
+
suggestSlashCommands?(input: string): import("./types.js").CliSlashCommand[];
|
|
117
|
+
/** 受管宿主可扩展输入命令;普通 CLI 继续采用默认解析。 */
|
|
118
|
+
parseInput?(input: string): import("./types.js").CliActionParseResult;
|
|
74
119
|
dispatch(action: CliAction): Promise<CliControllerResult>;
|
|
75
120
|
consume(events: AsyncIterable<AgentEvent>): Promise<CliControllerResult>;
|
|
76
121
|
resume(expectedApproval?: {
|
|
@@ -103,6 +148,8 @@ export interface CliController {
|
|
|
103
148
|
/** 绑定 queue Turn 启动通知;Plain 宿主不需要注册。 */
|
|
104
149
|
setQueuedInputListener?(listener?: CliQueuedInputStartedListener): void;
|
|
105
150
|
}
|
|
151
|
+
/** 将受信问题的当前题目与原选项投影为终端提示,数字选择与自定义文本共用原Core校验。 */
|
|
152
|
+
export declare function questionLines(question: NonNullable<NonNullable<import("@autopilot-agent/core").TurnExecutionView["interaction"]>["question"]>, index?: number): string[];
|
|
106
153
|
/** 创建无 React 依赖的 Controller;Renderer 和 Runtime 均通过参数注入。 */
|
|
107
154
|
export declare function createCliController(options: CreateCliControllerOptions): CliController;
|
|
108
155
|
/** 将 argv 命令转换为 Step 5.2 可执行范围内的 Controller Action。 */
|