ryugi-artifacts 1.89.0 → 1.90.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.
- package/dist/cli.cjs +5 -5
- package/dist/runtime/ryugi-icons.js +1 -1
- package/dist/runtime/ryugi-mockup.js +115 -4511
- package/dist/server.cjs +357 -336
- package/dist/viewer/{DocumentLayout-Cmf7FfWa.js → DocumentLayout-BgenKsde.js} +2 -2
- package/dist/viewer/DocumentPage-wMUKIU6L.js +3 -0
- package/dist/viewer/VerifyLayout-Dtn2s3eO.js +1 -0
- package/dist/viewer/index.js +2 -2
- package/dist/viewer/useAssetBase-4Ut9QhBI.js +1 -0
- package/package.json +1 -2
- package/dist/viewer/DocumentPage-OoUlWAsj.js +0 -3
- package/dist/viewer/VerifyLayout-C2S0V2kY.js +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -179,7 +179,7 @@ ${n.map(({variableName:o,uniqueLocalName:r})=>` reactHotLoader.register(${o}, "
|
|
|
179
179
|
`),"",e.summary,...e.details?["",e.details]:[],"","Options:",tR(L3({...n,...yl,...N3}))].join(`
|
|
180
180
|
`)}function R3(e,t={}){return[`Usage: ${nk} [project-directory] [--no-open]`,` ${nk} <command> [options]`,"","Without a command, opens the project's artifacts in your browser and keeps the server","running until Ctrl+C.","","Commands:",tR(e.map(n=>[n.name,n.summary])),"","Tasks:"," Write or edit: start --background --no-open --artifact <type>/<id>, edit the returned file, then check."," Find or read: get --project-dir <path> (local); get <link-or-id> (cloud); scene for a whiteboard."," Apply feedback: comment list --artifact <type>/<id> --sections all --detail; changes for document edits."," Organize and share: modules, config, publish. Prepare the environment: install, update, start, stop."," Automation: start is finite by default; use --foreground for a live process. JSON uses ryugi.cli/v1.","",`Run \`${nk} <command> --help\` for a command's options.`,"","Options:",tR(L3({...yl,...t,version:{type:"boolean",short:"v",help:"Print the version"},...N3}))].join(`
|
|
181
181
|
`)}var S1e=e=>[...e.matchAll(/"([^"]*)"|'([^']*)'|(\S+)/g)].map(t=>t[1]??t[2]??t[3]);function T1e(){let e=process.env.RYUGI_ARTIFACTS_COMMAND?.trim();return e?S1e(e):[process.execPath,process.argv[1]]}function C1e(e){if(process.env.RYUGI_ARTIFACTS_FORMAT)return process.env.RYUGI_ARTIFACTS_FORMAT;let t=e.indexOf("--project-dir");try{return D_(t>=0&&e[t+1]?e[t+1]:process.cwd()).effective}catch{return"brief"}}function rn(e,t="Details"){let n=e.indexOf("--"),o=n<0?e:e.slice(0,n),r=n<0?[]:e.slice(n),s={...yl,...P_.find(c=>c.name===e[0])?.options},i=[],a=!1;for(let c=0;c<o.length;c++){let u=o[c];if(["--format","--source","--quiet"].includes(u.split("=")[0])&&(a=!0),u.startsWith("--")&&!u.includes("=")&&s[u.slice(2)]?.type==="string"&&o[c+1]!==void 0){let d=o[++c];i.push(d.startsWith("-")?`${u}=${d}`:u,...d.startsWith("-")?[]:[d])}else i.push(u)}let l=a||C1e(o)==="brief"?[]:["--format","brief"];return{kind:"command",argv:[...T1e(),...i,...l,...r],label:t}}var b1e=/^whiteboard\/[a-z0-9][a-z0-9-]*$/,k1e=e=>{let t=e;return typeof e=="object"&&e!==null&&typeof t.artifact=="string"&&typeof t.sceneVersion=="number"&&Array.isArray(t.lines)&&["none","current","stale"].includes(t.render)},$3={name:"scene",summary:"Read a whiteboard: its render and a structure summary (needs a running server)",usage:["--artifact whiteboard/<id> [--page <pageId>] [--frame <frameId>]"],details:"Prints the scene version, where the latest browser render is and whether it shows the current scene, then one line per frame, element and arrow, with who drew each. On a whiteboard with several pages it lists the pages; --page or --frame reads one.",options:{artifact:{type:"string",value:"whiteboard/<id>",help:"The whiteboard"},page:{type:"string",value:"<pageId>",help:"Read this page of a whiteboard with several pages"},frame:{type:"string",value:"<frameId>",help:"Only this frame and the arrows touching it, on whichever page holds it"}},semantic:e=>Xt({id:"scene",mode:"finite",output:{detail:!1,formats:["brief","json","jsonl","raw"],fields:["artifact","page","pages","sceneVersion","render","renderPath","lines","conflicts"],scalar:t=>t.render},async run(t,n){let o=e.values.artifact;if(!o||!b1e.test(o))throw new ze("--artifact must be whiteboard/<id>");let r=e.values.frame,s=e.values.page,i=await vr(e.projectDir).call("POST",`/api/agent/${o}/scene`,{...r?{frame:r}:{},...s?{page:s}:{}},n.signal);if(n.payloads.raw=i.raw,i.status<200||i.status>=300)throw new ze(i.json?.error||`HTTP ${i.status}`);if(!k1e(i.json))throw new we({code:"E_PROTOCOL_MISMATCH",message:"The server returned an invalid scene report."});let a=i.json;return It(a,{kind:"succeeded"},{actions:(a.pages??[]).map(l=>rn(["scene","--artifact",o,"--page",l.id,"--project-dir",e.projectDir],`Read ${l.id}`))})},present:v1e},e)};function v1e({data:e}){return{heading:"Scene",status:e.problem?"invalid":"",subject:e.artifact,facts:[...e.page?[Ge("Page",qt(e,"page"))]:[],Ge("Version",qt(e,"sceneVersion")),Ge("Render",qt(e,"render")),...e.renderPath?[Ge("Image",qt(e,"renderPath"))]:[],...e.problem?[Ge("Problem",qt(e,"problem"))]:[],Ge("Conflicts",{key:"conflicts",value:e.conflicts.join(", ")})],sections:[{kind:"content",key:"lines",text:e.lines.join(`
|
|
182
|
-
`)}]}}var ok={threads:["id","status","waitingOn","anchor","stale","changes","messages","preview","messageCount","omittedMessages"],asks:["id","state","choice","text","byRecommendation","staleChoice","note"],groups:["id","kind","verdict","choice","by","byRecommendation","round","threads","evidenceUpdated","rejectThreads","title","from","capturedAt"],rounds:["id","state","title","groups","submitted"]},M3={threads:["id","status","waitingOn"],asks:["id","state"],groups:["id","kind","verdict","choice"],rounds:["id","state"]},oR=e=>e.startsWith("document/")?["threads","asks"]:["threads","groups","rounds"];function D3(e,t){return e.section?"Choose section or sections, not both.":!e.sections.length||new Set(e.sections).size!==e.sections.length||e.sections.some(n=>!oR(t).includes(n))?"Choose distinct review sections supported by this artifact.":e.fields||e.cursor||e.snapshot||e.thread||e.filters&&Object.values(e.filters).some(n=>n!==void 0)?"Fields, filters, thread, cursor and snapshot require a single --section. Follow each collection continuation separately.":null}function P3(e){let{section:t,filters:n}=e;if(!t&&(e.detail||e.cursor||e.fields||n&&Object.values(n).some(Boolean)))return"Choose a section before requesting detail, fields, filters or a cursor.";if(t&&!(t in ok))return"Unknown review section.";if(n&&Object.keys(n).some(r=>!["status","waitingOn","kind","choiceState"].includes(r)))return"Unknown review filter.";if(n?.waitingOn&&(t!=="threads"||!["agent","human","any"].includes(n.waitingOn)))return"waitingOn applies to threads and must be agent, human or any.";let o=t==="threads"?["open","resolved"]:t==="asks"?["draft","submitted","settled","orphan"]:t==="groups"?["pending","pass","reject"]:["open","submitted","closed"];return n?.status&&!o.includes(n.status)?"Invalid status for this section.":n?.kind&&(t!=="groups"||!["choose","verify"].includes(n.kind))?"kind applies to groups.":t==="groups"&&n?.status&&n.kind!=="verify"?"Verify status requires kind=verify.":n?.choiceState&&(t!=="groups"||n.kind!=="choose"||!["chosen","empty"].includes(n.choiceState))?"choiceState requires a choice group.":t&&e.fields?.some(r=>!ok[t].includes(r))?"Unknown field for this section.":null}var F_={claude:"Claude Code","claude-code":"Claude Code",cowork:"Claude Cowork",codex:"Codex",cursor:"Cursor","cursor-cli":"Cursor",gemini:"Gemini CLI","gemini-cli":"Gemini CLI",grok:"Grok","grok-cli":"Grok","github-copilot":"GitHub Copilot","github-copilot-cli":"GitHub Copilot",kilo:"Kilo Code",omp:"OMP","oh-my-pi":"OMP",opencode:"OpenCode","qwen-code":"Qwen Code",antigravity:"Antigravity",augment:"Augment","augment-cli":"Augment",goose:"Goose",amp:"Amp",cline:"Cline",roo:"Roo Code",devin:"Devin",replit:"Replit",v0:"v0"},CZe=[...new Set(Object.values(F_))],w1e=[["omp",e=>!!e.OMPCODE],["grok",e=>!!(e.GROK_AGENT||e.GROK_SESSION_ID)],["cowork",e=>!!e.CLAUDE_CODE_IS_COWORK],["kilo",e=>!!e.KILO],["codex",e=>!!(e.CODEX_THREAD_ID||e.CODEX_SANDBOX||e.CODEX_CI)],["cursor",e=>!!(e.CURSOR_AGENT||e.CURSOR_TRACE_ID)],["gemini",e=>!!e.GEMINI_CLI],["github-copilot",e=>!!e.COPILOT_CLI],["opencode",e=>e.OPENCODE==="1"||!!e.OPENCODE_CLIENT],["qwen-code",e=>!!e.QWEN_CODE],["antigravity",e=>!!e.ANTIGRAVITY_AGENT],["augment",e=>!!e.AUGMENT_AGENT],["cline",e=>!!e.CLINE_ACTIVE],["roo",e=>!!e.ROO_ACTIVE],["claude",e=>!!(e.CLAUDECODE||e.CLAUDE_CODE)]],B3=["AI_AGENT","AGENT","OMPCODE","GROK_AGENT","GROK_SESSION_ID","CLAUDE_CODE_IS_COWORK","KILO","CODEX_THREAD_ID","CODEX_SANDBOX","CODEX_CI","CURSOR_AGENT","CURSOR_TRACE_ID","GEMINI_CLI","COPILOT_CLI","OPENCODE","OPENCODE_CLIENT","QWEN_CODE","ANTIGRAVITY_AGENT","AUGMENT_AGENT","CLINE_ACTIVE","ROO_ACTIVE","CLAUDECODE","CLAUDE_CODE"],F3=e=>e?.trim().split(/[@_]/)[0]?.toLowerCase()||void 0;function iy(e){if(e.CLAUDE_CODE_IS_COWORK)return F_.cowork;let t=F3(e.AI_AGENT);if(t)return F_[t]??t;let n=w1e.find(([,r])=>r(e))?.[0];if(n)return F_[n];let o=F3(e.AGENT);if(o&&!/^(?:1|true|yes)$/.test(o))return F_[o]??o}var ay=V(require("node:fs"),1),K3=V(require("node:path"),1);function B_(e,t,n){let o=K3.default.resolve(e),r=n?.begin("save",o),s;try{s=ay.default.openSync(o,"wx",384)}catch(i){throw r!==void 0&&n.set(r,"failed"),new we({code:i.code==="EEXIST"?"E_FILE_EXISTS":"E_FILE_WRITE_FAILED",message:`Could not create ${o}: ${i.message}`})}try{ay.default.writeFileSync(s,t)}catch(i){throw ay.default.closeSync(s),ay.default.unlinkSync(o),r!==void 0&&n.set(r,"failed"),new we({code:"E_FILE_WRITE_FAILED",message:`Could not save ${o}: ${i.message}`})}return ay.default.closeSync(s),r!==void 0&&n.confirm(r,{bytes:typeof t=="string"?Buffer.byteLength(t):t.byteLength}),{file:o,bytes:typeof t=="string"?Buffer.byteLength(t):t.byteLength}}var iR=V(require("node:fs"),1),rk=V(require("node:path"),1);var j3='# Artboard writing\n\nWrite `canvas.json` and board HTML/media under `pages/`. Re-read canvas before each edit; preserve human edits, stable IDs and positions. Never edit comments.json or `.state/`.\n\n## Writing order\n\nNew artboard or round: apply canvas changes as soon as the structure is ready, before composing a large HTML batch. Scripts and batch writes are fine: canvas first, then HTML with the focus group first; other boards may run in parallel. Existing board content edits need HTML only unless layout, grouping, metadata or focus changes.\n\n## canvas.json\n\n```json\n{\n "version": 1,\n "title": "Delivery settings",\n "activePage": "settings",\n "pages": [{ "id": "settings", "name": "Settings" }],\n "boards": {\n "q1-a": { "file": "pages/settings/a.html", "page": "settings", "x": 0, "y": 0, "w": 640, "h": 400, "title": "Fixed delay" },\n "q1-b": { "file": "pages/settings/b.html", "page": "settings", "x": 720, "y": 0, "w": 640, "h": 400, "title": "Exponential" }\n },\n "groups": {\n "q1": { "title": "Retry strategy", "boards": ["q1-a", "q1-b"], "choose": true, "recommend": "q1-b" }\n },\n "notes": {\n "round-one": { "kind": "title", "page": "settings", "x": 0, "y": -300, "text": "Retry strategy" }\n }\n}\n```\n\n- **Title**: readable, distinct from the slug.\n- **Boards**: HTML boards require file/page/x/y/w/h; title/interactive are optional. Media boards use type:"image"|"video" and src instead of file.\n- **Resources**: relative paths under pages/; other directories are not served. Limits: 8MB per media file, 20MB per artboard. Video: mp4(H.264)/webm. Verify clips trim idle ends with one second context and retain originals; trim:false preserves timing/narration. Check recordings/pending before handoff.\n- **Groups** contain board IDs from one page: plain groups organize, choose:true + recommend:<member> asks a choice, verify:true + from:<environment/build> + capturedAt:<real ISO capture time> asks a verdict. Never combine choose and verify.\n- **Notes** require kind (title/sticky/condition), page/x/y/text; title size defaults to 96, optional w wraps; sticky w defaults to 240, optional color is #RGB/#RRGGBB.\n- **Edges** connect boards that follow one another: see Flows.\n- **Opening view**: activePage is the opening default; existing readers keep their page. focus `{target:<board/group/note>,at:<fresh ISO time>}` guides first ready content/phone question without resetting open camera/drafts. Share ?page=<id> for a new area.\n- **Spacing** is explicit: 80px horizontal board gap, 160px row gap; group frame 144px above and 48px outside boards. Leave 240px vertically/200px horizontally between groups; notes >=80px clear.\n- **Appending**: read `.state/artboard/<id>/layout.json` for actual group/note rectangles and page bounds first. A new round starts below maxY, title at maxY+120 then boards below title+80+144.\n- **Sizes**: desktop1280x800, phone390x844, tablet834x1194, component640x400. Frame height clips without warning: size h to content.\n\n## Flows\n\nWhen boards are steps of one path (an action on one screen opens the next, a condition forks, an error leads back), draw the path: connect them with `edges` and use condition notes for branches. Boards that are options to compare stay unconnected in a group. The viewer routes lines and keeps them attached when nodes move. Edit `edges` to change connections.\n\n```json\n{\n "version": 1,\n "title": "Publish flow",\n "pages": [{ "id": "flow", "name": "Flow" }],\n "boards": {\n "artboard": { "file": "pages/flow/artboard.html", "page": "flow", "x": 0, "y": 0, "w": 1280, "h": 800, "title": "Artboard" },\n "sign-in": { "file": "pages/flow/sign-in.html", "page": "flow", "x": 2308, "y": 1200, "w": 1280, "h": 800, "title": "Sign in" },\n "share": { "file": "pages/flow/share.html", "page": "flow", "x": 4068, "y": 0, "w": 1280, "h": 800, "title": "Share panel" }\n },\n "notes": {\n "signed-in": { "kind": "condition", "page": "flow", "x": 1760, "y": 328, "text": "Signed in?" }\n },\n "edges": {\n "publish": { "from": "artboard", "to": "signed-in", "label": "Click Publish" },\n "yes": { "from": "signed-in", "to": "share", "label": "Yes" },\n "no": { "from": "signed-in", "to": "sign-in", "label": "No" },\n "done": { "from": "sign-in", "to": "share", "label": "Signed in" }\n }\n}\n```\n\nEdge `from`/`to` reference board or condition IDs on one page; boards and notes share an ID space. Optional `label`: one line, at most 32 characters. Conditions require page/x/y/text, one incoming edge and at least two outgoing edges, each labelled. They are 96px tall, text-width, without wrapping.\n\nLay out flows on a grid with 480px between connected boards and on each side of a condition. Align a condition with a board at `y + (h - 48) / 2 - 48` (the name strip is 48px). Keep the main path on one row and branches below, clear of other boards.\n\nFix `edge "<id>" crosses board "<id>"` notices by moving boards or conditions; lines cannot be routed by hand. Conditions must not cover boards.\n\n## Board HTML\n\nWrite complete HTML ending `</html>` (last when streaming), inline CSS/scripts, html/body margin0. Missing or unfinished files stay pending. Use native, accessible labelled controls with visible state changes. Static by default; interactive:true enables PLAY.\n\nEach board/expanded view has independent iframe state: use memory, no localStorage/sessionStorage/cookies. Keep shared-state flows in one board; relative links stay inside its iframe. Replay, HTML edits and page changes/reloads reset prototype state; selected/playing/tweaked frames stay mounted on the same page.\n\n`ryugi-icon name="copy" size="18"` supplies Lucide icons; label actions. For JS-only icons add meta name="ryugi-icons" content="1" and await custom element definition.\n\n## Feedback\n\nChoice lifecycle: title notes define rounds. Read comment list --sections threads,groups,rounds --detail; act only on submitted rounds and read their threads. If human answered in terminal, record actual picks with comment choose and comment submit --round <id>. Withdrawal means wait. Add next round below, not over the old one. Documents can reference groups/boards using inline ref; preserve referenced keys.\n\nMarked comments: each `marked` line describes one mark. A box on an image or video board can end with `\xB7 at t=<s>` (the video frame) and `\xB7 crop <path>`: open that JPEG with your image reader before acting; it shows what the box covers.\n\nVerify lifecycle: put screen evidence in new verify groups with real from/capturedAt and language-matched titles/stickies. Record pass/reject only on human instruction. On rejection, repair behavior, replace evidence (resets pending), reply and leave the thread open; passing closes it. Preserve passed evidence unless asked. Command-output claims/gaps belong in a verify report. Run Check after writing; clear pending/warnings before claiming ready and inspect screenshots/recordings for visual claims.\n\n`browser_not_run:<board>` means no browser has loaded that board since its file, or a file under `pages/` that is not a board, last changed. Boards load only on the open page and near the view: open the artboard, go to each page Check lists under `Show` (`?page=<id>`), bring those boards into view, then run Check again. Editing one board or moving boards keeps the other boards\' results. With no browser to open, report Check as incomplete.\n\n## Selection and node IDs\n\nFor "here", "selected", Inspector changes or a node ID (`hero-2#7`), read `.state/artboard/<id>/selection.json`:\n\n- `selected`: file, CSS path from body, text, html, tweaks (`property/from/value`); `more` counts omitted nodes.\n- `boards`, `notes`: selected canvas IDs, omitted when empty.\n- `tweaks`: Inspector changes outside the selection.\n- `nodes`: all node IDs with file/path; query only the requested ID, never dump the list.\n\n```bash\njq \'{selected, more, boards, notes, tweaks}\' \'.ryugi/artifacts/.state/artboard/<id>/selection.json\'\n```\n\nFor a typed ID: `jq \'.nodes[] | select(.id == "hero-2#7")\' \u2026/selection.json`. A harness-attached selection carries the same data. Edit its file/path; Inspector tweaks become source only when you write them. IDs renumber on every board reload/edit: resolve against current nodes and ask for a fresh ID before a later edit to that board.\n\n## Author-declared parameters\n\nExpose deliberate controls with one JSON declaration before any JS that reads it. The viewer supplies Parameters; phone uses defaults. Inspector Tweaks remain CSS overrides.\n\n```html\n<script type="application/json" data-ryugi-tweaks>\n {\n "version": 1,\n "controls": { "accent": { "type": "color", "default": "#b45309" } }\n }\n</script>\n```\n\nEach control needs `type` and `default`; optional `label` defaults to its key, `section` groups controls. Keys: letter first, then letters/digits/underscores/hyphens, <=64 characters, unique ignoring case.\n\n| Type | Values and extra fields |\n| --------- | ----------------------------------------------------------------- |\n| `color` | Six-digit hex; optional `options` list supplies swatches |\n| `range` | Number; requires `min` and `max`; `step` defaults to 1 |\n| `number` | Finite number; optional `min`, `max`, `step` |\n| `boolean` | `true` or `false` |\n| `enum` | String; `options` is a list of strings or `{value,label}` objects |\n| `text` | String, at most 512 characters |\n\nDefaults/updates must match type, bounds, step and options. Limits: 32 controls, 32 choices per control. Invalid JSON/defaults or duplicate declarations show a Parameters error.\n\nValues set `--tweak-<key>` and `data-tweak-<key>` on `<html>`; numbers are unitless (`calc(var(--tweak-radius, 12) * 1px)`). `window.ryugiTweaks` gives a typed snapshot; `document` emits `ryugi-tweaks` with all updated values in `event.detail`. Keep ordinary copy literal; expose text controls only for cross-cutting values or requested editable copy.\n\nControl changes and Reset apply without reload, preserving unrelated app state. Canvas/expanded instances share values per board; other boards are independent. Replay, source edits and page switches retain valid overrides; untouched defaults follow source changes, removed/invalid overrides fall back to defaults. Viewer refresh resets to defaults. Reset affects parameters only; preview values never write HTML or publish.\n\nTest the host Parameters control, each value, Reset, Replay and expanded view before claiming it works; appearance changes must preserve in-progress interactions.\n';var U3='# Document writing\n\nWrite `doc.xml` under the returned artifact directory; put assets in `assets/`. Re-read immediately before each edit: the human and server edit this file too. Patch intended blocks, preserve existing IDs and human text; new blocks omit IDs and receive them from the server. Never edit `comments.json` or `.state/`. The server normalizes aliases and indentation after saving. Finish with `check`; pending merging or browser work means check again, not success.\n\nUse a closed `<doc>`. Choose blocks for the reader: diagrams show relationships, charts compare numbers, tables map exact attributes, prose explains reasons. A first draft can contain `<pending intent="What remains to investigate"/>`; fill every pending before claiming completion. Diagrams use native mermaid, or a whiteboard of this project embedded with a reference (below); never pictures of text or box drawing in code blocks.\n\nComplete block and inline vocabulary:\n\n- `h1`\u2013`h6`, `p`, `blockquote`, `ul`/`ol` with `li`, `table`/`tr`/`th`/`td`, `hr`.\n- Inline `b i u s code sub sup mark a br`; aliases `strong em del strike`. Links use `href`. Ordered lists accept `start`; checklists use `<ul type="check"><li checked="true">Done</li></ul>`.\n- `codeblock lang="ts"`: code; use CDATA for literal XML/angle brackets. `mermaid`: native flowcharts/sequences/states. `math`: inline LaTeX, `display="block"` for a block.\n- `img src="assets/image.png" alt="\u2026" caption="\u2026" width="640"`: real images.\n- `alert type="note|tip|important|warning|caution"`: block children. `details summary="\u2026" open="true"`: collapsed depth; omit open for collapsed. `steps` contains `step title="\u2026"` with block children; titles omit numbering.\n- `footnote ref="1"` inline; `footnote-section` contains `def ref="1"` definitions.\n- `chart`: CDATA ChartSpec JSON. Required `version:1`, `type:bar|line|area|pie`, `x` category field, `series:[{key,label?}]`, `data` rows containing x and every series key. Values numbers/null, pie nonnegative. At most 6 series and 6 pie rows. Optional title/subtitle/note/source/xLabel/stacked/donut/highlight, format `{unit,compact,decimals,signed}`, y `{min,max}`, refs `[{y,label}]`. `highlight` is a `series.key` and highlights that entire series; omit it when unnecessary. With `series:[{key:"failures"}]` and rows `[{phase:"Before",failures:12},{phase:"After",failures:4}]`, `highlight:"failures"` is valid; `highlight:"After"` is invalid because it is a row/category value.\n- `dynamic url="assets/demo.html" initial-height="240"`: CDATA JSON becomes `window.ryugiProps`. Self-contained sandboxed HTML, inline scripts/styles, size by content, transparent body. Browser controls persist on HTML rewrite; changing props resets them. Runtime is incomplete until the block has run. Native HTML/CSS/JS and `ryugi-icon` work; storage/cookies do not.\n- `pending intent="\u2026"`, inline `ask`/`option` and `ref` (below; a whiteboard `ref` can also embed as a block). Other tags are rejected.\n\n```xml\n<doc>\n <h1>Retry policy</h1>\n <p>Retry failed delivery at most <b>3</b> times.</p>\n <mermaid><![CDATA[flowchart LR\n ingress --> queue --> worker]]></mermaid>\n <p>Choose a strategy: <ask id="retry-strategy" recommend="exponential"><option value="fixed">Fixed delay</option><option value="exponential">Exponential backoff</option></ask></p>\n <details summary="Evidence"><codeblock lang="text"><![CDATA[attempts: 3]]></codeblock></details>\n</doc>\n```\n\nQuestions: `ask` is inline in p/li/table-cell paragraphs, never directly under doc. Its unique stable id is lowercase letters/digits/hyphens; never reuse an old question ID. Options contain plain text and distinct `value`s; `recommend` must name an option. No options makes an open question: `<ask id="other" placeholder="Describe it"/>`. Human picks are drafts until submitted. Read `comment list --sections threads,asks --detail`. Apply submitted answers, then `comment note --ask <id> --text <what changed>`. Every submitted question needs a note, even unanswered ones (state what was left or assumed). Record terminal answers only when actually supplied via `comment answer --ask <id> --choice <value>` or `--text`, then `comment submit`. Never invent an answer; wait after withdrawal. Changed settled answers require a human instruction and a fresh note.\n\nReferences: inline `<ref document="slug"/>`, `<ref html="slug">label</ref>`, `<ref artboard="slug" group="q1"/>` (or board), `<ref whiteboard="slug" frame="f1"/>` (or page), `<ref slides="slug" slide="slide-id"/>` (a deck, or one slide of it). Exactly one kind, at most one allowed subtarget, lowercase slug. Optional plain text label; server adds `to` when resolved, preserve it. Missing targets are warnings; clear before handoff. Keep referenced IDs stable; when changing a target, update the reference too. A reference under its section heading connects that section to its companion canvas. Live choices/verdicts belong in refs, not duplicated prose.\n\nEmbedded whiteboards: `<ref whiteboard="slug" frame="f1" embed="true"/>` draws the whiteboard in the document instead of a chip. Write it as a paragraph of its own directly under `<doc>`, e.g. `<p><ref whiteboard="sync-flow" frame="f-steps" embed="true"/></p>`; never beside text, in a list, table or quote. `frame` shows that frame cut to its box, `page` one page, neither the main page. Only whiteboard references embed. The drawing follows the whiteboard live: draw and change it on the whiteboard, not in the document; a reader clicks it to open the whole whiteboard. A missing whiteboard or frame is the same check warning as any reference.\n\nAfter editing, run the returned Check command. It names invalid blocks, chart/math/diagram errors, unresolved refs and pending dynamic work. Read complete feedback before acting; reply/resolve and acknowledge only the receipt for evidence actually used.\n';var H3='# HTML writing\n\nWrite one complete `index.html` with a descriptive `<title>`, inline or relative styles/scripts/images. The page reloads on edits. Native HTML/CSS/JavaScript works; use labelled controls and visible results. Assets stay inside this artifact directory; CDN fonts/scripts work, absolute local paths do not. The iframe is sandboxed: localStorage/sessionStorage/cookies throw; keep state in DOM/variables. Popups, forms, downloads and clipboard work.\n\n```html\n<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>Retry explorer</title>\n </head>\n <body>\n <label>Attempts <input id="attempts" type="range" min="1" max="5" value="3" /></label>\n <output id="result"></output>\n <script>\n const input = document.getElementById(\'attempts\');\n const render = () =>\n (document.getElementById(\'result\').textContent = input.value + \' attempts\');\n input.addEventListener(\'input\', render);\n render();\n </script>\n </body>\n</html>\n```\n\nStable control IDs preserve human input, checks, details and scroll across rewrites. Restoration fires input/change: render from those events. Script-only state resets. Use one surface for one investigation; comparison across independent screens belongs on an artboard. Re-read files before editing; never edit comments or `.state/`.\n\nBundled UI elements require no imports. Use native HTML/CSS for layout. `ryugi-icon name="message-square" size="18"` provides Lucide kebab-case icons (stroke-width defaults 2, color currentColor); label the button, icons are decorative. Unknown names become runtime warnings. For JS-only icons add `<meta name="ryugi-icons" content="1">` and await customElements.whenDefined(\'ryugi-icon\'). Preview glyphs map to the app\'s existing business icons when implementing the design.\n\nRun Check after edits. It distinguishes current static evidence from browser runtime. A closed/unloaded tab means runtime pending; open the returned URL and check again. Uncaught exceptions, rejected promises and missing relative assets are warnings; no browser run is not proof that a page works.\n\n# UI components\n\nHTML artifacts can use a small set of Lobe UI components through Web\nComponents. The artifacts server loads the runtime automatically when the page\ncontains a `<ryugi-\u2026>` element:\n\n```html\n<ryugi-button variant="primary">Save</ryugi-button>\n```\n\nNo script tag is needed. If you create components dynamically, add\n`<meta name="ryugi-ui" content="1">` to the page so the runtime is loaded.\n\nThe runtime loads with `defer`. A page script that needs the components should\nwait for the document event:\n\n```js\ndocument.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n // custom elements are defined\n },\n { once: true },\n);\n```\n\nUse these for controls and basic display. Use plain HTML and CSS for layout;\nthere is no layout wrapper to learn.\n\n## Rules\n\n- Give every interactive control a stable `id`. The viewer restores custom\n controls across rewrites by `id`, the same way it restores native inputs.\n- Listen for `ryugi-change` on controls:\n\n ```js\n document.addEventListener(\'ryugi-change\', (event) => {\n const { value, checked } = event.detail;\n console.log(event.target.id, value, checked);\n });\n ```\n\n It bubbles. `value` is a string, number, boolean, or `null`; `checked` is\n present for checkboxes and switches.\n\n- `value` / `checked` attributes set the initial state. Read the current state\n from the element\'s `value` / `checked` property after `ryugi-ui:ready`, and\n listen for `ryugi-change` for later updates.\n- `class` styles the host; `style` is forwarded to the component as well, so\n `style="width:100%"` works. Style the host, not the component\'s internal\n classes.\n- Keep children simple. For `ryugi-button`, `ryugi-card`, `ryugi-text`,\n `ryugi-tag`, `ryugi-checkbox`, and `ryugi-badge`, the original children are\n moved into the component. `ryugi-select`, `ryugi-segmented`, and\n `ryugi-radio-group` use option children instead.\n- Do not invent a `ryugi-` tag. If a component is not listed here, use HTML.\n- `ryugi-card` already paints a surface. Do not put a background, border and\n padding on both the host and the card: pick one. For a floating panel,\n either position the host and let the card paint its own surface, or make the\n host the surface and use `variant="borderless"` without `glass`/`shadow`.\n- Components follow `prefers-color-scheme`. Set `<html data-theme="light">`\n or `data-theme="dark"` before the runtime loads to pin the whole page.\n Without an explicit theme, the runtime follows OS theme changes.\n Lobe tokens such as `--lobe-color-primary` can be overridden on the host or\n page.\n\n## Controls\n\n### Button\n\n```html\n<ryugi-button variant="primary" size="middle" icon="plus">Add</ryugi-button>\n<ryugi-button variant="outlined" loading>Working\u2026</ryugi-button>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `size`\n(`small`, `middle`, `large`), `block`, `loading`, `disabled`, `shape`, `type`,\n`icon` (any Lucide kebab-case name; `refresh` and `trash` remain aliases).\nRun `node app/ryugi.cjs guide icons` for standalone icons and mapping the preview\'s\nactions to business icons when implementing the app.\n\nUses the native `click` event.\n\n### Action icon\n\n```html\n<ryugi-action-icon icon="settings" title="Settings" aria-label="Settings"></ryugi-action-icon>\n```\n\nAttributes: `icon` (same set as Button), `size`, `disabled`, `title`,\n`aria-label`. Uses the native `click` event.\n\n### Tooltip and popover\n\n```html\n<ryugi-tooltip content="Copy a private link" placement="top">\n <ryugi-icon name="copy" size="14"></ryugi-icon> Copy\n</ryugi-tooltip>\n<ryugi-popover id="sharing" content="Only people you invite can open this link.">\n Sharing details\n</ryugi-popover>\n```\n\nBoth provide a native button trigger; children are its label and decorative\nicons, not nested buttons or controls. `content` is plain text, `placement`\nsets the floating position. Tooltip opens on hover/focus; Popover opens on\nclick (`trigger="hover"` opts into hover). Tooltip also accepts `open` for\na controlled preview. Native trigger clicks still reach your handlers.\n\n### Action menu\n\n```html\n<ryugi-menu id="actions" label="More" icon="ellipsis">\n <ryugi-menu-item value="copy" icon="copy">Copy link</ryugi-menu-item>\n <ryugi-menu-item value="delete" icon="trash-2" disabled>Delete</ryugi-menu-item>\n</ryugi-menu>\n```\n\nAttributes: `label`, `icon`, `placement`, `disabled`. Items accept `value`,\n`icon`, `disabled`; their text is the label. Selecting an enabled item emits\n`ryugi-change` with its action in `event.detail.value`. Actions are not\nrestored as control values on reload.\n\n### Input\n\n```html\n<ryugi-input id="title" placeholder="Title" value="Ryugi" style="width:100%"></ryugi-input>\n```\n\nAttributes: `type`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`, `borderless`), `allowClear`, `placeholder`, `value`,\n`disabled`, `name`, `aria-label`.\n\n### Textarea\n\n```html\n<ryugi-textarea id="notes" rows="4" placeholder="Notes" style="width:100%"></ryugi-textarea>\n```\n\nAttributes: `rows`, `size`, `variant`, `placeholder`, `value`, `disabled`,\n`name`.\n\n### Number\n\n```html\n<ryugi-input-number id="count" value="12" min="0" max="100" step="1"></ryugi-input-number>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `precision`, `controls`, `size`,\n`variant`, `placeholder`, `disabled`.\n\n### Slider\n\n```html\n<ryugi-slider id="size" value="32" min="0" max="100" step="1"></ryugi-slider>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `disabled`.\n\n### Slider with number input\n\nThe most useful control for tuning an exact value.\n\n```html\n<ryugi-slider-input id="radius" value="8" min="0" max="32" step="1"></ryugi-slider-input>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `controls`, `size`, `variant`,\n`disabled`.\n\n### Switch\n\n```html\n<ryugi-switch id="dark" checked></ryugi-switch>\n```\n\nAttributes: `checked`, `loading`, `size`, `disabled`, `name`.\n\n### Checkbox\n\n```html\n<ryugi-checkbox id="compact">Compact</ryugi-checkbox>\n```\n\nAttributes: `checked`, `shape`, `size`, `disabled`, `name`. Children are the\nlabel.\n\n### Segmented\n\n```html\n<ryugi-segmented id="mode" value="grid">\n <ryugi-segment value="list">List</ryugi-segment>\n <ryugi-segment value="grid">Grid</ryugi-segment>\n <ryugi-segment value="masonry">Masonry</ryugi-segment>\n</ryugi-segmented>\n```\n\nAttributes: `value`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`), `block`, `glass`, `shadow`, `vertical`, `disabled`.\n\n### Select\n\n```html\n<ryugi-select id="layout" value="a" placeholder="Choose layout">\n <ryugi-option value="a">Sidebar</ryugi-option>\n <ryugi-option value="b">Top tabs</ryugi-option>\n <ryugi-option value="c">Bottom rail</ryugi-option>\n</ryugi-select>\n```\n\nAttributes: `value`, `placeholder`, `size`, `variant`, `allowClear`,\n`showSearch`, `loading`, `mode` (`multiple`, `tags`), `disabled`.\n\n### Radio group\n\n```html\n<ryugi-radio-group id="density" value="comfortable">\n <ryugi-radio value="compact">Compact</ryugi-radio>\n <ryugi-radio value="comfortable">Comfortable</ryugi-radio>\n <ryugi-radio value="spacious">Spacious</ryugi-radio>\n</ryugi-radio-group>\n```\n\nAttributes: `value`, `horizontal`, `gap`, `size`, `disabled`.\n\n### Colour picker\n\n```html\n<ryugi-color-picker id="accent" value="#c56473" trigger="field"></ryugi-color-picker>\n```\n\nAttributes: `value`, `alpha`, `defaultFormat` (`hex`, `rgb`, `hsl`),\n`trigger` (`swatch`, `field`, `chip`), `size`, `disabled`.\n\n## Display\n\n### Toast\n\nHTML artifacts can call the bundled Lobe UI toast API as `window.ryugiToast`.\nIf the page has no `ryugi-` UI controls, opt in with the meta tag. Wait for\n`ryugi-ui:ready` before calling it:\n\n```html\n<meta name="ryugi-ui" content="1" />\n<button id="save" type="button">Save</button>\n<script>\n document.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n document.getElementById(\'save\').addEventListener(\'click\', async () => {\n try {\n await saveDraft(); // the page\'s own operation\n window.ryugiToast.success({ id: \'save-result\', title: \'Saved\' });\n } catch {\n window.ryugiToast.error({\n id: \'save-result\',\n title: \'Save failed\',\n description: \'Try again.\',\n });\n }\n });\n },\n { once: true },\n );\n</script>\n```\n\nMethods: `success`, `error`, `info`, `warning`, `loading`. Each takes a string\nmessage or `{ title, description, id, duration }`. Text is rendered as text,\nnot HTML. A stable `id` refreshes the same notification instead of stacking\ncopies. The default duration is 5000ms; `duration: 0` stays until closed.\n`loading` stays until closed by default.\n\nCalls return a handle with `id` and `close()`. Use\n`window.ryugiToast.dismiss(id)` to close one, or `dismiss()` to close all.\nToasts appear at the bottom right and follow the page\'s theme. They are\ntransient: rewriting the page does not restore them. No `ryugi-toast` tag is\nneeded. Artboard pages do not load this UI runtime.\n\n### Tag\n\n```html\n<ryugi-tag variant="outlined">New</ryugi-tag>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`, `solid`), `size`,\n`shape` (`normal`, `round`), `color`, `closable`.\n\n### Alert\n\n```html\n<ryugi-alert\n type="info"\n title="Streaming"\n description="Pending boards draw as skeletons."\n></ryugi-alert>\n```\n\nAttributes: `type` (`success`, `info`, `warning`, `error`, `secondary`),\n`variant` (`soft`, `outlined`, `plain`), `title`, `description`, `showIcon`,\n`closable`. Text children are used as the title when `title` is absent.\n\n### Progress\n\n```html\n<ryugi-progress percent="64" size="small"></ryugi-progress>\n```\n\nAttributes: `percent`, `size`, `status`.\n\n### Badge\n\n```html\n<ryugi-badge count="3" status="processing"></ryugi-badge>\n<ryugi-badge count="3">\n <ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n</ryugi-badge>\n```\n\nAttributes: `count`, `dot`, `status`, `text`, `showZero`, `size`, `color`.\n\n### Avatar\n\n```html\n<ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n```\n\nAttributes: `src`, `alt`, `size`, `shape`.\n\n### Divider\n\n```html\n<ryugi-divider dashed></ryugi-divider>\n```\n\nAttributes: `orientation`, `dashed`.\n\n### Card\n\n```html\n<ryugi-card variant="outlined" shadow>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Supporting copy.</ryugi-text>\n</ryugi-card>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `shadow`,\n`glass`, `clickable`. Children are preserved, including nested components.\n`glass`, `shadow` and `variant` paint the inner Block surface, not the host.\nIf the host supplies the panel background and padding, omit `glass`/`shadow`\nand use `variant="borderless"` so there is only one visible container.\n\n### Text\n\n```html\n<ryugi-text type="secondary">Secondary body text</ryugi-text>\n<ryugi-text strong>Strong label</ryugi-text>\n<ryugi-text code>const x = 1</ryugi-text>\n```\n\nAttributes: `type` (`secondary`, `success`, `warning`, `danger`, `info`),\n`strong`, `code`, `italic`, `underline`, `delete`, `mark`, `align`, `weight`.\n\n## Complete tuning panel\n\n```html\n<ryugi-card>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Tune the reading column.</ryugi-text>\n\n <ryugi-slider-input id="measure" value="64" min="40" max="90" step="1"></ryugi-slider-input>\n\n <ryugi-segmented id="density" value="comfortable">\n <ryugi-segment value="compact">Compact</ryugi-segment>\n <ryugi-segment value="comfortable">Comfortable</ryugi-segment>\n <ryugi-segment value="spacious">Spacious</ryugi-segment>\n </ryugi-segmented>\n\n <ryugi-switch id="dark"></ryugi-switch>\n <ryugi-tag>Live preview</ryugi-tag>\n</ryugi-card>\n\n<script>\n document.addEventListener(\'ryugi-change\', (event) => {\n document.body.dataset[event.target.id] = event.detail.value;\n });\n</script>\n```\n\n## Not included in the first version\n\nTabs, Modal, Drawer, Table, DatePicker, and layout\ncomponents. Use plain HTML/CSS or a later component if one is added.\n';var rR='## Mockup components\n\nPhone screens use `<ryugi-iphone>` and `<ryugi-ios-*>`: custom elements on Framework7\'s iOS CSS that expand in light DOM, so selection, comments and the Inspector reach every part. Never hand-draw a status bar, Dynamic Island, home indicator or bezel. The server loads them when the page contains one of these tags; for elements created by script add `<meta name="ryugi-mockup" content="1">` and wait for `ryugi-mockup:ready` on `document`. A phone is 390\xD7844, 430\xD7884 with `bezel`: size phone boards to match.\n\n```html\n<!doctype html>\n<html lang="zh">\n <head>\n <meta charset="utf-8" />\n <link rel="stylesheet" href="../tokens.css" />\n <style>\n html,\n body {\n margin: 0;\n }\n </style>\n </head>\n <body>\n <ryugi-iphone>\n <ryugi-ios-navbar title="\u8D26\u6237" large>\n <ryugi-ios-button slot="trailing" variant="glass" icon="plus"></ryugi-ios-button>\n </ryugi-ios-navbar>\n <ryugi-ios-list inset header="\u50A8\u84C4">\n <ryugi-ios-row title="\u62DB\u5546\u94F6\u884C" value="\xA512,400" accessory="chevron"></ryugi-ios-row>\n <ryugi-ios-row\n title="\u4F59\u989D\u63D0\u9192"\n icon="bell"\n icon-color="#ff9500"\n accessory="switch"\n checked\n ></ryugi-ios-row>\n </ryugi-ios-list>\n <ryugi-ios-tabbar value="accounts">\n <ryugi-ios-tab value="accounts" icon="wallet" label="\u8D26\u6237"></ryugi-ios-tab>\n <ryugi-ios-tab value="stats" icon="chart-pie" label="\u7EDF\u8BA1"></ryugi-ios-tab>\n </ryugi-ios-tabbar>\n </ryugi-iphone>\n </body>\n</html>\n```\n\n| Element | Attributes | Children |\n| --------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |\n| `ryugi-iphone` | `bezel`, `time` (9:41), `look="ios26\\|ios18"` | the screen; `--safe-top` 54px and `--safe-bottom` 34px for your own layout |\n| `ryugi-ios-navbar` | `title`, `large`, `back` (label; empty for the chevron alone) | `ryugi-ios-button slot="leading\\|trailing"` |\n| `ryugi-ios-search` | `placeholder`, `value`, `cancel` (label), `variant="glass\\|filled"` | none |\n| `ryugi-ios-list` | `inset`, `header`, `footer` | `ryugi-ios-row` |\n| `ryugi-ios-row` | `title`, `subtitle`, `value`, `icon`, `icon-color` (tile), `accessory="chevron\\|switch\\|check\\|none"`, `checked`, `destructive` | none |\n| `ryugi-ios-button` | `variant="filled\\|tinted\\|gray\\|plain\\|glass"`, `size="small\\|medium\\|large"`, `icon`, `block`, `destructive` | label text |\n| `ryugi-ios-switch` | `checked`, `disabled` | none |\n| `ryugi-ios-segmented` | `value` | `ryugi-ios-segment value` with label text |\n| `ryugi-ios-tabbar` | `value` | `ryugi-ios-tab value icon label`; sits on the phone\'s bottom edge |\n| `ryugi-ios-sheet` | `detent="medium\\|large"`, `title`, `grabber` | sheet content |\n| `ryugi-ios-alert` | `title`, `message` | `ryugi-ios-alert-action role="default\\|cancel\\|destructive"` |\n| `ryugi-token-sheet` | `appearance` to show one set only | one `<script type="application/json">` |\n\nEvery element takes `appearance="light|dark"`, otherwise follows the nearest phone, then the system. Icons are Lucide names. Sheets and alerts cover the phone screen with their dimmed backdrop; outside a phone they fill a 480px box. Switch, segmented control and tab bar respond to clicks: they update `checked` / `value` and dispatch a bubbling `ryugi-change` with `detail: { value, checked }`; everything else is static. Unknown attribute values fall back to the default and raise a runtime warning. `look="ios18"` approximates iOS 18 (10px groups, opaque tab bar, plain navbar buttons, 12px buttons); everything else stays iOS 26.\n\nProduct tokens live in one stylesheet (on an artboard `pages/tokens.css`), light on `:root`, dark on `[data-appearance="dark"]`. Element roots carry `data-appearance`, so light and dark phones sit side by side. Unset variables fall back to iOS system values: `--color-bg`, `--color-surface`, `--color-surface-raised`, `--color-text`, `--color-text-secondary`, `--color-text-tertiary`, `--color-separator`, `--color-fill`, `--color-accent`, `--color-on-accent`, `--color-positive` (switch on), `--color-negative`, `--radius-group`, `--font-body`, `--font-display`. Your own layout between elements reads the same variables.\n\n`ryugi-token-sheet` draws the token table from JSON that names tokens, never values; values come from the stylesheet in both appearances:\n\n```json\n{\n "groups": [\n {\n "name": "Text",\n "kind": "color",\n "tokens": [\n {\n "name": "--color-text-secondary",\n "use": "\u884C\u53F3\u4FA7\u7684\u503C",\n "on": "--color-surface",\n "board": "t-color-a"\n }\n ]\n },\n {\n "name": "Type",\n "kind": "type",\n "tokens": [{ "name": "--type-body", "use": "\u6B63\u6587", "sample": "\u62DB\u5546\u94F6\u884C\u50A8\u84C4\u5361" }]\n }\n ]\n}\n```\n\nKinds: `color` (swatches; with `on`, WCAG contrast per appearance flagged under 4.5:1, or 3:1 with `"large": true`), `type` (a `font` shorthand), `space`, `radius`, `size`, `shadow`, `motion` (`<duration> <easing>`, click to play). Token and group names are English; `use` and `sample` follow the product\'s language. Missing variables and broken JSON show inline errors.\n';var W3='# Report writing\n\nA report is data and presentation kept apart. Each data source is a Node script that prints JSON; the report is `report.tsx`, one default-exported component built only from `@ryugi/report` that imports the data it draws.\n\n```\nreport/<id>/\n report.tsx\n sources/<source-id>/source.json\n sources/<source-id>/<script>.mjs\n data/<source-id>.json written by the hub when a source runs; never write it by hand\n assets/<file>.png images the report shows (png, jpg, gif, webp, avif, svg)\n```\n\n## Data sources\n\n`sources/<source-id>/source.json`: `{ "title": "Commits per day", "description": "main branch, last 30 days", "input": "git history of the repo", "script": "collect.mjs", "args": ["--days", "30"] }`. `title` and `script` are required; the script is a `.mjs`, `.js` or `.cjs` file in the same folder. Source ids are kebab-case.\n\nThe script runs with the project root as cwd and Node from the hub, so it can use the project\'s `node_modules`. Its env is the hub\'s env with the project\'s `.env` and `.env.local` laid over it; read secrets and machine paths from env or `args`, never write them into the script. It must print one JSON value on stdout (at most 2 MB; the whole report\'s data at most 10 MB) and exit 0 within 60 s. Do the aggregation in the script: the report only draws. A stderr line `ryugi:input <text>` replaces the input shown in the panel for that run, such as the commit the data was read at; other stderr is shown when the run fails.\n\nRun sources with `ryugi report refresh --artifact report/<id>` (all) or with `--only <source-id>` (one). The hub runs them, one run per source at a time, and writes `data/<source-id>.json`. Refresh after adding or changing a source, and before `check`. Reports fetched from someone else\'s Cloud link are read-only: never run their scripts.\n\n## report.tsx\n\n```tsx\nimport {\n BarChart,\n Grid,\n Report,\n Section,\n Stat,\n Table,\n useMemo,\n useState,\n Param,\n} from \'@ryugi/report\';\nimport days from \'./data/commits-per-day.json\';\n\nexport default function Commits() {\n const [span, setSpan] = useState(14);\n const shown = useMemo(() => days.slice(-span), [span]);\n return (\n <Report title="Ryugi commits" caption="main branch">\n <Param label="Window" min={7} max={30} unit="days" value={span} onChange={setSpan} />\n <Grid columns={3}>\n <Stat\n id="total"\n source="commits-per-day"\n title="Commits"\n value={shown.reduce((sum, day) => sum + day.commits, 0)}\n />\n </Grid>\n <Section id="daily" title="Per day">\n <BarChart\n id="per-day"\n source="commits-per-day"\n title="Commits per day"\n data={shown}\n x="date"\n series={[{ key: \'commits\', label: \'Commits\' }]}\n />\n <Table\n id="days"\n source="commits-per-day"\n title="Days"\n rows={shown}\n rowKey="date"\n columns={[{ key: \'date\' }, { key: \'commits\', align: \'right\' }]}\n />\n </Section>\n </Report>\n );\n}\n```\n\nImports come only from `@ryugi/report` and `./data/<source-id>.json` (default import; the source must exist). JSX uses SDK components only: no `div`, `img`, `a` or other native elements, no network calls, `document` / `window` / `location` / `navigator` / storage access, `globalThis`, `eval`, `Function`, `.constructor`, `import()` / `require()` or timers. Words in text and strings are fine; the check reads code. The page cannot reach the network either way. `report.tsx` stays under 64 KB; put data in a source. Derive with `useMemo` and plain expressions; keep state in `useState`.\n\nEvery Stat, chart, Table, Callout, Image and Section needs an `id`: kebab-case, unique in the report, and stable across edits, since comments and references hold on to it. Stat, charts and Table also need `source`: the source id, or a list of them, that the block\'s numbers come from; the hover chip and the sources panel read it. Write `id`, `source` and `title` as string literals.\n\nComponents:\n\n- `Report` `{ title, caption? }`: the root; `title` is the artifact\'s title.\n- `Section` `{ id?, title? }`, `Grid` `{ columns?: 1 | 2 | 3 | 4 }`, `Card`, `Stack` `{ gap? }`, `Divider`.\n- `H2`, `H3`, `Text` `{ tone?: \'muted\' }`, `List` `{ items }`, `Callout` `{ id, title?, tone?: \'info\' | \'success\' | \'warning\' | \'error\' }`.\n- `Stat` `{ id, source, title, value, unit?, delta?, format?, note? }`; `delta` is signed and shown up or down.\n- `Table` `{ id, source, title?, rows, rowKey, columns: { key, label?, align?, format? }[] }`; every row prints; a click on a row starts a comment on it.\n- `LineChart`, `BarChart`, `AreaChart`, `PieChart`, `ScatterChart` `{ id, source, title, data, x, series: { key, label?, color? }[], subtitle?, stacked?, donut?, highlight?, refs?: { label, y }[], format?, note? }`: the same chart renderer as a document\'s chart block. A `ScatterChart` needs a numeric `x` in every row. A reader clicks a point to pin it and comments on that point.\n- `Param` `{ label, value, onChange, min?, max?, step?, unit? }` (a slider with a number field when min and max are set), `Select` `{ label?, value, options, onChange }`, `Toggle` `{ label, checked, onChange }`. Printed, they show the value the reader set; a comment on a point or row records them too.\n- `Image` `{ id, src, alt, caption?, width? }`: an image file from the report folder, `src` written as a string such as `"assets/sources-panel.png"`; `alt` describes it. Copy screenshots and figures into `assets/` first; remote URLs are not allowed. Comments anchor to the image as a block.\n- `useState`, `useMemo` from `@ryugi/report`.\n\n`format` is `{ unit?, decimals?, compact?, signed? }`.\n\n## Check, comments, references\n\n`ryugi check --artifact report/<id>` reports static issues (imports, native elements, missing or repeated ids, unknown sources, missing data files) and, once a browser has opened the report, render errors.\n\nComments anchor to a block, a table row or a chart point: `ryugi comment add --artifact report/<id> --block <block-id> [--point <series>:<x> | --row <rowKey>]`. A comment keeps the value it was made on and which data it saw; after a refresh changes that data it is marked data changed and stays where it was.\n\nReference a report from a document or a deck with `<ref report="<id>"/>`, or one block with `<ref report="<id>" block="<block-id>"/>`.\n\nPublishing includes `report.tsx`, `sources/**`, `data/**` and the images under `assets/` with the report\'s visibility. Publishing is refused while a script, `report.tsx` or the data holds an absolute machine path (`/Users/\u2026`, `/home/\u2026`, `C:\\\\\u2026`, not checked in data) or something that looks like a secret (`sk-\u2026`, `ghp_\u2026`, `AKIA\u2026`, a private key, a value from `.env`); the refusal names the file and line.\n';var z3='# Slides writing\n\nWrite one complete `deck.xml` under the returned artifact directory; put images in `assets/` and reference them with relative paths. The deck is for an audience: your human partner presents it. Re-read before each edit; never edit `comments.json` or `.state/`. Finish with `check`.\n\nThe file holds what the slides say. The server compiles it into the page and adds the presentation engine, theme, code highlighting, diagrams and formulas. Only the tags and attributes below exist: there is no `class` and no `style`, and `check` reports anything else by slide and tag.\n\n```xml\n<deck title="Retry policy" lang="en">\n <slide id="cover" layout="cover">\n <kicker>Delivery \xB7 Q3</kicker>\n <h1>Retry policy</h1>\n <subtitle>Why failed deliveries now retry three times</subtitle>\n <notes>Open with last month\'s incident.</notes>\n </slide>\n\n <slide id="what-changes">\n <h2>What changes</h2>\n <ol steps="true">\n <li>At most three attempts</li>\n <li>Exponential backoff</li>\n </ol>\n </slide>\n\n <slide id="backoff" layout="code">\n <h2>Backoff</h2>\n <codeblock lang="ts" lines="1|2-3"><![CDATA[\n const delay = (attempt: number) =>\n Math.min(30_000,\n 500 * 2 ** attempt);\n ]]></codeblock>\n </slide>\n</deck>\n```\n\n## Slides\n\n- One slide is one `<slide>` directly inside `<deck>`. The deck\'s `title` is required; `lang` is optional.\n- Every slide needs a unique, stable `id` of lowercase letters, digits and hyphens. Comments and document references find a slide by its id: keep the id when you rewrite a slide, and only change it when the slide becomes a different slide. Deleting a slide orphans its comments.\n- The canvas is fixed at 1280\xD7720. Content that leaves that box is reported by `check` as overflow, naming the slide. Fix it by cutting or splitting the slide; `zoom="0.8"` on the slide (0.3 to 1) is for the one dense slide that must stay whole.\n- While the deck is open in the viewer, `check` also names contact sheet images (`Sheet:`) that show every slide at its last step, twelve to an image, with overflowing and hidden slides marked. After editing, run `check`, open those images, and look for slides that are too full or that all look like the same template. `sheet_not_drawn` under `Pending` means the open viewer has not drawn this version yet. `Sheet: unavailable (\u2026)` means it cannot be drawn, as for a deck holding a video or an iframe: go on without it.\n- `hidden="true"` keeps a slide in the file and out of the talk: it shows, marked, only while the deck is worked on; presenting, the audience window, the PDF and a published link never get it, and it takes no page number.\n- `<group id="evidence" title="What the data says">` inside `<deck>` gathers the slides of one part of the talk. It holds only `<slide>` and `<include>`, never another group; its `id` follows the slide id rules and is unique among slides and groups, and `title` is required. The grid view shows each group as a titled row; the audience sees nothing of it. Slides outside any group are fine, before, between or after groups.\n- `cover="<slide id>"` on `<deck>` names the slide that stands for the deck in lists and links. `check` warns when it names a slide that is missing or hidden.\n- Write XML: close every tag, quote every attribute, write `<` and `&` in text; common names such as ` `, `—` and `→` work, any other is an error, so write the character itself. Code, diagrams and formulas go in `<![CDATA[ \u2026 ]]>` so nothing in them needs escaping. CDATA ends at the first `]]>`: code that contains `]]>` comes from a file with `src`. End the file with `</deck>`.\n\n## Layouts\n\nPick the layout that fits what the slide says, and vary them: a deck of identical title-and-bullets slides reads as a template. Each layout adds a few places of its own; a place used in another layout is reported. The theme adds the page number itself.\n\n| `layout` | Use it for | Inside the slide |\n| ----------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------- |\n| `default` | A title with text, a list, a table or code | Optional `<label>`, an `<h2>`, then blocks. Omitting `layout` gives this one |\n| `cover` | The first slide | `<kicker>`, `<h1>`, `<subtitle>` |\n| `section` | The start of a new part | Optional `<label>`, then an `<h1>` or `<h2>` |\n| `statement` | One sentence the audience should remember | Optional `<label>`, an `<h2>` with the key words in `<mark>`, optional `<subtitle>` |\n| `two-cols` | Two things side by side | An `<h2>`, then exactly two `<col>`, each holding blocks |\n| `image` | Text beside a picture | One `<col>` holding the text and one `<img>`; whichever comes first is on the left |\n| `quote` | A quotation | `<quote>` and `<cite>` |\n| `fact` | One number that matters | `<big value="10\u201312" unit="working days"/>`, then up to three `<fact value="5 days" label="API"/>` |\n| `code` | Code as the subject of the slide | Optional `<label>`, an `<h2>` and one `<codeblock>` or one `<magic>` |\n| `end` | The last slide | An `<h1>` |\n| `none` | A slide you lay out yourself | `src` naming an HTML file; see Free HTML. No padding and no page number |\n\n```xml\n<slide id="numbers" layout="fact">\n <big value="13" unit="harnesses supported"/>\n <fact value="5" label="artifact types"/>\n <fact value="0" label="subscriptions"/>\n</slide>\n<slide id="before-after" layout="two-cols">\n <h2>Before and after</h2>\n <col>\n <h3>Before</h3>\n <p>One attempt, then a page.</p>\n </col>\n <col>\n <h3>After</h3>\n <p>Three attempts, then a page.</p>\n </col>\n</slide>\n<slide id="dashboard" layout="image">\n <col>\n <label>Result</label>\n <h2>Failures fell by half</h2>\n </col>\n <img src="assets/dashboard.png" alt="Failure rate before and after the change" frame="true"/>\n</slide>\n```\n\n## Blocks and text\n\nBlocks sit in a slide or a `<col>`: `<h1>`, `<h2>`, `<h3>`, `<p>`, `<ul>` and `<ol>` of `<li>` (a list may nest in an item), `<table>` of `<tr>` holding `<th>` or `<td>`, `<blockquote>`, `<hr/>`, `<alert type="note|tip|important|warning|caution">` holding blocks, `<img>`, `<icon>`, `<codeblock>`, `<magic>`, `<mermaid>`, `<math>`, `<html>`, `<embed>` and `<notes>`.\n\nBlocks and inline tags a document also has carry the same names here. Inside text: `<b>`/`<strong>`, `<i>`/`<em>`, `<u>`, `<s>`/`<del>`, `<sub>`, `<sup>`, `<code>`, `<mark>`, `<a href="\u2026">`, `<br/>`, `<math>` and `<icon>`.\n\n- `<img src="assets/chart.png" alt="\u2026"/>` shows a file of the artifact directory. `frame="true"` gives a screenshot rounded corners and a shadow.\n- `<icon name="check" size="32"/>` draws an icon; `size` is in pixels.\n- `<mermaid>` holds a Mermaid diagram and `<math>` a LaTeX formula, both in CDATA. `<math>` inside text is an inline formula.\n- `<notes>` holds speaker notes, shown only to the presenter. One per slide, plain text with `<br/>` between lines.\n\n```xml\n<h2>How a delivery flows</h2>\n<mermaid><![CDATA[\n flowchart LR\n A["ingress<br/>edge"] --> B[queue] --> C[worker]\n]]></mermaid>\n<table>\n <tr><th>Attempt</th><th>Delay</th></tr>\n <tr><td>1</td><td><math>500 \\cdot 2^1</math> ms</td></tr>\n</table>\n<p><icon name="check" size="24"/> Shipped behind a flag, see <a href="https://example.com/rfc">the RFC</a>.</p>\n```\n\n## Code\n\n`<codeblock lang="ts">` is a code block, named as in a document; `<code>` is inline code inside text. Write the code in CDATA; the indentation it shares with the XML is taken off.\n\n- `lines`: stepped line highlight. Parts are separated by `|`, each one step, lines count from 1: `1`, `2-3`, `2-3,5`; `all` lights every line and `hide` hides the block for that step.\n- `src="src/retry.ts#L10-24"`: take the code from a file of the project instead of writing it, optionally only those lines. The path is relative to the project root; files outside the project, dot-files such as `.env`, and files over 512 KB are refused, and so are files named like secrets (`secrets.*`, `credentials.*`, `*.pem`, `*.key`, `*.tfstate`, `*.tfvars`, SSH keys) and files git ignores. Never show a file that holds a secret under another name. What a deck shows is published with it.\n- `numbers="true"`: line numbers. `title="src/retry.ts"`: a title above the block. `max-height="320"`: a height in pixels past which the block scrolls, following the highlighted lines. `diff="true"`: lines starting with `+` or `-` are drawn as added or removed.\n- `<magic lang="ts">` holds two or more `<step>`, each the whole code at one step, in CDATA; what stays moves into place, and each step after the first is a step of the slide.\n\n```xml\n<codeblock lang="ts" src="src/retry.ts#L10-24" numbers="true" title="src/retry.ts" lines="all|3-5"/>\n<codeblock lang="ts" diff="true"><![CDATA[\n const attempts =\n - 1;\n + 3;\n]]></codeblock>\n<magic lang="ts">\n <step><![CDATA[const delay = 500;]]></step>\n <step><![CDATA[const delay = (attempt: number) => 500 * 2 ** attempt;]]></step>\n</magic>\n```\n\n## Steps and marks\n\n- `step="true"` on a block or a list item: it appears on the next step. `steps="true"` on a `<ul>`, `<ol>`, `<table>` or `<col>` makes each item, row or block a step.\n- `step="2"` places a step by number, and `step="with"` makes it appear together with the step before it.\n- `<mark>` highlights words. `type="highlight"`, `underline`, `circle` or `strike` draws that mark; with `step` the words are there from the start and the mark is drawn on its step.\n- `morph="title"` on a block in two consecutive slides moves it from one to the other; a name is used once per slide and the pair should hold the same text.\n\n```xml\n<h2 morph="title">The <mark type="underline" step="true">retry budget</mark> is per delivery</h2>\n<p step="true">Three attempts in total.</p>\n<p step="with">The first one counts.</p>\n<ul steps="true">\n <li>500 ms</li>\n <li>1 s</li>\n</ul>\n```\n\n## Several files and free HTML\n\n- `<include src="parts/appendix.xml"/>` inside `<deck>` puts the slides of another file of the artifact directory there. That file starts with `<slides>`, holds only `<slide>`, and cannot include further files. Ids stay unique across all files.\n- `<html src="parts/demo.html"/>` is a block of HTML you write yourself, in a file of the artifact directory.\n- `<slide id="demo" layout="none" src="parts/demo.html"/>` is a whole slide of your own HTML: you own every pixel of 1280\xD7720. It may hold `<notes>` and nothing else.\n- A free HTML file is a fragment: no page wrapper, every `<div>` closed. `data-step` on an element inside it makes that element a step. It runs in the deck\'s sandbox: no localStorage, sessionStorage or cookies.\n\n```xml\n<deck title="Retry policy">\n <slide id="live-demo" layout="none" src="parts/demo.html">\n <notes>Click through the three states.</notes>\n </slide>\n <slide id="curve">\n <h2>The backoff curve</h2>\n <html src="parts/curve.html"/>\n </slide>\n <include src="parts/appendix.xml"/>\n</deck>\n```\n\n## Other artifacts\n\n`<embed>` puts another artifact of this project on the slide, in a box that keeps the target\'s shape and fills the width it is given. Name the target by its slug, as a document\'s `<ref>` does:\n\n- `<embed artboard="settings-page" board="q1-b"/>` shows one board of an artboard.\n- `<embed whiteboard="sync-flow" frame="f1"/>` shows one frame of a whiteboard.\n- `<embed html="spring-curve"/>` shows an html page, at 1280\xD7720.\n\nA board or an html page is live and read-only on this computer: it shows the target as it is now and changes when the target does, and nobody can click or comment in it during the talk. A whiteboard frame is a picture of the frame as the whiteboard was last drawn in the viewer, so open the whiteboard once before embedding it. In thumbnails, PNG export and the contact sheet a board is a picture; an html page has no picture there and holds its place under its name. On a published link every embed holds its place under its name for now, a whiteboard frame included: nothing of the target is published with the deck.\n\nAn embed takes `step` and `morph` like any block. `check` warns, naming the slide, when the artifact, board or frame is not there, and the slide shows the target\'s name in its place.\n\n```xml\n<slide id="settings" layout="two-cols">\n <h2>The settings page</h2>\n <col>\n <p>Option B keeps billing on the first screen.</p>\n </col>\n <col>\n <embed artboard="settings-page" board="q1-b"/>\n </col>\n</slide>\n```\n\n## Theme, motion and glow\n\nChange the look for the whole deck with one `<theme>` before the first slide. `name` picks the theme: `paper` (the default: warm paper, one seal-coloured accent, glow) or `mono` (black on white, monospace labels, emphasis by weight, no glow). `appearance` is `light`, `dark` or `auto`; `auto`, the default, follows the system of whoever opens the deck and prints light, so write `light` or `dark` when the room decides. Every other attribute overrides one variable of the theme, in both appearances. A deck that sets its own `paper`, `surface` or `ink` is `light` unless it names an appearance: those colours suit one appearance only. Do not restyle slide by slide.\n\n```xml\n<deck title="Retry policy">\n <theme name="paper" appearance="dark" accent="#0a7cff" transition="slide-left" fragment="rise" glow-opacity="0.6"/>\n <slide id="cover" layout="cover" transition="fade" glow="top-right" glow-seed="launch">\n <h1>Retry policy</h1>\n </slide>\n</deck>\n```\n\n| `<theme>` attribute | Values | Paper |\n| ----------------------------- | ------------------------------------------------------------ | ------------------------------- |\n| `paper`, `surface` | the slide\'s background, and that of code and cards | |\n| `ink`, `ink-2`, `ink-3` | text, secondary text, labels | |\n| `accent`, `on-accent`, `info` | the accent colour, text on it, and the second accent | |\n| `rule`, `rule-strong` | hairlines | |\n| `font`, `font-mono` | font families | |\n| `transition` | `view`, `fade-out`, `fade`, `slide-left`, `slide-up`, `none` | `view` |\n| `transition-duration` | a time | `500ms` |\n| `transition-blur` | a length | `5px` |\n| `fragment` | `blur`, `fade`, `rise` | `blur` |\n| `fragment-duration` | a time | `500ms` |\n| `fragment-blur` | a length | `3px` |\n| `glow` | `on`, `off` | `on` |\n| `glow-1`, `glow-2`, `glow-3` | colours of the three shapes | `#9440e3`, `#41d1ff`, `#dce354` |\n| `glow-fade` | the colour each shape fades to | `rgb(255 255 255 / 0.1)` |\n| `glow-opacity` | 0 to 1 | `1` |\n| `glow-blur` | a length | `70px` |\n| `glow-drift` | how long the glow takes to move to the next slide\'s place | `2500ms` |\n| `glow-hue` | an angle | `0deg` |\n| `glow-at` | a glow place | `full` |\n\nTransitions:\n\n- `view`: the slide fades out, then the next fades in, both blurred; blocks with the same `morph` on both slides move and resize between them.\n- `fade-out`: the same fade out then in, without moving blocks.\n- `fade`: both slides cross-fade.\n- `slide-left`, `slide-up`: the next slide pushes in from the right or from below; going back reverses it.\n- `none`: the slide changes at once.\n\nSteps: `blur` fades a step in from a blur, `rise` also lifts it 12px, `fade` only fades it.\n\nOn a `<slide>`:\n\n- `transition`: the transition into this slide, one of the values above.\n- `glow`: where this slide\'s glow sits: `full`, `top`, `bottom`, `left`, `right`, `top-left`, `top-right`, `bottom-left`, `bottom-right`, `center`, or `none` for no glow. Left out, the place follows the layout and changes from slide to slide.\n- `glow-seed`: any text; the same seed on the same page number always gives the same shapes.\n- `glow-opacity`: 0 to 1, this slide only.\n- `glow-hue`: degrees, this slide only.\n\n`check` reports an unknown transition or glow place and a `morph` name used twice in one slide. With reduced motion, turns are instant and the glow does not move.\n\n## Placing blocks freely\n\nA layout arranges a slide for you. When a slide must sit exactly as drawn, put `free="true"` on it: every block it holds, inside a `<col>` too, then takes `x`, `y` and `w` in slide pixels of the 1280\xD7720 canvas, and `h` when its height matters (pictures, embeds, diagrams). The layout stays named, so its type sizes still apply, and removing `free` with the coordinates brings the layout back. A block on a free slide without `x`, `y` and `w` is reported, and so are coordinates on a slide that is not free. Later blocks sit on top of earlier ones.\n\n```xml\n<slide id="library" layout="two-cols" free="true">\n <h2 id="b4k2qz" x="96" y="80" w="520">The library</h2>\n <col>\n <p x="96" y="180" w="420" align="center" color="muted">Every artifact, one server.</p>\n </col>\n <col>\n <img x="640" y="120" w="560" h="380" src="assets/library.png" alt="The library page" frame="true"/>\n </col>\n</slide>\n```\n\n- `align="left|center|right|justify"` and `color` work on text blocks on any slide. `color` takes a theme colour, `ink|muted|faint|accent|info`, which follows the theme and its light and dark appearances, or a fixed `#RRGGBB` / `#RRGGBBAA`, which does not. Prefer the theme colours.\n- On a free slide, `w="fill"` stretches a block from its `x` to the right safe margin, and a text block may take `h`: what does not fit is clipped, unless the block also has `fit="shrink"`, which shrinks its text until it fits.\n\n### Look attributes\n\nYour human partner tunes blocks in the viewer\'s tweak panel. Each setting is one attribute on the block, on any slide; `check` reports a value outside its range and an attribute on a block that does not take it.\n\n| Attribute | Blocks | Value |\n| --------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------- |\n| `size="32"` | text | font size, 8\u2013400 px |\n| `weight="600"` | text | 100\u2013900 in steps of 100 |\n| `font="Avenir Next"` | text | `mono` or a font name; a font missing on another machine falls back to the theme font |\n| `leading="1.4"` | text | line height, 0.8\u20133 |\n| `tracking="-0.5"` | text | letter spacing, -20\u2013100 px |\n| `pad="16"` | text, table, codeblock, code, alert, big, fact | padding, 0\u2013200 px |\n| `fill="surface"` | all but hr, icon and html | a theme colour (`surface`, `paper`, `ink`, `muted`, `faint`, `accent`, `info`) or hex |\n| `opacity="80"` | all but html | 0\u2013100 |\n| `radius="12"` | all but hr, icon and html | 0\u2013360 px |\n| `border="solid"` | all but hr, icon and html | `solid`, `dashed` or `dotted`, 1 px in the theme\'s rule colour |\n| `shadow="0 8 24 #00000040"` | all but hr, icon and html | x, y, blur in px and a colour |\n\n```xml\n<slide id="promise" free="true">\n <p x="96" y="180" w="fill" h="120" fit="shrink" size="32" weight="600" fill="surface" radius="12" pad="16">Every artifact, one server.</p>\n</slide>\n```\n\nThese are deliberate choices: keep these attributes when you rewrite a block, unless changing them is the point.\n\n- An `id` on a block (letters, digits, `_` and `-`, at most 32) is how the viewer and comments know that block again. Your human partner\'s edits give blocks ids: keep every block id when you rewrite a slide, as you keep slide ids.\n\n## Rules\n\n- A talk is given offline: keep fonts, scripts and images inside the artifact directory and avoid CDNs.\n- Notes are not secret: they are hidden from viewers in the interface but remain in the page source.\n- Your human partner can edit notes in the viewer. Saving writes that slide\'s `<notes>` back as plain text lines joined by `<br/>`, replacing any markup inside it, in the file the slide is written in.\n- Keep the whole artifact under 20 MB.\n- Your human partner can edit slides in the viewer: select blocks, drag and resize them (which makes a slide `free="true"`), type into them, change their tag, alignment, colour and every look attribute, restack blocks, change a slide\'s layout, add text boxes, copy, paste and delete. Each edit rewrites the slide in `deck.xml` or its include file in place and is listed by `changes`. Re-read the file before every edit. When you write over one of their edits before you have read it, `check` warns with `W_HUMAN_EDIT_OVERWRITTEN`, naming the slide, the block and what they had set: put their edit back unless you meant to change it.\n- Your human partner can restructure the deck in the viewer\'s grid: reorder and duplicate slides, skip them, add placeholder slides, delete them, and create, rename or move groups. Each change rewrites `deck.xml` (and an include file, for a slide written there) in place, keeping the rest of the text as it was. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact slides/<id>` and read them before editing the deck, so you build on their order instead of writing it back.\n\n## Feedback\n\nComments are anchored to a slide, usually to a point on it. `comment list --sections threads --detail` shows the slide id, its title, the text under the pin and the message. A comment made on selected blocks lists them as `nodes`, each with its block (`#id`, or its position on the slide) and its text: change those blocks. Edit that slide, keep its id, run `check`, then reply with what changed. A comment whose slide was deleted is listed as an orphan.\n\nRun the returned Check command after every edit. Without a browser it reports XML that does not parse, tags, attributes and values the deck cannot take, files it cannot read, missing or duplicate ids, unknown layouts, missing assets and embeds whose target is not there, each naming its slide. Slides that overflow and code, diagram or formula errors come from the browser: with no browser open the result is pending, not clean.\n';var q3=`# Verify report writing
|
|
182
|
+
`)}]}}var ok={threads:["id","status","waitingOn","anchor","stale","changes","messages","preview","messageCount","omittedMessages"],asks:["id","state","choice","text","byRecommendation","staleChoice","note"],groups:["id","kind","verdict","choice","by","byRecommendation","round","threads","evidenceUpdated","rejectThreads","title","from","capturedAt"],rounds:["id","state","title","groups","submitted"]},M3={threads:["id","status","waitingOn"],asks:["id","state"],groups:["id","kind","verdict","choice"],rounds:["id","state"]},oR=e=>e.startsWith("document/")?["threads","asks"]:["threads","groups","rounds"];function D3(e,t){return e.section?"Choose section or sections, not both.":!e.sections.length||new Set(e.sections).size!==e.sections.length||e.sections.some(n=>!oR(t).includes(n))?"Choose distinct review sections supported by this artifact.":e.fields||e.cursor||e.snapshot||e.thread||e.filters&&Object.values(e.filters).some(n=>n!==void 0)?"Fields, filters, thread, cursor and snapshot require a single --section. Follow each collection continuation separately.":null}function P3(e){let{section:t,filters:n}=e;if(!t&&(e.detail||e.cursor||e.fields||n&&Object.values(n).some(Boolean)))return"Choose a section before requesting detail, fields, filters or a cursor.";if(t&&!(t in ok))return"Unknown review section.";if(n&&Object.keys(n).some(r=>!["status","waitingOn","kind","choiceState"].includes(r)))return"Unknown review filter.";if(n?.waitingOn&&(t!=="threads"||!["agent","human","any"].includes(n.waitingOn)))return"waitingOn applies to threads and must be agent, human or any.";let o=t==="threads"?["open","resolved"]:t==="asks"?["draft","submitted","settled","orphan"]:t==="groups"?["pending","pass","reject"]:["open","submitted","closed"];return n?.status&&!o.includes(n.status)?"Invalid status for this section.":n?.kind&&(t!=="groups"||!["choose","verify"].includes(n.kind))?"kind applies to groups.":t==="groups"&&n?.status&&n.kind!=="verify"?"Verify status requires kind=verify.":n?.choiceState&&(t!=="groups"||n.kind!=="choose"||!["chosen","empty"].includes(n.choiceState))?"choiceState requires a choice group.":t&&e.fields?.some(r=>!ok[t].includes(r))?"Unknown field for this section.":null}var F_={claude:"Claude Code","claude-code":"Claude Code",cowork:"Claude Cowork",codex:"Codex",cursor:"Cursor","cursor-cli":"Cursor",gemini:"Gemini CLI","gemini-cli":"Gemini CLI",grok:"Grok","grok-cli":"Grok","github-copilot":"GitHub Copilot","github-copilot-cli":"GitHub Copilot",kilo:"Kilo Code",omp:"OMP","oh-my-pi":"OMP",opencode:"OpenCode","qwen-code":"Qwen Code",antigravity:"Antigravity",augment:"Augment","augment-cli":"Augment",goose:"Goose",amp:"Amp",cline:"Cline",roo:"Roo Code",devin:"Devin",replit:"Replit",v0:"v0"},CZe=[...new Set(Object.values(F_))],w1e=[["omp",e=>!!e.OMPCODE],["grok",e=>!!(e.GROK_AGENT||e.GROK_SESSION_ID)],["cowork",e=>!!e.CLAUDE_CODE_IS_COWORK],["kilo",e=>!!e.KILO],["codex",e=>!!(e.CODEX_THREAD_ID||e.CODEX_SANDBOX||e.CODEX_CI)],["cursor",e=>!!(e.CURSOR_AGENT||e.CURSOR_TRACE_ID)],["gemini",e=>!!e.GEMINI_CLI],["github-copilot",e=>!!e.COPILOT_CLI],["opencode",e=>e.OPENCODE==="1"||!!e.OPENCODE_CLIENT],["qwen-code",e=>!!e.QWEN_CODE],["antigravity",e=>!!e.ANTIGRAVITY_AGENT],["augment",e=>!!e.AUGMENT_AGENT],["cline",e=>!!e.CLINE_ACTIVE],["roo",e=>!!e.ROO_ACTIVE],["claude",e=>!!(e.CLAUDECODE||e.CLAUDE_CODE)]],B3=["AI_AGENT","AGENT","OMPCODE","GROK_AGENT","GROK_SESSION_ID","CLAUDE_CODE_IS_COWORK","KILO","CODEX_THREAD_ID","CODEX_SANDBOX","CODEX_CI","CURSOR_AGENT","CURSOR_TRACE_ID","GEMINI_CLI","COPILOT_CLI","OPENCODE","OPENCODE_CLIENT","QWEN_CODE","ANTIGRAVITY_AGENT","AUGMENT_AGENT","CLINE_ACTIVE","ROO_ACTIVE","CLAUDECODE","CLAUDE_CODE"],F3=e=>e?.trim().split(/[@_]/)[0]?.toLowerCase()||void 0;function iy(e){if(e.CLAUDE_CODE_IS_COWORK)return F_.cowork;let t=F3(e.AI_AGENT);if(t)return F_[t]??t;let n=w1e.find(([,r])=>r(e))?.[0];if(n)return F_[n];let o=F3(e.AGENT);if(o&&!/^(?:1|true|yes)$/.test(o))return F_[o]??o}var ay=V(require("node:fs"),1),K3=V(require("node:path"),1);function B_(e,t,n){let o=K3.default.resolve(e),r=n?.begin("save",o),s;try{s=ay.default.openSync(o,"wx",384)}catch(i){throw r!==void 0&&n.set(r,"failed"),new we({code:i.code==="EEXIST"?"E_FILE_EXISTS":"E_FILE_WRITE_FAILED",message:`Could not create ${o}: ${i.message}`})}try{ay.default.writeFileSync(s,t)}catch(i){throw ay.default.closeSync(s),ay.default.unlinkSync(o),r!==void 0&&n.set(r,"failed"),new we({code:"E_FILE_WRITE_FAILED",message:`Could not save ${o}: ${i.message}`})}return ay.default.closeSync(s),r!==void 0&&n.confirm(r,{bytes:typeof t=="string"?Buffer.byteLength(t):t.byteLength}),{file:o,bytes:typeof t=="string"?Buffer.byteLength(t):t.byteLength}}var iR=V(require("node:fs"),1),rk=V(require("node:path"),1);var j3='# Artboard writing\n\nWrite `canvas.json` and board HTML/media under `pages/`. Re-read canvas before each edit; preserve human edits, stable IDs and positions. Never edit comments.json or `.state/`.\n\n## Writing order\n\nNew artboard or round: apply canvas changes as soon as the structure is ready, before composing a large HTML batch. Scripts and batch writes are fine: canvas first, then HTML with the focus group first; other boards may run in parallel. Existing board content edits need HTML only unless layout, grouping, metadata or focus changes.\n\n## canvas.json\n\n```json\n{\n "version": 1,\n "title": "Delivery settings",\n "activePage": "settings",\n "pages": [{ "id": "settings", "name": "Settings" }],\n "boards": {\n "q1-a": { "file": "pages/settings/a.html", "page": "settings", "x": 0, "y": 0, "w": 640, "h": 400, "title": "Fixed delay" },\n "q1-b": { "file": "pages/settings/b.html", "page": "settings", "x": 720, "y": 0, "w": 640, "h": 400, "title": "Exponential" }\n },\n "groups": {\n "q1": { "title": "Retry strategy", "boards": ["q1-a", "q1-b"], "choose": true, "recommend": "q1-b" }\n },\n "notes": {\n "round-one": { "kind": "title", "page": "settings", "x": 0, "y": -300, "text": "Retry strategy" }\n }\n}\n```\n\n- **Title**: readable, distinct from the slug.\n- **Boards**: HTML boards require file/page/x/y/w/h; title/interactive are optional. Media boards use type:"image"|"video" and src instead of file.\n- **Resources**: relative paths under pages/; other directories are not served. Limits: 8MB per media file, 20MB per artboard. Video: mp4(H.264)/webm. Verify clips trim idle ends with one second context and retain originals; trim:false preserves timing/narration. Check recordings/pending before handoff.\n- **Groups** contain board IDs from one page: plain groups organize, choose:true + recommend:<member> asks a choice, verify:true + from:<environment/build> + capturedAt:<real ISO capture time> asks a verdict. Never combine choose and verify.\n- **Notes** require kind (title/sticky/condition), page/x/y/text; title size defaults to 96, optional w wraps; sticky w defaults to 240, optional color is #RGB/#RRGGBB.\n- **Edges** connect boards that follow one another: see Flows.\n- **Opening view**: activePage is the opening default; existing readers keep their page. focus `{target:<board/group/note>,at:<fresh ISO time>}` guides first ready content/phone question without resetting open camera/drafts. Share ?page=<id> for a new area.\n- **Spacing** is explicit: 80px horizontal board gap, 160px row gap; group frame 144px above and 48px outside boards. Leave 240px vertically/200px horizontally between groups; notes >=80px clear.\n- **Appending**: read `.state/artboard/<id>/layout.json` for actual group/note rectangles and page bounds first. A new round starts below maxY, title at maxY+120 then boards below title+80+144.\n- **Sizes**: desktop1280x800, phone402x874, tablet834x1194, component640x400. Frame height clips without warning: size h to content.\n\n## Flows\n\nWhen boards are steps of one path (an action on one screen opens the next, a condition forks, an error leads back), draw the path: connect them with `edges` and use condition notes for branches. Boards that are options to compare stay unconnected in a group. The viewer routes lines and keeps them attached when nodes move. Edit `edges` to change connections.\n\n```json\n{\n "version": 1,\n "title": "Publish flow",\n "pages": [{ "id": "flow", "name": "Flow" }],\n "boards": {\n "artboard": { "file": "pages/flow/artboard.html", "page": "flow", "x": 0, "y": 0, "w": 1280, "h": 800, "title": "Artboard" },\n "sign-in": { "file": "pages/flow/sign-in.html", "page": "flow", "x": 2308, "y": 1200, "w": 1280, "h": 800, "title": "Sign in" },\n "share": { "file": "pages/flow/share.html", "page": "flow", "x": 4068, "y": 0, "w": 1280, "h": 800, "title": "Share panel" }\n },\n "notes": {\n "signed-in": { "kind": "condition", "page": "flow", "x": 1760, "y": 328, "text": "Signed in?" }\n },\n "edges": {\n "publish": { "from": "artboard", "to": "signed-in", "label": "Click Publish" },\n "yes": { "from": "signed-in", "to": "share", "label": "Yes" },\n "no": { "from": "signed-in", "to": "sign-in", "label": "No" },\n "done": { "from": "sign-in", "to": "share", "label": "Signed in" }\n }\n}\n```\n\nEdge `from`/`to` reference board or condition IDs on one page; boards and notes share an ID space. Optional `label`: one line, at most 32 characters. Conditions require page/x/y/text, one incoming edge and at least two outgoing edges, each labelled. They are 96px tall, text-width, without wrapping.\n\nLay out flows on a grid with 480px between connected boards and on each side of a condition. Align a condition with a board at `y + (h - 48) / 2 - 48` (the name strip is 48px). Keep the main path on one row and branches below, clear of other boards.\n\nFix `edge "<id>" crosses board "<id>"` notices by moving boards or conditions; lines cannot be routed by hand. Conditions must not cover boards.\n\n## Board HTML\n\nWrite complete HTML ending `</html>` (last when streaming), inline CSS/scripts, html/body margin0. Missing or unfinished files stay pending. Use native, accessible labelled controls with visible state changes. Static by default; interactive:true enables PLAY.\n\nEach board/expanded view has independent iframe state: use memory, no localStorage/sessionStorage/cookies. Keep shared-state flows in one board; relative links stay inside its iframe. Replay, HTML edits and page changes/reloads reset prototype state; selected/playing/tweaked frames stay mounted on the same page.\n\n`ryugi-icon name="copy" size="18"` supplies Lucide icons; label actions. For JS-only icons add meta name="ryugi-icons" content="1" and await custom element definition.\n\n## Feedback\n\nChoice lifecycle: title notes define rounds. Read comment list --sections threads,groups,rounds --detail; act only on submitted rounds and read their threads. If human answered in terminal, record actual picks with comment choose and comment submit --round <id>. Withdrawal means wait. Add next round below, not over the old one. Documents can reference groups/boards using inline ref; preserve referenced keys.\n\nMarked comments: each `marked` line describes one mark. A box on an image or video board can end with `\xB7 at t=<s>` (the video frame) and `\xB7 crop <path>`: open that JPEG with your image reader before acting; it shows what the box covers.\n\nVerify lifecycle: put screen evidence in new verify groups with real from/capturedAt and language-matched titles/stickies. Record pass/reject only on human instruction. On rejection, repair behavior, replace evidence (resets pending), reply and leave the thread open; passing closes it. Preserve passed evidence unless asked. Command-output claims/gaps belong in a verify report. Run Check after writing; clear pending/warnings before claiming ready and inspect screenshots/recordings for visual claims.\n\n`browser_not_run:<board>` means no browser has loaded that board since its file, or a file under `pages/` that is not a board, last changed. Boards load only on the open page and near the view: open the artboard, go to each page Check lists under `Show` (`?page=<id>`), bring those boards into view, then run Check again. Editing one board or moving boards keeps the other boards\' results. With no browser to open, report Check as incomplete.\n\n## Selection and node IDs\n\nFor "here", "selected", Inspector changes or a node ID (`hero-2#7`), read `.state/artboard/<id>/selection.json`:\n\n- `selected`: file, CSS path from body, text, html, tweaks (`property/from/value`); `more` counts omitted nodes.\n- `boards`, `notes`: selected canvas IDs, omitted when empty.\n- `tweaks`: Inspector changes outside the selection.\n- `nodes`: all node IDs with file/path; query only the requested ID, never dump the list.\n\n```bash\njq \'{selected, more, boards, notes, tweaks}\' \'.ryugi/artifacts/.state/artboard/<id>/selection.json\'\n```\n\nFor a typed ID: `jq \'.nodes[] | select(.id == "hero-2#7")\' \u2026/selection.json`. A harness-attached selection carries the same data. Edit its file/path; Inspector tweaks become source only when you write them. IDs renumber on every board reload/edit: resolve against current nodes and ask for a fresh ID before a later edit to that board.\n\n## Author-declared parameters\n\nExpose deliberate controls with one JSON declaration before any JS that reads it. The viewer supplies Parameters; phone uses defaults. Inspector Tweaks remain CSS overrides.\n\n```html\n<script type="application/json" data-ryugi-tweaks>\n {\n "version": 1,\n "controls": { "accent": { "type": "color", "default": "#b45309" } }\n }\n</script>\n```\n\nEach control needs `type` and `default`; optional `label` defaults to its key, `section` groups controls. Keys: letter first, then letters/digits/underscores/hyphens, <=64 characters, unique ignoring case.\n\n| Type | Values and extra fields |\n| --------- | ----------------------------------------------------------------- |\n| `color` | Six-digit hex; optional `options` list supplies swatches |\n| `range` | Number; requires `min` and `max`; `step` defaults to 1 |\n| `number` | Finite number; optional `min`, `max`, `step` |\n| `boolean` | `true` or `false` |\n| `enum` | String; `options` is a list of strings or `{value,label}` objects |\n| `text` | String, at most 512 characters |\n\nDefaults/updates must match type, bounds, step and options. Limits: 32 controls, 32 choices per control. Invalid JSON/defaults or duplicate declarations show a Parameters error.\n\nValues set `--tweak-<key>` and `data-tweak-<key>` on `<html>`; numbers are unitless (`calc(var(--tweak-radius, 12) * 1px)`). `window.ryugiTweaks` gives a typed snapshot; `document` emits `ryugi-tweaks` with all updated values in `event.detail`. Keep ordinary copy literal; expose text controls only for cross-cutting values or requested editable copy.\n\nControl changes and Reset apply without reload, preserving unrelated app state. Canvas/expanded instances share values per board; other boards are independent. Replay, source edits and page switches retain valid overrides; untouched defaults follow source changes, removed/invalid overrides fall back to defaults. Viewer refresh resets to defaults. Reset affects parameters only; preview values never write HTML or publish.\n\nTest the host Parameters control, each value, Reset, Replay and expanded view before claiming it works; appearance changes must preserve in-progress interactions.\n';var U3='# Document writing\n\nWrite `doc.xml` under the returned artifact directory; put assets in `assets/`. Re-read immediately before each edit: the human and server edit this file too. Patch intended blocks, preserve existing IDs and human text; new blocks omit IDs and receive them from the server. Never edit `comments.json` or `.state/`. The server normalizes aliases and indentation after saving. Finish with `check`; pending merging or browser work means check again, not success.\n\nUse a closed `<doc>`. Choose blocks for the reader: diagrams show relationships, charts compare numbers, tables map exact attributes, prose explains reasons. A first draft can contain `<pending intent="What remains to investigate"/>`; fill every pending before claiming completion. Diagrams use native mermaid, or a whiteboard of this project embedded with a reference (below); never pictures of text or box drawing in code blocks.\n\nComplete block and inline vocabulary:\n\n- `h1`\u2013`h6`, `p`, `blockquote`, `ul`/`ol` with `li`, `table`/`tr`/`th`/`td`, `hr`.\n- Inline `b i u s code sub sup mark a br`; aliases `strong em del strike`. Links use `href`. Ordered lists accept `start`; checklists use `<ul type="check"><li checked="true">Done</li></ul>`.\n- `codeblock lang="ts"`: code; use CDATA for literal XML/angle brackets. `mermaid`: native flowcharts/sequences/states. `math`: inline LaTeX, `display="block"` for a block.\n- `img src="assets/image.png" alt="\u2026" caption="\u2026" width="640"`: real images.\n- `alert type="note|tip|important|warning|caution"`: block children. `details summary="\u2026" open="true"`: collapsed depth; omit open for collapsed. `steps` contains `step title="\u2026"` with block children; titles omit numbering.\n- `footnote ref="1"` inline; `footnote-section` contains `def ref="1"` definitions.\n- `chart`: CDATA ChartSpec JSON. Required `version:1`, `type:bar|line|area|pie`, `x` category field, `series:[{key,label?}]`, `data` rows containing x and every series key. Values numbers/null, pie nonnegative. At most 6 series and 6 pie rows. Optional title/subtitle/note/source/xLabel/stacked/donut/highlight, format `{unit,compact,decimals,signed}`, y `{min,max}`, refs `[{y,label}]`. `highlight` is a `series.key` and highlights that entire series; omit it when unnecessary. With `series:[{key:"failures"}]` and rows `[{phase:"Before",failures:12},{phase:"After",failures:4}]`, `highlight:"failures"` is valid; `highlight:"After"` is invalid because it is a row/category value.\n- `dynamic url="assets/demo.html" initial-height="240"`: CDATA JSON becomes `window.ryugiProps`. Self-contained sandboxed HTML, inline scripts/styles, size by content, transparent body. Browser controls persist on HTML rewrite; changing props resets them. Runtime is incomplete until the block has run. Native HTML/CSS/JS and `ryugi-icon` work; storage/cookies do not.\n- `pending intent="\u2026"`, inline `ask`/`option` and `ref` (below; a whiteboard `ref` can also embed as a block). Other tags are rejected.\n\n```xml\n<doc>\n <h1>Retry policy</h1>\n <p>Retry failed delivery at most <b>3</b> times.</p>\n <mermaid><![CDATA[flowchart LR\n ingress --> queue --> worker]]></mermaid>\n <p>Choose a strategy: <ask id="retry-strategy" recommend="exponential"><option value="fixed">Fixed delay</option><option value="exponential">Exponential backoff</option></ask></p>\n <details summary="Evidence"><codeblock lang="text"><![CDATA[attempts: 3]]></codeblock></details>\n</doc>\n```\n\nQuestions: `ask` is inline in p/li/table-cell paragraphs, never directly under doc. Its unique stable id is lowercase letters/digits/hyphens; never reuse an old question ID. Options contain plain text and distinct `value`s; `recommend` must name an option. No options makes an open question: `<ask id="other" placeholder="Describe it"/>`. Human picks are drafts until submitted. Read `comment list --sections threads,asks --detail`. Apply submitted answers, then `comment note --ask <id> --text <what changed>`. Every submitted question needs a note, even unanswered ones (state what was left or assumed). Record terminal answers only when actually supplied via `comment answer --ask <id> --choice <value>` or `--text`, then `comment submit`. Never invent an answer; wait after withdrawal. Changed settled answers require a human instruction and a fresh note.\n\nReferences: inline `<ref document="slug"/>`, `<ref html="slug">label</ref>`, `<ref artboard="slug" group="q1"/>` (or board), `<ref whiteboard="slug" frame="f1"/>` (or page), `<ref slides="slug" slide="slide-id"/>` (a deck, or one slide of it). Exactly one kind, at most one allowed subtarget, lowercase slug. Optional plain text label; server adds `to` when resolved, preserve it. Missing targets are warnings; clear before handoff. Keep referenced IDs stable; when changing a target, update the reference too. A reference under its section heading connects that section to its companion canvas. Live choices/verdicts belong in refs, not duplicated prose.\n\nEmbedded whiteboards: `<ref whiteboard="slug" frame="f1" embed="true"/>` draws the whiteboard in the document instead of a chip. Write it as a paragraph of its own directly under `<doc>`, e.g. `<p><ref whiteboard="sync-flow" frame="f-steps" embed="true"/></p>`; never beside text, in a list, table or quote. `frame` shows that frame cut to its box, `page` one page, neither the main page. Only whiteboard references embed. The drawing follows the whiteboard live: draw and change it on the whiteboard, not in the document; a reader clicks it to open the whole whiteboard. A missing whiteboard or frame is the same check warning as any reference.\n\nAfter editing, run the returned Check command. It names invalid blocks, chart/math/diagram errors, unresolved refs and pending dynamic work. Read complete feedback before acting; reply/resolve and acknowledge only the receipt for evidence actually used.\n';var H3='# HTML writing\n\nWrite one complete `index.html` with a descriptive `<title>`, inline or relative styles/scripts/images. The page reloads on edits. Native HTML/CSS/JavaScript works; use labelled controls and visible results. Assets stay inside this artifact directory; CDN fonts/scripts work, absolute local paths do not. The iframe is sandboxed: localStorage/sessionStorage/cookies throw; keep state in DOM/variables. Popups, forms, downloads and clipboard work.\n\n```html\n<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>Retry explorer</title>\n </head>\n <body>\n <label>Attempts <input id="attempts" type="range" min="1" max="5" value="3" /></label>\n <output id="result"></output>\n <script>\n const input = document.getElementById(\'attempts\');\n const render = () =>\n (document.getElementById(\'result\').textContent = input.value + \' attempts\');\n input.addEventListener(\'input\', render);\n render();\n </script>\n </body>\n</html>\n```\n\nStable control IDs preserve human input, checks, details and scroll across rewrites. Restoration fires input/change: render from those events. Script-only state resets. Use one surface for one investigation; comparison across independent screens belongs on an artboard. Re-read files before editing; never edit comments or `.state/`.\n\nBundled UI elements require no imports. Use native HTML/CSS for layout. `ryugi-icon name="message-square" size="18"` provides Lucide kebab-case icons (stroke-width defaults 2, color currentColor); label the button, icons are decorative. Unknown names become runtime warnings. For JS-only icons add `<meta name="ryugi-icons" content="1">` and await customElements.whenDefined(\'ryugi-icon\'). Preview glyphs map to the app\'s existing business icons when implementing the design.\n\nRun Check after edits. It distinguishes current static evidence from browser runtime. A closed/unloaded tab means runtime pending; open the returned URL and check again. Uncaught exceptions, rejected promises and missing relative assets are warnings; no browser run is not proof that a page works.\n\n# UI components\n\nHTML artifacts can use a small set of Lobe UI components through Web\nComponents. The artifacts server loads the runtime automatically when the page\ncontains a `<ryugi-\u2026>` element:\n\n```html\n<ryugi-button variant="primary">Save</ryugi-button>\n```\n\nNo script tag is needed. If you create components dynamically, add\n`<meta name="ryugi-ui" content="1">` to the page so the runtime is loaded.\n\nThe runtime loads with `defer`. A page script that needs the components should\nwait for the document event:\n\n```js\ndocument.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n // custom elements are defined\n },\n { once: true },\n);\n```\n\nUse these for controls and basic display. Use plain HTML and CSS for layout;\nthere is no layout wrapper to learn.\n\n## Rules\n\n- Give every interactive control a stable `id`. The viewer restores custom\n controls across rewrites by `id`, the same way it restores native inputs.\n- Listen for `ryugi-change` on controls:\n\n ```js\n document.addEventListener(\'ryugi-change\', (event) => {\n const { value, checked } = event.detail;\n console.log(event.target.id, value, checked);\n });\n ```\n\n It bubbles. `value` is a string, number, boolean, or `null`; `checked` is\n present for checkboxes and switches.\n\n- `value` / `checked` attributes set the initial state. Read the current state\n from the element\'s `value` / `checked` property after `ryugi-ui:ready`, and\n listen for `ryugi-change` for later updates.\n- `class` styles the host; `style` is forwarded to the component as well, so\n `style="width:100%"` works. Style the host, not the component\'s internal\n classes.\n- Keep children simple. For `ryugi-button`, `ryugi-card`, `ryugi-text`,\n `ryugi-tag`, `ryugi-checkbox`, and `ryugi-badge`, the original children are\n moved into the component. `ryugi-select`, `ryugi-segmented`, and\n `ryugi-radio-group` use option children instead.\n- Do not invent a `ryugi-` tag. If a component is not listed here, use HTML.\n- `ryugi-card` already paints a surface. Do not put a background, border and\n padding on both the host and the card: pick one. For a floating panel,\n either position the host and let the card paint its own surface, or make the\n host the surface and use `variant="borderless"` without `glass`/`shadow`.\n- Components follow `prefers-color-scheme`. Set `<html data-theme="light">`\n or `data-theme="dark"` before the runtime loads to pin the whole page.\n Without an explicit theme, the runtime follows OS theme changes.\n Lobe tokens such as `--lobe-color-primary` can be overridden on the host or\n page.\n\n## Controls\n\n### Button\n\n```html\n<ryugi-button variant="primary" size="middle" icon="plus">Add</ryugi-button>\n<ryugi-button variant="outlined" loading>Working\u2026</ryugi-button>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `size`\n(`small`, `middle`, `large`), `block`, `loading`, `disabled`, `shape`, `type`,\n`icon` (any Lucide kebab-case name; `refresh` and `trash` remain aliases).\nRun `node app/ryugi.cjs guide icons` for standalone icons and mapping the preview\'s\nactions to business icons when implementing the app.\n\nUses the native `click` event.\n\n### Action icon\n\n```html\n<ryugi-action-icon icon="settings" title="Settings" aria-label="Settings"></ryugi-action-icon>\n```\n\nAttributes: `icon` (same set as Button), `size`, `disabled`, `title`,\n`aria-label`. Uses the native `click` event.\n\n### Tooltip and popover\n\n```html\n<ryugi-tooltip content="Copy a private link" placement="top">\n <ryugi-icon name="copy" size="14"></ryugi-icon> Copy\n</ryugi-tooltip>\n<ryugi-popover id="sharing" content="Only people you invite can open this link.">\n Sharing details\n</ryugi-popover>\n```\n\nBoth provide a native button trigger; children are its label and decorative\nicons, not nested buttons or controls. `content` is plain text, `placement`\nsets the floating position. Tooltip opens on hover/focus; Popover opens on\nclick (`trigger="hover"` opts into hover). Tooltip also accepts `open` for\na controlled preview. Native trigger clicks still reach your handlers.\n\n### Action menu\n\n```html\n<ryugi-menu id="actions" label="More" icon="ellipsis">\n <ryugi-menu-item value="copy" icon="copy">Copy link</ryugi-menu-item>\n <ryugi-menu-item value="delete" icon="trash-2" disabled>Delete</ryugi-menu-item>\n</ryugi-menu>\n```\n\nAttributes: `label`, `icon`, `placement`, `disabled`. Items accept `value`,\n`icon`, `disabled`; their text is the label. Selecting an enabled item emits\n`ryugi-change` with its action in `event.detail.value`. Actions are not\nrestored as control values on reload.\n\n### Input\n\n```html\n<ryugi-input id="title" placeholder="Title" value="Ryugi" style="width:100%"></ryugi-input>\n```\n\nAttributes: `type`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`, `borderless`), `allowClear`, `placeholder`, `value`,\n`disabled`, `name`, `aria-label`.\n\n### Textarea\n\n```html\n<ryugi-textarea id="notes" rows="4" placeholder="Notes" style="width:100%"></ryugi-textarea>\n```\n\nAttributes: `rows`, `size`, `variant`, `placeholder`, `value`, `disabled`,\n`name`.\n\n### Number\n\n```html\n<ryugi-input-number id="count" value="12" min="0" max="100" step="1"></ryugi-input-number>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `precision`, `controls`, `size`,\n`variant`, `placeholder`, `disabled`.\n\n### Slider\n\n```html\n<ryugi-slider id="size" value="32" min="0" max="100" step="1"></ryugi-slider>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `disabled`.\n\n### Slider with number input\n\nThe most useful control for tuning an exact value.\n\n```html\n<ryugi-slider-input id="radius" value="8" min="0" max="32" step="1"></ryugi-slider-input>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `controls`, `size`, `variant`,\n`disabled`.\n\n### Switch\n\n```html\n<ryugi-switch id="dark" checked></ryugi-switch>\n```\n\nAttributes: `checked`, `loading`, `size`, `disabled`, `name`.\n\n### Checkbox\n\n```html\n<ryugi-checkbox id="compact">Compact</ryugi-checkbox>\n```\n\nAttributes: `checked`, `shape`, `size`, `disabled`, `name`. Children are the\nlabel.\n\n### Segmented\n\n```html\n<ryugi-segmented id="mode" value="grid">\n <ryugi-segment value="list">List</ryugi-segment>\n <ryugi-segment value="grid">Grid</ryugi-segment>\n <ryugi-segment value="masonry">Masonry</ryugi-segment>\n</ryugi-segmented>\n```\n\nAttributes: `value`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`), `block`, `glass`, `shadow`, `vertical`, `disabled`.\n\n### Select\n\n```html\n<ryugi-select id="layout" value="a" placeholder="Choose layout">\n <ryugi-option value="a">Sidebar</ryugi-option>\n <ryugi-option value="b">Top tabs</ryugi-option>\n <ryugi-option value="c">Bottom rail</ryugi-option>\n</ryugi-select>\n```\n\nAttributes: `value`, `placeholder`, `size`, `variant`, `allowClear`,\n`showSearch`, `loading`, `mode` (`multiple`, `tags`), `disabled`.\n\n### Radio group\n\n```html\n<ryugi-radio-group id="density" value="comfortable">\n <ryugi-radio value="compact">Compact</ryugi-radio>\n <ryugi-radio value="comfortable">Comfortable</ryugi-radio>\n <ryugi-radio value="spacious">Spacious</ryugi-radio>\n</ryugi-radio-group>\n```\n\nAttributes: `value`, `horizontal`, `gap`, `size`, `disabled`.\n\n### Colour picker\n\n```html\n<ryugi-color-picker id="accent" value="#c56473" trigger="field"></ryugi-color-picker>\n```\n\nAttributes: `value`, `alpha`, `defaultFormat` (`hex`, `rgb`, `hsl`),\n`trigger` (`swatch`, `field`, `chip`), `size`, `disabled`.\n\n## Display\n\n### Toast\n\nHTML artifacts can call the bundled Lobe UI toast API as `window.ryugiToast`.\nIf the page has no `ryugi-` UI controls, opt in with the meta tag. Wait for\n`ryugi-ui:ready` before calling it:\n\n```html\n<meta name="ryugi-ui" content="1" />\n<button id="save" type="button">Save</button>\n<script>\n document.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n document.getElementById(\'save\').addEventListener(\'click\', async () => {\n try {\n await saveDraft(); // the page\'s own operation\n window.ryugiToast.success({ id: \'save-result\', title: \'Saved\' });\n } catch {\n window.ryugiToast.error({\n id: \'save-result\',\n title: \'Save failed\',\n description: \'Try again.\',\n });\n }\n });\n },\n { once: true },\n );\n</script>\n```\n\nMethods: `success`, `error`, `info`, `warning`, `loading`. Each takes a string\nmessage or `{ title, description, id, duration }`. Text is rendered as text,\nnot HTML. A stable `id` refreshes the same notification instead of stacking\ncopies. The default duration is 5000ms; `duration: 0` stays until closed.\n`loading` stays until closed by default.\n\nCalls return a handle with `id` and `close()`. Use\n`window.ryugiToast.dismiss(id)` to close one, or `dismiss()` to close all.\nToasts appear at the bottom right and follow the page\'s theme. They are\ntransient: rewriting the page does not restore them. No `ryugi-toast` tag is\nneeded. Artboard pages do not load this UI runtime.\n\n### Tag\n\n```html\n<ryugi-tag variant="outlined">New</ryugi-tag>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`, `solid`), `size`,\n`shape` (`normal`, `round`), `color`, `closable`.\n\n### Alert\n\n```html\n<ryugi-alert\n type="info"\n title="Streaming"\n description="Pending boards draw as skeletons."\n></ryugi-alert>\n```\n\nAttributes: `type` (`success`, `info`, `warning`, `error`, `secondary`),\n`variant` (`soft`, `outlined`, `plain`), `title`, `description`, `showIcon`,\n`closable`. Text children are used as the title when `title` is absent.\n\n### Progress\n\n```html\n<ryugi-progress percent="64" size="small"></ryugi-progress>\n```\n\nAttributes: `percent`, `size`, `status`.\n\n### Badge\n\n```html\n<ryugi-badge count="3" status="processing"></ryugi-badge>\n<ryugi-badge count="3">\n <ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n</ryugi-badge>\n```\n\nAttributes: `count`, `dot`, `status`, `text`, `showZero`, `size`, `color`.\n\n### Avatar\n\n```html\n<ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n```\n\nAttributes: `src`, `alt`, `size`, `shape`.\n\n### Divider\n\n```html\n<ryugi-divider dashed></ryugi-divider>\n```\n\nAttributes: `orientation`, `dashed`.\n\n### Card\n\n```html\n<ryugi-card variant="outlined" shadow>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Supporting copy.</ryugi-text>\n</ryugi-card>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `shadow`,\n`glass`, `clickable`. Children are preserved, including nested components.\n`glass`, `shadow` and `variant` paint the inner Block surface, not the host.\nIf the host supplies the panel background and padding, omit `glass`/`shadow`\nand use `variant="borderless"` so there is only one visible container.\n\n### Text\n\n```html\n<ryugi-text type="secondary">Secondary body text</ryugi-text>\n<ryugi-text strong>Strong label</ryugi-text>\n<ryugi-text code>const x = 1</ryugi-text>\n```\n\nAttributes: `type` (`secondary`, `success`, `warning`, `danger`, `info`),\n`strong`, `code`, `italic`, `underline`, `delete`, `mark`, `align`, `weight`.\n\n## Complete tuning panel\n\n```html\n<ryugi-card>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Tune the reading column.</ryugi-text>\n\n <ryugi-slider-input id="measure" value="64" min="40" max="90" step="1"></ryugi-slider-input>\n\n <ryugi-segmented id="density" value="comfortable">\n <ryugi-segment value="compact">Compact</ryugi-segment>\n <ryugi-segment value="comfortable">Comfortable</ryugi-segment>\n <ryugi-segment value="spacious">Spacious</ryugi-segment>\n </ryugi-segmented>\n\n <ryugi-switch id="dark"></ryugi-switch>\n <ryugi-tag>Live preview</ryugi-tag>\n</ryugi-card>\n\n<script>\n document.addEventListener(\'ryugi-change\', (event) => {\n document.body.dataset[event.target.id] = event.detail.value;\n });\n</script>\n```\n\n## Not included in the first version\n\nTabs, Modal, Drawer, Table, DatePicker, and layout\ncomponents. Use plain HTML/CSS or a later component if one is added.\n';var rR='## Mockup components\n\n`<ryugi-ios-shell>` draws the device and nothing else: the screen (402\xD7874, iPhone 17), status bar, Dynamic Island, home indicator and, with `bezel`, the frame (442\xD7914). Size phone boards to match. Never hand-draw those parts. Everything on the screen (navigation bar, glass buttons, tab bar, cards, lists, inputs, sheets, a floating composer) is the product\'s own design system: write it by hand in HTML/CSS from the variables of `tokens.css`, in the product\'s own style, including its own Liquid Glass where the product uses it. Do not imitate iOS Settings rows unless the product\'s own screens look like that. The shell renders in light DOM, so selection, comments and the Inspector reach every part. The server loads it when the page contains the tag; for a shell created by script add `<meta name="ryugi-mockup" content="1">` and wait for `ryugi-mockup:ready` on `document`.\n\n```html\n<!doctype html>\n<html lang="zh">\n <head>\n <meta charset="utf-8" />\n <link rel="stylesheet" href="../tokens.css" />\n <style>\n html,\n body {\n margin: 0;\n }\n .nav {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0 16px;\n }\n .mark {\n font: 700 26px/32px var(--font-display);\n color: var(--color-text);\n }\n .glass {\n display: flex;\n border-radius: 22px;\n background: var(--color-glass);\n backdrop-filter: blur(16px) saturate(1.8);\n color: var(--color-text);\n }\n .glass > * {\n display: grid;\n place-items: center;\n width: 44px;\n height: 44px;\n }\n .card {\n margin: 8px 16px;\n padding: 16px;\n border-radius: var(--radius-card);\n background: var(--color-surface);\n }\n </style>\n </head>\n <body>\n <ryugi-ios-shell>\n <div class="nav">\n <span class="mark">\u55B5\u65C5</span>\n <span class="glass">\n <span\n ><ryugi-icon symbol="person.crop.circle" name="circle-user" size="22"></ryugi-icon\n ></span>\n <span><ryugi-icon symbol="plus" name="plus" size="22"></ryugi-icon></span>\n </span>\n </div>\n <section class="card">\u2026</section>\n </ryugi-ios-shell>\n </body>\n</html>\n```\n\nThe variable names in the example (`--font-display`, `--radius-card`, `--color-glass`) stand for roles; use the names the product\'s own `tokens.css` defines.\n\n| Element | Attributes | Children |\n| ------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `ryugi-ios-shell` | `bezel`, `time` (9:41), `hide="status island home all"` (any of them) | the screen content: it flows from below the status bar (`--safe-top`, 62px); absolutely positioned content measures from the screen\'s top edge. `--safe-bottom` is 34px. Both stay when parts are hidden |\n| `ryugi-token-sheet` | `appearance` to show one set only | one `<script type="application/json">` |\n\nBoth take `appearance="light|dark"`, otherwise follow the nearest `[data-appearance]`, then the system. Unknown attribute values raise a runtime warning.\n\nIcons: `<ryugi-icon name>` is a Lucide icon. Add `symbol`, an SF Symbol name (`wallet.bifold.fill`): when the local server runs on macOS it draws the symbol through the system and shows it at the symbol\'s own proportions, tinted with `currentColor`; anywhere else (other systems, Ryugi Cloud, published links) the Lucide icon shows. Write both. Use `symbol` only in mockups of apps for Apple platforms; that is the condition of Apple\'s license. Symbol images are never part of `pages/` and are never published.\n\nProduct tokens live in one stylesheet (on an artboard `pages/tokens.css`), light on `:root`, dark on `[data-appearance="dark"]`. The shell\'s root carries `data-appearance`, so light and dark phones sit side by side and your content under `[data-appearance="dark"]` flips with them. The shell reads `--color-bg` (screen), `--color-text` (status bar, home indicator) and `--font-body`, falling back to iOS system values; the token sheet also reads `--color-text-secondary`, `--color-separator`, `--color-surface`, `--color-fill` and `--color-accent`. Your content reads the same variables plus the product\'s own (radius, spacing, type, glass).\n\n`ryugi-token-sheet` draws the token table from JSON that names tokens, never values; values come from the stylesheet in both appearances:\n\n```json\n{\n "groups": [\n {\n "name": "Text",\n "kind": "color",\n "tokens": [\n {\n "name": "--color-text-secondary",\n "use": "\u884C\u53F3\u4FA7\u7684\u503C",\n "on": "--color-surface",\n "board": "t-color-a"\n }\n ]\n },\n {\n "name": "Type",\n "kind": "type",\n "tokens": [{ "name": "--type-body", "use": "\u6B63\u6587", "sample": "\u62DB\u5546\u94F6\u884C\u50A8\u84C4\u5361" }]\n }\n ]\n}\n```\n\nKinds: `color` (swatches; with `on`, WCAG contrast per appearance flagged under 4.5:1, or 3:1 with `"large": true`), `type` (a `font` shorthand), `space`, `radius`, `size`, `shadow`, `motion` (`<duration> <easing>`, click to play). Token and group names are English; `use` and `sample` follow the product\'s language. Missing variables and broken JSON show inline errors.\n';var W3='# Report writing\n\nA report is data and presentation kept apart. Each data source is a Node script that prints JSON; the report is `report.tsx`, one default-exported component built only from `@ryugi/report` that imports the data it draws.\n\n```\nreport/<id>/\n report.tsx\n sources/<source-id>/source.json\n sources/<source-id>/<script>.mjs\n data/<source-id>.json written by the hub when a source runs; never write it by hand\n assets/<file>.png images the report shows (png, jpg, gif, webp, avif, svg)\n```\n\n## Data sources\n\n`sources/<source-id>/source.json`: `{ "title": "Commits per day", "description": "main branch, last 30 days", "input": "git history of the repo", "script": "collect.mjs", "args": ["--days", "30"] }`. `title` and `script` are required; the script is a `.mjs`, `.js` or `.cjs` file in the same folder. Source ids are kebab-case.\n\nThe script runs with the project root as cwd and Node from the hub, so it can use the project\'s `node_modules`. Its env is the hub\'s env with the project\'s `.env` and `.env.local` laid over it; read secrets and machine paths from env or `args`, never write them into the script. It must print one JSON value on stdout (at most 2 MB; the whole report\'s data at most 10 MB) and exit 0 within 60 s. Do the aggregation in the script: the report only draws. A stderr line `ryugi:input <text>` replaces the input shown in the panel for that run, such as the commit the data was read at; other stderr is shown when the run fails.\n\nRun sources with `ryugi report refresh --artifact report/<id>` (all) or with `--only <source-id>` (one). The hub runs them, one run per source at a time, and writes `data/<source-id>.json`. Refresh after adding or changing a source, and before `check`. Reports fetched from someone else\'s Cloud link are read-only: never run their scripts.\n\n## report.tsx\n\n```tsx\nimport {\n BarChart,\n Grid,\n Report,\n Section,\n Stat,\n Table,\n useMemo,\n useState,\n Param,\n} from \'@ryugi/report\';\nimport days from \'./data/commits-per-day.json\';\n\nexport default function Commits() {\n const [span, setSpan] = useState(14);\n const shown = useMemo(() => days.slice(-span), [span]);\n return (\n <Report title="Ryugi commits" caption="main branch">\n <Param label="Window" min={7} max={30} unit="days" value={span} onChange={setSpan} />\n <Grid columns={3}>\n <Stat\n id="total"\n source="commits-per-day"\n title="Commits"\n value={shown.reduce((sum, day) => sum + day.commits, 0)}\n />\n </Grid>\n <Section id="daily" title="Per day">\n <BarChart\n id="per-day"\n source="commits-per-day"\n title="Commits per day"\n data={shown}\n x="date"\n series={[{ key: \'commits\', label: \'Commits\' }]}\n />\n <Table\n id="days"\n source="commits-per-day"\n title="Days"\n rows={shown}\n rowKey="date"\n columns={[{ key: \'date\' }, { key: \'commits\', align: \'right\' }]}\n />\n </Section>\n </Report>\n );\n}\n```\n\nImports come only from `@ryugi/report` and `./data/<source-id>.json` (default import; the source must exist). JSX uses SDK components only: no `div`, `img`, `a` or other native elements, no network calls, `document` / `window` / `location` / `navigator` / storage access, `globalThis`, `eval`, `Function`, `.constructor`, `import()` / `require()` or timers. Words in text and strings are fine; the check reads code. The page cannot reach the network either way. `report.tsx` stays under 64 KB; put data in a source. Derive with `useMemo` and plain expressions; keep state in `useState`.\n\nEvery Stat, chart, Table, Callout, Image and Section needs an `id`: kebab-case, unique in the report, and stable across edits, since comments and references hold on to it. Stat, charts and Table also need `source`: the source id, or a list of them, that the block\'s numbers come from; the hover chip and the sources panel read it. Write `id`, `source` and `title` as string literals.\n\nComponents:\n\n- `Report` `{ title, caption? }`: the root; `title` is the artifact\'s title.\n- `Section` `{ id?, title? }`, `Grid` `{ columns?: 1 | 2 | 3 | 4 }`, `Card`, `Stack` `{ gap? }`, `Divider`.\n- `H2`, `H3`, `Text` `{ tone?: \'muted\' }`, `List` `{ items }`, `Callout` `{ id, title?, tone?: \'info\' | \'success\' | \'warning\' | \'error\' }`.\n- `Stat` `{ id, source, title, value, unit?, delta?, format?, note? }`; `delta` is signed and shown up or down.\n- `Table` `{ id, source, title?, rows, rowKey, columns: { key, label?, align?, format? }[] }`; every row prints; a click on a row starts a comment on it.\n- `LineChart`, `BarChart`, `AreaChart`, `PieChart`, `ScatterChart` `{ id, source, title, data, x, series: { key, label?, color? }[], subtitle?, stacked?, donut?, highlight?, refs?: { label, y }[], format?, note? }`: the same chart renderer as a document\'s chart block. A `ScatterChart` needs a numeric `x` in every row. A reader clicks a point to pin it and comments on that point.\n- `Param` `{ label, value, onChange, min?, max?, step?, unit? }` (a slider with a number field when min and max are set), `Select` `{ label?, value, options, onChange }`, `Toggle` `{ label, checked, onChange }`. Printed, they show the value the reader set; a comment on a point or row records them too.\n- `Image` `{ id, src, alt, caption?, width? }`: an image file from the report folder, `src` written as a string such as `"assets/sources-panel.png"`; `alt` describes it. Copy screenshots and figures into `assets/` first; remote URLs are not allowed. Comments anchor to the image as a block.\n- `useState`, `useMemo` from `@ryugi/report`.\n\n`format` is `{ unit?, decimals?, compact?, signed? }`.\n\n## Check, comments, references\n\n`ryugi check --artifact report/<id>` reports static issues (imports, native elements, missing or repeated ids, unknown sources, missing data files) and, once a browser has opened the report, render errors.\n\nComments anchor to a block, a table row or a chart point: `ryugi comment add --artifact report/<id> --block <block-id> [--point <series>:<x> | --row <rowKey>]`. A comment keeps the value it was made on and which data it saw; after a refresh changes that data it is marked data changed and stays where it was.\n\nReference a report from a document or a deck with `<ref report="<id>"/>`, or one block with `<ref report="<id>" block="<block-id>"/>`.\n\nPublishing includes `report.tsx`, `sources/**`, `data/**` and the images under `assets/` with the report\'s visibility. Publishing is refused while a script, `report.tsx` or the data holds an absolute machine path (`/Users/\u2026`, `/home/\u2026`, `C:\\\\\u2026`, not checked in data) or something that looks like a secret (`sk-\u2026`, `ghp_\u2026`, `AKIA\u2026`, a private key, a value from `.env`); the refusal names the file and line.\n';var z3='# Slides writing\n\nWrite one complete `deck.xml` under the returned artifact directory; put images in `assets/` and reference them with relative paths. The deck is for an audience: your human partner presents it. Re-read before each edit; never edit `comments.json` or `.state/`. Finish with `check`.\n\nThe file holds what the slides say. The server compiles it into the page and adds the presentation engine, theme, code highlighting, diagrams and formulas. Only the tags and attributes below exist: there is no `class` and no `style`, and `check` reports anything else by slide and tag.\n\n```xml\n<deck title="Retry policy" lang="en">\n <slide id="cover" layout="cover">\n <kicker>Delivery \xB7 Q3</kicker>\n <h1>Retry policy</h1>\n <subtitle>Why failed deliveries now retry three times</subtitle>\n <notes>Open with last month\'s incident.</notes>\n </slide>\n\n <slide id="what-changes">\n <h2>What changes</h2>\n <ol steps="true">\n <li>At most three attempts</li>\n <li>Exponential backoff</li>\n </ol>\n </slide>\n\n <slide id="backoff" layout="code">\n <h2>Backoff</h2>\n <codeblock lang="ts" lines="1|2-3"><![CDATA[\n const delay = (attempt: number) =>\n Math.min(30_000,\n 500 * 2 ** attempt);\n ]]></codeblock>\n </slide>\n</deck>\n```\n\n## Slides\n\n- One slide is one `<slide>` directly inside `<deck>`. The deck\'s `title` is required; `lang` is optional.\n- Every slide needs a unique, stable `id` of lowercase letters, digits and hyphens. Comments and document references find a slide by its id: keep the id when you rewrite a slide, and only change it when the slide becomes a different slide. Deleting a slide orphans its comments.\n- The canvas is fixed at 1280\xD7720. Content that leaves that box is reported by `check` as overflow, naming the slide. Fix it by cutting or splitting the slide; `zoom="0.8"` on the slide (0.3 to 1) is for the one dense slide that must stay whole.\n- While the deck is open in the viewer, `check` also names contact sheet images (`Sheet:`) that show every slide at its last step, twelve to an image, with overflowing and hidden slides marked. After editing, run `check`, open those images, and look for slides that are too full or that all look like the same template. `sheet_not_drawn` under `Pending` means the open viewer has not drawn this version yet. `Sheet: unavailable (\u2026)` means it cannot be drawn, as for a deck holding a video or an iframe: go on without it.\n- `hidden="true"` keeps a slide in the file and out of the talk: it shows, marked, only while the deck is worked on; presenting, the audience window, the PDF and a published link never get it, and it takes no page number.\n- `<group id="evidence" title="What the data says">` inside `<deck>` gathers the slides of one part of the talk. It holds only `<slide>` and `<include>`, never another group; its `id` follows the slide id rules and is unique among slides and groups, and `title` is required. The grid view shows each group as a titled row; the audience sees nothing of it. Slides outside any group are fine, before, between or after groups.\n- `cover="<slide id>"` on `<deck>` names the slide that stands for the deck in lists and links. `check` warns when it names a slide that is missing or hidden.\n- Write XML: close every tag, quote every attribute, write `<` and `&` in text; common names such as ` `, `—` and `→` work, any other is an error, so write the character itself. Code, diagrams and formulas go in `<![CDATA[ \u2026 ]]>` so nothing in them needs escaping. CDATA ends at the first `]]>`: code that contains `]]>` comes from a file with `src`. End the file with `</deck>`.\n\n## Layouts\n\nPick the layout that fits what the slide says, and vary them: a deck of identical title-and-bullets slides reads as a template. Each layout adds a few places of its own; a place used in another layout is reported. The theme adds the page number itself.\n\n| `layout` | Use it for | Inside the slide |\n| ----------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------- |\n| `default` | A title with text, a list, a table or code | Optional `<label>`, an `<h2>`, then blocks. Omitting `layout` gives this one |\n| `cover` | The first slide | `<kicker>`, `<h1>`, `<subtitle>` |\n| `section` | The start of a new part | Optional `<label>`, then an `<h1>` or `<h2>` |\n| `statement` | One sentence the audience should remember | Optional `<label>`, an `<h2>` with the key words in `<mark>`, optional `<subtitle>` |\n| `two-cols` | Two things side by side | An `<h2>`, then exactly two `<col>`, each holding blocks |\n| `image` | Text beside a picture | One `<col>` holding the text and one `<img>`; whichever comes first is on the left |\n| `quote` | A quotation | `<quote>` and `<cite>` |\n| `fact` | One number that matters | `<big value="10\u201312" unit="working days"/>`, then up to three `<fact value="5 days" label="API"/>` |\n| `code` | Code as the subject of the slide | Optional `<label>`, an `<h2>` and one `<codeblock>` or one `<magic>` |\n| `end` | The last slide | An `<h1>` |\n| `none` | A slide you lay out yourself | `src` naming an HTML file; see Free HTML. No padding and no page number |\n\n```xml\n<slide id="numbers" layout="fact">\n <big value="13" unit="harnesses supported"/>\n <fact value="5" label="artifact types"/>\n <fact value="0" label="subscriptions"/>\n</slide>\n<slide id="before-after" layout="two-cols">\n <h2>Before and after</h2>\n <col>\n <h3>Before</h3>\n <p>One attempt, then a page.</p>\n </col>\n <col>\n <h3>After</h3>\n <p>Three attempts, then a page.</p>\n </col>\n</slide>\n<slide id="dashboard" layout="image">\n <col>\n <label>Result</label>\n <h2>Failures fell by half</h2>\n </col>\n <img src="assets/dashboard.png" alt="Failure rate before and after the change" frame="true"/>\n</slide>\n```\n\n## Blocks and text\n\nBlocks sit in a slide or a `<col>`: `<h1>`, `<h2>`, `<h3>`, `<p>`, `<ul>` and `<ol>` of `<li>` (a list may nest in an item), `<table>` of `<tr>` holding `<th>` or `<td>`, `<blockquote>`, `<hr/>`, `<alert type="note|tip|important|warning|caution">` holding blocks, `<img>`, `<icon>`, `<codeblock>`, `<magic>`, `<mermaid>`, `<math>`, `<html>`, `<embed>` and `<notes>`.\n\nBlocks and inline tags a document also has carry the same names here. Inside text: `<b>`/`<strong>`, `<i>`/`<em>`, `<u>`, `<s>`/`<del>`, `<sub>`, `<sup>`, `<code>`, `<mark>`, `<a href="\u2026">`, `<br/>`, `<math>` and `<icon>`.\n\n- `<img src="assets/chart.png" alt="\u2026"/>` shows a file of the artifact directory. `frame="true"` gives a screenshot rounded corners and a shadow.\n- `<icon name="check" size="32"/>` draws an icon; `size` is in pixels.\n- `<mermaid>` holds a Mermaid diagram and `<math>` a LaTeX formula, both in CDATA. `<math>` inside text is an inline formula.\n- `<notes>` holds speaker notes, shown only to the presenter. One per slide, plain text with `<br/>` between lines.\n\n```xml\n<h2>How a delivery flows</h2>\n<mermaid><![CDATA[\n flowchart LR\n A["ingress<br/>edge"] --> B[queue] --> C[worker]\n]]></mermaid>\n<table>\n <tr><th>Attempt</th><th>Delay</th></tr>\n <tr><td>1</td><td><math>500 \\cdot 2^1</math> ms</td></tr>\n</table>\n<p><icon name="check" size="24"/> Shipped behind a flag, see <a href="https://example.com/rfc">the RFC</a>.</p>\n```\n\n## Code\n\n`<codeblock lang="ts">` is a code block, named as in a document; `<code>` is inline code inside text. Write the code in CDATA; the indentation it shares with the XML is taken off.\n\n- `lines`: stepped line highlight. Parts are separated by `|`, each one step, lines count from 1: `1`, `2-3`, `2-3,5`; `all` lights every line and `hide` hides the block for that step.\n- `src="src/retry.ts#L10-24"`: take the code from a file of the project instead of writing it, optionally only those lines. The path is relative to the project root; files outside the project, dot-files such as `.env`, and files over 512 KB are refused, and so are files named like secrets (`secrets.*`, `credentials.*`, `*.pem`, `*.key`, `*.tfstate`, `*.tfvars`, SSH keys) and files git ignores. Never show a file that holds a secret under another name. What a deck shows is published with it.\n- `numbers="true"`: line numbers. `title="src/retry.ts"`: a title above the block. `max-height="320"`: a height in pixels past which the block scrolls, following the highlighted lines. `diff="true"`: lines starting with `+` or `-` are drawn as added or removed.\n- `<magic lang="ts">` holds two or more `<step>`, each the whole code at one step, in CDATA; what stays moves into place, and each step after the first is a step of the slide.\n\n```xml\n<codeblock lang="ts" src="src/retry.ts#L10-24" numbers="true" title="src/retry.ts" lines="all|3-5"/>\n<codeblock lang="ts" diff="true"><![CDATA[\n const attempts =\n - 1;\n + 3;\n]]></codeblock>\n<magic lang="ts">\n <step><![CDATA[const delay = 500;]]></step>\n <step><![CDATA[const delay = (attempt: number) => 500 * 2 ** attempt;]]></step>\n</magic>\n```\n\n## Steps and marks\n\n- `step="true"` on a block or a list item: it appears on the next step. `steps="true"` on a `<ul>`, `<ol>`, `<table>` or `<col>` makes each item, row or block a step.\n- `step="2"` places a step by number, and `step="with"` makes it appear together with the step before it.\n- `<mark>` highlights words. `type="highlight"`, `underline`, `circle` or `strike` draws that mark; with `step` the words are there from the start and the mark is drawn on its step.\n- `morph="title"` on a block in two consecutive slides moves it from one to the other; a name is used once per slide and the pair should hold the same text.\n\n```xml\n<h2 morph="title">The <mark type="underline" step="true">retry budget</mark> is per delivery</h2>\n<p step="true">Three attempts in total.</p>\n<p step="with">The first one counts.</p>\n<ul steps="true">\n <li>500 ms</li>\n <li>1 s</li>\n</ul>\n```\n\n## Several files and free HTML\n\n- `<include src="parts/appendix.xml"/>` inside `<deck>` puts the slides of another file of the artifact directory there. That file starts with `<slides>`, holds only `<slide>`, and cannot include further files. Ids stay unique across all files.\n- `<html src="parts/demo.html"/>` is a block of HTML you write yourself, in a file of the artifact directory.\n- `<slide id="demo" layout="none" src="parts/demo.html"/>` is a whole slide of your own HTML: you own every pixel of 1280\xD7720. It may hold `<notes>` and nothing else.\n- A free HTML file is a fragment: no page wrapper, every `<div>` closed. `data-step` on an element inside it makes that element a step. It runs in the deck\'s sandbox: no localStorage, sessionStorage or cookies.\n\n```xml\n<deck title="Retry policy">\n <slide id="live-demo" layout="none" src="parts/demo.html">\n <notes>Click through the three states.</notes>\n </slide>\n <slide id="curve">\n <h2>The backoff curve</h2>\n <html src="parts/curve.html"/>\n </slide>\n <include src="parts/appendix.xml"/>\n</deck>\n```\n\n## Other artifacts\n\n`<embed>` puts another artifact of this project on the slide, in a box that keeps the target\'s shape and fills the width it is given. Name the target by its slug, as a document\'s `<ref>` does:\n\n- `<embed artboard="settings-page" board="q1-b"/>` shows one board of an artboard.\n- `<embed whiteboard="sync-flow" frame="f1"/>` shows one frame of a whiteboard.\n- `<embed html="spring-curve"/>` shows an html page, at 1280\xD7720.\n\nA board or an html page is live and read-only on this computer: it shows the target as it is now and changes when the target does, and nobody can click or comment in it during the talk. A whiteboard frame is a picture of the frame as the whiteboard was last drawn in the viewer, so open the whiteboard once before embedding it. In thumbnails, PNG export and the contact sheet a board is a picture; an html page has no picture there and holds its place under its name. On a published link every embed holds its place under its name for now, a whiteboard frame included: nothing of the target is published with the deck.\n\nAn embed takes `step` and `morph` like any block. `check` warns, naming the slide, when the artifact, board or frame is not there, and the slide shows the target\'s name in its place.\n\n```xml\n<slide id="settings" layout="two-cols">\n <h2>The settings page</h2>\n <col>\n <p>Option B keeps billing on the first screen.</p>\n </col>\n <col>\n <embed artboard="settings-page" board="q1-b"/>\n </col>\n</slide>\n```\n\n## Theme, motion and glow\n\nChange the look for the whole deck with one `<theme>` before the first slide. `name` picks the theme: `paper` (the default: warm paper, one seal-coloured accent, glow) or `mono` (black on white, monospace labels, emphasis by weight, no glow). `appearance` is `light`, `dark` or `auto`; `auto`, the default, follows the system of whoever opens the deck and prints light, so write `light` or `dark` when the room decides. Every other attribute overrides one variable of the theme, in both appearances. A deck that sets its own `paper`, `surface` or `ink` is `light` unless it names an appearance: those colours suit one appearance only. Do not restyle slide by slide.\n\n```xml\n<deck title="Retry policy">\n <theme name="paper" appearance="dark" accent="#0a7cff" transition="slide-left" fragment="rise" glow-opacity="0.6"/>\n <slide id="cover" layout="cover" transition="fade" glow="top-right" glow-seed="launch">\n <h1>Retry policy</h1>\n </slide>\n</deck>\n```\n\n| `<theme>` attribute | Values | Paper |\n| ----------------------------- | ------------------------------------------------------------ | ------------------------------- |\n| `paper`, `surface` | the slide\'s background, and that of code and cards | |\n| `ink`, `ink-2`, `ink-3` | text, secondary text, labels | |\n| `accent`, `on-accent`, `info` | the accent colour, text on it, and the second accent | |\n| `rule`, `rule-strong` | hairlines | |\n| `font`, `font-mono` | font families | |\n| `transition` | `view`, `fade-out`, `fade`, `slide-left`, `slide-up`, `none` | `view` |\n| `transition-duration` | a time | `500ms` |\n| `transition-blur` | a length | `5px` |\n| `fragment` | `blur`, `fade`, `rise` | `blur` |\n| `fragment-duration` | a time | `500ms` |\n| `fragment-blur` | a length | `3px` |\n| `glow` | `on`, `off` | `on` |\n| `glow-1`, `glow-2`, `glow-3` | colours of the three shapes | `#9440e3`, `#41d1ff`, `#dce354` |\n| `glow-fade` | the colour each shape fades to | `rgb(255 255 255 / 0.1)` |\n| `glow-opacity` | 0 to 1 | `1` |\n| `glow-blur` | a length | `70px` |\n| `glow-drift` | how long the glow takes to move to the next slide\'s place | `2500ms` |\n| `glow-hue` | an angle | `0deg` |\n| `glow-at` | a glow place | `full` |\n\nTransitions:\n\n- `view`: the slide fades out, then the next fades in, both blurred; blocks with the same `morph` on both slides move and resize between them.\n- `fade-out`: the same fade out then in, without moving blocks.\n- `fade`: both slides cross-fade.\n- `slide-left`, `slide-up`: the next slide pushes in from the right or from below; going back reverses it.\n- `none`: the slide changes at once.\n\nSteps: `blur` fades a step in from a blur, `rise` also lifts it 12px, `fade` only fades it.\n\nOn a `<slide>`:\n\n- `transition`: the transition into this slide, one of the values above.\n- `glow`: where this slide\'s glow sits: `full`, `top`, `bottom`, `left`, `right`, `top-left`, `top-right`, `bottom-left`, `bottom-right`, `center`, or `none` for no glow. Left out, the place follows the layout and changes from slide to slide.\n- `glow-seed`: any text; the same seed on the same page number always gives the same shapes.\n- `glow-opacity`: 0 to 1, this slide only.\n- `glow-hue`: degrees, this slide only.\n\n`check` reports an unknown transition or glow place and a `morph` name used twice in one slide. With reduced motion, turns are instant and the glow does not move.\n\n## Placing blocks freely\n\nA layout arranges a slide for you. When a slide must sit exactly as drawn, put `free="true"` on it: every block it holds, inside a `<col>` too, then takes `x`, `y` and `w` in slide pixels of the 1280\xD7720 canvas, and `h` when its height matters (pictures, embeds, diagrams). The layout stays named, so its type sizes still apply, and removing `free` with the coordinates brings the layout back. A block on a free slide without `x`, `y` and `w` is reported, and so are coordinates on a slide that is not free. Later blocks sit on top of earlier ones.\n\n```xml\n<slide id="library" layout="two-cols" free="true">\n <h2 id="b4k2qz" x="96" y="80" w="520">The library</h2>\n <col>\n <p x="96" y="180" w="420" align="center" color="muted">Every artifact, one server.</p>\n </col>\n <col>\n <img x="640" y="120" w="560" h="380" src="assets/library.png" alt="The library page" frame="true"/>\n </col>\n</slide>\n```\n\n- `align="left|center|right|justify"` and `color` work on text blocks on any slide. `color` takes a theme colour, `ink|muted|faint|accent|info`, which follows the theme and its light and dark appearances, or a fixed `#RRGGBB` / `#RRGGBBAA`, which does not. Prefer the theme colours.\n- On a free slide, `w="fill"` stretches a block from its `x` to the right safe margin, and a text block may take `h`: what does not fit is clipped, unless the block also has `fit="shrink"`, which shrinks its text until it fits.\n\n### Look attributes\n\nYour human partner tunes blocks in the viewer\'s tweak panel. Each setting is one attribute on the block, on any slide; `check` reports a value outside its range and an attribute on a block that does not take it.\n\n| Attribute | Blocks | Value |\n| --------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------- |\n| `size="32"` | text | font size, 8\u2013400 px |\n| `weight="600"` | text | 100\u2013900 in steps of 100 |\n| `font="Avenir Next"` | text | `mono` or a font name; a font missing on another machine falls back to the theme font |\n| `leading="1.4"` | text | line height, 0.8\u20133 |\n| `tracking="-0.5"` | text | letter spacing, -20\u2013100 px |\n| `pad="16"` | text, table, codeblock, code, alert, big, fact | padding, 0\u2013200 px |\n| `fill="surface"` | all but hr, icon and html | a theme colour (`surface`, `paper`, `ink`, `muted`, `faint`, `accent`, `info`) or hex |\n| `opacity="80"` | all but html | 0\u2013100 |\n| `radius="12"` | all but hr, icon and html | 0\u2013360 px |\n| `border="solid"` | all but hr, icon and html | `solid`, `dashed` or `dotted`, 1 px in the theme\'s rule colour |\n| `shadow="0 8 24 #00000040"` | all but hr, icon and html | x, y, blur in px and a colour |\n\n```xml\n<slide id="promise" free="true">\n <p x="96" y="180" w="fill" h="120" fit="shrink" size="32" weight="600" fill="surface" radius="12" pad="16">Every artifact, one server.</p>\n</slide>\n```\n\nThese are deliberate choices: keep these attributes when you rewrite a block, unless changing them is the point.\n\n- An `id` on a block (letters, digits, `_` and `-`, at most 32) is how the viewer and comments know that block again. Your human partner\'s edits give blocks ids: keep every block id when you rewrite a slide, as you keep slide ids.\n\n## Rules\n\n- A talk is given offline: keep fonts, scripts and images inside the artifact directory and avoid CDNs.\n- Notes are not secret: they are hidden from viewers in the interface but remain in the page source.\n- Your human partner can edit notes in the viewer. Saving writes that slide\'s `<notes>` back as plain text lines joined by `<br/>`, replacing any markup inside it, in the file the slide is written in.\n- Keep the whole artifact under 20 MB.\n- Your human partner can edit slides in the viewer: select blocks, drag and resize them (which makes a slide `free="true"`), type into them, change their tag, alignment, colour and every look attribute, restack blocks, change a slide\'s layout, add text boxes, copy, paste and delete. Each edit rewrites the slide in `deck.xml` or its include file in place and is listed by `changes`. Re-read the file before every edit. When you write over one of their edits before you have read it, `check` warns with `W_HUMAN_EDIT_OVERWRITTEN`, naming the slide, the block and what they had set: put their edit back unless you meant to change it.\n- Your human partner can restructure the deck in the viewer\'s grid: reorder and duplicate slides, skip them, add placeholder slides, delete them, and create, rename or move groups. Each change rewrites `deck.xml` (and an include file, for a slide written there) in place, keeping the rest of the text as it was. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact slides/<id>` and read them before editing the deck, so you build on their order instead of writing it back.\n\n## Feedback\n\nComments are anchored to a slide, usually to a point on it. `comment list --sections threads --detail` shows the slide id, its title, the text under the pin and the message. A comment made on selected blocks lists them as `nodes`, each with its block (`#id`, or its position on the slide) and its text: change those blocks. Edit that slide, keep its id, run `check`, then reply with what changed. A comment whose slide was deleted is listed as an orphan.\n\nRun the returned Check command after every edit. Without a browser it reports XML that does not parse, tags, attributes and values the deck cannot take, files it cannot read, missing or duplicate ids, unknown layouts, missing assets and embeds whose target is not there, each naming its slide. Slides that overflow and code, diagram or formula errors come from the browser: with no browser open the result is pending, not clean.\n';var q3=`# Verify report writing
|
|
183
183
|
|
|
184
184
|
Write \`verify.xml\` and captured files in \`evidence/\`. Reports cover command output, counts, API behavior, deploy evidence and evals. Claims judged by looking at a screen go in artboard verify groups; reference those groups from the report. Never invent captured output or human verdicts. Report prose uses the human's language; IDs/commands/raw logs retain their form.
|
|
185
185
|
|
|
@@ -503,11 +503,11 @@ function run(urls) {
|
|
|
503
503
|
}
|
|
504
504
|
return unknown ? 'unknown' : 'missing';
|
|
505
505
|
}`;async function Dq(e,t=[]){if(process.platform==="darwin"){let{stdout:o,stderr:r}=await $ye("osascript",["-l","JavaScript","-e",S9e,e,...t],{timeout:5e3});if(r.trim()&&console.error(r.trim()),o.trim()==="found")return;if(o.trim()!=="missing")throw new Error("Could not inspect existing browser tabs; open the artifact link manually.")}let n=Rye(process.platform,e);n&&await $ye(n.bin,n.args)}var Pye=V(require("node:crypto"),1),Rb=V(require("node:fs"),1),Fye=V(require("node:os"),1),Wg=V(require("node:path"),1);function Bye(e=process.env,t=process.platform,n=process.getuid?.()??-1,o=Fye.default.tmpdir()){return e.RYUGI_RUNTIME_DIR?Wg.default.join(e.RYUGI_RUNTIME_DIR,"servers"):t==="win32"?Wg.default.join(o,"ryugi","servers"):`/tmp/ryugi-${n}/servers`}var T9e=(e,t)=>Wg.default.join(e,`${Pye.default.createHash("sha256").update(t).digest("hex").slice(0,16)}.json`);function C9e(e){if(process.platform!=="win32")for(let t of[Wg.default.dirname(e),e]){let n=Rb.default.lstatSync(t);if(!n.isDirectory()||n.uid!==process.getuid()||n.mode&18)throw new Error(`Unsafe registry directory: ${t}`)}}function Kye(e){try{let t=JSON.parse(Rb.default.readFileSync(e,"utf8"));return typeof t.project!="string"||typeof t.root!="string"||typeof t.serverId!="string"||!Number.isInteger(t.pid)||!Number.isFinite(t.startedAt)||t.root!==Wg.default.join(t.project,".ryugi","artifacts")?null:t}catch{return null}}function jye(e){let t;try{C9e(e),t=Rb.default.readdirSync(e)}catch{return[]}return t.filter(n=>n.endsWith(".json")).flatMap(n=>Kye(Wg.default.join(e,n))??[])}function Uye(e,t){let n=T9e(e,t.project);Kye(n)?.serverId===t.serverId&&Rb.default.rmSync(n,{force:!0})}var Pq=V(require("node:fs"),1),Hye=V(require("node:os"),1),wO=V(require("node:path"),1);function Wye(e){let t=Df(process.env,process.platform,Hye.default.homedir()),n=(process.env.RYUGI_CLOUD_ORIGIN||"https://ryugi.innei.dev").replace(/\/+$/,"");if(Xb(t,n))return;let o=wO.default.join(wO.default.dirname(t),"login-hint-shown");try{Pq.default.mkdirSync(wO.default.dirname(o),{recursive:!0,mode:448}),Pq.default.writeFileSync(o,`1
|
|
506
|
-
`,{flag:"wx",mode:384})}catch(r){if(r.code==="EEXIST")return}return{message:"Recommended: sign in to Ryugi Cloud to share artifacts and review them from other devices. Sign-in is optional; local work can continue.",command:`${process.env.RYUGI_ARTIFACTS_COMMAND||"npx ryugi-artifacts"} publish --login --from hint`,projectDir:e,agentInstruction:"Briefly pass this recommendation to your human partner and offer to run command in projectDir to obtain the sign-in URL. Continue the current task without waiting for sign-in."}}var $b=V(require("node:path"),1);function b9e(e){let t=e.values;if(t.foreground&&t.background)throw new we({code:"E_OPTION_CONFLICT",message:"Choose --foreground or --background."});if(t.open&&t["no-open"])throw new we({code:"E_OPTION_CONFLICT",message:"Choose --open or --no-open."});return{projectDir:e.projectDir,artifact:t.artifact,background:!!t.background,foreground:!!t.foreground,host:t.host??"127.0.0.1",urlHost:t["url-host"],port:t.port,open:t["no-open"]?!1:t.open?!0:process.env.ARTIFACTS_OPEN!=="0",openExisting:!!t.open}}function Fq(e,t){let n=t?$b.default.dirname($b.default.dirname(t.root)):e.projectDir,o=e.artifact?fc(n,e.artifact):void 0;return{cliVersion:"1.
|
|
506
|
+
`,{flag:"wx",mode:384})}catch(r){if(r.code==="EEXIST")return}return{message:"Recommended: sign in to Ryugi Cloud to share artifacts and review them from other devices. Sign-in is optional; local work can continue.",command:`${process.env.RYUGI_ARTIFACTS_COMMAND||"npx ryugi-artifacts"} publish --login --from hint`,projectDir:e,agentInstruction:"Briefly pass this recommendation to your human partner and offer to run command in projectDir to obtain the sign-in URL. Continue the current task without waiting for sign-in."}}var $b=V(require("node:path"),1);function b9e(e){let t=e.values;if(t.foreground&&t.background)throw new we({code:"E_OPTION_CONFLICT",message:"Choose --foreground or --background."});if(t.open&&t["no-open"])throw new we({code:"E_OPTION_CONFLICT",message:"Choose --open or --no-open."});return{projectDir:e.projectDir,artifact:t.artifact,background:!!t.background,foreground:!!t.foreground,host:t.host??"127.0.0.1",urlHost:t["url-host"],port:t.port,open:t["no-open"]?!1:t.open?!0:process.env.ARTIFACTS_OPEN!=="0",openExisting:!!t.open}}function Fq(e,t){let n=t?$b.default.dirname($b.default.dirname(t.root)):e.projectDir,o=e.artifact?fc(n,e.artifact):void 0;return{cliVersion:"1.90.1",serverVersion:ji(cd().version),status:t?"running":"stopped",scope:"machine",project:n,...o,...o?.content==="missing"?{writing:sk(e.artifact)}:{},reused:!!t?.reused,...t?{url:t.cloudLink??t.link??t.url,localUrl:t.link??t.url}:{},...e.artifact?{artifact:e.artifact}:{},cloud:t?.cloudLink?"live_link_reserved":"local_only"}}function zye({data:e}){return{heading:"Server",status:e.status,subject:e.reused?"reused":void 0,facts:[Ge("Scope",qt(e,"scope")),Ge("CLI version",qt(e,"cliVersion")),Ge("Server version",qt(e,"serverVersion")),Ge("Project",qt(e,"project"),!0),...e.artifact?[Ge("Artifact",qt(e,"artifact"),!0)]:[],...e.write?[Ge("Write",qt(e,"write"),!0),Ge("Content",qt(e,"content"),!0)]:[],...e.url?[Ge("Open",qt(e,"url"),!0)]:[],...e.localUrl&&e.localUrl!==e.url?[Ge("Local",qt(e,"localUrl"),!0)]:[],Ge("Cloud",qt(e,"cloud"))],sections:e.writing?[{kind:"content",key:"writing",title:"Writing",text:e.writing}]:[]}}function qye(e,t){let n=t.cloudLimit?.upgradeUrl?[{kind:"url",url:t.cloudLimit.upgradeUrl,label:"Upgrade"}]:[];return e.artifact&&n.push(rn(["check","--project-dir",$b.default.dirname($b.default.dirname(t.root)),"--artifact",e.artifact],"Check")),t.loginHint&&n.push(rn(["publish","--login","--from","hint","--project-dir",e.projectDir],"Sign in")),It(Fq(e,t),void 0,{actions:n,warnings:[...t.loginHint?[{code:"W_LOGIN_OPTIONAL",message:t.loginHint.message}]:[],...t.cloudLimit?[{code:"W_CLOUD_LIMIT",message:String(t.cloudLimit.message??"Cloud link unavailable; local server is ready.")}]:[]]})}async function*k9e(e,t){let n=[],o,r=!1,s,i,a,l=t.effects.begin("start",e.projectDir),c=d=>{n.push(d),o?.()},u=Bq(e,{signal:t.signal,ready(d){i=d,t.effects.confirm(l,{reused:!!d.reused}),c({kind:"ready",result:qye(e,d)})},failure(d){a=String(d.error??"Server failed")},log:d=>t.diagnostic(d)}).then(d=>{if(t.signal.aborted){let f=t.signal.reason==="SIGINT"?"SIGINT":"SIGTERM";c({kind:"result",result:It({...Fq(e,i),status:"stopped"},{kind:"interrupted",signal:f},{effects:t.effects.snapshot()})})}else{if(d!==0||a)throw new we({code:"E_SERVER_FAILED",message:a??`Server exited with ${d}.`});c({kind:"result",result:It({...Fq(e,i),status:i?.reused?"running":"stopped"},void 0,{effects:t.effects.snapshot()})})}}).catch(d=>{s=d}).finally(()=>{r=!0,o?.()});try{for(;!r||n.length;)n.length?yield n.shift():await new Promise(d=>{o=d});if(s)throw s}finally{await u}}function IO(e,t="start"){let n=b9e(e);return n.library=t==="browse",n.foreground?Xt({id:t,mode:"live",output:{formats:["brief","jsonl"]},run:(r,s)=>k9e(n,s),present:zye},e):Xt({id:t,mode:"finite",output:{formats:["brief","json","jsonl","quiet"],scalar:r=>r.url},async run(r,s){let i,a,l=s.effects.begin("start",n.projectDir);if(await Bq(n,{signal:s.signal,ready(u){i=u,s.effects.confirm(l,{reused:!!u.reused})},failure(u){a=String(u.error??"Server failed")},log:u=>s.diagnostic(u)})!==0||!i)throw new we({code:"E_SERVER_FAILED",message:a??"Server did not become ready."});return qye(n,i)},present:zye},e)}function Gye(e,t){return e&&t&&e===t?"keep":"replace"}var Zye="https://ryugi.innei.dev",v9e=5e3,w9e=15e3,I9e=1e3,Vye=1e4,Qye=(e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t},E9e=Qye("RYUGI_START_SETTLE_MS",6e3),N9e=Qye("RYUGI_STOP_GRACE_MS",7e3),A9e=e=>(e.RYUGI_CLOUD_ORIGIN||Zye).replace(/\/+$/,""),L9e=e=>{let t=new URL(e);return t.hostname==="localhost"&&(t.hostname="127.0.0.1"),t},jq=(e,t)=>{let n=L9e(e.url),o=new URL(t,n.origin),r=n.searchParams.get("key");return r&&o.searchParams.set("key",r),o.toString()};function O9e(e,t,n){let o={type:"server-started",url:e.url,port:e.port,root:t.root};if(n){let r=new URL(e.url),s=Ofe(n),i=r.searchParams.get("key");o.link=`${r.origin}${cO(t.root,s.type,s.id)}${i?`?key=${i}`:""}`}return o}async function R9e(e,t,n,o){if(!o)return e;try{let r=await fetch(jq(t,`/api/cloud/reserve/${o}`),{method:"POST",headers:{"X-Ryugi-Project":encodeURIComponent(n.project)},signal:AbortSignal.timeout(v9e)}),{url:s,limit:i}=await r.json();return typeof s=="string"?{...e,cloudLink:s}:typeof i?.upgradeUrl=="string"?{...e,cloudLimit:{message:i.message,upgradeUrl:i.upgradeUrl}}:e}catch{return e}}async function $9e(e){for(let t=0;t<150;t++){try{return si.default.mkdirSync(e),!0}catch{}try{if(Date.now()-si.default.statSync(e).mtimeMs>6e4){si.default.rmdirSync(e);continue}}catch{}await Qg(100)}return!1}function M9e(e){let t=Number(ji(e.pid)),n=ji(e.serverId);return!Number.isInteger(t)||t<=0||!n?null:E_(t,n)?t:null}function Yye(e){try{let t=JSON.parse(ji(e.info)??"");return typeof t.url=="string"&&Number.isInteger(t.port)?t:null}catch{return null}}async function D9e(e){try{return(await fetch(jq(e,"/api/status"),{signal:AbortSignal.timeout(I9e)})).ok}catch{return!1}}async function Xye(e,t){try{process.kill(e,"SIGTERM")}catch{}if(!await fm(e,N9e)){try{process.kill(e,"SIGKILL")}catch{}if(!await fm(e,2e3))throw new ze(`The ${t} (pid ${e}) did not stop; stop it with \`${I_()} stop\` and retry`)}}async function P9e(){let e=Bye();for(let t of jye(e)){if(E_(t.pid,t.serverId)){try{process.kill(t.pid,"SIGTERM")}catch{}await fm(t.pid,5e3)}try{Uye(e,t)}catch{}}}function F9e(e){let t=Object.fromEntries(B3.flatMap(n=>process.env[n]?[[n,process.env[n]]]:[]));Object.keys(t).length&&si.default.writeFileSync(e.agent,`${JSON.stringify(t)}
|
|
507
507
|
`)}function B9e(e){let t={...process.env,ARTIFACTS_HOST:e.host,ARTIFACTS_URL_HOST:e.urlHost};process.env.RYUGI_ARTIFACTS_COMMAND&&(t.RYUGI_ARTIFACTS_LAUNCHER=process.env.RYUGI_ARTIFACTS_COMMAND);for(let n of["RYUGI_ARTIFACTS_OWNER","RYUGI_ARTIFACTS_VERSION","RYUGI_ARTIFACTS_COMMAND","ARTIFACTS_OPEN_CMD","ARTIFACTS_ROOT"])delete t[n];return t}var K9e=e=>e.split(`
|
|
508
508
|
`).find(t=>t.includes('"server-started"')),j9e=e=>e.split(`
|
|
509
509
|
`).find(t=>t.includes('"server-error"'));async function U9e(e,t,n){let o=await fetch(jq(e,"/api/hub/projects"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:t.project,...n?{open:n}:{},...n&&process.env.ARTIFACTS_OPEN_CMD?{openCmd:process.env.ARTIFACTS_OPEN_CMD}:{}}),signal:AbortSignal.timeout(w9e)});if(!o.ok)throw new ze(`The artifacts server refused this project: ${await o.text()}`)}async function Bq(e,t){if(t.signal?.throwIfAborted(),e.artifact!==void 0&&!dc.test(e.artifact))throw new ze(ld);if(e.port!==void 0&&(!/^\d+$/.test(e.port)||Number(e.port)<1||Number(e.port)>65535))throw new ze("--port must be a port number");e.urlHost||=e.host==="127.0.0.1"||e.host==="localhost"?"localhost":e.host,process.umask(63);let n=ds(e.projectDir),o=cd();Yq(o.home),si.default.mkdirSync(n.state,{recursive:!0}),si.default.existsSync(EO.default.join(n.state,".gitignore"))||si.default.writeFileSync(EO.default.join(n.state,".gitignore"),`*
|
|
510
|
-
`);let r=process.env.RYUGI_ARTIFACTS_VERSION||"1.
|
|
510
|
+
`);let r=process.env.RYUGI_ARTIFACTS_VERSION||"1.90.1",s=Jg(o.projects).some(c=>c.dir===n.project),i=async(c,u)=>{F9e(n);let d=e.open&&!e.library&&(!u||!s);await U9e(c,n,d?e.artifact??!0:void 0);let f=O9e(c,n,e.artifact);u&&(f.reused=!0);let p=await R9e(f,c,n,e.artifact),h=Wye(n.project);if(t.signal?.throwIfAborted(),e.library&&e.open&&(process.env.ARTIFACTS_OPEN_CMD?await new Promise(m=>(0,Mb.execFile)(process.env.ARTIFACTS_OPEN_CMD,[c.url],()=>m())):await Dq(c.url,[c.url]).catch(m=>t.log(m.message,"stderr"))),await t.ready(h?{...p,loginHint:h}:p),u&&s&&process.platform==="darwin"&&e.open&&e.openExisting&&e.artifact&&!process.env.ARTIFACTS_OPEN_CMD){let m=p.link;await Dq(typeof p.cloudLink=="string"?p.cloudLink:m,[m]).catch(g=>t.log(g.message,"stderr"))}};if(!await $9e(o.lock))throw new ze("Another start is still starting the artifacts server; retry in a moment");let a=!0,l=()=>{if(a){a=!1;try{si.default.rmdirSync(o.lock)}catch{}}};try{t.signal?.throwIfAborted();let c=M9e(o),u=Yye(o);if(c&&!u){for(let x=0;x<E9e&&ud(c)&&!u;x+=100)await Qg(100),u=Yye(o);!u&&ud(c)&&await Xye(c,"stopping artifacts server")}if(c&&u){let x=ji(o.version)??"",_=Gye(x,r),S=(u.host??"127.0.0.1")!==e.host||(u.urlHost??"localhost")!==e.urlHost||(u.cloudOrigin??Zye)!==A9e(process.env)||e.port!==void 0&&String(u.port)!==e.port;if(_!=="replace"&&!S&&await D9e(u))return l(),await i(u,!0),0;await Xye(c,"running artifacts server")}await P9e(),si.default.rmSync(o.info,{force:!0});let d=Jye.default.randomBytes(24).toString("hex");si.default.writeFileSync(o.serverId,`${d}
|
|
511
511
|
`),si.default.writeFileSync(o.version,`${r}
|
|
512
512
|
`);let p=[EO.default.join(__dirname,"server.cjs"),`--artifacts-server-id=${d}`,...e.port?[`--port=${e.port}`]:[]],h=B9e(e);if(e.foreground){let x=(0,Mb.spawn)(process.execPath,p,{env:h,stdio:["ignore","pipe","pipe"]});si.default.writeFileSync(o.pid,`${x.pid}
|
|
513
513
|
`);let _=()=>{x.kill("SIGTERM")};if(t.signal)t.signal.addEventListener("abort",_,{once:!0});else for(let k of["SIGINT","SIGTERM"])process.on(k,_);Kq.default.createInterface({input:x.stderr}).on("line",k=>t.log(k,"stderr"));let S=new Promise(k=>x.on("close",b=>k(b??1))),T=!1,C;Kq.default.createInterface({input:x.stdout}).on("line",k=>{let b;try{b=JSON.parse(k)}catch{t.log(k,"stdout");return}if(b.type!=="server-started"||T){t.event?t.event(b):b.type==="server-error"||b.type==="error"?t.failure(b):t.log(JSON.stringify(b),"stderr");return}T=!0,l(),C=i(b,!1),C.catch(()=>_())});try{let k=await S;return await C,k}finally{if(t.signal)t.signal.removeEventListener("abort",_);else for(let k of["SIGINT","SIGTERM"])process.removeListener(k,_)}}try{si.default.renameSync(o.log,`${o.log}.1`)}catch{}let g=si.default.openSync(o.log,"w"),y=(0,Mb.spawn)(process.execPath,p,{env:h,detached:!0,windowsHide:!0,stdio:["ignore",g,g]});si.default.closeSync(g),y.unref(),si.default.writeFileSync(o.pid,`${y.pid}
|
|
@@ -515,9 +515,9 @@ function run(urls) {
|
|
|
515
515
|
`)};if(ji(e.pid)===null)return{status:"not_running"};let n=Number(ji(e.pid)),o=ji(e.serverId)??"";if(!Number.isInteger(n)||n<=0||!/^[\w-]{32,64}$/.test(o)||!E_(n,o))return lm.default.rmSync(e.pid,{force:!0}),lm.default.rmSync(e.serverId,{force:!0}),t("stale_pid"),{status:"stale_pid"};try{process.kill(n,"SIGTERM")}catch{}if(!await fm(n,7e3)){try{process.kill(n,"SIGKILL")}catch{}await fm(n,1e3)}if(ud(n))return{status:"failed",error:"process still running"};for(let r of[e.pid,e.serverId])lm.default.rmSync(r,{force:!0});return t("stop"),{status:"stopped"}}var nxe={name:"stop",summary:"Stop this machine's artifacts server; the artifacts are kept",usage:["[options]"],options:{},semantic:e=>Xt({id:"stop",mode:"finite",output:{formats:["brief","json","jsonl","quiet"],scalar:t=>t.status},async run(t,n){let o=n.effects.begin("stop","machine"),r=await z9e();return r.status!=="failed"&&n.effects.set(o,r.status==="not_running"?"none":"confirmed"),It({status:r.status==="stopped"?"stopped":r.status==="failed"?"failed":"unchanged",reason:r.status,scope:"machine",artifacts:"kept"},r.status==="failed"?{kind:"failed",error:{code:"E_SERVER_STOP_FAILED",message:r.error}}:{kind:"succeeded"})},present:W9e},e)};var oxe=V(require("node:path"),1);var rxe={name:"uninstall",summary:"Remove recorded integrations and owned command; keep artifacts and data",options:{"install-dir":{type:"string",value:"<path>",help:"Managed installation directory"},harness:{type:"string",value:"<targets>",help:"Only remove these comma-separated harnesses; keep CLI"}},semantic:e=>Xt({id:"uninstall",mode:"finite",output:{formats:["brief","json","jsonl"]},run(t,n){let o=typeof e.values.harness=="string"?e.values.harness.split(",").map(_k):void 0;if(o?.some(a=>!xl.some(l=>l.id===a)))return It({removed:[],preserved:[],failures:[]},{kind:"validation_failed"},{warnings:[{code:"E_HARNESS",severity:"error",message:"Unknown harness selection"}]});let r=oxe.default.resolve(e.values["install-dir"]||Xc()),s=n.effects.begin("uninstall",r),i=KG(r,{targets:o});return i.failures.length||n.effects.confirm(s,i.removed),It(i,i.failures.length?{kind:"partial"}:{kind:"succeeded"})},present:({data:t})=>({heading:"Uninstall",status:t.failures.length?"partial":"removed",facts:[Ge("Removed",qt(t,"removed")),Ge("Preserved",qt(t,"preserved"))],sections:[{kind:"records",key:"failures",rows:t.failures,columns:[{key:"component",required:!0},{key:"message",required:!0}]}]})},e)};var Hq=require("node:child_process"),cxe=require("node:crypto"),Wq=V(require("node:fs"),1),Db=V(require("node:path"),1);var NO=V(require("node:fs"),1),sxe=V(require("node:os"),1),AO=V(require("node:path"),1);function ixe(e,t){let n=e.split(".").map(Number),o=t.split(".").map(Number);for(let r=0;r<3;r++)if(n[r]!==o[r])return n[r]>o[r];return!1}var Uq=e=>AO.default.join(e.XDG_CACHE_HOME||AO.default.join(sxe.default.homedir(),".cache"),"ryugi","artifacts","latest.json");function axe(e,t,n){try{NO.default.mkdirSync(AO.default.dirname(e),{recursive:!0});let o=`${e}.${process.pid}`;NO.default.writeFileSync(o,JSON.stringify({version:t,checkedAt:n})),NO.default.renameSync(o,e)}catch{}}var zc="ryugi-artifacts";function lxe(e,t){let n=`${zc}@${t}`;return{cmd:e,args:e==="npm"?["install","-g",n]:e==="yarn"?["global","add",n]:["add","-g",n]}}var v_=({cmd:e,args:t})=>[e,...t].join(" ");async function q9e(e){let t=e.endsWith("/")?e:`${e}/`;try{let n=await fetch(new URL(`${zc}/latest`,t),{signal:AbortSignal.timeout(1e4)}),{version:o}=await n.json();if(n.ok&&typeof o=="string"&&/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(o))return o;throw new Error(`registry returned ${n.status}`)}catch(n){throw new ze(`Could not get the latest ${zc} version from ${t}: ${n.message}`)}}function G9e(e,t){return e.kind==="transient"?`You ran ${zc} through ${e.runner}, which keeps no install to update. Run \`${e.runner} ${zc}@latest\` to get ${t}.`:e.kind==="local"?"This is a local build from a Ryugi checkout. Update it with `git pull`, then `pnpm build` in artifacts/.":e.kind==="launcher"?`Release cache refreshed to ${t}. Run the returned start command through the launcher to install it and replace the running server.`:null}var LO=class extends ze{};async function V9e(e,t={}){if(e.pm!==void 0&&!Nb.includes(e.pm))throw new ze(`--pm must be one of ${Nb.join(", ")}`);let n=e.pm?{kind:"global",pm:e.pm}:C_(e.file,e.env),o=await q9e(e.registry);t.beforeCache?.(),axe(Uq(e.env),o,Date.now()),t.cacheRefreshed?.();let r={type:"update-check",current:e.current,latest:o,install:n.kind};if(!ixe(o,e.current))return{...r,upToDate:!0,command:null};if(n.kind==="unknown"){let c=Nb.map(u=>` ${v_(lxe(u,o))}`).join(`
|
|
516
516
|
`);throw new LO(`Could not tell how ${zc} was installed (${e.file}). Install ${o} with one of:
|
|
517
517
|
${c}
|
|
518
|
-
or run \`${zc} update --pm <${Nb.join("|")}>\`.`)}if(n.kind==="managed"){if(e.check)return{...r,upToDate:!1,command:"ryugi update"};let c=Xc(e.env),u=new ja(c).current();if(!u)throw new ze("Managed runtime state is missing; run ryugi doctor.");let d=new ja(c,Db.default.dirname(u.bin)),f=Db.default.join(c,"downloads",`runtime-${(0,cxe.randomUUID)()}`);try{t.beforeInstall?.();let p;return t.downloadRuntime?p=await t.downloadRuntime(o):(Wq.default.mkdirSync(f,{recursive:!0}),t.log?.(`Downloading ${zc}@${o}`),mc("npm",["install","--prefix",f,"--ignore-scripts","--no-audit","--no-fund","--omit=dev","--legacy-peer-deps","--registry",e.registry,`${zc}@${o}`]),p=Db.default.join(f,"node_modules",zc)),d.install(p),{type:"updated",from:e.current,to:o,pm:"ryugi",command:"ryugi update"}}finally{Wq.default.rmSync(f,{recursive:!0,force:!0})}}if(n.kind!=="global")return{...r,upToDate:!1,command:null,message:G9e(n,o)};let s=lxe(n.pm,o);if(e.check)return{...r,upToDate:!1,command:v_(s)};let i=process.platform==="win32";t.beforeInstall?.();let a=t.log?["inherit","pipe","pipe"]:["inherit",2,2],l=i?(0,Hq.spawnSync)(v_(s),{stdio:[...a],env:e.env,shell:!0}):(0,Hq.spawnSync)(s.cmd,s.args,{stdio:[...a],env:e.env});if(l.stdout?.length&&t.log?.(l.stdout.toString()),l.stderr?.length&&t.log?.(l.stderr.toString()),l.error)throw new ze(`Could not run ${v_(s)}: ${l.error.message}`);if(l.status!==0)throw new ze(`${v_(s)} exited with ${l.status??l.signal}`);return{type:"updated",from:e.current,to:o,pm:n.pm,command:v_(s)}}var uxe={name:"update",summary:"Update the CLI through its original owner and refresh recorded harness integrations",options:{check:{type:"boolean",help:"Compare CLI versions only; do not install"},"cli-only":{type:"boolean",help:"Update CLI without refreshing harness plugins"},"plugins-only":{type:"boolean",help:"Refresh recorded plugins without updating CLI"},"install-dir":{type:"string",value:"<path>",help:"Managed installation directory"},"plugin-source":{type:"string",value:"<path>",help:"Plugin checkout for offline/development refresh"},pm:{type:"string",value:"<npm|pnpm|yarn|bun>",help:"Use this package manager instead of detecting it"}},semantic:e=>Xt({id:"update",mode:"finite",output:{formats:["brief","json","jsonl"],fields:["current","latest","install","status","installed","message","command","plugins"]},async run(t,n){if(e.values["cli-only"]&&e.values["plugins-only"])throw new ze("Choose --cli-only or --plugins-only");let o,r,s;try{s=e.values["plugins-only"]?{type:"update-check",current:"1.
|
|
518
|
+
or run \`${zc} update --pm <${Nb.join("|")}>\`.`)}if(n.kind==="managed"){if(e.check)return{...r,upToDate:!1,command:"ryugi update"};let c=Xc(e.env),u=new ja(c).current();if(!u)throw new ze("Managed runtime state is missing; run ryugi doctor.");let d=new ja(c,Db.default.dirname(u.bin)),f=Db.default.join(c,"downloads",`runtime-${(0,cxe.randomUUID)()}`);try{t.beforeInstall?.();let p;return t.downloadRuntime?p=await t.downloadRuntime(o):(Wq.default.mkdirSync(f,{recursive:!0}),t.log?.(`Downloading ${zc}@${o}`),mc("npm",["install","--prefix",f,"--ignore-scripts","--no-audit","--no-fund","--omit=dev","--legacy-peer-deps","--registry",e.registry,`${zc}@${o}`]),p=Db.default.join(f,"node_modules",zc)),d.install(p),{type:"updated",from:e.current,to:o,pm:"ryugi",command:"ryugi update"}}finally{Wq.default.rmSync(f,{recursive:!0,force:!0})}}if(n.kind!=="global")return{...r,upToDate:!1,command:null,message:G9e(n,o)};let s=lxe(n.pm,o);if(e.check)return{...r,upToDate:!1,command:v_(s)};let i=process.platform==="win32";t.beforeInstall?.();let a=t.log?["inherit","pipe","pipe"]:["inherit",2,2],l=i?(0,Hq.spawnSync)(v_(s),{stdio:[...a],env:e.env,shell:!0}):(0,Hq.spawnSync)(s.cmd,s.args,{stdio:[...a],env:e.env});if(l.stdout?.length&&t.log?.(l.stdout.toString()),l.stderr?.length&&t.log?.(l.stderr.toString()),l.error)throw new ze(`Could not run ${v_(s)}: ${l.error.message}`);if(l.status!==0)throw new ze(`${v_(s)} exited with ${l.status??l.signal}`);return{type:"updated",from:e.current,to:o,pm:n.pm,command:v_(s)}}var uxe={name:"update",summary:"Update the CLI through its original owner and refresh recorded harness integrations",options:{check:{type:"boolean",help:"Compare CLI versions only; do not install"},"cli-only":{type:"boolean",help:"Update CLI without refreshing harness plugins"},"plugins-only":{type:"boolean",help:"Refresh recorded plugins without updating CLI"},"install-dir":{type:"string",value:"<path>",help:"Managed installation directory"},"plugin-source":{type:"string",value:"<path>",help:"Plugin checkout for offline/development refresh"},pm:{type:"string",value:"<npm|pnpm|yarn|bun>",help:"Use this package manager instead of detecting it"}},semantic:e=>Xt({id:"update",mode:"finite",output:{formats:["brief","json","jsonl"],fields:["current","latest","install","status","installed","message","command","plugins"]},async run(t,n){if(e.values["cli-only"]&&e.values["plugins-only"])throw new ze("Choose --cli-only or --plugins-only");let o,r,s;try{s=e.values["plugins-only"]?{type:"update-check",current:"1.90.1",latest:"1.90.1",install:C_(__filename,process.env).kind,upToDate:!0,command:null,message:"CLI unchanged; refreshing recorded plugins."}:await V9e({current:"1.90.1",file:__filename,env:process.env,registry:process.env.npm_config_registry||"https://registry.npmjs.org/",check:!!e.values.check,pm:e.values.pm},{beforeCache(){r=n.effects.begin("release-cache",Uq(process.env))},cacheRefreshed(){r!==void 0&&n.effects.confirm(r)},beforeInstall(){o=n.effects.begin("install",zc)},log:n.diagnostic})}catch(a){throw a instanceof LO?new we({code:"E_INSTALL_UNKNOWN",message:a.message},"action_required"):a}s.type==="updated"&&o!==void 0&&n.effects.confirm(o,{from:s.from,to:s.to});let i=s.type==="updated"?{current:s.to,latest:s.to,install:s.pm==="ryugi"?"managed":"global",status:"updated",installed:!0,command:s.command}:{current:s.current,latest:s.latest,install:s.install,status:s.upToDate?"up_to_date":"available",installed:!1,command:s.command,...s.message?{message:s.message}:{}};if(!e.values.check&&!e.values["cli-only"]){let a=Db.default.resolve(e.values["install-dir"]||Xc());i.plugins=[];for(let l of Object.values(gm(a).harnesses)){let c=await Eq({projectDir:e.projectDir,positionals:[],values:{mode:l.mode,harness:l.harness,"no-cli":!0,"install-dir":a,"plugin-source":e.values["plugin-source"]}},n,!1,!0),u=c.data.targets.find(d=>d.harness===l.harness);i.plugins.push({harness:l.harness,mode:l.mode,status:u?.status||"failed",error:u?.error||(c.completion.kind!=="succeeded"?c.warnings.map(d=>d.message).join("; "):void 0)})}}return It(i,i.plugins?.some(a=>a.status!=="installed")?{kind:"partial"}:void 0,{effects:n.effects.snapshot(),actions:i.install==="launcher"&&i.status==="available"?[rn(["start","--background","--no-open","--project-dir",e.projectDir],"Restart server")]:[]})},present:Y9e},e)};function Y9e({data:e}){return{heading:"Update",status:e.status,facts:[Ge("Current",qt(e,"current"),!0),Ge("Latest",qt(e,"latest")),Ge("Install",qt(e,"install")),...e.message?[Ge("Advice",qt(e,"message"))]:[]],sections:e.plugins?.length?[{kind:"records",key:"plugins",title:"Harnesses",rows:e.plugins.map(t=>({...t})),columns:[{key:"harness",required:!0},{key:"mode",required:!0},{key:"status",required:!0},{key:"error"}]}]:[]}}var P_=[exe,nxe,mG,Oye,n3,Nye,bG,fG,$3,pge,vG,uxe,uye,UG,rxe];var pxe=V(require("node:fs"),1);function dxe(e){return(t,n,o)=>{let r=["--project-dir",e.projectDir],s=typeof e.values.artifact=="string"?e.values.artifact:void 0,i=[...r,...s?["--artifact",s]:[]];if(o.some(a=>a.state==="unknown")){let a;if(t.startsWith("comment")&&s)a=["comment","list",...i,...s.startsWith("verify/")?[]:["--sections","all",...t.endsWith(".ack")?[]:["--all"],"--detail"]];else if(t.startsWith("changes"))a=["changes",...i,"--detail"];else if(t.startsWith("publish"))a=["publish","--list",...r,...s&&o.some(l=>["share-key","revoke-key"].includes(l.operation)&&l.state==="unknown")?["--artifact",s]:[]];else if(t==="config")a=["config",...r];else if(t.startsWith("modules"))a=["modules",...i];else if(t==="update")a=["--version"];else{if(t==="install")return[{kind:"command",argv:["claude","plugin","list","--json"],label:"Verify state",reason:"Inspect installed plugins before any retry; an operation may already have completed."}];a=["get",...r]}return[{...rn(a,"Verify state"),reason:"Inspect current state before any retry; an operation may already have completed."}]}return n?.code==="E_SERVER_NOT_RUNNING"||n?.code==="E_SERVER_UNREACHABLE"?[rn(["start","--background","--no-open",...i],"Start server")]:n?.code==="E_ARGUMENT_INVALID"||n?.code==="E_OPTION_CONFLICT"?[rn([t.split(".")[0],...e.positionals[0]&&t.startsWith("comment")?[e.positionals[0]]:[],"--help"],"Help")]:n?ty(n):[]}}async function Pb(e,t,n,o){return jO({id:e,mode:"finite",output:{formats:[n.format]},run(){throw t},present(){return{heading:"Error",status:"failed",facts:[],sections:[]}}},void 0,{...n,fields:void 0,detail:!1},o)}function fxe(e,t){return{id:e,mode:"finite",output:{formats:["brief","json","jsonl"],fields:["text","version","capabilities","commands"]},run(){return It(t)},present({data:n}){return n.version?{heading:`ryugi ${n.version}`,status:"",facts:[],sections:[]}:{heading:"Help",status:"",facts:[],sections:[{kind:"content",key:"text",text:n.text}]}}}}async function hxe(e,t,n,o,r,s,i){let[a,...l]=e,c=t.find(d=>d.name===a),u;try{if(c?.positionals&&c.usage?.some(f=>/^[a-z]+\s/.test(f))&&(u=hm(l.filter(f=>f!=="--help"&&f!=="-h"),c.options,c.positionals).positionals[0]),a==="--version"||a==="-v")return hm(l,{},0),await Xt(fxe("version",{text:o,version:o,capabilities:["reviewBundlesV1"]}),void 0).run(r,s);if(a==="--help"||a==="-h"||c&&A3(l)){c||hm(l,{},0);let f=c?O3(c,u):R3(t,n);if(c&&["start","check"].includes(c.name)){let p=hm(l.filter(h=>h!=="--help"&&h!=="-h"),c.options,c.positionals);typeof p.values.artifact=="string"&&(f+=`
|
|
519
519
|
|
|
520
|
-
${sk(p.values.artifact)}`)}return await Xt(fxe("help",{text:f,commands:t.map(({name:p,summary:h})=>({name:p,summary:h}))}),void 0).run(r,s)}if(!c&&(!a||a.startsWith("-")||(()=>{try{return pxe.default.statSync(a).isDirectory()}catch{return!1}})())){let f=hm(e,n,1);if(f.positionals.length&&f.values["project-dir"])throw new we({code:"E_ARGUMENT_INVALID",message:"Specify one project directory."});return f.projectDir=f.values["project-dir"]??f.positionals[0]??f.projectDir,f.values.foreground=!0,f.values.open=!f.values["no-open"],await IO(f,"browse").run(r,s,i)}if(!c)throw new we({code:a?.includes("/")?"E_PROJECT_NOT_FOUND":"E_UNKNOWN_COMMAND",message:a?`Unknown command: ${a}`:"Use start --foreground to browse with semantic output."});let d;try{d=hm(l,nR(c,u),c.positionals)}catch(f){throw new we({code:"E_ARGUMENT_INVALID",message:f.message})}return d.projectDir=ds(d.projectDir).project,await c.semantic(d).run(r,s,i,dxe(d))}catch(d){let f=d instanceof ze?new we({code:"E_ARGUMENT_INVALID",message:d.message}):d;return f instanceof Error&&Object.assign(f,{actions:[rn([...c?[c.name,...u&&c.usage?.some(p=>p.startsWith(`${u} `))?[u]:[]]:[],"--help"],"Help")]}),Pb(c?.name??a??"browse",f,r,s)}}function zq(e=process.stdout,t=process.stderr){let n=new WeakMap;for(let o of[e,t])o.on("error",r=>n.set(o,r));return{write(o,r){let s=o==="stdout"?e:t,i=n.get(s);return i?Promise.reject(i):new Promise((a,l)=>s.write(r,c=>c?l(c):a()))}}}function qq(e){process.exitCode=e}var X9e={"no-open":{type:"boolean",help:"Print the URL without opening a browser"}};async function J9e(e){let t=Object.assign({},yl,...P_.map(a=>a.options)),n=zq(),o;try{o=QO(e,t,I3(e,t))}catch(a){return Pb(e[0]??"browse",a,QO(e,t).options,n)}if(o.error)return Pb(e[0]??"browse",o.error,o.options,n);let r=new AbortController,s=()=>r.abort("SIGINT"),i=()=>r.abort("SIGTERM");process.on("SIGINT",s),process.on("SIGTERM",i);try{return await hxe(e,P_,X9e,"1.
|
|
520
|
+
${sk(p.values.artifact)}`)}return await Xt(fxe("help",{text:f,commands:t.map(({name:p,summary:h})=>({name:p,summary:h}))}),void 0).run(r,s)}if(!c&&(!a||a.startsWith("-")||(()=>{try{return pxe.default.statSync(a).isDirectory()}catch{return!1}})())){let f=hm(e,n,1);if(f.positionals.length&&f.values["project-dir"])throw new we({code:"E_ARGUMENT_INVALID",message:"Specify one project directory."});return f.projectDir=f.values["project-dir"]??f.positionals[0]??f.projectDir,f.values.foreground=!0,f.values.open=!f.values["no-open"],await IO(f,"browse").run(r,s,i)}if(!c)throw new we({code:a?.includes("/")?"E_PROJECT_NOT_FOUND":"E_UNKNOWN_COMMAND",message:a?`Unknown command: ${a}`:"Use start --foreground to browse with semantic output."});let d;try{d=hm(l,nR(c,u),c.positionals)}catch(f){throw new we({code:"E_ARGUMENT_INVALID",message:f.message})}return d.projectDir=ds(d.projectDir).project,await c.semantic(d).run(r,s,i,dxe(d))}catch(d){let f=d instanceof ze?new we({code:"E_ARGUMENT_INVALID",message:d.message}):d;return f instanceof Error&&Object.assign(f,{actions:[rn([...c?[c.name,...u&&c.usage?.some(p=>p.startsWith(`${u} `))?[u]:[]]:[],"--help"],"Help")]}),Pb(c?.name??a??"browse",f,r,s)}}function zq(e=process.stdout,t=process.stderr){let n=new WeakMap;for(let o of[e,t])o.on("error",r=>n.set(o,r));return{write(o,r){let s=o==="stdout"?e:t,i=n.get(s);return i?Promise.reject(i):new Promise((a,l)=>s.write(r,c=>c?l(c):a()))}}}function qq(e){process.exitCode=e}var X9e={"no-open":{type:"boolean",help:"Print the URL without opening a browser"}};async function J9e(e){let t=Object.assign({},yl,...P_.map(a=>a.options)),n=zq(),o;try{o=QO(e,t,I3(e,t))}catch(a){return Pb(e[0]??"browse",a,QO(e,t).options,n)}if(o.error)return Pb(e[0]??"browse",o.error,o.options,n);let r=new AbortController,s=()=>r.abort("SIGINT"),i=()=>r.abort("SIGTERM");process.on("SIGINT",s),process.on("SIGTERM",i);try{return await hxe(e,P_,X9e,"1.90.1",o.options,n,r.signal)}finally{process.removeListener("SIGINT",s),process.removeListener("SIGTERM",i)}}J9e(process.argv.slice(2)).then(qq,e=>Pb(process.argv[2]??"browse",e,{format:"brief"},zq()).then(qq));
|
|
521
521
|
/*! Bundled license information:
|
|
522
522
|
|
|
523
523
|
react/cjs/react.production.js:
|