@henryqw/pi-subagent 18.0.1 → 22.0.1

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.
Files changed (47) hide show
  1. package/CONTEXT.md +76 -24
  2. package/README.md +116 -142
  3. package/dist/composition.d.ts +11 -0
  4. package/dist/composition.js +107 -0
  5. package/dist/direct-herdr.d.ts +17 -0
  6. package/dist/direct-herdr.js +219 -0
  7. package/dist/ephemeral.d.ts +2 -2
  8. package/dist/ephemeral.js +7 -7
  9. package/dist/git-runtime.d.ts +110 -0
  10. package/dist/git-runtime.js +472 -0
  11. package/dist/herdr-runtime.d.ts +137 -0
  12. package/dist/herdr-runtime.js +1228 -0
  13. package/dist/index.d.ts +11 -5
  14. package/dist/index.js +20 -16
  15. package/dist/integration-git.d.ts +59 -0
  16. package/dist/integration-git.js +484 -0
  17. package/dist/launch-runtime.d.ts +54 -0
  18. package/dist/launch-runtime.js +195 -0
  19. package/dist/process.d.ts +9 -0
  20. package/dist/process.js +11 -0
  21. package/dist/runner.d.ts +356 -0
  22. package/dist/runner.js +2710 -0
  23. package/dist/schema.d.ts +2234 -0
  24. package/dist/schema.js +1236 -0
  25. package/dist/store.d.ts +50 -0
  26. package/dist/store.js +288 -0
  27. package/dist/working-evidence.d.ts +25 -0
  28. package/dist/working-evidence.js +261 -0
  29. package/docs/adr/001-composable-ephemeral-execution.md +3 -3
  30. package/docs/delegation-routing.html +89 -0
  31. package/docs/delegation-routing.svg +78 -0
  32. package/docs/orchestration-architecture.html +238 -0
  33. package/docs/orchestration-architecture.svg +189 -0
  34. package/docs/orchestration.md +122 -331
  35. package/example.png +0 -0
  36. package/examples/roles/implementer.md +2 -3
  37. package/extensions/admission.ts +66 -0
  38. package/extensions/config.ts +51 -37
  39. package/extensions/isolated.ts +638 -0
  40. package/extensions/result-transport.ts +13 -103
  41. package/extensions/role-tools.ts +11 -11
  42. package/extensions/subagent-command.ts +167 -0
  43. package/extensions/subagent.ts +264 -540
  44. package/extensions/task-name.ts +1 -2
  45. package/extensions/workflow.ts +60 -96
  46. package/package.json +14 -6
  47. package/skills/pi-subagent/SKILL.md +35 -0
