✓
Passing This code compiles and runs correctly.
Code
// TEST: `note` is the observer channel — a host verb, not vocabulary.
//
// Granted by `create(introspection: true)` alongside vocabulary/grammar/
// bind. The result is a bare `ok` acknowledgment: the note's text is already
// durable in the turn's wire source, and echoing it as the result would
// re-feed the model its own prose every report. It never becomes a `say` —
// the scope dispatcher never sees it. A `note` with no `text:` field fails
// with teaching. A `note(...)` glued to a same-line call
// (`note(...)say(...)`) splits at the call: the note binds as residue, the
// tail still runs. In an ungranted session `note` is event-denied, the same
// answer any unknown word gets — the observer channel exists only where the
// session was built to be observed.
import std/io
import std/bridge
import std/runtime
import std/interpreter
tor echo { text: string } -> string
proc echo|zig {
return text;
}
std/runtime:register(scope: "echo") {
echo(1)
}
tor noted { br: *std/bridge:Bridge<session> }
noted = std/bridge:run(br, source: "note(text: \"checking tier before touching the reservation\")")
| result r |> std/interpreter:value.stringify(r.value): j |> std/io:print.ln(" note -> {{ j:s }} bound: {{ r.bound:s }}")
| error runerr |> std/bridge:error-decode(e: runerr)
| event-denied ev |> std/io:print.ln(" FAIL note DENIED {{ ev:s }}")
| dispatch-error e |> std/io:print.ln(" FAIL note DISPATCH {{ e.message:s }}")
| parse-error e |> std/io:print.ln(" FAIL note PARSE {{ e.message:s }}")
| exhausted _ |> std/io:print.ln(" FAIL note EXHAUSTED")
| validation-error e |> std/io:print.ln(" FAIL note VALIDATION {{ e:s }}")
| shape-error _ |> std/io:print.ln(" FAIL note SHAPE")
| scope-not-found _ |> std/io:print.ln(" FAIL note NO SCOPE")
| residue _ |> std/io:print.ln("FAIL: residue outcome")
| unhandled-branch u |> std/io:print.ln(" FAIL note UNHANDLED {{ u.branch:s }}")
| defined _ |> std/io:print.ln(" FAIL note DEFINED")
| partial _ |> std/io:print.ln(" FAIL note PARTIAL")
tor note-chain { br: *std/bridge:Bridge<session> }
note-chain = std/bridge:run(br, source: "note(text: \"plan: greet, then book\")\n| ok n |> echo(text: n)")
| result r |> std/interpreter:value.stringify(r.value): j |> std/io:print.ln(" chain -> {{ j:s }}\n{{ r.trace:s }}")
| error runerr |> std/bridge:error-decode(e: runerr)
| event-denied ev |> std/io:print.ln(" FAIL chain DENIED {{ ev:s }}")
| dispatch-error e |> std/io:print.ln(" FAIL chain DISPATCH {{ e.message:s }}")
| parse-error e |> std/io:print.ln(" FAIL chain PARSE {{ e.message:s }}")
| exhausted _ |> std/io:print.ln(" FAIL chain EXHAUSTED")
| validation-error e |> std/io:print.ln(" FAIL chain VALIDATION {{ e:s }}")
| shape-error _ |> std/io:print.ln(" FAIL chain SHAPE")
| scope-not-found _ |> std/io:print.ln(" FAIL chain NO SCOPE")
| residue _ |> std/io:print.ln("FAIL: residue outcome")
| unhandled-branch u |> std/io:print.ln(" FAIL chain UNHANDLED {{ u.branch:s }}")
| defined _ |> std/io:print.ln(" FAIL chain DEFINED")
| partial _ |> std/io:print.ln(" FAIL chain PARTIAL")
tor note-no-arg { br: *std/bridge:Bridge<session> }
note-no-arg = std/bridge:run(br, source: "note()")
| result r |> std/io:print.ln(" FAIL noarg RESULT {{ r.value.branch:s }}")
| error runerr |> std/bridge:error-decode(e: runerr)
| event-denied ev |> std/io:print.ln(" FAIL noarg DENIED {{ ev:s }}")
| dispatch-error e |> std/io:print.ln(" noarg dispatch-error: {{ e.message:s }}")
| parse-error e |> std/io:print.ln(" FAIL noarg PARSE {{ e.message:s }}")
| exhausted _ |> std/io:print.ln(" FAIL noarg EXHAUSTED")
| validation-error e |> std/io:print.ln(" FAIL noarg VALIDATION {{ e:s }}")
| shape-error _ |> std/io:print.ln(" FAIL noarg SHAPE")
| scope-not-found _ |> std/io:print.ln(" FAIL noarg NO SCOPE")
| residue _ |> std/io:print.ln("FAIL: residue outcome")
| unhandled-branch u |> std/io:print.ln(" FAIL noarg UNHANDLED {{ u.branch:s }}")
| defined _ |> std/io:print.ln(" FAIL noarg DEFINED")
| partial _ |> std/io:print.ln(" FAIL noarg PARTIAL")
tor note-rname { br: *std/bridge:Bridge<session> }
note-rname = std/bridge:run(br, source: "note(text: r1)")
| result r |> std/interpreter:value.stringify(r.value): j |> std/io:print.ln(" note-rN -> {{ j:s }}")
| error runerr |> std/bridge:error-decode(e: runerr)
| event-denied ev |> std/io:print.ln(" FAIL note-rN DENIED {{ ev:s }}")
| dispatch-error e |> std/io:print.ln(" FAIL note-rN DISPATCH {{ e.message:s }}")
| parse-error e |> std/io:print.ln(" FAIL note-rN PARSE {{ e.message:s }}")
| exhausted _ |> std/io:print.ln(" FAIL note-rN EXHAUSTED")
| validation-error e |> std/io:print.ln(" FAIL note-rN VALIDATION {{ e:s }}")
| shape-error _ |> std/io:print.ln(" FAIL note-rN SHAPE")
| scope-not-found _ |> std/io:print.ln(" FAIL note-rN NO SCOPE")
| residue _ |> std/io:print.ln("FAIL: residue outcome")
| unhandled-branch u |> std/io:print.ln(" FAIL note-rN UNHANDLED {{ u.branch:s }}")
| defined _ |> std/io:print.ln(" FAIL note-rN DEFINED")
| partial _ |> std/io:print.ln(" FAIL note-rN PARTIAL")
tor note-tail { br: *std/bridge:Bridge<session> }
note-tail = std/bridge:run(br, source: "note(text: bare prose, the natural spelling)echo(text: \"reached\")")
| result r |> std/io:print.ln(" FAIL tail RESULT {{ r.value.branch:s }}")
| error runerr |> std/bridge:error-decode(e: runerr)
| event-denied ev |> std/io:print.ln(" FAIL tail DENIED {{ ev:s }}")
| dispatch-error e |> std/io:print.ln(" FAIL tail DISPATCH {{ e.message:s }}")
| parse-error e |> std/io:print.ln(" FAIL tail PARSE {{ e.message:s }}")
| exhausted _ |> std/io:print.ln(" FAIL tail EXHAUSTED")
| validation-error e |> std/io:print.ln(" FAIL tail VALIDATION {{ e:s }}")
| shape-error _ |> std/io:print.ln(" FAIL tail SHAPE")
| scope-not-found _ |> std/io:print.ln(" FAIL tail NO SCOPE")
| residue _ |> std/io:print.ln(" FAIL tail RESIDUE (tail swallowed)")
| unhandled-branch u |> std/io:print.ln(" FAIL tail UNHANDLED {{ u.branch:s }}")
| defined _ |> std/io:print.ln(" FAIL tail DEFINED")
| partial p |> std/io:print.ln(" tail partial wire_failures={{ p.wire_failures:d }}\n{{ p.report:s }}")
tor denied-note { br: *std/bridge:Bridge<session> }
denied-note = std/bridge:run(br, source: "note(text: \"can you hear me\")")
| result r |> std/io:print.ln(" FAIL denied RESULT {{ r.value.branch:s }}")
| error runerr |> std/bridge:error-decode(e: runerr)
| event-denied ev |> std/io:print.ln(" denied: event-denied {{ ev:s }}")
| dispatch-error e |> std/io:print.ln(" FAIL denied DISPATCH {{ e.message:s }}")
| parse-error e |> std/io:print.ln(" FAIL denied PARSE {{ e.message:s }}")
| exhausted _ |> std/io:print.ln(" FAIL denied EXHAUSTED")
| validation-error e |> std/io:print.ln(" FAIL denied VALIDATION {{ e:s }}")
| shape-error _ |> std/io:print.ln(" FAIL denied SHAPE")
| scope-not-found _ |> std/io:print.ln(" FAIL denied NO SCOPE")
| residue _ |> std/io:print.ln("FAIL: residue outcome")
| unhandled-branch u |> std/io:print.ln(" FAIL denied UNHANDLED {{ u.branch:s }}")
| defined _ |> std/io:print.ln(" FAIL denied DEFINED")
| partial _ |> std/io:print.ln(" FAIL denied PARTIAL")
[with]std/bridge:create(id: "s1", scope: "echo", introspection: true): br
|> std/io:print.ln("--- granted session")
|> noted(br)
|> note-chain(br)
|> note-no-arg(br)
|> note-rname(br)
|> note-tail(br)
|> std/io:print.ln("--- ungranted session")
|> std/bridge:create(id: "s2", scope: "echo"): br2
|> denied-note(br: br2)
|> std/io:print.ln("--- done")
Supporting Files
error[KORU047]: CS emission failed: UnsupportedConstruct
~proc echo|cs {
return text;
}Actual · Zig
✓ pass--- granted session
note -> {"branch":"","value":"ok"} bound: r1
chain -> {"branch":"","value":"ok"}
note -> {"branch":"","value":"ok"} bound: r2 as n
echo -> {"branch":"","value":"ok"} bound: r3
noarg dispatch-error: 'note' needs a `text:` field — note(text: "what you're thinking")
note-rN -> {"branch":"","value":"ok"}
tail partial wire_failures=0
step 1/2 residue bound: r5 — your note did not parse as wire, but the observer kept it. Well-formed: note(text: "..."); to reach the user, say(text: "...")
step 2/2 result: {"branch":"","value":"reached"} bound: r6
--- ungranted session
denied: event-denied note
--- done
Actual · JavaScript
✗ error[KORU047]Actual · C#
✗ error[KORU047]: CS emission failed: UnsupportedConstructExpected output
✓ Zig✗ JavaScript✗ C#--- granted session
note -> {"branch":"","value":"ok"} bound: r1
chain -> {"branch":"","value":"ok"}
note -> {"branch":"","value":"ok"} bound: r2 as n
echo -> {"branch":"","value":"ok"} bound: r3
noarg dispatch-error: 'note' needs a `text:` field — note(text: "what you're thinking")
note-rN -> {"branch":"","value":"ok"}
tail partial wire_failures=0
step 1/2 residue bound: r5 — your note did not parse as wire, but the observer kept it. Well-formed: note(text: "..."); to reach the user, say(text: "...")
step 2/2 result: {"branch":"","value":"reached"} bound: r6
--- ungranted session
denied: event-denied note
--- done
Emitted Zig source
// Access compiler flags via the per-user compiler_env module
const CompilerEnv = @import("compiler_env").CompilerEnv;
pub const panic = if (@import("builtin").mode == .Debug)
@import("std").debug.FullPanic(@import("std").debug.defaultPanic)
else
@import("std").debug.simple_panic;
const __koru_bare = struct {
extern fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: usize) c_int;
extern fn free(ptr: ?*anyopaque) void;
fn bareAlloc(_: *anyopaque, len: usize, alignment: @import("std").mem.Alignment, _: usize) ?[*]u8 {
var p: ?*anyopaque = null;
const a = @max(alignment.toByteUnits(), @sizeOf(usize));
if (posix_memalign(&p, a, len) != 0) return null;
return @ptrCast(p);
}
fn bareResize(_: *anyopaque, _: []u8, _: @import("std").mem.Alignment, _: usize, _: usize) bool { return false; }
fn bareRemap(_: *anyopaque, _: []u8, _: @import("std").mem.Alignment, _: usize, _: usize) ?[*]u8 { return null; }
fn bareFree(_: *anyopaque, memory: []u8, _: @import("std").mem.Alignment, _: usize) void { free(@ptrCast(memory.ptr)); }
const vtable = @import("std").mem.Allocator.VTable{ .alloc = bareAlloc, .resize = bareResize, .remap = bareRemap, .free = bareFree };
const allocator = @import("std").mem.Allocator{ .ptr = undefined, .vtable = &vtable };
};
const __koru_backing = if (@import("builtin").link_libc) @import("std").heap.c_allocator else if (@import("builtin").os.tag == .freestanding and !@import("builtin").cpu.arch.isWasm()) __koru_bare.allocator else @import("std").heap.page_allocator;
const __koru_leak_mode = false;
var __koru_gpa: @import("std").heap.DebugAllocator(.{ .stack_trace_frames = 16 }) = .init;
fn __koruBacking() @import("std").mem.Allocator {
if (comptime __koru_leak_mode) return __koru_gpa.allocator();
return __koru_backing;
}
var __koru_leak_watch_started: @import("std").atomic.Value(bool) = .init(false);
fn __koru_leak_watch_maybe_start() void {
if (comptime !__koru_leak_mode) return;
if (__koru_leak_watch_started.swap(true, .acq_rel)) return;
_ = @import("std").Thread.spawn(.{}, __koru_leak_watch, .{}) catch {};
}
fn __koru_leak_watch() void {
var tick: usize = 0;
while (true) : (tick += 1) {
@import("std").Thread.sleep(5 * @import("std").time.ns_per_s);
@import("std").debug.print("[koru-leak] outstanding allocs: {}\n", .{__koru_leak_count.load(.acquire)});
if (tick % 12 == 11) {
@import("std").debug.print("[koru-leak] GPA scan — sites still holding allocs:\n", .{});
_ = __koru_gpa.detectLeaks();
}
}
}
var __koru_leak_count: @import("std").atomic.Value(usize) = .init(0);
var __koru_par_tasks: @import("std").atomic.Value(usize) = .init(0);
const __koru_par_CAP: usize = 128;
threadlocal var __koru_par_depth: usize = 0;
const __koru_par_DEPTH_CAP: usize = 7;
var __koru_par_pool: @import("std").Thread.Pool = undefined;
var __koru_par_pool_ready: bool = false;
var __koru_par_pool_mtx: @import("std").Thread.Mutex = .{};
fn __koru_par_pool_ensure() *@import("std").Thread.Pool {
__koru_par_pool_mtx.lock();
defer __koru_par_pool_mtx.unlock();
if (!__koru_par_pool_ready) {
@import("std").Thread.Pool.init(&__koru_par_pool, .{ .allocator = @import("std").heap.smp_allocator }) catch @panic("koru: thread pool init failed");
__koru_par_pool_ready = true;
}
return &__koru_par_pool;
}
fn __koru_alloc(ctx: *anyopaque, len: usize, alignment: @import("std").mem.Alignment, ret_addr: usize) ?[*]u8 {
_ = ctx;
__koru_leak_watch_maybe_start();
const r = __koruBacking().rawAlloc(len, alignment, ret_addr);
if (comptime @import("builtin").mode == .Debug or __koru_leak_mode) {
if (r != null) _ = __koru_leak_count.fetchAdd(1, .monotonic);
}
return r;
}
fn __koru_resize(ctx: *anyopaque, memory: []u8, alignment: @import("std").mem.Alignment, new_len: usize, ret_addr: usize) bool {
_ = ctx;
return __koruBacking().rawResize(memory, alignment, new_len, ret_addr);
}
fn __koru_remap(ctx: *anyopaque, memory: []u8, alignment: @import("std").mem.Alignment, new_len: usize, ret_addr: usize) ?[*]u8 {
_ = ctx;
return __koruBacking().rawRemap(memory, alignment, new_len, ret_addr);
}
fn __koru_free(ctx: *anyopaque, memory: []u8, alignment: @import("std").mem.Alignment, ret_addr: usize) void {
_ = ctx;
__koruBacking().rawFree(memory, alignment, ret_addr);
if (comptime @import("builtin").mode == .Debug or __koru_leak_mode) {
_ = __koru_leak_count.fetchSub(1, .monotonic);
}
}
const __koru_vtable = @import("std").mem.Allocator.VTable{ .alloc = __koru_alloc, .resize = __koru_resize, .remap = __koru_remap, .free = __koru_free };
pub fn koru_allocator() @import("std").mem.Allocator {
return .{ .ptr = undefined, .vtable = &__koru_vtable };
}
pub inline fn __koru_intcast(comptime T: type, x: anytype) T {
if (comptime (@import("builtin").mode == .Debug or @import("builtin").mode == .ReleaseSafe))
return @as(T, @intCast(x));
const dst = @typeInfo(T);
const src = @typeInfo(@TypeOf(x));
if (comptime (dst == .int and src == .int and dst.int.bits == src.int.bits and dst.int.signedness != src.int.signedness))
return @as(T, @bitCast(x));
return @as(T, @intCast(x));
}
fn __KoruPadI(comptime T: type) type {
const V = switch (@typeInfo(T)) { .comptime_int => i64, .comptime_float => f64, else => T };
return struct {
v: V,
width: usize,
pub fn format(self: @This(), w: *@import("std").Io.Writer) @import("std").Io.Writer.Error!void {
const rendered = @import("std").fmt.count("{d}", .{self.v});
const pad = self.width -| rendered;
for (0..pad) |_| try w.writeByte(' ');
try w.print("{d}", .{self.v});
}
};
}
pub fn __koru_pad_i(width: usize, value: anytype) __KoruPadI(@TypeOf(value)) {
return .{ .v = value, .width = width };
}
pub fn koru_leak_check() void {
if (comptime @import("builtin").mode != .Debug) return;
if (__koru_leak_count.load(.acquire) == 0) return;
if (comptime @import("builtin").target.os.tag == .freestanding) {
if (comptime @import("builtin").cpu.arch == .wasm32 or @import("builtin").cpu.arch == .wasm64) {
@panic("KORU LEAK CHECK FAILED: the produced program leaked");
} else {
const __klc = struct { extern var stdout: ?*anyopaque; extern fn fputs(__s: [*:0]const u8, __st: ?*anyopaque) c_int; };
var __lb: [128]u8 = undefined;
const __lm = "KORU LEAK CHECK FAILED: allocations still outstanding at end of run: ";
@memcpy(__lb[0..__lm.len], __lm);
var __ln: usize = __lm.len;
var __lv = __koru_leak_count.load(.acquire);
var __ld: [20]u8 = undefined;
var __lk: usize = 0;
while (__lv > 0) : (__lk += 1) { __ld[__lk] = @intCast('0' + __lv % 10); __lv /= 10; }
for (0..__lk) |__li| { __lb[__ln] = __ld[__lk - 1 - __li]; __ln += 1; }
__lb[__ln] = '\n'; __ln += 1; __lb[__ln] = 0;
_ = __klc.fputs(@as([*:0]const u8, @ptrCast(&__lb)), __klc.stdout);
@trap();
}
} else {
@import("std").debug.print("KORU LEAK CHECK FAILED: the produced program leaked (trace above)\n", .{});
@import("std").process.exit(1);
}
}
pub const main_module = struct {
pub const echo_event = struct {
pub const Input = struct {
text: []const u8,
};
pub const Output = []const u8;
pub fn handler(__koru_event_input: @This().Input) @This().Output {
// >>> PROC: echo [tests/regression/400_RUNTIME_FEATURES/440_RESOURCE_BRIDGE/440_037_note_is_the_observer_channel/input.k:21]
const text = __koru_event_input.text;
_ = &text;
_ = &__koru_event_input;
return text;
}
};
// __KORU_RUNTIME_REGISTRY_HELPERS__
const __koru_dispatcher_std = @import("std");
const __koru_dispatcher_ast = @import("ast");
pub const Path = __koru_dispatcher_ast.DottedPath;
pub const Arg = __koru_dispatcher_ast.Arg;
pub const Invocation = __koru_dispatcher_ast.Invocation;
pub const DispatchResult = koru_std.koru_runtime.DispatchResult;
const __koru_ScopeEvent = koru_std.koru_runtime.ScopeEvent;
const __koru_ScopeDescriptor = koru_std.koru_runtime.ScopeDescriptor;
const __koru_ScopeManifest = koru_std.koru_runtime.ScopeManifest;
const __koru_ManifestEvent = koru_std.koru_runtime.ManifestEvent;
const __koru_ManifestArg = koru_std.koru_runtime.ManifestArg;
const __koru_ManifestCreate = koru_std.koru_runtime.ManifestCreate;
const __koru_ManifestDischarge = koru_std.koru_runtime.ManifestDischarge;
const __koru_ManifestBranch = koru_std.koru_runtime.ManifestBranch;
const __koru_ManifestBranchField = koru_std.koru_runtime.ManifestBranchField;
const __koru_FieldValue = koru_std.koru_runtime.FieldValue;
const __koru_NamedField = koru_std.koru_runtime.NamedField;
fn __koru_getArg(__koru_args: []const __koru_dispatcher_ast.Arg, __koru_n: []const u8) ?[]const u8 {
for (__koru_args) |__koru_arg| {
if (__koru_dispatcher_std.mem.eql(u8, __koru_arg.name, __koru_n)) {
var __koru_v = __koru_arg.value;
if (__koru_v.len >= 2 and __koru_v[0] == '"' and __koru_v[__koru_v.len-1] == '"') __koru_v = __koru_v[1..__koru_v.len-1];
return __koru_v;
}
}
return null;
}
fn __koru_buildInput(comptime __koru_T: type, __koru_args: []const __koru_dispatcher_ast.Arg) !__koru_T {
var __koru_input: __koru_T = undefined;
inline for (__koru_dispatcher_std.meta.fields(__koru_T)) |__koru_field| {
const __koru_raw = __koru_getArg(__koru_args, __koru_field.name) orelse "";
const __koru_F = __koru_field.type;
if (__koru_F == bool) {
@field(__koru_input, __koru_field.name) = __koru_dispatcher_std.mem.eql(u8, __koru_raw, "true") or __koru_dispatcher_std.mem.eql(u8, __koru_raw, "1");
} else switch (@typeInfo(__koru_F)) {
.int => {
@field(__koru_input, __koru_field.name) = __koru_dispatcher_std.fmt.parseInt(__koru_F, __koru_raw, 10) catch {
koru_std.koru_interpreter.setDispatchDetail(__koru_dispatcher_std.fmt.allocPrint(__koru_dispatcher_std.heap.page_allocator, "field '{s}' expected " ++ @typeName(__koru_F) ++ ", got '{s}'", .{ __koru_field.name, __koru_raw }) catch @panic("dispatch: OOM"));
return error.InvalidArgument;
};
},
.float => {
@field(__koru_input, __koru_field.name) = __koru_dispatcher_std.fmt.parseFloat(__koru_F, __koru_raw) catch {
koru_std.koru_interpreter.setDispatchDetail(__koru_dispatcher_std.fmt.allocPrint(__koru_dispatcher_std.heap.page_allocator, "field '{s}' expected " ++ @typeName(__koru_F) ++ ", got '{s}'", .{ __koru_field.name, __koru_raw }) catch @panic("dispatch: OOM"));
return error.InvalidArgument;
};
},
.pointer => |__koru_ptr_info| {
if (__koru_ptr_info.size == .slice and __koru_ptr_info.child == u8) {
@field(__koru_input, __koru_field.name) = __koru_raw;
} else {
@field(__koru_input, __koru_field.name) = koru_std.koru_interpreter.resolveDispatchResource(__koru_F, __koru_raw) orelse {
koru_std.koru_interpreter.setDispatchDetail(__koru_dispatcher_std.fmt.allocPrint(__koru_dispatcher_std.heap.page_allocator, "field '{s}' names a resource token this pool does not hold — got '{s}'", .{ __koru_field.name, __koru_raw }) catch @panic("dispatch: OOM"));
return error.InvalidArgument;
};
}
},
else => {
@field(__koru_input, __koru_field.name) = __koru_dispatcher_std.mem.zeroes(__koru_F);
},
}
}
return __koru_input;
}
fn __koru_own(comptime __koru_T: type, __koru_s: []const __koru_T) []const __koru_T {
const __koru_a = __koru_dispatcher_std.heap.page_allocator;
if (__koru_T == u8) return __koru_a.dupe(u8, __koru_s) catch @panic("dispatch: OOM owning result");
const __koru_out = __koru_a.alloc(__koru_T, __koru_s.len) catch @panic("dispatch: OOM owning result");
for (__koru_s, 0..) |__koru_e, __koru_i| __koru_out[__koru_i] = __koru_a.dupe(u8, __koru_e) catch @panic("dispatch: OOM owning result");
return __koru_out;
}
fn dispatch_echo_echo(__koru_inv: *const __koru_dispatcher_ast.Invocation, __koru_out: *koru_std.koru_runtime.DispatchResult) !void {
const __koru_Input = main_module.echo_event.Input;
const __koru_Handler = main_module.echo_event;
const __koru_ReturnType = @typeInfo(@TypeOf(__koru_Handler.handler)).@"fn".return_type.?;
if (__koru_ReturnType == void) {
// Void event - just call and return empty __koru_branch
__koru_Handler.handler(try __koru_buildInput(__koru_Input, __koru_inv.args));
__koru_out.* = .{ .branch = "", .fields = &.{} };
return;
}
if (@typeInfo(__koru_ReturnType) != .@"union") {
// Single-return tor (`-> __koru_T`): the value BINDS, it does not select a
// __koru_branch. Reported as the empty __koru_branch with the value on __type_ref,
// the same channel identity branches use for bare payloads.
const __koru_v = __koru_Handler.handler(try __koru_buildInput(__koru_Input, __koru_inv.args));
const __koru_V = @TypeOf(__koru_v);
const __koru_SR = struct { threadlocal var buf: [1]__koru_NamedField = undefined; };
var __koru_n: usize = 0;
if (__koru_V == bool) {
__koru_SR.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .bool_val = __koru_v } };
__koru_n = 1;
} else if (@typeInfo(__koru_V) == .int) {
__koru_SR.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .int_val = @as(i64, @intCast(__koru_v)) } };
__koru_n = 1;
} else if (@typeInfo(__koru_V) == .float) {
__koru_SR.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .float_val = @as(f64, @floatCast(__koru_v)) } };
__koru_n = 1;
} else if (@typeInfo(__koru_V) == .pointer) {
const __koru_ptr_info = @typeInfo(__koru_V).pointer;
if (__koru_ptr_info.size == .slice and __koru_ptr_info.child == u8) {
__koru_SR.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .string_val = __koru_own(u8, __koru_v) } };
__koru_n = 1;
} else if (__koru_ptr_info.size == .slice and __koru_ptr_info.child == []const u8) {
__koru_SR.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .string_array = __koru_own([]const u8, __koru_v) } };
__koru_n = 1;
} else {
__koru_SR.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .string_val = koru_std.koru_interpreter.registerDispatchResource(@typeName(__koru_ptr_info.child), __koru_v) } };
__koru_n = 1;
}
}
__koru_out.* = .{ .branch = "", .fields = __koru_SR.buf[0..__koru_n] };
return;
}
// Branched event - extract __koru_branch and fields
const __koru_r = __koru_Handler.handler(try __koru_buildInput(__koru_Input, __koru_inv.args));
const __koru_S = struct { threadlocal var buf: [16]__koru_NamedField = undefined; };
const __koru_branch = @tagName(__koru_r);
const __koru_field_count = switch (__koru_r) { inline else => |__koru_p| blk: {
const __koru_P = @TypeOf(__koru_p);
// Identity branches have bare types, not structs
if (@typeInfo(__koru_P) != .@"struct") {
// Identity __koru_branch - create synthetic __type_ref __koru_field
if (__koru_P == bool) {
__koru_S.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .bool_val = __koru_p } };
} else if (@typeInfo(__koru_P) == .int) {
__koru_S.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .int_val = @as(i64, @intCast(__koru_p)) } };
} else if (@typeInfo(__koru_P) == .float) {
__koru_S.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .float_val = @as(f64, @floatCast(__koru_p)) } };
} else if (@typeInfo(__koru_P) == .pointer) {
const __koru_ptr_info = @typeInfo(__koru_P).pointer;
if (__koru_ptr_info.size == .slice and __koru_ptr_info.child == u8) {
__koru_S.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .string_val = __koru_own(u8, __koru_p) } };
} else if (__koru_ptr_info.size == .slice and __koru_ptr_info.child == []const u8) {
__koru_S.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .string_array = __koru_own([]const u8, __koru_p) } };
} else {
__koru_S.buf[0] = .{ .name = "__type_ref", .value = __koru_FieldValue{ .string_val = koru_std.koru_interpreter.registerDispatchResource(@typeName(__koru_ptr_info.child), __koru_p) } };
}
} else {
break :blk @as(usize, 0);
}
break :blk @as(usize, 1);
}
// Compound __koru_branch - iterate over struct fields
const __koru_payload_fields = __koru_dispatcher_std.meta.fields(__koru_P);
comptime var __koru_count: usize = 0;
inline for (__koru_payload_fields) |__koru_field| {
const __koru_T = __koru_field.type;
if (__koru_T == bool) {
__koru_S.buf[__koru_count] = .{ .name = __koru_field.name, .value = __koru_FieldValue{ .bool_val = @field(__koru_p, __koru_field.name) } };
__koru_count += 1;
} else switch (@typeInfo(__koru_T)) {
.int => {
__koru_S.buf[__koru_count] = .{ .name = __koru_field.name, .value = __koru_FieldValue{ .int_val = @as(i64, @intCast(@field(__koru_p, __koru_field.name))) } };
__koru_count += 1;
},
.float => {
__koru_S.buf[__koru_count] = .{ .name = __koru_field.name, .value = __koru_FieldValue{ .float_val = @as(f64, @floatCast(@field(__koru_p, __koru_field.name))) } };
__koru_count += 1;
},
.pointer => |__koru_ptr_info| {
if (__koru_ptr_info.size == .slice and __koru_ptr_info.child == u8) {
__koru_S.buf[__koru_count] = .{ .name = __koru_field.name, .value = __koru_FieldValue{ .string_val = __koru_own(u8, @field(__koru_p, __koru_field.name)) } };
__koru_count += 1;
} else if (__koru_ptr_info.size == .slice and __koru_ptr_info.child == []const u8) {
__koru_S.buf[__koru_count] = .{ .name = __koru_field.name, .value = __koru_FieldValue{ .string_array = __koru_own([]const u8, @field(__koru_p, __koru_field.name)) } };
__koru_count += 1;
} else if (__koru_ptr_info.size == .one) {
... [truncated - 585KB total]Emitted C# source
static class main_module {
public static void __koru_stdout_write(dynamic s) => global::System.Console.Out.Write(s);
public static void __koru_stderr_write(dynamic s) => global::System.Console.Error.Write(s);
// The mutable handle carrier — `*String`-style resources are
// `new __KoruBox { data = … }` because C# anonymous types are
// read-only: `s.data = …` (std/string append/clear, handle
// mutation generally) needs a settable member.
public class __KoruBox { public dynamic data; }
// Textification for `{{ … }}` operands: C# bool ToStrings as
// `True` where Koru prints `true`, and the operand's static type
// is unknown at this boundary — a `(x) is bool` inline test would
// be a compile error on statically-typed operands instead. Generic
// on purpose: `dynamic` boxed every value-type operand — measured
// ~1s/10M elements on 012_threat_scanner — while T specializes to
// the operand's own ToString() with no box.
public static string __koru_str<T>(T v) => v is bool b ? (b ? "true" : "false") : v?.ToString();
public static class echo_event {
public struct Input {
public string text;
}
public static string handler(Input __koru_input) {
var text = __koru_input.text;
return text;
return default;
}
}
public static class noted_event {
public struct Input {
public dynamic br;
}
public static dynamic handler(Input __koru_input) {
var br = __koru_input.br;
var result_0 = main_module.std_bridge_run_event.handler(new std_bridge_run_event.Input { br = br, source = (string)("note(text: \"checking tier before touching the reservation\")")});
if (result_0.tag == "result") {
var r = result_0.result;
var j = main_module.std_interpreter_value_stringify_event.handler(new std_interpreter_value_stringify_event.Input { value = r.value});
__koru_stdout_write(" note -> " + __koru_str(j) + " bound: " + __koru_str(r.bound) + "\n");
{
var __koru_p_content = (string)(j);
// The host owns memory — a Koru string is a managed C# string and the
// GC settles the `allocated!` debt. Empty by construction.
}
}
if (result_0.tag == "event-denied") {
var ev = result_0.event_denied;
__koru_stdout_write(" FAIL note DENIED " + __koru_str(ev) + "\n");
}
if (result_0.tag == "dispatch-error") {
var e = result_0.dispatch_error;
__koru_stdout_write(" FAIL note DISPATCH " + __koru_str(e.message) + "\n");
}
if (result_0.tag == "residue") {
var _auto_8 = result_0.residue;
__koru_stdout_write("FAIL: residue outcome" + "\n");
}
if (result_0.tag == "parse-error") {
var e = result_0.parse_error;
__koru_stdout_write(" FAIL note PARSE " + __koru_str(e.message) + "\n");
}
if (result_0.tag == "unhandled-branch") {
var u = result_0.unhandled_branch;
__koru_stdout_write(" FAIL note UNHANDLED " + __koru_str(u.branch) + "\n");
}
if (result_0.tag == "defined") {
var _auto_9 = result_0.defined;
__koru_stdout_write(" FAIL note DEFINED" + "\n");
}
if (result_0.tag == "exhausted") {
var _auto_10 = result_0.exhausted;
__koru_stdout_write(" FAIL note EXHAUSTED" + "\n");
}
if (result_0.tag == "validation-error") {
var e = result_0.validation_error;
__koru_stdout_write(" FAIL note VALIDATION " + __koru_str(e) + "\n");
}
if (result_0.tag == "shape-error") {
var _auto_11 = result_0.shape_error;
__koru_stdout_write(" FAIL note SHAPE" + "\n");
}
if (result_0.tag == "scope-not-found") {
var _auto_12 = result_0.scope_not_found;
__koru_stdout_write(" FAIL note NO SCOPE" + "\n");
}
if (result_0.tag == "partial") {
var _auto_13 = result_0.partial;
__koru_stdout_write(" FAIL note PARTIAL" + "\n");
}
return default;
}
}
public static class note_chain_event {
public struct Input {
public dynamic br;
}
public static dynamic handler(Input __koru_input) {
var br = __koru_input.br;
var result_1 = main_module.std_bridge_run_event.handler(new std_bridge_run_event.Input { br = br, source = (string)("note(text: \"plan: greet, then book\")\n| ok n |> echo(text: n)")});
if (result_1.tag == "result") {
var r = result_1.result;
var j = main_module.std_interpreter_value_stringify_event.handler(new std_interpreter_value_stringify_event.Input { value = r.value});
__koru_stdout_write(" chain -> " + __koru_str(j) + "\n" + __koru_str(r.trace) + "\n");
{
var __koru_p_content = (string)(j);
// The host owns memory — a Koru string is a managed C# string and the
// GC settles the `allocated!` debt. Empty by construction.
}
}
if (result_1.tag == "event-denied") {
var ev = result_1.event_denied;
__koru_stdout_write(" FAIL chain DENIED " + __koru_str(ev) + "\n");
}
if (result_1.tag == "dispatch-error") {
var e = result_1.dispatch_error;
__koru_stdout_write(" FAIL chain DISPATCH " + __koru_str(e.message) + "\n");
}
if (result_1.tag == "residue") {
var _auto_14 = result_1.residue;
__koru_stdout_write("FAIL: residue outcome" + "\n");
}
if (result_1.tag == "parse-error") {
var e = result_1.parse_error;
__koru_stdout_write(" FAIL chain PARSE " + __koru_str(e.message) + "\n");
}
if (result_1.tag == "unhandled-branch") {
var u = result_1.unhandled_branch;
__koru_stdout_write(" FAIL chain UNHANDLED " + __koru_str(u.branch) + "\n");
}
if (result_1.tag == "defined") {
var _auto_15 = result_1.defined;
__koru_stdout_write(" FAIL chain DEFINED" + "\n");
}
if (result_1.tag == "exhausted") {
var _auto_16 = result_1.exhausted;
__koru_stdout_write(" FAIL chain EXHAUSTED" + "\n");
}
if (result_1.tag == "validation-error") {
var e = result_1.validation_error;
__koru_stdout_write(" FAIL chain VALIDATION " + __koru_str(e) + "\n");
}
if (result_1.tag == "shape-error") {
var _auto_17 = result_1.shape_error;
__koru_stdout_write(" FAIL chain SHAPE" + "\n");
}
if (result_1.tag == "scope-not-found") {
var _auto_18 = result_1.scope_not_found;
__koru_stdout_write(" FAIL chain NO SCOPE" + "\n");
}
if (result_1.tag == "partial") {
var _auto_19 = result_1.partial;
__koru_stdout_write(" FAIL chain PARTIAL" + "\n");
}
return default;
}
}
public static class note_no_arg_event {
public struct Input {
public dynamic br;
}
public static dynamic handler(Input __koru_input) {
var br = __koru_input.br;
var result_2 = main_module.std_bridge_run_event.handler(new std_bridge_run_event.Input { br = br, source = (string)("note()")});
if (result_2.tag == "result") {
var r = result_2.result;
__koru_stdout_write(" FAIL noarg RESULT " + __koru_str(r.value.branch) + "\n");
}
if (result_2.tag == "event-denied") {
var ev = result_2.event_denied;
__koru_stdout_write(" FAIL noarg DENIED " + __koru_str(ev) + "\n");
}
if (result_2.tag == "dispatch-error") {
var e = result_2.dispatch_error;
__koru_stdout_write(" noarg dispatch-error: " + __koru_str(e.message) + "\n");
}
if (result_2.tag == "residue") {
var _auto_20 = result_2.residue;
__koru_stdout_write("FAIL: residue outcome" + "\n");
}
if (result_2.tag == "parse-error") {
var e = result_2.parse_error;
__koru_stdout_write(" FAIL noarg PARSE " + __koru_str(e.message) + "\n");
}
if (result_2.tag == "unhandled-branch") {
var u = result_2.unhandled_branch;
__koru_stdout_write(" FAIL noarg UNHANDLED " + __koru_str(u.branch) + "\n");
}
if (result_2.tag == "defined") {
var _auto_21 = result_2.defined;
__koru_stdout_write(" FAIL noarg DEFINED" + "\n");
}
if (result_2.tag == "exhausted") {
var _auto_22 = result_2.exhausted;
__koru_stdout_write(" FAIL noarg EXHAUSTED" + "\n");
}
if (result_2.tag == "validation-error") {
var e = result_2.validation_error;
__koru_stdout_write(" FAIL noarg VALIDATION " + __koru_str(e) + "\n");
}
if (result_2.tag == "shape-error") {
var _auto_23 = result_2.shape_error;
__koru_stdout_write(" FAIL noarg SHAPE" + "\n");
}
if (result_2.tag == "scope-not-found") {
var _auto_24 = result_2.scope_not_found;
__koru_stdout_write(" FAIL noarg NO SCOPE" + "\n");
}
if (result_2.tag == "partial") {
var _auto_25 = result_2.partial;
__koru_stdout_write(" FAIL noarg PARTIAL" + "\n");
}
return default;
}
}
public static class note_rname_event {
public struct Input {
public dynamic br;
}
public static dynamic handler(Input __koru_input) {
var br = __koru_input.br;
var result_3 = main_module.std_bridge_run_event.handler(new std_bridge_run_event.Input { br = br, source = (string)("note(text: r1)")});
if (result_3.tag == "result") {
var r = result_3.result;
var j = main_module.std_interpreter_value_stringify_event.handler(new std_interpreter_value_stringify_event.Input { value = r.value});
__koru_stdout_write(" note-rN -> " + __koru_str(j) + "\n");
{
var __koru_p_content = (string)(j);
// The host owns memory — a Koru string is a managed C# string and the
// GC settles the `allocated!` debt. Empty by construction.
}
}
if (result_3.tag == "event-denied") {
var ev = result_3.event_denied;
__koru_stdout_write(" FAIL note-rN DENIED " + __koru_str(ev) + "\n");
}
if (result_3.tag == "dispatch-error") {
var e = result_3.dispatch_error;
__koru_stdout_write(" FAIL note-rN DISPATCH " + __koru_str(e.message) + "\n");
}
if (result_3.tag == "residue") {
var _auto_26 = result_3.residue;
__koru_stdout_write("FAIL: residue outcome" + "\n");
}
if (result_3.tag == "parse-error") {
var e = result_3.parse_error;
__koru_stdout_write(" FAIL note-rN PARSE " + __koru_str(e.message) + "\n");
}
if (result_3.tag == "unhandled-branch") {
var u = result_3.unhandled_branch;
__koru_stdout_write(" FAIL note-rN UNHANDLED " + __koru_str(u.branch) + "\n");
}
if (result_3.tag == "defined") {
var _auto_27 = result_3.defined;
__koru_stdout_write(" FAIL note-rN DEFINED" + "\n");
}
if (result_3.tag == "exhausted") {
var _auto_28 = result_3.exhausted;
__koru_stdout_write(" FAIL note-rN EXHAUSTED" + "\n");
}
if (result_3.tag == "validation-error") {
var e = result_3.validation_error;
__koru_stdout_write(" FAIL note-rN VALIDATION " + __koru_str(e) + "\n");
}
if (result_3.tag == "shape-error") {
var _auto_29 = result_3.shape_error;
__koru_stdout_write(" FAIL note-rN SHAPE" + "\n");
}
if (result_3.tag == "scope-not-found") {
var _auto_30 = result_3.scope_not_found;
__koru_stdout_write(" FAIL note-rN NO SCOPE" + "\n");
}
if (result_3.tag == "partial") {
var _auto_31 = result_3.partial;
__koru_stdout_write(" FAIL note-rN PARTIAL" + "\n");
}
return default;
}
}
public static class note_tail_event {
public struct Input {
public dynamic br;
}
public static dynamic handler(Input __koru_input) {
var br = __koru_input.br;
var result_4 = main_module.std_bridge_run_event.handler(new std_bridge_run_event.Input { br = br, source = (string)("note(text: bare prose, the natural spelling)echo(text: \"reached\")")});
if (result_4.tag == "result") {
var r = result_4.result;
__koru_stdout_write(" FAIL tail RESULT " + __koru_str(r.value.branch) + "\n");
}
if (result_4.tag == "event-denied") {
var ev = result_4.event_denied;
__koru_stdout_write(" FAIL tail DENIED " + __koru_str(ev) + "\n");
}
if (result_4.tag == "dispatch-error") {
var e = result_4.dispatch_error;
__koru_stdout_write(" FAIL tail DISPATCH " + __koru_str(e.message) + "\n");
}
if (result_4.tag == "residue") {
var _auto_32 = result_4.residue;
__koru_stdout_write(" FAIL tail RESIDUE (tail swallowed)" + "\n");
}
if (result_4.tag == "parse-error") {
var e = result_4.parse_error;
__koru_stdout_write(" FAIL tail PARSE " + __koru_str(e.message) + "\n");
}
if (result_4.tag == "unhandled-branch") {
var u = result_4.unhandled_branch;
__koru_stdout_write(" FAIL tail UNHANDLED " + __koru_str(u.branch) + "\n");
}
if (result_4.tag == "defined") {
var _auto_33 = result_4.defined;
__koru_stdout_write(" FAIL tail DEFINED" + "\n");
}
if (result_4.tag == "exhausted") {
var _auto_34 = result_4.exhausted;
__koru_stdout_write(" FAIL tail EXHAUSTED" + "\n");
}
if (result_4.tag == "validation-error") {
var e = result_4.validation_error;
__koru_stdout_write(" FAIL tail VALIDATION " + __koru_str(e) + "\n");
}
if (result_4.tag == "shape-error") {
var _auto_35 = result_4.shape_error;
__koru_stdout_write(" FAIL tail SHAPE" + "\n");
}
if (result_4.tag == "scope-not-found") {
var _auto_36 = result_4.scope_not_found;
__koru_stdout_write(" FAIL tail NO SCOPE" + "\n");
}
if (result_4.tag == "partial") {
var p = result_4.partial;
__koru_stdout_write(" tail partial wire_failures=" + __koru_str(p.wire_failures) + "\n" + __koru_str(p.report) + "\n");
}
return default;
}
}
public static class denied_note_event {
public struct Input {
public dynamic br;
}
public static dynamic handler(Input __koru_input) {
var br = __koru_input.br;
var result_5 = main_module.std_bridge_run_event.handler(new std_bridge_run_event.Input { br = br, source = (string)("note(text: \"can you hear me\")")});
if (result_5.tag == "result") {
var r = result_5.result;
__koru_stdout_write(" FAIL denied RESULT " + __koru_str(r.value.branch) + "\n");
}
if (result_5.tag == "event-denied") {
var ev = result_5.event_denied;
__koru_stdout_write(" denied: event-denied " + __koru_str(ev) + "\n");
}
if (result_5.tag == "dispatch-error") {
var e = result_5.dispatch_error;
__koru_stdout_write(" FAIL denied DISPATCH " + __koru_str(e.message) + "\n");
}
if (result_5.tag == "residue") {
var _auto_37 = result_5.residue;
__koru_stdout_write("FAIL: residue outcome" + "\n");
}
if (result_5.tag == "parse-error") {
var e = result_5.parse_error;
__koru_stdout_write(" FAIL denied PARSE " + __koru_str(e.message) + "\n");
}
if (result_5.tag == "unhandled-branch") {
var u = result_5.unhandled_branch;
__koru_stdout_write(" FAIL denied UNHANDLED " + __koru_str(u.branch) + "\n");
}
if (result_5.tag == "defined") {
var _auto_38 = result_5.defined;
__koru_stdout_write(" FAIL denied DEFINED" + "\n");
}
if (result_5.tag == "exhausted") {
var _auto_39 = result_5.exhausted;
__koru_stdout_write(" FAIL denied EXHAUSTED" + "\n");
}
if (result_5.tag == "validation-error") {
var e = result_5.validation_error;
__koru_stdout_write(" FAIL denied VALIDATION " + __koru_str(e) + "\n");
}
if (result_5.tag == "shape-error") {
var _auto_40 = result_5.shape_error;
__koru_stdout_write(" FAIL denied SHAPE" + "\n");
}
if (result_5.tag == "scope-not-found") {
var _auto_41 = result_5.scope_not_found;
__koru_stdout_write(" FAIL denied NO SCOPE" + "\n");
}
if (result_5.tag == "partial") {
var _auto_42 = result_5.partial;
__koru_stdout_write(" FAIL denied PARTIAL" + "\n");
}
return default;
}
}
public static class std_io_free_event {
public struct Input {
public string content;
}
public static dynamic handler(Input __koru_input) {
var content = __koru_input.content;
// The host owns memory — a Koru string is a managed C# string and the
// GC settles the `allocated!` debt. Empty by construction.
return default;
}
}
public static class std_io_print_ln_event {
public struct Input {
public dynamic expr;
public dynamic invocation;
public dynamic item;
public dynamic program;
public dynamic reporter;
public dynamic allocator;
}
public static dynamic handler(Input __koru_input) {
var expr = __koru_input.expr;
var invocation = __koru_input.invocation;
var item = __koru_input.item;
var program = __koru_input.program;
var reporter = __koru_input.reporter;
var allocator = __koru_input.allocator;
throw new global::System.Exception("ln: [transform] tor is lowered at compile time and must never be called");
}
}
public static class std_bridge_close_event {
public struct Input {
public dynamic br;
}
public static dynamic handler(dynamic __koru_input) {
throw new global::System.Exception("std.bridge:close has no C# implementation — its body resolves only to a non-cs target (|zig / [comptime]), directly or through a callee");
}
}
public static class std_bridge_create_event {
public struct Input {
public dynamic id;
public dynamic scope;
public dynamic introspection;
public dynamic world;
}
public static dynamic handler(dynamic __koru_input) {
throw new global::System.Exception("std.bridge:create has no C# implementation — its body resolves only to a non-cs target (|zig / [comptime]), directly or through a callee");
}
}
public static class std_bridge_run_event {
public struct Input {
public dynamic br;
public dynamic source;
}
public static dynamic handler(dynamic __koru_input) {
throw new global::System.Exception("std.bridge:run has no C# implementation — its body resolves only to a non-cs target (|zig / [comptime]), directly or through a callee");
}
}
public static class std_interpreter_value_stringify_event {
public struct Input {
public dynamic value;
}
public static dynamic handler(dynamic __koru_input) {
throw new global::System.Exception("std.interpreter:stringify has no C# implementation — its body resolves only to a non-cs target (|zig / [comptime]), directly or through a callee");
}
}
public static class koru_start_event {
public struct Input {
}
public struct Output {
public string tag;
public dynamic done;
}
public static Output handler(Input __koru_input) => new Output { tag = "done" };
}
public static class koru_end_event {
public struct Input {
}
public struct Output {
public string tag;
public dynamic done;
}
public static Output handler(Input __koru_input) => new Output { tag = "done" };
}
public static void flow0() {
var br = main_module.std_bridge_create_event.handler(new std_bridge_create_event.Input { id = (string)("s1"), scope = (string)("echo"), introspection = (bool)(true)});
__koru_stdout_write("--- granted session" + "\n");
main_module.noted_event.handler(new noted_event.Input { br = br});
main_module.note_chain_event.handler(new note_chain_event.Input { br = br});
main_module.note_no_arg_event.handler(new note_no_arg_event.Input { br = br});
main_module.note_rname_event.handler(new note_rname_event.Input { br = br});
main_module.note_tail_event.handler(new note_tail_event.Input { br = br});
__koru_stdout_write("--- ungranted session" + "\n");
var br2 = main_module.std_bridge_create_event.handler(new std_bridge_create_event.Input { id = (string)("s2"), scope =
... [truncated - 20KB total]Flows
flow ~register click a branch to expand · @labels scroll to their anchor
register (scope: "echo", source: echo(1))
subflow ~noted click a branch to expand · @labels scroll to their anchor
run (br, source: "note(text: \"checking tier before touching the reservation\")")
subflow ~note-chain click a branch to expand · @labels scroll to their anchor
run (br, source: "note(text: \"plan: greet, then book\")\n| ok n |> echo(text: n)")
subflow ~note-no-arg click a branch to expand · @labels scroll to their anchor
run (br, source: "note()")
subflow ~note-rname click a branch to expand · @labels scroll to their anchor
run (br, source: "note(text: r1)")
subflow ~note-tail click a branch to expand · @labels scroll to their anchor
run (br, source: "note(text: bare prose, the natural spelling)echo(text: \"reached\")")
subflow ~denied-note click a branch to expand · @labels scroll to their anchor
run (br, source: "note(text: \"can you hear me\")")
flow ~create click a branch to expand · @labels scroll to their anchor
create (id: "s1", scope: "echo", introspection: true)
Test Configuration
MUST_RUN JS_REFUSES LANGUAGES: zig js cs
JS must refuse with:
error[KORU047]