@ludecker/aaac 1.1.1 → 1.1.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/package.json +1 -1
- package/src/generators/generate-commands.mjs +17 -9
- package/src/run-engine/advance-phase.mjs +2 -2
- package/src/run-engine/gate-write.mjs +14 -2
- package/src/run-engine/init-run.mjs +41 -0
- package/src/run-engine/lib.mjs +33 -0
- package/src/run-engine/record-task.mjs +7 -1
- package/src/run-engine/stop-check.mjs +7 -1
- package/src/run-engine/verify-website-build.mjs +67 -30
- package/templates/cursor/aaac/capabilities/registry.json +14 -16
- package/templates/cursor/aaac/graph.project.yaml +4 -204
- package/templates/cursor/aaac/ontology.md +17 -32
- package/templates/cursor/aaac/project.config.json +4 -1
- package/templates/cursor/aaac/run/schema.json +3 -1
- package/templates/cursor/aaac/scripts/run-engine/advance-phase.mjs +2 -2
- package/templates/cursor/aaac/scripts/run-engine/gate-write.mjs +14 -2
- package/templates/cursor/aaac/scripts/run-engine/init-run.mjs +41 -0
- package/templates/cursor/aaac/scripts/run-engine/lib.mjs +33 -0
- package/templates/cursor/aaac/scripts/run-engine/record-task.mjs +7 -1
- package/templates/cursor/aaac/scripts/run-engine/stop-check.mjs +7 -1
- package/templates/cursor/aaac/scripts/run-engine/verify-website-build.mjs +67 -30
- package/templates/cursor/agents/playwright-check-run.md +8 -26
- package/templates/cursor/agents/release-git.md +2 -2
- package/templates/cursor/agents/unit-test-run.md +3 -7
- package/templates/cursor/skills/shared/governance/implementation/SKILL.md +25 -396
- package/templates/cursor/skills/shared/testing/SKILL.md +2 -2
- package/templates/cursor/skills/shared/verbs/check/orchestrator/SKILL.md +1 -1
- package/templates/cursor/skills/shared/verification/SKILL.md +2 -2
- package/templates/docs/agentic_architecture.md +86 -166
|
@@ -1,127 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
map:
|
|
4
|
-
cms: cms-update
|
|
5
|
-
ui: ui-update
|
|
6
|
-
database: database-update
|
|
7
|
-
aaac: aaac-update
|
|
8
|
-
update-component-by-scope:
|
|
9
|
-
map:
|
|
10
|
-
cms: cms-design-update
|
|
11
|
-
ui: ui-design-update
|
|
12
|
-
create-feature-by-slug:
|
|
13
|
-
map:
|
|
14
|
-
cms: cms-create-feature
|
|
15
|
-
aaac: aaac-create-feature
|
|
16
|
-
fix-bug-by-slug:
|
|
17
|
-
map:
|
|
18
|
-
cms: cms-fix-bug
|
|
19
|
-
ui: ui-fix-bug
|
|
20
|
-
database: database-fix-bug
|
|
21
|
-
aaac: aaac-fix-bug
|
|
22
|
-
default: verb-fix
|
|
23
|
-
default_object: feature
|
|
24
|
-
fix-domain-by-slug:
|
|
25
|
-
map:
|
|
26
|
-
cms: cms-fix-bug
|
|
27
|
-
ui: ui-fix-bug
|
|
28
|
-
database: database-fix-bug
|
|
29
|
-
aaac: aaac-fix-bug
|
|
30
|
-
default: verb-fix
|
|
31
|
-
default_object: module
|
|
32
|
-
fix-component-by-scope:
|
|
33
|
-
map:
|
|
34
|
-
cms: cms-fix-bug
|
|
35
|
-
ui: ui-fix-bug
|
|
36
|
-
default: verb-fix
|
|
37
|
-
default_object: component
|
|
38
|
-
fix-data-by-slug:
|
|
39
|
-
map:
|
|
40
|
-
database: database-fix-bug
|
|
41
|
-
default: database-fix-bug
|
|
42
|
-
default_object: schema
|
|
43
|
-
fix-integration-by-slug:
|
|
44
|
-
map:
|
|
45
|
-
cms: cms-fix-bug
|
|
46
|
-
ui: ui-fix-bug
|
|
47
|
-
database: database-fix-bug
|
|
48
|
-
aaac: aaac-fix-bug
|
|
49
|
-
default: verb-fix
|
|
50
|
-
default_object: integration
|
|
51
|
-
test-module-by-slug:
|
|
52
|
-
map:
|
|
53
|
-
cms: cms-test-module
|
|
54
|
-
ui: ui-test-module
|
|
55
|
-
database: database-test-module
|
|
56
|
-
aaac: aaac-test-module
|
|
1
|
+
# Generic AAAC project overlay — verb orchestrators + exception commands only.
|
|
2
|
+
# Add domain resolvers, orchestrators, and project skills in your repo after init.
|
|
57
3
|
|
|
58
4
|
orchestrators:
|
|
59
|
-
cms-update:
|
|
60
|
-
domain: cms
|
|
61
|
-
path: domains/cms/update/orchestrator
|
|
62
|
-
inventory: domains/cms/update/inventory
|
|
63
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
64
|
-
phases: [load_inventory, discover, investigate_lite, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
65
|
-
|
|
66
|
-
ui-update:
|
|
67
|
-
domain: ui
|
|
68
|
-
path: domains/ui/update/orchestrator
|
|
69
|
-
inventory: domains/ui/update/inventory
|
|
70
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
71
|
-
phases: [load_inventory, discover, investigate_lite, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
72
|
-
|
|
73
|
-
database-update:
|
|
74
|
-
domain: database
|
|
75
|
-
path: domains/database/update/orchestrator
|
|
76
|
-
inventory: domains/database/update/inventory
|
|
77
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
78
|
-
phases: [load_inventory, discover, investigate_lite, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
79
|
-
|
|
80
|
-
cms-design-update:
|
|
81
|
-
domain: cms
|
|
82
|
-
path: domains/cms/update/orchestrator
|
|
83
|
-
inventory: domains/cms/update/inventory
|
|
84
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
85
|
-
design_mode: true
|
|
86
|
-
|
|
87
|
-
ui-design-update:
|
|
88
|
-
domain: ui
|
|
89
|
-
path: domains/ui/update/orchestrator
|
|
90
|
-
inventory: domains/ui/update/inventory
|
|
91
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
92
|
-
design_mode: true
|
|
93
|
-
|
|
94
|
-
cms-create-feature:
|
|
95
|
-
domain: cms
|
|
96
|
-
path: domains/cms/update/orchestrator
|
|
97
|
-
inventory: domains/cms/update/inventory
|
|
98
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting, module-authoring]
|
|
99
|
-
create_mode: true
|
|
100
|
-
|
|
101
|
-
cms-fix-bug:
|
|
102
|
-
domain: cms
|
|
103
|
-
path: domains/cms/update/orchestrator
|
|
104
|
-
inventory: domains/cms/update/inventory
|
|
105
|
-
requires: [discovery, investigation, root-cause, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
106
|
-
fix_mode: true
|
|
107
|
-
phases: [load_inventory, discover, investigate_swarm, root_cause, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
108
|
-
|
|
109
|
-
ui-fix-bug:
|
|
110
|
-
domain: ui
|
|
111
|
-
path: domains/ui/update/orchestrator
|
|
112
|
-
inventory: domains/ui/update/inventory
|
|
113
|
-
requires: [discovery, investigation, root-cause, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
114
|
-
fix_mode: true
|
|
115
|
-
phases: [load_inventory, discover, investigate_swarm, root_cause, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
116
|
-
|
|
117
|
-
database-fix-bug:
|
|
118
|
-
domain: database
|
|
119
|
-
path: domains/database/update/orchestrator
|
|
120
|
-
inventory: domains/database/update/inventory
|
|
121
|
-
requires: [discovery, investigation, root-cause, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting]
|
|
122
|
-
fix_mode: true
|
|
123
|
-
phases: [load_inventory, discover, investigate_swarm, root_cause, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
124
|
-
|
|
125
5
|
update-doc:
|
|
126
6
|
path: skills/shared/documentation/orchestrator
|
|
127
7
|
requires: [discovery, documentation, reporting]
|
|
@@ -130,7 +10,7 @@ orchestrators:
|
|
|
130
10
|
review-incident:
|
|
131
11
|
path: skills/shared/investigation/orchestrator
|
|
132
12
|
requires: [discovery, investigation, reporting]
|
|
133
|
-
optional: [execution
|
|
13
|
+
optional: [execution]
|
|
134
14
|
|
|
135
15
|
review-module:
|
|
136
16
|
path: skills/shared/architecture/orchestrator
|
|
@@ -146,73 +26,9 @@ orchestrators:
|
|
|
146
26
|
path: skills/shared/testing/orchestrator
|
|
147
27
|
requires: [discovery, testing, verification, reporting]
|
|
148
28
|
|
|
149
|
-
cms-test-module:
|
|
150
|
-
domain: cms
|
|
151
|
-
path: domains/cms/update/orchestrator
|
|
152
|
-
inventory: domains/cms/update/inventory
|
|
153
|
-
requires: [testing, verification, reporting]
|
|
154
|
-
test_only: true
|
|
155
|
-
|
|
156
|
-
ui-test-module:
|
|
157
|
-
domain: ui
|
|
158
|
-
path: domains/ui/update/orchestrator
|
|
159
|
-
inventory: domains/ui/update/inventory
|
|
160
|
-
requires: [testing, verification, reporting]
|
|
161
|
-
test_only: true
|
|
162
|
-
|
|
163
|
-
database-test-module:
|
|
164
|
-
domain: database
|
|
165
|
-
path: domains/database/update/orchestrator
|
|
166
|
-
inventory: domains/database/update/inventory
|
|
167
|
-
requires: [testing, verification, reporting]
|
|
168
|
-
test_only: true
|
|
169
|
-
|
|
170
|
-
aaac-update:
|
|
171
|
-
domain: aaac
|
|
172
|
-
path: domains/aaac/update/orchestrator
|
|
173
|
-
inventory: domains/aaac/update/inventory
|
|
174
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting, integration]
|
|
175
|
-
phases: [load_inventory, discover, investigate_lite, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
176
|
-
|
|
177
|
-
aaac-create-feature:
|
|
178
|
-
domain: aaac
|
|
179
|
-
path: domains/aaac/update/orchestrator
|
|
180
|
-
inventory: domains/aaac/update/inventory
|
|
181
|
-
requires: [discovery, investigation-lite, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting, module-authoring, integration]
|
|
182
|
-
create_mode: true
|
|
183
|
-
|
|
184
|
-
aaac-fix-bug:
|
|
185
|
-
domain: aaac
|
|
186
|
-
path: domains/aaac/update/orchestrator
|
|
187
|
-
inventory: domains/aaac/update/inventory
|
|
188
|
-
requires: [discovery, investigation, root-cause, planning, validation, impact-analysis, dependency-graph, fitness-functions, rollback, execution, testing, verification, reporting, integration]
|
|
189
|
-
fix_mode: true
|
|
190
|
-
phases: [load_inventory, discover, investigate_swarm, root_cause, plan, validate, impact_analysis, dependency_graph, fitness_functions, rollback, execute, verify, sync_inventory, report]
|
|
191
|
-
|
|
192
|
-
aaac-test-module:
|
|
193
|
-
domain: aaac
|
|
194
|
-
path: domains/aaac/update/orchestrator
|
|
195
|
-
inventory: domains/aaac/update/inventory
|
|
196
|
-
requires: [testing, verification, reporting, integration]
|
|
197
|
-
test_only: true
|
|
198
|
-
|
|
199
|
-
aaac-publish:
|
|
200
|
-
domain: aaac
|
|
201
|
-
path: domains/aaac/update/orchestrator
|
|
202
|
-
inventory: domains/aaac/update/inventory
|
|
203
|
-
requires: [testing, verification, execution, reporting, integration]
|
|
204
|
-
publish_mode: true
|
|
205
|
-
|
|
206
|
-
write-article:
|
|
207
|
-
domain: content
|
|
208
|
-
path: domains/content/write/orchestrator
|
|
209
|
-
requires: [run, reporting]
|
|
210
|
-
workflow: write-article
|
|
211
|
-
phases: [parse, research_swarm, write, review, persist, report]
|
|
212
|
-
|
|
213
29
|
release-app:
|
|
214
30
|
path: skills/shared/platform-release/orchestrator
|
|
215
|
-
requires: [testing, verification, execution, reporting
|
|
31
|
+
requires: [testing, verification, execution, reporting]
|
|
216
32
|
|
|
217
33
|
verb-create:
|
|
218
34
|
path: skills/shared/verbs/create/orchestrator
|
|
@@ -322,18 +138,6 @@ skills:
|
|
|
322
138
|
path: skills/shared/platform-release
|
|
323
139
|
governance/implementation:
|
|
324
140
|
path: skills/shared/governance/implementation
|
|
325
|
-
ludecker-design-system:
|
|
326
|
-
path: skills/ludecker/design-system
|
|
327
|
-
ludecker-database-schema:
|
|
328
|
-
path: skills/ludecker/database-schema
|
|
329
|
-
ludecker-api-first:
|
|
330
|
-
path: skills/ludecker/api-first
|
|
331
|
-
ludecker-security:
|
|
332
|
-
path: skills/ludecker/security
|
|
333
|
-
ludecker-user-experience:
|
|
334
|
-
path: skills/ludecker/user-experience
|
|
335
|
-
ludecker-infrastructure:
|
|
336
|
-
path: skills/ludecker/infrastructure
|
|
337
141
|
|
|
338
142
|
agents:
|
|
339
143
|
discovery-inventory:
|
|
@@ -382,10 +186,6 @@ agents:
|
|
|
382
186
|
path: agents/release-git.md
|
|
383
187
|
wave: 1
|
|
384
188
|
blocking: true
|
|
385
|
-
release-render:
|
|
386
|
-
path: agents/release-render.md
|
|
387
|
-
wave: 2
|
|
388
|
-
requires: [release-git]
|
|
389
189
|
|
|
390
190
|
policies:
|
|
391
191
|
- policies/master-rules.md
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
SSOT: [ontology.json](ontology.json). Regenerate graph and commands:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
|
|
7
|
-
node .cursor/aaac/generate-commands.mjs
|
|
6
|
+
npx @ludecker/aaac@latest generate
|
|
8
7
|
```
|
|
9
8
|
|
|
10
9
|
## Hierarchy (how developers already think)
|
|
@@ -22,18 +21,10 @@ Four layers in the graph:
|
|
|
22
21
|
| **product** | feature, workflow, integration | `/create-feature`, `/check-workflow` |
|
|
23
22
|
| **system** | app, domain, architecture | `/release-app`, `/update-domain`, `/review-architecture` |
|
|
24
23
|
|
|
25
|
-
## Verbs
|
|
24
|
+
## Verbs
|
|
26
25
|
|
|
27
26
|
create · update · fix · review · check · test · release · remove
|
|
28
27
|
|
|
29
|
-
## Ludecker domains
|
|
30
|
-
|
|
31
|
-
| Slug | Bounded context |
|
|
32
|
-
|------|-----------------|
|
|
33
|
-
| `cms` | `apps/website` — public site + CMS admin |
|
|
34
|
-
| `ui` | `packages/ui` — design system |
|
|
35
|
-
| `database` | `supabase/migrations` — schema, RLS, type mirrors |
|
|
36
|
-
|
|
37
28
|
## Granular aliases
|
|
38
29
|
|
|
39
30
|
Finer nouns (api, endpoint, hook, spec, skill, graph, …) map to a canonical command — see `command_aliases` in [ontology.json](ontology.json). Examples:
|
|
@@ -43,48 +34,42 @@ Finer nouns (api, endpoint, hook, spec, skill, graph, …) map to a canonical co
|
|
|
43
34
|
| `/update-api` | `update-integration` |
|
|
44
35
|
| `/fix-hook` | `fix-function` |
|
|
45
36
|
| `/update-doc` | `update-architecture` |
|
|
46
|
-
| `/update-design` | `update-component` (cms/ui resolver) |
|
|
47
37
|
| `/check-inventory` | `check-module` |
|
|
48
38
|
| `/create-skill` | `create-module` |
|
|
49
|
-
| `/ship-ludecker` | `release-app` |
|
|
50
39
|
|
|
51
40
|
## Exceptions
|
|
52
41
|
|
|
53
42
|
| Command | Note |
|
|
54
43
|
|---------|------|
|
|
55
|
-
| `fix-bug` | Defect repair;
|
|
44
|
+
| `fix-bug` | Defect repair; routes to `verb-fix` + object `feature` by default |
|
|
45
|
+
| `fix-module` | Same fix swarm; routes to `verb-fix` + object `module` by default |
|
|
56
46
|
| `review-incident` | Production/deploy incident (`swarm-check` alias) |
|
|
57
47
|
| `test-function` | Journey verification (dedicated orchestrator) |
|
|
58
|
-
| `release-app` |
|
|
59
|
-
|
|
48
|
+
| `release-app` | Platform release swarm |
|
|
49
|
+
|
|
50
|
+
Add domain resolvers in `graph.project.yaml` to route `/update-module <slug>` to domain orchestrators.
|
|
60
51
|
|
|
61
52
|
## Invalid `release-*`
|
|
62
53
|
|
|
63
|
-
Use `release-app`, `release-feature`, or `release-integration` — not `release-function`, `release-module`,
|
|
54
|
+
Use `release-app`, `release-feature`, or `release-integration` — not `release-function`, `release-module`, etc. (see `invalid_pairs` in graph).
|
|
64
55
|
|
|
65
56
|
## Verb lifecycle and gates
|
|
66
57
|
|
|
67
|
-
**Work:** [lifecycle/lifecycle.json](lifecycle/lifecycle.json)
|
|
68
|
-
**Gates:** [governance/gates.json](governance/gates.json)
|
|
69
|
-
**
|
|
70
|
-
**Run:** [run/schema.json](run/schema.json) — primary execution object
|
|
71
|
-
|
|
72
|
-
Phase → skill: [lifecycle/phases.json](lifecycle/phases.json)
|
|
58
|
+
**Work:** [lifecycle/lifecycle.json](lifecycle/lifecycle.json)
|
|
59
|
+
**Gates:** [governance/gates.json](governance/gates.json)
|
|
60
|
+
**Run:** [run/schema.json](run/schema.json)
|
|
73
61
|
|
|
74
62
|
## Object capabilities
|
|
75
63
|
|
|
76
|
-
Ontology declares `object_capabilities` per object. Graph resolves
|
|
64
|
+
Ontology declares `object_capabilities` per object. Graph resolves providers via [capabilities/registry.json](capabilities/registry.json). Generic install uses shared skills; replace with project skills in your overlay.
|
|
77
65
|
|
|
78
|
-
Example: `component` → `[component-model, layer-boundaries, ui-design]` → `[component, architecture,
|
|
66
|
+
Example: `component` → `[component-model, layer-boundaries, ui-design]` → `[component, architecture, component]`
|
|
79
67
|
|
|
80
68
|
## Domain argument
|
|
81
69
|
|
|
82
|
-
- **
|
|
83
|
-
- **Optional:** `*-function`, `review-incident
|
|
70
|
+
- **Recommended:** `update-module`, `fix-module`, … once you add domains
|
|
71
|
+
- **Optional:** `*-function`, `review-incident`
|
|
84
72
|
|
|
85
|
-
## Manual commands
|
|
73
|
+
## Manual commands
|
|
86
74
|
|
|
87
|
-
|
|
88
|
-
|---------|---------|
|
|
89
|
-
| `/launch-ludecker` | Local dev: kill stale processes, clean `.next`, start `pnpm dev` |
|
|
90
|
-
| `/kill-ludecker` | Kill local dev port listeners |
|
|
75
|
+
Add filenames to [project.config.json](project.config.json) `manual_commands` — not generated from ontology.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"domain": "string | null",
|
|
11
11
|
"intent": "string",
|
|
12
12
|
"orchestrator": "string",
|
|
13
|
-
"status": "pending | running | blocked | completed | failed",
|
|
13
|
+
"status": "pending | running | blocked | completed | failed | cancelled",
|
|
14
14
|
"phase": "string | null",
|
|
15
15
|
"phase_kind": "work | gate | null",
|
|
16
16
|
"awaiting_approval": false,
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"checkpoints": [],
|
|
23
23
|
"log": [],
|
|
24
24
|
"capabilities_resolved": {},
|
|
25
|
+
"capability_runtime": {},
|
|
26
|
+
"capability_runtime_approved": false,
|
|
25
27
|
"capability_evidence_processed": false,
|
|
26
28
|
"capability_evidence_outcomes": [],
|
|
27
29
|
"confidence": {
|
|
@@ -102,7 +102,7 @@ if (
|
|
|
102
102
|
manifest.updated_at = isoNow();
|
|
103
103
|
writeJson(manifestPath, manifest);
|
|
104
104
|
console.error(
|
|
105
|
-
"
|
|
105
|
+
"App verify failed (see project.config.json verify). Fix errors, then re-run:\n" +
|
|
106
106
|
` node .cursor/aaac/scripts/run-engine/verify-website-build.mjs --run-id ${runId}\n` +
|
|
107
107
|
detail,
|
|
108
108
|
);
|
|
@@ -112,7 +112,7 @@ if (
|
|
|
112
112
|
event: "verify_website_pass",
|
|
113
113
|
phase: completedPhase,
|
|
114
114
|
phase_kind: manifest.phase_kind,
|
|
115
|
-
detail: "
|
|
115
|
+
detail: "app verify gate",
|
|
116
116
|
level: "info",
|
|
117
117
|
});
|
|
118
118
|
}
|
|
@@ -53,10 +53,22 @@ process.stdin.on("end", () => {
|
|
|
53
53
|
if (!conversationId) allow();
|
|
54
54
|
|
|
55
55
|
const active = loadActiveRun(conversationId);
|
|
56
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
!active?.run_id ||
|
|
58
|
+
active.status === "completed" ||
|
|
59
|
+
active.status === "cancelled"
|
|
60
|
+
) {
|
|
61
|
+
allow();
|
|
62
|
+
}
|
|
57
63
|
|
|
58
64
|
const manifest = loadRunManifest(active.run_id);
|
|
59
|
-
if (
|
|
65
|
+
if (
|
|
66
|
+
!manifest ||
|
|
67
|
+
manifest.status === "completed" ||
|
|
68
|
+
manifest.status === "cancelled"
|
|
69
|
+
) {
|
|
70
|
+
allow();
|
|
71
|
+
}
|
|
60
72
|
if (manifest.conversation_id && manifest.conversation_id !== conversationId) allow();
|
|
61
73
|
|
|
62
74
|
const enforcement = loadEnforcement();
|
|
@@ -11,6 +11,11 @@ import {
|
|
|
11
11
|
phaseKind,
|
|
12
12
|
writeJson,
|
|
13
13
|
saveActiveRun,
|
|
14
|
+
loadActiveRun,
|
|
15
|
+
loadRunManifest,
|
|
16
|
+
clearActiveRun,
|
|
17
|
+
cancelRunManifest,
|
|
18
|
+
isUserStopIntent,
|
|
14
19
|
conversationIdFromHook,
|
|
15
20
|
promptFromHook,
|
|
16
21
|
} from "./lib.mjs";
|
|
@@ -41,6 +46,42 @@ try {
|
|
|
41
46
|
|
|
42
47
|
const prompt = process.argv[2] ?? promptFromHook(hook);
|
|
43
48
|
const conversationId = conversationIdFromHook(hook);
|
|
49
|
+
|
|
50
|
+
if (isUserStopIntent(prompt) && conversationId) {
|
|
51
|
+
const active = loadActiveRun(conversationId);
|
|
52
|
+
let cancelledRunId = null;
|
|
53
|
+
if (active?.run_id) {
|
|
54
|
+
const existing = loadRunManifest(active.run_id);
|
|
55
|
+
if (
|
|
56
|
+
existing &&
|
|
57
|
+
existing.status !== "completed" &&
|
|
58
|
+
existing.status !== "cancelled"
|
|
59
|
+
) {
|
|
60
|
+
cancelRunManifest(existing, prompt.trim());
|
|
61
|
+
recordLog(existing, {
|
|
62
|
+
event: "run_cancelled",
|
|
63
|
+
phase: existing.phase,
|
|
64
|
+
phase_kind: existing.phase_kind,
|
|
65
|
+
detail: `user stop: ${prompt.trim()}`,
|
|
66
|
+
level: "info",
|
|
67
|
+
});
|
|
68
|
+
recordDecision(existing, {
|
|
69
|
+
phase: existing.phase ?? "dispatch",
|
|
70
|
+
decision: "user_stop",
|
|
71
|
+
reason: "User requested stop",
|
|
72
|
+
evidence: prompt.trim(),
|
|
73
|
+
});
|
|
74
|
+
writeJson(`${runDir(active.run_id)}/run.json`, existing);
|
|
75
|
+
cancelledRunId = active.run_id;
|
|
76
|
+
}
|
|
77
|
+
clearActiveRun(conversationId);
|
|
78
|
+
}
|
|
79
|
+
console.log(
|
|
80
|
+
JSON.stringify({ ok: true, aaac: false, cancelled: cancelledRunId }),
|
|
81
|
+
);
|
|
82
|
+
process.exit(0);
|
|
83
|
+
}
|
|
84
|
+
|
|
44
85
|
const parsed = parseAaacPrompt(prompt);
|
|
45
86
|
|
|
46
87
|
if (!parsed) {
|
|
@@ -139,3 +139,36 @@ export function phaseKind(phase, registry) {
|
|
|
139
139
|
export function promptFromHook(hook) {
|
|
140
140
|
return hook?.prompt ?? hook?.text ?? hook?.content ?? "";
|
|
141
141
|
}
|
|
142
|
+
|
|
143
|
+
/** User explicitly asked to halt the current Run (short prompts only). */
|
|
144
|
+
export function isUserStopIntent(text) {
|
|
145
|
+
if (!text || typeof text !== "string") return false;
|
|
146
|
+
const trimmed = text.trim();
|
|
147
|
+
if (trimmed.length > 60) return false;
|
|
148
|
+
return (
|
|
149
|
+
/^(stop|cancel|abort)([.!?]*)$/i.test(trimmed) ||
|
|
150
|
+
/^(please\s+)?(stop|cancel|abort)([.!?]*)$/i.test(trimmed) ||
|
|
151
|
+
/^(stop|cancel|abort)\s+(the\s+)?run([.!?]*)$/i.test(trimmed)
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function cancelRunManifest(manifest, evidence = "user_stop") {
|
|
156
|
+
manifest.status = "cancelled";
|
|
157
|
+
manifest.awaiting_approval = false;
|
|
158
|
+
manifest.blocked_reason = null;
|
|
159
|
+
manifest.updated_at = isoNow();
|
|
160
|
+
if (manifest.enforcement) {
|
|
161
|
+
manifest.enforcement.edit_allowed = true;
|
|
162
|
+
}
|
|
163
|
+
return manifest;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function clearActiveRun(conversationId) {
|
|
167
|
+
if (!conversationId) return;
|
|
168
|
+
const filePath = activeRunPath(conversationId);
|
|
169
|
+
try {
|
|
170
|
+
fs.unlinkSync(filePath);
|
|
171
|
+
} catch {
|
|
172
|
+
// already cleared
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -34,7 +34,13 @@ process.stdin.on("end", () => {
|
|
|
34
34
|
if (!active?.run_id) allow();
|
|
35
35
|
|
|
36
36
|
const manifest = loadRunManifest(active.run_id);
|
|
37
|
-
if (
|
|
37
|
+
if (
|
|
38
|
+
!manifest ||
|
|
39
|
+
manifest.status === "completed" ||
|
|
40
|
+
manifest.status === "cancelled"
|
|
41
|
+
) {
|
|
42
|
+
allow();
|
|
43
|
+
}
|
|
38
44
|
if (manifest.conversation_id && manifest.conversation_id !== conversationId) allow();
|
|
39
45
|
|
|
40
46
|
manifest.swarm = manifest.swarm ?? {};
|
|
@@ -28,7 +28,13 @@ process.stdin.on("end", () => {
|
|
|
28
28
|
if (!active?.run_id) process.exit(0);
|
|
29
29
|
|
|
30
30
|
const manifest = loadRunManifest(active.run_id);
|
|
31
|
-
if (
|
|
31
|
+
if (
|
|
32
|
+
!manifest ||
|
|
33
|
+
manifest.status === "completed" ||
|
|
34
|
+
manifest.status === "cancelled"
|
|
35
|
+
) {
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
32
38
|
|
|
33
39
|
const remaining = [manifest.phase, ...(manifest.pending ?? [])].filter(Boolean);
|
|
34
40
|
|