repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

feat(ultra): show workflow progress and prompts

f97aa02de0e876d1c1bdfac24f193c4bd54e0835

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (21)

extensions/ultra/README.md

Modified
8 8 ## Two surfaces
10 10 - **`/ultra <name> [args]`** — interactive command. Runs a saved workflow behind a
11 - live overlay: a per-agent board, `Tab`/`↑↓` to focus an agent and drill into its
12 - streaming transcript, steer a running sub-agent, and `Esc` to abort.
11 + phase-first live overlay with keyboard phase toggling, agent focus, streaming
12 + transcripts, steering, targeted abort, and confirmed whole-run abort.
13 13 - **`/ultra runs`** — browse, inspect, resume, stop, or delete saved runs.
14 14 - **`/ultra <instructions>`** — injects the authoring prompt, enables the hidden
15 15 `workflow` tool, and starts an agent turn to design or run a workflow.
42 42 ### Where workflows live
44 44 Discovery merges three locations, lowest-to-highest precedence (a later source
45 -overrides a bundled name):
45 +overrides a bundled name).
46 +Workflow files are rescanned on every completion or invocation, so newly saved JSON works immediately without `/reload`.
47 48 1. **bundled** — `extensions/ultra/workflows/*.json` (ships with ultra)
48 49 2. **global** — `~/.pi/agent/workflows/*.json`
75 76 If a run is aborted, the next matching run on the same session branch reuses completed steps and runs the missing or changed steps.
76 77 A completed run appends a completion marker, so later runs start fresh.
78 -Expanded workflow tool output renders every phase from the start and each known sub-agent as a multiline block.
79 -The tool header shows total workflow wall time while running and freezes it at completion.
79 +Both progress surfaces use the same phase-first hierarchy, authored step summaries, status language, icons, elapsed time, counts, checkpoint state, token usage, and cost.
80 +The overlay also shows each exact resolved sub-agent prompt as the first user message in its transcript.
81 +Collapsed workflow tool output remains counts-only with Pi's standard expand hint.
82 +Expanded tool output summarizes every phase, automatically opens the active and failed phases, shows their agents, and ends with the human-readable workflow outcome.
83 +The command overlay uses the same board, automatically collapses completed phases, and adds keyboard interaction.
84 +Use `↑`/`↓` to focus visible phase or agent rows, `Enter` to toggle a phase, and `Tab` to cycle visible agents.
85 +Use `Alt+↑`/`Alt+↓` to scroll the focused transcript, `s` to steer, and `x` to abort the focused agent.
86 +Aborting the whole run requires two `Esc` presses within 1.5 seconds.
80 87 Known agents appear queued before launch; dynamic fan-outs show `agents not planned yet`; conditional phases show `conditional` until their selectors resolve.
81 -Rows then transition through queued, running, done, dropped, or skipped without disappearing.
82 -Verified Nerd Font icons reinforce each state while text labels preserve meaning without glyph support.
83 -Configured tiers are shown as `tier → provider/model`; collapsed output remains counts-only.
88 +Rows transition through queued, running, done, dropped, or skipped without disappearing from their phase summary.
89 +Configured tiers are shown as `tier → provider/model`.
85 91 Workflow results include aggregate token and cost usage from completed sub-agent turns when the provider reports it.
86 92 The final JSON contains `tokenUsage` with `input`, `output`, `total`, `cacheRead`, `cacheWrite`, and `cost`.

extensions/ultra/__tests__/engine.test.ts

