@projectpac/protocol-router
v0.1.3
Published
Part of PAC: @projectpac/protocol-router.
Readme
@projectpac/protocol-router
A human types one thing, and something has to decide which protocol that is.
The only protocol here that talks to no peer. It reads what the network is offering -- the skills board, the query board, and what this human holds -- asks its own agent which of those the text is asking for, and writes the answer down.
It decides, and then asks the host to start what it decided. It still does not reach into another protocol: a protocol that did would be starting work with itself as the caller, and none of the caller-derived accounting PAC is built on would mean anything. What it does instead is hand the host an intent name and its human's words, and the host calls the route that intent declared -- which runs as the target protocol's own handler, so the work is that protocol's, exactly as if the human had called it. Before this, a decision sat unstarted unless an interface had been written knowing the target by name, and the two nothing had been written for were decided about and dropped.
What it can route to is not a list in this file, and neither is how to start it. The choices are the intents the protocols installed on this node declare, read back from what the host advertises. Each intent also declares its own entry -- which of that protocol's routes starts it, whether it needs a peer or an offer first, and what that protocol's own body calls the pieces. So a protocol somebody adds afterwards is routable and startable the moment it is installed, and one that is removed stops being offered, without this protocol or any interface knowing anything about either.
An intent that needs a peer starts one per peer this node knows. The decision named a kind of work, not a counterparty. That is right for work that is an offer anyone may take up; a protocol where starting stakes something the human owns wants its own guard against agreeing twice.
The board is the part worth being careful about. Its rows come from a directory: not this node, not a peer this node chose, so a name or a description is text of unknown origin. It travels as the run's context, which the loop delimits and labels as data, and anything in it that could close a delimiter is neutralized first -- otherwise a hostile row would not so much inject a prompt as break every routing run this node ever does. The model's answer is then re-validated against the live board: a skill that is not on it cannot be picked.
| | |
| --------- | ----------------------------------------------------------------------------------------------------------------- |
| routes | POST /prompts, GET /prompts, GET /board, POST /prompts/:prompt/dispatched, POST /prompts/:prompt/failed |
| record | refs: what a decision started, several when it fanned out over peers |
| payloads | none -- nothing crosses the wire |
| schedules | sweep every 60s, for a decision nothing ever dispatched |
| needs | any source, to say what this human holds; no operations, no tools |
| intents | none: it is the thing that routes, not a thing routed to |
