Skip to content

Commit d469efa

Browse files
committed
test(spec): restructure envelope examples to match synthesize/edit model
Rename specification example files to align with synthesize/edit envelope terminology and remove outdated operation types. Rename: incremental-diff.json → edit-id-targeting.json, json-pointer-diff.json → edit-pointer-targeting.json, section-update.json → edit-section-replace.json. Delete full-generation.json, composite.json, parallel-manifest.json, chunked-stream.jsonl, and template-fill.json. Update edit-delegation.json to reflect the new orchestrator -> maintain context -> apply engine flow with lightweight handles.
1 parent 6a31d8b commit d469efa

10 files changed

Lines changed: 50 additions & 213 deletions

spec/examples/chunked-stream.jsonl

Lines changed: 0 additions & 11 deletions
This file was deleted.

spec/examples/composite.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

spec/examples/edit-delegation.json

Lines changed: 22 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,53 @@
11
{
2-
"_comment": "Full edit delegation cycle using envelope format for every message",
2+
"_comment": "Edit delegation cycle showing orchestrator -> maintain context -> apply engine -> handle",
33

44
"step_1_handle": {
5-
"_description": "Orchestrator holds this envelope after artifact creation",
5+
"_description": "Orchestrator holds this handle after artifact creation via init context",
66
"protocol": "aap/0.1",
77
"id": "dashboard-001",
88
"version": 3,
99
"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"},
1111
"content": [
12-
{"sections": ["nav", "stats", "users", "orders"], "token_count": 10240}
12+
{"id": "dashboard-001", "version": 3, "token_count": 10240}
1313
]
1414
},
1515

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)",
5618

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.",
5921
"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"
6123
},
6224

63-
"maintain_agent_output": {
25+
"maintain_context_output": {
6426
"protocol": "aap/0.1",
6527
"id": "dashboard-001",
6628
"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},
6931
"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"}
7234
]
73-
},
74-
75-
"apply_engine": "Resolves diff operations against stored v3 content → produces v4 (CPU, 0 tokens, ~2μs)"
35+
}
7636
},
7737

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)"
9440
},
9541

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",
9844
"protocol": "aap/0.1",
9945
"id": "dashboard-001",
10046
"version": 4,
101-
"name": "audit",
102-
"operation": {"direction": "output"},
47+
"name": "handle",
48+
"meta": {"format": "text/html", "state": "published"},
10349
"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}
12051
]
12152
}
12253
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22
"protocol": "aap/0.1",
33
"id": "dashboard-001",
44
"version": 2,
5-
"name": "diff",
6-
"operation": {
7-
"direction": "output",
5+
"name": "edit",
6+
"meta": {
87
"format": "text/html",
9-
"updated_at": "2026-03-29T10:05:00Z",
108
"tokens_used": 42
119
},
1210
"content": [
1311
{
1412
"op": "replace",
15-
"target": {"search": "<span class=\"stat-value\">$12,340</span>"},
13+
"target": {"type": "id", "value": "revenue-value"},
1614
"content": "<span class=\"stat-value\">$15,720</span>"
1715
},
1816
{
1917
"op": "replace",
20-
"target": {"search": "<span class=\"stat-value\">1,205</span>"},
18+
"target": {"type": "id", "value": "user-count"},
2119
"content": "<span class=\"stat-value\">1,342</span>"
2220
}
2321
]
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,24 @@
22
"protocol": "aap/0.1",
33
"id": "config-001",
44
"version": 2,
5-
"name": "diff",
6-
"operation": {
7-
"direction": "output",
5+
"name": "edit",
6+
"meta": {
87
"format": "application/json"
98
},
109
"content": [
1110
{
1211
"op": "replace",
13-
"target": {"pointer": "/database/host"},
12+
"target": {"type": "pointer", "value": "/database/host"},
1413
"content": "\"prod-db.example.com\""
1514
},
1615
{
1716
"op": "replace",
18-
"target": {"pointer": "/features/dark_mode"},
17+
"target": {"type": "pointer", "value": "/features/dark_mode"},
1918
"content": "true"
2019
},
2120
{
2221
"op": "delete",
23-
"target": {"pointer": "/deprecated_field"}
22+
"target": {"type": "pointer", "value": "/deprecated_field"}
2423
}
2524
]
2625
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
"protocol": "aap/0.1",
33
"id": "dashboard-001",
44
"version": 3,
5-
"name": "section",
6-
"operation": {
7-
"direction": "output",
5+
"name": "edit",
6+
"meta": {
87
"format": "text/html",
9-
"updated_at": "2026-03-29T10:10:00Z",
108
"tokens_used": 95
119
},
1210
"content": [
1311
{
14-
"id": "users-table",
12+
"op": "replace",
13+
"target": {"type": "id", "value": "users-table"},
1514
"content": "<table>\n <tr><th>Name</th><th>Email</th><th>Role</th><th>Status</th></tr>\n <tr><td>Alice</td><td>alice@example.com</td><td>Admin</td><td>Active</td></tr>\n <tr><td>Bob</td><td>bob@example.com</td><td>User</td><td>Active</td></tr>\n <tr><td>Charlie</td><td>charlie@example.com</td><td>User</td><td>Inactive</td></tr>\n <tr><td>Dana</td><td>dana@example.com</td><td>Editor</td><td>Active</td></tr>\n</table>"
1615
}
1716
]

spec/examples/full-generation.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

spec/examples/parallel-manifest.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

spec/examples/synthesize.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"protocol": "aap/0.1",
3+
"id": "dashboard-001",
4+
"version": 1,
5+
"name": "synthesize",
6+
"meta": {
7+
"format": "text/html",
8+
"tokens_used": 210
9+
},
10+
"content": [
11+
{
12+
"body": "<!DOCTYPE html>\n<html>\n<head><title>Dashboard</title></head>\n<body>\n<aap:target id=\"stats\">\n<div class=\"stats\">\n <div class=\"stat\"><span class=\"label\">Revenue</span><aap:target id=\"revenue-value\"><span class=\"stat-value\">$12,340</span></aap:target></div>\n <div class=\"stat\"><span class=\"label\">Users</span><aap:target id=\"user-count\"><span class=\"stat-value\">1,205</span></aap:target></div>\n</div>\n</aap:target>\n<aap:target id=\"users-table\">\n<table>\n <tr><th>Name</th><th>Email</th><th>Role</th></tr>\n <tr><td>Alice</td><td>alice@example.com</td><td>Admin</td></tr>\n <tr><td>Bob</td><td>bob@example.com</td><td>User</td></tr>\n</table>\n</aap:target>\n<aap:target id=\"orders-table\">\n<table>\n <tr><th>Order</th><th>Product</th><th>Amount</th></tr>\n <tr><td>#001</td><td>Widget</td><td>$29.99</td></tr>\n</table>\n</aap:target>\n</body>\n</html>"
13+
}
14+
]
15+
}

spec/examples/template-fill.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)