Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/ultra/demo/scene.json

Raw
{
	"title": "ultra",
	"extensions": ["ultra", "footer", "model-info", "cost"],
	"cols": 100,
	"rows": 30,
	"settings": {
		"ultra": {
			"subagentExtensions": "all",
			"autoEnable": true
		}
	},
	"files": {
		"src/retry.ts": "export async function withRetry<T>(run: () => Promise<T>): Promise<T> {\n\tfor (let attempt = 1; ; attempt++) {\n\t\ttry {\n\t\t\treturn await run();\n\t\t} catch (error) {\n\t\t\tif (attempt === 4) throw error;\n\t\t}\n\t}\n}\n",
		"src/upload.ts": "import { withRetry } from \"./retry\";\nexport const upload = (f: string) => withRetry(() => send(f));\ndeclare function send(f: string): Promise<void>;\n",
		"src/queue.ts": "export class Queue<T> {\n\tprivate items: T[] = [];\n\tpush(item: T) { this.items.push(item); }\n\tpop() { return this.items.shift(); }\n}\n"
	},
	"turns": [
		{
			"text": "Three files, three independent reviewers, one judge.",
			"tool": {
				"name": "run_workflow",
				"arguments": {
					"spec": {
						"name": "review-three",
						"schemas": {
							"finding": {
								"type": "object",
								"required": ["file", "severity", "summary"],
								"properties": {
									"file": {
										"type": "string"
									},
									"severity": {
										"type": "string",
										"enum": ["low", "medium", "high"]
									},
									"summary": {
										"type": "string"
									}
								}
							}
						},
						"phases": [
							{
								"id": "review",
								"kind": "fanout",
								"over": ["src/retry.ts", "src/upload.ts", "src/queue.ts"],
								"step": {
									"summary": "review {item}",
									"tools": ["read"],
									"schema": "finding",
									"prompt": "Read {item} and report its single most important finding as structured output. Do not modify anything."
								}
							},
							{
								"id": "judge",
								"kind": "single",
								"step": {
									"summary": "merge findings",
									"tools": ["read"],
									"prompt": "Merge these findings into one verdict with a severity and a next step: {review.results}"
								}
							}
						],
						"return": "{judge.results}"
					}
				}
			},
			"usage": {
				"input": 2200,
				"output": 420
			}
		},
		{
			"text": "Verdict: medium. Add exponential backoff to withRetry and a capacity limit to Queue; the reviewers agree on the retry gap.",
			"usage": {
				"input": 3900,
				"output": 40
			}
		}
	],
	"steps": [
		{
			"expect": "demo-model",
			"hold": 6
		},
		{
			"type": "review src/retry.ts, src/upload.ts and src/queue.ts in parallel, then judge",
			"key": "enter",
			"expect": "review src/queue\\.ts",
			"timeout": 40000,
			"hold": 8
		},
		{
			"expect": "merge findings",
			"timeout": 40000,
			"hold": 10.0
		},
		{
			"expect": "capacity limit to Queue",
			"timeout": 60000,
			"hold": 16
		},
		{
			"key": "ctrl-c",
			"hold": 0.3
		},
		{
			"key": "ctrl-c"
		}
	],
	"childTurns": [
		{
			"tool": {
				"name": "read",
				"arguments": {
					"path": "{prompt:(src/[a-z]+\\.ts)}"
				}
			},
			"usage": {
				"input": 900,
				"output": 24
			}
		},
		{
			"tool": {
				"name": "structured_output",
				"arguments": {
					"file": "{prompt:(src/[a-z]+\\.ts)}",
					"severity": "medium",
					"summary": "No backoff between attempts; failures are retried immediately.",
					"verdict": "The retry path lacks backoff; medium.",
					"nextStep": "Add exponential backoff to withRetry."
				}
			},
			"usage": {
				"input": 1400,
				"output": 70
			}
		}
	]
}