{
  "askPatienceMs": 5000,
  "env": {
    "generation": "INTENTIC_NODE_GENERATION",
    "instance": "INTENTIC_INSTANCE",
    "netdSocket": "INTENTIC_NETD_SOCKET",
    "nodeSocket": "INTENTIC_NODE_SOCKET"
  },
  "frame": {
    "lengthBytes": 4,
    "maxBytes": 67108864
  },
  "fromNode": {
    "$defs": {
      "Answer": {
        "oneOf": [
          {
            "properties": {
              "answer": {
                "const": "preview",
                "type": "string"
              },
              "route": {
                "$ref": "#/$defs/PreviewRoute"
              }
            },
            "required": [
              "answer",
              "route"
            ],
            "type": "object"
          },
          {
            "properties": {
              "answer": {
                "const": "terminal",
                "type": "string"
              },
              "member": {
                "description": "The member whose ticket opened it, lowercased; absent when the daemon runs without auth.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "plan": {
                "$ref": "#/$defs/TerminalPlan"
              }
            },
            "required": [
              "answer",
              "plan"
            ],
            "type": "object"
          },
          {
            "properties": {
              "answer": {
                "const": "pong",
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "type": "object"
          }
        ]
      },
      "Certificate": {
        "description": "A PEM certificate chain and its PEM private key.",
        "properties": {
          "certificate": {
            "type": "string"
          },
          "privateKey": {
            "type": "string"
          }
        },
        "required": [
          "certificate",
          "privateKey"
        ],
        "type": "object"
      },
      "Endpoint": {
        "properties": {
          "host": {
            "type": "string"
          },
          "port": {
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "host",
          "port"
        ],
        "type": "object"
      },
      "ListenConfig": {
        "description": "Every port netd binds, as Node's config names them; an absent one is not bound.",
        "properties": {
          "daemon": {
            "$ref": "#/$defs/Endpoint"
          },
          "frameAncestors": {
            "description": "Origins that may frame a preview besides the preview itself.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "loopback": {
            "anyOf": [
              {
                "$ref": "#/$defs/Endpoint"
              },
              {
                "type": "null"
              }
            ]
          },
          "preview": {
            "anyOf": [
              {
                "$ref": "#/$defs/Endpoint"
              },
              {
                "type": "null"
              }
            ]
          },
          "previewProbePath": {
            "description": "A preview path Node answers whatever its host resolves to.",
            "type": "string"
          },
          "sandboxId": {
            "description": "The 12-hex id every public hostname ends in; without one, a label's prefix alone classifies it.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "daemon",
          "frameAncestors",
          "previewProbePath"
        ],
        "type": "object"
      },
      "NetdQuestion": {
        "description": "A question Node asks netd.",
        "oneOf": [
          {
            "description": "Where each checkout's count stands, once every write that finished before this was sent is counted.",
            "properties": {
              "dirs": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "question": {
                "const": "sync",
                "type": "string"
              }
            },
            "required": [
              "question",
              "dirs"
            ],
            "type": "object"
          }
        ]
      },
      "Page": {
        "description": "An answer Node renders whole when asked, for netd to write as it stands: a refusal page, or the probe's report.",
        "properties": {
          "body": {
            "type": "string"
          },
          "headers": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "status": {
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "status",
          "headers",
          "body"
        ],
        "type": "object"
      },
      "PreviewRoute": {
        "description": "What becomes of a preview host's request, decided by Node once, when asked.",
        "oneOf": [
          {
            "description": "netd relays it to this upstream.",
            "properties": {
              "to": {
                "const": "upstream",
                "type": "string"
              },
              "upstream": {
                "$ref": "#/$defs/Upstream"
              }
            },
            "required": [
              "to",
              "upstream"
            ],
            "type": "object"
          },
          {
            "description": "netd answers it with this page.",
            "properties": {
              "page": {
                "$ref": "#/$defs/Page"
              },
              "to": {
                "const": "page",
                "type": "string"
              }
            },
            "required": [
              "to",
              "page"
            ],
            "type": "object"
          },
          {
            "description": "The sandbox's outbox: handed back to Node marked `outbox`, which serves the file it names.",
            "properties": {
              "to": {
                "const": "outbox",
                "type": "string"
              }
            },
            "required": [
              "to"
            ],
            "type": "object"
          }
        ]
      },
      "Scheme": {
        "enum": [
          "http",
          "https"
        ],
        "type": "string"
      },
      "TerminalPlan": {
        "description": "What a terminal socket opens onto, as Node decided from its ticket, session name and working directory.",
        "oneOf": [
          {
            "description": "The tmux session `name`, created in `create_in` when it does not exist yet; without a directory it is only ever\nattached, so a session that is gone fails as itself rather than as a bare shell in its place. netd composes\nthe command.",
            "properties": {
              "createIn": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "plan": {
                "const": "session",
                "type": "string"
              }
            },
            "required": [
              "plan",
              "name"
            ],
            "type": "object"
          },
          {
            "description": "A service's log, followed from its first line.",
            "properties": {
              "path": {
                "type": "string"
              },
              "plan": {
                "const": "tail",
                "type": "string"
              }
            },
            "required": [
              "plan",
              "path"
            ],
            "type": "object"
          },
          {
            "description": "Opens only to end at once: the session names nothing there is to show.",
            "properties": {
              "code": {
                "format": "int32",
                "type": "integer"
              },
              "plan": {
                "const": "exit",
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "plan",
              "code",
              "reason"
            ],
            "type": "object"
          },
          {
            "description": "Closed with this WebSocket close code before anything is attached.",
            "properties": {
              "code": {
                "format": "uint16",
                "maximum": 65535,
                "minimum": 0,
                "type": "integer"
              },
              "plan": {
                "const": "refused",
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "plan",
              "code",
              "reason"
            ],
            "type": "object"
          }
        ]
      },
      "TunnelConfig": {
        "description": "The ingress tunnel's door, the reachability grant it presents there, and the daemon's transfer routes it announces\n(`METHOD /path` each, as the daemon names them), which the edge sends down the bulk socket.",
        "properties": {
          "bulk": {
            "default": [],
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "grant": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "grant"
        ],
        "type": "object"
      },
      "Upstream": {
        "description": "A local upstream a preview host relays to.",
        "properties": {
          "frameable": {
            "description": "Framed by the editor: `frame-ancestors` is set and `x-frame-options` dropped.",
            "type": "boolean"
          },
          "host": {
            "type": "string"
          },
          "localhost": {
            "description": "Rewrites Host and Origin to `localhost:<port>`, for an app that never agreed to its preview name.",
            "type": "boolean"
          },
          "port": {
            "format": "uint16",
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
          },
          "scheme": {
            "$ref": "#/$defs/Scheme"
          }
        },
        "required": [
          "host",
          "port",
          "scheme",
          "localhost",
          "frameable"
        ],
        "type": "object"
      },
      "WatchedCheckout": {
        "description": "A checkout whose changes netd counts: its working tree, the git dir holding its index and HEAD, and the common\ndir holding refs and excludes (the git dir itself for a repository's main checkout).",
        "properties": {
          "commonDir": {
            "type": "string"
          },
          "dir": {
            "type": "string"
          },
          "gitDir": {
            "type": "string"
          }
        },
        "required": [
          "dir",
          "gitDir",
          "commonDir"
        ],
        "type": "object"
      }
    },
    "description": "Everything Node sends netd.",
    "oneOf": [
      {
        "description": "Node's HTTP socket is accepting; once per Node process. `generation` is the `GENERATION_ENV` it was started with,\nabsent from a Node that predates it.",
        "properties": {
          "build": {
            "type": "string"
          },
          "generation": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "kind": {
            "const": "hello",
            "type": "string"
          },
          "pid": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "kind",
          "build",
          "pid"
        ],
        "type": "object"
      },
      {
        "properties": {
          "config": {
            "$ref": "#/$defs/ListenConfig"
          },
          "kind": {
            "const": "listen",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "config"
        ],
        "type": "object"
      },
      {
        "properties": {
          "certificate": {
            "anyOf": [
              {
                "$ref": "#/$defs/Certificate"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "const": "certificate",
            "type": "string"
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      {
        "properties": {
          "kind": {
            "const": "tunnel",
            "type": "string"
          },
          "tunnel": {
            "anyOf": [
              {
                "$ref": "#/$defs/TunnelConfig"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      {
        "properties": {
          "id": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "const": "ask",
            "type": "string"
          },
          "question": {
            "$ref": "#/$defs/NetdQuestion"
          }
        },
        "required": [
          "kind",
          "id",
          "question"
        ],
        "type": "object"
      },
      {
        "properties": {
          "answer": {
            "$ref": "#/$defs/Answer"
          },
          "id": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "const": "answer",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "id",
          "answer"
        ],
        "type": "object"
      },
      {
        "properties": {
          "id": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "const": "refused",
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "id",
          "message"
        ],
        "type": "object"
      },
      {
        "description": "Closes every terminal the member opened; naming none closes every terminal a member opened.",
        "properties": {
          "kind": {
            "const": "revoke",
            "type": "string"
          },
          "member": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      {
        "description": "Counts this checkout's changes from now on; the same checkout again changes nothing.",
        "properties": {
          "checkout": {
            "$ref": "#/$defs/WatchedCheckout"
          },
          "kind": {
            "const": "watch",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "checkout"
        ],
        "type": "object"
      },
      {
        "description": "Stops counting the checkout at `dir`.",
        "properties": {
          "dir": {
            "type": "string"
          },
          "kind": {
            "const": "unwatch",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "dir"
        ],
        "type": "object"
      }
    ],
    "title": "FromNode"
  },
  "headers": [
    "x-intentic-preview",
    "x-intentic-preview-unreachable",
    "x-intentic-listener"
  ],
  "toNode": {
    "$defs": {
      "NetdAnswer": {
        "oneOf": [
          {
            "description": "Each asked checkout's generation, in the order asked: a number that moves whenever anything a `git status` there\nreads may have changed, and null for a checkout netd is not counting.",
            "properties": {
              "answer": {
                "const": "sync",
                "type": "string"
              },
              "generations": {
                "items": {
                  "format": "uint64",
                  "minimum": 0,
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "type": "array"
              }
            },
            "required": [
              "answer",
              "generations"
            ],
            "type": "object"
          }
        ]
      },
      "Question": {
        "description": "A question netd asks Node.",
        "oneOf": [
          {
            "description": "What becomes of a request to a preview host; `probe` when it asks the preview probe's path.",
            "properties": {
              "host": {
                "type": "string"
              },
              "probe": {
                "default": false,
                "type": "boolean"
              },
              "question": {
                "const": "preview",
                "type": "string"
              }
            },
            "required": [
              "question",
              "host"
            ],
            "type": "object"
          },
          {
            "description": "A terminal socket asking to open, its query string as the browser sent it.",
            "properties": {
              "query": {
                "type": "string"
              },
              "question": {
                "const": "terminal",
                "type": "string"
              }
            },
            "required": [
              "question",
              "query"
            ],
            "type": "object"
          },
          {
            "description": "Whether Node's event loop turns, and how fast: answered `pong` at once, by the link itself. netd sends one\nevery 2 s once the previous one is answered, and reports the round trip as the vitals' lag. An older Node answers\nwith a refusal, or with an answer netd cannot read, and either still counts as answered.",
            "properties": {
              "question": {
                "const": "ping",
                "type": "string"
              }
            },
            "required": [
              "question"
            ],
            "type": "object"
          }
        ]
      },
      "TunnelRefusal": {
        "description": "Why netd stopped dialling the ingress at its usual pace, past an ordinary drop it redials at once.",
        "oneOf": [
          {
            "description": "Another copy of this sandbox (a container holding the same grant) holds its tunnel, running on `host` as the\nedge named it: the edge refused this netd three times in a row, and netd now dials every 15 minutes.",
            "properties": {
              "host": {
                "type": "string"
              },
              "refusal": {
                "const": "elsewhere",
                "type": "string"
              }
            },
            "required": [
              "refusal",
              "host"
            ],
            "type": "object"
          },
          {
            "description": "The platform deleted this sandbox: the edge closed its tunnel for that, and netd stopped dialling.",
            "properties": {
              "refusal": {
                "const": "deleted",
                "type": "string"
              }
            },
            "required": [
              "refusal"
            ],
            "type": "object"
          }
        ]
      }
    },
    "description": "Everything netd sends Node.",
    "oneOf": [
      {
        "properties": {
          "id": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "const": "ask",
            "type": "string"
          },
          "question": {
            "$ref": "#/$defs/Question"
          }
        },
        "required": [
          "kind",
          "id",
          "question"
        ],
        "type": "object"
      },
      {
        "properties": {
          "answer": {
            "$ref": "#/$defs/NetdAnswer"
          },
          "id": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "const": "answer",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "id",
          "answer"
        ],
        "type": "object"
      },
      {
        "properties": {
          "id": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "kind": {
            "const": "refused",
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "id",
          "message"
        ],
        "type": "object"
      },
      {
        "description": "Where the ingress tunnel's interactive socket stands, told on every change and again to each Node that says\nhello. `reason` says why it is not held, in netd's words (a drop, the edge's refusal), and `refused` when\nnetd stopped redialling at its usual pace (2026-10-05).",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "kind": {
            "const": "tunnel",
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "refused": {
            "anyOf": [
              {
                "$ref": "#/$defs/TunnelRefusal"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "kind",
          "connected"
        ],
        "type": "object"
      },
      {
        "description": "A line the person typed with echo off in one of the editor's own terminal sessions (`web-…`), after a\npassword-ish question: told once, on Enter, for the daemon to hand Passwords if the owner turned remembering on\nfor sandbox terminals (2026-10-19). Never logged on either side; netd keeps nothing of it after sending.",
        "properties": {
          "kind": {
            "const": "hiddenLine",
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "session": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "session",
          "prompt",
          "value"
        ],
        "type": "object"
      }
    ],
    "title": "ToNode"
  }
}
