@ddse/acm-aicoder 0.5.0 → 0.5.2
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/src/capability-map.d.ts +4 -0
- package/dist/src/capability-map.d.ts.map +1 -0
- package/dist/src/capability-map.js +289 -0
- package/dist/src/capability-map.js.map +1 -0
- package/dist/src/registries.d.ts +3 -0
- package/dist/src/registries.d.ts.map +1 -1
- package/dist/src/registries.js +11 -0
- package/dist/src/registries.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -7
- package/.aicoder/index.json +0 -304
- package/AICODER_IMPLEMENTATION_PLAN_PHASE2.md +0 -284
- package/bin/interactive.tsx +0 -232
- package/docs/AICODER.png +0 -0
- package/docs/INTERACTIVE_CLI_GUIDE.md +0 -201
- package/docs/TUI_MOCKUP.md +0 -180
- package/src/config/providers.ts +0 -174
- package/src/config/session.ts +0 -143
- package/src/context/bm25.ts +0 -173
- package/src/context/code-search.ts +0 -188
- package/src/context/context-pack.ts +0 -133
- package/src/context/dependency-mapper.ts +0 -72
- package/src/context/index.ts +0 -8
- package/src/context/symbol-extractor.ts +0 -149
- package/src/context/test-mapper.ts +0 -77
- package/src/context/types.ts +0 -69
- package/src/context/workspace-indexer.ts +0 -249
- package/src/index.ts +0 -5
- package/src/registries.ts +0 -118
- package/src/runtime/budget-manager.ts +0 -118
- package/src/runtime/interactive-runtime.ts +0 -423
- package/src/tasks-v2/analysis-tasks.ts +0 -311
- package/src/tasks-v2/developer-tasks.ts +0 -437
- package/src/tasks-v2/index.ts +0 -3
- package/src/tools-v2/edit-tools.ts +0 -153
- package/src/tools-v2/index.ts +0 -6
- package/src/tools-v2/read-tools.ts +0 -286
- package/src/tools-v2/search-tools.ts +0 -175
- package/src/tools-v2/test-tools.ts +0 -147
- package/src/tools-v2/workspace-context.ts +0 -428
- package/src/ui/App.tsx +0 -392
- package/src/ui/components/ChatPane.tsx +0 -84
- package/src/ui/components/EventsPane.tsx +0 -81
- package/src/ui/components/GoalsTasksPane.tsx +0 -149
- package/src/ui/store.ts +0 -362
- package/tests/integration.test.ts +0 -537
- package/tsconfig.json +0 -22
package/bin/interactive.tsx
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// ACM AI Coder - Phase 2 Interactive CLI
|
|
4
|
-
// Full-screen TUI with three-column layout
|
|
5
|
-
// Requires: --provider, --model, and --workspace (optional --base-url)
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { render } from 'ink';
|
|
9
|
-
import { ExternalContextProviderAdapter } from '@ddse/acm-sdk';
|
|
10
|
-
import { createOllamaClient, createVLLMClient } from '@ddse/acm-llm';
|
|
11
|
-
import { App } from '../src/ui/App.js';
|
|
12
|
-
import { AppStore } from '../src/ui/store.js';
|
|
13
|
-
import { InteractiveRuntime } from '../src/runtime/interactive-runtime.js';
|
|
14
|
-
import { parseCliArgs, validateAndNormalizeConfig } from '../src/config/session.js';
|
|
15
|
-
import {
|
|
16
|
-
SimpleCapabilityRegistry,
|
|
17
|
-
SimpleToolRegistry,
|
|
18
|
-
SimplePolicyEngine,
|
|
19
|
-
// V2 Tools
|
|
20
|
-
FileStatTool,
|
|
21
|
-
FileReadToolV2,
|
|
22
|
-
CodeSearchTool,
|
|
23
|
-
GrepTool,
|
|
24
|
-
DiffTool,
|
|
25
|
-
CodeEditToolV2,
|
|
26
|
-
RunTestsToolV2,
|
|
27
|
-
WorkspaceContextRetrievalTool,
|
|
28
|
-
type WorkspaceContextOperation,
|
|
29
|
-
BuildTool,
|
|
30
|
-
// V2 Tasks
|
|
31
|
-
AnalyzeWorkspaceTask,
|
|
32
|
-
CollectContextPackTask,
|
|
33
|
-
SearchCodeTask,
|
|
34
|
-
FindSymbolDefinitionTask,
|
|
35
|
-
ImplementFunctionTask,
|
|
36
|
-
RefactorRenameSymbolTask,
|
|
37
|
-
FixTypeErrorTask,
|
|
38
|
-
GenerateUnitTestsTask,
|
|
39
|
-
} from '../src/index.js';
|
|
40
|
-
|
|
41
|
-
function buildWorkspaceContextInput(
|
|
42
|
-
directive: string,
|
|
43
|
-
goalIntent?: string
|
|
44
|
-
): {
|
|
45
|
-
directive: string;
|
|
46
|
-
goal?: string;
|
|
47
|
-
operations: WorkspaceContextOperation[];
|
|
48
|
-
} {
|
|
49
|
-
const separatorIndex = directive.indexOf(':');
|
|
50
|
-
const payload = separatorIndex >= 0 ? directive.slice(separatorIndex + 1).trim() : '';
|
|
51
|
-
const operations: WorkspaceContextOperation[] = [];
|
|
52
|
-
|
|
53
|
-
if (payload.length > 0) {
|
|
54
|
-
if (payload.startsWith('{')) {
|
|
55
|
-
try {
|
|
56
|
-
const parsed = JSON.parse(payload);
|
|
57
|
-
if (Array.isArray(parsed.operations)) {
|
|
58
|
-
return {
|
|
59
|
-
directive,
|
|
60
|
-
goal: goalIntent,
|
|
61
|
-
operations: parsed.operations as WorkspaceContextOperation[],
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
if (typeof parsed.query === 'string' && parsed.query.length > 0) {
|
|
65
|
-
operations.push({ type: 'search', query: parsed.query, includeContext: true });
|
|
66
|
-
}
|
|
67
|
-
if (typeof parsed.pattern === 'string' && parsed.pattern.length > 0) {
|
|
68
|
-
operations.push({ type: 'grep', pattern: parsed.pattern, maxResults: 20 });
|
|
69
|
-
}
|
|
70
|
-
} catch {
|
|
71
|
-
// Fall through to textual parsing
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (operations.length === 0) {
|
|
76
|
-
operations.push({ type: 'search', query: payload, includeContext: true });
|
|
77
|
-
operations.push({ type: 'grep', pattern: payload, maxResults: 20 });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
directive,
|
|
83
|
-
goal: goalIntent,
|
|
84
|
-
operations,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async function main() {
|
|
89
|
-
try {
|
|
90
|
-
// Parse and validate CLI arguments
|
|
91
|
-
const args = parseCliArgs(process.argv.slice(2));
|
|
92
|
-
const config = validateAndNormalizeConfig(args);
|
|
93
|
-
|
|
94
|
-
// Ensure the process operates within the validated workspace
|
|
95
|
-
process.chdir(config.workspace);
|
|
96
|
-
|
|
97
|
-
// Create LLM client based on provider selection
|
|
98
|
-
const llm = config.provider === 'vllm'
|
|
99
|
-
? createVLLMClient(config.model, config.baseUrl)
|
|
100
|
-
: createOllamaClient(config.model, config.baseUrl);
|
|
101
|
-
|
|
102
|
-
// Setup registries
|
|
103
|
-
const toolRegistry = new SimpleToolRegistry();
|
|
104
|
-
const capabilityRegistry = new SimpleCapabilityRegistry();
|
|
105
|
-
const policyEngine = new SimplePolicyEngine();
|
|
106
|
-
const contextProvider = new ExternalContextProviderAdapter();
|
|
107
|
-
|
|
108
|
-
// Register tools
|
|
109
|
-
const fileStatTool = new FileStatTool(config.workspace);
|
|
110
|
-
const fileReadTool = new FileReadToolV2(config.workspace);
|
|
111
|
-
const codeSearchTool = new CodeSearchTool(config.workspace);
|
|
112
|
-
const grepTool = new GrepTool(config.workspace);
|
|
113
|
-
const diffTool = new DiffTool(config.workspace);
|
|
114
|
-
const codeEditTool = new CodeEditToolV2(config.workspace);
|
|
115
|
-
const runTestsTool = new RunTestsToolV2(config.workspace);
|
|
116
|
-
const buildTool = new BuildTool(config.workspace);
|
|
117
|
-
const workspaceContextTool = new WorkspaceContextRetrievalTool(config.workspace);
|
|
118
|
-
|
|
119
|
-
toolRegistry.register(fileStatTool);
|
|
120
|
-
toolRegistry.register(fileReadTool);
|
|
121
|
-
toolRegistry.register(codeSearchTool);
|
|
122
|
-
toolRegistry.register(grepTool);
|
|
123
|
-
toolRegistry.register(diffTool);
|
|
124
|
-
toolRegistry.register(codeEditTool);
|
|
125
|
-
toolRegistry.register(runTestsTool);
|
|
126
|
-
toolRegistry.register(buildTool);
|
|
127
|
-
toolRegistry.register(workspaceContextTool);
|
|
128
|
-
|
|
129
|
-
contextProvider.register(workspaceContextTool, {
|
|
130
|
-
match: directive =>
|
|
131
|
-
directive.startsWith('workspace.context') || directive.startsWith('workspace_context'),
|
|
132
|
-
buildInput: (directive, ctx) =>
|
|
133
|
-
buildWorkspaceContextInput(directive, ctx.runContext?.goal.intent),
|
|
134
|
-
describe:
|
|
135
|
-
'Retrieve relevant workspace snippets, grep matches, and metadata to satisfy context requests.',
|
|
136
|
-
autoPromote: true,
|
|
137
|
-
maxArtifacts: 32,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
// Register capabilities (tasks)
|
|
141
|
-
capabilityRegistry.register(
|
|
142
|
-
{ name: 'analyze_workspace', sideEffects: false },
|
|
143
|
-
new AnalyzeWorkspaceTask()
|
|
144
|
-
);
|
|
145
|
-
capabilityRegistry.register(
|
|
146
|
-
{ name: 'collect_context_pack', sideEffects: false },
|
|
147
|
-
new CollectContextPackTask()
|
|
148
|
-
);
|
|
149
|
-
capabilityRegistry.register(
|
|
150
|
-
{ name: 'search_code', sideEffects: false },
|
|
151
|
-
new SearchCodeTask()
|
|
152
|
-
);
|
|
153
|
-
capabilityRegistry.register(
|
|
154
|
-
{ name: 'find_symbol_definition', sideEffects: false },
|
|
155
|
-
new FindSymbolDefinitionTask()
|
|
156
|
-
);
|
|
157
|
-
capabilityRegistry.register(
|
|
158
|
-
{ name: 'implement_function', sideEffects: true },
|
|
159
|
-
new ImplementFunctionTask()
|
|
160
|
-
);
|
|
161
|
-
capabilityRegistry.register(
|
|
162
|
-
{ name: 'refactor_rename_symbol', sideEffects: true },
|
|
163
|
-
new RefactorRenameSymbolTask()
|
|
164
|
-
);
|
|
165
|
-
capabilityRegistry.register(
|
|
166
|
-
{ name: 'fix_type_error', sideEffects: true },
|
|
167
|
-
new FixTypeErrorTask()
|
|
168
|
-
);
|
|
169
|
-
capabilityRegistry.register(
|
|
170
|
-
{ name: 'generate_unit_tests', sideEffects: true },
|
|
171
|
-
new GenerateUnitTestsTask()
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
// Allow workspace operations
|
|
175
|
-
policyEngine.setAllowedPaths([config.workspace]);
|
|
176
|
-
|
|
177
|
-
// Create app store and runtime
|
|
178
|
-
const store = new AppStore();
|
|
179
|
-
const runtime = new InteractiveRuntime({
|
|
180
|
-
config,
|
|
181
|
-
llm,
|
|
182
|
-
capabilityRegistry,
|
|
183
|
-
toolRegistry,
|
|
184
|
-
policyEngine,
|
|
185
|
-
store,
|
|
186
|
-
contextProvider,
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
const initialBudget = runtime.getBudgetManager().getStatus();
|
|
190
|
-
|
|
191
|
-
// Welcome message
|
|
192
|
-
store.addMessage('system',
|
|
193
|
-
`Welcome to ACM AI Coder (Phase 2)\n\n` +
|
|
194
|
-
`Configuration:\n` +
|
|
195
|
-
` Provider: ${config.provider}\n` +
|
|
196
|
-
` Model: ${config.model}\n` +
|
|
197
|
-
(config.baseUrl ? ` Base URL: ${config.baseUrl}\n` : '') +
|
|
198
|
-
` Workspace: ${config.workspace}\n` +
|
|
199
|
-
(initialBudget.maxTokens !== undefined ? ` Token allowance: ${initialBudget.maxTokens}\n` : '') +
|
|
200
|
-
`\n` +
|
|
201
|
-
`Type your goal to start planning, or /help for commands.`
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
// Update initial budget status
|
|
205
|
-
store.updateBudgetStatus(initialBudget);
|
|
206
|
-
|
|
207
|
-
// Handle commands from UI
|
|
208
|
-
const handleCommand = async (command: string) => {
|
|
209
|
-
if (command.startsWith('/')) {
|
|
210
|
-
// Already handled by UI component
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Process as goal
|
|
215
|
-
await runtime.processGoal(command);
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
// Render TUI
|
|
219
|
-
render(<App store={store} onCommand={handleCommand} />);
|
|
220
|
-
|
|
221
|
-
} catch (error: any) {
|
|
222
|
-
console.error('Error starting ACM AI Coder:');
|
|
223
|
-
console.error(error.message);
|
|
224
|
-
console.error('\nFor help, run: acm-aicoder --help');
|
|
225
|
-
process.exit(1);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
main().catch(err => {
|
|
230
|
-
console.error('Fatal error:', err);
|
|
231
|
-
process.exit(1);
|
|
232
|
-
});
|
package/docs/AICODER.png
DELETED
|
Binary file
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
# ACM AI Coder - Phase 2 Interactive CLI Guide
|
|
2
|
-
|
|
3
|
-
## Architecture
|
|
4
|
-
|
|
5
|
-
The Phase 2 AI Coder is built entirely on ACM v0.5 framework primitives:
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
┌─────────────────────────────────────────────────────────┐
|
|
9
|
-
│ Full-Screen Terminal UI (Ink) │
|
|
10
|
-
├───────────────┬─────────────────────────┬───────────────┤
|
|
11
|
-
│ Chat Pane │ Goals/Tasks/Budget │ Event Stream │
|
|
12
|
-
│ (40% width) │ (30% width) │ (30% width) │
|
|
13
|
-
├───────────────┴─────────────────────────┴───────────────┤
|
|
14
|
-
│ Command Input │
|
|
15
|
-
└─────────────────────────────────────────────────────────┘
|
|
16
|
-
│
|
|
17
|
-
▼
|
|
18
|
-
┌─────────────────────────┐
|
|
19
|
-
│ InteractiveRuntime │
|
|
20
|
-
└─────────────────────────┘
|
|
21
|
-
│
|
|
22
|
-
┌──────────────────┼──────────────────┐
|
|
23
|
-
▼ ▼ ▼
|
|
24
|
-
┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
25
|
-
│ Planner │ │ Runtime │ │ Budget │
|
|
26
|
-
│ (LLM) │ │ (Tasks) │ │ Manager │
|
|
27
|
-
└──────────┘ └──────────┘ └──────────┘
|
|
28
|
-
│ │ │
|
|
29
|
-
└──────────────────┼──────────────────┘
|
|
30
|
-
▼
|
|
31
|
-
┌────────────┐
|
|
32
|
-
│ Ledger │
|
|
33
|
-
│ (Replay) │
|
|
34
|
-
└────────────┘
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Quick Start
|
|
38
|
-
|
|
39
|
-
### Start Interactive Mode
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
acm-aicoder \
|
|
43
|
-
--provider vllm \
|
|
44
|
-
--model Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8 \
|
|
45
|
-
--base-url http://localhost:8001/v1 \
|
|
46
|
-
--workspace /path/to/your/project
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Available Commands
|
|
50
|
-
|
|
51
|
-
| Command | Description |
|
|
52
|
-
|---------|-------------|
|
|
53
|
-
| `/exit`, `/quit` | Exit the application |
|
|
54
|
-
| `/help` | Show available commands |
|
|
55
|
-
| `/budget` | Display detailed budget information |
|
|
56
|
-
| `/context` | Show current context packet info |
|
|
57
|
-
| `/reset` | Reset session (clear goal, tasks) |
|
|
58
|
-
| `#path/to/file` | Reference workspace files in chat |
|
|
59
|
-
|
|
60
|
-
## Components
|
|
61
|
-
|
|
62
|
-
### Budget Governance
|
|
63
|
-
|
|
64
|
-
- Pre-inference cost checks using provider metadata
|
|
65
|
-
- Live spend tracking with warnings
|
|
66
|
-
- Hard limits with override prompts
|
|
67
|
-
- Token estimation: ~4 chars per token
|
|
68
|
-
|
|
69
|
-
### Streaming Reasoning
|
|
70
|
-
|
|
71
|
-
- Planner thoughts appear in Chat pane as they generate
|
|
72
|
-
- Nucleus inferences show reasoning process
|
|
73
|
-
- Real-time task status updates
|
|
74
|
-
|
|
75
|
-
### Memory Lifecycle
|
|
76
|
-
|
|
77
|
-
After each goal:
|
|
78
|
-
|
|
79
|
-
- Replay bundle saved to `.aicoder/replays/{timestamp}/`
|
|
80
|
-
- Budget reset for next goal
|
|
81
|
-
- Chat and events preserved
|
|
82
|
-
|
|
83
|
-
## Configuration
|
|
84
|
-
|
|
85
|
-
### Required Parameters
|
|
86
|
-
|
|
87
|
-
- `--provider` - LLM provider (`ollama` or `vllm`, default: `ollama`)
|
|
88
|
-
- `--model` - Model identifier published by the provider
|
|
89
|
-
- `--workspace` - Project root directory (must already exist)
|
|
90
|
-
|
|
91
|
-
- `--base-url` - Override provider endpoint
|
|
92
|
-
- `--temperature` - LLM temperature 0-2 (default: 0.7)
|
|
93
|
-
- `--seed` - Random seed for reproducibility
|
|
94
|
-
- `--plans` - Number of plans to generate, 1 or 2 (default: 1)
|
|
95
|
-
|
|
96
|
-
## Extending
|
|
97
|
-
|
|
98
|
-
### Add a New Task
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
export class MyTask extends Task<{ input: string }, { output: string }> {
|
|
102
|
-
constructor() {
|
|
103
|
-
super('my-task', 'my_capability');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async execute(ctx: RunContext, input: { input: string }) {
|
|
107
|
-
// Implementation
|
|
108
|
-
return { output: 'result' };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Register in `bin/interactive.tsx`:
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
capabilityRegistry.register(
|
|
117
|
-
{ name: 'my_capability', sideEffects: false },
|
|
118
|
-
new MyTask()
|
|
119
|
-
);
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Add a New Tool
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
export class MyTool extends Tool<{ input: string }, { result: string }> {
|
|
126
|
-
name() { return 'my_tool'; }
|
|
127
|
-
description() { return 'My custom tool'; }
|
|
128
|
-
|
|
129
|
-
async _call(args: { input: string }) {
|
|
130
|
-
return { result: 'processed' };
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Register in `bin/interactive.tsx`:
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
toolRegistry.register(new MyTool());
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Example Sessions
|
|
142
|
-
|
|
143
|
-
### Local vLLM (Qwen)
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
python -m vllm.entrypoints.openai.api_server \
|
|
147
|
-
--model Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8 \
|
|
148
|
-
--port 8001
|
|
149
|
-
|
|
150
|
-
acm-aicoder \
|
|
151
|
-
--provider vllm \
|
|
152
|
-
--model Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8 \
|
|
153
|
-
--base-url http://localhost:8001/v1 \
|
|
154
|
-
--workspace ~/project
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### OpenAI
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
export OPENAI_API_KEY="sk-..."
|
|
161
|
-
|
|
162
|
-
acm-aicoder \
|
|
163
|
-
--provider vllm \
|
|
164
|
-
--model gpt-4o \
|
|
165
|
-
--base-url https://api.openai.com \
|
|
166
|
-
--workspace ~/project
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Capabilities
|
|
170
|
-
|
|
171
|
-
### Analysis (No Side Effects)
|
|
172
|
-
|
|
173
|
-
- `analyze_workspace` - Deep codebase analysis
|
|
174
|
-
- `collect_context_pack` - Generate context for planning
|
|
175
|
-
- `search_code` - BM25-based code search
|
|
176
|
-
- `find_symbol_definition` - Locate symbols
|
|
177
|
-
|
|
178
|
-
### Development (Side Effects)
|
|
179
|
-
|
|
180
|
-
- `implement_function` - Create implementations
|
|
181
|
-
- `refactor_rename_symbol` - Rename with tracking
|
|
182
|
-
- `fix_type_error` - Fix TypeScript errors
|
|
183
|
-
- `generate_unit_tests` - Generate test scaffolding
|
|
184
|
-
|
|
185
|
-
## Troubleshooting
|
|
186
|
-
|
|
187
|
-
### Missing Parameters
|
|
188
|
-
|
|
189
|
-
Ensure all required flags are provided. Check error message for details.
|
|
190
|
-
|
|
191
|
-
### Budget Exceeded
|
|
192
|
-
|
|
193
|
-
- Use a model with a higher token allowance or adjust provider configuration
|
|
194
|
-
- Run locally: `--provider vllm --model Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8 --base-url http://localhost:8001/v1`
|
|
195
|
-
|
|
196
|
-
### Layout Issues
|
|
197
|
-
|
|
198
|
-
- Terminal must be ≥80 columns wide
|
|
199
|
-
- Use standard terminal emulators
|
|
200
|
-
|
|
201
|
-
For more details, see [AICODER_IMPLEMENTATION_PLAN_PHASE2.md](../AICODER_IMPLEMENTATION_PLAN_PHASE2.md)
|
package/docs/TUI_MOCKUP.md
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
# ACM AI Coder - Interactive TUI Mockup
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
╔═══════════════════════════════════════════════════════════════════════════════╗
|
|
5
|
-
║ ACM AI Coder - Interactive Mode ⟳ Processing║
|
|
6
|
-
╠═════════════════════════╤═════════════════════════════╤═════════════════════════╣
|
|
7
|
-
║ │ │ ║
|
|
8
|
-
║ ┌─────────────────┐ │ ┌─────────────────────┐ │ ┌─────────────────┐ ║
|
|
9
|
-
║ │ Chat │ │ │ Goal/Tasks/Progress │ │ │ Event Stream │ ║
|
|
10
|
-
║ └─────────────────┘ │ └─────────────────────┘ │ └─────────────────┘ ║
|
|
11
|
-
║ │ │ ║
|
|
12
|
-
║ System: │ Goal: │ [14:23:45] GOAL_ ║
|
|
13
|
-
║ Welcome to ACM AI │ Analyze src/index.ts │ CREATED: goal-123 ║
|
|
14
|
-
║ Coder (Phase 2) │ and find bugs │ ║
|
|
15
|
-
║ │ │ [14:23:46] BUDGET_ ║
|
|
16
|
-
║ Configuration: │ Tasks: │ CHECK: $0.0024 ║
|
|
17
|
-
║ Model: gpt-4o │ ○ analyze_workspace │ ║
|
|
18
|
-
║ Engine: langgraph │ ○ collect_context_pack │ [14:23:47] PLAN_ ║
|
|
19
|
-
║ Workspace: /project │ ○ search_code │ SELECTED: plan-456 ║
|
|
20
|
-
║ Budget: $10.00 │ │ ║
|
|
21
|
-
║ │ Budget: │ [14:23:48] TASK_ ║
|
|
22
|
-
║ Type your goal to │ Spent: $0.0024 / $10.00 │ START: task-0 ║
|
|
23
|
-
║ start planning. │ Used: 0.0% │ ║
|
|
24
|
-
║ │ Remaining: $9.9976 │ [14:23:49] CONTEXT_ ║
|
|
25
|
-
║ You: │ Calls: 1 │ INTERNALIZED: 3 files ║
|
|
26
|
-
║ Analyze src/index.ts │ │ ║
|
|
27
|
-
║ and find bugs │ │ [14:23:50] TASK_ ║
|
|
28
|
-
║ │ │ END: task-0 ║
|
|
29
|
-
║ Planner (streaming...):│ │ ║
|
|
30
|
-
║ I'll analyze the file │ │ [14:23:51] NUCLEUS_ ║
|
|
31
|
-
║ by first collecting │ │ INFERENCE: context ok ║
|
|
32
|
-
║ context from the │ │ ║
|
|
33
|
-
║ workspace, then... │ │ ║
|
|
34
|
-
║ │ │ ║
|
|
35
|
-
║ │ │ ║
|
|
36
|
-
║ │ │ ║
|
|
37
|
-
╠═════════════════════════╧═════════════════════════════╧═════════════════════════╣
|
|
38
|
-
║ > Type your goal or command (e.g., /help)... ║
|
|
39
|
-
╚═══════════════════════════════════════════════════════════════════════════════╝
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Layout Breakdown
|
|
43
|
-
|
|
44
|
-
### Left Column (40%) - Chat Pane
|
|
45
|
-
- **Purpose:** User messages, planner reasoning, nucleus thoughts, system messages
|
|
46
|
-
- **Colors:**
|
|
47
|
-
- User: white
|
|
48
|
-
- Planner: yellow (streaming indicator when active)
|
|
49
|
-
- Nucleus: magenta
|
|
50
|
-
- System: gray
|
|
51
|
-
- **Scrolling:** Shows most recent messages that fit in viewport
|
|
52
|
-
|
|
53
|
-
### Middle Column (30%) - Goals/Tasks/Progress
|
|
54
|
-
- **Goal Section:** Current goal intent
|
|
55
|
-
- **Tasks Section:** Live task list with status icons
|
|
56
|
-
- ○ pending (gray)
|
|
57
|
-
- ◐ running (yellow)
|
|
58
|
-
- ● succeeded (green)
|
|
59
|
-
- ✗ failed (red)
|
|
60
|
-
- ⟳ retrying (yellow)
|
|
61
|
-
- **Budget Section:** Real-time spend tracking
|
|
62
|
-
- Total spent vs. limit
|
|
63
|
-
- Percentage used (color-coded)
|
|
64
|
-
- Remaining budget
|
|
65
|
-
- API call count
|
|
66
|
-
|
|
67
|
-
### Right Column (30%) - Event Stream
|
|
68
|
-
- **Purpose:** Ledger entries, tool calls, context updates, policy decisions
|
|
69
|
-
- **Format:** [timestamp] TYPE: data
|
|
70
|
-
- **Colors:**
|
|
71
|
-
- PLAN_SELECTED, TASK_END: green
|
|
72
|
-
- TASK_START: blue
|
|
73
|
-
- ERROR: red
|
|
74
|
-
- POLICY_DECISION: yellow
|
|
75
|
-
- Others: gray
|
|
76
|
-
- **Pruning:** Keeps last 100 events
|
|
77
|
-
|
|
78
|
-
### Bottom - Command Input
|
|
79
|
-
- **Text input:** Accepts goals or commands
|
|
80
|
-
- **Commands:** /exit, /help, /budget, /context, /reset
|
|
81
|
-
- **File mentions:** #path/to/file syntax
|
|
82
|
-
- **Submit:** Press Enter to send
|
|
83
|
-
|
|
84
|
-
## Example Session Flow
|
|
85
|
-
|
|
86
|
-
### 1. Startup
|
|
87
|
-
```
|
|
88
|
-
> acm-aicoder --provider vllm --model gpt-4o --base-url https://api.openai.com \
|
|
89
|
-
--workspace /myproject
|
|
90
|
-
|
|
91
|
-
[TUI launches with welcome message]
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### 2. User Types Goal
|
|
95
|
-
```
|
|
96
|
-
> Find all TypeScript errors in src/ directory
|
|
97
|
-
[ENTER]
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### 3. Budget Check
|
|
101
|
-
```
|
|
102
|
-
Event Stream:
|
|
103
|
-
[14:25:01] BUDGET_CHECK: estimated $0.0035, 1200 tokens
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### 4. Planner Streams Reasoning
|
|
107
|
-
```
|
|
108
|
-
Chat Pane:
|
|
109
|
-
Planner (streaming...):
|
|
110
|
-
First, I'll analyze the TypeScript files in src/...
|
|
111
|
-
Then I'll run the type checker...
|
|
112
|
-
Finally, I'll categorize the errors...
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 5. Tasks Execute
|
|
116
|
-
```
|
|
117
|
-
Tasks Pane:
|
|
118
|
-
◐ analyze_workspace (running)
|
|
119
|
-
○ collect_context_pack
|
|
120
|
-
○ fix_type_error
|
|
121
|
-
|
|
122
|
-
Event Stream:
|
|
123
|
-
[14:25:02] TASK_START: task-0
|
|
124
|
-
[14:25:03] CONTEXT_INTERNALIZED: 15 files
|
|
125
|
-
[14:25:04] TASK_END: task-0
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### 6. Completion
|
|
129
|
-
```
|
|
130
|
-
System:
|
|
131
|
-
Goal completed successfully!
|
|
132
|
-
Replay bundle saved to: /myproject/.aicoder/replays/2025-01-04T14-25-05
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Interactive Commands
|
|
136
|
-
|
|
137
|
-
### /help
|
|
138
|
-
Shows available commands and usage examples.
|
|
139
|
-
|
|
140
|
-
### /budget
|
|
141
|
-
```
|
|
142
|
-
Budget Status:
|
|
143
|
-
Total Spent: $0.0124
|
|
144
|
-
Limit: $10.00
|
|
145
|
-
Remaining: $9.9876
|
|
146
|
-
Used: 0.1%
|
|
147
|
-
API Calls: 4
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### /context
|
|
151
|
-
```
|
|
152
|
-
Current Context:
|
|
153
|
-
ID: ctx-1735998305123
|
|
154
|
-
Facts: 3 entries
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### /reset
|
|
158
|
-
Clears current goal and tasks, resets budget, keeps chat history.
|
|
159
|
-
|
|
160
|
-
### /exit or /quit
|
|
161
|
-
Saves replay bundle and exits cleanly.
|
|
162
|
-
|
|
163
|
-
## Visual Styling
|
|
164
|
-
|
|
165
|
-
- **Borders:** Single-line for panes, double-line for header/footer
|
|
166
|
-
- **Colors:** ANSI terminal colors (cyan, yellow, green, red, blue, magenta)
|
|
167
|
-
- **Responsive:** Adjusts to terminal size (minimum 80 columns)
|
|
168
|
-
- **Updates:** Real-time re-renders on state changes
|
|
169
|
-
|
|
170
|
-
## Terminal Requirements
|
|
171
|
-
|
|
172
|
-
- **Minimum Width:** 80 columns
|
|
173
|
-
- **Minimum Height:** 24 rows
|
|
174
|
-
- **Terminal Type:** xterm-compatible (supports ANSI colors)
|
|
175
|
-
- **Not Recommended:** tmux/screen nested sessions (may cause layout issues)
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
This mockup represents the actual TUI layout implemented in Phase 2.
|
|
180
|
-
All components are functional and wired to the ACM framework.
|