laohuang 0.4.1 → 0.5.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 +10 -6
- package/dist/agent.d.ts +7 -27
- package/dist/agent.js +53 -567
- package/dist/agent.js.map +1 -1
- package/dist/capabilities.d.ts +19 -0
- package/dist/capabilities.js +29 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/cli.d.ts +9 -6
- package/dist/cli.js +83 -70
- package/dist/cli.js.map +1 -1
- package/dist/commands.d.ts +20 -3
- package/dist/commands.js +39 -38
- package/dist/commands.js.map +1 -1
- package/dist/keybindings/default-keybindings.d.ts +2 -0
- package/dist/keybindings/default-keybindings.js +10 -0
- package/dist/keybindings/default-keybindings.js.map +1 -0
- package/dist/keybindings/hints.d.ts +3 -0
- package/dist/keybindings/hints.js +7 -0
- package/dist/keybindings/hints.js.map +1 -0
- package/dist/keybindings/key-id.d.ts +20 -0
- package/dist/keybindings/key-id.js +11 -0
- package/dist/keybindings/key-id.js.map +1 -0
- package/dist/keybindings/key-parser.d.ts +7 -0
- package/dist/keybindings/key-parser.js +92 -0
- package/dist/keybindings/key-parser.js.map +1 -0
- package/dist/keybindings/keybindings.d.ts +21 -0
- package/dist/keybindings/keybindings.js +65 -0
- package/dist/keybindings/keybindings.js.map +1 -0
- package/dist/routing.d.ts +2 -57
- package/dist/routing.js +3 -161
- package/dist/routing.js.map +1 -1
- package/dist/runtime/agent-step-runner.d.ts +51 -0
- package/dist/runtime/agent-step-runner.js +361 -0
- package/dist/runtime/agent-step-runner.js.map +1 -0
- package/dist/runtime/agent-turn-loop.d.ts +36 -0
- package/dist/runtime/agent-turn-loop.js +71 -0
- package/dist/runtime/agent-turn-loop.js.map +1 -0
- package/dist/runtime/guard-policy.d.ts +21 -0
- package/dist/runtime/guard-policy.js +93 -0
- package/dist/runtime/guard-policy.js.map +1 -0
- package/dist/runtime/history-committer.d.ts +34 -0
- package/dist/runtime/history-committer.js +77 -0
- package/dist/runtime/history-committer.js.map +1 -0
- package/dist/runtime/human-intent-router.d.ts +5 -0
- package/dist/runtime/human-intent-router.js +38 -0
- package/dist/runtime/human-intent-router.js.map +1 -0
- package/dist/runtime/model-runtime.d.ts +33 -0
- package/dist/runtime/model-runtime.js +70 -0
- package/dist/runtime/model-runtime.js.map +1 -0
- package/dist/runtime/queue-bridge.d.ts +11 -0
- package/dist/runtime/queue-bridge.js +2 -0
- package/dist/runtime/queue-bridge.js.map +1 -0
- package/dist/runtime/queue-dispatcher.d.ts +45 -0
- package/dist/runtime/queue-dispatcher.js +120 -0
- package/dist/runtime/queue-dispatcher.js.map +1 -0
- package/dist/runtime/runtime-events.d.ts +26 -0
- package/dist/runtime/runtime-events.js +21 -0
- package/dist/runtime/runtime-events.js.map +1 -0
- package/dist/runtime/session-action-protocol.d.ts +10 -0
- package/dist/runtime/session-action-protocol.js +64 -0
- package/dist/runtime/session-action-protocol.js.map +1 -0
- package/dist/runtime/session-action.d.ts +42 -0
- package/dist/runtime/session-action.js +3 -0
- package/dist/runtime/session-action.js.map +1 -0
- package/dist/runtime/task-lifecycle.d.ts +73 -0
- package/dist/runtime/task-lifecycle.js +267 -0
- package/dist/runtime/task-lifecycle.js.map +1 -0
- package/dist/runtime/tool-runtime.d.ts +33 -0
- package/dist/runtime/tool-runtime.js +89 -0
- package/dist/runtime/tool-runtime.js.map +1 -0
- package/dist/runtime/user-intent.d.ts +48 -0
- package/dist/runtime/user-intent.js +17 -0
- package/dist/runtime/user-intent.js.map +1 -0
- package/dist/session.d.ts +19 -9
- package/dist/session.js +119 -169
- package/dist/session.js.map +1 -1
- package/dist/terminal/editor.d.ts +16 -5
- package/dist/terminal/editor.js +99 -4
- package/dist/terminal/editor.js.map +1 -1
- package/dist/terminal/input.d.ts +2 -0
- package/dist/terminal/input.js +32 -7
- package/dist/terminal/input.js.map +1 -1
- package/dist/terminal/ui.d.ts +34 -21
- package/dist/terminal/ui.js +417 -252
- package/dist/terminal/ui.js.map +1 -1
- package/dist/tools.d.ts +7 -0
- package/dist/tools.js.map +1 -1
- package/dist/tui/components.d.ts +5 -0
- package/dist/tui/components.js +12 -0
- package/dist/tui/components.js.map +1 -0
- package/dist/tui/focus-manager.d.ts +7 -0
- package/dist/tui/focus-manager.js +13 -0
- package/dist/tui/focus-manager.js.map +1 -0
- package/dist/tui/overlay-manager.d.ts +12 -0
- package/dist/tui/overlay-manager.js +27 -0
- package/dist/tui/overlay-manager.js.map +1 -0
- package/dist/ui/display-actions.d.ts +23 -0
- package/dist/ui/display-actions.js +15 -0
- package/dist/ui/display-actions.js.map +1 -0
- package/dist/ui/display-policy.d.ts +38 -0
- package/dist/ui/display-policy.js +97 -0
- package/dist/ui/display-policy.js.map +1 -0
- package/dist/ui/frame-builder.d.ts +39 -0
- package/dist/ui/frame-builder.js +111 -0
- package/dist/ui/frame-builder.js.map +1 -0
- package/dist/ui/transcript-store.d.ts +35 -0
- package/dist/ui/transcript-store.js +172 -0
- package/dist/ui/transcript-store.js.map +1 -0
- package/dist/ui-state.js +6 -6
- package/dist/ui-state.js.map +1 -1
- package/dist/web.js +14 -1
- package/dist/web.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -90,10 +90,9 @@ laohuang
|
|
|
90
90
|
输入任务,使用 `/help` 查看命令,使用 `/exit` 或 `Ctrl+D` 退出。通过 `/model`
|
|
91
91
|
切换供应商或模型时会保留当前对话上下文。
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
编辑和当前会话输入历史:
|
|
93
|
+
当前交互终端使用简洁的上下边框标识输入区域。输入 `/` 会立即显示命令、说明和参数
|
|
94
|
+
补全;`Tab`/`Enter` 可接受当前补全,`/model` 会按“供应商 → 模型”分层补全。
|
|
95
|
+
终端还支持多行编辑和当前会话输入历史:
|
|
97
96
|
|
|
98
97
|
- `Enter`:发送任务。
|
|
99
98
|
- `Alt+Enter`:插入换行。
|
|
@@ -107,6 +106,12 @@ laohuang
|
|
|
107
106
|
通过 Web 日志面板查看。输出被重定向或由程序调用 CLI 时,会自动回退到稳定的纯文本
|
|
108
107
|
格式。
|
|
109
108
|
|
|
109
|
+
### TUI 设计方向
|
|
110
|
+
|
|
111
|
+
后续 TUI 会继续增强为完整 Agent 控制台:固定外框、`laoHuang` 标题栏、欢迎语、
|
|
112
|
+
状态栏、工具输出折叠、可配置快捷键、模型选择器,以及更清晰的事件回流与渲染边界。
|
|
113
|
+
未实现功能不会出现在当前快捷键说明中。
|
|
114
|
+
|
|
110
115
|
### 验证交互终端
|
|
111
116
|
|
|
112
117
|
1. 在真实 TTY 中运行 `laohuang`。
|
|
@@ -145,8 +150,7 @@ npm test
|
|
|
145
150
|
Bash。但 `bash` **没有操作系统级沙箱**,执行后仍能访问项目外文件、网络和其他
|
|
146
151
|
系统资源。公开使用前请阅读 [安全模型](docs/security.md)。
|
|
147
152
|
|
|
148
|
-
架构说明见 [docs/architecture.md](docs/architecture.md)
|
|
149
|
-
[docs/superpowers/specs/](docs/superpowers/specs/)。
|
|
153
|
+
架构说明见 [docs/architecture.md](docs/architecture.md)。
|
|
150
154
|
|
|
151
155
|
## License
|
|
152
156
|
|
package/dist/agent.d.ts
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
import { CancelToken } from "./cancellation.ts";
|
|
15
15
|
import { EventKind, EventSource, type EventBus } from "./events.ts";
|
|
16
16
|
import { type ChatClientLike } from "./model-adapter.ts";
|
|
17
|
-
import type {
|
|
17
|
+
import type { ToolExecutionContextLike, ToolExecutionMode, ToolRegistryLike, ToolResult } from "./tools.ts";
|
|
18
18
|
import { ProjectInstructionState } from "./project-instructions.ts";
|
|
19
|
-
|
|
19
|
+
import { FORCED_FINAL_PROMPT, type AgentStepRunnerContext } from "./runtime/agent-step-runner.ts";
|
|
20
|
+
export { FORCED_FINAL_PROMPT };
|
|
20
21
|
/** Raised when the model response cannot drive the agent loop. */
|
|
21
22
|
export declare class AgentError extends Error {
|
|
22
23
|
constructor(message: string, options?: {
|
|
@@ -33,12 +34,7 @@ export type AgentEventCallback = (eventType: string, payload: Record<string, unk
|
|
|
33
34
|
export type ToolEventCallback = (name: string, args: Record<string, unknown>, result: ToolResult) => void;
|
|
34
35
|
export type { ChatClientLike } from "./model-adapter.ts";
|
|
35
36
|
/** Structural minimum of ToolRegistry (tools.ts) the agent relies on. */
|
|
36
|
-
export
|
|
37
|
-
readonly definitions: readonly ToolDefinition[];
|
|
38
|
-
readonly orderedSpecs: readonly ToolSpec[];
|
|
39
|
-
executionMode(name: string): ToolExecutionMode | undefined;
|
|
40
|
-
execute(name: string, args: Record<string, unknown>, context?: ToolExecutionContextLike): Promise<ToolResult> | ToolResult;
|
|
41
|
-
}
|
|
37
|
+
export type AgentToolRegistry = ToolRegistryLike;
|
|
42
38
|
/** Pending user input handed over at a session safe point. */
|
|
43
39
|
export interface PendingInputBatchLike {
|
|
44
40
|
content?: string | undefined;
|
|
@@ -55,23 +51,12 @@ export interface AgentEventPublishOptions {
|
|
|
55
51
|
* Every member is optional; without a context the agent runs standalone and
|
|
56
52
|
* manages its own history commits and cancellation checks.
|
|
57
53
|
*/
|
|
58
|
-
export interface AgentContext {
|
|
54
|
+
export interface AgentContext extends AgentStepRunnerContext {
|
|
59
55
|
readonly sessionId?: string | null;
|
|
60
56
|
readonly taskId?: string | null;
|
|
61
57
|
readonly cancelToken?: CancelToken | null;
|
|
62
58
|
readonly eventBus?: EventBus | null;
|
|
63
59
|
publish?(kind: EventKind, options: AgentEventPublishOptions): unknown;
|
|
64
|
-
/** Return false to cancel before the model request is sent. */
|
|
65
|
-
modelStarted?(): boolean | void;
|
|
66
|
-
/** Called once the SDK acknowledged the streaming request. */
|
|
67
|
-
modelRequestOpened?(): boolean | void;
|
|
68
|
-
toolsStarted?(): void;
|
|
69
|
-
safePoint?(): PendingInputBatchLike | null | undefined;
|
|
70
|
-
/** Atomically commit the user message; rollback undoes a failed commit. */
|
|
71
|
-
commitInput?(append: () => void, rollback: () => void): boolean;
|
|
72
|
-
commitPending?(batch: PendingInputBatchLike, append: () => void, rollback: () => void): boolean;
|
|
73
|
-
/** Atomically reject history commits once cancellation has won. */
|
|
74
|
-
commitIfActive?(callback: () => void): boolean;
|
|
75
60
|
}
|
|
76
61
|
export interface RunOptions {
|
|
77
62
|
cancelToken?: CancelToken | null;
|
|
@@ -110,6 +95,8 @@ export declare class CodingAgent {
|
|
|
110
95
|
provider: string | null;
|
|
111
96
|
/** Provider-neutral model access; resolved from `provider`. */
|
|
112
97
|
private adapter;
|
|
98
|
+
private modelRuntime;
|
|
99
|
+
private readonly toolRuntime;
|
|
113
100
|
readonly tools: AgentToolRegistry;
|
|
114
101
|
readonly maxTotalTokens: number;
|
|
115
102
|
readonly maxElapsedSeconds: number;
|
|
@@ -137,12 +124,6 @@ export declare class CodingAgent {
|
|
|
137
124
|
}): void;
|
|
138
125
|
/** Run one user turn, committing only fully validated model attempts. */
|
|
139
126
|
run(userInput: string, context?: AgentContext | null, options?: RunOptions): Promise<string>;
|
|
140
|
-
private budgetGuardReason;
|
|
141
|
-
private guardPayload;
|
|
142
|
-
private recordRepeatedToolCalls;
|
|
143
|
-
private executeToolBatch;
|
|
144
|
-
private executeTool;
|
|
145
|
-
private finishToolEvent;
|
|
146
127
|
/**
|
|
147
128
|
* Append the rendered baseline project instructions once per session,
|
|
148
129
|
* right after the first direct user message and before the first model
|
|
@@ -159,7 +140,6 @@ export declare class CodingAgent {
|
|
|
159
140
|
* instruction loading is not configured.
|
|
160
141
|
*/
|
|
161
142
|
private discoverForTouchedPaths;
|
|
162
|
-
private commitContextMessage;
|
|
163
143
|
private emit;
|
|
164
144
|
private emitLegacy;
|
|
165
145
|
private publishRuntimeEvent;
|