@lazyingart/agintiflow 0.20.49 → 0.20.50
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 +15 -2
- package/docs/aaps.md +70 -0
- package/docs/student-committee-supervisor.md +104 -0
- package/package.json +4 -2
- package/references/aaps-agintiflow-integration-design.md +710 -0
- package/references/student-committee-supervisor-mode.md +331 -0
- package/scripts/smoke-aaps-adapter.js +67 -0
- package/skills/aaps/SKILL.md +23 -2
- package/src/aaps-adapter.js +742 -0
- package/src/agent-runner.js +216 -5
- package/src/cli.js +57 -1
- package/src/config.js +24 -7
- package/src/i18n.js +1 -0
- package/src/interactive-cli.js +73 -1
- package/src/scs-controller.js +471 -0
- package/src/task-profiles.js +2 -1
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
# AAPS And AgInTiFlow Integration Design
|
|
2
|
+
|
|
3
|
+
This note researches how AgInTiFlow should connect with AAPS and proposes a lightweight `/aaps` feature that can grow into a full large-project workflow harness.
|
|
4
|
+
|
|
5
|
+
Local sources inspected:
|
|
6
|
+
|
|
7
|
+
- `/home/lachlan/ProjectsLFS/AAPS/package.json`
|
|
8
|
+
- `/home/lachlan/ProjectsLFS/AAPS/README.md`
|
|
9
|
+
- `/home/lachlan/ProjectsLFS/AAPS/docs/design-philosophy.md`
|
|
10
|
+
- `/home/lachlan/ProjectsLFS/AAPS/docs/language-spec.md`
|
|
11
|
+
- `/home/lachlan/ProjectsLFS/AAPS/docs/compiler.md`
|
|
12
|
+
- `/home/lachlan/ProjectsLFS/AAPS/docs/runtime.md`
|
|
13
|
+
- `/home/lachlan/ProjectsLFS/AAPS/docs/project-management.md`
|
|
14
|
+
- `/home/lachlan/ProjectsLFS/AAPS/docs/codex-wrapper.md`
|
|
15
|
+
- `/home/lachlan/ProjectsLFS/AAPS/scripts/aaps.js`
|
|
16
|
+
- `/home/lachlan/ProjectsLFS/AAPS/scripts/aaps-runner.js`
|
|
17
|
+
- `/home/lachlan/ProjectsLFS/AAPS/scripts/aaps-compiler.js`
|
|
18
|
+
- `/home/lachlan/ProjectsLFS/AAPS/examples/*.aaps`
|
|
19
|
+
- `/home/lachlan/ProjectsLFS/AAPS/examples/projects/app-development/aaps.project.json`
|
|
20
|
+
- AgInTiFlow runtime, CLI, web, task profiles, skill library, session store, canvas/artifact tunnel, SCS mode, and wrapper architecture.
|
|
21
|
+
|
|
22
|
+
## Short Answer
|
|
23
|
+
|
|
24
|
+
Yes, AAPS can lift AgInTiFlow to the next level, but the integration should be deliberately thin at first.
|
|
25
|
+
|
|
26
|
+
Recommended principle:
|
|
27
|
+
|
|
28
|
+
> AAPS is the declarative large-workflow control plane. AgInTiFlow is the interactive agent runtime and tool-use backend.
|
|
29
|
+
|
|
30
|
+
Do not merge the projects or copy the AAPS parser into AgInTiFlow. Use the published `@lazyingart/aaps` package as an optional dependency discovered at runtime, then wrap it with a stable AgInTiFlow adapter.
|
|
31
|
+
|
|
32
|
+
The first useful feature should be:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
/aaps
|
|
36
|
+
/aaps status
|
|
37
|
+
/aaps init
|
|
38
|
+
/aaps parse|validate|compile|check|run
|
|
39
|
+
/aaps open
|
|
40
|
+
/aaps studio
|
|
41
|
+
/aaps install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Later:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
/aaps on
|
|
48
|
+
/aaps auto
|
|
49
|
+
/aaps off
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Those mode commands should not mean "turn AgInTi into AAPS." They should mean "when a task is large, ask AgInTi to express the work as AAPS blocks, compile/check it, and then execute or supervise the blocks."
|
|
53
|
+
|
|
54
|
+
## Current AAPS Shape
|
|
55
|
+
|
|
56
|
+
AAPS means Autonomous Agentic Pipeline Script. The current local package is `@lazyingart/aaps` and exposes the `aaps` CLI.
|
|
57
|
+
|
|
58
|
+
Important properties:
|
|
59
|
+
|
|
60
|
+
- It is CommonJS, Node >=18.
|
|
61
|
+
- It has a deterministic parser in `src/aaps.js`.
|
|
62
|
+
- It has a CLI front door in `scripts/aaps.js`.
|
|
63
|
+
- It has an agent-aware compiler in `scripts/aaps-compiler.js`.
|
|
64
|
+
- It has an executable runtime in `scripts/aaps-runner.js`.
|
|
65
|
+
- It has a Studio PWA and Python backend in `studio/` and `backend/`.
|
|
66
|
+
- It has schemas for chat/edit/project/response payloads.
|
|
67
|
+
- It already supports project manifests through `aaps.project.json`.
|
|
68
|
+
- It already has example workflows for app development, book writing, generic workflows, runtime demos, and organoid segmentation.
|
|
69
|
+
|
|
70
|
+
AAPS pipeline:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
.aaps
|
|
74
|
+
-> deterministic parser
|
|
75
|
+
-> unresolved IR
|
|
76
|
+
-> compiler
|
|
77
|
+
-> resolved IR
|
|
78
|
+
-> execution plan
|
|
79
|
+
-> readiness check
|
|
80
|
+
-> runtime actions
|
|
81
|
+
-> validation/recovery/report
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The useful design boundary is strict:
|
|
85
|
+
|
|
86
|
+
- Parse does not invent missing code.
|
|
87
|
+
- Compile can detect missing blocks/scripts/tools/agents/packages and optionally generate safe project-local assets.
|
|
88
|
+
- Run executes deterministic local actions and records prompt/model-only work as prompts/checkpoints unless an adapter exists.
|
|
89
|
+
- Every run writes durable JSON, JSONL, reports, readiness, logs, and artifacts.
|
|
90
|
+
|
|
91
|
+
## Current AgInTiFlow Shape
|
|
92
|
+
|
|
93
|
+
AgInTiFlow already owns the runtime pieces AAPS wants from a backend agent:
|
|
94
|
+
|
|
95
|
+
- Role-based model routing: route/main/spare/wrapper/auxiliary.
|
|
96
|
+
- CLI and local web UI over the same session store.
|
|
97
|
+
- Central session storage under `~/.agintiflow/sessions/<session-id>`.
|
|
98
|
+
- Project session pointers under `.aginti-sessions/`.
|
|
99
|
+
- Workspace file tools with path guardrails.
|
|
100
|
+
- Docker workspace and command policy.
|
|
101
|
+
- Host tmux tools for long-running jobs.
|
|
102
|
+
- Browser, web search, canvas/artifact tunnel, and generated file previews.
|
|
103
|
+
- Task profiles and Markdown skills, including an existing `aaps` profile/skill.
|
|
104
|
+
- Optional SCS mode for plan approval, progress monitoring, and finish gates.
|
|
105
|
+
- Wrapper tools for external coding assistants.
|
|
106
|
+
- Structured `events.jsonl` for every model/tool/session event.
|
|
107
|
+
|
|
108
|
+
AgInTiFlow current execution loop:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
goal
|
|
112
|
+
-> resolve runtime config and model route
|
|
113
|
+
-> create/resume session
|
|
114
|
+
-> plan
|
|
115
|
+
-> optional scouts/SCS
|
|
116
|
+
-> model tool loop
|
|
117
|
+
-> guarded tools
|
|
118
|
+
-> events/artifacts/chat
|
|
119
|
+
-> finish/resume
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This is complementary to AAPS. AAPS is better at declared workflow shape. AgInTiFlow is better at interactive environment-facing agent work.
|
|
123
|
+
|
|
124
|
+
## What AAPS Adds To AgInTiFlow
|
|
125
|
+
|
|
126
|
+
AAPS gives AgInTiFlow a better language for large tasks:
|
|
127
|
+
|
|
128
|
+
- Named workflows instead of transient chat plans.
|
|
129
|
+
- Reusable `skill`, `block`, `task`, `stage`, `action`, `guard`, `choose`, `if`, `else`, and `for_each` blocks.
|
|
130
|
+
- Typed inputs, outputs, artifacts, validations, requirements, agents, tools, and environment declarations.
|
|
131
|
+
- Readiness checks before side effects.
|
|
132
|
+
- Compile reports for missing scripts/tools/agents/packages.
|
|
133
|
+
- Project manifests for multi-file workflow libraries.
|
|
134
|
+
- A visual editor and graph-shaped mental model.
|
|
135
|
+
- Durable run/report folders independent of the chat transcript.
|
|
136
|
+
|
|
137
|
+
This solves a real weakness of ordinary agents: they make plans as prose, then the plan decays as execution gets messy. AAPS turns large-task plans into editable source.
|
|
138
|
+
|
|
139
|
+
## What AgInTiFlow Adds To AAPS
|
|
140
|
+
|
|
141
|
+
AgInTiFlow gives AAPS a stronger backend:
|
|
142
|
+
|
|
143
|
+
- Real browser/workspace/shell/canvas tooling.
|
|
144
|
+
- Better model-provider control, including DeepSeek/Venice/OpenAI/Qwen.
|
|
145
|
+
- Project-local API key onboarding.
|
|
146
|
+
- Docker workspace policy.
|
|
147
|
+
- tmux supervision.
|
|
148
|
+
- Session history and resumability.
|
|
149
|
+
- Web app workspace controls and artifact previews.
|
|
150
|
+
- SCS monitoring and finish gates.
|
|
151
|
+
- Skill Mesh and learned capability sharing later.
|
|
152
|
+
|
|
153
|
+
This solves a current AAPS limitation: AAPS can prepare prompts and run deterministic actions, but agent-assisted blocks currently depend on Codex wrapper or prompt files. AgInTiFlow can become a first-class AAPS agent adapter.
|
|
154
|
+
|
|
155
|
+
## Integration Options
|
|
156
|
+
|
|
157
|
+
### Option A: Shell Adapter To `aaps` CLI
|
|
158
|
+
|
|
159
|
+
AgInTiFlow discovers `aaps` on `PATH` or runs `npx -y @lazyingart/aaps`.
|
|
160
|
+
|
|
161
|
+
Pros:
|
|
162
|
+
|
|
163
|
+
- Minimal implementation.
|
|
164
|
+
- No dependency bloat in AgInTiFlow.
|
|
165
|
+
- Uses the actual published AAPS package.
|
|
166
|
+
- Easy to debug because commands are visible.
|
|
167
|
+
- Works with current AAPS immediately.
|
|
168
|
+
|
|
169
|
+
Cons:
|
|
170
|
+
|
|
171
|
+
- JSON parsing and error mapping must be careful.
|
|
172
|
+
- Version mismatch is possible.
|
|
173
|
+
- Shell command policy must explicitly allow safe AAPS commands.
|
|
174
|
+
- Web UI integration needs a wrapper API.
|
|
175
|
+
|
|
176
|
+
Verdict: best first step.
|
|
177
|
+
|
|
178
|
+
### Option B: Optional Dynamic Package Import
|
|
179
|
+
|
|
180
|
+
AgInTiFlow dynamically imports `@lazyingart/aaps` if installed.
|
|
181
|
+
|
|
182
|
+
Pros:
|
|
183
|
+
|
|
184
|
+
- Faster than spawning CLI.
|
|
185
|
+
- Cleaner API if AAPS exports parser/compiler functions.
|
|
186
|
+
- Easier web preview of IR.
|
|
187
|
+
|
|
188
|
+
Cons:
|
|
189
|
+
|
|
190
|
+
- AAPS is currently CommonJS and CLI-oriented.
|
|
191
|
+
- Compiler/runner are script-level, not stable library APIs.
|
|
192
|
+
- Pulls optional package complexity into AgInTiFlow.
|
|
193
|
+
|
|
194
|
+
Verdict: good later after AAPS exposes stable library exports.
|
|
195
|
+
|
|
196
|
+
### Option C: Vendored/Submodule Integration
|
|
197
|
+
|
|
198
|
+
AgInTiFlow vendors AAPS or uses the local sibling path.
|
|
199
|
+
|
|
200
|
+
Pros:
|
|
201
|
+
|
|
202
|
+
- Easy local development.
|
|
203
|
+
- Exact source is available.
|
|
204
|
+
|
|
205
|
+
Cons:
|
|
206
|
+
|
|
207
|
+
- Bad product boundary.
|
|
208
|
+
- Hard to maintain.
|
|
209
|
+
- Increases npm package size.
|
|
210
|
+
- Risks copying dirty local state.
|
|
211
|
+
|
|
212
|
+
Verdict: avoid for product runtime. Use only for local development references.
|
|
213
|
+
|
|
214
|
+
### Option D: AAPS Runtime Calls AgInTiFlow API
|
|
215
|
+
|
|
216
|
+
AAPS agent registry gets an `agintiflow` invocation that starts/resumes AgInTiFlow runs through API calls.
|
|
217
|
+
|
|
218
|
+
Pros:
|
|
219
|
+
|
|
220
|
+
- Correct long-term architecture.
|
|
221
|
+
- AAPS remains the declarative control plane.
|
|
222
|
+
- AgInTiFlow becomes the backend agent for specific blocks.
|
|
223
|
+
- AAPS Studio can display AgInTiFlow session and artifact links.
|
|
224
|
+
|
|
225
|
+
Cons:
|
|
226
|
+
|
|
227
|
+
- Requires stable AgInTiFlow run API and event streaming.
|
|
228
|
+
- Requires careful permission mapping.
|
|
229
|
+
- Requires cancellation/resume semantics.
|
|
230
|
+
- Needs a clear project/session identity bridge.
|
|
231
|
+
|
|
232
|
+
Verdict: best long-term bridge after the lightweight AgInTi-side adapter works.
|
|
233
|
+
|
|
234
|
+
## Recommended Architecture
|
|
235
|
+
|
|
236
|
+
Implement a new AgInTiFlow module:
|
|
237
|
+
|
|
238
|
+
```text
|
|
239
|
+
src/aaps-adapter.js
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Responsibilities:
|
|
243
|
+
|
|
244
|
+
- Detect whether AAPS is available.
|
|
245
|
+
- Resolve the AAPS executable command:
|
|
246
|
+
- `AAPS_BIN`
|
|
247
|
+
- `node <local-sibling>/scripts/aaps.js` for development when allowed
|
|
248
|
+
- `aaps` on PATH
|
|
249
|
+
- `npx -y @lazyingart/aaps` only when install/network policy allows
|
|
250
|
+
- Run safe AAPS commands with project-relative paths.
|
|
251
|
+
- Parse JSON output and normalize errors.
|
|
252
|
+
- Summarize AAPS project status.
|
|
253
|
+
- Find `aaps.project.json`.
|
|
254
|
+
- Find active/default `.aaps` workflow.
|
|
255
|
+
- Return artifact paths and run/compile directories.
|
|
256
|
+
- Never read or print `.env` values.
|
|
257
|
+
|
|
258
|
+
Adapter surface:
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
detectAaps({ cwd })
|
|
262
|
+
ensureAaps({ cwd, installPolicy })
|
|
263
|
+
initAapsProject({ cwd, name, domain, mode })
|
|
264
|
+
listAapsFiles({ cwd })
|
|
265
|
+
parseAaps({ cwd, file })
|
|
266
|
+
validateAaps({ cwd, file })
|
|
267
|
+
compileAaps({ cwd, file, mode })
|
|
268
|
+
checkAaps({ cwd, file })
|
|
269
|
+
runAaps({ cwd, file, dryRun, block })
|
|
270
|
+
openAapsStudio({ cwd, host, port, tmux })
|
|
271
|
+
summarizeAapsArtifacts({ cwd, report })
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Use `run_command` policy only for the implementation, not raw LLM shell guessing. The model should request an explicit `aaps_*` tool once the adapter graduates from slash command to model tool.
|
|
275
|
+
|
|
276
|
+
## Slash Command Design
|
|
277
|
+
|
|
278
|
+
Interactive CLI:
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
/aaps
|
|
282
|
+
/aaps status
|
|
283
|
+
/aaps install
|
|
284
|
+
/aaps init [name]
|
|
285
|
+
/aaps files
|
|
286
|
+
/aaps open [file]
|
|
287
|
+
/aaps parse [file]
|
|
288
|
+
/aaps validate [file]
|
|
289
|
+
/aaps compile [file] [check|suggest|apply]
|
|
290
|
+
/aaps check [file]
|
|
291
|
+
/aaps run [file]
|
|
292
|
+
/aaps dry-run [file]
|
|
293
|
+
/aaps studio
|
|
294
|
+
/aaps on
|
|
295
|
+
/aaps auto
|
|
296
|
+
/aaps off
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Default `/aaps` behavior:
|
|
300
|
+
|
|
301
|
+
1. If no AAPS project exists, show a compact explainer plus options:
|
|
302
|
+
- initialize project
|
|
303
|
+
- create first workflow from current goal
|
|
304
|
+
- install/find AAPS
|
|
305
|
+
2. If an AAPS project exists, show:
|
|
306
|
+
- project name/domain
|
|
307
|
+
- active file
|
|
308
|
+
- available workflows
|
|
309
|
+
- last compile/run status
|
|
310
|
+
- suggested next commands
|
|
311
|
+
|
|
312
|
+
State fields:
|
|
313
|
+
|
|
314
|
+
```js
|
|
315
|
+
state.enableAaps = "off" | "on" | "auto"
|
|
316
|
+
state.aapsFile = ""
|
|
317
|
+
state.aapsProjectRoot = state.commandCwd
|
|
318
|
+
state.aapsCompileMode = "check" | "suggest" | "apply"
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
CLI flags:
|
|
322
|
+
|
|
323
|
+
```text
|
|
324
|
+
--aaps
|
|
325
|
+
--aaps auto
|
|
326
|
+
--no-aaps
|
|
327
|
+
--aaps-file workflows/main.aaps
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Web UI Design
|
|
331
|
+
|
|
332
|
+
Do not put AAPS into the left daily settings column at first. It is too large.
|
|
333
|
+
|
|
334
|
+
Add an **AAPS** panel/tab in the workspace area:
|
|
335
|
+
|
|
336
|
+
- Project status card.
|
|
337
|
+
- Active `.aaps` workflow selector.
|
|
338
|
+
- Source editor.
|
|
339
|
+
- Parse diagnostics.
|
|
340
|
+
- IR/graph preview.
|
|
341
|
+
- Compile/check/run buttons.
|
|
342
|
+
- Missing components list.
|
|
343
|
+
- Generated setup prompts and agent prompts.
|
|
344
|
+
- Run reports and artifacts.
|
|
345
|
+
- Button to send selected report/artifact to canvas.
|
|
346
|
+
|
|
347
|
+
Use existing Canvas & Artifacts for outputs rather than building a second preview system.
|
|
348
|
+
|
|
349
|
+
Suggested web layout:
|
|
350
|
+
|
|
351
|
+
```text
|
|
352
|
+
Left: normal AgInTi controls
|
|
353
|
+
Center: chat/session
|
|
354
|
+
Right/lower workspace tabs:
|
|
355
|
+
Logs
|
|
356
|
+
Workspace files
|
|
357
|
+
Canvas
|
|
358
|
+
AAPS
|
|
359
|
+
Sandbox
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
AAPS editor should use the existing guarded file APIs at first. Later it can reuse AAPS Studio components or import AAPS parser directly in the browser.
|
|
363
|
+
|
|
364
|
+
## Model Behavior With AAPS Mode
|
|
365
|
+
|
|
366
|
+
When `/aaps on` or `/aaps auto` is enabled, the prompt should change:
|
|
367
|
+
|
|
368
|
+
- For large ambiguous tasks, first propose or update an AAPS workflow.
|
|
369
|
+
- Use `.aaps` as the durable high-level plan.
|
|
370
|
+
- Compile/check before running.
|
|
371
|
+
- Use AgInTiFlow tools to implement missing scripts/assets only when compile reports require them.
|
|
372
|
+
- Keep all generated assets project-local.
|
|
373
|
+
- Use SCS for risky large tasks automatically.
|
|
374
|
+
- Publish final report/artifacts through canvas.
|
|
375
|
+
|
|
376
|
+
Auto activation signals:
|
|
377
|
+
|
|
378
|
+
- User asks for "large project", "pipeline", "workflow", "autonomous", "repeatable", "batch", "analysis", "book", "paper", "app review", "multi-step".
|
|
379
|
+
- The task needs many phases or repeated loops.
|
|
380
|
+
- The task has clear inputs/outputs/artifacts.
|
|
381
|
+
- The task should be reused later.
|
|
382
|
+
- The project contains `aaps.project.json` or `.aaps` files.
|
|
383
|
+
|
|
384
|
+
Avoid AAPS mode for:
|
|
385
|
+
|
|
386
|
+
- one-off shell/file questions;
|
|
387
|
+
- tiny edits;
|
|
388
|
+
- normal code review;
|
|
389
|
+
- tasks where a short direct tool loop is cheaper and clearer.
|
|
390
|
+
|
|
391
|
+
## AAPS As Backend Agent Consumer
|
|
392
|
+
|
|
393
|
+
Long-term, AAPS should be able to declare an AgInTiFlow agent:
|
|
394
|
+
|
|
395
|
+
```json
|
|
396
|
+
{
|
|
397
|
+
"name": "agintiflow_main",
|
|
398
|
+
"invocation": "agintiflow",
|
|
399
|
+
"provider": "deepseek",
|
|
400
|
+
"modelRole": "main",
|
|
401
|
+
"sandboxMode": "docker-workspace",
|
|
402
|
+
"packageInstallPolicy": "allow",
|
|
403
|
+
"tools": ["files", "shell", "browser", "canvas"]
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
AAPS `exec agent "agintiflow_main"` would call an AgInTiFlow service:
|
|
408
|
+
|
|
409
|
+
```text
|
|
410
|
+
POST /api/agent-runs
|
|
411
|
+
GET /api/agent-runs/:id
|
|
412
|
+
GET /api/agent-runs/:id/events
|
|
413
|
+
POST /api/agent-runs/:id/inbox
|
|
414
|
+
POST /api/agent-runs/:id/stop
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
The payload should include:
|
|
418
|
+
|
|
419
|
+
```json
|
|
420
|
+
{
|
|
421
|
+
"projectRoot": "/path/to/aaps/project",
|
|
422
|
+
"commandCwd": "/path/to/aaps/project",
|
|
423
|
+
"goal": "Execute AAPS block qc_image with these inputs and outputs.",
|
|
424
|
+
"aaps": {
|
|
425
|
+
"project": "aaps.project.json",
|
|
426
|
+
"workflow": "workflows/main.aaps",
|
|
427
|
+
"block": "qc_image",
|
|
428
|
+
"runId": "aaps-run-123",
|
|
429
|
+
"contract": {
|
|
430
|
+
"inputs": [],
|
|
431
|
+
"outputs": [],
|
|
432
|
+
"validations": [],
|
|
433
|
+
"stopConditions": []
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
"policy": {
|
|
437
|
+
"sandboxMode": "docker-workspace",
|
|
438
|
+
"packageInstallPolicy": "allow",
|
|
439
|
+
"allowDestructive": false
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
AgInTiFlow returns:
|
|
445
|
+
|
|
446
|
+
```json
|
|
447
|
+
{
|
|
448
|
+
"sessionId": "web-agent-...",
|
|
449
|
+
"status": "finished",
|
|
450
|
+
"result": "...",
|
|
451
|
+
"artifacts": [],
|
|
452
|
+
"eventsPath": "~/.agintiflow/sessions/.../events.jsonl",
|
|
453
|
+
"changedFiles": [],
|
|
454
|
+
"checks": []
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
AAPS can then write those links into its run report.
|
|
459
|
+
|
|
460
|
+
## Mapping AAPS Contracts To AgInTiFlow
|
|
461
|
+
|
|
462
|
+
| AAPS concept | AgInTiFlow mapping |
|
|
463
|
+
| --- | --- |
|
|
464
|
+
| `pipeline` | session goal plus optional AAPS project metadata |
|
|
465
|
+
| `agent` | model role/provider plus tool permissions |
|
|
466
|
+
| `skill` / `block` | AgInTi skill prompt plus tool contract |
|
|
467
|
+
| `task` | one run phase or queued prompt |
|
|
468
|
+
| `stage` | SCS phase or log section |
|
|
469
|
+
| `action run/exec` | guarded shell/file/browser tool call |
|
|
470
|
+
| `validate` / `verify` | explicit checks before `finish` |
|
|
471
|
+
| `guard` | SCS student gate plus runtime policy |
|
|
472
|
+
| `recover` / `fallback` | retry/fallback prompt injected after failure |
|
|
473
|
+
| `artifact` / `output` | workspace file plus `send_to_canvas` |
|
|
474
|
+
| `events.jsonl` | AgInTiFlow session events plus AAPS run events |
|
|
475
|
+
| `run.json` | AgInTiFlow session pointer plus AAPS run summary |
|
|
476
|
+
|
|
477
|
+
## Safety Model
|
|
478
|
+
|
|
479
|
+
AAPS integration must not become a backdoor around AgInTiFlow policy.
|
|
480
|
+
|
|
481
|
+
Rules:
|
|
482
|
+
|
|
483
|
+
- AAPS commands run inside the current `commandCwd` or an explicitly chosen AAPS project root.
|
|
484
|
+
- All AAPS file arguments must be project-relative.
|
|
485
|
+
- No absolute paths, `..`, home paths, `.env`, `.git`, `node_modules`, or secret-like paths in generated commands.
|
|
486
|
+
- `aaps compile --mode apply` is a write action and should require normal workspace-write policy.
|
|
487
|
+
- `aaps run` may execute workflow commands; route it through existing shell/Docker policy.
|
|
488
|
+
- `aaps studio` should start in host tmux or a durable process, not a short Docker command.
|
|
489
|
+
- `npx -y @lazyingart/aaps` requires package/network install policy.
|
|
490
|
+
- `aaps install` should be explicit. Auto-install can offer a selector, not silently install.
|
|
491
|
+
- All AAPS run/compile artifacts should be captured as session artifacts or canvas links.
|
|
492
|
+
- Never share AAPS project files through Skill Mesh unless the user explicitly exports a sanitized skill pack.
|
|
493
|
+
|
|
494
|
+
## Storage Model
|
|
495
|
+
|
|
496
|
+
Keep AAPS project files in the project:
|
|
497
|
+
|
|
498
|
+
```text
|
|
499
|
+
aaps.project.json
|
|
500
|
+
workflows/
|
|
501
|
+
blocks/
|
|
502
|
+
skills/
|
|
503
|
+
scripts/
|
|
504
|
+
tools/
|
|
505
|
+
agents/
|
|
506
|
+
artifacts/
|
|
507
|
+
runs/
|
|
508
|
+
reports/
|
|
509
|
+
notes/
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
Keep AgInTi session metadata in AgInTi storage:
|
|
513
|
+
|
|
514
|
+
```text
|
|
515
|
+
~/.agintiflow/sessions/<session-id>/
|
|
516
|
+
.aginti-sessions/<session-id>/session.json
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
Bridge with pointers:
|
|
520
|
+
|
|
521
|
+
```json
|
|
522
|
+
{
|
|
523
|
+
"sessionId": "web-agent-...",
|
|
524
|
+
"aapsProjectRoot": "/path/project",
|
|
525
|
+
"aapsWorkflow": "workflows/main.aaps",
|
|
526
|
+
"aapsRunDir": "runs/20260504_run",
|
|
527
|
+
"aapsCompileDir": "runs/20260504_compile"
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Do not move AAPS run directories into `~/.agintiflow`. AAPS artifacts are part of the project workflow and should remain portable with the AAPS project.
|
|
532
|
+
|
|
533
|
+
## Installation Strategy
|
|
534
|
+
|
|
535
|
+
Preferred resolution order:
|
|
536
|
+
|
|
537
|
+
1. `AAPS_BIN` env var.
|
|
538
|
+
2. Local project dependency: `node_modules/.bin/aaps`.
|
|
539
|
+
3. Global `aaps` on PATH.
|
|
540
|
+
4. Development sibling path `/home/lachlan/ProjectsLFS/AAPS/scripts/aaps.js` only in source checkout/dev mode.
|
|
541
|
+
5. `npx -y @lazyingart/aaps` when package policy allows network/package setup.
|
|
542
|
+
|
|
543
|
+
First `/aaps install` behavior:
|
|
544
|
+
|
|
545
|
+
- Explain that AAPS is optional.
|
|
546
|
+
- Show detected status.
|
|
547
|
+
- Offer project-local dev dependency as the default for reproducibility.
|
|
548
|
+
- Global install only if user explicitly asks.
|
|
549
|
+
|
|
550
|
+
Possible commands:
|
|
551
|
+
|
|
552
|
+
```bash
|
|
553
|
+
npm install --save-dev @lazyingart/aaps
|
|
554
|
+
npm install -g @lazyingart/aaps
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
In AgInTiFlow’s own npm package, do not add `@lazyingart/aaps` as a hard dependency initially. Use optional discovery to keep the CLI light.
|
|
558
|
+
|
|
559
|
+
## How AAPS And SCS Should Work Together
|
|
560
|
+
|
|
561
|
+
SCS and AAPS solve different layers.
|
|
562
|
+
|
|
563
|
+
- AAPS: durable workflow specification and block contract.
|
|
564
|
+
- SCS: runtime gatekeeper for plan/phase/progress/finish.
|
|
565
|
+
|
|
566
|
+
Recommended combined behavior:
|
|
567
|
+
|
|
568
|
+
- `/aaps auto` implies SCS auto for large AAPS runs.
|
|
569
|
+
- SCS student should judge AAPS compile/readiness/run evidence before finish.
|
|
570
|
+
- AAPS `guard` and `validate` statements should be included in the SCS evidence pack.
|
|
571
|
+
- If AAPS readiness is blocked, SCS should reject finish unless the final answer honestly reports the blocker and points to the setup/repair prompts.
|
|
572
|
+
|
|
573
|
+
Do not use both AAPS and parallel scouts by default. AAPS is already a structured planning layer; if extra critique is needed, use SCS or a review block explicitly.
|
|
574
|
+
|
|
575
|
+
## Minimal First Implementation
|
|
576
|
+
|
|
577
|
+
Implement only this first:
|
|
578
|
+
|
|
579
|
+
1. Add `src/aaps-adapter.js`.
|
|
580
|
+
2. Add `/aaps status`, `/aaps install`, `/aaps init`, `/aaps validate`, `/aaps compile`, `/aaps check`, `/aaps run`, `/aaps studio`.
|
|
581
|
+
3. Add CLI flags `--aaps`, `--aaps-file`.
|
|
582
|
+
4. Add a safe AAPS status summary to `/status` when an AAPS project exists.
|
|
583
|
+
5. Add docs and smoke tests with `AAPS_MOCK` or local AAPS examples.
|
|
584
|
+
6. Do not add web editor yet.
|
|
585
|
+
|
|
586
|
+
First smoke tests:
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
node scripts/smoke-aaps.js
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
Smoke should cover:
|
|
593
|
+
|
|
594
|
+
- no AAPS installed -> status returns actionable missing state;
|
|
595
|
+
- sibling AAPS path -> parse example;
|
|
596
|
+
- project with `aaps.project.json` -> validate;
|
|
597
|
+
- compile check -> report path captured;
|
|
598
|
+
- dry-run/check -> no destructive side effects;
|
|
599
|
+
- `/aaps status` works in non-interactive simulation.
|
|
600
|
+
|
|
601
|
+
## Web Implementation After CLI
|
|
602
|
+
|
|
603
|
+
After CLI is stable:
|
|
604
|
+
|
|
605
|
+
1. Add `/api/aaps/status`.
|
|
606
|
+
2. Add `/api/aaps/files`.
|
|
607
|
+
3. Add `/api/aaps/file?path=...`.
|
|
608
|
+
4. Add `/api/aaps/file` save endpoint with guarded path checks.
|
|
609
|
+
5. Add `/api/aaps/parse`.
|
|
610
|
+
6. Add `/api/aaps/compile`.
|
|
611
|
+
7. Add `/api/aaps/run`.
|
|
612
|
+
8. Add AAPS tab in web UI.
|
|
613
|
+
|
|
614
|
+
The web editor can start as plain textarea plus diagnostics. The graph can come later.
|
|
615
|
+
|
|
616
|
+
## Product UX
|
|
617
|
+
|
|
618
|
+
The user mental model should be simple:
|
|
619
|
+
|
|
620
|
+
```text
|
|
621
|
+
Chat is for working.
|
|
622
|
+
AAPS is for making the work repeatable.
|
|
623
|
+
AgInTi executes.
|
|
624
|
+
AAPS remembers the pipeline.
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
Example flow:
|
|
628
|
+
|
|
629
|
+
```text
|
|
630
|
+
user> /aaps init "Android release QA"
|
|
631
|
+
user> make a workflow to build, install, screenshot, inspect logs, and summarize this Android app
|
|
632
|
+
aginti> creates workflows/android_release_qa.aaps
|
|
633
|
+
aginti> runs aaps compile --mode check
|
|
634
|
+
aginti> reports missing emulator/device setup or readiness
|
|
635
|
+
user> /aaps run
|
|
636
|
+
aginti> runs the executable blocks, uses AgInTi tools where needed, publishes screenshots/reports to canvas
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
## Why This Can Bring AgInTiFlow Up A Level
|
|
640
|
+
|
|
641
|
+
Normal coding agents are strong at local execution but weak at durable workflow shape.
|
|
642
|
+
|
|
643
|
+
AAPS gives AgInTiFlow:
|
|
644
|
+
|
|
645
|
+
- reusable project scripts for repeated work;
|
|
646
|
+
- user-editable high-level workflows;
|
|
647
|
+
- GUI-editable block graphs;
|
|
648
|
+
- compile/readiness reports before side effects;
|
|
649
|
+
- a natural form for large projects, papers, books, app QA, data analysis, and scientific pipelines.
|
|
650
|
+
|
|
651
|
+
AgInTiFlow gives AAPS:
|
|
652
|
+
|
|
653
|
+
- a real model/tool runtime;
|
|
654
|
+
- model/provider selection;
|
|
655
|
+
- browser/shell/file/canvas actions;
|
|
656
|
+
- long-running session management;
|
|
657
|
+
- better local UI;
|
|
658
|
+
- safer tool policy.
|
|
659
|
+
|
|
660
|
+
Together:
|
|
661
|
+
|
|
662
|
+
```text
|
|
663
|
+
AAPS = source code for autonomous work
|
|
664
|
+
AgInTiFlow = runtime for autonomous work
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
That is the clean product story.
|
|
668
|
+
|
|
669
|
+
## Risks
|
|
670
|
+
|
|
671
|
+
- Too much UI too early can make AgInTiFlow feel heavy.
|
|
672
|
+
- Silent auto-install of AAPS would surprise users.
|
|
673
|
+
- Running AAPS workflows can execute arbitrary declared commands if not routed through policy.
|
|
674
|
+
- Two run stores can confuse users unless linked clearly.
|
|
675
|
+
- If AgInTiFlow starts editing `.aaps` without compiling it, AAPS loses its main value.
|
|
676
|
+
- If AAPS Studio and AgInTi web both become full editors, duplicated UI maintenance will grow.
|
|
677
|
+
|
|
678
|
+
Mitigation:
|
|
679
|
+
|
|
680
|
+
- Start CLI-only.
|
|
681
|
+
- Use the AAPS CLI as source of truth.
|
|
682
|
+
- Show compile/run artifacts through existing AgInTi canvas.
|
|
683
|
+
- Add web editor only after adapter events and smoke tests are reliable.
|
|
684
|
+
- Keep install optional.
|
|
685
|
+
|
|
686
|
+
## Final Recommendation
|
|
687
|
+
|
|
688
|
+
Implement `/aaps` as a lightweight optional adapter first.
|
|
689
|
+
|
|
690
|
+
Do not make AAPS a hard dependency of AgInTiFlow. Do not merge the runtimes. Do not start with a full visual editor.
|
|
691
|
+
|
|
692
|
+
First milestone:
|
|
693
|
+
|
|
694
|
+
```text
|
|
695
|
+
AgInTiFlow can detect/install AAPS, initialize a project, validate/compile/check/run `.aaps`, and surface reports/artifacts in the current session.
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
Second milestone:
|
|
699
|
+
|
|
700
|
+
```text
|
|
701
|
+
AgInTiFlow web can edit `.aaps`, show parse diagnostics, and run compile/check/run from an AAPS tab.
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
Third milestone:
|
|
705
|
+
|
|
706
|
+
```text
|
|
707
|
+
AAPS can invoke AgInTiFlow as a backend agent for `exec agent "agintiflow_main"` blocks.
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
This keeps the architecture elegant: AAPS remains the explicit top-down pipeline language, while AgInTiFlow becomes the practical execution engine and user-facing agent workspace.
|