✓
Passing This code compiles and runs correctly.
Code
// Pins the bridge's complete derived prompt: grammar renders the wire's shape
// rules, then the scope's compiled verbs, then the session's OWN defined
// flows — the register block plus the agent's growth, with nothing
// hand-typed. A prompt built from this render and a turn judged by the wire
// gate in run are the same declaration read twice: the lesson and the law.
import std/io
import std/bridge
import std/runtime
tor echo { text: string } -> string
echo -> text
std/runtime:register(scope: "api") {
echo(1)
}
tor do-define { br: *std/bridge:Bridge }
do-define = std/bridge:define(br, source: "tor shout { text: string }\nshout = echo(text)")
| defined d |> std/io:print.ln("defined {{ d:s }}")
| parse-error e |> std/io:print.ln("define failed: {{ e.message:s }}")
tor show-grammar { br: *std/bridge:Bridge }
show-grammar = std/bridge:grammar(br)
| ok g |> std/io:print.ln("{{ g:s }}")
| not-found s |> std/io:print.ln("NO SCOPE {{ s:s }}")
[with]std/bridge:create(id: "gram", scope: "api"): br
|> do-define(br)
|> show-grammar(br)
|> std/io:print.ln("--- done")
Actual
defined shout
A wire turn is one flow: verb(field: value, field: value) with `|` arms chaining what each call issues.
- An arm binds what a call issued to a name for the next call: `| ok u |>` for an ordinary result, `| chosen c |>` for a named branch — the arm word is the branch name the verb's line in the vocabulary declares; a `| ?` outcome may go unarmed, every other named outcome must be armed or the turn stops with `unhandled-branch`.
- The verb is a bare name from your vocabulary — letters, digits, '-', '_' — immediately followed by '('.
- A value is a double-quoted string (escape \" and \\ inside) or a bare literal: a number, true/false, or a name a `|` arm already bound.
- A field typed `Expression` takes expression text bare (`calc(expr: 2 + 3)`); a field typed `Source` takes prose bare (`note(text: thinking this through)`) — and a verb whose only field is Source also answers to `verb: prose`.
- A field typed `name<x>` takes only a bound name the session minted `<x!>` — an `rN` from an earlier verb or an arm binding, never literal text. `name<!x>` spends it.
- A bound name keeps its fields: `r3.user_id` reads that field out of the value r3 bound — the whole result stays readable in the session, not just its name.
- A second invocation starts a second item: one invocation per line runs each in order with one line of report per step.
- Prose is not wire — it binds as residue: "residue bound: rN — your reply was not wire; nothing reached the user" keeps YOUR reply at rN; nothing hears it until a verb takes it as an argument.
- Chain fresh outcomes with arms — a `| branch name |>` arm binds `name` to what the call just issued. Never invent one, never predict one: bind it.
Your vocabulary:
echo(text: string)
shout(text: string)
--- done
Expected output
defined shout
A wire turn is one flow: verb(field: value, field: value) with `|` arms chaining what each call issues.
- An arm binds what a call issued to a name for the next call: `| ok u |>` for an ordinary result, `| chosen c |>` for a named branch — the arm word is the branch name the verb's line in the vocabulary declares; a `| ?` outcome may go unarmed, every other named outcome must be armed or the turn stops with `unhandled-branch`.
- The verb is a bare name from your vocabulary — letters, digits, '-', '_' — immediately followed by '('.
- A value is a double-quoted string (escape \" and \\ inside) or a bare literal: a number, true/false, or a name a `|` arm already bound.
- A field typed `Expression` takes expression text bare (`calc(expr: 2 + 3)`); a field typed `Source` takes prose bare (`note(text: thinking this through)`) — and a verb whose only field is Source also answers to `verb: prose`.
- A field typed `name<x>` takes only a bound name the session minted `<x!>` — an `rN` from an earlier verb or an arm binding, never literal text. `name<!x>` spends it.
- A bound name keeps its fields: `r3.user_id` reads that field out of the value r3 bound — the whole result stays readable in the session, not just its name.
- A second invocation starts a second item: one invocation per line runs each in order with one line of report per step.
- Prose is not wire — it binds as residue: "residue bound: rN — your reply was not wire; nothing reached the user" keeps YOUR reply at rN; nothing hears it until a verb takes it as an argument.
- Chain fresh outcomes with arms — a `| branch name |>` arm binds `name` to what the call just issued. Never invent one, never predict one: bind it.
Your vocabulary:
echo(text: string)
shout(text: string)
--- done
Flows
flow ~register click a branch to expand · @labels scroll to their anchor
register (scope: "api", source: echo(1))
subflow ~do-define click a branch to expand · @labels scroll to their anchor
define (br, source: "tor shout { text: string }\nshout = echo(text)")
subflow ~show-grammar click a branch to expand · @labels scroll to their anchor
grammar (br)
flow ~create click a branch to expand · @labels scroll to their anchor
create (id: "gram", scope: "api")
Test Configuration
MUST_RUN