Skip to content

feat(rutis): a go feature — Go plugins through the bridge - #304

Merged
yuanhao merged 2 commits into
mainfrom
feat/rutis-go
Oct 12, 2026
Merged

yuanhao merged 2 commits into
mainfrom
feat/rutis-go

Conversation

@yuanhao

@yuanhao yuanhao commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Contains #303's Bun commit. Merge #303 first; this diff then shrinks to the Go work. (A PR whose base isn't main gets no CI.)

rutis 0.9 adds Go runtimes: a plugin built with the rutis Go SDK is a binary, one runtime each, started when a go:<plugin> row needs it. A spike showed the bridge's contract holds for Go unchanged, with no upstream change needed:

  • Handlers: a Go plugin registers a map of Go functions (functions cross by reference, as a Python dict's do).
  • Cancellation: when the host gives a call up (run cancel, hook timeout, unload), the Go call's context.Context is cancelled, the same contract as a JavaScript hook's AbortSignal.
  • The signal field in a hook's first argument decodes as nothing in Go, so typed structs are unaffected.

Changes

  • go = ["rutis-bridge/go"]; the yoagent host service's gates include it.
  • plugins/go/ is a working example (own go.mod, go 1.24, rutis Go SDK v0.9.1): a before_tool that denies bash, a slow policy that watches ctx.Done(), and a go_echo tool.
  • tests/go_test.rs (required-features = ["go"]) builds it with go build and runs it through GoResolver + GoRuntimes. It checks three things: the Go tool answers; Go's denial stops bash before it runs; and a 300 ms policy timeout cancels Go's context (Go records ctx.Done()). Without Go 1.24+ it prints SKIPPED:, or fails with YOAGENT_RUTIS_REQUIRE_RUNTIMES=1.
  • CI: actions/setup-go 1.24 in the languages job; clippy, doc and test with go; the MSRV check includes it.
  • Docs: README feature table, crate docs, CLAUDE.md.

Checked locally (Go 1.27.1, Bun 1.4.3, runtimes required): clippy (go, and all features) and docs clean; every suite passes with node,python,bun,go,websocket.

With #303, yoagent-rutis 0.3.0 runs plugins in Rust, TypeScript (Node or Bun), Python and Go.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG

yuanhao and others added 2 commits October 12, 2026 11:13
rutis 0.9 adds Go runtimes: a plugin built with the rutis Go SDK is a
binary, one runtime each, started when a `go:<plugin>` row needs it. A Go
plugin reaches the `yoagent` host service like any other:

- the handler is a map of Go functions (functions cross by reference);
- the `signal` field of a hook's first argument decodes as nothing, so
  typed structs are unaffected;
- when the host gives a call up (run cancel, hook timeout, unload), the Go
  call's context.Context is cancelled — the same contract as a JavaScript
  hook's AbortSignal.

`go = ["rutis-bridge/go"]`; plugins/go/ is a working example (a policy
denying `bash`, a slow policy watching ctx.Done(), a `go_echo` tool);
tests/go_test.rs builds it with the local Go toolchain and checks the tool,
the denial and the cancelled context through GoResolver + GoRuntimes.
CI: setup-go 1.24 in the languages job; clippy/doc/test with `go`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
…fails, docs

- go_test: a failed `go build` with Go present fails the test (it was a
  skip); covers an after_tool redaction from Go, Go's denial / returned
  error / malformed answer each denying, the timeout reason, a run cancel
  cancelling the Go call's context, and unloading the row removing the
  handler (the disposer Effect), after which `bash` runs.
- plugins/go: `record` reports its own errors on stderr; the doc says a
  hook's context also ends when the hook returns (the SDK's defer cancel),
  so watch it only while the call runs; register's missing disposer is an
  error.
- Docs: languages.rs, lib.rs, README handler shapes include Go; CLAUDE.md
  "decodes as nil"; CI comment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
@yuanhao
yuanhao merged commit 0bab3d0 into main Oct 12, 2026
17 checks passed
@yuanhao
yuanhao deleted the feat/rutis-go branch October 12, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant