summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 02:07:32 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit83b9d45b8665a80bdb70934aa23bbde5cc03d202 (patch)
treec902b557ef624b07cd139659d0a891cd4809e03e /src/ninep
parentb3d32656413734952bc918c2d4cfd12fede6c214 (diff)
downloadpardes-83b9d45b8665a80bdb70934aa23bbde5cc03d202.tar.gz
pardes-83b9d45b8665a80bdb70934aa23bbde5cc03d202.zip
plumber: a look sends what it looks at (docs/next-plumber.md, phase 2): after the pane's own readings and once a name already open in a pane is focused (never sent), lookAt sends the trimmed name, type text, src pardes (term from a raw terminal, a kind's name from its pane), wdir the pane's directory, with what resolveLookTarget found of it (Plumb.Seen: isfile and isdir take it, so no second stat and Look's own readings of a URL or `//` stay no file); a message the rules give back to `edit` as sent is Look's own (Sent.look) and runs lookAt's switch on that target, one nothing takes or a started word declines is Look's own too, whose `.url` arm is now the word's search; the edit port's open of another message runs with look_text, which now means "unplumbed", so the edit port's lookAt never sends again (the recursion trap); the three diff hooks become the default rules of the record's §5.2 (a bare .diff/.patch to `Diff $file`, a commit hash in the editor to `Diff $0`, after the two edit sets), and `Diff` takes a file or a revision, a rule's Diff declining in silence (Pardes.plumb_declined) where it cannot (no hunk, not readable, no .git above): hunks.lookedAt and lookedAtCommit go, their bodies in hunks.word, the `needs` check of the bare form in the word, PaneKind.diff gone; the old one-line `Plumb` word, Core.plumb, look.Port, plumbRuleError, plumbTarget and resolve's rules block go: bare, `Plumb` opens <config>/plumbing as Config opens init (both through builtins.openConfigFile; `include basic` in a new one), an argument is refused in words, Save applies it (host_io.writeFile beside reapplyInitFile, Plumb.saved), and boot reads it (Plumb.boot in applyStartupConfig); a started program now runs detached as Plan 9's plumber's (the coordinator's decision for the user's question 4): Effect.start, every host's host_io.startDetached (double fork, setsid, /dev/null for 0-2, every other fd closed, argv exec'd in wdir with no shell, the child's errno back through a close-on-exec pipe, said as `plumb start: <prog>: <why>`), so exec_dir goes; resolveLookTarget's and Plumb.Send.search's directory walk is one look.Dirs; test: look.zig's Plumb test rewritten onto the rules (a rule's word, an open pane unsent, the hover's resolve, a URL with no web rule searched for) and a hash inside and outside a git work tree; addons.zig's Plumb test onto plumb/rules (a port no kind reads, its kind gone: Look's own); Plumb.zig: the word, the save and boot; replicas.zig gains a URL (speculated whole, confirmed, no rollback) and a hash, each the authority's and a replica's own; every look golden unchanged; the reference quotes src/plumbing whole and says the order, the changelog says so
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/tree.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index 8902f11e..bd3f3b3b 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -1408,7 +1408,7 @@ fn writeNow(p: *Pardes, req: Req, target: Target) Reply {
fn writeRules(p: *Pardes, req: Req) Reply {
const done: Reply = .{ .tag = req.tag, .written = @intCast(req.data.len) };
// A close's rest (runClosedLines), or a write with no open: whole.
- const o = openOf(p, req) orelse return if (Plumb.apply(p, true, req.data)) |why| failText(req.tag, E.INVAL, why) else done;
+ const o = openOf(p, req) orelse return if (Plumb.apply(p, true, "plumb/rules", req.data)) |why| failText(req.tag, E.INVAL, why) else done;
if (o.pending.items.len + req.data.len > Plumb.max_text) {
o.pending.clearRetainingCapacity();
return failText(req.tag, E.INVAL, std.fmt.comptimePrint("rules too long; max {d} KiB", .{Plumb.max_text / 1024}));
@@ -1416,7 +1416,7 @@ fn writeRules(p: *Pardes, req: Req) Reply {
o.pending.appendSlice(p.gpa, req.data) catch return Reply.fail(req.tag, E.NOMEM);
const end = Plumb.wholeSets(o.pending.items);
if (end == 0) return done;
- const why = Plumb.apply(p, true, o.pending.items[0..end]);
+ const why = Plumb.apply(p, true, "plumb/rules", o.pending.items[0..end]);
if (why != null) o.pending.clearRetainingCapacity() else {
const rest = o.pending.items.len - end;
std.mem.copyForwards(u8, o.pending.items[0..rest], o.pending.items[end..]);
@@ -1449,7 +1449,10 @@ fn writeSend(p: *Pardes, req: Req) Reply {
},
.msg => |m| {
defer if (o) |op| op.pending.clearRetainingCapacity();
- if (Plumb.send(p, null, m)) |why| return failText(req.tag, E.IO, why);
+ switch (Plumb.send(p, null, m, null)) {
+ .refused => |why| return failText(req.tag, E.IO, why),
+ .done, .look => {},
+ }
return .{ .tag = req.tag, .written = @intCast(req.data.len) };
},
}