opencode/packages/widget/test/fixtures/wire/shared-node.json
OpenCode Agent 523750c6a1 feat(core): widget protocol 2: split native step output, keys and depth rules, function rule
- __widget_native_step(__input()) hands the view to the host global __widget_emit and returns the
  rest of the step output as the run's result, under its JSON rules; the TypeScript host uses it.
- The prelude's first line declares __widget_protocol = 2; hosts refuse older programs as a program
  error (ask the agent to post it again) and newer ones as a client error.
- Keys are strings, numbers or booleans, and views nest at most 100 levels; both are program errors
  in phase view, in the prelude's tree building and in native hosts. The boundary depth for 100
  levels is 202.
- A function in a host call's argument anywhere but a node's handler props fails the call with the
  runtime's TypeError, the view's included.
- Wire fixtures gain the run's result, failures, keys, depth and JSON edge cases.
2026-11-22 13:25:02 +00:00

54 lines
965 B
JSON

{
"name": "shared-node",
"source": "function view() {\n const go = ui.button(\"Go\", { onPress: (s) => s })\n return ui.column([go, ui.text(\"between\"), go])\n}",
"input": {
"phase": "init",
"data": null
},
"built": {
"type": "column",
"children": [
{
"onPress": "$function",
"type": "button",
"label": "Go"
},
{
"type": "text",
"text": "between"
},
{
"onPress": "$function",
"type": "button",
"label": "Go"
}
]
},
"view": {
"type": "column",
"children": [
{
"type": "button",
"label": "Go",
"id": "0/0"
},
{
"type": "text",
"text": "between"
},
{
"type": "button",
"label": "Go",
"id": "0/2"
}
]
},
"handlers": {
"0/0": "press",
"0/2": "press"
},
"canvases": {},
"result": {
"state": {}
}
}