A3e item 1: the tool runner serves through mesh-sdk's gate, translating the contracts for it
Builds: design 47 G §677, §700, lead answers A-219, A-224, A-228 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -12,8 +12,8 @@ import (
|
||||
"git.novox.be/novox/mesh-sdk/go/busretry"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/approval"
|
||||
|
||||
"github.com/novox/mesh-tools/node-tools/internal/approval"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/bus"
|
||||
)
|
||||
|
||||
|
||||
@@ -13,10 +13,11 @@ import (
|
||||
"git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
|
||||
seat "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
|
||||
catalogseat "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
||||
"git.novox.be/novox/mesh-sdk/go/approval"
|
||||
"git.novox.be/novox/mesh-sdk/go/seatdef"
|
||||
"github.com/nats-io/nats.go"
|
||||
runnerapproval "github.com/novox/mesh-tools/node-tools/internal/approval"
|
||||
|
||||
"github.com/novox/mesh-tools/node-tools/internal/approval"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/bus"
|
||||
mt "github.com/novox/mesh-tools/node-tools/internal/meshtest"
|
||||
)
|
||||
@@ -28,12 +29,14 @@ var wipeEntry = catalogseat.CatalogEntry{Module: "shell", Fp: "src2:1", Manifest
|
||||
|
||||
func (marked) Ready() error { return nil }
|
||||
func (marked) Revision() string { return "7" }
|
||||
func (marked) Served(fp string) (catalogseat.CatalogEntry, bool, string) {
|
||||
return wipeEntry, fp == wipeEntry.Fp, "not-found"
|
||||
func (marked) Served(fp string) (approval.Entry, bool, string) {
|
||||
return runnerapproval.Entry(wipeEntry), fp == wipeEntry.Fp, "not-found"
|
||||
}
|
||||
func (marked) Newest(m string) (catalogseat.CatalogEntry, bool) { return wipeEntry, m == "shell" }
|
||||
func (marked) Definitions() map[string]seatdef.Definition { return map[string]seatdef.Definition{} }
|
||||
func (marked) Entries() []catalogseat.CatalogEntry { return []catalogseat.CatalogEntry{wipeEntry} }
|
||||
func (marked) Newest(m string) (approval.Entry, bool) {
|
||||
return runnerapproval.Entry(wipeEntry), m == "shell"
|
||||
}
|
||||
func (marked) Definitions() map[string]seatdef.Definition { return map[string]seatdef.Definition{} }
|
||||
func (marked) Entries() []approval.Entry { return []approval.Entry{runnerapproval.Entry(wipeEntry)} }
|
||||
|
||||
// bed is the runner's gate wired as main wires it, over the runner's own connection to a real bus, with stand-ins of the
|
||||
// operator channel's router (it takes each ask into its record asks, as the router writes it) and of the hand-act seat.
|
||||
@@ -143,9 +146,11 @@ func (b *bed) gate(record func(func())) *approval.Gate {
|
||||
record = func(f func()) { f() }
|
||||
}
|
||||
g := approval.New(approval.Deps{Node: "n1", Runner: "node-tools", Catalog: marked{}, Logf: b.t.Logf,
|
||||
State: approvalsState{conn: b.conn, module: "node-tools"}, Publish: publishAsk(b.conn), Record: routerRecord(b.conn),
|
||||
State: approvalsState{conn: b.conn, module: "node-tools"},
|
||||
Channel: &operatorchannelclient.GateChannel{State: approvalsState{conn: b.conn, module: "node-tools"}, KeyPrefix: "n1.",
|
||||
Publish: publishAsk(b.conn), ReadRecord: routerRecord(b.conn)},
|
||||
Warranted: warranted(b.conn), Bounds: boundState{conn: b.conn, module: "node-tools"}, Go: record,
|
||||
Holder: approval.HoldersIn(func() (map[string][]byte, error) {
|
||||
Holder: runnerapproval.HoldersIn(func() (map[string][]byte, error) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
return b.holders, nil
|
||||
|
||||
@@ -26,9 +26,11 @@ import (
|
||||
"time"
|
||||
|
||||
handacts "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshhandacts"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/alive"
|
||||
"git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
|
||||
"git.novox.be/novox/mesh-sdk/go/approval"
|
||||
|
||||
"github.com/novox/mesh-tools/node-tools/internal/approval"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/alive"
|
||||
runnerapproval "github.com/novox/mesh-tools/node-tools/internal/approval"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/bus"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/console"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/firstview"
|
||||
@@ -77,10 +79,12 @@ func main() {
|
||||
// ADR 0615 §1; design 46 7-approval-mark §5).
|
||||
source, stopViews := firstview.Start(context.Background(), conn, log.Printf)
|
||||
defer stopViews()
|
||||
approvals := approvalsState{conn: conn, module: cred.Module}
|
||||
gate := approval.New(approval.Deps{Node: conn.Node(), Runner: cred.Module, Catalog: source.ApprovalCatalog(definitionsOf(seatList)), Wait: source.WaitCatalog,
|
||||
Findings: source.Findings(), Logf: log.Printf, State: approvalsState{conn: conn, module: cred.Module},
|
||||
Publish: publishAsk(conn), Record: routerRecord(conn), Warranted: warranted(conn), Bounds: boundState{conn: conn, module: cred.Module},
|
||||
Holder: approval.HoldersIn(func() (map[string][]byte, error) { return source.State(firstview.SeatHoldersRead) }),
|
||||
Findings: runnerapproval.Findings(source.Findings(), conn.Node(), cred.Module, nil), Logf: log.Printf, State: approvals,
|
||||
Channel: &operatorchannelclient.GateChannel{State: approvals, KeyPrefix: conn.Node() + ".", Publish: publishAsk(conn), ReadRecord: routerRecord(conn)},
|
||||
Warranted: warranted(conn), Bounds: boundState{conn: conn, module: cred.Module},
|
||||
Holder: runnerapproval.HoldersIn(func() (map[string][]byte, error) { return source.State(firstview.SeatHoldersRead) }),
|
||||
// The runner's own build, the one a marked wait's act binds (design 34 every-event §35).
|
||||
Build: os.Getenv(runtime.FingerprintWord), Hear: hearOne(conn)})
|
||||
// A failed read or write of the state approvals is made again at the next membership change the runner hears (A-157).
|
||||
|
||||
Reference in New Issue
Block a user