|
1 | 1 | { |
2 | | - "_comment": "Full edit delegation cycle using envelope format for every message", |
| 2 | + "_comment": "Edit delegation cycle showing orchestrator -> maintain context -> apply engine -> handle", |
3 | 3 |
|
4 | 4 | "step_1_handle": { |
5 | | - "_description": "Orchestrator holds this envelope after artifact creation", |
| 5 | + "_description": "Orchestrator holds this handle after artifact creation via init context", |
6 | 6 | "protocol": "aap/0.1", |
7 | 7 | "id": "dashboard-001", |
8 | 8 | "version": 3, |
9 | 9 | "name": "handle", |
10 | | - "operation": {"direction": "output", "format": "text/html", "updated_at": "2026-03-29T14:00:00Z", "state": "published"}, |
| 10 | + "meta": {"format": "text/html", "state": "published"}, |
11 | 11 | "content": [ |
12 | | - {"sections": ["nav", "stats", "users", "orders"], "token_count": 10240} |
| 12 | + {"id": "dashboard-001", "version": 3, "token_count": 10240} |
13 | 13 | ] |
14 | 14 | }, |
15 | 15 |
|
16 | | - "step_2_projection": { |
17 | | - "_description": "Orchestrator requests and receives a structure projection — an envelope", |
18 | | - "protocol": "aap/0.1", |
19 | | - "id": "dashboard-001", |
20 | | - "version": 3, |
21 | | - "name": "projection", |
22 | | - "operation": {"direction": "output", "format": "text/html", "created_at": "2026-03-29T14:01:00Z"}, |
23 | | - "content": [ |
24 | | - { |
25 | | - "projection_type": "structure", |
26 | | - "token_count": 10240, |
27 | | - "outline": "HTML dashboard with 4 main sections", |
28 | | - "sections": [ |
29 | | - {"id": "nav", "label": "Navigation", "token_count": 820, "summary": "Top nav bar with logo, search, and user menu"}, |
30 | | - {"id": "stats", "label": "Statistics Cards", "token_count": 1200, "summary": "4 stat cards: users (1,247), revenue ($12,340), orders (312), uptime (99.7%)"}, |
31 | | - {"id": "users", "label": "Users Table", "token_count": 5100, "summary": "Sortable table with 50 user rows"}, |
32 | | - {"id": "orders", "label": "Orders Table", "token_count": 3120, "summary": "Sortable table with 30 order rows"} |
33 | | - ] |
34 | | - } |
35 | | - ] |
36 | | - }, |
37 | | - |
38 | | - "step_3_edit_intent": { |
39 | | - "_description": "Orchestrator sends edit intent — an input envelope with parallel intents", |
40 | | - "protocol": "aap/0.1", |
41 | | - "id": "dashboard-001", |
42 | | - "version": 3, |
43 | | - "name": "intent", |
44 | | - "operation": {"direction": "input", "format": "text/html"}, |
45 | | - "content": [ |
46 | | - { |
47 | | - "intent": "Update the revenue stat card to show $15,720 and the orders count to 384", |
48 | | - "target_sections": ["stats"], |
49 | | - "constraints": {"preserve_structure": true, "mode_hint": "diff"} |
50 | | - } |
51 | | - ] |
52 | | - }, |
53 | | - |
54 | | - "step_3_internal_dispatch": { |
55 | | - "_description": "What happens inside the edit operation (not visible to orchestrator)", |
| 16 | + "step_2_maintain_context": { |
| 17 | + "_description": "Maintain context receives artifact + message, produces edit envelope (not visible to orchestrator)", |
56 | 18 |
|
57 | | - "maintain_agent_context": { |
58 | | - "system_prompt": "You are a maintain-agent. Produce AAP diff envelopes to apply the requested change.", |
| 19 | + "maintain_context_input": { |
| 20 | + "system_prompt": "You are an AAP maintain context. Given an artifact and an edit instruction, produce a name: \"edit\" envelope.", |
59 | 21 | "artifact_injected": "(full HTML content of dashboard-001 v3 — ~10,240 tokens)", |
60 | | - "intent": "Update the revenue stat card to show $15,720 and the orders count to 384" |
| 22 | + "message": "Update the revenue stat card to show $15,720 and the orders count to 384" |
61 | 23 | }, |
62 | 24 |
|
63 | | - "maintain_agent_output": { |
| 25 | + "maintain_context_output": { |
64 | 26 | "protocol": "aap/0.1", |
65 | 27 | "id": "dashboard-001", |
66 | 28 | "version": 4, |
67 | | - "name": "diff", |
68 | | - "operation": {"direction": "output", "format": "text/html", "tokens_used": 65}, |
| 29 | + "name": "edit", |
| 30 | + "meta": {"format": "text/html", "tokens_used": 65}, |
69 | 31 | "content": [ |
70 | | - {"op": "replace", "target": {"search": "$12,340"}, "content": "$15,720"}, |
71 | | - {"op": "replace", "target": {"search": "<span class=\"stat-value\">312</span>"}, "content": "<span class=\"stat-value\">384</span>"} |
| 32 | + {"op": "replace", "target": {"type": "id", "value": "revenue-value"}, "content": "$15,720"}, |
| 33 | + {"op": "replace", "target": {"type": "id", "value": "orders-count"}, "content": "384"} |
72 | 34 | ] |
73 | | - }, |
74 | | - |
75 | | - "apply_engine": "Resolves diff operations against stored v3 content → produces v4 (CPU, 0 tokens, ~2μs)" |
| 35 | + } |
76 | 36 | }, |
77 | 37 |
|
78 | | - "step_4_edit_result": { |
79 | | - "_description": "Orchestrator receives result envelope — summary of changes + updated handle", |
80 | | - "protocol": "aap/0.1", |
81 | | - "id": "dashboard-001", |
82 | | - "version": 4, |
83 | | - "name": "result", |
84 | | - "operation": {"direction": "output", "format": "text/html", "tokens_used": 65, "checksum": "sha256:b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3"}, |
85 | | - "content": [ |
86 | | - { |
87 | | - "status": "applied", |
88 | | - "mode_used": "diff", |
89 | | - "changes": [ |
90 | | - {"section_id": "stats", "description": "Updated revenue from $12,340 to $15,720 and orders from 312 to 384"} |
91 | | - ] |
92 | | - } |
93 | | - ] |
| 38 | + "step_3_apply_engine": { |
| 39 | + "_description": "Apply engine resolves edit operations against stored v3 content -> produces v4 artifact + handle (CPU, 0 tokens, ~2us)" |
94 | 40 | }, |
95 | 41 |
|
96 | | - "step_5_audit": { |
97 | | - "_description": "Audit entry — also an envelope", |
| 42 | + "step_4_handle_returned": { |
| 43 | + "_description": "Orchestrator receives updated handle — never sees the artifact content", |
98 | 44 | "protocol": "aap/0.1", |
99 | 45 | "id": "dashboard-001", |
100 | 46 | "version": 4, |
101 | | - "name": "audit", |
102 | | - "operation": {"direction": "output"}, |
| 47 | + "name": "handle", |
| 48 | + "meta": {"format": "text/html", "state": "published"}, |
103 | 49 | "content": [ |
104 | | - { |
105 | | - "entry_id": "audit-dash001-004", |
106 | | - "operation": "edit", |
107 | | - "actor": "agent:orchestrator", |
108 | | - "timestamp": "2026-03-29T14:02:00Z", |
109 | | - "version_before": 3, |
110 | | - "version_after": 4, |
111 | | - "status": "success", |
112 | | - "tokens_used": 65, |
113 | | - "detail": { |
114 | | - "intent": "Update the revenue stat card to show $15,720 and the orders count to 384", |
115 | | - "target_sections": ["stats"], |
116 | | - "mode_used": "diff", |
117 | | - "changes": [{"section_id": "stats", "description": "Updated revenue from $12,340 to $15,720 and orders from 312 to 384"}] |
118 | | - } |
119 | | - } |
| 50 | + {"id": "dashboard-001", "version": 4, "token_count": 10240} |
120 | 51 | ] |
121 | 52 | } |
122 | 53 | } |
0 commit comments