Skip to content

script: PR-A.4 — promote translator from internal/ to pkg/script/#14

Merged
vinodhalaharvi merged 1 commit into
mainfrom
claude/translator-public
May 21, 2026
Merged

script: PR-A.4 — promote translator from internal/ to pkg/script/#14
vinodhalaharvi merged 1 commit into
mainfrom
claude/translator-public

Conversation

@vinodhalaharvi-claude
Copy link
Copy Markdown
Collaborator

What

Makes the translator importable from outside the agentscript module so loom can depend on it. Go's internal/ rule confines internal/agentscript/script/ to the agentscript module; loom is a separate module and can't import it. This moves the whole translator package to pkg/script/, matching the repo's existing pkg/ convention.

Pure move + import-path rewrite — no logic changes.

  • git mv internal/agentscript/script → pkg/script (carries ast/, registry/, resolved/ sub-packages and all phase files)
  • Rewrote every import of .../internal/agentscript/script.../pkg/script across the package's cross-imports, tests, and cmd/agentscript-run

The legacy in-process runtime (grammar.go, runtime.go, translator.go, …) stays in internal/agentscript/ — it's the old DSL evaluator, correctly module-private.

Public surface now at github.com/vinodhalaharvi/agentscript/pkg/script

This is exactly what loom will call:

  • Compile(ctx, registry, Source) → (sibyl.Plan, error) — source to validated Plan, no submission
  • Submit / SubmitWith / Run — start the Plan as a Sibyl PlanWorkflow
  • DefaultRegistry() / EchoSpec() — the builtin registry; registry.Names() lists builtins (for an LLM prompt)
  • Parse / Resolve / Lower / Finalize / Validate — individual phases, for finer control
  • Typed errors (UnknownBuiltinError, ArityError, ArgTypeError) so a caller distinguishes bad DSL from execution failure — the safety net around an LLM that emits DSL

Docs updated

  • docs/dsl-to-sibyl-translator.md: status → Translator MVP complete; phase table marks Lower/Finalize/Validate/Submit Merged at pkg/script/, notes the lowering target is Sibyl's serializable Plan
  • README.md: the two internal/agentscript/script/ path references corrected

Verified

Build clean, pkg/script tests pass, and the demo compiles identically — agentscript-run --dry-run examples/translator-echo.as produces the same two-node Plan (n1 requires n0).

Step Result
go mod tidy (+ diff) ✅ no change (pure move)
go vet -structtag=false ./...
gofmt -l .
staticcheck ./...
go test -race ./...
go build ./...

Next

loom PR-3 — depend on agentscript/pkg/script, add the prose→DSL LLM step: Slack message → LLM emits AgentScript → script.Compile validates it → script.Submit runs it on Sibyl. The translator is the serialization layer; loom's LLM becomes its author.

Makes the translator importable from outside the agentscript module so
loom can depend on it. Go's internal/ rule confines
internal/agentscript/script/ to the agentscript module; loom is a
separate module and cannot import it. This moves the whole translator
package to pkg/script/, matching the repo's existing pkg/ convention
for importable code.

Pure move + import-path rewrite — no logic changes:
  - git mv internal/agentscript/script -> pkg/script (carries ast/,
    registry/, resolved/ sub-packages and all phase files).
  - Rewrote every import of
    .../internal/agentscript/script -> .../pkg/script across the
    package's own cross-imports, the tests, and cmd/agentscript-run.

The legacy in-process runtime (grammar.go, runtime.go, conditional.go,
loop.go, translator.go, registry.go, emoji_style.go) stays in
internal/agentscript/ — it's the old DSL evaluator, not part of the
public translator surface, and correctly remains module-private.

Public surface now available at github.com/vinodhalaharvi/agentscript/pkg/script:
  - Compile(ctx, registry, Source) (sibyl.Plan, error) — source to
    validated Plan, no submission.
  - Submit / SubmitWith / Run — start the Plan as a Sibyl PlanWorkflow.
  - DefaultRegistry() / EchoSpec() — the builtin registry; front ends
    extend it. registry.Names() lists builtins (for an LLM prompt).
  - Parse / Resolve / ResolveWith / Lower / Finalize / Validate — the
    individual phases, for callers that want finer control.
  - Typed errors (UnknownBuiltinError, ArityError, ArgTypeError) so a
    caller can distinguish 'bad DSL' from 'execution failure'.

Docs updated to the new path and current status:
  - docs/dsl-to-sibyl-translator.md: status line now 'Translator MVP
    complete'; the phase table marks Lower/Finalize/Validate/Submit
    Merged at pkg/script/ and notes the lowering target is Sibyl's
    serializable Plan (not the removed in-process DAG).
  - README.md: the two internal/agentscript/script/ path references
    corrected to pkg/script/.

Verified after the move: build clean, pkg/script tests pass, and the
demo still compiles identically — agentscript-run --dry-run
examples/translator-echo.as produces the same two-node Plan (n1
requires n0).

All CI steps pass: go mod tidy (no change — pure move), go vet
-structtag=false, gofmt, staticcheck, go test -race ./..., go build
./....
@vinodhalaharvi vinodhalaharvi merged commit 62bc0a7 into main May 21, 2026
1 check passed
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.

2 participants