[{"data":1,"prerenderedAt":412},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fv2\u002Fapi\u002Fui":3},{"id":4,"title":5,"body":6,"description":405,"extension":406,"meta":407,"navigation":128,"path":408,"seo":409,"stem":410,"__hash__":411},"docs\u002Fdocs\u002Fv2\u002Fapi\u002Fui.md","axon.ui",{"type":7,"value":8,"toc":400},"minimark",[9,13,29,203,208,214,224,228,231,353,357,367,396],[10,11,5],"h1",{"id":12},"axonui",[14,15,16,17,21,22,24,25,28],"p",{},"Request input from a connected TUI host. When the agent is running headlessly —\nvia ",[18,19,20],"code",{},"axon run",", a cron job, or a route handler — ",[18,23,5],{}," returns ",[18,26,27],{},"{ unavailable }","\nrather than blocking.",[30,31,36],"pre",{"className":32,"code":33,"language":34,"meta":35,"style":35},"language-ts shiki shiki-themes dark-plus","const response = await axon.ui.ask({\n    message: \"Which approach should I take?\",\n    options: [\"refactor\", \"rewrite\", \"leave it\"],\n})\n\nif (\"unavailable\" in response) {\n    \u002F\u002F no connected host — fall back to a default or skip the decision\n} else {\n    console.log(response.selected)   \u002F\u002F what the user picked\n}\n","ts","",[18,37,38,78,91,117,123,130,150,157,169,197],{"__ignoreMap":35},[39,40,43,47,51,55,59,63,66,69,71,75],"span",{"class":41,"line":42},"line",1,[39,44,46],{"class":45},"scz_3","const",[39,48,50],{"class":49},"s9McN"," response",[39,52,54],{"class":53},"sTNBD"," = ",[39,56,58],{"class":57},"sYbnZ","await",[39,60,62],{"class":61},"s3F5K"," axon",[39,64,65],{"class":53},".",[39,67,68],{"class":61},"ui",[39,70,65],{"class":53},[39,72,74],{"class":73},"sCudf","ask",[39,76,77],{"class":53},"({\n",[39,79,81,84,88],{"class":41,"line":80},2,[39,82,83],{"class":61},"    message:",[39,85,87],{"class":86},"sKc5r"," \"Which approach should I take?\"",[39,89,90],{"class":53},",\n",[39,92,94,97,100,103,106,109,111,114],{"class":41,"line":93},3,[39,95,96],{"class":61},"    options:",[39,98,99],{"class":53}," [",[39,101,102],{"class":86},"\"refactor\"",[39,104,105],{"class":53},", ",[39,107,108],{"class":86},"\"rewrite\"",[39,110,105],{"class":53},[39,112,113],{"class":86},"\"leave it\"",[39,115,116],{"class":53},"],\n",[39,118,120],{"class":41,"line":119},4,[39,121,122],{"class":53},"})\n",[39,124,126],{"class":41,"line":125},5,[39,127,129],{"emptyLinePlaceholder":128},true,"\n",[39,131,133,136,139,142,145,147],{"class":41,"line":132},6,[39,134,135],{"class":57},"if",[39,137,138],{"class":53}," (",[39,140,141],{"class":86},"\"unavailable\"",[39,143,144],{"class":45}," in",[39,146,50],{"class":61},[39,148,149],{"class":53},") {\n",[39,151,153],{"class":41,"line":152},7,[39,154,156],{"class":155},"sOLPB","    \u002F\u002F no connected host — fall back to a default or skip the decision\n",[39,158,160,163,166],{"class":41,"line":159},8,[39,161,162],{"class":53},"} ",[39,164,165],{"class":57},"else",[39,167,168],{"class":53}," {\n",[39,170,172,175,177,180,183,186,188,191,194],{"class":41,"line":171},9,[39,173,174],{"class":61},"    console",[39,176,65],{"class":53},[39,178,179],{"class":73},"log",[39,181,182],{"class":53},"(",[39,184,185],{"class":61},"response",[39,187,65],{"class":53},[39,189,190],{"class":61},"selected",[39,192,193],{"class":53},")   ",[39,195,196],{"class":155},"\u002F\u002F what the user picked\n",[39,198,200],{"class":41,"line":199},10,[39,201,202],{"class":53},"}\n",[204,205,207],"h2",{"id":206},"why-this-exists","Why this exists",[14,209,210,211,213],{},"Some scripts benefit from a human decision mid-run — a confirmation before a\ndestructive action, a choice between approaches, a review gate. ",[18,212,5],{}," lets\nscripts surface those moments to a TUI user without hardcoding a blocking prompt\nthat would break headless execution.",[14,215,216,217,220,221,223],{},"The ",[18,218,219],{},"unavailable"," check is the contract: any script that calls ",[18,222,5],{}," must\nhandle the headless case explicitly. The runtime never blocks waiting for input\nthat may never come.",[204,225,227],{"id":226},"axonuiask","axon.ui.ask",[14,229,230],{},"Presents a question with a fixed set of options. Returns whichever the user selects.",[30,232,234],{"className":32,"code":233,"language":34,"meta":35,"style":35},"const response = await axon.ui.ask({\n    message: \"Proceed with the migration?\",\n    options: [\"yes\", \"no\", \"show me the diff first\"],\n})\n\nif (\"selected\" in response) {\n    if (response.selected === \"no\") process.exit(0)\n}\n",[18,235,236,258,267,288,292,296,311,349],{"__ignoreMap":35},[39,237,238,240,242,244,246,248,250,252,254,256],{"class":41,"line":42},[39,239,46],{"class":45},[39,241,50],{"class":49},[39,243,54],{"class":53},[39,245,58],{"class":57},[39,247,62],{"class":61},[39,249,65],{"class":53},[39,251,68],{"class":61},[39,253,65],{"class":53},[39,255,74],{"class":73},[39,257,77],{"class":53},[39,259,260,262,265],{"class":41,"line":80},[39,261,83],{"class":61},[39,263,264],{"class":86}," \"Proceed with the migration?\"",[39,266,90],{"class":53},[39,268,269,271,273,276,278,281,283,286],{"class":41,"line":93},[39,270,96],{"class":61},[39,272,99],{"class":53},[39,274,275],{"class":86},"\"yes\"",[39,277,105],{"class":53},[39,279,280],{"class":86},"\"no\"",[39,282,105],{"class":53},[39,284,285],{"class":86},"\"show me the diff first\"",[39,287,116],{"class":53},[39,289,290],{"class":41,"line":119},[39,291,122],{"class":53},[39,293,294],{"class":41,"line":125},[39,295,129],{"emptyLinePlaceholder":128},[39,297,298,300,302,305,307,309],{"class":41,"line":132},[39,299,135],{"class":57},[39,301,138],{"class":53},[39,303,304],{"class":86},"\"selected\"",[39,306,144],{"class":45},[39,308,50],{"class":61},[39,310,149],{"class":53},[39,312,313,316,318,320,322,324,327,329,332,335,337,340,342,346],{"class":41,"line":152},[39,314,315],{"class":57},"    if",[39,317,138],{"class":53},[39,319,185],{"class":61},[39,321,65],{"class":53},[39,323,190],{"class":61},[39,325,326],{"class":53}," === ",[39,328,280],{"class":86},[39,330,331],{"class":53},") ",[39,333,334],{"class":61},"process",[39,336,65],{"class":53},[39,338,339],{"class":73},"exit",[39,341,182],{"class":53},[39,343,345],{"class":344},"sDGX8","0",[39,347,348],{"class":53},")\n",[39,350,351],{"class":41,"line":159},[39,352,202],{"class":53},[204,354,356],{"id":355},"timeout","Timeout",[14,358,359,360,362,363,366],{},"If the user doesn't respond within the configured timeout, ",[18,361,74],{}," returns\n",[18,364,365],{},"{ timeout: true }"," rather than blocking indefinitely.",[30,368,370],{"className":32,"code":369,"language":34,"meta":35,"style":35},"if (\"timeout\" in response) {\n    \u002F\u002F user didn't respond — proceed with default\n}\n",[18,371,372,387,392],{"__ignoreMap":35},[39,373,374,376,378,381,383,385],{"class":41,"line":42},[39,375,135],{"class":57},[39,377,138],{"class":53},[39,379,380],{"class":86},"\"timeout\"",[39,382,144],{"class":45},[39,384,50],{"class":61},[39,386,149],{"class":53},[39,388,389],{"class":41,"line":80},[39,390,391],{"class":155},"    \u002F\u002F user didn't respond — proceed with default\n",[39,393,394],{"class":41,"line":93},[39,395,202],{"class":53},[397,398,399],"style",{},"html pre.shiki code .scz_3, html code.shiki .scz_3{--shiki-default:#569CD6}html pre.shiki code .s9McN, html code.shiki .s9McN{--shiki-default:#4FC1FF}html pre.shiki code .sTNBD, html code.shiki .sTNBD{--shiki-default:#D4D4D4}html pre.shiki code .sYbnZ, html code.shiki .sYbnZ{--shiki-default:#C586C0}html pre.shiki code .s3F5K, html code.shiki .s3F5K{--shiki-default:#9CDCFE}html pre.shiki code .sCudf, html code.shiki .sCudf{--shiki-default:#DCDCAA}html pre.shiki code .sKc5r, html code.shiki .sKc5r{--shiki-default:#CE9178}html pre.shiki code .sOLPB, html code.shiki .sOLPB{--shiki-default:#6A9955}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sDGX8, html code.shiki .sDGX8{--shiki-default:#B5CEA8}",{"title":35,"searchDepth":80,"depth":80,"links":401},[402,403,404],{"id":206,"depth":80,"text":207},{"id":226,"depth":80,"text":227},{"id":355,"depth":80,"text":356},"Request input from a connected TUI host. When the agent is running headlessly —\nvia axon run, a cron job, or a route handler — axon.ui returns { unavailable }\nrather than blocking.","md",{},"\u002Fdocs\u002Fv2\u002Fapi\u002Fui",{"title":5,"description":405},"docs\u002Fv2\u002Fapi\u002Fui","3sEyhPJT99tAh9H1PZ-aFuDWEquBPmUln9F-vlZnT9Q",1785671808452]