Skip to content

Runtime Scripts: compile TypeScript authoring output to Lua #320

Closed

Description

@Mathih13

This was generated by AI during triage.

Agent Brief

Category: enhancement
Summary: Add the Package-author TypeScript-to-Lua build path while keeping Lua as the runtime contract.

Current behavior:
The piccolo spike includes representative generated Lua, but Packages cannot build Runtime Script TypeScript or ship a reconciled artifact.

Desired behavior:
Use the pinned Bun Package toolchain and a pinned TypeScript-to-Lua configuration to compile scripts/*.ts into deterministic Lua artifacts. Hand-written Lua enters the same artifact and runtime path. Generated code targets the semantics verified by the piccolo spike and is measured against the same fuel budget. Runtime diagnostics identify the generated Lua location. Source-map support may follow later.

Key interfaces:

  • Runtime Script TypeScript authoring types
  • TypeScript-to-Lua build configuration
  • Package script artifact
  • Hand-written Lua inclusion rule

Acceptance criteria:

  • A typed event handler builds into Lua accepted by the Runtime Script host.
  • The same sources and locked tools produce byte-identical artifacts.
  • Hand-written Lua and generated Lua reconcile through one Package contract.
  • CI typechecks TypeScript and rejects stale generated Lua.
  • Fuel tests include representative generated code.
  • Operators do not need Bun to publish prebuilt Runtime Scripts.

Out of scope:

  • Client addon TypeScript
  • Source-map presentation beyond generated Lua locations
  • Raw script uploads

Activity

  1. added
    enhancementNew feature or request
    P3someday / nice-to-have
    ready-for-agentComplete enough to build from the issue alone, by a person or their agent
    on Aug 24, 2026
  2. Mathih13 commented on Aug 24, 2026

    @Mathih13
    ContributorAuthor

    This was generated by AI during triage.

    Handoff from the #317 implementation (PR #324): piccolo 0.3.3 miscompiles f({...}) — it passes the table constructor's element count as an extra argument, so f({7,8,9}) reaches a 3-param f as f(table, 3, nil). Reproduced in the untouched spike harness, so it is the engine, not the host. Transpiled TS output leans on this call shape (x = x or default chains), so the TS→Lua build must avoid or rewrite direct table-constructor call arguments. A pinning test in module/src/runtime_script.rs fails when the engine fixes it.

  3. Mathih13 commented on Sep 3, 2026

    @Mathih13
    ContributorAuthor

    PRs filed 2026-09-02: core #402 (Runtime Script authoring types, the pinned typescript-to-lua build under the Datascript Bun project, the piccolo table-constructor rewrite with a pinning test, fuel coverage for generated Lua, docs and glossary) and CLI LyraCoreProject/lyracore-cli#55 (packages build compiles packages/<name>/scripts/*.ts and includes *.lua, writes the Script Artifact plus a script.identity sidecar; packages check verifies it). Decisions made and named in the PRs: sources live inside the Package folder; @id is author-written; each script compiles as its own program. Byte-identical rebuilds were verified by hand. The end-to-end run through the ./lyracore shim waits for the pin bump after the CLI PR merges. Orchestrated by Claude (model claude-fable-5-1) via Claude Code.

  4. Mathih13 commented on Sep 3, 2026

    @Mathih13
    ContributorAuthor

    Merged 2026-09-03: core PR 402 (authoring types, pinned typescript-to-lua build under the Datascript Bun project, piccolo call-shape rewrite with a pinning test, fuel coverage) and CLI PR 55 (packages build compiles scripts/*.ts, includes *.lua, writes the Script Artifact and its Build Identity; packages check verifies it), pinned by core PR 406. Byte-identical rebuilds verified; Operators install prebuilt artifacts and need no Bun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3someday / nice-to-haveenhancementNew feature or requestready-for-agentComplete enough to build from the issue alone, by a person or their agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions