abstractcode 0.1.0__tar.gz → 0.3.0__tar.gz
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.
- abstractcode-0.3.0/PKG-INFO +270 -0
- abstractcode-0.3.0/README.md +231 -0
- abstractcode-0.3.0/abstractcode/__init__.py +23 -0
- abstractcode-0.3.0/abstractcode/cli.py +401 -0
- abstractcode-0.3.0/abstractcode/flow_cli.py +1413 -0
- abstractcode-0.3.0/abstractcode/fullscreen_ui.py +1453 -0
- abstractcode-0.3.0/abstractcode/input_handler.py +81 -0
- abstractcode-0.3.0/abstractcode/py.typed +1 -0
- abstractcode-0.3.0/abstractcode/react_shell.py +6440 -0
- abstractcode-0.3.0/abstractcode/recall.py +384 -0
- abstractcode-0.3.0/abstractcode/remember.py +184 -0
- abstractcode-0.3.0/abstractcode/terminal_markdown.py +168 -0
- abstractcode-0.3.0/abstractcode/workflow_agent.py +894 -0
- abstractcode-0.3.0/abstractcode.egg-info/PKG-INFO +270 -0
- abstractcode-0.3.0/abstractcode.egg-info/SOURCES.txt +40 -0
- abstractcode-0.3.0/abstractcode.egg-info/requires.txt +14 -0
- {abstractcode-0.1.0 → abstractcode-0.3.0}/pyproject.toml +15 -8
- abstractcode-0.3.0/tests/test_answer_markdown_newline_unescape.py +68 -0
- abstractcode-0.3.0/tests/test_async_run_controls_and_copy_button.py +262 -0
- abstractcode-0.3.0/tests/test_compact_integration_llm.py +209 -0
- abstractcode-0.3.0/tests/test_executor_command.py +123 -0
- abstractcode-0.3.0/tests/test_executor_real_logic.py +114 -0
- abstractcode-0.3.0/tests/test_file_tool_ui_no_cwd_injection.py +48 -0
- abstractcode-0.3.0/tests/test_flow_cli.py +173 -0
- abstractcode-0.3.0/tests/test_fullscreen_ui_spinner_shimmer.py +61 -0
- abstractcode-0.3.0/tests/test_history_copy_full_to_clipboard.py +125 -0
- abstractcode-0.3.0/tests/test_log_provider_no_tool_defs.py +131 -0
- abstractcode-0.3.0/tests/test_log_provider_tool_calls_anthropic.py +100 -0
- abstractcode-0.3.0/tests/test_mcp_activity_spinner.py +90 -0
- abstractcode-0.3.0/tests/test_provenance_recall.py +53 -0
- abstractcode-0.3.0/tests/test_recall_command.py +186 -0
- abstractcode-0.3.0/tests/test_remember_command.py +80 -0
- abstractcode-0.3.0/tests/test_remote_mcp_tool_execution.py +179 -0
- abstractcode-0.3.0/tests/test_remote_mcp_tool_execution_stdio.py +186 -0
- abstractcode-0.3.0/tests/test_repeat_guardrail_write_file_content.py +93 -0
- abstractcode-0.3.0/tests/test_tools_examples_toggle.py +132 -0
- abstractcode-0.3.0/tests/test_workflow_agent.py +992 -0
- abstractcode-0.1.0/PKG-INFO +0 -114
- abstractcode-0.1.0/README.md +0 -80
- abstractcode-0.1.0/abstractcode/__init__.py +0 -54
- abstractcode-0.1.0/abstractcode.egg-info/PKG-INFO +0 -114
- abstractcode-0.1.0/abstractcode.egg-info/SOURCES.txt +0 -10
- abstractcode-0.1.0/abstractcode.egg-info/requires.txt +0 -6
- {abstractcode-0.1.0 → abstractcode-0.3.0}/LICENSE +0 -0
- {abstractcode-0.1.0 → abstractcode-0.3.0}/abstractcode.egg-info/dependency_links.txt +0 -0
- {abstractcode-0.1.0 → abstractcode-0.3.0}/abstractcode.egg-info/entry_points.txt +0 -0
- {abstractcode-0.1.0 → abstractcode-0.3.0}/abstractcode.egg-info/top_level.txt +0 -0
- {abstractcode-0.1.0 → abstractcode-0.3.0}/setup.cfg +0 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: abstractcode
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A clean terminal CLI for multi-agent agentic coding
|
|
5
|
+
Author-email: Laurent-Philippe Albou <contact@abstractcore.ai>
|
|
6
|
+
Maintainer-email: Laurent-Philippe Albou <contact@abstractcore.ai>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://abstractcore.ai
|
|
9
|
+
Project-URL: Documentation, https://abstractcore.ai
|
|
10
|
+
Project-URL: Repository, https://github.com/lpalbou/abstractcode
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/lpalbou/abstractcode/issues
|
|
12
|
+
Keywords: ai,llm,cli,coding,agent,multi-agent,agentic,terminal,abstractcore,abstractruntime,abstractagent
|
|
13
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: abstractagent>=0.2.0
|
|
27
|
+
Requires-Dist: abstractruntime>=0.2.0
|
|
28
|
+
Requires-Dist: abstractcore[tools]>=2.6.8
|
|
29
|
+
Requires-Dist: ddgs<10.0.0,>=9.10.0
|
|
30
|
+
Requires-Dist: prompt_toolkit>=3.0.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
36
|
+
Provides-Extra: flow
|
|
37
|
+
Requires-Dist: abstractflow>=0.1.0; extra == "flow"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# AbstractCode
|
|
41
|
+
|
|
42
|
+
Terminal TUI for the AbstractFramework:
|
|
43
|
+
- run **agents** (ReAct / CodeAct)
|
|
44
|
+
- run **workflows** authored in AbstractFlow (VisualFlow JSON)
|
|
45
|
+
- keep everything **durable** via AbstractRuntime (runs, ledger, artifacts)
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install abstractcode
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To run AbstractFlow workflows from AbstractCode:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install "abstractcode[flow]"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Start the TUI (Agents)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
abstractcode --provider lmstudio --model qwen/qwen3-next-80b
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Interaction model:
|
|
66
|
+
- commands are slash-prefixed (`/help`)
|
|
67
|
+
- any non-command line starts a task (same as `/task ...`)
|
|
68
|
+
|
|
69
|
+
### Useful commands
|
|
70
|
+
- `/status` (run status)
|
|
71
|
+
- `/auto-accept on|off` (tool approvals)
|
|
72
|
+
- `/max-tokens N` (or `-1` auto-detect)
|
|
73
|
+
- `/compact [light|standard|heavy] [--preserve N] [focus...]` (durable compaction)
|
|
74
|
+
- `/spans`, `/expand <span> [--show] [--into-context]` (provenance recall)
|
|
75
|
+
- `/recall [--since ISO] [--until ISO] [--tag k=v] [--q text] [--into-context]`
|
|
76
|
+
- `/snapshot save|load|list`
|
|
77
|
+
|
|
78
|
+
### Persistence
|
|
79
|
+
By default, AbstractCode uses `~/.abstractcode/state.json` and stores the durable data in `~/.abstractcode/state.d/`.
|
|
80
|
+
- disable persistence: `abstractcode --no-state`
|
|
81
|
+
- override path: `ABSTRACTCODE_STATE_FILE=... abstractcode`
|
|
82
|
+
|
|
83
|
+
## Workflow Agents (VisualFlow as `--agent`)
|
|
84
|
+
|
|
85
|
+
AbstractCode can run an AbstractFlow VisualFlow workflow *as an agent* (instead of using the built-in `react|codeact|memact` agents).
|
|
86
|
+
|
|
87
|
+
### Requirements (`abstractcode.agent.v1`)
|
|
88
|
+
- The workflow JSON must declare: `interfaces: ["abstractcode.agent.v1"]`
|
|
89
|
+
- The workflow must expose these pins:
|
|
90
|
+
- `On Flow Start`: output pins:
|
|
91
|
+
- `request` (type `string`)
|
|
92
|
+
- `provider` (type `provider`)
|
|
93
|
+
- `model` (type `model`)
|
|
94
|
+
- `tools` (type `tools`)
|
|
95
|
+
- `On Flow End`: input pin `response` (type `string`)
|
|
96
|
+
|
|
97
|
+
Recommended (optional) pins:
|
|
98
|
+
- `On Flow Start`: `context` (object), `max_iterations` (number)
|
|
99
|
+
- `On Flow End`: `meta` (object), `scratchpad` (object), `raw_result` (object)
|
|
100
|
+
|
|
101
|
+
### Authoring in the AbstractFlow visual editor
|
|
102
|
+
- **Mark the interface**: click `📂 Load` → select the workflow → in the right preview panel find **Interfaces** → click the ✏️ icon → enable **AbstractCode Agent (v1)** → **Save Interfaces**
|
|
103
|
+
- **Pins are scaffolded automatically**: when the interface is enabled, AbstractFlow will ensure `On Flow Start` and `On Flow End` have the required pins. You can still add/remove optional pins as needed.
|
|
104
|
+
|
|
105
|
+
Tip: an example workflow is shipped at `abstractflow/web/flows/acagent01.json` (implements the interface).
|
|
106
|
+
|
|
107
|
+
### What is `meta` and how do I use it?
|
|
108
|
+
`On Flow End.meta` is an **optional JSON object** for host-facing metadata (usage, trace ids, warnings, raw provider info, etc.).
|
|
109
|
+
|
|
110
|
+
It is intentionally **not strictly validated** today (the host treats it as opaque JSON). To make workflows portable and predictable across hosts, we recommend using a small “envelope” shape:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"schema": "abstractcode.agent.v1.meta",
|
|
115
|
+
"version": 1,
|
|
116
|
+
"provider": "lmstudio",
|
|
117
|
+
"model": "qwen/qwen3-next-80b",
|
|
118
|
+
"usage": { "input_tokens": 123, "output_tokens": 456 },
|
|
119
|
+
"trace": { "trace_id": "..." },
|
|
120
|
+
"warnings": ["..."],
|
|
121
|
+
"debug": {}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Hosts should treat unknown fields as allowed and ignore what they don’t understand (forward-compatible).
|
|
126
|
+
|
|
127
|
+
Typical ways to produce it inside a workflow:
|
|
128
|
+
- Wire `LLM Call.result` (object) → `On Flow End.meta`
|
|
129
|
+
- Wire `Agent.result` (object) → `On Flow End.meta`
|
|
130
|
+
- Or build your own object and wire it into `meta`
|
|
131
|
+
|
|
132
|
+
When present, AbstractCode attaches it to the assistant message metadata as `workflow_meta`.
|
|
133
|
+
|
|
134
|
+
### Workflow-driven status updates (footer / live UX)
|
|
135
|
+
Inside a workflow, you can update AbstractCode’s footer status text by emitting the reserved event:
|
|
136
|
+
- Add an **Emit Event** node
|
|
137
|
+
- Set **name** to `abstractcode.status`
|
|
138
|
+
- Set **payload** to:
|
|
139
|
+
- a string (e.g. `"Enrich Query..."`), or
|
|
140
|
+
- an object like `{ "text": "Enrich Query...", "duration": -1 }`
|
|
141
|
+
|
|
142
|
+
`duration` is seconds:
|
|
143
|
+
- default: `-1` (sticky)
|
|
144
|
+
- if `> 0`: auto-clears after the timeout unless superseded by a newer status
|
|
145
|
+
|
|
146
|
+
Example workflow: `abstractflow/web/flows/acagent_status_demo.json` (3 status updates, each separated by a 2s Delay).
|
|
147
|
+
|
|
148
|
+
### Workflow-driven UI events (messages + tool UX)
|
|
149
|
+
Workflows can also emit additional reserved events for host UX:
|
|
150
|
+
- `abstractcode.message`: show a message/notification (payload is a string or `{text, level?, title?}`)
|
|
151
|
+
- `abstractcode.tool_execution`: render a tool-call block (payload is a tool call object or a list)
|
|
152
|
+
- recommended shape: `{name, arguments, call_id?}`
|
|
153
|
+
- `abstractcode.tool_result`: render a tool-result block (payload is a tool result object or a list)
|
|
154
|
+
- recommended shape: `{name, call_id?, success?, output?, error?}`
|
|
155
|
+
|
|
156
|
+
Full contract (recommended for integrators): `docs/ui_events.md`
|
|
157
|
+
|
|
158
|
+
Example workflows:
|
|
159
|
+
- `abstractflow/web/flows/acagent_message_demo.json`
|
|
160
|
+
- `abstractflow/web/flows/acagent_tool_events_demo.json`
|
|
161
|
+
|
|
162
|
+
### Durable ask+wait (prompt the user and resume)
|
|
163
|
+
For workflows that need human input, you can:
|
|
164
|
+
- use the **Ask User** node (WAIT_USER), or
|
|
165
|
+
- use **Wait Event** with a `prompt` field (WAIT_EVENT), which is also durable and network-friendly.
|
|
166
|
+
|
|
167
|
+
Example workflow: `abstractflow/web/flows/acagent_ask_demo.json`
|
|
168
|
+
|
|
169
|
+
### Run
|
|
170
|
+
Use `--agent` with a workflow id/name (from the flows directory) or a direct JSON path:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
abstractcode --agent acagent01
|
|
174
|
+
abstractcode --agent abstractflow/web/flows/acagent01.json
|
|
175
|
+
|
|
176
|
+
# If your flows are stored elsewhere:
|
|
177
|
+
ABSTRACTFLOW_FLOWS_DIR=/path/to/flows abstractcode --agent my_flow_id
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Run Workflows (AbstractFlow VisualFlow)
|
|
181
|
+
|
|
182
|
+
### From the CLI
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
abstractcode flow run <flow_id_or_path> [inputs...]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Inputs can be passed as flags (no JSON typing required):
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
abstractcode flow run abstractflow/web/flows/4e2f2329.json --query "who are you?"
|
|
192
|
+
|
|
193
|
+
abstractcode flow run abstractflow/web/flows/b3a9d7c1.json \
|
|
194
|
+
--query "who are you?" \
|
|
195
|
+
--max_web_search 15 \
|
|
196
|
+
--max_fetch_url 50 \
|
|
197
|
+
--follow_up_questions true
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Other input options:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
abstractcode flow run deep-research-pro --input-json-file params.json
|
|
204
|
+
abstractcode flow run deep-research-pro --param max_web_search=15 --param follow_up_questions=true
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Tool approvals:
|
|
208
|
+
- approval-gated by default (type `a` once to approve all remaining calls for that run)
|
|
209
|
+
- auto-approve (unsafe): `--accept-tools` (alias `--auto-approve`)
|
|
210
|
+
|
|
211
|
+
Controls:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
abstractcode flow resume
|
|
215
|
+
abstractcode flow pause
|
|
216
|
+
abstractcode flow resume-run
|
|
217
|
+
abstractcode flow cancel
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Run discovery and event injection:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
abstractcode flow runs
|
|
224
|
+
abstractcode flow attach <run_id>
|
|
225
|
+
abstractcode flow emit --name my_event --scope session --payload-json '{"k":"v"}'
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Flow state:
|
|
229
|
+
- default: `~/.abstractcode/flow_state.json` (stores in `~/.abstractcode/flow_state.d/`)
|
|
230
|
+
- override with `ABSTRACTCODE_FLOW_STATE_FILE=...`
|
|
231
|
+
- flow discovery default dir: `ABSTRACTFLOW_FLOWS_DIR=...`
|
|
232
|
+
|
|
233
|
+
### From inside the TUI (keeps outputs in context)
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
/flow run deep-research-pro --query "..." --max_web_search 10 --follow_up_questions true
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`ANSWER_USER` outputs from the workflow are appended into the current conversation’s active context so you can continue the dialogue naturally.
|
|
240
|
+
|
|
241
|
+
## Development (Monorepo)
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
pip install -e ./abstractcore -e ./abstractruntime -e ./abstractagent -e ./abstractflow -e ./abstractcode
|
|
245
|
+
abstractcode --help
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Environment variables
|
|
249
|
+
- `ABSTRACTCODE_STATE_FILE`
|
|
250
|
+
- `ABSTRACTCODE_FLOW_STATE_FILE`
|
|
251
|
+
- `ABSTRACTFLOW_FLOWS_DIR`
|
|
252
|
+
|
|
253
|
+
## Default Tools
|
|
254
|
+
|
|
255
|
+
AbstractCode provides a curated set of 10 tools for coding tasks (ReAct agent):
|
|
256
|
+
|
|
257
|
+
| Tool | Description |
|
|
258
|
+
|------|-------------|
|
|
259
|
+
| `list_files` | Find and list files using glob patterns (case-insensitive) |
|
|
260
|
+
| `search_files` | Search for text patterns inside files using regex |
|
|
261
|
+
| `analyze_code` | Outline a Python/JS file (imports/classes/functions + line ranges) |
|
|
262
|
+
| `read_file` | Read file contents with optional line range |
|
|
263
|
+
| `write_file` | Write content to files, creating directories as needed |
|
|
264
|
+
| `edit_file` | Edit files by replacing text patterns (supports regex, line ranges, preview mode) |
|
|
265
|
+
| `execute_command` | Execute shell commands with security controls |
|
|
266
|
+
| `web_search` | Search the web via DuckDuckGo (no API key required) |
|
|
267
|
+
| `fetch_url` | Fetch a URL and return text/metadata (best-effort parsing) |
|
|
268
|
+
| `self_improve` | Log improvement suggestions for later review |
|
|
269
|
+
|
|
270
|
+
When running `--agent codeact`, AbstractCode exposes `execute_python` instead of the ReAct toolset.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# AbstractCode
|
|
2
|
+
|
|
3
|
+
Terminal TUI for the AbstractFramework:
|
|
4
|
+
- run **agents** (ReAct / CodeAct)
|
|
5
|
+
- run **workflows** authored in AbstractFlow (VisualFlow JSON)
|
|
6
|
+
- keep everything **durable** via AbstractRuntime (runs, ledger, artifacts)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install abstractcode
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
To run AbstractFlow workflows from AbstractCode:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install "abstractcode[flow]"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Start the TUI (Agents)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
abstractcode --provider lmstudio --model qwen/qwen3-next-80b
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Interaction model:
|
|
27
|
+
- commands are slash-prefixed (`/help`)
|
|
28
|
+
- any non-command line starts a task (same as `/task ...`)
|
|
29
|
+
|
|
30
|
+
### Useful commands
|
|
31
|
+
- `/status` (run status)
|
|
32
|
+
- `/auto-accept on|off` (tool approvals)
|
|
33
|
+
- `/max-tokens N` (or `-1` auto-detect)
|
|
34
|
+
- `/compact [light|standard|heavy] [--preserve N] [focus...]` (durable compaction)
|
|
35
|
+
- `/spans`, `/expand <span> [--show] [--into-context]` (provenance recall)
|
|
36
|
+
- `/recall [--since ISO] [--until ISO] [--tag k=v] [--q text] [--into-context]`
|
|
37
|
+
- `/snapshot save|load|list`
|
|
38
|
+
|
|
39
|
+
### Persistence
|
|
40
|
+
By default, AbstractCode uses `~/.abstractcode/state.json` and stores the durable data in `~/.abstractcode/state.d/`.
|
|
41
|
+
- disable persistence: `abstractcode --no-state`
|
|
42
|
+
- override path: `ABSTRACTCODE_STATE_FILE=... abstractcode`
|
|
43
|
+
|
|
44
|
+
## Workflow Agents (VisualFlow as `--agent`)
|
|
45
|
+
|
|
46
|
+
AbstractCode can run an AbstractFlow VisualFlow workflow *as an agent* (instead of using the built-in `react|codeact|memact` agents).
|
|
47
|
+
|
|
48
|
+
### Requirements (`abstractcode.agent.v1`)
|
|
49
|
+
- The workflow JSON must declare: `interfaces: ["abstractcode.agent.v1"]`
|
|
50
|
+
- The workflow must expose these pins:
|
|
51
|
+
- `On Flow Start`: output pins:
|
|
52
|
+
- `request` (type `string`)
|
|
53
|
+
- `provider` (type `provider`)
|
|
54
|
+
- `model` (type `model`)
|
|
55
|
+
- `tools` (type `tools`)
|
|
56
|
+
- `On Flow End`: input pin `response` (type `string`)
|
|
57
|
+
|
|
58
|
+
Recommended (optional) pins:
|
|
59
|
+
- `On Flow Start`: `context` (object), `max_iterations` (number)
|
|
60
|
+
- `On Flow End`: `meta` (object), `scratchpad` (object), `raw_result` (object)
|
|
61
|
+
|
|
62
|
+
### Authoring in the AbstractFlow visual editor
|
|
63
|
+
- **Mark the interface**: click `📂 Load` → select the workflow → in the right preview panel find **Interfaces** → click the ✏️ icon → enable **AbstractCode Agent (v1)** → **Save Interfaces**
|
|
64
|
+
- **Pins are scaffolded automatically**: when the interface is enabled, AbstractFlow will ensure `On Flow Start` and `On Flow End` have the required pins. You can still add/remove optional pins as needed.
|
|
65
|
+
|
|
66
|
+
Tip: an example workflow is shipped at `abstractflow/web/flows/acagent01.json` (implements the interface).
|
|
67
|
+
|
|
68
|
+
### What is `meta` and how do I use it?
|
|
69
|
+
`On Flow End.meta` is an **optional JSON object** for host-facing metadata (usage, trace ids, warnings, raw provider info, etc.).
|
|
70
|
+
|
|
71
|
+
It is intentionally **not strictly validated** today (the host treats it as opaque JSON). To make workflows portable and predictable across hosts, we recommend using a small “envelope” shape:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"schema": "abstractcode.agent.v1.meta",
|
|
76
|
+
"version": 1,
|
|
77
|
+
"provider": "lmstudio",
|
|
78
|
+
"model": "qwen/qwen3-next-80b",
|
|
79
|
+
"usage": { "input_tokens": 123, "output_tokens": 456 },
|
|
80
|
+
"trace": { "trace_id": "..." },
|
|
81
|
+
"warnings": ["..."],
|
|
82
|
+
"debug": {}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Hosts should treat unknown fields as allowed and ignore what they don’t understand (forward-compatible).
|
|
87
|
+
|
|
88
|
+
Typical ways to produce it inside a workflow:
|
|
89
|
+
- Wire `LLM Call.result` (object) → `On Flow End.meta`
|
|
90
|
+
- Wire `Agent.result` (object) → `On Flow End.meta`
|
|
91
|
+
- Or build your own object and wire it into `meta`
|
|
92
|
+
|
|
93
|
+
When present, AbstractCode attaches it to the assistant message metadata as `workflow_meta`.
|
|
94
|
+
|
|
95
|
+
### Workflow-driven status updates (footer / live UX)
|
|
96
|
+
Inside a workflow, you can update AbstractCode’s footer status text by emitting the reserved event:
|
|
97
|
+
- Add an **Emit Event** node
|
|
98
|
+
- Set **name** to `abstractcode.status`
|
|
99
|
+
- Set **payload** to:
|
|
100
|
+
- a string (e.g. `"Enrich Query..."`), or
|
|
101
|
+
- an object like `{ "text": "Enrich Query...", "duration": -1 }`
|
|
102
|
+
|
|
103
|
+
`duration` is seconds:
|
|
104
|
+
- default: `-1` (sticky)
|
|
105
|
+
- if `> 0`: auto-clears after the timeout unless superseded by a newer status
|
|
106
|
+
|
|
107
|
+
Example workflow: `abstractflow/web/flows/acagent_status_demo.json` (3 status updates, each separated by a 2s Delay).
|
|
108
|
+
|
|
109
|
+
### Workflow-driven UI events (messages + tool UX)
|
|
110
|
+
Workflows can also emit additional reserved events for host UX:
|
|
111
|
+
- `abstractcode.message`: show a message/notification (payload is a string or `{text, level?, title?}`)
|
|
112
|
+
- `abstractcode.tool_execution`: render a tool-call block (payload is a tool call object or a list)
|
|
113
|
+
- recommended shape: `{name, arguments, call_id?}`
|
|
114
|
+
- `abstractcode.tool_result`: render a tool-result block (payload is a tool result object or a list)
|
|
115
|
+
- recommended shape: `{name, call_id?, success?, output?, error?}`
|
|
116
|
+
|
|
117
|
+
Full contract (recommended for integrators): `docs/ui_events.md`
|
|
118
|
+
|
|
119
|
+
Example workflows:
|
|
120
|
+
- `abstractflow/web/flows/acagent_message_demo.json`
|
|
121
|
+
- `abstractflow/web/flows/acagent_tool_events_demo.json`
|
|
122
|
+
|
|
123
|
+
### Durable ask+wait (prompt the user and resume)
|
|
124
|
+
For workflows that need human input, you can:
|
|
125
|
+
- use the **Ask User** node (WAIT_USER), or
|
|
126
|
+
- use **Wait Event** with a `prompt` field (WAIT_EVENT), which is also durable and network-friendly.
|
|
127
|
+
|
|
128
|
+
Example workflow: `abstractflow/web/flows/acagent_ask_demo.json`
|
|
129
|
+
|
|
130
|
+
### Run
|
|
131
|
+
Use `--agent` with a workflow id/name (from the flows directory) or a direct JSON path:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
abstractcode --agent acagent01
|
|
135
|
+
abstractcode --agent abstractflow/web/flows/acagent01.json
|
|
136
|
+
|
|
137
|
+
# If your flows are stored elsewhere:
|
|
138
|
+
ABSTRACTFLOW_FLOWS_DIR=/path/to/flows abstractcode --agent my_flow_id
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Run Workflows (AbstractFlow VisualFlow)
|
|
142
|
+
|
|
143
|
+
### From the CLI
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
abstractcode flow run <flow_id_or_path> [inputs...]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Inputs can be passed as flags (no JSON typing required):
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
abstractcode flow run abstractflow/web/flows/4e2f2329.json --query "who are you?"
|
|
153
|
+
|
|
154
|
+
abstractcode flow run abstractflow/web/flows/b3a9d7c1.json \
|
|
155
|
+
--query "who are you?" \
|
|
156
|
+
--max_web_search 15 \
|
|
157
|
+
--max_fetch_url 50 \
|
|
158
|
+
--follow_up_questions true
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Other input options:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
abstractcode flow run deep-research-pro --input-json-file params.json
|
|
165
|
+
abstractcode flow run deep-research-pro --param max_web_search=15 --param follow_up_questions=true
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Tool approvals:
|
|
169
|
+
- approval-gated by default (type `a` once to approve all remaining calls for that run)
|
|
170
|
+
- auto-approve (unsafe): `--accept-tools` (alias `--auto-approve`)
|
|
171
|
+
|
|
172
|
+
Controls:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
abstractcode flow resume
|
|
176
|
+
abstractcode flow pause
|
|
177
|
+
abstractcode flow resume-run
|
|
178
|
+
abstractcode flow cancel
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Run discovery and event injection:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
abstractcode flow runs
|
|
185
|
+
abstractcode flow attach <run_id>
|
|
186
|
+
abstractcode flow emit --name my_event --scope session --payload-json '{"k":"v"}'
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Flow state:
|
|
190
|
+
- default: `~/.abstractcode/flow_state.json` (stores in `~/.abstractcode/flow_state.d/`)
|
|
191
|
+
- override with `ABSTRACTCODE_FLOW_STATE_FILE=...`
|
|
192
|
+
- flow discovery default dir: `ABSTRACTFLOW_FLOWS_DIR=...`
|
|
193
|
+
|
|
194
|
+
### From inside the TUI (keeps outputs in context)
|
|
195
|
+
|
|
196
|
+
```text
|
|
197
|
+
/flow run deep-research-pro --query "..." --max_web_search 10 --follow_up_questions true
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`ANSWER_USER` outputs from the workflow are appended into the current conversation’s active context so you can continue the dialogue naturally.
|
|
201
|
+
|
|
202
|
+
## Development (Monorepo)
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
pip install -e ./abstractcore -e ./abstractruntime -e ./abstractagent -e ./abstractflow -e ./abstractcode
|
|
206
|
+
abstractcode --help
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Environment variables
|
|
210
|
+
- `ABSTRACTCODE_STATE_FILE`
|
|
211
|
+
- `ABSTRACTCODE_FLOW_STATE_FILE`
|
|
212
|
+
- `ABSTRACTFLOW_FLOWS_DIR`
|
|
213
|
+
|
|
214
|
+
## Default Tools
|
|
215
|
+
|
|
216
|
+
AbstractCode provides a curated set of 10 tools for coding tasks (ReAct agent):
|
|
217
|
+
|
|
218
|
+
| Tool | Description |
|
|
219
|
+
|------|-------------|
|
|
220
|
+
| `list_files` | Find and list files using glob patterns (case-insensitive) |
|
|
221
|
+
| `search_files` | Search for text patterns inside files using regex |
|
|
222
|
+
| `analyze_code` | Outline a Python/JS file (imports/classes/functions + line ranges) |
|
|
223
|
+
| `read_file` | Read file contents with optional line range |
|
|
224
|
+
| `write_file` | Write content to files, creating directories as needed |
|
|
225
|
+
| `edit_file` | Edit files by replacing text patterns (supports regex, line ranges, preview mode) |
|
|
226
|
+
| `execute_command` | Execute shell commands with security controls |
|
|
227
|
+
| `web_search` | Search the web via DuckDuckGo (no API key required) |
|
|
228
|
+
| `fetch_url` | Fetch a URL and return text/metadata (best-effort parsing) |
|
|
229
|
+
| `self_improve` | Log improvement suggestions for later review |
|
|
230
|
+
|
|
231
|
+
When running `--agent codeact`, AbstractCode exposes `execute_python` instead of the ReAct toolset.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AbstractCode - A clean terminal CLI for multi-agent agentic coding
|
|
3
|
+
|
|
4
|
+
This package provides a terminal-based interface for AI-powered coding assistance
|
|
5
|
+
using multiple coordinated agents. Built on the Abstract Framework ecosystem.
|
|
6
|
+
|
|
7
|
+
Author: Laurent-Philippe Albou
|
|
8
|
+
Email: contact@abstractcore.ai
|
|
9
|
+
Website: https://abstractcore.ai
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
__version__ = "0.2.0"
|
|
13
|
+
__author__ = "Laurent-Philippe Albou"
|
|
14
|
+
__email__ = "contact@abstractcore.ai"
|
|
15
|
+
__license__ = "MIT"
|
|
16
|
+
|
|
17
|
+
def main(argv=None):
|
|
18
|
+
"""Console entrypoint for `abstractcode`."""
|
|
19
|
+
from .cli import main as _main
|
|
20
|
+
|
|
21
|
+
return _main(argv)
|
|
22
|
+
|
|
23
|
+
__all__ = ["__version__", "__author__", "__email__", "__license__", "main"]
|