@@ -0,0 +1,189 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="1280" height="720" viewBox="0 0 1280 720" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="orchestration-architecture-title orchestration-architecture-desc">
3
+ <title id="orchestration-architecture-title">Pi Subagent checked execution architecture</title>
4
+ <desc id="orchestration-architecture-desc">Architecture diagram showing Pi Main resolving each task-selected Role just in time, returning bounded text to durable state, and sending changesets through isolated Herdr work, direct checks, optional judgment, and guarded Main integration.</desc>
5
+ <defs>
6
+ <style>
7
+ .zone { fill: #e6e4de; stroke: #101828; stroke-opacity: .141; stroke-width: 1; }
8
+ .zone-protected { fill: #1d4ed8; fill-opacity: .05; stroke: #1d4ed8; stroke-opacity: .50; stroke-width: 1; stroke-dasharray: 4 4; }
9
+ .zone-label { fill: #6a7282; font: 500 8px 'Geist Mono', monospace; letter-spacing: .16em; }
10
+ .node-mask { fill: #f0eee9; }
11
+ .node { fill: #ffffff; stroke: #101828; stroke-width: 1; }
12
+ .node-input { fill: #4c5665; fill-opacity: .10; stroke: #6a7282; stroke-width: 1; }
13
+ .node-store { fill: #101828; fill-opacity: .05; stroke: #4c5665; stroke-width: 1; }
14
+ .node-focal { fill: #1d4ed8; fill-opacity: .08; stroke: #1d4ed8; stroke-width: 1.2; }
15
+ .tag { fill: none; stroke: #101828; stroke-opacity: .34; stroke-width: .8; }
16
+ .tag-focal { fill: none; stroke: #1d4ed8; stroke-opacity: .55; stroke-width: .8; }
17
+ .tag-text { fill: #6a7282; font: 500 8px 'Geist Mono', monospace; letter-spacing: .08em; text-anchor: middle; }
18
+ .tag-text-focal { fill: #1d4ed8; font: 500 8px 'Geist Mono', monospace; letter-spacing: .08em; text-anchor: middle; }
19
+ .name { fill: #101828; font: 600 12px 'Geist', sans-serif; text-anchor: middle; }
20
+ .sub { fill: #4c5665; font: 400 8px 'Geist Mono', monospace; text-anchor: middle; }
21
+ .edge { fill: none; stroke: #4c5665; stroke-width: 1.2; marker-end: url(#arrow); }
22
+ .edge-approved { fill: none; stroke: #1d4ed8; stroke-width: 1.2; marker-end: url(#arrow-accent); }
23
+ .edge-audit { fill: none; stroke: #4c5665; stroke-width: 1; stroke-dasharray: 5 4; marker-end: url(#arrow); }
24
+ .edge-blocked { fill: none; stroke: #6a7282; stroke-width: 1; stroke-dasharray: 5 4; }
25
+ .label-mask { fill: #f0eee9; }
26
+ .label { fill: #4c5665; font: 500 8px 'Geist Mono', monospace; letter-spacing: .04em; text-anchor: middle; }
27
+ .label-approved { fill: #1d4ed8; font: 500 8px 'Geist Mono', monospace; letter-spacing: .04em; text-anchor: middle; }
28
+ .stop { fill: #f0eee9; stroke: #6a7282; stroke-width: 1.2; }
29
+ .stop-mark { stroke: #6a7282; stroke-width: 1.2; }
30
+ .legend { fill: #101828; font: 400 12px 'Geist', sans-serif; }
31
+ .legend-label { fill: #6a7282; font: 500 8px 'Geist Mono', monospace; letter-spacing: .16em; }
32
+ </style>
33
+ <marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
34
+ <polygon points="0 0,8 3,0 6" fill="#4c5665"/>
35
+ </marker>
36
+ <marker id="arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
37
+ <polygon points="0 0,8 3,0 6" fill="#1d4ed8"/>
38
+ </marker>
39
+ <marker id="arrow-link" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
40
+ <polygon points="0 0,8 3,0 6" fill="#1d4ed8"/>
41
+ </marker>
42
+ </defs>
43
+
44
+ <rect width="1280" height="720" fill="#f0eee9"/>
45
+
46
+ <!-- Trust zones -->
47
+ <rect class="zone" x="248" y="96" width="344" height="448" rx="8"/>
48
+ <rect class="label-mask" x="260" y="100" width="152" height="16" rx="2"/>
49
+ <text class="zone-label" x="268" y="112">MAIN CONTROL PLANE</text>
50
+
51
+ <rect class="zone" x="624" y="96" width="304" height="448" rx="8"/>
52
+ <rect class="label-mask" x="636" y="100" width="164" height="16" rx="2"/>
53
+ <text class="zone-label" x="644" y="112">TASK EXECUTION CHANNELS</text>
54
+
55
+ <rect class="zone-protected" x="960" y="96" width="280" height="472" rx="8"/>
56
+ <rect class="label-mask" x="972" y="100" width="196" height="16" rx="2"/>
57
+ <text class="zone-label" x="980" y="112">PROTECTED MAIN REPOSITORY</text>
58
+
59
+ <!-- Approved and audit paths -->
60
+ <line class="edge" x1="216" y1="216" x2="280" y2="216"/>
61
+ <line class="edge" x1="560" y1="216" x2="656" y2="216"/>
62
+ <line class="edge" x1="420" y1="272" x2="420" y2="400"/>
63
+ <line class="edge" x1="776" y1="272" x2="776" y2="336"/>
64
+ <line class="edge-approved" x1="776" y1="448" x2="776" y2="472"/>
65
+ <line class="edge-audit" x1="656" y1="424" x2="560" y2="424"/>
66
+ <line class="edge-approved" x1="896" y1="516" x2="992" y2="516"/>
67
+ <path class="edge-audit" d="M1068 560 V584 Q1068 592 1060 592 H428 Q420 592 420 584 V512"/>
68
+
69
+ <!-- Forbidden routes stop before crossing -->
70
+ <path class="edge-blocked" d="M704 272 V296 Q704 304 696 304 H624"/>
71
+ <circle class="stop" cx="624" cy="304" r="8"/>
72
+ <line class="stop-mark" x1="620" y1="300" x2="628" y2="308"/>
73
+ <line class="stop-mark" x1="628" y1="300" x2="620" y2="308"/>
74
+
75
+ <line class="edge-blocked" x1="896" y1="420" x2="952" y2="420"/>
76
+ <circle class="stop" cx="952" cy="420" r="8"/>
77
+ <line class="stop-mark" x1="948" y1="416" x2="956" y2="424"/>
78
+ <line class="stop-mark" x1="956" y1="416" x2="948" y2="424"/>
79
+
80
+ <!-- Connector labels -->
81
+ <rect class="label-mask" x="220" y="196" width="56" height="12" rx="2"/>
82
+ <text class="label" x="248" y="204">EXECUTE</text>
83
+
84
+ <rect class="label-mask" x="580" y="196" width="56" height="12" rx="2"/>
85
+ <text class="label" x="608" y="204">LAUNCH</text>
86
+
87
+ <rect class="label-mask" x="428" y="324" width="72" height="12" rx="2"/>
88
+ <text class="label" x="464" y="332">CHECKPOINT</text>
89
+
90
+ <rect class="label-mask" x="784" y="296" width="72" height="12" rx="2"/>
91
+ <text class="label" x="820" y="304">DISPATCH</text>
92
+
93
+ <rect class="label-mask" x="788" y="452" width="72" height="12" rx="2"/>
94
+ <text class="label-approved" x="824" y="460">CHANGESET</text>
95
+
96
+ <rect class="label-mask" x="572" y="400" width="72" height="12" rx="2"/>
97
+ <text class="label" x="608" y="408">TEXT RESULT</text>
98
+
99
+ <rect class="label-mask" x="916" y="496" width="56" height="12" rx="2"/>
100
+ <text class="label-approved" x="944" y="504">VERIFY</text>
101
+
102
+ <rect class="label-mask" x="628" y="284" width="96" height="12" rx="2"/>
103
+ <text class="label" x="676" y="292">NO CONTROL API</text>
104
+
105
+ <rect class="label-mask" x="900" y="400" width="48" height="12" rx="2"/>
106
+ <text class="label" x="924" y="408">NO BYPASS</text>
107
+
108
+ <rect class="label-mask" x="696" y="572" width="80" height="12" rx="2"/>
109
+ <text class="label" x="736" y="580">AUDIT RESULT</text>
110
+
111
+ <!-- Opaque node masks -->
112
+ <rect class="node-mask" x="40" y="160" width="176" height="112" rx="6"/>
113
+ <rect class="node-mask" x="280" y="160" width="280" height="112" rx="6"/>
114
+ <rect class="node-mask" x="280" y="400" width="280" height="112" rx="6"/>
115
+ <rect class="node-mask" x="656" y="160" width="240" height="112" rx="6"/>
116
+ <rect class="node-mask" x="656" y="336" width="240" height="112" rx="6"/>
117
+ <rect class="node-mask" x="656" y="472" width="240" height="72" rx="6"/>
118
+ <rect class="node-mask" x="992" y="472" width="216" height="88" rx="6"/>
119
+
120
+ <!-- Request -->
121
+ <rect class="node-input" x="40" y="160" width="176" height="112" rx="6"/>
122
+ <rect class="tag" x="52" y="172" width="40" height="16" rx="2"/>
123
+ <text class="tag-text" x="72" y="184">INPUT</text>
124
+ <text class="name" x="128" y="216">Checked request</text>
125
+ <text class="sub" x="128" y="240">TASK DAG · CHECKS · BUDGET</text>
126
+
127
+ <!-- Main control plane -->
128
+ <rect class="node-focal" x="280" y="160" width="280" height="112" rx="6"/>
129
+ <rect class="tag-focal" x="292" y="172" width="40" height="16" rx="2"/>
130
+ <text class="tag-text-focal" x="312" y="184">MAIN</text>
131
+ <text class="name" x="420" y="212">Pi Subagent</text>
132
+ <text class="sub" x="420" y="236">PREFLIGHTS ROLE + MODEL PAIRS</text>
133
+ <text class="sub" x="420" y="252">RESOLVES AGAIN AT LAUNCH</text>
134
+
135
+ <rect class="node-store" x="280" y="400" width="280" height="112" rx="6"/>
136
+ <rect class="tag" x="292" y="412" width="48" height="16" rx="2"/>
137
+ <text class="tag-text" x="316" y="424">AUDIT</text>
138
+ <text class="name" x="420" y="452">Durable request state</text>
139
+ <text class="sub" x="420" y="476">CONFIG/PI-SUBAGENT/STATE</text>
140
+ <text class="sub" x="420" y="492">STRICT SCHEMA · RECOVERY EVIDENCE</text>
141
+
142
+ <!-- Task-selected Role and execution channels -->
143
+ <rect class="node" x="656" y="160" width="240" height="112" rx="6"/>
144
+ <rect class="tag" x="668" y="172" width="40" height="16" rx="2"/>
145
+ <text class="tag-text" x="688" y="184">ROLE</text>
146
+ <text class="name" x="776" y="212">Current configured Role</text>
147
+ <text class="sub" x="776" y="236">TASK-SELECTED · RESOLVED JIT</text>
148
+ <text class="sub" x="776" y="252">TOOLS · SKILLS · MCP POLICY</text>
149
+
150
+ <rect class="node-store" x="656" y="336" width="240" height="112" rx="6"/>
151
+ <rect class="tag" x="668" y="348" width="56" height="16" rx="2"/>
152
+ <text class="tag-text" x="696" y="360">CHANNEL</text>
153
+ <text class="name" x="776" y="388">Text or changeset execution</text>
154
+ <text class="sub" x="776" y="412">BOUNDED TEXT · ISOLATED HERDR</text>
155
+ <text class="sub" x="776" y="428">MAIN DRIFT FAILS CLOSED</text>
156
+
157
+ <!-- Live-worker changeset gate -->
158
+ <rect class="node" x="656" y="472" width="240" height="72" rx="6"/>
159
+ <rect class="tag" x="668" y="484" width="40" height="16" rx="2"/>
160
+ <text class="tag-text" x="688" y="496">CHECK</text>
161
+ <text class="name" x="776" y="508">Changeset checks + judgment</text>
162
+ <text class="sub" x="776" y="528">LIVE WORKER · REBASE · EXACT PATCH</text>
163
+
164
+ <!-- Protected Main repository -->
165
+ <rect class="node-focal" x="992" y="472" width="216" height="88" rx="6"/>
166
+ <rect class="tag-focal" x="1004" y="484" width="40" height="16" rx="2"/>
167
+ <text class="tag-text-focal" x="1024" y="496">GATE</text>
168
+ <text class="name" x="1100" y="520">Guarded Main integration</text>
169
+ <text class="sub" x="1100" y="544">IDENTITY FENCE · DECLARED ORDER</text>
170
+
171
+ <!-- Legend -->
172
+ <line x1="40" y1="640" x2="1240" y2="640" stroke="#101828" stroke-opacity=".141" stroke-width=".8"/>
173
+ <text class="legend-label" x="40" y="672">LEGEND</text>
174
+
175
+ <line class="edge-approved" x1="136" y1="668" x2="184" y2="668"/>
176
+ <text class="legend" x="200" y="672">approved checked path</text>
177
+
178
+ <line class="edge-audit" x1="396" y1="668" x2="444" y2="668"/>
179
+ <text class="legend" x="460" y="672">durable audit record</text>
180
+
181
+ <line class="edge-blocked" x1="660" y1="668" x2="700" y2="668"/>
182
+ <circle class="stop" cx="708" cy="668" r="8"/>
183
+ <line class="stop-mark" x1="704" y1="664" x2="712" y2="672"/>
184
+ <line class="stop-mark" x1="712" y1="664" x2="704" y2="672"/>
185
+ <text class="legend" x="728" y="672">blocked before boundary</text>
186
+
187
+ <rect class="zone-protected" x="988" y="660" width="32" height="16" rx="4"/>
188
+ <text class="legend" x="1036" y="672">trust boundary</text>
189
+ </svg>