script: complete builtin catalog + per-backend availability#17
Merged
Conversation
Makes the registry COMPLETE and backwards-compatible: every verb the
AgentScript grammar has ever supported is now recognized, and
availability is decided per-backend rather than per-existence. This
separates two situations that used to collapse into one error:
- 'unknown verb' (typo, hallucination) → UnknownBuiltinError
- 'known verb, not on this backend yet' → NotImplementedOnBackendError (NEW)
Before: the temporal registry held only echo, so 'hf_summarize' under
temporal failed as UnknownBuiltinError — indistinguishable from a real
typo, and a lie (it IS a real verb, just memory-only). After: it
resolves as known vocabulary and reports 'not implemented on the
temporal backend yet'. The in-memory interpreter still implements the
full set, so the vocabulary the registry advertises matches reality.
Changes:
- registry.BuiltinSpec gains a Backends []Backend field +
SupportsBackend(b). registry.Backend enum (BackendMemory,
BackendTemporal) — the registry is the single source of truth for
'what runs where', with no dependency on the ast package. Empty
Backends defaults to memory-only: the SAFE default, so a verb with
no declared Sibyl activity is never dispatched to Temporal.
- pkg/script/catalog.go: CompleteRegistry() — all 111 historical verbs
(sourced from the grammar's authoritative Action enum) as permissive
memory-backed specs, plus echo (memory + temporal). Arg schemas are
intentionally variadic-string: the registry's job for memory verbs
is vocabulary recognition; the in-process interpreter does its own
arg handling. DefaultRegistry (echo only) stays for the minimal
temporal-only case.
- Resolve threads the block's backend down to each Call and performs
an availability check AFTER the vocabulary lookup: unknown name →
UnknownBuiltinError (safety net intact); known but unsupported
backend → NotImplementedOnBackendError.
- EchoSpec now declares both backends.
Tested contract (catalog_test.go):
- CompleteRegistry recognizes a representative spread of all verb
families (hf_*, mcp_*, perplexity*, weather/stock/crypto, control
flow, exec, ...).
- memory-only verb RESOLVES under memory; under temporal it fails with
NotImplementedOnBackendError and explicitly NOT UnknownBuiltinError.
- echo compiles end-to-end on temporal and resolves on memory.
- SAFETY NET preserved: 'teleport' is still UnknownBuiltinError on
BOTH backends.
- empty Backends ⇒ memory-only (no accidental temporal dispatch).
Note on Compile vs Resolve in tests: memory *execution* (Finalize for
the memory backend) is the NEXT step; this PR establishes the registry +
resolution contract, so memory-backend assertions stop at Resolve.
loom is UNTOUCHED: changes are purely additive (new field, new error
type). Verified by building + testing loom against this commit with
loom's code unchanged — builds clean, all tests pass. (Whether loom
adopts CompleteRegistry is a separate loom decision.)
CI: go vet -structtag=false, gofmt, staticcheck, go test -race ./...,
go build ./... — all pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the registry complete and backwards-compatible: every verb the AgentScript grammar has ever supported is now recognized, and availability is decided per-backend rather than per-existence. This separates two situations that used to collapse into one error:
UnknownBuiltinErrorNotImplementedOnBackendError(new)Why
Before: the temporal registry held only
echo, sohf_summarizeunder temporal failed asUnknownBuiltinError— indistinguishable from a real typo, and a lie (it is a real verb, just memory-only). After: it resolves as known vocabulary and reports "not implemented on the temporal backend yet." The in-memory interpreter still implements the full set, so the vocabulary the registry advertises matches reality. This is the backwards-compatibility you asked for: every real verb resolves; the backend decides where it can run.Changes
registry.BuiltinSpec.Backends []Backend+SupportsBackend(b). Newregistry.Backendenum (BackendMemory,BackendTemporal) — the registry is the single source of truth for "what runs where," with no dependency onast. EmptyBackends⇒ memory-only (the safe default: a verb with no declared Sibyl activity is never dispatched to Temporal).pkg/script/catalog.go:CompleteRegistry()— all 111 historical verbs (sourced from the grammar's authoritativeActionenum) as permissive memory-backed specs, plusecho(memory + temporal). Arg schemas are intentionally variadic-string: the registry's job for memory verbs is vocabulary recognition; the in-process interpreter does its own arg handling.DefaultRegistry(echo only) stays for the minimal temporal-only case.Calland checks availability after the vocabulary lookup: unknown →UnknownBuiltinError(safety net intact); known-but-unsupported-backend →NotImplementedOnBackendError.EchoSpecnow declares both backends.Tested contract (
catalog_test.go)CompleteRegistryrecognizes a representative spread of all verb families (hf_*,mcp_*,perplexity*, weather/stock/crypto, control flow,exec, …)NotImplementedOnBackendErrorand explicitly notUnknownBuiltinErrorechocompiles end-to-end on temporal and resolves on memoryteleportis stillUnknownBuiltinErroron both backendsBackends⇒ memory-only (no accidental temporal dispatch)(Note: memory execution — Finalize for the memory backend — is the next step. This PR establishes the registry + resolution contract, so memory-backend assertions stop at Resolve.)
loom untouched
Changes are purely additive (new field, new error type). Verified by building + testing loom against this commit with loom's code unchanged — builds clean, all tests pass. Whether loom adopts
CompleteRegistryis a separate loom decision.go vet -structtag=false ./...gofmt/staticcheckgo test -race ./...go build ./...Next
Step 2 — the memory interpreter branch: wire
Finalize/dispatch so amemoryblock actually executes through the in-process runtime via the composed pipeline. Then every one of these now-resolvable verbs runs on memory, end-to-end.