Modified
98 98 value: { said: args.step.prompt },
100 100 const s = spec({
101 - phases: [{ id: "judge", kind: "single", step: { prompt: "hello" } }],
101 + phases: [
103 + id: "judge",
104 + kind: "single",
105 + step: { summary: "hello", prompt: "hello" },
106 + },
107 + ],
104 110 const res = await runWorkflow(
127 133 id: "f",
128 134 kind: "fanout",
129 135 over: ["x", "y", "z"],
130 - step: { prompt: "{item}" },
136 + step: { summary: "{item}", prompt: "{item}" },
162 168 const s = spec({
163 169 phases: [
164 - { id: "one", kind: "single", step: { prompt: "one" } },
170 + { id: "one", kind: "single", step: { summary: "one", prompt: "one" } },
166 172 id: "literal",
167 173 kind: "fanout",
168 174 over: ["a", "b"],
169 - step: { prompt: "{item}" },
175 + step: { summary: "{item}", prompt: "{item}" },
172 178 id: "dynamic",
173 179 kind: "fanout",
174 180 over: "{one.results}",
175 - step: { prompt: "{item}" },
181 + step: { summary: "{item}", prompt: "{item}" },
178 184 id: "conditional",
179 185 kind: "single",
180 186 when: "{args.enabled}",
181 - step: { prompt: "conditional" },
187 + step: { summary: "conditional", prompt: "conditional" },
182 188 } as Phase,
244 250 await runWorkflow(
245 251 spec({
246 252 phases: [
247 - { id: "empty", kind: "fanout", over: [], step: { prompt: "x" } },
254 + id: "empty",
255 + kind: "fanout",
256 + over: [],
257 + step: { summary: "x", prompt: "x" },
258 + },
250 261 undefined,
287 298 id: "conditional",
288 299 kind: "single",
289 300 when: "{args.enabled}",
290 - step: { prompt: "must not run" },
301 + step: { summary: "must not run", prompt: "must not run" },
291 302 } as Phase,
293 304 id: "after",
294 305 kind: "single",
295 - step: { prompt: "saw {conditional.results}" },
306 + step: {
307 + summary: "saw {conditional.results}",
308 + prompt: "saw {conditional.results}",
309 + },
328 342 id: "work",
329 343 kind: "fanout",
330 344 over: ["good", "bad"],
331 - step: { prompt: "work {item}" },
345 + step: { summary: "work {item}", prompt: "work {item}" },
334 348 id: "recover",
335 349 kind: "fanout",
336 350 when: "{work.failures}",
337 351 over: "{work.failures}",
338 - step: { prompt: "repair {item}" },
352 + step: { summary: "repair {item}", prompt: "repair {item}" },
360 374 id: "conditional",
361 375 kind: "single",
362 376 when: "{args.enabled}",
363 - step: { prompt: "run" },
377 + step: { summary: "run", prompt: "run" },
364 378 } as Phase,
412 426 // ---------------------------------------------------------------------------
414 428 describe("runWorkflow — interpolation", () => {
415 - it("resolves {item} and {args.NAME} in the prompt before calling the runner", async () => {
429 + it("resolves the summary and prompt before publishing and running each agent", async () => {
430 + const events: UltraProgressEvent[] = [];
416 431 const fr = fakeRunner((args) => ({ ok: true, value: args.step.prompt }));
417 432 const s = spec({
418 433 phases: [
420 435 id: "p",
421 436 kind: "fanout",
422 437 over: ["a", "b"],
423 - step: { prompt: "do {item} for {args.who}" },
438 + step: {
439 + summary: "do {item} for {args.who}",
440 + prompt: "do {item} for {args.who}",
441 + },
428 - await runWorkflow(s, { who: "alice" }, baseDeps({ stepRunner: fr.runner }));
446 + await runWorkflow(
447 + s,
448 + { who: "alice" },
449 + baseDeps({
450 + stepRunner: fr.runner,
451 + onProgress: (event) => events.push(event),
452 + }),
453 + );
430 455 const prompts = fr.calls.map((c) => c.step.prompt).sort();
431 456 expect(prompts).toEqual(["do a for alice", "do b for alice"]);
457 + expect(events).toContainEqual(
458 + expect.objectContaining({
459 + agentId: "p#0",
460 + kind: "prompt",
461 + summary: "do a for alice",
462 + prompt: "do a for alice",
463 + }),
464 + );
434 467 it("fanout over a prior phase's flattened findings, filtering by `where real`, retaining the join key", async () => {
458 491 id: "review",
459 492 kind: "fanout",
460 493 over: ["correctness", "security"],
461 - step: { prompt: "review {item}" },
494 + step: { summary: "review {item}", prompt: "review {item}" },
464 497 id: "verify",
465 498 kind: "fanout",
466 499 over: "{review.results[].findings[]}",
467 - step: { prompt: "verify {item}" },
500 + step: { summary: "verify {item}", prompt: "verify {item}" },
494 527 id: "work",
495 528 kind: "fanout",
496 529 over: ["task"],
497 - step: { prompt: "{item}" },
530 + step: { summary: "{item}", prompt: "{item}" },
525 558 id: "p",
526 559 kind: "fanout",
527 560 over: [0, 1, 2],
528 - step: { prompt: "{item}" },
561 + step: { summary: "{item}", prompt: "{item}" },
556 589 id: "f",
557 590 kind: "fanout",
558 591 over: [1, 2, 3, 4, 5, 6],
559 - step: { prompt: "x" },
592 + step: { summary: "x", prompt: "x" },
583 616 kind: "fanout",
584 617 over: [1, 2, 3, 4],
585 618 concurrency: 1,
586 - step: { prompt: "x" },
619 + step: { summary: "x", prompt: "x" },
609 642 const s = spec({
610 643 return: "{p.results}",
611 644 phases: [
612 - { id: "p", kind: "fanout", over: ["a"], step: { prompt: "do {item}" } },
646 + id: "p",
647 + kind: "fanout",
648 + over: ["a"],
649 + step: { summary: "do {item}", prompt: "do {item}" },
650 + },
615 653 const first = fakeRunner(() => ({ ok: true, value: "live-a" }));
648 686 id: "p",
649 687 kind: "fanout",
650 688 over: ["a", "b"],
651 - step: { prompt: "do {item}" },
689 + step: { summary: "do {item}", prompt: "do {item}" },
706 744 id: "f",
707 745 kind: "fanout",
708 746 over: ["ok1", "bad", "ok2"],
709 - step: { prompt: "{item}" },
747 + step: { summary: "{item}", prompt: "{item}" },
749 787 const s = spec({
750 788 return: "{b.results}",
751 789 phases: [
752 - { id: "a", kind: "fanout", over: [1, 2], step: { prompt: "{item}" } },
753 - { id: "b", kind: "single", step: { prompt: "after a" } },
791 + id: "a",
792 + kind: "fanout",
793 + over: [1, 2],
794 + step: { summary: "{item}", prompt: "{item}" },
795 + },
797 + id: "b",
798 + kind: "single",
799 + step: { summary: "after a", prompt: "after a" },
800 + },
785 832 id: "f",
786 833 kind: "fanout",
787 834 over: [0, 1, 2, 3, 4, 5],
788 - step: { prompt: "{item}" },
835 + step: { summary: "{item}", prompt: "{item}" },
826 873 const fr = fakeRunner(() => ({ ok: true, value: 1 }));
827 874 const s = spec({
828 875 phases: [
829 - { id: "f", kind: "fanout", over: [1, 2, 3], step: { prompt: "x" } },
877 + id: "f",
878 + kind: "fanout",
879 + over: [1, 2, 3],
880 + step: { summary: "x", prompt: "x" },
881 + },
876 928 id: "review",
877 929 kind: "fanout",
878 930 over: ["kept", "drop"],
879 - step: { prompt: "review {item}" },
931 + step: { summary: "review {item}", prompt: "review {item}" },
882 934 id: "verify",
883 935 kind: "fanout",
884 936 over: "{review.results[].findings[]}",
885 - step: { prompt: "verify {item}" },
937 + step: { summary: "verify {item}", prompt: "verify {item}" },
928 980 name: "demo",
929 981 return: "{p.results}",
930 982 phases: [
931 - { id: "p", kind: "fanout", over: ["a"], step: { prompt: "{item}" } },
984 + id: "p",
985 + kind: "fanout",
986 + over: ["a"],
987 + step: { summary: "{item}", prompt: "{item}" },
988 + },
992 1049 const s = spec({
993 1050 phases: [
994 - { id: "scan", kind: "fanout", over: ["x"], step: { prompt: "{item}" } },
1052 + id: "scan",
1053 + kind: "fanout",
1054 + over: ["x"],
1055 + step: { summary: "{item}", prompt: "{item}" },
1056 + },
1034 1096 const s = spec({
1035 - phases: [{ id: "p", kind: "single", step: { prompt: "go" } }],
1097 + phases: [
1098 + { id: "p", kind: "single", step: { summary: "go", prompt: "go" } },
1099 + ],
1038 1102 const res = await runWorkflow(
1048 1112 it("leaves steered false when no steer occurs", async () => {
1049 1113 const fr = fakeRunner(() => ({ ok: true, value: 1 }));
1050 1114 const s = spec({
1051 - phases: [{ id: "p", kind: "single", step: { prompt: "go" } }],
1115 + phases: [
1116 + { id: "p", kind: "single", step: { summary: "go", prompt: "go" } },
1117 + ],
1054 1120 const res = await runWorkflow(

extensions/ultra/__tests__/harness.test.ts

Modified
1 -import { readFileSync } from "node:fs";
1 +import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
2 +import { join } from "node:path";
2 3 import { fileURLToPath } from "node:url";
3 4 import {
4 5 createTestSession,
51 + it("discovers a workflow saved after the extension loaded without /reload", async () => {
52 + t = await createTestSession({ extensions: [ultraPath()] });
53 + const [extension] = t.session.extensionRunner.extensions;
54 + const complete = () =>
55 + extension.commands.get("ultra").getArgumentCompletions("");
56 + await complete();
58 + const previousCwd = process.cwd();
59 + try {
60 + process.chdir(t.cwd);
61 + const directory = join(t.cwd, ".pi", "workflows");
62 + mkdirSync(directory, { recursive: true });
63 + writeFileSync(
64 + join(directory, "fresh.json"),
65 + `${JSON.stringify({
66 + name: "fresh",
67 + phases: [
68 + { id: "p", kind: "single", step: { summary: "hi", prompt: "hi" } },
69 + ],
70 + })}\n`,
71 + );
73 + const items = await complete();
74 + expect(items.map((item: { value: string }) => item.value)).toContain(
75 + "fresh",
76 + );
77 + } finally {
78 + process.chdir(previousCwd);
79 + }
80 + });
50 82 it("exposes the runtime workflow schema to tool callers", async () => {
51 83 t = await createTestSession({ extensions: [ultraPath()] });
52 84 const [extension] = t.session.extensionRunner.extensions;
53 85 const tool = extension.tools.get("workflow").definition;
54 86 const specSchema = tool.parameters.properties.spec;
87 + const stepSchema =
88 + specSchema.properties.phases.items.anyOf[0].properties.step;
56 90 expect(tool.description).toContain(
57 91 "schema strings must exactly name top-level schemas",
59 93 expect(tool.description).toContain(
60 94 "interpolation uses only the closed grammar",
96 + expect(stepSchema.required).toContain("summary");
97 + expect(stepSchema.properties.summary.description).toContain("progress-UI");
62 98 expect(JSON.parse(JSON.stringify(specSchema))).toEqual(
63 99 JSON.parse(JSON.stringify(WorkflowSpecSchema)),

extensions/ultra/__tests__/journal.test.ts

Modified
14 14 const spec = (name = "wf"): WorkflowSpec => ({
15 15 name,
16 - phases: [{ id: "p", kind: "single", step: { prompt: "hi" } }],
16 + phases: [{ id: "p", kind: "single", step: { summary: "hi", prompt: "hi" } }],
19 19 function tempHome(): string {

extensions/ultra/__tests__/progress.test.ts

Modified
198 + it("stores the resolved summary and prompt without starting the queued agent", () => {
199 + let state = reduceProgress(initialReducerState(), {
200 + kind: "plan",
201 + startedAt: 1000,
202 + phases: [{ phase: "review", status: "resolved", agentIds: ["review#0"] }],
203 + } as UltraProgressEvent);
204 + state = reduceProgress(
205 + state,
206 + pe({
207 + agentId: "review#0",
208 + phase: "review",
209 + kind: "prompt",
210 + summary: "Review security",
211 + prompt: "Inspect every authentication path.",
212 + }),
213 + );
215 + expect(state.rows[0]).toMatchObject({
216 + status: "queued",
217 + summary: "Review security",
218 + prompt: "Inspect every authentication path.",
219 + });
220 + expect(state.transcriptItems["review#0"]).toEqual([
221 + { kind: "user", text: "Inspect every authentication path." },
222 + ]);
223 + });
198 225 it("starts wall time with the plan and freezes it when every phase settles", () => {
199 226 vi.useFakeTimers();

extensions/ultra/__tests__/prompt.test.ts

Modified
51 + it("requires authored progress summaries beside exact prompts", () => {
52 + const prompt = fs.readFileSync(PROMPT_PATH, "utf8");
53 + const reference = fs.readFileSync(SPEC_FORMAT_PATH, "utf8");
54 + const schema = JSON.stringify(WorkflowSpecSchema);
56 + expect(prompt).toContain("every step has a short `summary`");
57 + expect(reference).toContain("exact resolved `prompt`");
58 + expect(schema).toContain("progress-UI sentence");
59 + });
51 61 it("keeps the exact interpolation grammar synchronized", () => {
52 62 const prompt = fs.readFileSync(PROMPT_PATH, "utf8");
53 63 expect(prompt).toContain("{EXPR | where FIELD}");

extensions/ultra/__tests__/runner.test.ts

Modified
35 35 additionalProperties: false,
36 36 } as const;
38 -const toollessStep: Step = { prompt: "do X", schema: VERDICT_SCHEMA };
38 +const toollessStep: Step = {
39 + summary: "Do X",
40 + prompt: "do X",
41 + schema: VERDICT_SCHEMA,
42 +};
39 43 const toolStep: Step = {
44 + summary: "Do X",
40 45 prompt: "do X",
41 46 tools: ["read", "grep"],
42 47 schema: VERDICT_SCHEMA,
662 667 const drivers = makeDrivers({ sessionFactory: harness.factory });
664 669 const recursiveStep: Step = {
670 + summary: "Do X",
665 671 prompt: "do X",
666 672 tools: ["read", "workflow"],
667 673 schema: VERDICT_SCHEMA,

extensions/ultra/__tests__/spec.test.ts

Modified
52 52 kind: "fanout",
53 53 over: ["correctness", "security", "performance"],
54 54 step: {
55 + summary: "Review diff for {item} issues",
55 56 prompt:
56 57 "Review the working diff for {item} issues. Return JSON matching Findings.",
57 58 tools: ["read", "bash", "grep", "find", "ls"],
63 64 kind: "fanout",
64 65 over: "{review.results[].findings[]}",
65 66 step: {
67 + summary: "Verify one finding",
66 68 prompt:
67 69 "Adversarially try to refute this finding.\n\nFinding: {item}",
68 70 schema: "Verdict",
87 89 expect(parsed.name).toBe("review");
92 + it("requires a progress summary for every step", () => {
93 + const spec = validSpec();
94 + delete spec.phases[0].step.summary;
95 + expect(() => parseWorkflow(spec)).toThrow(/summary/i);
96 + });
90 98 it("accepts optional phase `when` selectors", () => {
91 99 const s = validSpec();
92 100 s.phases = [
94 102 id: "only",
95 103 kind: "single",
96 104 when: "{args.enabled}",
97 - step: { prompt: "go" },
105 + step: { summary: "go", prompt: "go" },
100 108 expect(parseWorkflow(s).phases[0].when).toBe("{args.enabled}");
109 117 it("accepts a single phase without `over`", () => {
110 118 const s = validSpec();
111 - s.phases = [{ id: "only", kind: "single", step: { prompt: "go" } }];
119 + s.phases = [
120 + { id: "only", kind: "single", step: { summary: "go", prompt: "go" } },
121 + ];
112 122 expect(() => parseWorkflow(s)).not.toThrow();
260 270 path.join(projWf, "foo.json"),
261 271 JSON.stringify({
262 272 name: "foo",
263 - phases: [{ id: "p", kind: "single", step: { prompt: "from-project" } }],
273 + phases: [
275 + id: "p",
276 + kind: "single",
277 + step: { summary: "from-project", prompt: "from-project" },
278 + },
279 + ],
266 282 fs.writeFileSync(
267 283 path.join(globalWf, "foo.json"),
268 284 JSON.stringify({
269 285 name: "foo",
270 - phases: [{ id: "p", kind: "single", step: { prompt: "from-global" } }],
286 + phases: [
288 + id: "p",
289 + kind: "single",
290 + step: { summary: "from-global", prompt: "from-global" },
291 + },
292 + ],
273 295 // `bar` only in global.
275 297 path.join(globalWf, "bar.json"),
276 298 JSON.stringify({
277 299 name: "bar",
278 - phases: [{ id: "p", kind: "single", step: { prompt: "x" } }],
300 + phases: [
301 + { id: "p", kind: "single", step: { summary: "x", prompt: "x" } },
302 + ],

extensions/ultra/__tests__/ui.test.ts

Modified
180 - it("renders the complete icon-led planned-work vocabulary in phase order", () => {
180 + it("uses phase-first disclosure: completed and future phases collapse while active and failed phases open", () => {
181 181 const s = stateFrom([
183 183 kind: "plan",
184 184 startedAt: Date.now(),
185 185 phases: [
186 186 { phase: "done", status: "resolved", agentIds: ["done#0"] },
187 - { phase: "active", status: "resolved", agentIds: ["active#0"] },
188 + phase: "active",
189 + status: "resolved",
190 + agentIds: ["active#0", "active#1"],
191 + },
188 192 { phase: "queued", status: "resolved", agentIds: ["queued#0"] },
189 193 { phase: "verify", status: "agents-pending", agentIds: [] },
192 196 status: "condition-pending",
193 197 agentIds: [],
195 - { phase: "skip", status: "skipped", agentIds: [] },
196 - { phase: "failed", status: "resolved", agentIds: ["failed#0"] },
198 200 } as unknown as UltraProgressEvent,
199 201 pe({ agentId: "done#0", phase: "done", kind: "start" }),
200 202 pe({ agentId: "done#0", phase: "done", kind: "end", status: "done" }),
204 + kind: "phase",
205 + phase: "done",
206 + status: "done",
207 + agentIds: ["done#0"],
208 + } as UltraProgressEvent,
201 209 pe({ agentId: "active#0", phase: "active", kind: "start" }),
202 - pe({ agentId: "failed#0", phase: "failed", kind: "start" }),
204 - agentId: "failed#0",
205 - phase: "failed",
211 + agentId: "active#1",
212 + phase: "active",
206 213 kind: "end",
207 214 status: "failed",
210 217 const expanded = toolText(s, { expanded: true, isPartial: true });
212 - for (const icon of ["󰗠", "󰐌", "󰅐", "󰭙", "󰘬", "󰅙"])
213 - expect(expanded).toContain(icon);
214 - for (const label of [
215 - "done",
216 - "running",
217 - "queued",
218 - "agents not planned yet",
219 - "conditional",
220 - "skipped",
221 - "dropped",
222 - ])
223 - expect(expanded).toContain(label);
224 - expect(expanded.indexOf("done#0")).toBeLessThan(
225 - expanded.indexOf("active#0"),
226 - );
227 - expect(expanded.indexOf("active#0")).toBeLessThan(
228 - expanded.indexOf("queued#0"),
229 - );
219 + expect(expanded).toContain("󰗠 done · 1/1 done");
220 + expect(expanded).not.toContain("done#0");
221 + expect(expanded).toContain("▼ active");
222 + expect(expanded).toContain("active#0 · running");
223 + expect(expanded).toContain("active#1 · dropped");
224 + expect(expanded).toContain("󰅐 queued · 1 queued");
225 + expect(expanded).not.toContain("queued#0");
226 + expect(expanded).toContain("agents not planned yet");
227 + expect(expanded).toContain("conditional");
231 229 const collapsed = toolText(s, { expanded: false, isPartial: true });
232 230 expect(collapsed).toContain("1 active");
233 231 expect(collapsed).toContain("1 queued");
234 232 expect(collapsed).toContain("2 later");
235 - expect(collapsed).not.toContain("done#0");
233 + expect(collapsed).not.toContain("active#0");
238 236 it("truncation keeps ellipsis in the surrounding style span", () => {
306 304 expect(out).not.toContain("agentId");
307 + it("expanded: shows authored summaries but never exact prompts", () => {
308 + const state = stateFrom([
309 + pe({
310 + agentId: "review#0",
311 + phase: "review",
312 + kind: "prompt",
313 + summary: "Review security",
314 + prompt: "SECRET EXACT PROMPT",
315 + }),
316 + ]);
317 + const out = toolText(state, { expanded: true, isPartial: true });
318 + expect(out).toContain("Review security");
319 + expect(out).not.toContain("SECRET EXACT PROMPT");
320 + });
309 322 it("expanded: shows per-agent statuses + latest action + dropped agents", () => {
310 323 const out = toolText(scripted, { expanded: true, isPartial: true });
311 324 // running agent + its latest action
369 382 expect(out).toContain("read docs/phase-1.html");
385 + it("shows aggregate cost, checkpoints, and resumed steps", () => {
386 + const s = stateFrom([
388 + kind: "plan",
389 + startedAt: 0,
390 + phases: [{ phase: "p", status: "resolved", agentIds: ["p#0", "p#1"] }],
391 + } as UltraProgressEvent,
392 + pe({ agentId: "p#0", phase: "p", kind: "start", text: "cached" }),
393 + pe({ agentId: "p#0", phase: "p", kind: "end", status: "done" }),
394 + pe({ agentId: "p#1", phase: "p", kind: "start" }),
395 + pe({
396 + agentId: "p#1",
397 + phase: "p",
398 + kind: "end",
399 + status: "done",
400 + usage: {
401 + input: 800,
402 + output: 200,
403 + total: 1000,
404 + cacheRead: 0,
405 + cacheWrite: 0,
406 + cost: 0.125,
407 + },
408 + }),
409 + ]);
410 + const out = toolText(s, { expanded: true, isPartial: true });
411 + expect(out).toContain("checkpoint reused");
412 + expect(out).toContain("1k tokens · $0.1250 · checkpoint 2/2 · 1 resumed");
413 + });
415 + it("renders the final human-readable outcome only when expanded", () => {
416 + const base = stateFrom([
417 + pe({ agentId: "p#0", phase: "p", kind: "end", status: "done" }),
418 + ]);
419 + const state = {
420 + ...base,
421 + workflowResult: {
422 + workflow: "fix-pmd",
423 + phases: [{ id: "p", ran: 1, ok: 1, dropped: 0 }],
424 + phaseResults: {},
425 + phaseFailures: {},
426 + result: [{ success: true, summary: "All accepted findings fixed." }],
427 + steered: false,
428 + tokenUsage: {
429 + input: 1,
430 + output: 2,
431 + total: 3,
432 + cacheRead: 0,
433 + cacheWrite: 0,
434 + cost: 0,
435 + },
436 + },
437 + };
438 + expect(
439 + toolText(state, { expanded: false, isPartial: false }),
440 + ).not.toContain("All accepted findings fixed.");
441 + const expanded = toolText(state, { expanded: true, isPartial: false });
442 + expect(expanded).toContain("outcome");
443 + expect(expanded).toContain("All accepted findings fixed.");
444 + expect(expanded).not.toContain("phaseResults");
445 + });
372 447 it("freezes elapsed time when an agent ends", () => {
373 448 vi.useFakeTimers();
486 561 expect(out).toContain("transcript: a#0");
487 562 overlay.handleInput(K.down);
488 563 out = overlay.render(80).join("\n");
564 + expect(out).toContain("phase: pending");
565 + overlay.handleInput(K.down);
566 + overlay.handleInput(K.enter);
567 + overlay.handleInput(K.down);
568 + out = overlay.render(80).join("\n");
489 569 expect(out).toContain("transcript: b#0");
572 + it("renders the exact resolved prompt as the first user transcript message", () => {
573 + const { overlay } = makeOverlay({ rows: 24 });
574 + overlay.handleProgress(
575 + pe({
576 + agentId: "a",
577 + phase: "p",
578 + kind: "prompt",
579 + summary: "Review security",
580 + prompt: "Inspect every authentication path.",
581 + }),
582 + );
583 + overlay.handleProgress(pe({ agentId: "a", phase: "p", kind: "start" }));
584 + overlay.handleProgress(
585 + pe({ agentId: "a", phase: "p", kind: "delta", text: "Working" }),
586 + );
587 + const out = overlay.render(80).join("\n");
588 + expect(out).toContain("Review security");
589 + expect(out).toContain("user");
590 + expect(out).toContain("Inspect every authentication path.");
591 + expect(out.indexOf("Inspect every authentication path.")).toBeLessThan(
592 + out.indexOf("Working"),
593 + );
594 + });
596 + it("toggles phase rows with Enter and cycles visible agents with Tab", () => {
597 + const { overlay } = makeOverlay({ rows: 24 });
598 + overlay.handleProgress({
599 + kind: "plan",
600 + startedAt: Date.now(),
601 + phases: [{ phase: "p", status: "resolved", agentIds: ["p#0", "p#1"] }],
602 + });
603 + overlay.handleInput(K.up);
604 + overlay.handleInput(K.enter);
605 + let out = overlay.render(80).join("\n");
606 + expect(out).toContain("phase: p");
607 + expect(out).not.toContain("p#0 · queued");
609 + overlay.handleInput(K.enter);
610 + overlay.handleInput(K.tab);
611 + out = overlay.render(80).join("\n");
612 + expect(out).toContain("transcript: p#0");
613 + overlay.handleInput(K.tab);
614 + expect(overlay.render(80).join("\n")).toContain("transcript: p#1");
615 + });
492 617 it("focusing agent k shows its deltas and not the others'", () => {
493 618 const { overlay } = makeOverlay({ rows: 24 });
494 619 for (const id of ["a", "b", "c"]) {
765 890 expect(overlay.steered).toBe(false); // follow-up is not a steer taint
768 - it("global Esc triggers the run-level abort", () => {
893 + it("requires two Esc presses to abort the whole run", () => {
769 894 const onRunAbort = vi.fn();
770 895 const { overlay } = makeOverlay({ rows: 24, onRunAbort });
771 896 overlay.handleProgress(pe({ agentId: "a", phase: "p", kind: "start" }));
772 897 overlay.handleInput(K.esc);
898 + expect(onRunAbort).not.toHaveBeenCalled();
899 + expect(overlay.render(80).join("\n")).toContain(
900 + "Press Esc again to abort all agents",
901 + );
902 + overlay.handleInput(K.esc);
903 + expect(onRunAbort).toHaveBeenCalledTimes(1);
904 + });
906 + it("expires abort confirmation instead of treating a later Esc as confirmation", () => {
907 + let clock = 0;
908 + const onRunAbort = vi.fn();
909 + const { overlay } = makeOverlay({
910 + rows: 24,
911 + now: () => clock,
912 + onRunAbort,
913 + });
914 + overlay.handleInput(K.esc);
915 + clock = 1600;
916 + overlay.handleInput(K.esc);
917 + expect(onRunAbort).not.toHaveBeenCalled();
918 + overlay.handleInput(K.esc);
773 919 expect(onRunAbort).toHaveBeenCalledTimes(1);
788 934 expect(onRunAbort).not.toHaveBeenCalled();
789 935 expect(steer).not.toHaveBeenCalled();
791 - // a fresh Esc in normal mode now aborts the run
937 + // Two fresh Esc presses in normal mode now confirm the whole-run abort.
938 + overlay.handleInput(K.esc);
939 + expect(onRunAbort).not.toHaveBeenCalled();
792 940 overlay.handleInput(K.esc);
793 941 expect(onRunAbort).toHaveBeenCalledTimes(1);

extensions/ultra/__tests__/wire.test.ts

Modified
16 16 const validSpec = (name: string): WorkflowSpec => ({
17 17 name,
18 - phases: [{ id: "p", kind: "single", step: { prompt: "hi" } }],
18 + phases: [{ id: "p", kind: "single", step: { summary: "hi", prompt: "hi" } }],
21 21 const specWithParams = (name: string, params: string[]): WorkflowSpec => ({
22 22 name,
23 23 args: { params },
24 - phases: [{ id: "p", kind: "single", step: { prompt: "hi {args.base}" } }],
24 + phases: [
25 + {
26 + id: "p",
27 + kind: "single",
28 + step: { summary: "hi {args.base}", prompt: "hi {args.base}" },
29 + },
30 + ],
27 33 const discovered = (
362 368 expect(seen).toEqual([1, 2]); // details changed between calls
371 + it("attaches the final aggregate only after progress completes", () => {
372 + const onUpdate = vi.fn();
373 + const progress = makeToolProgressSink(onUpdate);
374 + progress.sink(ev({ kind: "start" }));
375 + expect(progress.getState().workflowResult).toBeUndefined();
376 + const result = {
377 + workflow: "done",
378 + phases: [{ id: "p", ran: 1, ok: 1, dropped: 0 }],
379 + phaseResults: {},
380 + phaseFailures: {},
381 + result: [{ summary: "finished" }],
382 + steered: false,
383 + tokenUsage: {
384 + input: 1,
385 + output: 1,
386 + total: 2,
387 + cacheRead: 0,
388 + cacheWrite: 0,
389 + cost: 0,
390 + },
391 + };
392 + expect(progress.finish(result).workflowResult).toEqual(result);
393 + expect(() => structuredClone(progress.getState())).not.toThrow();
394 + });
365 396 it("strips non-cloneable `controls` so Pi can structured-clone details + result (regression)", () => {
366 397 // The runner attaches `controls` (functions — incl. NOOP_CONTROLS on the
367 398 // tool-less complete path) to EVERY event. Pi structured-clones the tool
372 403 const onUpdate = vi.fn((u: { details: unknown }) => updates.push(u));
373 404 const { sink, getState } = makeToolProgressSink(onUpdate);
406 + sink(
407 + ev({
408 + agentId: "a#0",
409 + kind: "prompt",
410 + summary: "Review security",
411 + prompt: "SECRET EXACT PROMPT",
412 + controls: noopControls,
413 + }),
414 + );
375 415 sink(ev({ agentId: "a#0", kind: "start", controls: noopControls }));
386 426 expect(() => structuredClone(updates[0].details)).not.toThrow();
387 427 expect(() => structuredClone(getState())).not.toThrow();
388 428 // And the run is still tracked correctly.
389 - expect(getState().rows[0].controls).toBeUndefined();
429 + expect(getState().rows[0]).toMatchObject({
430 + controls: undefined,
431 + prompt: undefined,
432 + summary: "Review security",
433 + });
434 + expect(JSON.stringify(getState())).not.toContain("SECRET EXACT PROMPT");
390 435 expect(getState().done).toBe(1);

extensions/ultra/engine.ts

Modified
146 146 phases.push({ id: phase.id, ran: 0, ok: 0, dropped: 0 });
147 147 continue;
149 - // Resolve `over` and every prompt up-front. Both own the interpolation
149 + // Resolve `over`, summaries, and prompts up-front. They own the interpolation
150 150 // grammar; a bad token throws here (spec authoring error), before any step
151 151 // launches — it is deliberately not a runtime drop.
152 152 const context = { args, results, failures: phaseFailures };
162 162 status: "resolved",
163 163 agentIds,
165 + resolved.forEach(({ item, step }, index) =>
166 + forward({
167 + agentId: `${phase.id}#${index}`,
168 + phase: phase.id,
169 + kind: "prompt",
170 + summary: step.summary,
171 + prompt: step.prompt,
172 + item,
173 + }),
174 + );
166 176 const cap = phase.concurrency ?? deps.concurrency;
167 177 const slots = await mapWithConcurrency(
372 382 return [undefined];
375 -/** Resolve a step's prompt template; the runner receives the result verbatim. */
385 +/** Resolve a step's UI summary and prompt; the runner receives both verbatim. */
376 386 function resolveStep(step: Step, ctx: InterpContext): Step {
377 - return { ...step, prompt: resolveTemplate(step.prompt, ctx) };
387 + return {
388 + ...step,
389 + summary: resolveTemplate(step.summary, ctx),
390 + prompt: resolveTemplate(step.prompt, ctx),
391 + };
380 394 /** Build the progress forwarder: forwards every runner event to `deps.onProgress`,

extensions/ultra/index.ts

Modified
100 - // Discovery is lazy — NEVER run in `session_start` (extensions/AGENTS.md). The
101 - // first tool/command/completion use pays for it once, then it's cached.
102 - let cache: DiscoveredWorkflow[] | undefined;
103 - const discover = (cwd: string): DiscoveredWorkflow[] => {
104 - if (!cache) cache = discoverWorkflows(cwd);
105 - return cache;
106 - };
100 + // Workflow files are tiny and human-authored during live sessions. Rescan at
101 + // each use so a newly saved workflow immediately works without `/reload`.
102 + const discover = (cwd: string): DiscoveredWorkflow[] =>
103 + discoverWorkflows(cwd);
108 105 let authoringPrompt: string | undefined;
109 106 const loadAuthoringPrompt = (): string => {
355 352 return {
356 353 content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
357 - details: progress.getState(),
354 + details: progress.finish(result),
358 355 terminate: false, // the agent keeps reasoning over the results

extensions/ultra/progress.ts

Modified
11 11 // terminating tool's structured payload is on `tool_execution_end.result.details`.
13 13 import type { AgentSessionEvent } from "@earendil-works/pi-coding-agent";
14 +import type { WorkflowResult } from "./engine.ts";
14 15 import type { StepFailure, TokenUsage } from "./runner.ts";
15 16 import type { ThinkingLevel } from "./spec.ts";
19 20 // ---------------------------------------------------------------------------
21 22 /** Lifecycle stage of a single mapped agent event. */
22 -export type AgentProgressKind = "start" | "action" | "delta" | "end";
23 +export type AgentProgressKind = "prompt" | "start" | "action" | "delta" | "end";
25 26 * Live control surface for one running sub-agent. Bound by the runner (which
52 53 /** Raw tool result for native tool rendering. */
53 54 result?: unknown;
54 55 isError?: boolean;
56 + /** Short resolved task summary shown on progress rows. */
57 + summary?: string;
58 + /** Exact resolved sub-agent prompt, shown as the first overlay transcript message. */
59 + prompt?: string;
55 60 /** Streamed delta text, a tool action/result preview, or a coarse status line. */
56 61 text?: string;
57 62 /** Terminal/error marker: `end` carries the run outcome; `action` may carry `"error"`. */
259 264 usage?: TokenUsage;
260 265 failure?: StepFailure;
261 266 item?: unknown;
267 + summary?: string;
268 + prompt?: string;
269 + /** This successful step was restored from the session journal. */
270 + cached?: boolean;
262 271 /** Live controls (command overlay only); absent on tool-less / tool-surface rows. */
263 272 controls?: AgentControls;
272 281 export type TranscriptItem =
282 + | { kind: "user"; text: string }
273 283 | { kind: "text"; text: string }
275 285 kind: "tool";
302 312 dropped: number;
303 313 /** Phases whose agent count or run decision still depends on earlier results. */
304 314 later: number;
315 + /** Final aggregate, attached only to the completed workflow tool result. */
316 + workflowResult?: WorkflowResult;
307 319 /** A fresh, empty reducer state. */
322 334 done: 0,
323 335 dropped: 0,
324 336 later: 0,
337 + workflowResult: undefined,
363 376 function transcriptItem(event: AgentProgressEvent): TranscriptItem | undefined {
377 + if (event.kind === "prompt" && event.prompt)
378 + return { kind: "user", text: event.prompt };
364 379 if (event.kind === "delta") return { kind: "text", text: event.text ?? "" };
365 380 if (event.kind !== "action" || !event.toolName) return undefined;
366 381 const fallback = actionLabel(event);
388 403 let status = base.status;
389 404 let action = base.action;
405 + let cached = base.cached;
390 406 switch (event.kind) {
407 + case "prompt":
408 + break;
391 409 case "start":
392 410 status = "running";
411 + if (event.text === "cached") {
412 + cached = true;
413 + action = "resumed from checkpoint";
393 415 break;
394 416 case "action":
395 417 if (event.result === undefined || event.isError)
415 437 usage: event.usage ?? base.usage,
416 438 failure: event.failure ?? base.failure,
417 439 item: event.item ?? base.item,
440 + summary: event.summary ?? base.summary,
441 + prompt: event.prompt ?? base.prompt,
442 + cached,
418 443 controls: event.controls ?? base.controls,
568 593 phase: event.phase,
569 594 startedAt: state.startedAt,
570 595 endedAt: state.endedAt,
596 + workflowResult: state.workflowResult,

extensions/ultra/prompts/authoring-workflows.md

Modified
44 44 a prior phase's results (e.g. `{review.results[].findings[]}`).
45 45 - Optional `when` uses one existing selector; empty/false skips the phase and produces empty results.
46 46 - A recovery fan-out may use `{PHASE.failures}` for both `when` and `over`; recovery remains one explicit later phase, never a loop.
47 - - The step `prompt`, its `tools`, and how tightly its structured JSON output must be constrained by a schema.
47 + - The step's short `summary`, exact `prompt`, `tools`, and how tightly its structured JSON output must be constrained by a schema.
48 + - `summary` is one concise progress-UI sentence, uses the same interpolation grammar as `prompt`, and must describe the concrete sub-agent task without paraphrasing its result.
49 50 3. **Apply the read-only fan-out rule.** A `fanout` step with tools must stay
50 51 within `read`, `grep`, `find`, `ls`, `bash` **and** the prompt must forbid
56 57 B to echo it, so each result ties back to its source. See the `review`
57 58 worked example in the reference.
59 -5. **Wire interpolation.** Use only the closed grammar (`{args.NAME}`, `{item}`,
60 +5. **Wire interpolation.** Use only the closed grammar in both `summary` and `prompt` (`{args.NAME}`, `{item}`,
60 61 `{PHASE.results}`, `{PHASE.failures}`, `{PHASE.results[].FIELD[]}`, `{EXPR | where FIELD}`). Keep
61 62 literal `{`/`}` out of prompts except these tokens. Set `return` to the
62 63 selector for the workflow's final value.
71 72 7. **Self-check the spec (there is no validator tool).** You can't call
72 73 `parseWorkflow` directly — verify by inspection against the reference: every
73 - required field is present, every `fanout` has an `over`, every `when` is one selector, every string
74 + required field is present, every step has a short `summary`, every `fanout` has an `over`, every `when` is one selector, every string
74 75 `schema` names a key in `schemas`, and interpolation uses only the closed
75 76 grammar. The real validator is the load itself: saving and test-running
76 77 (steps 8–9) parses the file through the runtime's `parseWorkflow`, which

extensions/ultra/prompts/references/spec-format.md

Modified
53 53 | Field | Required | Type | Meaning |
54 54 | --------------- | -------- | --------------------- | ------------------------------------------------------------------------------------------------- |
55 -| `prompt` | yes | string | The agent instruction. Interpolates `{...}` tokens (see below). |
55 +| `summary` | yes | string | One short progress-UI sentence describing the task; interpolates `{...}` tokens. |
56 +| `prompt` | yes | string | The exact agent instruction; interpolates `{...}` tokens (see below). |
56 57 | `tools` | no | string[] | Tool allowlist. Omit for a tool-less completion (pure reasoning). |
57 58 | `model` | no | string | `provider/id` override, or configured tier `small`/`medium`/`big`; defaults to the session model. |
58 59 | `thinkingLevel` | no | off…max | Reasoning budget for this step. |
59 60 | `schema` | no | string \| JSON Schema | A `schemas` name, or an inline schema that validates structured output. |
62 +`summary` is rendered on tool and overlay agent rows.
63 +Keep it concise and concrete; use the same interpolation grammar as `prompt` so fan-out rows can identify their item.
64 +The overlay separately shows the exact resolved `prompt` as the first user message in that agent's transcript.
61 66 Every step returns a JSON object through completion parsing or the terminating `structured_output` tool.
62 67 Without `schema`, any JSON object is accepted.
63 68 A `schema` validates that object and is required when downstream phases depend on a stable shape.
130 135 "when": "{work.failures}",
131 136 "over": "{work.failures}",
132 137 "step": {
138 + "summary": "Recover failed task {item}",
133 139 "prompt": "Recover this failed task and return the required result. Failure: {item}",
134 140 "model": "big",
135 141 "thinkingLevel": "high"
164 170 "kind": "fanout",
165 171 "over": "{args.paths}",
166 172 "step": {
173 + "summary": "Summarize {item}",
167 174 "prompt": "Read the file at {item} and return JSON with two string fields: path (the file path you were given) and summary (one sentence). Do not modify anything.",
168 175 "tools": ["read"],
169 176 "model": "small",
235 242 "kind": "fanout",
236 243 "over": ["correctness", "security", "performance"],
237 244 "step": {
245 + "summary": "Review diff for {item} issues",
238 246 "prompt": "Review the diff for {item} issues. Inspect it with `git diff {args.base}` (no base ref → the working tree; a base ref → everything since that ref), plus read/grep as needed; do not modify any files. Return JSON matching the Findings schema, and set each finding's file to the path it concerns.",
239 247 "tools": ["read", "bash", "grep", "find", "ls"],
240 248 "model": "small",
247 255 "kind": "fanout",
248 256 "over": "{review.results[].findings[]}",
249 257 "step": {
258 + "summary": "Verify one candidate finding",
250 259 "prompt": "Adversarially try to refute this finding. Default to real=false if uncertain. Echo the finding's file verbatim in your verdict's file field so the verdict ties back to its finding. Finding: {item}",
251 260 "model": "big",
252 261 "thinkingLevel": "high",

extensions/ultra/spec.ts

Modified
60 60 export const StepSchema = Type.Object(
62 + summary: Type.String({
63 + minLength: 1,
64 + description: `One short progress-UI sentence describing this sub-agent's task. May embed the same grammar tokens as prompt. ${INTERPOLATION_GRAMMAR}`,
65 + }),
62 66 prompt: Type.String({
63 67 description:
64 68 `Sub-agent instruction. May embed grammar tokens in text; {item} is meaningful only in fanout. ${INTERPOLATION_GRAMMAR} ` +

extensions/ultra/ui.ts

Modified
42 42 type TranscriptItem,
43 43 type UltraProgressEvent,
44 44 } from "./progress.ts";
45 +import { formatUltraResultMarkdown } from "./wire.ts";
46 47 // ---------------------------------------------------------------------------
47 48 // Shared board helpers (used by both sinks)
157 158 type DisplayRow =
158 159 | { kind: "agent"; row: ReducerState["rows"][number] }
159 - | { kind: "phase"; phase: PlannedPhase };
160 + | { kind: "phase"; phase: PlannedPhase; expanded: boolean };
161 -function displayRows(state: ReducerState): DisplayRow[] {
162 +function rowsInPhase(state: ReducerState, phase: string) {
163 + return state.rows.filter((row) => row.phase === phase);
166 +function displayRows(
167 + state: ReducerState,
168 + expanded: (phase: PlannedPhase) => boolean,
169 +): DisplayRow[] {
162 170 const out: DisplayRow[] = [];
163 171 const seen = new Set<string>();
164 172 for (const phase of state.phases) {
165 - const rows = state.rows.filter((row) => row.phase === phase.phase);
166 - if (
167 - phase.status === "agents-pending" ||
168 - phase.status === "condition-pending" ||
169 - phase.status === "skipped" ||
170 - (phase.status === "done" && rows.length === 0)
171 - ) {
172 - out.push({ kind: "phase", phase });
173 - continue;
174 - }
175 - for (const row of rows) {
173 + const open = expanded(phase);
174 + out.push({ kind: "phase", phase, expanded: open });
175 + if (!open) continue;
176 + for (const row of rowsInPhase(state, phase.phase)) {
176 177 seen.add(row.agentId);
177 178 out.push({ kind: "agent", row });
180 181 for (const row of state.rows) {
181 - if (!seen.has(row.agentId)) out.push({ kind: "agent", row });
182 + if (
183 + !seen.has(row.agentId) &&
184 + !state.phases.some((p) => p.phase === row.phase)
186 + out.push({ kind: "agent", row });
183 188 return out;
186 -function phaseLabel(phase: PlannedPhase): string {
187 - switch (phase.status) {
188 - case "agents-pending":
189 - return `${PHASE_ICON[phase.status]} ${phase.phase} · agents not planned yet`;
190 - case "condition-pending":
191 - return `${PHASE_ICON[phase.status]} ${phase.phase} · conditional`;
192 - case "skipped":
193 - return `${PHASE_ICON[phase.status]} ${phase.phase} · skipped`;
194 - case "done":
195 - return `󰗠 ${phase.phase} · done · no agents`;
196 - case "resolved":
197 - return phase.phase;
198 - }
191 +function phaseLabel(
192 + state: ReducerState,
193 + phase: PlannedPhase,
194 + expanded: boolean,
195 +): string {
196 + if (phase.status === "agents-pending")
197 + return `${PHASE_ICON[phase.status]} ${phase.phase} · agents not planned yet`;
198 + if (phase.status === "condition-pending")
199 + return `${PHASE_ICON[phase.status]} ${phase.phase} · conditional`;
200 + if (phase.status === "skipped")
201 + return `${PHASE_ICON[phase.status]} ${phase.phase} · skipped`;
203 + const rows = rowsInPhase(state, phase.phase);
204 + const done = rows.filter((row) => row.status === "done").length;
205 + const running = rows.filter((row) => row.status === "running").length;
206 + const dropped = rows.filter((row) => row.status === "dropped").length;
207 + const queued = rows.filter((row) => row.status === "queued").length;
208 + const counts = [
209 + `${done}/${rows.length} done`,
210 + running ? `${running} active` : "",
211 + queued ? `${queued} queued` : "",
212 + dropped ? `${dropped} dropped` : "",
214 + .filter(Boolean)
215 + .join(" · ");
216 + if (phase.status === "done")
217 + return `${dropped ? STATUS_ICON.dropped : STATUS_ICON.done} ${phase.phase}${counts ? ` · ${counts}` : " · done"}`;
218 + if (state.phase === phase.phase)
219 + return `${expanded ? "▼" : "▶"} ${phase.phase}${counts ? ` · ${counts}` : ""}`;
220 + return `${STATUS_ICON.queued} ${phase.phase}${rows.length ? ` · ${rows.length} queued` : ""}`;
201 223 function phaseDetail(phase: PlannedPhase): string | undefined {
212 234 : "starts when phase begins";
237 +function automaticPhase(state: ReducerState): string | undefined {
238 + const current = state.phases.find(
239 + (phase) => phase.phase === state.phase && phase.status === "resolved",
240 + );
241 + return (current ?? state.phases.find((phase) => phase.status === "resolved"))
242 + ?.phase;
245 +function toolPhaseExpanded(state: ReducerState, phase: PlannedPhase): boolean {
246 + if (rowsInPhase(state, phase.phase).some((row) => row.status === "dropped"))
247 + return true;
248 + return phase.phase === automaticPhase(state);
251 +function aggregateUsage(state: ReducerState): { tokens: number; cost: number } {
252 + let tokens = 0;
253 + let cost = 0;
254 + for (const row of state.rows) {
255 + tokens += row.usage?.total ?? 0;
256 + cost += row.usage?.cost ?? 0;
258 + return { tokens, cost };
261 +function metricsLine(state: ReducerState): string | undefined {
262 + if (state.total === 0) return undefined;
263 + const usage = aggregateUsage(state);
264 + const resumed = state.rows.filter((row) => row.cached).length;
265 + if (usage.tokens === 0 && state.done === 0 && resumed === 0) return undefined;
266 + return [
267 + usage.tokens ? `${compactTokens(usage.tokens)} tokens` : "",
268 + usage.cost ? `$${usage.cost.toFixed(4)}` : "",
269 + `checkpoint ${state.done}/${state.total}`,
270 + resumed ? `${resumed} resumed` : "",
272 + .filter(Boolean)
273 + .join(" · ");
215 276 function divider(label: string, width: number): string {
216 277 const w = Math.max(1, width);
217 278 const text = ` ${label} `;
238 299 * Pure board renderer for the tool surface. Collapsed = aggregate counts +
239 300 * one-line summary + the expand hint (NEVER any per-agent line or transcript
240 - * body). Expanded = multiline per-agent identity, model/usage metadata, and latest
241 - * action, with dropped agents surfaced. The drill-in transcript is the OVERLAY's job, never the tool sink's,
242 - * so `state.transcripts` is intentionally never read here.
301 + * body). Expanded = phase-first summaries with active and failed phases opened,
302 + * plus model/usage metadata and the final outcome. The drill-in transcript is
303 + * the OVERLAY's job, never the tool sink's, so `state.transcripts` is never read here.
244 305 function renderToolBoard(
245 306 state: ReducerState,
261 322 return lines.map((l) => fitLine(l, w));
264 - // Expanded: specification order, including non-agent planning rows.
265 - for (const display of displayRows(state)) {
325 + // Expanded: one phase row each, with only active or failed phases opened.
326 + for (const display of displayRows(state, (phase) =>
327 + toolPhaseExpanded(state, phase),
328 + )) {
266 329 if (display.kind === "phase") {
267 - lines.push(theme.fg("dim", fitLine(phaseLabel(display.phase), w)));
330 + const color =
331 + display.phase.status === "done"
332 + ? "success"
333 + : state.phase === display.phase.phase
334 + ? "accent"
335 + : "dim";
336 + lines.push(
337 + theme.fg(
338 + color,
339 + fitLine(phaseLabel(state, display.phase, display.expanded), w),
340 + ),
341 + );
268 342 const detail = phaseDetail(display.phase);
269 343 if (detail) lines.push(theme.fg("muted", fitLine(` └ ${detail}`, w)));
270 344 continue;
272 346 const { row } = display;
273 347 const icon = STATUS_ICON[row.status];
274 - let identity = `${icon} ${row.agentId} · ${row.status}`;
348 + let identity = ` ${icon} ${row.agentId} · ${row.status}`;
349 + if (row.summary) identity += ` · ${row.summary}`;
350 + if (row.cached) identity += " · checkpoint reused";
275 351 if (row.status === "queued")
276 352 identity += ` · ${queuedDetail(state, row.phase)}`;
277 353 lines.push(theme.fg("dim", fitLine(identity, w)));
278 354 for (const detail of agentDetailLines(row)) {
279 - lines.push(theme.fg("muted", fitLine(` ${detail}`, w)));
355 + lines.push(theme.fg("muted", fitLine(` ${detail}`, w)));
359 + const metrics = metricsLine(state);
360 + if (metrics) lines.push(theme.fg("muted", fitLine(metrics, w)));
361 + if (state.workflowResult) {
362 + lines.push(theme.fg("border", divider("outcome", w)));
363 + lines.push(
364 + ...new Markdown(
365 + formatUltraResultMarkdown(state.workflowResult),
366 + 0,
367 + 0,
368 + getMarkdownTheme(),
369 + ).render(w),
370 + );
283 373 return lines.map((l) => fitLine(l, w));
403 493 export interface UltraOverlayOptions {
404 494 host: OverlayHost;
405 495 theme: Theme;
406 - /** Global `Esc` → run-level abort (the command path's own AbortController). */
496 + /** Confirmed `Esc Esc` run-level abort through the command path's AbortController. */
407 497 onRunAbort: () => void;
408 498 /** Injectable clock for the render throttle (default `Date.now`). */
409 499 now?: () => number;
457 547 export class UltraOverlayComponent implements Component {
458 548 private state: ReducerState;
459 - private focusIndex = 0;
549 + private focusKey: string | undefined;
550 + private readonly expandedPhases = new Set<string>();
551 + private readonly collapsedPhases = new Set<string>();
460 552 private followMode = true;
461 553 private scrollOffset = 0;
462 554 private lastMaxScroll = 0;
464 556 private steerMode = false;
465 557 private steerBuffer = "";
466 558 private steeredFlag = false;
559 + private abortArmedAt: number | undefined;
468 561 private readonly host: OverlayHost;
469 562 private readonly theme: Theme;
503 596 const previousPhase = this.state.phase;
504 597 this.state = reduceProgress(this.state, event);
505 598 if (event.kind === "start" && event.phase !== previousPhase) {
506 - const nextFocus = this.state.rows.findIndex(
507 - (row) => row.agentId === event.agentId,
508 - );
509 - if (nextFocus >= 0) {
510 - this.focusIndex = nextFocus;
511 - this.followMode = true;
512 - this.scrollOffset = 0;
599 + if (previousPhase) {
600 + this.expandedPhases.delete(previousPhase);
601 + this.collapsedPhases.delete(previousPhase);
603 + this.collapsedPhases.delete(event.phase);
604 + this.focusKey = `agent:${event.agentId}`;
605 + this.followMode = true;
606 + this.scrollOffset = 0;
515 - if (this.focusIndex >= this.state.rows.length) {
516 - this.focusIndex = Math.max(0, this.state.rows.length - 1);
517 - }
608 + this.ensureVisibleFocus();
518 609 const now = this.now();
519 610 // Terminal events bypass the throttle so the final board is never lost
520 611 // behind the render window.
533 624 return;
535 626 if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
536 - this.onRunAbort();
627 + const now = this.now();
628 + if (this.abortArmedAt !== undefined && now - this.abortArmedAt <= 1500) {
629 + this.abortArmedAt = undefined;
630 + this.onRunAbort();
631 + } else {
632 + this.abortArmedAt = now;
633 + this.host.requestRender();
537 635 return;
637 + this.abortArmedAt = undefined;
539 638 if (matchesKey(data, "tab")) {
540 639 this.focusBy(1, true);
541 640 } else if (matchesKey(data, "down")) {
542 641 this.focusBy(1, false);
543 642 } else if (matchesKey(data, "up")) {
544 643 this.focusBy(-1, false);
644 + } else if (matchesKey(data, "return") || matchesKey(data, "enter")) {
645 + this.toggleFocusedPhase();
545 646 } else if (
546 647 matchesKey(data, "pageUp") ||
547 648 matchesKey(data, "alt+up") ||
564 - private focusBy(delta: number, wrap: boolean): void {
565 - const n = this.state.rows.length;
566 - if (n === 0) return;
567 - this.focusIndex = wrap
568 - ? (this.focusIndex + delta + n) % n
569 - : Math.min(n - 1, Math.max(0, this.focusIndex + delta));
570 - // New agent → re-pin its transcript to newest.
665 + private phaseExpanded(phase: PlannedPhase): boolean {
666 + if (this.collapsedPhases.has(phase.phase)) return false;
667 + if (this.expandedPhases.has(phase.phase)) return true;
668 + return phase.phase === automaticPhase(this.state);
671 + private visibleRows(): DisplayRow[] {
672 + return displayRows(this.state, (phase) => this.phaseExpanded(phase));
675 + private displayKey(display: DisplayRow): string {
676 + return display.kind === "phase"
677 + ? `phase:${display.phase.phase}`
678 + : `agent:${display.row.agentId}`;
681 + private ensureVisibleFocus(): void {
682 + const visible = this.visibleRows();
683 + if (visible.length === 0) {
684 + this.focusKey = undefined;
685 + return;
687 + if (
688 + this.focusKey &&
689 + visible.some((row) => this.displayKey(row) === this.focusKey)
691 + return;
692 + const firstAgent = visible.find((row) => row.kind === "agent");
693 + this.focusKey = this.displayKey(firstAgent ?? visible[0]);
696 + private focusBy(delta: number, agentsOnly: boolean): void {
697 + const candidates = this.visibleRows().filter(
698 + (row) => !agentsOnly || row.kind === "agent",
699 + );
700 + if (candidates.length === 0) return;
701 + const current = candidates.findIndex(
702 + (row) => this.displayKey(row) === this.focusKey,
703 + );
704 + const next =
705 + current < 0
706 + ? 0
707 + : agentsOnly
708 + ? (current + delta + candidates.length) % candidates.length
709 + : Math.min(candidates.length - 1, Math.max(0, current + delta));
710 + this.focusKey = this.displayKey(candidates[next]);
571 711 this.followMode = true;
572 712 this.scrollOffset = 0;
573 713 this.host.requestRender();
716 + private toggleFocusedPhase(): void {
717 + const phase = this.focusedPhase();
718 + if (!phase) return;
719 + if (this.phaseExpanded(phase)) {
720 + this.expandedPhases.delete(phase.phase);
721 + this.collapsedPhases.add(phase.phase);
722 + this.focusKey = `phase:${phase.phase}`;
723 + } else {
724 + this.collapsedPhases.delete(phase.phase);
725 + this.expandedPhases.add(phase.phase);
727 + this.host.requestRender();
576 730 private scrollBy(delta: number): void {
577 731 if (delta < 0) {
578 732 this.followMode = false;
587 741 private focusedRow() {
588 - return this.state.rows[this.focusIndex];
742 + if (!this.focusKey?.startsWith("agent:")) return undefined;
743 + const id = this.focusKey.slice("agent:".length);
744 + return this.state.rows.find((row) => row.agentId === id);
747 + private focusedPhase(): PlannedPhase | undefined {
748 + if (!this.focusKey) return undefined;
749 + const row = this.focusedRow();
750 + const name = row?.phase ?? this.focusKey.slice("phase:".length);
751 + return this.state.phases.find((phase) => phase.phase === name);
591 754 private openSteer(): void {
592 - if (this.state.rows.length === 0) return;
755 + if (!this.focusedRow()) return;
593 756 this.steerMode = true;
594 757 this.steerBuffer = "";
595 758 this.host.requestRender();
673 836 continue;
675 838 flushText();
839 + if (item.kind === "user") {
840 + lines.push(this.theme.fg("accent", "user"));
841 + lines.push(...transcriptLines(item.text, width));
842 + continue;
676 844 if (this.toolUi && this.cwd) {
677 845 const tool = new ToolExecutionComponent(
678 846 item.toolName,
708 876 const description = descriptionLine(state);
709 877 if (description)
710 878 lines.push(this.theme.fg("muted", fitLine(description, w)));
879 + const metrics = metricsLine(state);
880 + if (metrics) lines.push(this.theme.fg("muted", fitLine(metrics, w)));
712 882 const maxLines = Math.max(1, this.host.terminal.rows - 3);
713 - const fixedAfterRows = 3; // border + transcript title + footer
714 - const display = displayRows(state);
883 + const fixedAfterRows = 4; // transcript divider + body allowance + two footer rows
884 + const display = this.visibleRows();
715 885 const maxWorkRows = Math.min(
716 886 display.length,
717 887 Math.max(0, maxLines - lines.length - fixedAfterRows),
719 - const focusedId = this.focusedRow()?.agentId;
720 889 const focusedDisplay = display.findIndex(
721 - (item) => item.kind === "agent" && item.row.agentId === focusedId,
890 + (item) => this.displayKey(item) === this.focusKey,
723 892 const rowStart =
724 893 maxWorkRows >= display.length
728 897 Math.max(0, display.length - maxWorkRows),
730 899 for (const item of display.slice(rowStart, rowStart + maxWorkRows)) {
900 + const focused = this.displayKey(item) === this.focusKey;
731 901 if (item.kind === "phase") {
902 + const marker = focused ? "▶" : " ";
903 + const color = focused
904 + ? "accent"
905 + : item.phase.status === "done"
906 + ? "success"
907 + : "dim";
732 908 lines.push(
733 - this.theme.fg("dim", fitLine(` ${phaseLabel(item.phase)}`, w)),
909 + this.theme.fg(
910 + color,
911 + fitLine(
912 + `${marker} ${phaseLabel(state, item.phase, item.expanded)}`,
913 + w,
914 + ),
915 + ),
735 - const detail = phaseDetail(item.phase);
736 - if (detail)
737 - lines.push(this.theme.fg("muted", fitLine(` └ ${detail}`, w)));
738 917 continue;
740 919 const { row } = item;
741 - const focused = row.agentId === focusedId;
742 920 const marker = focused ? "▶" : " ";
743 921 const icon = STATUS_ICON[row.status];
744 - let line = `${marker} ${icon} ${row.agentId} · ${row.status}`;
922 + let line = `${marker} ${icon} ${row.agentId} · ${row.status}`;
923 + if (row.summary) line += ` · ${row.summary}`;
924 + if (row.cached) line += " · checkpoint reused";
745 925 if (row.status === "queued")
746 926 line += ` · ${queuedDetail(state, row.phase)}`;
747 927 if (row.action) line += ` · ${row.action}`;
751 931 const focusedRow = this.focusedRow();
932 + const focusedPhase = this.focusedPhase();
752 933 lines.push(
753 934 this.theme.fg(
754 935 "border",
755 - divider(`transcript: ${focusedRow ? focusedRow.agentId : "—"}`, w),
936 + divider(
937 + focusedRow
938 + ? `transcript: ${focusedRow.agentId}`
939 + : `phase: ${focusedPhase?.phase ?? "—"}`,
940 + w,
941 + ),
759 945 const body = this.transcriptBodyLines(focusedRow?.agentId, w - 2);
761 - // Reserve the footer and keep a 3-row terminal safety margin.
762 - const maxVisible = Math.max(0, maxLines - lines.length - 1);
947 + // Reserve both footer rows and keep a 3-row terminal safety margin.
948 + const maxVisible = Math.max(0, maxLines - lines.length - 2);
763 949 const maxScroll = Math.max(0, body.length - maxVisible);
764 950 this.lastMaxScroll = maxScroll;
765 951 if (this.followMode) this.scrollOffset = maxScroll;
972 + } else if (
973 + this.abortArmedAt !== undefined &&
974 + this.now() - this.abortArmedAt <= 1500
975 + ) {
976 + lines.push(
977 + this.theme.fg(
978 + "warning",
979 + fitLine("Press Esc again to abort all agents", w),
980 + ),
981 + );
786 982 } else {
787 983 const follow = this.followMode ? "follow" : "paused";
788 984 lines.push(
789 985 this.theme.fg(
790 986 "dim",
791 987 fitLine(
792 - `Tab/↑↓ focus · Alt+↑/↓ scroll (${follow}) · s steer · x abort · Esc quit`,
988 + `↑↓ focus · Tab agents · Enter phase · Alt+↑/↓ transcript (${follow})`,
992 + this.theme.fg(
993 + "dim",
994 + fitLine("s steer · x abort agent · Esc Esc abort all", w),
995 + ),

extensions/ultra/wire.ts

Modified
37 37 function itemLine(value: unknown): string {
38 38 const r = record(value);
39 39 if (!r) return `- ${JSON.stringify(value)}`;
40 - const title = text(r.title) ?? text(r.file) ?? JSON.stringify(value);
40 + const title =
41 + text(r.title) ??
42 + text(r.summary) ??
43 + text(r.group) ??
44 + text(r.name) ??
45 + text(r.file) ??
46 + text(r.status) ??
47 + JSON.stringify(value);
41 48 const file = text(r.file);
42 49 const why = text(r.why) ?? text(r.reason) ?? text(r.detail);
43 50 return `- **${title}**${file && file !== title ? ` — \`${file}\`` : ""}${why ? `\n ${why}` : ""}`;
275 282 meta: ProgressMeta = {},
277 284 sink: (event: UltraProgressEvent) => void;
285 + finish: (result: WorkflowResult) => ReducerState;
278 286 getState: () => ReducerState;
280 288 let state = initialReducerState(meta);
289 297 // fails the whole run. Only the command overlay (never serialized)
290 298 // keeps controls.
291 299 const safe =
292 - "agentId" in event ? { ...event, controls: undefined } : event;
300 + "agentId" in event
301 + ? { ...event, controls: undefined, prompt: undefined }
302 + : event;
293 303 state = reduceProgress(state, safe);
294 304 onUpdate({
295 305 content: [{ type: "text", text: summarize(state) }],
296 306 details: state,
309 + finish: (result) => {
310 + state = { ...state, workflowResult: result };
311 + return state;
312 + },
299 313 getState: () => state,

extensions/ultra/workflows/bug.json

Modified
54 54 "id": "investigate",
55 55 "kind": "single",
56 56 "step": {
57 + "summary": "Investigate bug: {args.bug}",
57 58 "prompt": "Investigate this bug without modifying files: {args.bug}. Reproduce or trace the failing path, inspect callers and shared routes, identify the likely root cause, and list relevant files. Use read/grep/find/bash as needed. Return JSON matching Investigation.",
58 59 "tools": ["read", "grep", "find", "ls", "bash"],
59 60 "model": "medium",
65 66 "id": "regression",
66 67 "kind": "single",
67 68 "step": {
69 + "summary": "Create regression test: {args.bug}",
68 70 "prompt": "Create the smallest regression test for this bug: {args.bug}. Investigation: {investigate.results}. Do not fix production code. Run the focused test and set ready=true only when it fails for the expected reason, not from a test error. Return JSON matching Regression.",
69 71 "tools": ["read", "grep", "find", "ls", "bash", "edit", "write"],
70 72 "model": "big",
77 79 "kind": "single",
78 80 "when": "{regression.results | where ready}",
79 81 "step": {
82 + "summary": "Fix root cause: {args.bug}",
80 83 "prompt": "Fix the root cause of this bug: {args.bug}. Investigation: {investigate.results}. Regression evidence: {regression.results}. Prefer the shared route over caller-specific patches. Make the minimum production change, run the regression test and relevant checks, and set fixed=true only when they pass. Then return JSON matching Fix.",
81 84 "tools": ["read", "grep", "find", "ls", "bash", "edit", "write"],
82 85 "model": "big",
90 93 "when": "{fix.results | where fixed}",
91 94 "over": ["regression", "correctness", "security"],
92 95 "step": {
96 + "summary": "Verify fix from {item} perspective",
93 97 "prompt": "Adversarially verify the bug fix from the {item} perspective. Bug: {args.bug}. Investigation: {investigate.results}. Regression: {regression.results}. Fix: {fix.results}. Inspect the diff and run focused checks as needed; do not modify files. Set passed=false and list concrete findings if the fix is incomplete, the regression test is weak, or new risk was introduced. Echo dimension as {item}. Return JSON matching Verdict.",
94 98 "tools": ["read", "grep", "find", "ls", "bash"],
95 99 "model": "big",

extensions/ultra/workflows/feature.json

Modified
97 97 "id": "research",
98 98 "kind": "single",
99 99 "step": {
100 + "summary": "Research feature: {args.task}",
100 101 "prompt": "Research this codebase to implement the feature: {args.task}. Identify the files you'd touch, the existing patterns/conventions to follow, and any constraints. Inspect with read/grep/find/bash (e.g. `git log`, `git grep`); do not modify anything. Return JSON matching the Research schema.",
101 102 "tools": ["read", "grep", "find", "ls", "bash"],
102 103 "model": "small",
108 109 "id": "plan",
109 110 "kind": "single",
110 111 "step": {
112 + "summary": "Plan feature: {args.task}",
111 113 "prompt": "Produce an implementation plan for: {args.task}. Ground it in this research: {research.results}. Give concrete ordered tasks, a one-paragraph approach, and the real risks. Read further if needed; do not modify anything. Return JSON matching the Plan schema.",
112 114 "tools": ["read", "grep", "find", "ls", "bash"],
113 115 "model": "big",
119 121 "id": "critique",
120 122 "kind": "single",
121 123 "step": {
124 + "summary": "Critique feature plan: {args.task}",
122 125 "prompt": "Adversarially critique this plan BEFORE any code is written. Task: {args.task}. Plan: {plan.results}. Research: {research.results}. Hunt for missing steps, wrong assumptions, and unhandled edge cases. Set approved=false and list each blocking issue if the plan isn't ready; default approved=false when uncertain. Do not modify anything. Return JSON matching the Critique schema.",
123 126 "tools": ["read", "grep", "find", "ls", "bash"],
124 127 "model": "big",
130 133 "id": "refine",
131 134 "kind": "single",
132 135 "step": {
136 + "summary": "Strengthen feature plan: {args.task}",
133 137 "prompt": "Strengthen the implementation plan for: {args.task}. Rewrite it as a complete replacement that resolves EVERY blocking item from this critique: {critique.results}. Original plan: {plan.results}. Research: {research.results}. Read further if needed; do not modify anything. Return JSON matching the Plan schema.",
134 138 "tools": ["read", "grep", "find", "ls", "bash"],
135 139 "model": "big",
141 145 "id": "implement",
142 146 "kind": "single",
143 147 "step": {
148 + "summary": "Implement feature: {args.task}",
144 149 "prompt": "Implement the feature: {args.task}. Follow the strengthened plan: {refine.results}. Make the actual edits with the edit/write tools, keep the change focused, and follow the conventions surfaced in research. Run focused checks and set implemented=true only when the changes and checks complete. Then return JSON matching the Implementation schema (list the files you changed and a concise summary).",
145 150 "tools": ["read", "grep", "find", "ls", "bash", "edit", "write"],
146 151 "model": "medium",
154 159 "when": "{implement.results | where implemented}",
155 160 "over": ["security", "quality"],
156 161 "step": {
162 + "summary": "Review implementation from {item} perspective",
157 163 "prompt": "Review the just-made implementation of {args.task} from the {item} perspective. What changed: {implement.results}. Inspect the working tree with read/grep and `git diff`; do not modify anything. Set passed=false and list each blocking {item} problem you find. Echo the `dimension` field as \"{item}\" so the verdict ties back. Return JSON matching the Verdict schema.",
158 164 "tools": ["read", "grep", "find", "ls", "bash"],
159 165 "model": "big",

extensions/ultra/workflows/review.json

Modified
41 41 "kind": "fanout",
42 42 "over": ["correctness", "security", "performance"],
43 43 "step": {
44 + "summary": "Review target for {item} issues",
44 45 "prompt": "Review the requested target for {item} issues. Target: {args.target}\n\nThe target may be a PR, branch/ref, recent changes, folder, or file. If target is empty, inspect the working tree and recent local changes. Use git/read/grep/find/ls as appropriate; for PRs or branches, inspect the relevant diff; for folders/files, inspect that scope. Do not modify files. Return JSON matching the Findings schema, and set each finding's `file` to the path it concerns.",
45 46 "tools": ["read", "bash", "grep", "find", "ls"],
46 47 "model": "small",
53 54 "kind": "fanout",
54 55 "over": "{review.results[].findings[]}",
55 56 "step": {
57 + "summary": "Verify one candidate finding",
56 58 "prompt": "Adversarially try to refute this finding. Default to real=false if uncertain. Echo the finding's `file` verbatim in your verdict's `file` field so the verdict ties back to its finding.\n\nFinding: {item}",
57 59 "model": "big",
58 60 "thinkingLevel": "high",