mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
* Run personal commands in embedded QuickJS instead of Bun Hex now runs ~/.config/hex/hex.config.ts in-process: rquickjs on one worker thread, TypeScript erased to same-position JavaScript with oxc's parser, per-call time limits and a runtime memory limit, and no filesystem, network, process, or timer API. Handlers return actions that Hex validates and runs on its native executor. The Bun host, managed SDK provisioning, bun update, the sdk/commands workspace, and their scripts and CI steps are gone; Hex writes hex.d.ts typings instead, and hex commands check replaces bun run check. Plan and measurements: docs/plans/quickjs.md. * Spell out a range check that a new dependency's impls made ambiguous
3 KiB
3 KiB
| name | description | license |
|---|---|---|
| hex-personal-commands | Configure Hex personal voice commands, voice-dictation control phrases, and deterministic transcript transformations. Use when the user wants to add or change commands or transformations for the Hex voice app. | MIT |
Hex Personal Commands
Hex runs ~/.config/hex/hex.config.ts itself, in an embedded JavaScript
engine. There is no package to install and no build step.
- Check for
~/.config/hex/hex.config.ts(orhex.config.js). If it is missing, ask the user to open Hex's Commands pane and choose Create Config, or runhex commands initif thehexCLI is available. - Read
~/.config/hex/AGENTS.mdfor the current API and limits, andhex.d.tsfor exact types. Hex owns both and rewrites them; do not edit them. - Edit only the config and files it imports. Scripts are plain TypeScript or
JavaScript: they can import
@hex/commandsand files in the folder, not npm packages, Effect, or Node APIs, and they have no filesystem, network, or timer access. Enums, namespaces, and constructor parameter properties are rejected. - Use
defineHexConfigfrom@hex/commands. A command hasphrasesand either a fixedaction(such asopenUrl(...)) or arunhandler that returns an action, a list of actions, or nothing (it may also queue actions through itshexargument). Hex runs the actions after the handler returns. - Keep command phrases unambiguous. Use
digit()for zero through nine,digit({ min, max })for a restricted range,choice(["left", "right"] as const)for exact choices, an object-formchoice()to normalize one-word aliases to canonical keys,union(letter(), digit(), choice(["home", "end"] as const))for disjoint bounded one-token alternatives, and trailingtext()for explicit text captures.letter()accepts literal, common spoken, and one-word NATO letter names and returns lowercase"a" | ... | "z". With acapturesschema, every phrase alias must bind every declared name exactly once. - Spoken commands and dictation controls need the Commands opt-in, which defaults off; creating a config does not enable it. Transformations must be selected in the mode's Transformations section and can run with Commands off. They run after mode corrections and optional AI rewriting, not for Voice Action or meetings. Do not enable voice commands merely to run a transformation.
- Run
hex commands check(macOS) after editing. It loads the config as Hex does and prints what it registers or the error with file, line, and column, including phrase overlaps. Optionally type-check withnpx -y -p typescript tscin~/.config/hex. A running Hex reloads the config on save and shows load errors in Modes' Transformations section.
Completion criterion: the requested behavior is represented in the config,
hex commands check succeeds (or, without the CLI, the reload succeeded in
Hex), and any verification gap is reported.