Skip to content

[plugins] Add bounded per-plugin Lua configuration #2188

Description

@Xuepoo

Priority: P1 | Area: plugin | Labels: feat,P1,area:plugin | Milestone: 0.0.24 | RFC: DEC-0117 | Task: CTX-1294

Goal

Add per-plugin user configuration in Lua under $XDG_CONFIG_HOME/bitty/plugins/, consistent with Bitty's Lua configuration model, while preserving a strict no-ambient-authority boundary.

Contract

  • Canonical file: $XDG_CONFIG_HOME/bitty/plugins/<owner>.<name>.lua.
  • Optional short alias: $XDG_CONFIG_HOME/bitty/plugins/<name>.lua only when a complete, current, bounded registry proves the plugin short name is globally unique. If uniqueness cannot be proven, disable the alias. Ambiguous aliases apply to no plugin and produce bounded diagnostics.
  • If both canonical and short-name files exist, canonical wins; the alias is not evaluated and is reported as shadowed.
  • New Lua config has precedence over the legacy $XDG_CONFIG_HOME/bitty/plugins/<owner>.<name>.toml. If no applicable Lua file exists, TOML remains a compatibility fallback. If a Lua file exists but is invalid/unreadable/over budget, fail closed to lower/default settings; do not silently load TOML instead.
  • Evaluate each file in a fresh restricted configuration VM. No bitty global, plugin APIs, host callbacks, filesystem, network, require, package/debug/io/os/load/loadfile/dofile, or capability-granting surface. The VM returns only bounded owned plain data.
  • Enforce source, instruction, wall-clock, memory, depth, key/value, string, and aggregate-data limits. Reject unsupported values, non-finite numbers, malformed shapes, cycles, and excess data.
  • Intersect the returned table with that plugin's manifest-declared settings using strict declared types. Unknown keys are ignored with bounded diagnostics; config cannot grant or alter capabilities.
  • Preserve platform config-root derivation and keep plugin packages and extension data in their existing XDG data directories.

Acceptance criteria

  • Generic restricted plain-data Lua evaluation is implemented separately from Core-specific ConfigData extraction and is covered by negative sandbox/resource tests.
  • Plugin settings loader implements canonical/alias/TOML precedence and collision behavior with path safety tests.
  • Manifest allowlisting and strict type/default behavior remain enforced per plugin generation.
  • Existing flat TOML settings continue working when no applicable Lua config exists.
  • Terminal-platform and plugin-ecosystem canonical docs are synchronized before merge.
  • No release, RSS, or plugin capability claims are inferred from source presence alone.

Activity

  1. added this to the 0.0.24 milestone on Oct 17, 2026
  2. added
    feat
    P1
    area:plugin
    on Oct 17, 2026
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

    P1area:pluginfeat

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions